passport-bridge 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -18
- package/dist/cli.js +5 -5
- package/dist/cliArgs.d.ts +5 -0
- package/dist/cliArgs.js +11 -5
- package/dist/cliGuardHealth.d.ts +1 -1
- package/dist/cliGuardHealth.js +1 -1
- package/dist/cliInit.js +6 -1
- package/dist/cliMain.js +78 -38
- package/dist/cliOutput.js +9 -9
- package/dist/cliPolicyRefresh.d.ts +1 -1
- package/dist/cliPolicyRefresh.js +1 -1
- package/dist/cliScan.d.ts +17 -2
- package/dist/cliScan.js +29 -8
- package/dist/cliSetupLock.js +1 -1
- package/dist/cliSetupOrg.js +18 -6
- package/dist/completion.js +14 -10
- package/dist/enrollment.js +1 -1
- package/dist/initAgents.d.ts +12 -3
- package/dist/initAgents.js +40 -9
- package/dist/initAutopilotStep.d.ts +2 -4
- package/dist/initAutopilotStep.js +6 -5
- package/dist/initLocalSteps.d.ts +0 -18
- package/dist/initLocalSteps.js +2 -78
- package/dist/initOutro.js +0 -2
- package/dist/initPlan.js +10 -14
- package/dist/initState.d.ts +0 -2
- package/dist/initState.js +0 -10
- package/dist/lockedHooks.d.ts +1 -1
- package/dist/lockedHooks.js +3 -3
- package/dist/loginFlow.js +1 -1
- package/dist/managedHooks.js +1 -1
- package/dist/pluginPin.d.ts +1 -1
- package/dist/pluginPin.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ passport run github_search_issues '{"query":"SSO"}'
|
|
|
51
51
|
| Command | Purpose |
|
|
52
52
|
| --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
53
53
|
| `init [--yes] [--move-keys] [--no-open] [--cloud <origin>] [--skip-apps\|--skip-agents\|--skip-guard] [--verbose] [--json]` | Set up Passport for this computer's agents in one pass. Every step asks first, can be skipped, and is safe to run again. |
|
|
54
|
+
| `init --org <pek_key> --yes [--agents <list>] [--lock [--strict]]` | Set up every agent on this computer for your company without asking anything (MDM and scripts); `--lock` (root) locks the guard on. See [Company rollout](#company-rollout). |
|
|
54
55
|
| `login` | Browser sign-in or sign-up (or device sign-in with `--workspace`); saves a rotating CLI credential and makes the profile active. |
|
|
55
56
|
| `logout` | Revoke the credential and always remove the local profile (warns if revocation fails). |
|
|
56
57
|
| `profiles` / `use <name>` | List stored profiles / select the active one. Offline. |
|
|
@@ -63,14 +64,12 @@ passport run github_search_issues '{"query":"SSO"}'
|
|
|
63
64
|
| `connect [app...] [--alias <name>] [--open] [--wait <s>]` | Show member sign-in links and optionally wait for completion. |
|
|
64
65
|
| `resources [uri] [--out <file>]` | List or read MCP resources. |
|
|
65
66
|
| `prompts [name] [--set k=v] [--out <file>]` | List or get MCP prompts. |
|
|
66
|
-
| `scan [--path <dir>] [--verbose] [--check]`
|
|
67
|
-
| `discover` | Scan local MCP configuration and submit a privacy-minimized fleet report. Exit 5 on a managed-policy violation. |
|
|
67
|
+
| `scan [--path <dir>] [--verbose] [--check]` | Find keys your agents can reach on this computer and what each can do, without an account. Signed in, also report the MCP servers set up in your agents to your workspace and exit 5 when its policy doesn't allow one. `--check` scans files only (not the shell environment), never reports, and exits 5 on a high or medium key. |
|
|
68
68
|
| `hook` | Records the CLIs agents run and, with `--guard`, decides each one before it runs from your Autopilot rules (`install`, `uninstall`, `status`). |
|
|
69
69
|
| `wait <approval-id> [--timeout <s>]` | Wait for a person to decide an approval request (default 100 seconds). |
|
|
70
70
|
| `rules test "<command>" [--environment <kind>]` | What Autopilot decides for a command, why, and which environment it acts on. |
|
|
71
71
|
| `sessions [--status running\|idle\|ended]` | Your agents' recent sessions with what Passport decided. |
|
|
72
72
|
| `undo <action-id>\|--last [--option <id>] [--yes]` | Undo an action Passport took a backup before, within 7 days. See [Undo](#undo). |
|
|
73
|
-
| `setup --org <pek_key> [--yes] [--agents <list>] [--lock [--strict]]` | Set up every agent on this computer for your company without asking anything (MDM and scripts); `--lock` (root) locks the guard on. See [Company rollout](#company-rollout). |
|
|
74
73
|
| `setup` | Install and maintain assigned team workflows as managed skills. |
|
|
75
74
|
| `session` | Run NDJSON commands over one authenticated MCP session. |
|
|
76
75
|
| `access` | Signed managed access: `keygen`, `actions`, `run`, `invoke`, `status`, `cancel`. |
|
|
@@ -120,7 +119,9 @@ passport scan --path ../api --verbose
|
|
|
120
119
|
passport scan --check # CI and pre-commit: files only, exit 5 on a high or medium key
|
|
121
120
|
```
|
|
122
121
|
|
|
123
|
-
Reads agent MCP configs (Claude Desktop, Claude Code, Cursor, VS Code, Codex), CLI sign-in files (GitHub CLI, Railway, Vercel, Wrangler, AWS, Stripe CLI, Supabase, npm), well-known shell variable names, and `.env*` files up to three folders deep in the project. It never prints or
|
|
122
|
+
Reads agent MCP configs (Claude Desktop, Claude Code, Cursor, VS Code, Codex), CLI sign-in files (GitHub CLI, Railway, Vercel, Wrangler, AWS, Stripe CLI, Supabase, npm), well-known shell variable names, and `.env*` files up to three folders deep in the project. It never prints, saves, or sends any part of a key, needs no profile, and skips `.env` files in your home folder. Sign-ins held by the OS keychain are named but not flagged. `passport-bridge scan` and `passport-bridge init` run the `passport` CLI's own implementation.
|
|
123
|
+
|
|
124
|
+
Signed in (a member profile, never an agent token), scan then sends the MCP-config inventory to `POST /api/my/discovery/scan` for **Agents → Discovered**: each MCP server's name and how it connects, never paths, commands, arguments, environment values, or keys. The closing line becomes `No key left this computer.` followed by what Passport made of it (`Sent the MCP setup on <computer> to Passport: …`), and a workspace that requires MCP servers to go through Passport makes it exit 5. A problem sending it is one line and never fails the scan. Without a profile, and with `--check`, nothing leaves the computer (`Nothing left this computer.`). `passport discover` is its old name: it still sends the inventory alone, with the same output and exit code, and says `passport discover is now part of passport scan.` on stderr.
|
|
124
125
|
|
|
125
126
|
### Set up with init
|
|
126
127
|
|
|
@@ -141,7 +142,7 @@ Eight steps, each reusing the command that owns it:
|
|
|
141
142
|
3. **Apps**: Railway, Vercel, Supabase, Cloudflare, GitHub, and Stripe, when the scan found a key or its CLI is on PATH. Missing apps are added through the same catalog rules as the web (an app your workspace reviews first says `! Stripe needs approval from your admin.`), then one sign-in page covers the rest. In a terminal init waits until they connect (Enter stops waiting); with `--yes` or without a terminal it prints the page, adds `passport connect --wait 300` to `next`, and moves on.
|
|
142
143
|
4. **Keys**: the recommended setup keeps them; the plan says `Your GitHub and Railway keys stay on this computer. Move them any time.` with `Run: passport keys move` under it. Step by step asks the same question as `passport keys move` for each: `Move your Railway account token into Passport and sign the Railway CLI out on this computer? [y/N]` (a long question wraps; `[y/N]` stays on its last line). Enter keeps the key here; an answer that isn't y or n asks again (`Type y or n.`). Add `--move-keys` to move every key it finds without asking; the closing list then says which (`Moved your Railway key into Passport and signed that CLI out here`) and, once per moved key, where to rotate the old one (`Rotate the old Railway key, since copies may exist elsewhere: https://railway.com/account/tokens`). When Passport already holds a different key for that CLI, an interactive run asks `Passport already holds a different Railway key. Replace it with this computer's? Every agent that uses it switches to this one.` then `Type railway to confirm, or press Enter to cancel:`: only the name replaces it and signs the CLI out, keeping links; anything else prints `Kept the key in Passport. This computer's Railway CLI stays signed in.` `--yes` never replaces a key. Quiet when there's nothing to move.
|
|
143
144
|
5. **Where** (environments): the environments Passport has placed for your apps, grouped by kind (`Production production (Railway), production (Vercel)`), one row per resource. Anything Passport can't place counts as Production and is listed once: `Treated as Production until placed: blue (Railway). Change it in Rules.` A resource named for its kind (`production` in Production) is never called assumed. This folder's links follow (`This folder: Railway production (linked), counted as Production`). With no app connected yet it says they appear once one is.
|
|
144
|
-
6. **Agents**: Passport's one MCP URL with this workspace as its hint (`https://passportmcp.com/mcp?ws=<workspace>`), with each agent's own browser sign-in; a server that doesn't serve `/mcp` yet (read from its OAuth protected-resource metadata) gets the workspace's own URL (`https://<host>/w/<workspace>/mcp`). An
|
|
145
|
+
6. **Agents**: Passport's one MCP URL with this workspace as its hint (`https://passportmcp.com/mcp?ws=<workspace>`), with each agent's own browser sign-in; a server that doesn't serve `/mcp` yet (read from its OAuth protected-resource metadata) gets the workspace's own URL (`https://<host>/w/<workspace>/mcp`). An entry already at the one URL counts as set up. Once the server serves `/mcp`, an entry at this workspace's own URL or a local bridge entry for this workspace (`passport-bridge serve --profile <agent>@<workspace>`) moves to the one URL: the plan says `Move Cursor and Codex to Passport's one URL`, and each row's status is `updated`. Codex without its CLI gets its `[mcp_servers.passport]` table (and subtables) replaced in place. An entry for another workspace is left as is. No token lands in a config file. **Agents** shows `Uses an old URL` on an agent still on the workspace's own URL until init moves it. Claude Code and Codex through their own CLIs (`claude mcp add --transport http --scope user`, `codex mcp add --url`), Cursor through `~/.cursor/mcp.json`, VS Code through `code --add-mcp` or its user `mcp.json`. Claude Desktop connects through Settings → Connectors: on a terminal init copies the URL and says `Claude Desktop: paste the copied URL in Settings → Connectors → Add custom connector`; without one it names the URL.
|
|
145
146
|
7. **Guard**: (step by step asks `Check each shell command in <agents> before it runs? [Y/n]`) runs `passport hook install --guard` for Claude Code, Codex, and Cursor (in Codex, a command your rules ask about is blocked with how to approve it, since Codex can't show Passport's questions), pointing at the launcher `$PASSPORT_HOME/cli/bin/passport` (`passport.cmd` on Windows), which runs a stable copy of the CLI in `$PASSPORT_HOME/cli/<version>/` (never npm's cache), or at a global `passport-bridge` of the same version or newer. An upgrade rewrites the launcher and the `cli/current` link in one rename each, so hooks follow without being edited; the launcher runs the recorded node, or the node on PATH once that one is removed. A hook from an older init that names a version folder is replaced where it stands, next to your other hooks. Once the new copy is in place, older copies are deleted unless a hook still runs them.
|
|
146
147
|
8. **Autopilot**: how much agents can do on their own, per environment:
|
|
147
148
|
|
|
@@ -151,7 +152,7 @@ Eight steps, each reusing the command that owns it:
|
|
|
151
152
|
Development Hands-off everything except irreversible runs
|
|
152
153
|
```
|
|
153
154
|
|
|
154
|
-
The plan shows them once. Step by step asks one compact question per environment where a choice is left (`Staging: 1 Careful 2 Balanced 3 Hands-off [2]`, Enter keeps it); the recommended setup and `--yes` keep the defaults. A team floor stricter than a default is shown with why (`Your team requires Careful or stricter in Staging.`), and choices below it aren't offered. A CLI credential can only make presets stricter; a looser pick says so in one line and keeps the current ones. A re-run lists them under Done without asking. The closing list says what will ask: `Autopilot on: asks only for Production changes, deletes outside Development, and irreversible actions`. A server without Autopilot gets the
|
|
155
|
+
The plan shows them once. Step by step asks one compact question per environment where a choice is left (`Staging: 1 Careful 2 Balanced 3 Hands-off [2]`, Enter keeps it); the recommended setup and `--yes` keep the defaults. A team floor stricter than a default is shown with why (`Your team requires Careful or stricter in Staging.`), and choices below it aren't offered. A CLI credential can only make presets stricter; a looser pick says so in one line and keeps the current ones. A re-run lists them under Done without asking. The closing list says what will ask: `Autopilot on: asks only for Production changes, deletes outside Development, and irreversible actions`. A server without Autopilot gets no rules step (`Autopilot needs a newer Passport server.`); init never writes the retired safety profile.
|
|
155
156
|
|
|
156
157
|
What changes on disk, and how to undo it:
|
|
157
158
|
|
|
@@ -170,11 +171,11 @@ The plan names every file init edits before it edits any, and it keeps one copy
|
|
|
170
171
|
### Company rollout
|
|
171
172
|
|
|
172
173
|
```sh
|
|
173
|
-
npx passport-bridge@latest
|
|
174
|
-
npx passport-bridge@latest
|
|
174
|
+
npx passport-bridge@latest init --org pek_example --yes # Jamf, Kandji, Intune, or any script
|
|
175
|
+
npx passport-bridge@latest init --org pek_example --yes --agents claude-code,codex
|
|
175
176
|
```
|
|
176
177
|
|
|
177
|
-
`init` for MDM: it never asks anything and never signs in. It installs the stable copy of the CLI, adds Passport to every detected agent (Claude Code, Cursor, Codex, VS Code; Claude Desktop gets the connector step) at the one URL with the enrollment key as its hint (`https://passportmcp.com/mcp?enroll=pek_…`), turns on the guard and audit hooks for Claude Code, Codex, and Cursor, and records the key in `$PASSPORT_HOME/enrollment.json` (mode 600). It prints one line per agent:
|
|
178
|
+
`init --org` is `init` for MDM: it never asks anything and never signs in. `passport setup --org` is its old name and still runs it for one release, saying `passport setup --org is now passport init --org.` on stderr. init's own step flags (`--dry-run`, `--move-keys`, `--skip-*`, `--no-open`, `--verbose`) don't go with `--org` (exit 6), and `--agents`, `--lock`, and `--strict` need `--org`. It installs the stable copy of the CLI, adds Passport to every detected agent (Claude Code, Cursor, Codex, VS Code; Claude Desktop gets the connector step) at the one URL with the enrollment key as its hint (`https://passportmcp.com/mcp?enroll=pek_…`), turns on the guard and audit hooks for Claude Code, Codex, and Cursor, and records the key in `$PASSPORT_HOME/enrollment.json` (mode 600). It prints one line per agent:
|
|
178
179
|
|
|
179
180
|
```
|
|
180
181
|
Passport setup for passportmcp.com (enrollment pek_…mple)
|
|
@@ -184,11 +185,11 @@ Codex ✓ Passport added · sign in: codex mcp login passport · guard o
|
|
|
184
185
|
Each agent asks you to sign in to Passport the first time it connects.
|
|
185
186
|
```
|
|
186
187
|
|
|
187
|
-
The first line names the workspace the key pre-selects (`GET /api/auth/enrollment/<key>`, public, no credential). It exits 0 even with no agents (`No supported agents found. Nothing to set up.`), so an MDM run never fails a computer without them. A malformed key or `--agents` list (`--clients` still works) exits 6, and so does a key the server doesn't know or has revoked, with the server's one line (`This enrollment key isn't valid.` or `This enrollment key was revoked. Ask your admin for a new one.`) before anything changes. `passport login` on that computer later passes the recorded key: as the browser sign-in hint (`POST /api/auth/cli/start { enroll }`) and for rollout attribution when the CLI credential is minted (`enrollmentKey`). A server that doesn't serve the one URL yet still gets the CLI, hooks, and key, and the agents wait for `passport init`. Run it again any time: it changes nothing that's in place and repairs what drifted (a removed hook, an entry pointing at npm's cache). The enrollment key is a workspace hint, not a credential: people still sign in as themselves. `--cloud <origin>` (or `PASSPORT_CLOUD`) points it at a self-hosted Passport. `--json` prints `{version,origin,universal,url?,workspace?:{id,name},enrollment,clients:[{agent,name,mcp,guard,message?,next?}]}`.
|
|
188
|
+
The first line names the workspace the key pre-selects (`GET /api/auth/enrollment/<key>`, public, no credential). It exits 0 even with no agents (`No supported agents found. Nothing to set up.`), so an MDM run never fails a computer without them. A malformed key or `--agents` list (`--clients` still works) exits 6, and so does a key the server doesn't know or has revoked, with the server's one line (`This enrollment key isn't valid.` or `This enrollment key was revoked. Ask your admin for a new one.`) before anything changes. `passport login` on that computer later passes the recorded key: as the browser sign-in hint (`POST /api/auth/cli/start { enroll }`) and for rollout attribution when the CLI credential is minted (`enrollmentKey`). A server that doesn't serve the one URL yet still gets the CLI, hooks, and key, and the agents wait for `passport init`. Run it again any time: it changes nothing that's in place and repairs what drifted (a removed hook, an entry pointing at npm's cache). When the key names its workspace, an agent on that workspace's own URL or a local bridge for it moves to the one URL (`✓ Passport updated`). The enrollment key is a workspace hint, not a credential: people still sign in as themselves. `--cloud <origin>` (or `PASSPORT_CLOUD`) points it at a self-hosted Passport. `--json` prints `{version,origin,universal,url?,workspace?:{id,name},enrollment,clients:[{agent,name,mcp,guard,message?,next?}]}`.
|
|
188
189
|
|
|
189
190
|
```sh
|
|
190
|
-
sudo npx passport-bridge@latest
|
|
191
|
-
sudo npx passport-bridge@latest
|
|
191
|
+
sudo npx passport-bridge@latest init --org pek_example --yes --lock # lock the guard on
|
|
192
|
+
sudo npx passport-bridge@latest init --org pek_example --yes --lock --strict # and allow only managed hooks
|
|
192
193
|
```
|
|
193
194
|
|
|
194
195
|
`--lock`, run as root, puts the guard and audit hooks in each agent's managed settings instead of the per-person steps (as root those would write into root's home), so people can't turn them off (`src/cliSetupLock.ts`, `src/lockedHooks.ts`, a checked copy of `shared/lockedHooks.ts`). It writes a root-owned launcher (`/Library/Application Support/Passport/bin/passport` on macOS, `/opt/passport/bin/passport` on Linux, 0755) that sets `PASSPORT_HOOK_VIA=managed` and runs the person's own `$PASSPORT_HOME/cli/bin/passport`; without one it lets the command run, or with `--strict` blocks it with `Passport's guard isn't set up for you yet. Run: npx passport-bridge@latest init`. Then per agent: Claude Code gets the drop-in `managed-settings.d/50-passport.json`; Codex's `/etc/codex/requirements.toml` gets Passport's `[features]`/`[hooks]` lines between `# >>> passport` and `# <<< passport`; Cursor's system `hooks.json` gets Passport's two entries beside everyone else's. `--strict` adds `allowManagedHooksOnly` and `onFailure: "block"` (Claude Code), `allow_managed_hooks_only = true` (Codex), and `failClosed` (Cursor). A file it can't merge safely (someone else's drop-in or `[hooks]`, `hooks = false`, `disableAllHooks`, invalid JSON) is left untouched with the fix. Atomic writes, files 0644. Without root, or on Windows, it writes nothing and prints `Locking needs administrator rights. Run it with sudo, or deploy these through MDM:` with each path. `--clients` narrows it; `--strict` without `--lock` exits 6. It exits 0 and prints one line per agent (`Claude Code Locked · <path>`, `Already locked`, or `! Not locked: <reason>`); `--json` prints `{version,lock:{strict,shim,agents:[{agent,state,path,message?}]}}` with `state` one of `locked`, `already_locked`, `conflict`, `needs_admin`, `failed`. A hook from the person's own settings stands down when managed settings already run Passport's guard (`src/managedHooks.ts`). `PASSPORT_MANAGED_ROOT` puts every managed path under a folder (tests). Vendor docs: code.claude.com/docs/en/settings, code.claude.com/docs/en/hooks, learn.chatgpt.com/docs/enterprise/managed-configuration, cursor.com/docs/agent/hooks.
|
|
@@ -263,7 +264,7 @@ An ask becomes one Activity row. In Claude Code, with the audit hook registered,
|
|
|
263
264
|
|
|
264
265
|
`src/cliPolicy.ts` caches the member's CLI policy (`GET /api/my/cli-policy`) at `$PASSPORT_HOME/cli-policy/<profile>.json` (mode 600). Servers with Autopilot send version 2 (`src/cliPolicyV2.ts`: presets, floors, CLI rules, irreversible and delete verbs, environment flags, placed environments); older servers send version 1, and then the guard keeps its earlier shape: ask or deny before destructive verbs, never allow, no server call, and reports without the Autopilot fields. `passport login` and `passport status` refresh it and `passport logout` removes it. A 404 or error keeps the previous copy; with no copy the guard asks before every destructive verb. `PASSPORT_HOOK_DISABLED=1` turns both hooks off.
|
|
265
266
|
|
|
266
|
-
The Passport plugin (`rsyed94/passport-plugins`) runs the same two hooks from the agent's plugin folder, with `PASSPORT_HOOK_VIA=plugin`. `passport hook status` shows those agents as `via plugin`, and `hook install`, `init`, and `
|
|
267
|
+
The Passport plugin (`rsyed94/passport-plugins`) runs the same two hooks from the agent's plugin folder, with `PASSPORT_HOOK_VIA=plugin`. `passport hook status` shows those agents as `via plugin`, and `hook install`, `init`, and `init --org` skip them (`Claude Code: already covered by the Passport plugin.`) so nothing is recorded twice. The plugin pins the CLI version in `src/pluginPin.ts`.
|
|
267
268
|
|
|
268
269
|
### Autopilot from the terminal
|
|
269
270
|
|
|
@@ -283,7 +284,7 @@ passport actions sync # propose this repository's .passport/actions.toml
|
|
|
283
284
|
- `rules test` classifies the command here and sends only its app and verb (and the environment kind) to `POST /api/my/rules/test`, never the command line. An everyday command goes as a finding (`{finding: {vendor, verb, risk, environment}}`), because only this computer can place its paths. It prints the decision, its cause, the environment, and the class. Without a server answer it decides from this computer's copy and says how old it is. `--environment` picks one when the flags don't say.
|
|
284
285
|
- `wait` long-polls `GET /api/my/approvals/<id>/wait`, after a short first look that names who decides. Once Passport says the request is still pending (never for one that doesn't exist or is already decided), on a terminal it prints the approval link and one live line (`Waiting for Erin · 1:32 left`); piped, `Waiting for a decision on <id> (up to 100 seconds).` and `Open in Passport: <url>`. Ctrl-C exits 4 with `The request is still open. Keep waiting any time.` and `Run: passport wait <id>`. Approved: `Approved by Ramish. Run the command again.` (exit 0). Declined: the note for the agent, `Declined by Ramish: <note>` (exit 5, cause `approval_denied`). Expired: `Expired. The agent can ask again.` (exit 5, cause `approval_expired`). Still waiting at `--timeout` (default 100 seconds, under an agent's 2-minute command limit): exit 4 with the same command as `next`.
|
|
285
286
|
- `sessions` lists recent sessions (`GET /api/my/agent-sessions`): status, agent, folder, start, `42 ran · 2 asked · 1 blocked`, environments touched, and `Waiting for you` when approvals are pending.
|
|
286
|
-
- `sync` writes the allows Passport is sure of into each agent's own permission settings, so those prompts disappear offline and in Codex (`src/nativeSync.ts`). Only reads, test runners, builds and type checks, linters that only check, `git status`, `git add`, and `git commit`, checked against the person's rules. Formatters, fixing linters, `mv`/`cp`, and package scripts stay with the hook, which sees what they touch; deletes, installs, pushes, and Production never sync. Claude Code: `Bash(npm test *)` in `permissions.allow` of `~/.claude/settings.json`. Codex: `prefix_rule(pattern = ["npm", "test"], decision = "allow")` in `~/.codex/rules/passport.rules`, a file Passport owns. Cursor CLI: `Shell(npm:test*)` in `permissions.allow` of `~/.cursor/cli-config.json`. Cursor: `npm test` in `terminalAllowlist` of `~/.cursor/permissions.json`, only when that list already exists there (defining it replaces Cursor's in-app list). Entries Passport added are listed in `$PASSPORT_HOME/native-sync.json`; an entry you had before is never claimed or removed, and a file Passport can't parse exactly (JSONC) is left alone. Sync runs on `init`, `
|
|
287
|
+
- `sync` writes the allows Passport is sure of into each agent's own permission settings, so those prompts disappear offline and in Codex (`src/nativeSync.ts`). Only reads, test runners, builds and type checks, linters that only check, `git status`, `git add`, and `git commit`, checked against the person's rules. Formatters, fixing linters, `mv`/`cp`, and package scripts stay with the hook, which sees what they touch; deletes, installs, pushes, and Production never sync. Claude Code: `Bash(npm test *)` in `permissions.allow` of `~/.claude/settings.json`. Codex: `prefix_rule(pattern = ["npm", "test"], decision = "allow")` in `~/.codex/rules/passport.rules`, a file Passport owns. Cursor CLI: `Shell(npm:test*)` in `permissions.allow` of `~/.cursor/cli-config.json`. Cursor: `npm test` in `terminalAllowlist` of `~/.cursor/permissions.json`, only when that list already exists there (defining it replaces Cursor's in-app list). Entries Passport added are listed in `$PASSPORT_HOME/native-sync.json`; an entry you had before is never claimed or removed, and a file Passport can't parse exactly (JSONC) is left alone. Sync runs on `init`, `init --org`, every rules refresh, and `passport sync`; `hook uninstall`, `sync --remove`, and signing out of the last profile take the entries out.
|
|
287
288
|
- `status` is one screen, like `gh auth status`, with a label per row (`You` with the name you signed in as, `Computer`, `Guard`, `Autopilot`, `Apps`, `Keys`, `Shims`, `This folder`, `Allowlists`, `CLI`); under 60 columns each label gets its own row, and piped it never wraps. `Guard` lists each agent's guard (`✓ Claude Code On`, `! Codex Not trusted`) with its fix on the line under it, the coverage line, and sends the daily guard report when due. It also adds today's speed line, `Passport added 0.3 s and asked you twice today. 412 actions ran on their own.` (across your computers when the server keeps speed numbers, else `(this computer)`), and `Answered for you: N prompts today` (allows the hook gave in Claude Code and Cursor, and Codex commands Passport synced, counted only when the agent would have prompted) and which agents' allowlists are synced. Under the presets, one line per exception that lets something run your presets would ask about, in the web's words: `! 1 exception: deletes run in Production without asking, even without a backup.` Counts are appended locally (`$PASSPORT_HOME/answered/`) and sent in batches at most every five minutes as `answered: {batch, count}` on `POST /api/my/cli-activity`.
|
|
288
289
|
- `actions` tells Passport what a project script does (`src/cliActions.ts`): `actions add <script> [args…] --environment <kind> --class <class>` sends the path in the repository (or `make`, `npm`, `pnpm`, `yarn` with the target), an argument glob, the repository's remote fingerprint and name, and the SHA-256 of what it runs, never its contents, to `POST /api/my/project-actions`. `--id <op_…>` resolves a Session row's **Tell Passport what this does** from this computer's scan cache. `actions sync` proposes each entry of `.passport/actions.toml`. A change, delete, or irreversible in Production applies at once; anything looser waits for an admin. The guard then decides a matching run as vendor `project` with that class and environment; it never makes a line allowed on its own, and a changed script stops matching (`projectChanged`) until it's set again. `.passport/actions.toml` entries apply locally only when they ask or block.
|
|
289
290
|
- `rules test`, `sessions`, `actions`, and `sync` need a member profile. `wait` also works for a cloud agent's agent token, on the approval its own `passport exec` opened.
|
|
@@ -333,7 +334,7 @@ printf '%s\n' \
|
|
|
333
334
|
- One `{"id"?:string|number,"argv":string[]}` request per line, run in order; one JSON response per line with `ok`, `exitCode`, and `result` or error fields. `id` is echoed.
|
|
334
335
|
- A failed request does not close the session. EOF, SIGINT, or SIGTERM closes it cleanly.
|
|
335
336
|
- Limits: 1 MiB per line, 128 arguments. Set `--profile`, `--caller`, and `--timeout` on `passport session`, not per request.
|
|
336
|
-
- Allowed commands: `status`, `search`, `describe`, `run`, `connect`, `resources`, `prompts
|
|
337
|
+
- Allowed commands: `status`, `search`, `describe`, `run`, `connect`, `resources`, `prompts` (and `discover`, the old inventory name, for one release).
|
|
337
338
|
- Governance is unchanged; access tokens keep normal expiry and refresh.
|
|
338
339
|
|
|
339
340
|
### Shell completion
|
|
@@ -377,7 +378,7 @@ passport ready --json
|
|
|
377
378
|
passport search "deployment status" --json
|
|
378
379
|
```
|
|
379
380
|
|
|
380
|
-
`PASSPORT_ENDPOINT` is Passport's one URL (`https://<host>/mcp
|
|
381
|
+
`PASSPORT_ENDPOINT` is Passport's one URL (`https://<host>/mcp`): the agent token's own prefix says which workspace. A workspace's own older URL (`https://<host>/w/<workspace>/mcp`) still works. Set both variables together. Environment auth overrides stored profiles, persists nothing, and cannot be combined with `--profile` or `login`/`logout`. Agent tokens skip member approval prompts; use a member profile for work that must pause for a human.
|
|
381
382
|
|
|
382
383
|
## Managed access
|
|
383
384
|
|
|
@@ -448,8 +449,8 @@ On a terminal, human output comes from one renderer (`src/term.ts`): it wraps to
|
|
|
448
449
|
| `run` | Full governed MCP tool result, including `structuredContent` |
|
|
449
450
|
| `connect` | Gateway payload with `connections` and optional `connectAllUrl` |
|
|
450
451
|
| `resources`, `prompts` | MCP list, read, or get result |
|
|
451
|
-
| `discover` | `{snapshot,report,compliant}`
|
|
452
|
-
| `scan` | `{version:1,findings:[{id,provider,kind,label,severity,location,locations,blastRadius}],agents,unreadable,checked}`
|
|
452
|
+
| `discover` | `{snapshot,report,compliant}` (the old name of `scan`'s inventory step, for one release) |
|
|
453
|
+
| `scan` | `{version:1,findings:[{id,provider,kind,label,severity,location,locations,blastRadius}],agents,unreadable,checked,inventory?:{snapshot,report,compliant}}`; `inventory` only when signed in, or `{error}` when it couldn't be sent |
|
|
453
454
|
| `session` | NDJSON `{id?,ok,exitCode,result?}` or `{id?,ok:false,error,cause,exitCode,...}` |
|
|
454
455
|
| `access` | `keygen`: algorithm, paths, public JWK; `actions`: `{actions}`; `run`/`cancel`: `{run}`; `invoke`: governed result; `status`: `{receipt}` |
|
|
455
456
|
| `completion` | `{shell,script}` |
|
package/dist/cli.js
CHANGED
|
@@ -27,8 +27,9 @@ function arg(flag, fallback = "") {
|
|
|
27
27
|
const i = process.argv.indexOf(flag);
|
|
28
28
|
return i >= 0 && process.argv[i + 1] ? process.argv[i + 1] : fallback;
|
|
29
29
|
}
|
|
30
|
-
/** `npx passport-bridge@latest scan
|
|
31
|
-
* `passport` CLI's own implementation, so both bins behave identically.
|
|
30
|
+
/** `npx passport-bridge@latest scan` and `init` (with `--org` for MDM) run the
|
|
31
|
+
* `passport` CLI's own implementation, so both bins behave identically.
|
|
32
|
+
* `setup` is here for `setup --org`, init's old name for one release. */
|
|
32
33
|
const PASSPORT_ONE_LINERS = new Set(["scan", "init", "setup"]);
|
|
33
34
|
async function passportOneLiner() {
|
|
34
35
|
const problem = oneLinerNodeProblem();
|
|
@@ -80,9 +81,8 @@ Commands:
|
|
|
80
81
|
login Sign in and save a rotating bridge sign-in
|
|
81
82
|
status Check saved bridge profiles
|
|
82
83
|
logout Revoke and remove a saved profile
|
|
83
|
-
scan Find keys your agents can reach
|
|
84
|
-
init Set up Passport for your agents
|
|
85
|
-
setup setup --org <key>: set up every agent here for your company (MDM)
|
|
84
|
+
scan Find the keys and MCP servers your agents can reach
|
|
85
|
+
init Set up Passport for your agents (--org <key> for company computers)
|
|
86
86
|
|
|
87
87
|
Options:
|
|
88
88
|
--profile <name> Use a named profile (default: default)
|
package/dist/cliArgs.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export declare const COMMANDS: readonly ["init", "login", "logout", "profiles", "use", "status", "doctor", "ready", "search", "describe", "run", "connect", "resources", "prompts", "discover", "scan", "hook", "wait", "rules", "actions", "sessions", "env", "sync", "exec", "undo", "keys", "setup", "session", "access", "completion", "help", "version"];
|
|
2
2
|
export type Command = (typeof COMMANDS)[number];
|
|
3
|
+
/** Old names that still run for one release, left out of help, completion,
|
|
4
|
+
* and suggestions. `discover` is part of `scan` now. */
|
|
5
|
+
export declare const HIDDEN_COMMANDS: readonly Command[];
|
|
6
|
+
/** Every command help, completion, and suggestions name. */
|
|
7
|
+
export declare const VISIBLE_COMMANDS: readonly Command[];
|
|
3
8
|
/** A usage mistake. `suggestion` is the command the person most likely meant. */
|
|
4
9
|
export declare class ArgError extends Error {
|
|
5
10
|
readonly suggestion?: string[] | undefined;
|
package/dist/cliArgs.js
CHANGED
|
@@ -33,6 +33,11 @@ export const COMMANDS = [
|
|
|
33
33
|
"help",
|
|
34
34
|
"version"
|
|
35
35
|
];
|
|
36
|
+
/** Old names that still run for one release, left out of help, completion,
|
|
37
|
+
* and suggestions. `discover` is part of `scan` now. */
|
|
38
|
+
export const HIDDEN_COMMANDS = ["discover"];
|
|
39
|
+
/** Every command help, completion, and suggestions name. */
|
|
40
|
+
export const VISIBLE_COMMANDS = COMMANDS.filter((command) => !HIDDEN_COMMANDS.includes(command));
|
|
36
41
|
const FLAGS = {
|
|
37
42
|
profile: { kind: "value" },
|
|
38
43
|
json: { kind: "boolean" },
|
|
@@ -47,10 +52,11 @@ const FLAGS = {
|
|
|
47
52
|
guard: { kind: "boolean", commands: ["hook"] },
|
|
48
53
|
"no-open": { kind: "boolean", commands: ["login", "init"] },
|
|
49
54
|
yes: { kind: "boolean", commands: ["init", "setup", "keys", "undo"] },
|
|
50
|
-
org
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
// `init --org` is setup for MDM; `setup --org` still runs it for one release.
|
|
56
|
+
org: { kind: "value", commands: ["init", "setup"] },
|
|
57
|
+
clients: { kind: "value", commands: ["init", "setup"] },
|
|
58
|
+
lock: { kind: "boolean", commands: ["init", "setup"] },
|
|
59
|
+
strict: { kind: "boolean", commands: ["init", "setup"] },
|
|
54
60
|
"skip-apps": { kind: "boolean", commands: ["init"] },
|
|
55
61
|
"skip-agents": { kind: "boolean", commands: ["init"] },
|
|
56
62
|
"skip-guard": { kind: "boolean", commands: ["init"] },
|
|
@@ -108,7 +114,7 @@ function optionsFor(command) {
|
|
|
108
114
|
return [...new Set(names)];
|
|
109
115
|
}
|
|
110
116
|
function unknownCommand(raw, help = false) {
|
|
111
|
-
const guess = closest(raw,
|
|
117
|
+
const guess = closest(raw, VISIBLE_COMMANDS);
|
|
112
118
|
const argv = guess ? ["passport", ...(help ? ["help"] : []), guess] : undefined;
|
|
113
119
|
return new ArgError(`Unknown command "${raw}". ${argv ? `Did you mean: ${argv.join(" ")}` : "See every command with passport help."}`, argv);
|
|
114
120
|
}
|
package/dist/cliGuardHealth.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const GUARD_HEALTH_PATH = "/api/my/guard-health";
|
|
|
13
13
|
type ApiCall = (path: string, init: RequestInit) => Promise<Response>;
|
|
14
14
|
/** Managed settings hold Passport's guard for this agent: one reader for
|
|
15
15
|
* guard health and the hooks' stand-down (`managedHooks.ts`, which
|
|
16
|
-
* `passport
|
|
16
|
+
* `passport init --org --lock` writes for). */
|
|
17
17
|
export declare function managedGuard(client: GuardClient, env: Env): boolean;
|
|
18
18
|
/** Each agent on this computer, as the report sends it. */
|
|
19
19
|
export declare function guardClientReports(env: Env): Promise<GuardClientReport[]>;
|
package/dist/cliGuardHealth.js
CHANGED
|
@@ -19,7 +19,7 @@ import { VERSION } from "./version.js";
|
|
|
19
19
|
export const GUARD_HEALTH_PATH = "/api/my/guard-health";
|
|
20
20
|
/** Managed settings hold Passport's guard for this agent: one reader for
|
|
21
21
|
* guard health and the hooks' stand-down (`managedHooks.ts`, which
|
|
22
|
-
* `passport
|
|
22
|
+
* `passport init --org --lock` writes for). */
|
|
23
23
|
export function managedGuard(client, env) {
|
|
24
24
|
return managedPassportHook(client, env);
|
|
25
25
|
}
|
package/dist/cliInit.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* `--json` without `--yes`, print the plan and change nothing.
|
|
11
11
|
*
|
|
12
12
|
* Every step reuses the command that already owns it (scan, login, the hook
|
|
13
|
-
* installer, the server's connect plans and
|
|
13
|
+
* installer, the server's connect plans and Autopilot presets) in-process. Every
|
|
14
14
|
* step is skippable and idempotent, and state is read back from the machine and
|
|
15
15
|
* the server, so a re-run, or a run after Ctrl-C, changes only what's missing.
|
|
16
16
|
*/
|
|
@@ -558,6 +558,11 @@ export async function init(args, runtime, deps = {}) {
|
|
|
558
558
|
if (problem)
|
|
559
559
|
return failure(problem, 1, "unsupported_node");
|
|
560
560
|
ensureOneLinerRuntime();
|
|
561
|
+
// --agents, --lock, and --strict choose what a company rollout sets up.
|
|
562
|
+
const orgOnly = ["clients", "lock", "strict"].find((flag) => flag === "clients" ? value(args, flag) !== undefined : bool(args, flag));
|
|
563
|
+
if (orgOnly) {
|
|
564
|
+
return failure(`--${orgOnly === "clients" ? "agents" : orgOnly} goes with --org <enrollment key>.`, 6, "usage");
|
|
565
|
+
}
|
|
561
566
|
const json = bool(args, "json");
|
|
562
567
|
const yes = bool(args, "yes");
|
|
563
568
|
const dryRun = bool(args, "dry-run") || (json && !yes);
|
package/dist/cliMain.js
CHANGED
|
@@ -68,49 +68,85 @@ async function doctor(args, runtime) {
|
|
|
68
68
|
exitCode: report.ok ? 0 : signedOut(report) ? 2 : 1
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* The MCP-config inventory: the MCP servers set up directly in this
|
|
73
|
+
* computer's agents (each one's name and how it connects, never its keys),
|
|
74
|
+
* sent to Passport for the workspace's fleet view. `passport scan` sends it
|
|
75
|
+
* when signed in; `passport discover`, its old name, still runs it alone.
|
|
76
|
+
*/
|
|
77
|
+
async function sendInventory(gateway, runtime) {
|
|
78
|
+
const { evaluateDiscoveryCompliance, scanLocalMcpConfigs } = await import("./discover.js");
|
|
79
|
+
const snapshot = scanLocalMcpConfigs(gateway.origin, runtime.env);
|
|
80
|
+
const response = await gateway.fetchApi("/api/my/discovery/scan", {
|
|
81
|
+
method: "POST",
|
|
82
|
+
headers: { "content-type": "application/json" },
|
|
83
|
+
body: JSON.stringify(snapshot),
|
|
84
|
+
signal: runtime.signal
|
|
85
|
+
});
|
|
86
|
+
if (!response.ok) {
|
|
87
|
+
const message = await safeApiError(response, "Could not send this computer's MCP setup to Passport.");
|
|
88
|
+
return failure(message, response.status === 401 || response.status === 403 ? 2 : 1, "server");
|
|
89
|
+
}
|
|
90
|
+
const report = await readBoundedJson(response);
|
|
91
|
+
const direct = Number(report.stats?.directConnections ?? 0);
|
|
92
|
+
const review = Number(report.stats?.needsReview ?? 0);
|
|
93
|
+
const enforcement = String(report.policy?.enforcement ?? "observe");
|
|
94
|
+
const managed = report.policy?.fleetMode === "managed";
|
|
95
|
+
const compliance = evaluateDiscoveryCompliance(report);
|
|
96
|
+
const { computerName } = await import("./cliKeys.js");
|
|
97
|
+
const { countOf } = await import("./plural.js");
|
|
98
|
+
const policy = !managed || enforcement === "observe"
|
|
99
|
+
? "Your workspace watches but doesn't block."
|
|
100
|
+
: enforcement === "block"
|
|
101
|
+
? "Your workspace blocks MCP servers it denied."
|
|
102
|
+
: "Your workspace requires MCP servers to go through Passport.";
|
|
103
|
+
return {
|
|
104
|
+
json: { snapshot, report, compliant: compliance.compliant },
|
|
105
|
+
lines: [
|
|
106
|
+
`Sent the MCP setup on ${computerName()} to Passport: ${countOf(direct, "direct MCP configuration")}, ${review} waiting for review.`,
|
|
107
|
+
policy,
|
|
108
|
+
...(!compliance.compliant
|
|
109
|
+
? [
|
|
110
|
+
`${countOf(compliance.routeRequired, "MCP server")} must go through Passport, and ${compliance.denied} ${compliance.denied === 1 ? "is" : "are"} denied.`
|
|
111
|
+
]
|
|
112
|
+
: [])
|
|
113
|
+
],
|
|
114
|
+
compliant: compliance.compliant
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/** Old names keep working for one release and say the new one, once, on
|
|
118
|
+
* stderr, wrapped to the terminal like every other line. */
|
|
119
|
+
async function renamedNotice(args, runtime, text) {
|
|
120
|
+
if (bool(args, "quiet"))
|
|
121
|
+
return;
|
|
122
|
+
const { layout, termOf } = await import("./term.js");
|
|
123
|
+
const width = termOf(runtime.stderr, runtime.env).width;
|
|
124
|
+
runtime.stderr.write(`${layout(text, width)}\n`);
|
|
125
|
+
}
|
|
126
|
+
/** `passport discover`: now part of `passport scan`. Same output and exit code. */
|
|
71
127
|
async function discover(args, runtime) {
|
|
128
|
+
await renamedNotice(args, runtime, "passport discover is now part of passport scan.\nRun: passport scan");
|
|
72
129
|
return withGateway(args, runtime, async (gateway) => {
|
|
73
|
-
const
|
|
74
|
-
const snapshot = scanLocalMcpConfigs(gateway.origin, runtime.env);
|
|
75
|
-
const response = await gateway.fetchApi("/api/my/discovery/scan", {
|
|
76
|
-
method: "POST",
|
|
77
|
-
headers: { "content-type": "application/json" },
|
|
78
|
-
body: JSON.stringify(snapshot),
|
|
79
|
-
signal: runtime.signal
|
|
80
|
-
});
|
|
81
|
-
if (!response.ok) {
|
|
82
|
-
const message = await safeApiError(response, "Could not submit the fleet discovery scan.");
|
|
83
|
-
return failure(message, response.status === 401 || response.status === 403 ? 2 : 1, "server");
|
|
84
|
-
}
|
|
85
|
-
const report = await readBoundedJson(response);
|
|
86
|
-
const direct = Number(report.stats?.directConnections ?? 0);
|
|
87
|
-
const review = Number(report.stats?.needsReview ?? 0);
|
|
88
|
-
const enforcement = String(report.policy?.enforcement ?? "observe");
|
|
89
|
-
const managed = report.policy?.fleetMode === "managed";
|
|
90
|
-
const compliance = evaluateDiscoveryCompliance(report);
|
|
91
|
-
const { computerName } = await import("./cliKeys.js");
|
|
92
|
-
const { countOf } = await import("./plural.js");
|
|
93
|
-
const policy = !managed || enforcement === "observe"
|
|
94
|
-
? "Your workspace watches but doesn't block."
|
|
95
|
-
: enforcement === "block"
|
|
96
|
-
? "Your workspace blocks MCP servers it denied."
|
|
97
|
-
: "Your workspace requires MCP servers to go through Passport.";
|
|
130
|
+
const outcome = await sendInventory(gateway, runtime);
|
|
98
131
|
return {
|
|
99
|
-
json:
|
|
100
|
-
human:
|
|
101
|
-
`Sent the MCP setup on ${computerName()} to Passport: ${countOf(direct, "direct MCP configuration")}, ${review} waiting for review.`,
|
|
102
|
-
policy,
|
|
103
|
-
...(!compliance.compliant
|
|
104
|
-
? [
|
|
105
|
-
`${countOf(compliance.routeRequired, "MCP server")} must go through Passport, and ${compliance.denied} ${compliance.denied === 1 ? "is" : "are"} denied.`
|
|
106
|
-
]
|
|
107
|
-
: [])
|
|
108
|
-
].join("\n"),
|
|
132
|
+
json: outcome.json,
|
|
133
|
+
human: outcome.lines.join("\n"),
|
|
109
134
|
essential: true,
|
|
110
|
-
exitCode:
|
|
135
|
+
exitCode: outcome.compliant ? 0 : 5
|
|
111
136
|
};
|
|
112
137
|
});
|
|
113
138
|
}
|
|
139
|
+
/** Scan's inventory step: only for a signed-in person, never for an agent token. */
|
|
140
|
+
function inventoryStep(args, runtime) {
|
|
141
|
+
try {
|
|
142
|
+
if (resolveCliAuth(args, runtime.env).kind === "agent-key")
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
return () => withGateway(args, runtime, (gateway) => sendInventory(gateway, runtime));
|
|
149
|
+
}
|
|
114
150
|
async function search(args, runtime) {
|
|
115
151
|
const query = args.positionals.join(" ").trim();
|
|
116
152
|
if (value(args, "app") !== undefined && !value(args, "app").trim())
|
|
@@ -426,6 +462,8 @@ async function hook(args, runtime) {
|
|
|
426
462
|
async function dispatch(args, runtime) {
|
|
427
463
|
switch (args.command) {
|
|
428
464
|
case "init":
|
|
465
|
+
if (value(args, "org") !== undefined)
|
|
466
|
+
return (await import("./cliSetupOrg.js")).setupOrg(args, runtime);
|
|
429
467
|
return (await import("./cliInit.js")).init(args, runtime);
|
|
430
468
|
case "login":
|
|
431
469
|
return login(args, runtime);
|
|
@@ -456,7 +494,7 @@ async function dispatch(args, runtime) {
|
|
|
456
494
|
case "discover":
|
|
457
495
|
return discover(args, runtime);
|
|
458
496
|
case "scan":
|
|
459
|
-
return (await import("./cliScan.js")).scan(args, runtime);
|
|
497
|
+
return (await import("./cliScan.js")).scan(args, runtime, undefined, inventoryStep(args, runtime));
|
|
460
498
|
case "hook":
|
|
461
499
|
return hook(args, runtime);
|
|
462
500
|
case "env":
|
|
@@ -476,8 +514,10 @@ async function dispatch(args, runtime) {
|
|
|
476
514
|
case "keys":
|
|
477
515
|
return (await import("./cliKeys.js")).keys(args, runtime);
|
|
478
516
|
case "setup":
|
|
479
|
-
if (value(args, "org") !== undefined)
|
|
517
|
+
if (value(args, "org") !== undefined) {
|
|
518
|
+
await renamedNotice(args, runtime, "passport setup --org is now passport init --org.\nRun: passport init --org <key> --yes");
|
|
480
519
|
return (await import("./cliSetupOrg.js")).setupOrg(args, runtime);
|
|
520
|
+
}
|
|
481
521
|
return (await import("./cliSetup.js")).setup(args, runtime, withGateway);
|
|
482
522
|
case "session":
|
|
483
523
|
return runCliSession(args, runtime, dispatch);
|
package/dist/cliOutput.js
CHANGED
|
@@ -27,7 +27,8 @@ const EXAMPLES = {
|
|
|
27
27
|
init: [
|
|
28
28
|
["passport init", "Detect, show one plan, ask once"],
|
|
29
29
|
["passport init --dry-run", "Show the plan and change nothing"],
|
|
30
|
-
["passport init --yes", "Use the recommended setup without asking"]
|
|
30
|
+
["passport init --yes", "Use the recommended setup without asking"],
|
|
31
|
+
["passport init --org <key> --yes", "Set up a company computer (MDM)"]
|
|
31
32
|
],
|
|
32
33
|
login: [
|
|
33
34
|
["passport login", "Sign in through the browser"],
|
|
@@ -109,7 +110,7 @@ function withExamples(page, examples) {
|
|
|
109
110
|
function helpText(verb) {
|
|
110
111
|
const details = {
|
|
111
112
|
// copy-style-allow double-space: help columns line up
|
|
112
|
-
init:
|
|
113
|
+
init: "passport init [--yes] [--dry-run] [--move-keys] [--no-open] [--cloud <origin>] [--skip-apps] [--skip-agents] [--skip-guard] [--verbose] [--json]\nnpx passport-bridge@latest init [same options]\nnpx passport-bridge@latest init --org <pek_key> --yes [--agents <list>] [--cloud <origin>]\nsudo npx passport-bridge@latest init --org <pek_key> --yes --lock [--strict] [--agents <list>]\nSets up Passport in one pass: scans for keys your agents can reach, signs you in (or up), then shows one plan before changing anything: the apps it connects, the agents it adds Passport to, the guard for shell commands, how much agents can do on their own (Autopilot), every file it edits (each backed up first), and what stays as it is. One question applies it; n goes step by step. Run it again any time: finished steps are left as they are, and with nothing to change it asks nothing.\n --yes use the recommended setup without asking (needed without a terminal); never waits for app sign-ins; CLI keys stay on this computer\n --dry-run show the plan and change nothing\n --move-keys also move CLI keys into Passport and sign those CLIs out\n --no-open print links instead of opening a browser\n --cloud <url> a self-hosted Passport\n --skip-apps leave out connecting apps\n --skip-agents leave out adding Passport to agents\n --skip-guard leave out the guard\n --verbose show the full scan\n --json with --yes: one JSON summary with each step's status and the plan; without --yes: the plan only\nFor your company (MDM and scripts), --org sets up every agent on this computer without asking anything or signing in: a stable copy of the CLI, Passport in each detected agent at your company's one URL, and the guard and audit hooks. People sign in later from each agent. It prints one line per agent, exits 0 even when no agents are found, and repairs anything that drifted when run again.\n --org <key> your enrollment key (pek_…)\n --agents <list> only these: claude-code, codex, cursor, vscode, claude (--lock: the first three)\n --lock run as root: put the guard in each agent's managed settings, where people can't turn it off. Without administrator rights it writes nothing and prints what to deploy through MDM\n --strict with --lock: allow only managed hooks, and block commands when the guard can't run\nTo undo it, remove the guard, then the \"passport\" entry from each agent.\nRun: passport hook uninstall --agent <agent> --apply",
|
|
113
114
|
login:
|
|
114
115
|
// copy-style-allow double-space: help columns line up
|
|
115
116
|
"passport login [--workspace <id>] [--cloud <origin>] [--agent <id>] [--profile <name>] [--no-open] [--switch] [--verbose]\npassport login --complete <id>\nSigns in through the browser with a short code, stores a rotating sign-in for the CLI, and makes that profile active. Check the code in the browser matches the one in your terminal before you approve. Without --workspace, login reuses the workspace and cloud of the saved profile it refreshes, or the one workspace all saved profiles share; it never chooses between several. With no saved workspace, the browser signs you in or up and you pick or create a workspace. Passport Cloud is the default; self-hosted servers take --cloud.\n Already signed in: login says as whom and asks Switch? [y/N]. --switch skips the question and lets the browser pick again.\n Without a terminal, or with --json: two steps. Login prints {verification_url, code, next_step} and exits; after the code is approved, run next_step (passport login --complete <id>) to finish.\n --verbose also show the profile name and where the sign-in is saved",
|
|
@@ -140,11 +141,11 @@ function helpText(verb) {
|
|
|
140
141
|
resources: "passport resources [uri] [--out <file>]\nLists or reads workspace MCP resources. Binary content requires --out or --json.",
|
|
141
142
|
prompts: "passport prompts [name] [--set key=value] [--out <file>]\nLists or gets workspace MCP prompts. Binary content requires --out or --json.",
|
|
142
143
|
// copy-style-allow double-space: help columns line up
|
|
143
|
-
scan: "passport scan [--path <folder>] [--verbose] [--check] [--json]\nnpx passport-bridge@latest scan [same options]\nFinds keys your agents can reach: agent configs, CLI sign-ins, your shell\nenvironment, and this project's .env files. Runs locally with no account
|
|
144
|
-
discover: "passport discover\
|
|
144
|
+
scan: "passport scan [--path <folder>] [--verbose] [--check] [--json]\nnpx passport-bridge@latest scan [same options]\nFinds keys your agents can reach: agent configs, CLI sign-ins, your shell\nenvironment, and this project's .env files. Runs locally with no account,\nand no part of a key is ever printed or sent. Signed in, it also tells\nPassport which MCP servers your agents use (each one's name and how it\nconnects, never its keys) and exits 5 when your workspace's policy doesn't\nallow one.\n --path <folder> scan this project instead of the current folder\n --verbose show every place a key was found and files it couldn't read\n --check files only, no shell environment; exit 5 on a high or\n medium key (CI, pre-commit)\n --json one JSON document: {version,findings,agents,unreadable,checked,inventory?}",
|
|
145
|
+
discover: "passport discover\nNow part of passport scan, which reports the same MCP servers when you're signed in.\nRun: passport scan",
|
|
145
146
|
hook: "passport hook install [--agent claude-code|codex|cursor] [--guard] [--apply] [--verbose]\npassport hook uninstall [--agent claude-code|codex|cursor] [--guard] [--apply] [--verbose]\npassport hook status\nThe audit hook runs after each shell command an agent runs and records the vendor, a coarse verb, a risk class, and the environment in Activity. With --guard, Passport also decides each command before it runs, from your Autopilot rules: it runs what your rules allow without a prompt (only when it recognizes every part of the command), asks first, or blocks. When nobody is at the keyboard, an ask becomes an approval request you answer on the web or your phone. Neither hook sends the command line, its output, your folder path, or your environment; an approval request carries a summary with secrets removed on this computer. It reads the project's own shell scripts, make targets, and package scripts (npm, pnpm, yarn) before they run, up to 256 KB a file and 30 ms a command, and decides from what they run; a script it can't follow to the end is partly checked and gets no allow. Tell Passport what other scripts do with passport actions add. Changes are previewed unless --apply is supplied; --verbose shows each hook's full command. uninstall --guard removes only the guard.",
|
|
146
|
-
setup: "passport setup
|
|
147
|
-
session: 'passport session\nReads newline-delimited {"id"?:string|number,"argv":string[]} requests from stdin and emits one JSON response per line. Reuses one authenticated MCP session. Supported request commands: status, search, describe, run, connect, resources, prompts
|
|
147
|
+
setup: "passport setup list\npassport setup installed\npassport setup install <setup-id> <workflow-key> --agent <codex|claude-code> [--apply]\npassport setup remove <skill-name> [--apply]\npassport setup rollback <skill-name> [--apply]\nLists assigned workflows and safely manages their local skill files. Changes are previewed unless --apply is supplied. Personal edits are preserved. Installed inventory, removal, and rollback work offline.\nSetting up a company's computers is passport init --org.",
|
|
148
|
+
session: 'passport session\nReads newline-delimited {"id"?:string|number,"argv":string[]} requests from stdin and emits one JSON response per line. Reuses one authenticated MCP session. Supported request commands: status, search, describe, run, connect, resources, prompts.',
|
|
148
149
|
access: "passport access <keygen|actions|run|invoke|status|cancel>\nkeygen writes a new owner-only private key and separate public JWK. Other commands use PASSPORT_ENDPOINT, PASSPORT_CLIENT_ID, and PASSPORT_PRIVATE_KEY_FILE.\n access actions [--delegation-id <id>]\n access run --input <json-file>\n access invoke --input <json-file> --caller <stable-id>\n access status <invocation-id>\n access cancel <run-id>",
|
|
149
150
|
completion: "passport completion <bash|zsh|fish>\nPrints an offline shell-completion script to stdout.",
|
|
150
151
|
help: "passport help [command]",
|
|
@@ -166,8 +167,8 @@ Usage: passport <command> [options]
|
|
|
166
167
|
${exampleLines(EXAMPLES.help)}
|
|
167
168
|
|
|
168
169
|
Commands:
|
|
169
|
-
scan Find keys your agents can reach
|
|
170
|
-
init Set up Passport for your agents
|
|
170
|
+
scan Find the keys and MCP servers your agents can reach
|
|
171
|
+
init Set up Passport for your agents (--org for company computers)
|
|
171
172
|
login Sign in or sign up in the browser
|
|
172
173
|
logout Revoke and remove a profile
|
|
173
174
|
profiles List saved profiles and which one is in use
|
|
@@ -181,7 +182,6 @@ Commands:
|
|
|
181
182
|
connect Sign in to your apps
|
|
182
183
|
resources List or read MCP resources
|
|
183
184
|
prompts List or get MCP prompts
|
|
184
|
-
discover Report MCP servers set up on this computer
|
|
185
185
|
hook Record the CLIs your agents run, and decide before they run
|
|
186
186
|
wait Wait for a person to decide an approval request
|
|
187
187
|
rules Test what Autopilot decides for a command
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Refresh this computer's copy of the rules, then keep the agents' own
|
|
3
3
|
* allowlists in line with them when this computer syncs those
|
|
4
|
-
* (passport sync, init,
|
|
4
|
+
* (passport sync, init, init --org). Never rejects.
|
|
5
5
|
*/
|
|
6
6
|
import { type CliPolicyRefresh, type CliPolicyRefreshDependencies } from "./cliPolicy.js";
|
|
7
7
|
export declare function refreshRules(profile: string, signal: AbortSignal, deps?: CliPolicyRefreshDependencies): Promise<CliPolicyRefresh>;
|
package/dist/cliPolicyRefresh.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Refresh this computer's copy of the rules, then keep the agents' own
|
|
3
3
|
* allowlists in line with them when this computer syncs those
|
|
4
|
-
* (passport sync, init,
|
|
4
|
+
* (passport sync, init, init --org). Never rejects.
|
|
5
5
|
*/
|
|
6
6
|
import { readCliPolicy, refreshCliPolicy } from "./cliPolicy.js";
|
|
7
7
|
import { nativeSyncEnabled, syncNative } from "./nativeSync.js";
|
package/dist/cliScan.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { type ParsedArgs } from "./cliArgs.js";
|
|
2
2
|
import { type CommandResult, type Runtime } from "./cliSupport.js";
|
|
3
3
|
import { type ScanResult } from "./scan.js";
|
|
4
|
+
/** What the MCP-config inventory sent, and what the workspace made of it. */
|
|
5
|
+
export type InventoryOutcome = {
|
|
6
|
+
json: {
|
|
7
|
+
snapshot: unknown;
|
|
8
|
+
report: unknown;
|
|
9
|
+
compliant: boolean;
|
|
10
|
+
};
|
|
11
|
+
lines: string[];
|
|
12
|
+
compliant: boolean;
|
|
13
|
+
};
|
|
4
14
|
export type ScanRenderOptions = {
|
|
5
15
|
color: boolean;
|
|
6
16
|
width: number;
|
|
@@ -8,6 +18,8 @@ export type ScanRenderOptions = {
|
|
|
8
18
|
/** How to run `init` from here, or undefined while it isn't available. */
|
|
9
19
|
initCommand?: string;
|
|
10
20
|
platform: NodeJS.Platform;
|
|
21
|
+
/** What the MCP-config inventory said, when it ran (signed in). */
|
|
22
|
+
inventory?: string[];
|
|
11
23
|
};
|
|
12
24
|
export type ScanContext = {
|
|
13
25
|
cwd: string;
|
|
@@ -15,7 +27,10 @@ export type ScanContext = {
|
|
|
15
27
|
platform: NodeJS.Platform;
|
|
16
28
|
nodeVersion: string;
|
|
17
29
|
};
|
|
18
|
-
/** `passport scan` / `npx passport-bridge@latest scan`.
|
|
19
|
-
|
|
30
|
+
/** `passport scan` / `npx passport-bridge@latest scan`. The key scan is local
|
|
31
|
+
* only: no account, no network. Signed in (`inventory`), it then sends the
|
|
32
|
+
* MCP-config inventory `passport discover` used to send: server names and how
|
|
33
|
+
* they connect, never a key. `--check` (CI, pre-commit) stays local. */
|
|
34
|
+
export declare function scan(args: ParsedArgs, runtime: Runtime, context?: ScanContext, inventory?: () => Promise<InventoryOutcome>): Promise<CommandResult>;
|
|
20
35
|
export declare function colorEnabled(runtime: Pick<Runtime, "stdout" | "env">): boolean;
|
|
21
36
|
export declare function renderScan(result: ScanResult, options: ScanRenderOptions): string;
|