Add support for package executors and support for PTY handling (#100)

* define contract for package executors

* introduce npx executor

* add npx and pnpx cmd support

* fix typo

* rm PackageExecutor and depend on PackageManager interface

* add support for PTY to handle parent-child process interaction

* refactor PTY handling in proxy flow

* enforce interactiveSession interface check

* close reader explicitly and clean npm version for pkg executors

* rm interaction from interceptors

* add docs and wait for outputRouter before exit

* add support for non interactive TTY for proxy mode

* add support for CI env var check for non interactive tty proxy mode

* update readme to include npx, pnpx support

* Update internal/flows/proxy_flow.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Sahil Bansal <bansalsahil315@gmail.com>

* update ptyx lib

* fix docs typo

---------

Signed-off-by: Sahil Bansal <bansalsahil315@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Sahil Bansal
2026-01-09 22:03:42 +05:30
committed by GitHub
co-authored by Copilot
parent a373b5b243
commit 31f23fd065
21 changed files with 1009 additions and 96 deletions
+7 -7
View File
@@ -3,9 +3,9 @@
PMG supports an experimental proxy based interception as an alternative to the current optimistic dependency resolution. When enabled via `--experimental-proxy-mode` flag:
- PMG starts a micro-proxy server on a random localhost port
- Run `npm` and other supported package managers configured to use the proxy
- Intercept package registry requests and analyze packages as they are downloaded
- Block malicious packages and allow trusted packages to be installed
- Runs `npm` and other supported package managers configured to use the proxy
- Intercepts package registry requests and analyzes packages as they are downloaded
- Blocks malicious packages and allows trusted packages to be installed
## Usage
@@ -26,11 +26,11 @@ experimental_proxy_mode: true
| Package Manager | Status |
| --------------- | --------- |
| `npm` | ✅ Active |
| `npx` | 🕒 Planned |
| `yarn` | 🕒 Planned |
| `npx` | ✅ Active |
| `pnpx` | ✅ Active |
| `pnpm` | 🕒 Planned |
| `pnpx` | 🕒 Planned |
| `yarn` | 🕒 Planned |
| `bun` | 🕒 Planned |
| `pip` | 🕒 Planned |
| `uv` | 🕒 Planned |
| `poetry` | 🕒 Planned |
| `poetry` | 🕒 Planned |
+1 -2
View File
@@ -11,9 +11,8 @@ If you don't have a `config.yml` file, you can create one by running `pmg setup
```yaml
trusted_packages:
- purl: pkg:npm/safedep/pmg
- purl: pkg:npm/@safedep/pmg
reason: "All versions of PMG are trusted"
- purl: pkg:npm/express@4.18.0
reason: "Version 4.18.0 of Express is a trusted package"
```