passport-bridge 0.36.0 → 0.37.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 CHANGED
@@ -63,6 +63,7 @@ passport run github_search_issues '{"query":"SSO"}'
63
63
  | `describe <tool>` | One exact definition with its full parameter schema. |
64
64
  | `run <tool> [json]` | Run a tool through Passport governance. |
65
65
  | `connect [app...] [--alias <name>] [--open] [--wait <s>]` | Show member sign-in links and optionally wait for completion. |
66
+ | `connections [app] [--no-open]` | What's connected for you and what still needs you, then your connections page in the browser. See [Your connections](#your-connections). |
66
67
  | `request <app> [--full] --reason "<why>"` | Ask an admin for an app you don't have, or for Full access where you have Read-only. A person decides in Passport; nothing is granted here. See [Asking for access](#asking-for-access). |
67
68
  | `resources [uri] [--out <file>]` | List or read MCP resources. |
68
69
  | `prompts [name] [--set k=v] [--out <file>]` | List or get MCP prompts. |
@@ -105,6 +106,18 @@ passport connect github --wait 120
105
106
  - The CLI never retries after a network failure or timeout, since the outcome is unknown.
106
107
  - `connect` with no app names uses one aggregate link when several apps need sign-in. Agent tokens get guidance but cannot create sign-in links.
107
108
 
109
+ ### Your connections
110
+
111
+ ```sh
112
+ passport connections
113
+ passport connections github
114
+ ```
115
+
116
+ - Lists every app you're granted: `Connected as you`, `Needs connecting`, `Ready · connected by your company` (no sign-in of yours), or `Waiting on your admin`. Apps that need you come first; a named app comes before them.
117
+ - Then opens your connections page in the browser (`#cp/connections`), where Connect and Reconnect start your own sign-in with the app. `--no-open` and `--json` print the link instead. The link works for 10 minutes and never signs a browser in: it goes through your workspace's sign-in when the browser isn't signed in, and refuses a browser signed in as someone else.
118
+ - When the CLI or an agent is refused because an app needs connecting, the refusal names `passport connections <app>`; the MCP's `passport_manage_connections` returns the same page as `connectionsUrl`.
119
+ - `--json`: `{workspace,apps:[{app,name,status,connectedAs?}],needsYou,url?,expiresAt?,opened}`. Agent tokens have no connections page (exit 6, `member_profile_required`).
120
+
108
121
  ### Asking for access
109
122
 
110
123
  ```sh
package/dist/cliArgs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const COMMANDS: readonly ["init", "login", "logout", "profiles", "use", "status", "doctor", "ready", "search", "describe", "run", "connect", "request", "resources", "prompts", "discover", "scan", "hook", "wait", "rules", "actions", "tasks", "changes", "env", "where", "sync", "exec", "kube-credential", "git-credential", "undo", "keys", "setup", "session", "access", "update", "completion", "help", "version"];
1
+ export declare const COMMANDS: readonly ["init", "login", "logout", "profiles", "use", "status", "doctor", "ready", "search", "describe", "run", "connect", "connections", "request", "resources", "prompts", "discover", "scan", "hook", "wait", "rules", "actions", "tasks", "changes", "env", "where", "sync", "exec", "kube-credential", "git-credential", "undo", "keys", "setup", "session", "access", "update", "completion", "help", "version"];
2
2
  export type Command = (typeof COMMANDS)[number];
3
3
  /** Old names that still run for one release, left out of help, completion,
4
4
  * and suggestions. `discover` is part of `scan` now. */
package/dist/cliArgs.js CHANGED
@@ -12,6 +12,7 @@ export const COMMANDS = [
12
12
  "describe",
13
13
  "run",
14
14
  "connect",
15
+ "connections",
15
16
  "request",
16
17
  "resources",
17
18
  "prompts",
@@ -57,7 +58,7 @@ const FLAGS = {
57
58
  apply: { kind: "boolean", commands: ["setup", "hook"] },
58
59
  guard: { kind: "boolean", commands: ["hook"] },
59
60
  hold: { kind: "value", commands: ["hook"] },
60
- "no-open": { kind: "boolean", commands: ["login", "init"] },
61
+ "no-open": { kind: "boolean", commands: ["login", "init", "connections"] },
61
62
  yes: { kind: "boolean", commands: ["init", "setup", "keys", "undo", "actions"] },
62
63
  // `init --org` is setup for MDM; `setup --org` still runs it for one release.
63
64
  org: { kind: "value", commands: ["init", "setup"] },
@@ -0,0 +1,40 @@
1
+ /**
2
+ * `passport connections [app] [--no-open]`: the developer's own connections, in the terminal and
3
+ * in the browser. It prints what's connected for this person and what still needs them, then opens
4
+ * their connections page with a link that lasts ten minutes (`POST /api/my/connections-link`). The
5
+ * link never signs a browser in by itself: the page still needs the person's own sign-in.
6
+ *
7
+ * passport connections every app, and the page
8
+ * passport connections github the page with GitHub highlighted
9
+ *
10
+ * Agent hooks and the MCP point here when a connection is missing.
11
+ */
12
+ import { type ParsedArgs } from "./cliArgs.js";
13
+ import { type GatewayRunner } from "./cliConnect.js";
14
+ import { type AutopilotDependencies } from "./cliMemberCall.js";
15
+ import { type CommandResult, type Runtime } from "./cliSupport.js";
16
+ import { type Term } from "./term.js";
17
+ /** One app as `passport connections --json` reports it. */
18
+ export type ConnectionsRow = {
19
+ app: string;
20
+ name: string;
21
+ status: "connected" | "needs_your_signin" | "needs_setup" | "org_managed" | string;
22
+ connectedAs?: string;
23
+ /** Signed in before, but the sign-in stopped working. */
24
+ reconnect?: true;
25
+ };
26
+ export type ConnectionsJson = {
27
+ workspace: string;
28
+ apps: ConnectionsRow[];
29
+ needsYou: number;
30
+ /** The page's link: lasts ten minutes. Absent when Passport couldn't make one. */
31
+ url?: string;
32
+ expiresAt?: number;
33
+ opened: boolean;
34
+ };
35
+ export type ConnectionsDependencies = AutopilotDependencies & {
36
+ open?: (url: string) => boolean;
37
+ term?: Term;
38
+ };
39
+ export declare function connectionsScreen(term: Term, view: ConnectionsJson, focus: string | undefined, linkNote: "opened" | "printed" | "none"): string;
40
+ export declare function connections(args: ParsedArgs, runtime: Runtime, withGateway: GatewayRunner, deps?: ConnectionsDependencies): Promise<CommandResult>;
@@ -0,0 +1,125 @@
1
+ /**
2
+ * `passport connections [app] [--no-open]`: the developer's own connections, in the terminal and
3
+ * in the browser. It prints what's connected for this person and what still needs them, then opens
4
+ * their connections page with a link that lasts ten minutes (`POST /api/my/connections-link`). The
5
+ * link never signs a browser in by itself: the page still needs the person's own sign-in.
6
+ *
7
+ * passport connections every app, and the page
8
+ * passport connections github the page with GitHub highlighted
9
+ *
10
+ * Agent hooks and the MCP point here when a connection is missing.
11
+ */
12
+ import { bool } from "./cliArgs.js";
13
+ import { managePayload } from "./cliConnect.js";
14
+ import { api } from "./cliMemberCall.js";
15
+ import { failure, openUrl, readBoundedJson, resolveCliAuth, timeoutMs } from "./cliSupport.js";
16
+ import { countOf } from "./plural.js";
17
+ import { mark, table, termOf, wrap } from "./term.js";
18
+ const USAGE = "Use: passport connections [app] [--no-open]";
19
+ const APP_KEY = /^[a-z0-9][a-z0-9._-]{0,63}$/;
20
+ function rowsOf(connections) {
21
+ return connections.map((row) => ({
22
+ app: String(row.app ?? ""),
23
+ name: String(row.name ?? row.app ?? "app"),
24
+ status: String(row.status ?? "unknown"),
25
+ ...(typeof row.connectedAs === "string" && row.connectedAs ? { connectedAs: row.connectedAs } : {}),
26
+ ...(row.reconnect === true ? { reconnect: true } : {})
27
+ }));
28
+ }
29
+ /** The status in the page's words, and the house mark for it. */
30
+ function said(row) {
31
+ switch (row.status) {
32
+ case "connected":
33
+ return { mark: "done", words: row.connectedAs ? `Connected as you · ${row.connectedAs}` : "Connected as you" };
34
+ case "org_managed":
35
+ return { mark: "done", words: "Ready · connected by your company" };
36
+ case "needs_your_signin":
37
+ return { mark: "warn", words: row.reconnect ? "Needs reconnecting" : "Needs connecting" };
38
+ case "needs_setup":
39
+ return { mark: "skip", words: "Waiting on your admin" };
40
+ default:
41
+ return { mark: "skip", words: row.status.replace(/_/g, " ") };
42
+ }
43
+ }
44
+ const ORDER = { needs_your_signin: 0, connected: 1, org_managed: 2, needs_setup: 3 };
45
+ async function mintLink(args, runtime, deps, app) {
46
+ try {
47
+ const response = await api(args, runtime, deps).fetchApi("/api/my/connections-link", {
48
+ method: "POST",
49
+ headers: { "content-type": "application/json", accept: "application/json" },
50
+ body: JSON.stringify(app ? { app } : {}),
51
+ signal: AbortSignal.any([runtime.signal, AbortSignal.timeout(timeoutMs(args))])
52
+ });
53
+ if (!response.ok) {
54
+ await response.body?.cancel().catch(() => undefined);
55
+ return undefined;
56
+ }
57
+ const answer = await readBoundedJson(response);
58
+ if (typeof answer.url !== "string" || !/^https?:\/\//.test(answer.url))
59
+ return undefined;
60
+ return { url: answer.url, expiresAt: typeof answer.expiresAt === "number" ? answer.expiresAt : 0 };
61
+ }
62
+ catch (error) {
63
+ if (runtime.signal.aborted)
64
+ throw error;
65
+ return undefined;
66
+ }
67
+ }
68
+ export function connectionsScreen(term, view, focus, linkNote) {
69
+ const lines = [];
70
+ const width = term.width;
71
+ lines.push(...wrap(`Your connections in ${view.workspace}`, width));
72
+ const rows = [...view.apps].sort((a, b) => Number(b.app === focus) - Number(a.app === focus) ||
73
+ (ORDER[a.status] ?? 9) - (ORDER[b.status] ?? 9) ||
74
+ a.name.localeCompare(b.name));
75
+ if (!rows.length)
76
+ lines.push(" No apps yet. Your admin adds them.");
77
+ lines.push(...table(rows.map((row) => {
78
+ const { mark: kind, words } = said(row);
79
+ return [` ${mark(term, kind)} ${row.name}`, words];
80
+ }), width));
81
+ lines.push("");
82
+ if (view.needsYou)
83
+ lines.push(...wrap(`${countOf(view.needsYou, "app")} need${view.needsYou === 1 ? "s" : ""} you.`, width));
84
+ if (linkNote === "opened")
85
+ lines.push(...wrap("Opened your connections page in your browser.", width));
86
+ if (view.url && linkNote !== "none") {
87
+ lines.push(linkNote === "opened" ? "If it didn't open:" : "Open your connections page:", ` ${view.url}`);
88
+ lines.push(...wrap("The link works for 10 minutes.", width));
89
+ }
90
+ else if (!view.url) {
91
+ lines.push(...wrap("Couldn't make a link to your connections page. Connect from here instead:", width));
92
+ lines.push(`Run: passport connect${focus ? ` ${focus}` : ""}`);
93
+ }
94
+ return lines.join("\n");
95
+ }
96
+ export async function connections(args, runtime, withGateway, deps = {}) {
97
+ const [requested, extra] = args.positionals;
98
+ const focus = requested?.trim().toLowerCase();
99
+ if (extra !== undefined || (focus !== undefined && !APP_KEY.test(focus))) {
100
+ return failure("Name one app by its key, like github or linear.", 6, "usage", { hint: USAGE });
101
+ }
102
+ if (!deps.api && resolveCliAuth(args, runtime.env).kind !== "profile") {
103
+ return failure("Your connections page is a person's. Agent tokens have none.", 6, "member_profile_required", {
104
+ hint: "Run: passport login"
105
+ });
106
+ }
107
+ const managed = await withGateway(args, runtime, async (gateway) => managePayload(await gateway.callTool("passport_manage_connections", { includeLinks: false })));
108
+ // An app that isn't granted still opens the page, which offers Request when the catalog has it.
109
+ const apps = rowsOf(managed.connections);
110
+ const link = await mintLink(args, runtime, deps, focus);
111
+ const shouldOpen = Boolean(link) && !bool(args, "no-open") && !bool(args, "json");
112
+ const opened = shouldOpen ? (deps.open ?? openUrl)(link.url) : false;
113
+ const view = {
114
+ workspace: managed.workspace.name,
115
+ apps,
116
+ needsYou: apps.filter((row) => row.status === "needs_your_signin").length,
117
+ ...(link ? { url: link.url, expiresAt: link.expiresAt } : {}),
118
+ opened
119
+ };
120
+ const term = deps.term ?? termOf(runtime.stdout, runtime.env);
121
+ return {
122
+ json: view,
123
+ human: connectionsScreen(term, view, focus, link ? (opened ? "opened" : "printed") : "none")
124
+ };
125
+ }
package/dist/cliMain.js CHANGED
@@ -456,6 +456,8 @@ async function dispatch(args, runtime) {
456
456
  return run(args, runtime);
457
457
  case "connect":
458
458
  return connect(args, runtime, withGateway);
459
+ case "connections":
460
+ return (await import("./cliConnections.js")).connections(args, runtime, withGateway);
459
461
  case "resources":
460
462
  return resources(args, runtime);
461
463
  case "prompts":
package/dist/cliOutput.js CHANGED
@@ -112,6 +112,10 @@ const EXAMPLES = {
112
112
  describe: [["passport describe github_search_issues", "One tool's parameters"]],
113
113
  run: [['passport run github_search_issues \'{"query":"SSO"}\'', "Run a tool through your rules"]],
114
114
  connect: [["passport connect github --wait 120", "Sign in to an app and wait for it"]],
115
+ connections: [
116
+ ["passport connections", "What's connected for you, and your connections page"],
117
+ ["passport connections github", "The page with GitHub first"]
118
+ ],
115
119
  completion: [["passport completion zsh", "Print zsh completion"]],
116
120
  update: [
117
121
  ["passport update", "Install the version Passport names"],
@@ -170,6 +174,7 @@ const HELP_GROUPS = [
170
174
  [
171
175
  ["keys", "Move CLI keys from this computer into Passport"],
172
176
  ["exec", "Run a vendor CLI with a key Passport holds"],
177
+ ["connections", "Your connections: what's connected and what needs you"],
173
178
  ["connect", "Sign in to your apps"],
174
179
  ["search", "Find tools you can run"],
175
180
  ["describe", "Show one tool and its parameters"],
@@ -266,6 +271,7 @@ function helpText(verb, all = false) {
266
271
  describe: "passport describe <tool>\nShows one tool: what it does and every parameter it takes.",
267
272
  // copy-style-allow double-space: help columns line up
268
273
  run: "passport run <tool> [json-object]\n --args - read the JSON object from stdin\n --set key=value set a string argument (repeatable)\n --set-json key=<json> set a typed argument (repeatable)\n --wait <sec> retry only a definite approval_pending call\nWithout --json, prints the tool's text as it returned it. JSON: the tool's whole result.",
274
+ connections: "passport connections [app] [--no-open]\nLists what's connected for you and what still needs you, then opens your connections page in your browser. The link works for 10 minutes and still needs your own sign-in.\nJSON: {workspace,apps,needsYou,url?,expiresAt?,opened}",
269
275
  connect: "passport connect [app…] [--alias <name>] [--open] [--wait <sec>]\nShows the link to sign in to your apps, and can wait for the sign-in to finish.\nJSON: each app's status and its sign-in link.",
270
276
  resources: "passport resources [uri] [--out <file>]\nLists or reads workspace MCP resources. Binary content requires --out or --json.",
271
277
  prompts: "passport prompts [name] [--set key=value] [--out <file>]\nLists or gets workspace MCP prompts. Binary content requires --out or --json.",
package/dist/cliResult.js CHANGED
@@ -63,15 +63,19 @@ export function refusalOf(result) {
63
63
  ? `Open: ${connectUrl}\nFinish the browser sign-in, then retry the command.`
64
64
  : app
65
65
  ? "Run the connect action below, then retry the command."
66
- : "See which app needs connecting.\nRun: passport status",
66
+ : "See what needs connecting on your connections page.\nRun: passport connections",
67
67
  next: app
68
68
  ? [
69
69
  {
70
70
  argv: ["passport", "connect", app, "--wait", "120"],
71
71
  description: "Connect the required app, then retry the tool call."
72
+ },
73
+ {
74
+ argv: ["passport", "connections", app],
75
+ description: "Open your connections page with this app first."
72
76
  }
73
77
  ]
74
- : [{ argv: ["passport", "status"], description: "Identify the app that needs connecting." }]
78
+ : [{ argv: ["passport", "connections"], description: "See what needs connecting, and connect it." }]
75
79
  });
76
80
  }
77
81
  if (cause === "approval_pending") {
@@ -12,6 +12,7 @@ const DESCRIPTIONS = {
12
12
  describe: "Show one exact tool definition",
13
13
  run: "Run a governed tool",
14
14
  connect: "Connect member app accounts",
15
+ connections: "Your connections, and your connections page",
15
16
  request: "Ask an admin for an app or for Full access",
16
17
  resources: "List or read MCP resources",
17
18
  prompts: "List or get MCP prompts",
@@ -4,4 +4,4 @@
4
4
  * the version, then runs `npm run set-version -- <version>` in the plugin repo
5
5
  * and pushes (docs/RELEASING.md). `pluginPin.test.ts` fails when it drifts.
6
6
  */
7
- export declare const PLUGIN_PIN = "0.36.0";
7
+ export declare const PLUGIN_PIN = "0.37.0";
package/dist/pluginPin.js CHANGED
@@ -4,4 +4,4 @@
4
4
  * the version, then runs `npm run set-version -- <version>` in the plugin repo
5
5
  * and pushes (docs/RELEASING.md). `pluginPin.test.ts` fails when it drifts.
6
6
  */
7
- export const PLUGIN_PIN = "0.36.0";
7
+ export const PLUGIN_PIN = "0.37.0";
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.36.0";
1
+ export declare const VERSION = "0.37.0";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Keep in lockstep with bridge/package.json.
2
- export const VERSION = "0.36.0";
2
+ export const VERSION = "0.37.0";
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "passport-bridge",
3
- "version": "0.36.0",
3
+ "version": "0.37.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "passport-bridge",
9
- "version": "0.36.0",
9
+ "version": "0.37.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@modelcontextprotocol/sdk": "1.32.1"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "passport-bridge",
3
- "version": "0.36.0",
3
+ "version": "0.37.0",
4
4
  "description": "Passport CLI for governed terminal and CI agents, plus the local stdio-to-cloud MCP bridge.",
5
5
  "license": "MIT",
6
6
  "repository": {