passport-bridge 0.16.13 → 0.16.14
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 +15 -15
- package/dist/bridgeExchange.d.ts +7 -1
- package/dist/bridgeExchange.js +11 -2
- package/dist/cli.js +3 -1
- package/dist/cliActions.js +37 -18
- package/dist/cliArgs.js +14 -9
- package/dist/cliAutopilot.js +35 -14
- package/dist/cliAutopilotPolicy.d.ts +10 -0
- package/dist/cliAutopilotPolicy.js +28 -0
- package/dist/cliConnect.js +7 -6
- package/dist/cliDeadline.js +2 -1
- package/dist/cliEnv.js +5 -4
- package/dist/cliExec.js +13 -5
- package/dist/cliGuardState.d.ts +2 -0
- package/dist/cliGuardState.js +5 -1
- package/dist/cliHelp.d.ts +5 -4
- package/dist/cliHelp.js +2 -27
- package/dist/cliHook.js +6 -2
- package/dist/cliHookGuard.js +2 -2
- package/dist/cliHookInstall.d.ts +3 -0
- package/dist/cliHookInstall.js +17 -7
- package/dist/cliHookStatus.d.ts +2 -1
- package/dist/cliHookStatus.js +26 -17
- package/dist/cliInit.js +5 -3
- package/dist/cliKeys.d.ts +3 -0
- package/dist/cliKeys.js +59 -77
- package/dist/cliKeysShim.js +7 -5
- package/dist/cliLogin.js +44 -24
- package/dist/cliLogout.js +23 -7
- package/dist/cliMain.js +48 -20
- package/dist/cliOffline.d.ts +2 -2
- package/dist/cliOffline.js +31 -8
- package/dist/cliOutput.js +72 -42
- package/dist/cliReady.d.ts +2 -1
- package/dist/cliReady.js +9 -6
- package/dist/cliResult.js +1 -1
- package/dist/cliScan.js +10 -28
- package/dist/cliSessions.d.ts +3 -2
- package/dist/cliSessions.js +19 -17
- package/dist/cliSetup.js +6 -4
- package/dist/cliSetupLock.js +1 -0
- package/dist/cliSetupOrg.js +7 -5
- package/dist/cliStatus.d.ts +2 -4
- package/dist/cliStatus.js +55 -60
- package/dist/cliSuggest.d.ts +3 -2
- package/dist/cliSuggest.js +19 -6
- package/dist/cliSupport.d.ts +1 -1
- package/dist/cliSupport.js +3 -7
- package/dist/cliSync.js +2 -0
- package/dist/cliUndo.d.ts +3 -1
- package/dist/cliUndo.js +14 -11
- package/dist/cliWait.d.ts +3 -2
- package/dist/cliWait.js +10 -18
- package/dist/doctor.d.ts +4 -1
- package/dist/doctor.js +43 -24
- package/dist/execNoKey.d.ts +1 -1
- package/dist/execNoKey.js +3 -2
- package/dist/execShims.js +2 -2
- package/dist/hookFastPath.js +1 -0
- package/dist/initAutopilotStep.js +5 -4
- package/dist/initInstall.js +4 -3
- package/dist/initKeysStep.js +1 -1
- package/dist/initLocalSteps.js +4 -2
- package/dist/initOutro.d.ts +1 -3
- package/dist/initOutro.js +7 -15
- package/dist/initPlan.js +6 -6
- package/dist/initUi.d.ts +2 -4
- package/dist/initUi.js +8 -17
- package/dist/keysLocal.js +3 -3
- package/dist/keysSecret.d.ts +6 -0
- package/dist/keysSecret.js +43 -0
- package/dist/launcherFastPath.js +1 -0
- package/dist/loginFlow.d.ts +1 -1
- package/dist/loginFlow.js +4 -4
- package/dist/pathLines.d.ts +1 -0
- package/dist/pathLines.js +23 -0
- package/dist/pluginPin.d.ts +1 -1
- package/dist/pluginPin.js +1 -1
- package/dist/plural.d.ts +10 -0
- package/dist/plural.js +14 -0
- package/dist/term.d.ts +49 -5
- package/dist/term.js +200 -26
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/waitingLine.js +2 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/cliMain.js
CHANGED
|
@@ -46,7 +46,10 @@ async function syncCliPolicy(profile, args, runtime, api) {
|
|
|
46
46
|
await refreshCliPolicy(profile, signal, api ? { api } : {});
|
|
47
47
|
}
|
|
48
48
|
async function doctor(args, runtime) {
|
|
49
|
-
const { formatDoctorReport, runDoctor } = await
|
|
49
|
+
const [{ formatDoctorReport, runDoctor, signedOut }, { termOf }] = await Promise.all([
|
|
50
|
+
import("./doctor.js"),
|
|
51
|
+
import("./term.js")
|
|
52
|
+
]);
|
|
50
53
|
const report = await runDoctor({
|
|
51
54
|
version: VERSION,
|
|
52
55
|
profile: value(args, "profile"),
|
|
@@ -59,9 +62,10 @@ async function doctor(args, runtime) {
|
|
|
59
62
|
});
|
|
60
63
|
return {
|
|
61
64
|
json: report,
|
|
62
|
-
human: formatDoctorReport(report),
|
|
65
|
+
human: formatDoctorReport(report, termOf(runtime.stdout, runtime.env)),
|
|
63
66
|
essential: true,
|
|
64
|
-
|
|
67
|
+
// Not signed in is exit 2, like every other command that needs a sign-in.
|
|
68
|
+
exitCode: report.ok ? 0 : signedOut(report) ? 2 : 1
|
|
65
69
|
};
|
|
66
70
|
}
|
|
67
71
|
async function discover(args, runtime) {
|
|
@@ -82,16 +86,25 @@ async function discover(args, runtime) {
|
|
|
82
86
|
const direct = Number(report.stats?.directConnections ?? 0);
|
|
83
87
|
const review = Number(report.stats?.needsReview ?? 0);
|
|
84
88
|
const enforcement = String(report.policy?.enforcement ?? "observe");
|
|
89
|
+
const managed = report.policy?.fleetMode === "managed";
|
|
85
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.";
|
|
86
98
|
return {
|
|
87
99
|
json: { snapshot, report, compliant: compliance.compliant },
|
|
88
100
|
human: [
|
|
89
|
-
`
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
+
: [])
|
|
95
108
|
].join("\n"),
|
|
96
109
|
essential: true,
|
|
97
110
|
exitCode: compliance.compliant ? 0 : 5
|
|
@@ -108,27 +121,32 @@ async function search(args, runtime) {
|
|
|
108
121
|
...(value(args, "app") ? { app: value(args, "app") } : {})
|
|
109
122
|
}));
|
|
110
123
|
const payload = payloadOf(result, "search");
|
|
124
|
+
const { countOf } = await import("./plural.js");
|
|
111
125
|
const lines = [];
|
|
126
|
+
const note = typeof payload.note === "string" ? payload.note : undefined;
|
|
112
127
|
if (query) {
|
|
113
128
|
const results = Array.isArray(payload.results) ? payload.results : [];
|
|
129
|
+
// Each tool's name on its own line, what it does under it.
|
|
114
130
|
for (const hit of results) {
|
|
115
|
-
lines.push(
|
|
131
|
+
lines.push(String(hit.tool ?? ""), ` ${hit.readonly ? "Read-only" : "Can change things"} · ${firstSentence(String(hit.description ?? ""))}`);
|
|
116
132
|
}
|
|
117
|
-
if (!results.length)
|
|
133
|
+
if (!results.length && !note)
|
|
118
134
|
lines.push("No matching tools.");
|
|
119
135
|
}
|
|
120
136
|
else {
|
|
121
137
|
const catalog = Array.isArray(payload.catalog) ? payload.catalog : [];
|
|
122
138
|
for (const group of catalog) {
|
|
123
139
|
const tools = Array.isArray(group.tools) ? group.tools.map(String) : [];
|
|
124
|
-
|
|
140
|
+
const readOnly = group.access === "read-only" ? ", read-only" : "";
|
|
141
|
+
lines.push(`${String(group.app ?? group.key ?? "app")}: ${countOf(tools.length, "tool")}${readOnly}`);
|
|
125
142
|
lines.push(...tools.map((tool) => ` ${tool}`));
|
|
126
143
|
}
|
|
127
144
|
if (!catalog.length)
|
|
128
|
-
lines.push("No
|
|
145
|
+
lines.push("No tools you can run yet.");
|
|
129
146
|
}
|
|
130
|
-
|
|
131
|
-
|
|
147
|
+
// A listing ends with its own count; a search with what to do next.
|
|
148
|
+
if (note && query)
|
|
149
|
+
lines.push(note);
|
|
132
150
|
return { json: payload, human: lines.join("\n") };
|
|
133
151
|
});
|
|
134
152
|
}
|
|
@@ -159,7 +177,7 @@ async function describe(args, runtime) {
|
|
|
159
177
|
const schema = described.parameters ?? {};
|
|
160
178
|
const human = [
|
|
161
179
|
String(described.tool),
|
|
162
|
-
`${described.readonly ? "Read-only" : "
|
|
180
|
+
`${described.readonly ? "Read-only" : "Can change things"}`,
|
|
163
181
|
String(described.description ?? ""),
|
|
164
182
|
"Parameters:",
|
|
165
183
|
JSON.stringify(schema, null, 2)
|
|
@@ -179,7 +197,7 @@ async function run(args, runtime) {
|
|
|
179
197
|
const refusal = refusalOf(result);
|
|
180
198
|
if (!refusal) {
|
|
181
199
|
if (waitingForApproval && !bool(args, "quiet"))
|
|
182
|
-
runtime.stderr.write("
|
|
200
|
+
runtime.stderr.write("Approved. Running it now…\n");
|
|
183
201
|
break;
|
|
184
202
|
}
|
|
185
203
|
if (refusal.cause === "needs_connect" && auth.kind === "agent-key") {
|
|
@@ -215,7 +233,8 @@ async function run(args, runtime) {
|
|
|
215
233
|
throw refusal;
|
|
216
234
|
if (!waitingForApproval && !bool(args, "quiet")) {
|
|
217
235
|
const approval = refusal.details.approvalId ? ` (${refusal.details.approvalId})` : "";
|
|
218
|
-
|
|
236
|
+
const { countOf } = await import("./plural.js");
|
|
237
|
+
runtime.stderr.write(`Waiting for approval${approval}, up to ${countOf(waitSeconds, "second")}…\n`);
|
|
219
238
|
waitingForApproval = true;
|
|
220
239
|
}
|
|
221
240
|
await sleep(Math.min(APPROVAL_RETRY_MS, remaining), runtime.signal);
|
|
@@ -395,6 +414,15 @@ function promptBytes(messages) {
|
|
|
395
414
|
}
|
|
396
415
|
return failure("A multi-part binary prompt cannot be written to one file. Use --json.", 6, "usage");
|
|
397
416
|
}
|
|
417
|
+
/** Bare `passport hook` reads an agent's event from stdin. Typed at a
|
|
418
|
+
* terminal, nothing will arrive: it shows its help instead of waiting. */
|
|
419
|
+
async function hook(args, runtime) {
|
|
420
|
+
if (!args.positionals.length && runtime.stdin?.isTTY) {
|
|
421
|
+
const page = await (await import("./cliHelp.js")).help({ ...args, command: "help", positionals: ["hook"] }, runtime);
|
|
422
|
+
return { ...page, exitCode: 6 };
|
|
423
|
+
}
|
|
424
|
+
return (await import("./cliHook.js")).hook(args, runtime);
|
|
425
|
+
}
|
|
398
426
|
async function dispatch(args, runtime) {
|
|
399
427
|
switch (args.command) {
|
|
400
428
|
case "init":
|
|
@@ -404,7 +432,7 @@ async function dispatch(args, runtime) {
|
|
|
404
432
|
case "logout":
|
|
405
433
|
return (await import("./cliLogout.js")).logout(args, runtime);
|
|
406
434
|
case "profiles":
|
|
407
|
-
return profilesResult(args);
|
|
435
|
+
return profilesResult(args, runtime);
|
|
408
436
|
case "use":
|
|
409
437
|
return useProfileResult(args, runtime.env);
|
|
410
438
|
case "status":
|
|
@@ -430,7 +458,7 @@ async function dispatch(args, runtime) {
|
|
|
430
458
|
case "scan":
|
|
431
459
|
return (await import("./cliScan.js")).scan(args, runtime);
|
|
432
460
|
case "hook":
|
|
433
|
-
return
|
|
461
|
+
return hook(args, runtime);
|
|
434
462
|
case "env":
|
|
435
463
|
case "rules":
|
|
436
464
|
case "actions":
|
package/dist/cliOffline.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ParsedArgs } from "./cliArgs.js";
|
|
2
|
-
import { type CommandResult, type Env } from "./cliSupport.js";
|
|
2
|
+
import { type CommandResult, type Env, type Runtime } from "./cliSupport.js";
|
|
3
3
|
export declare function completionResult(args: ParsedArgs): CommandResult;
|
|
4
|
-
export declare function profilesResult(_args: ParsedArgs): CommandResult;
|
|
4
|
+
export declare function profilesResult(_args: ParsedArgs, runtime?: Pick<Runtime, "stdout" | "env">): CommandResult;
|
|
5
5
|
export declare function useProfileResult(args: ParsedArgs, env: Env): CommandResult;
|
|
6
6
|
export declare function versionResult(args: ParsedArgs, env: Env): CommandResult;
|
package/dist/cliOffline.js
CHANGED
|
@@ -2,6 +2,8 @@ import { value } from "./cliArgs.js";
|
|
|
2
2
|
import { completionScript } from "./completion.js";
|
|
3
3
|
import { inferredProfileClient, readActiveProfile, readCreds, setActiveProfile } from "./credentials.js";
|
|
4
4
|
import { endpoint, failure, FIRST_LOGIN_HINT, FIRST_LOGIN_NEXT, profileName, selectStoredProfile } from "./cliSupport.js";
|
|
5
|
+
import { loginIdentity } from "./loginIdentity.js";
|
|
6
|
+
import { mark, paint, termOf } from "./term.js";
|
|
5
7
|
import { VERSION } from "./version.js";
|
|
6
8
|
export function completionResult(args) {
|
|
7
9
|
const shell = args.positionals[0];
|
|
@@ -11,7 +13,24 @@ export function completionResult(args) {
|
|
|
11
13
|
const script = completionScript(shell);
|
|
12
14
|
return { json: { shell, script }, human: script, essential: true, raw: true };
|
|
13
15
|
}
|
|
14
|
-
|
|
16
|
+
/** "Erin Park in Acme" for a saved profile, from what login cached. */
|
|
17
|
+
function whoIs(profile) {
|
|
18
|
+
const identity = loginIdentity(profile);
|
|
19
|
+
if (identity?.name && identity.workspaceName)
|
|
20
|
+
return `${identity.name} in ${identity.workspaceName}`;
|
|
21
|
+
return identity?.name || identity?.workspaceName;
|
|
22
|
+
}
|
|
23
|
+
/** A person and workspace with the profile id dimmed beside it, or the id alone. */
|
|
24
|
+
function profileLabel(term, profile, extra = "") {
|
|
25
|
+
const who = whoIs(profile);
|
|
26
|
+
const id = `${profile}${extra}`;
|
|
27
|
+
return who ? `${who} ${paint(term, "dim", `(${id})`)}` : id;
|
|
28
|
+
}
|
|
29
|
+
function termFor(stream, env) {
|
|
30
|
+
return termOf((stream ?? {}), env);
|
|
31
|
+
}
|
|
32
|
+
export function profilesResult(_args, runtime) {
|
|
33
|
+
const term = termFor(runtime?.stdout, runtime?.env ?? {});
|
|
15
34
|
const creds = readCreds();
|
|
16
35
|
const names = Object.keys(creds).sort();
|
|
17
36
|
const selection = selectStoredProfile(_args, {}, creds, true);
|
|
@@ -29,11 +48,12 @@ export function profilesResult(_args) {
|
|
|
29
48
|
essential: true
|
|
30
49
|
};
|
|
31
50
|
}
|
|
51
|
+
// ● marks the one commands use; the id is what `passport use` takes.
|
|
32
52
|
const lines = [
|
|
33
53
|
"Passport profiles:",
|
|
34
|
-
...profiles.map((profile) => ` ${profile.active ? "
|
|
54
|
+
...profiles.map((profile) => ` ${profile.active ? mark(term, "live") : " "} ${profileLabel(term, profile.name)}${profile.active ? " · in use" : ""}`),
|
|
35
55
|
"",
|
|
36
|
-
"
|
|
56
|
+
"Run: passport use <name>"
|
|
37
57
|
];
|
|
38
58
|
return {
|
|
39
59
|
json: { profiles, ...(active ? { active } : {}), selectionSource: selection.source },
|
|
@@ -71,8 +91,8 @@ export function useProfileResult(args, env) {
|
|
|
71
91
|
...(overridden ? { overriddenBy: "PASSPORT_PROFILE" } : {})
|
|
72
92
|
},
|
|
73
93
|
human: overridden
|
|
74
|
-
? `Saved
|
|
75
|
-
: `
|
|
94
|
+
? `Saved ${profile} as the profile to use.\nPASSPORT_PROFILE still picks ${environmentProfile} for commands that sign in.`
|
|
95
|
+
: `Now using ${profileLabel(termFor(undefined, env), profile)}.\nRun: passport status`
|
|
76
96
|
};
|
|
77
97
|
}
|
|
78
98
|
export function versionResult(args, env) {
|
|
@@ -127,12 +147,15 @@ export function versionResult(args, env) {
|
|
|
127
147
|
`Profiles: ${profileCount}`,
|
|
128
148
|
...(resolvedEndpoint ? [`Endpoint: ${resolvedEndpoint}`] : []),
|
|
129
149
|
...(agentMode
|
|
130
|
-
? ["
|
|
150
|
+
? ["Signed in with an agent key", "Run: passport status"]
|
|
131
151
|
: profile
|
|
132
|
-
? [
|
|
152
|
+
? [
|
|
153
|
+
`Profile: ${profileLabel(termFor(undefined, env), profile, `, ${selection.source}`)}`,
|
|
154
|
+
"Run: passport status"
|
|
155
|
+
]
|
|
133
156
|
: [
|
|
134
157
|
profileCount === 0 ? "Not signed in." : "No profile selected.",
|
|
135
|
-
...next.slice(0, 1).map((action) => `
|
|
158
|
+
...next.slice(0, 1).map((action) => `Run: ${action.argv.join(" ")}`)
|
|
136
159
|
])
|
|
137
160
|
].join("\n"),
|
|
138
161
|
essential: true
|
package/dist/cliOutput.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ArgError, bool } from "./cliArgs.js";
|
|
2
2
|
import { SERVER_TOO_OLD } from "./cliProtocol.js";
|
|
3
3
|
import { CliFailure, sanitize } from "./cliSupport.js";
|
|
4
|
-
import {
|
|
4
|
+
import { layout, mark, termOf } from "./term.js";
|
|
5
5
|
import { VERSION } from "./version.js";
|
|
6
|
-
const RENAMED_FLAGS = "--agent and --agents were --client and --clients; the old names still work.";
|
|
6
|
+
const RENAMED_FLAGS = "The --agent and --agents options were --client and --clients; the old names still work.";
|
|
7
7
|
/** What each exit code means. Scripts and agents branch on these; the
|
|
8
8
|
* meanings never change (bridge/README.md, docs/troubleshooting.mdx). */
|
|
9
9
|
export const EXIT_CODES = [
|
|
@@ -19,7 +19,7 @@ export const EXIT_CODES = [
|
|
|
19
19
|
const EXAMPLES = {
|
|
20
20
|
help: [
|
|
21
21
|
["passport init", "Set up Passport for your agents"],
|
|
22
|
-
["passport status", "
|
|
22
|
+
["passport status", "Your setup on one screen"],
|
|
23
23
|
["passport exec -- railway up", "Run a CLI with a key Passport holds"],
|
|
24
24
|
['passport rules test "railway up"', "See what Autopilot decides for a command"],
|
|
25
25
|
["passport help <command>", "Every option for one command"]
|
|
@@ -34,7 +34,7 @@ const EXAMPLES = {
|
|
|
34
34
|
["passport login --no-open", "Print the link instead of opening a browser"]
|
|
35
35
|
],
|
|
36
36
|
status: [
|
|
37
|
-
["passport status", "
|
|
37
|
+
["passport status", "Your setup on one screen"],
|
|
38
38
|
["passport status --json", "The same as one JSON object"]
|
|
39
39
|
],
|
|
40
40
|
wait: [
|
|
@@ -91,7 +91,9 @@ function exampleLines(examples) {
|
|
|
91
91
|
const width = Math.max(...examples.map(([command]) => command.length));
|
|
92
92
|
return [
|
|
93
93
|
"Examples:",
|
|
94
|
-
...examples.map(([command, what]) =>
|
|
94
|
+
...examples.map(([command, what]) =>
|
|
95
|
+
// copy-style-allow double-space: help columns line up
|
|
96
|
+
width > EXAMPLE_COLUMN ? ` ${command}\n ${what}` : ` ${command.padEnd(width)} ${what}`)
|
|
95
97
|
].join("\n");
|
|
96
98
|
}
|
|
97
99
|
/** A verb's page: its usage lines, then examples, then the rest. */
|
|
@@ -106,45 +108,57 @@ function withExamples(page, examples) {
|
|
|
106
108
|
}
|
|
107
109
|
function helpText(verb) {
|
|
108
110
|
const details = {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
// copy-style-allow double-space: help columns line up
|
|
112
|
+
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]\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\nTo undo it, remove the guard, then the "passport" entry from each agent.\nRun: passport hook uninstall --agent <agent> --apply',
|
|
113
|
+
login:
|
|
114
|
+
// copy-style-allow double-space: help columns line up
|
|
115
|
+
"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",
|
|
111
116
|
logout: "passport logout [--profile <name>]\nRevokes the rotating sign-in and always removes the local profile.",
|
|
112
117
|
profiles: "passport profiles\nLists saved profiles and marks the active profile. Works offline.",
|
|
113
118
|
use: "passport use <name>\nSelects a saved profile as the default for subsequent commands. Works offline.",
|
|
114
|
-
status: "passport status\
|
|
115
|
-
wait: "passport wait <approval-id> [--timeout <sec>]\nWaits for a person to decide an approval request (default 100 seconds).
|
|
119
|
+
status: "passport status\nShows you, your workspace, and this computer; each agent's guard and its fix; Autopilot presets, team floors, and how old this computer's copy of your rules is; apps; keys Passport holds and when each was last used; this folder's environments; and the CLI version.\nJSON: {workspace,member,endpoint,auth,profile?,client,mcps:[{app,name,status,toolCount}],autopilot?:{presets,floors,cache},computer,keys?,folder,cli}",
|
|
120
|
+
wait: "passport wait <approval-id> [--timeout <sec>]\nWaits for a person to decide an approval request (default 100 seconds). While it is still waiting, prints the approval link; on a terminal, one live line counts down. Ctrl-C stops waiting and the request stays open (exit 4).\n Approved: prints who approved it; run the command again. Exit 0.\n Declined: prints the note for the agent. Exit 5.\n Expired: the agent can ask again. Exit 5.\n Still waiting at the timeout: exit 4; run it again.",
|
|
116
121
|
rules: 'passport rules test "<command>" [--environment production|staging|development]\nShows what Autopilot decides for a command, why, and which environment it acts on. The command is read on this computer; only its app and verb are sent to Passport.',
|
|
117
|
-
actions: "passport actions\npassport actions add <script> [args…] --environment production|staging|development --class read|change|delete|irreversible [--args <glob>]\npassport actions add --id <op_…> --environment <kind> --class <class>\npassport actions sync\nTells Passport what a project script does, so the guard checks it: its environment and action class. Your presets and exceptions still decide what runs; a project script never runs on its say-so alone. <script> is a file in the project, or make, npm, pnpm, or yarn with the target or script name. --args is a glob over its arguments (* is any). --id is the id a Session row shows under Tell Passport what this does; this computer resolves it, since the script's name never left it. sync proposes each entry of the project's .passport/actions.toml. You can say Production for a change, delete, or irreversible action; anything else waits for an admin in Rules › Environments › Project scripts. Sends the script's path in the repository, the repository's fingerprint and name, and a SHA-256 of what it runs, never its contents.\nJSON: {action} | {actions:[…]}",
|
|
122
|
+
actions: "passport actions\npassport actions add <script> [args…] --environment production|staging|development --class read|change|delete|irreversible [--args <glob>]\npassport actions add --id <op_…> --environment <kind> --class <class>\npassport actions sync\nTells Passport what a project script does, so the guard checks it: its environment and action class. Your presets and exceptions still decide what runs; a project script never runs on its say-so alone. <script> is a file in the project, or make, npm, pnpm, or yarn with the target or script name. --args is a glob over its arguments (* is any). --id is the id a Session row shows under \"Tell Passport what this does\"; this computer resolves it, since the script's name never left it. sync proposes each entry of the project's .passport/actions.toml. You can say Production for a change, delete, or irreversible action; anything else waits for an admin in Rules › Environments › Project scripts. Sends the script's path in the repository, the repository's fingerprint and name, and a SHA-256 of what it runs, never its contents.\nJSON: {action} | {actions:[…]}",
|
|
123
|
+
// copy-style-allow double-space: help columns line up
|
|
118
124
|
sync: "passport sync [--remove]\nAdds what your Autopilot rules run without asking (reads, and changes inside the project: tests, builds, formatters, git add, git commit) to each agent's own allowlist, so those prompts stop even offline and in Codex. Claude Code: permissions.allow in ~/.claude/settings.json. Codex: ~/.codex/rules/passport.rules. Cursor CLI: permissions.allow in ~/.cursor/cli-config.json; Cursor: terminalAllowlist in ~/.cursor/permissions.json when you keep one there. Deletes, installs, and Production never sync. Your own entries are never changed. Runs again on its own when your rules change.\n --remove take Passport's entries out and stop syncing\nJSON: {action,agents:[{agent,name,path,added,removed,skipped?}]}",
|
|
125
|
+
// copy-style-allow double-space: help columns line up
|
|
119
126
|
env: "passport env [--json]\npassport env set <vendor> <resource> <production|staging|development>\nShows where commands in this folder land, read the way each vendor's own CLI reads it: Railway, Vercel, Supabase, Wrangler, Netlify, Firebase, Convex, Neon, Fly, Heroku, kubectl, AWS, gcloud, Terraform, Stripe, and database URLs. One row per app: the resource, how Passport knows (linked, a flag, the vendor's default), and its environment. Anything Passport can't place counts as Production. Read on this computer; nothing is sent.\n set place a resource for the whole workspace. Admins choose any environment; everyone else can only say Production.\nJSON: {environments:[{vendor,resource,how,kind,assumed,note?}]}",
|
|
120
127
|
sessions: "passport sessions [--status running|idle|ended]\nLists your agents' recent sessions with what Passport decided: ran, asked, and blocked.\nJSON: {sessions:[{id,client,folder,status,startedAt,lastActivityAt,counts,environments,waiting}],nextCursor}",
|
|
121
|
-
|
|
128
|
+
// copy-style-allow double-space: help columns line up
|
|
129
|
+
exec: "passport exec [--wait <sec>] [--ask-again] [--verbose] [--mask | --no-masking] -- <cli> [args…]\nRuns railway, gh, vercel, wrangler, supabase, stripe, aws, neonctl, or flyctl with a key Passport holds, after your Autopilot rules decide. The key reaches only that command's environment, short-lived where the vendor allows (GitHub App tokens, 15-minute AWS sessions, 15-minute Cloudflare tokens). The exit code passes through unchanged.\n Output: when stdout isn't a terminal (an agent's shell, a pipe, a log), any copy of the key the CLI prints (raw, base64, or URL-encoded) reads <hidden by Passport>, since that output is kept and read later. In a terminal the CLI gets the terminal itself (colors, prompts), unmasked.\n --mask hide the key in a terminal too (the CLI then writes to a pipe)\n --no-masking never hide it (in a shim, set PASSPORT_EXEC_NO_MASKING=1)\n --verbose say which key was issued (on stderr)\n Asks: waits for your approval in Passport when you're at the keyboard or with --wait; otherwise exits 4 with the approval id. Run passport wait <id>, then the command again.\n Blocked or declined: exit 5 with the reason. A decline answers the same command for ten minutes; --ask-again requests it again.\n No key in Passport, or it stopped working: exit 3.\n Offline: nothing runs (exit 1); exec never uses a key on this computer.\n Refuses shells, env, and subcommands that would print the key or run another program with it.",
|
|
130
|
+
// copy-style-allow double-space: help columns line up
|
|
122
131
|
undo: "passport undo <action-id> [--option <id>] [--yes]\npassport undo --last [--option <id>] [--yes]\nUndoes an action Passport took a backup before (deletes and overwrites through Passport, within 7 days). Shows what comes back and what won't, then asks. Without a terminal, add --yes to run it. Passport decides the undo like a change in that environment; when Production approvers cover the action, one of them approves it.\n --last your newest action that can be undone\n --option <id> pick a listed option (default: the first)\n Done: exit 0. Partly done or failed: exit 1.\n Asks first: exit 4 with the approval id. Run passport wait <id>, then the undo again.\n Blocked, declined, or can't be undone: exit 5. No backup: exit 6.\nJSON: {actionId,status,message,steps:[{label,ok,detail?}],option,undoActionId?}; a preview is {actionId,status:\"preview\",preview,next}",
|
|
123
132
|
keys: "passport keys [list]\npassport keys move [<cli>] [--yes] [--no-shim]\npassport keys add <cli>\npassport keys shim [<cli>] [--remove]\nmove: finds CLI sign-ins on this computer (Railway, GitHub CLI, Vercel, Wrangler, Supabase, Stripe, AWS, and keys in Claude Code's settings), stores each in Passport after you confirm it ([y/N]), then signs that CLI out here. With <cli>, only that one. When Passport already holds a different key for that CLI, every agent that uses it would switch, so you type the CLI's name at a terminal to replace it; no flag does it, and without a terminal both keys stay. .env files are never touched: your apps need them. add: stores a key you paste (read from stdin, never echoed). Agents then use the keys through passport exec.\nshim: so typing railway keeps working after its key moves, a small railway command in Passport's folder (~/.passport/cli/bin) runs passport exec -- railway. move offers one for each CLI it moved ([Y/n]; --yes installs them, --no-shim skips). Put the folder first on PATH (the line is printed when it isn't). With no <cli>, lists them; --remove <cli|all> takes them out. A shim goes by itself when Passport no longer holds that key, and when you sign out of the last profile.",
|
|
124
|
-
doctor: "passport doctor [--profile <name>]\nChecks Node,
|
|
125
|
-
ready: "passport ready [--profile <name>]\
|
|
126
|
-
search: "passport search [query
|
|
127
|
-
describe: "passport describe <tool>\nShows
|
|
128
|
-
|
|
129
|
-
|
|
133
|
+
doctor: "passport doctor [--profile <name>]\nChecks Node, how your sign-in is stored, the server, your sign-in, and that this CLI and the server match. Not signed in: exit 2.\nJSON: {ok,auth,profile?,profileCount,endpointOrigin?,server?,checks}",
|
|
134
|
+
ready: "passport ready [--profile <name>]\nThe same checks as doctor, for scripts and CI: is this CLI ready to use? Not signed in: exit 2.\nJSON: {ready,ok,auth,profile?,profileCount,endpointOrigin?,server?,checks}",
|
|
135
|
+
search: "passport search [query…] [--app <key>]\nFinds tools you can run that match the words. With no words, lists every tool you can run, by app.\nJSON: the search result, with a note on how to narrow it.",
|
|
136
|
+
describe: "passport describe <tool>\nShows one tool: what it does and every parameter it takes.",
|
|
137
|
+
// copy-style-allow double-space: help columns line up
|
|
138
|
+
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.",
|
|
139
|
+
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.",
|
|
130
140
|
resources: "passport resources [uri] [--out <file>]\nLists or reads workspace MCP resources. Binary content requires --out or --json.",
|
|
131
141
|
prompts: "passport prompts [name] [--set key=value] [--out <file>]\nLists or gets workspace MCP prompts. Binary content requires --out or --json.",
|
|
142
|
+
// copy-style-allow double-space: help columns line up
|
|
132
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.\nNothing leaves this computer, and no part of a key is ever printed.\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}",
|
|
133
|
-
discover: "passport discover\
|
|
134
|
-
hook: "passport hook install [--agent claude-code|codex|cursor] [--guard] [--apply]\npassport hook uninstall [--agent claude-code|codex|cursor] [--guard] [--apply]\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. uninstall --guard removes only the guard.",
|
|
135
|
-
setup: "passport setup --org <pek_key> [--yes] [--agents claude-code,cursor,
|
|
144
|
+
discover: "passport discover\nFinds MCP servers set up directly in this computer's agents and reports them to Passport: each one's name and how it connects, never its keys. Exits 5 when your workspace's policy doesn't allow one.",
|
|
145
|
+
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 --org <pek_key> [--yes] [--agents claude-code,codex,cursor,vscode,claude] [--cloud <origin>]\nnpx passport-bridge@latest setup --org <pek_key> --yes\nSets up every agent on this computer for your company without asking anything (for MDM and scripts): 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. Prints one line per agent and exits 0 even when no agents are found. Run it again to repair anything that drifted.\n\nsudo npx passport-bridge@latest setup --org <pek_key> --yes --lock [--strict] [--agents claude-code,codex,cursor]\nLocks the guard on for everyone on this computer: a root-owned launcher plus Passport's hooks in the managed settings of Claude Code, Codex, and Cursor, where people can't turn them off. --strict allows only managed hooks and blocks commands when the guard can't run. Files Passport didn't write are merged or left alone. Without administrator rights it writes nothing and prints what to deploy through MDM.\n\npassport 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.",
|
|
136
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, discover.',
|
|
137
148
|
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>",
|
|
138
149
|
completion: "passport completion <bash|zsh|fish>\nPrints an offline shell-completion script to stdout.",
|
|
139
|
-
help: "passport help [
|
|
150
|
+
help: "passport help [command]",
|
|
140
151
|
version: "passport version\nWorks without a profile or network."
|
|
141
152
|
};
|
|
153
|
+
// Every page ends the same way: the renamed-flags note on pages that take
|
|
154
|
+
// --agent, a blank line, then the global options.
|
|
142
155
|
const renamed = verb && details[verb]?.includes("--agent") ? `\n${RENAMED_FLAGS}` : "";
|
|
143
156
|
const page = verb && details[verb] ? withExamples(details[verb], verb === "help" ? undefined : EXAMPLES[verb]) : undefined;
|
|
144
|
-
if ((verb === "scan" || verb === "init") && page)
|
|
145
|
-
return page + renamed;
|
|
146
157
|
if (page)
|
|
147
158
|
return `${page}${renamed}\n\nGlobal: --profile <name> --json --timeout <sec> --quiet --caller <id>`;
|
|
159
|
+
// copy-style-allow double-space: help columns line up
|
|
160
|
+
const exitLines = EXIT_CODES.map(([code, meaning]) => ` ${code} ${meaning}`).join("\n");
|
|
161
|
+
// copy-style-allow double-space: help columns line up
|
|
148
162
|
return `Passport CLI ${VERSION}
|
|
149
163
|
|
|
150
164
|
Usage: passport <command> [options]
|
|
@@ -156,18 +170,18 @@ Commands:
|
|
|
156
170
|
init Set up Passport for your agents, step by step
|
|
157
171
|
login Sign in or sign up in the browser
|
|
158
172
|
logout Revoke and remove a profile
|
|
159
|
-
profiles List saved profiles and
|
|
160
|
-
use
|
|
161
|
-
status
|
|
162
|
-
doctor
|
|
173
|
+
profiles List saved profiles and which one is in use
|
|
174
|
+
use Pick the saved profile commands use
|
|
175
|
+
status Your setup on one screen
|
|
176
|
+
doctor Check this computer's setup and the server
|
|
163
177
|
ready Check whether this CLI is ready to use
|
|
164
|
-
search Find
|
|
165
|
-
describe Show one
|
|
166
|
-
run Run a
|
|
167
|
-
connect
|
|
178
|
+
search Find tools you can run
|
|
179
|
+
describe Show one tool and its parameters
|
|
180
|
+
run Run a tool through your rules
|
|
181
|
+
connect Sign in to your apps
|
|
168
182
|
resources List or read MCP resources
|
|
169
183
|
prompts List or get MCP prompts
|
|
170
|
-
discover
|
|
184
|
+
discover Report MCP servers set up on this computer
|
|
171
185
|
hook Record the CLIs your agents run, and decide before they run
|
|
172
186
|
wait Wait for a person to decide an approval request
|
|
173
187
|
rules Test what Autopilot decides for a command
|
|
@@ -188,10 +202,9 @@ Commands:
|
|
|
188
202
|
Global: --profile <name> --json --timeout <sec> --quiet --caller <id>
|
|
189
203
|
|
|
190
204
|
Exit codes:
|
|
191
|
-
${
|
|
205
|
+
${exitLines}
|
|
192
206
|
|
|
193
|
-
With --json, stdout is exactly one JSON value. Hints and warnings use stderr
|
|
194
|
-
${RENAMED_FLAGS}`;
|
|
207
|
+
With --json, stdout is exactly one JSON value. Hints and warnings use stderr.`;
|
|
195
208
|
}
|
|
196
209
|
export function helpResult(args) {
|
|
197
210
|
const verb = args.positionals[0];
|
|
@@ -209,8 +222,14 @@ export function emitResult(result, args, runtime) {
|
|
|
209
222
|
return;
|
|
210
223
|
if (Buffer.isBuffer(result.human))
|
|
211
224
|
runtime.stdout.write(result.human);
|
|
212
|
-
else
|
|
213
|
-
runtime.stdout.write(result.
|
|
225
|
+
else if (result.raw)
|
|
226
|
+
runtime.stdout.write(result.human);
|
|
227
|
+
else {
|
|
228
|
+
// Every human line fits the terminal (term.ts `layout`); piped, it's as is.
|
|
229
|
+
const width = termOf(runtime.stdout, runtime.env).width;
|
|
230
|
+
const text = layout(result.human, width);
|
|
231
|
+
runtime.stdout.write(`${text}${text.endsWith("\n") ? "" : "\n"}`);
|
|
232
|
+
}
|
|
214
233
|
}
|
|
215
234
|
/** Connection failures: nothing answered, or the connection dropped. */
|
|
216
235
|
const UNREACHABLE_CODES = new Set([
|
|
@@ -279,6 +298,10 @@ export function asFailure(error, origin) {
|
|
|
279
298
|
}
|
|
280
299
|
if (passportUnreachable(error))
|
|
281
300
|
return new CliFailure(unreachableMessage(origin), 1, "network_or_server");
|
|
301
|
+
// The sign-in works, but Passport refused this one request: not "expired".
|
|
302
|
+
if (error?.phase === "request") {
|
|
303
|
+
return new CliFailure("Passport refused this request.", 1, "refused", { hint: "Run: passport doctor" });
|
|
304
|
+
}
|
|
282
305
|
if (/token exchange failed|invalid_or_revoked|unauthori[sz]ed|\b401\b/i.test(message)) {
|
|
283
306
|
return new CliFailure("Passport authentication expired or was revoked.", 2, "auth", {
|
|
284
307
|
hint: "Run: passport login"
|
|
@@ -292,18 +315,25 @@ export function asFailure(error, origin) {
|
|
|
292
315
|
}
|
|
293
316
|
export function emitFailure(error, json, quiet, runtime) {
|
|
294
317
|
// On a terminal each line wraps to its width; piped, lines stay as they are.
|
|
295
|
-
const
|
|
296
|
-
const say = (text) => runtime.stderr.write(`${
|
|
318
|
+
const term = termOf(runtime.stderr, runtime.env);
|
|
319
|
+
const say = (text) => runtime.stderr.write(`${layout(text, term.width)}\n`);
|
|
320
|
+
// On a terminal a failure carries the house mark beside its words (! while
|
|
321
|
+
// a request still waits for a person, ✗ for anything else), and every line
|
|
322
|
+
// after the first sits under the words.
|
|
323
|
+
const marked = term.tty && !json;
|
|
324
|
+
const under = (text) => (marked ? text.replace(/^/gm, " ") : text);
|
|
297
325
|
if (json) {
|
|
298
326
|
runtime.stdout.write(`${JSON.stringify(failurePayload(error))}\n`);
|
|
299
327
|
}
|
|
300
328
|
else {
|
|
301
|
-
|
|
329
|
+
const [first = "", ...rest] = error.message.split("\n");
|
|
330
|
+
const lead = marked ? `${mark(term, error.exitCode === 4 ? "warn" : "fail")} ${first}` : first;
|
|
331
|
+
say(rest.length ? `${lead}\n${under(rest.join("\n"))}` : lead);
|
|
302
332
|
}
|
|
303
333
|
if (error.details.hint && !quiet)
|
|
304
|
-
say(error.details.hint);
|
|
334
|
+
say(under(error.details.hint));
|
|
305
335
|
if (error.details.approvalUrl && !json && !quiet && !error.details.linkShown) {
|
|
306
|
-
say(`Open in Passport: ${error.details.approvalUrl}`);
|
|
336
|
+
say(under(`Open in Passport: ${error.details.approvalUrl}`));
|
|
307
337
|
}
|
|
308
338
|
}
|
|
309
339
|
export function failurePayload(error) {
|
package/dist/cliReady.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type ParsedArgs } from "./cliArgs.js";
|
|
2
2
|
import { type CommandResult, type Runtime } from "./cliSupport.js";
|
|
3
3
|
import { type DoctorReport } from "./doctor.js";
|
|
4
|
+
import { type Term } from "./term.js";
|
|
4
5
|
/**
|
|
5
6
|
* Run the same local, auth, server, and protocol checks as doctor, with a
|
|
6
7
|
* machine-friendly `ready` field for agents and CI preflight scripts.
|
|
7
8
|
*/
|
|
8
9
|
export declare function ready(args: ParsedArgs, runtime: Runtime): Promise<CommandResult>;
|
|
9
|
-
export declare function formatReadyReport(report: DoctorReport): string;
|
|
10
|
+
export declare function formatReadyReport(report: DoctorReport, term?: Pick<Term, "color" | "unicode">): string;
|
package/dist/cliReady.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { value } from "./cliArgs.js";
|
|
2
2
|
import { callerFrom, endpoint, resolveCliAuth, sanitize, timeoutMs } from "./cliSupport.js";
|
|
3
|
-
import { formatDoctorReport, runDoctor } from "./doctor.js";
|
|
3
|
+
import { formatDoctorReport, runDoctor, signedOut } from "./doctor.js";
|
|
4
|
+
import { termOf } from "./term.js";
|
|
4
5
|
import { VERSION } from "./version.js";
|
|
5
6
|
/**
|
|
6
7
|
* Run the same local, auth, server, and protocol checks as doctor, with a
|
|
@@ -41,16 +42,18 @@ export async function ready(args, runtime) {
|
|
|
41
42
|
};
|
|
42
43
|
return {
|
|
43
44
|
json,
|
|
44
|
-
human: formatReadyReport(report),
|
|
45
|
+
human: formatReadyReport(report, termOf(runtime.stdout, runtime.env)),
|
|
45
46
|
essential: true,
|
|
46
|
-
exitCode: report.ok ? 0 : 1
|
|
47
|
+
exitCode: report.ok ? 0 : signedOut(report) ? 2 : 1
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
|
-
export function formatReadyReport(report) {
|
|
50
|
-
const lines = formatDoctorReport(report).split("\n");
|
|
50
|
+
export function formatReadyReport(report, term) {
|
|
51
|
+
const lines = formatDoctorReport(report, term).split("\n");
|
|
51
52
|
lines[0] = `Passport ready ${report.version}`;
|
|
52
53
|
lines[lines.length - 1] = report.ok
|
|
53
54
|
? "Ready: all required checks passed."
|
|
54
|
-
:
|
|
55
|
+
: signedOut(report)
|
|
56
|
+
? "Not signed in to Passport."
|
|
57
|
+
: "Not ready: fix the failed checks above.";
|
|
55
58
|
return lines.join("\n");
|
|
56
59
|
}
|
package/dist/cliResult.js
CHANGED
|
@@ -63,7 +63,7 @@ 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
|
-
: "
|
|
66
|
+
: "See which app needs connecting.\nRun: passport status",
|
|
67
67
|
next: app
|
|
68
68
|
? [
|
|
69
69
|
{
|