passport-bridge 0.44.0 → 0.46.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/dist/cliArgs.d.ts +1 -1
- package/dist/cliArgs.js +3 -0
- package/dist/cliConnect.d.ts +3 -1
- package/dist/cliConnect.js +58 -6
- package/dist/cliConnections.d.ts +3 -3
- package/dist/cliConnections.js +13 -5
- package/dist/cliExec.js +1 -5
- package/dist/cliGuardHealth.js +2 -1
- package/dist/cliHook.js +5 -1
- package/dist/cliHookAfter.js +2 -2
- package/dist/cliHookNotices.d.ts +7 -0
- package/dist/cliHookNotices.js +14 -0
- package/dist/cliMain.js +33 -3
- package/dist/cliOutput.js +4 -6
- package/dist/cliRequest.d.ts +65 -0
- package/dist/cliRequest.js +135 -0
- package/dist/cliScan.js +1 -1
- package/dist/cliSession.d.ts +0 -1
- package/dist/cliSession.js +0 -2
- package/dist/cliStatus.d.ts +4 -2
- package/dist/cliStatus.js +21 -4
- package/dist/cliSupport.d.ts +0 -8
- package/dist/completion.js +1 -0
- package/dist/connectorKit/engine.generated.d.ts +2 -2
- package/dist/connectorKit/engine.generated.js +23 -3
- package/dist/connectorKit/manifest.generated.d.ts +1 -1
- package/dist/connectorKit/manifests/github.generated.js +26 -3
- package/dist/connectorKit/manifests/githubCapture.generated.js +41 -10
- package/dist/connectorKit/manifests/githubHooks.generated.js +21 -1
- package/dist/connectorKit/manifests/githubReads.generated.d.ts +2 -0
- package/dist/connectorKit/manifests/githubReads.generated.js +30 -5
- package/dist/connectorKit/manifests/railway.generated.js +3 -3
- package/dist/connectorKit/manifests/supabase.generated.js +1 -1
- package/dist/connectorKit/manifests/supabaseApi.generated.js +1 -1
- package/dist/connectorKit/manifests/supabaseCapture.generated.js +1 -1
- package/dist/connectorKit/manifests/supabaseCatalog.generated.d.ts +1 -1
- package/dist/connectorKit/manifests/supabaseCatalog.generated.js +4 -4
- package/dist/controlPlane.generated.d.ts +18 -17
- package/dist/controlPlane.generated.js +15 -21
- package/dist/controlPlaneBasic.generated.d.ts +5 -5
- package/dist/controlPlaneBasic.generated.js +5 -5
- package/dist/controlPlaneGithub.generated.d.ts +2 -2
- package/dist/controlPlaneGithub.generated.js +12 -2
- package/dist/controlPlaneGithubApi.generated.d.ts +2 -0
- package/dist/controlPlaneGithubApi.generated.js +56 -1
- package/dist/controlPlaneGithubCatalog.generated.d.ts +9 -3
- package/dist/controlPlaneGithubCatalog.generated.js +19 -13
- package/dist/controlPlaneGithubCli.generated.d.ts +2 -0
- package/dist/controlPlaneGithubCli.generated.js +65 -12
- package/dist/controlPlaneGuard.js +2 -0
- package/dist/controlPlanePeople.generated.d.ts +117 -0
- package/dist/controlPlanePeople.generated.js +6 -0
- package/dist/controlPlaneSupabase.js +3 -1
- package/dist/controlPlaneUnnamed.generated.d.ts +58 -0
- package/dist/controlPlaneUnnamed.generated.js +225 -0
- package/dist/cpCli.js +5 -1
- package/dist/initAppsStep.d.ts +1 -1
- package/dist/initAppsStep.js +7 -5
- package/dist/initOutro.js +13 -10
- package/dist/initState.d.ts +3 -2
- package/dist/initState.js +7 -18
- package/dist/localNotices.d.ts +22 -0
- package/dist/localNotices.js +100 -0
- 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/dist/webLinks.d.ts +23 -6
- package/dist/webLinks.js +21 -22
- package/npm-shrinkwrap.json +8 -8
- package/package.json +1 -1
- package/dist/cliApprovalLink.d.ts +0 -5
- package/dist/cliApprovalLink.js +0 -21
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", "connections", "resources", "prompts", "discover", "scan", "hook", "exec", "kube-credential", "git-credential", "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", "exec", "kube-credential", "git-credential", "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; `setup --org` is
|
package/dist/cliArgs.js
CHANGED
|
@@ -13,6 +13,7 @@ export const COMMANDS = [
|
|
|
13
13
|
"run",
|
|
14
14
|
"connect",
|
|
15
15
|
"connections",
|
|
16
|
+
"request",
|
|
16
17
|
"resources",
|
|
17
18
|
"prompts",
|
|
18
19
|
"discover",
|
|
@@ -72,6 +73,8 @@ const FLAGS = {
|
|
|
72
73
|
session: { kind: "value", commands: ["exec"] },
|
|
73
74
|
alias: { kind: "value", commands: ["connect"] },
|
|
74
75
|
open: { kind: "boolean", commands: ["connect"] },
|
|
76
|
+
reason: { kind: "value", commands: ["request"] },
|
|
77
|
+
cancel: { kind: "boolean", commands: ["request"] },
|
|
75
78
|
out: { kind: "value", commands: ["resources", "prompts"] },
|
|
76
79
|
verbose: { kind: "boolean", commands: ["scan", "init", "exec", "login", "hook"] },
|
|
77
80
|
"no-masking": { kind: "boolean", commands: ["exec"] },
|
package/dist/cliConnect.d.ts
CHANGED
|
@@ -7,9 +7,11 @@ export type ManagePayload = {
|
|
|
7
7
|
id: string;
|
|
8
8
|
name: string;
|
|
9
9
|
};
|
|
10
|
+
/** Newer servers send the name and never the email; older ones send the email. */
|
|
10
11
|
member: {
|
|
11
12
|
id: string;
|
|
12
|
-
|
|
13
|
+
name?: string;
|
|
14
|
+
email?: string;
|
|
13
15
|
};
|
|
14
16
|
client: string;
|
|
15
17
|
surface: string;
|
package/dist/cliConnect.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { bool, value } from "./cliArgs.js";
|
|
2
2
|
import { SERVER_TOO_OLD } from "./cliProtocol.js";
|
|
3
3
|
import { firstText, payloadOf, requireSuccess } from "./cliResult.js";
|
|
4
|
-
import { failure, openUrl, sleep } from "./cliSupport.js";
|
|
4
|
+
import { failure, openUrl, readBoundedJson, sleep } from "./cliSupport.js";
|
|
5
5
|
import { countOf } from "./plural.js";
|
|
6
|
+
import { CONNECT_LINK_LIFETIME } from "./webLinks.js";
|
|
6
7
|
export function managePayload(result) {
|
|
7
8
|
requireSuccess(result);
|
|
8
9
|
const payload = payloadOf(result, "connection");
|
|
@@ -18,6 +19,46 @@ export function managePayload(result) {
|
|
|
18
19
|
}
|
|
19
20
|
return payload;
|
|
20
21
|
}
|
|
22
|
+
/** The app a refusal says isn't offered to this person ("\"jira\" isn't offered to you at Northwind."). */
|
|
23
|
+
function notOfferedApp(error) {
|
|
24
|
+
if (!(error instanceof Error))
|
|
25
|
+
return undefined;
|
|
26
|
+
return /^"([^"]{1,64})" isn't offered to you at /.exec(error.message)?.[1];
|
|
27
|
+
}
|
|
28
|
+
/** "Jira isn't offered to you at Northwind." and how to ask, or that they already did (docs/design/v21/requests.md). */
|
|
29
|
+
async function notOffered(app, message, auth, runtime) {
|
|
30
|
+
const workspace = /isn't offered to you at (.+?)\. Ask for it/.exec(message)?.[1] ?? "your company";
|
|
31
|
+
const name = app.charAt(0).toUpperCase() + app.slice(1);
|
|
32
|
+
let waiting;
|
|
33
|
+
if (auth.kind === "profile") {
|
|
34
|
+
try {
|
|
35
|
+
const { memberApi } = await import("./cliClient.js");
|
|
36
|
+
const response = await memberApi({ auth, timeoutMs: 5_000, signal: runtime.signal }).fetchApi("/api/my/app-requests", {
|
|
37
|
+
headers: { accept: "application/json" },
|
|
38
|
+
signal: runtime.signal
|
|
39
|
+
});
|
|
40
|
+
if (response.ok) {
|
|
41
|
+
const body = await readBoundedJson(response);
|
|
42
|
+
waiting = body.requests?.find((row) => row.status === "pending" && row.app.key === app.toLowerCase());
|
|
43
|
+
}
|
|
44
|
+
else
|
|
45
|
+
await response.body?.cancel().catch(() => undefined);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
/* Without the list, it says how to ask. */
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (waiting) {
|
|
52
|
+
const { shortDate } = await import("./cliRequest.js");
|
|
53
|
+
const who = waiting.statusLine.replace(/^Waiting for /, "");
|
|
54
|
+
return failure(`${name} isn't offered to you at ${workspace} yet. You asked on ${shortDate(waiting.askedAt)}; ${who} decides.`, 6, "not_offered", { app });
|
|
55
|
+
}
|
|
56
|
+
return failure(`${name} isn't offered to you at ${workspace}.`, 6, "not_offered", {
|
|
57
|
+
app,
|
|
58
|
+
hint: `Ask for it: passport request ${app} --reason "…"`,
|
|
59
|
+
next: [{ argv: ["passport", "request", app, "--reason", "<what it's for>"], description: "Ask for the app." }]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
21
62
|
function assertConnectionCanStart(auth, needSignin, urls, human, shouldOpen, shouldAct) {
|
|
22
63
|
if (auth.kind === "agent-key" && needSignin.length && shouldAct) {
|
|
23
64
|
return failure("Agent-token authentication cannot create a person's sign-in link.", 3, "member_profile_required", {
|
|
@@ -46,10 +87,19 @@ export async function connect(args, runtime, withGateway) {
|
|
|
46
87
|
return failure("--alias must contain 1-32 letters, numbers, spaces, or hyphens.", 6, "usage");
|
|
47
88
|
const requested = args.positionals;
|
|
48
89
|
return withGateway(args, runtime, async (gateway, auth) => {
|
|
49
|
-
let managed
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
90
|
+
let managed;
|
|
91
|
+
try {
|
|
92
|
+
managed = managePayload(await gateway.callTool("passport_manage_connections", {
|
|
93
|
+
...(alias !== undefined ? { alias: alias.trim() } : {}),
|
|
94
|
+
...(requested.length ? { apps: requested } : {})
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
const app = notOfferedApp(error);
|
|
99
|
+
if (app)
|
|
100
|
+
return notOffered(app, error instanceof Error ? error.message : "", auth, runtime);
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
53
103
|
const rows = requested.length
|
|
54
104
|
? requested.map((app) => findConnection(managed.connections, app))
|
|
55
105
|
: managed.connections;
|
|
@@ -119,7 +169,7 @@ function connectionUrls(managed, rows, explicitlyNamed) {
|
|
|
119
169
|
function connectionLines(managed, rows, explicitlyNamed) {
|
|
120
170
|
const urls = connectionUrls(managed, rows, explicitlyNamed);
|
|
121
171
|
if (!explicitlyNamed && urls.length === 1 && rows.filter((row) => row.status === "needs_your_signin").length >= 2) {
|
|
122
|
-
return ["Sign in to your apps on one page:", ` ${urls[0]}
|
|
172
|
+
return ["Sign in to your apps on one page:", ` ${urls[0]}`, CONNECT_LINK_LIFETIME];
|
|
123
173
|
}
|
|
124
174
|
const lines = [];
|
|
125
175
|
for (const row of rows) {
|
|
@@ -135,6 +185,8 @@ function connectionLines(managed, rows, explicitlyNamed) {
|
|
|
135
185
|
}
|
|
136
186
|
if (!lines.length || (!explicitlyNamed && !rows.some((row) => row.status === "needs_your_signin")))
|
|
137
187
|
lines.push(managed.note || "Nothing needs connecting.");
|
|
188
|
+
else if (urls.length)
|
|
189
|
+
lines.push(CONNECT_LINK_LIFETIME);
|
|
138
190
|
return lines;
|
|
139
191
|
}
|
|
140
192
|
async function waitForConnections(gateway, apps, seconds, signal) {
|
package/dist/cliConnections.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `passport connections [app] [--no-open]`: the developer's own connections, in the terminal and
|
|
3
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
|
|
4
|
+
* their connections page with a link that lasts fifteen minutes (`POST /api/my/connections-link`). The
|
|
5
5
|
* link never signs a browser in by itself: the page still needs the person's own sign-in.
|
|
6
6
|
*
|
|
7
7
|
* passport connections every app, and the page
|
|
@@ -27,7 +27,7 @@ export type ConnectionsJson = {
|
|
|
27
27
|
workspace: string;
|
|
28
28
|
apps: ConnectionsRow[];
|
|
29
29
|
needsYou: number;
|
|
30
|
-
/** The page's link: lasts
|
|
30
|
+
/** The page's link: lasts fifteen minutes. Absent when Passport couldn't make one. */
|
|
31
31
|
url?: string;
|
|
32
32
|
expiresAt?: number;
|
|
33
33
|
opened: boolean;
|
|
@@ -36,5 +36,5 @@ export type ConnectionsDependencies = MemberCallDependencies & {
|
|
|
36
36
|
open?: (url: string) => boolean;
|
|
37
37
|
term?: Term;
|
|
38
38
|
};
|
|
39
|
-
export declare function connectionsScreen(term: Term, view: ConnectionsJson, focus: string | undefined, linkNote: "opened" | "printed" | "none"): string;
|
|
39
|
+
export declare function connectionsScreen(term: Term, view: ConnectionsJson, focus: string | undefined, linkNote: "opened" | "printed" | "none", now?: number): string;
|
|
40
40
|
export declare function connections(args: ParsedArgs, runtime: Runtime, withGateway: GatewayRunner, deps?: ConnectionsDependencies): Promise<CommandResult>;
|
package/dist/cliConnections.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `passport connections [app] [--no-open]`: the developer's own connections, in the terminal and
|
|
3
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
|
|
4
|
+
* their connections page with a link that lasts fifteen minutes (`POST /api/my/connections-link`). The
|
|
5
5
|
* link never signs a browser in by itself: the page still needs the person's own sign-in.
|
|
6
6
|
*
|
|
7
7
|
* passport connections every app, and the page
|
|
@@ -32,11 +32,11 @@ function said(row) {
|
|
|
32
32
|
case "connected":
|
|
33
33
|
return { mark: "done", words: row.connectedAs ? `Connected as you · ${row.connectedAs}` : "Connected as you" };
|
|
34
34
|
case "org_managed":
|
|
35
|
-
return { mark: "done", words: "
|
|
35
|
+
return { mark: "done", words: "Connected by your company" };
|
|
36
36
|
case "needs_your_signin":
|
|
37
37
|
return { mark: "warn", words: row.reconnect ? "Needs reconnecting" : "Needs connecting" };
|
|
38
38
|
case "needs_setup":
|
|
39
|
-
return { mark: "skip", words: "
|
|
39
|
+
return { mark: "skip", words: "Not set up yet" };
|
|
40
40
|
default:
|
|
41
41
|
return { mark: "skip", words: row.status.replace(/_/g, " ") };
|
|
42
42
|
}
|
|
@@ -65,7 +65,13 @@ async function mintLink(args, runtime, deps, app) {
|
|
|
65
65
|
return undefined;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
/** "10 minutes": what's left of the link, from the server's own expiresAt (docs/design/v21/words.md, row 6). */
|
|
69
|
+
function linkLifetime(expiresAt, now) {
|
|
70
|
+
if (!expiresAt || expiresAt <= now)
|
|
71
|
+
return undefined;
|
|
72
|
+
return countOf(Math.max(1, Math.round((expiresAt - now) / 60_000)), "minute");
|
|
73
|
+
}
|
|
74
|
+
export function connectionsScreen(term, view, focus, linkNote, now = Date.now()) {
|
|
69
75
|
const lines = [];
|
|
70
76
|
const width = term.width;
|
|
71
77
|
lines.push(...wrap(`Your connections in ${view.workspace}`, width));
|
|
@@ -85,7 +91,9 @@ export function connectionsScreen(term, view, focus, linkNote) {
|
|
|
85
91
|
lines.push(...wrap("Opened your connections page in your browser.", width));
|
|
86
92
|
if (view.url && linkNote !== "none") {
|
|
87
93
|
lines.push(linkNote === "opened" ? "If it didn't open:" : "Open your connections page:", ` ${view.url}`);
|
|
88
|
-
|
|
94
|
+
const lifetime = linkLifetime(view.expiresAt, now);
|
|
95
|
+
if (lifetime)
|
|
96
|
+
lines.push(...wrap(`The link expires in ${lifetime}.`, width));
|
|
89
97
|
}
|
|
90
98
|
else if (!view.url) {
|
|
91
99
|
lines.push(...wrap("Couldn't make a link to your connections page. Connect from here instead:", width));
|
package/dist/cliExec.js
CHANGED
|
@@ -29,7 +29,6 @@ import { spawnVendor } from "./execSpawn.js";
|
|
|
29
29
|
import { shadowAfterDecision } from "./kitShadow.js";
|
|
30
30
|
export { spawnVendor } from "./execSpawn.js";
|
|
31
31
|
import { findVendorBinary } from "./execShims.js";
|
|
32
|
-
import { hashLink } from "./webLinks.js";
|
|
33
32
|
export const EXEC_AUTHORIZE_PATH = "/api/my/exec/authorize";
|
|
34
33
|
export const EXEC_RESULT_PATH = "/api/my/exec/result";
|
|
35
34
|
const SESSION = /^[A-Za-z0-9._:-]{1,128}$/;
|
|
@@ -226,10 +225,7 @@ export async function exec(args, runtime, deps = {}) {
|
|
|
226
225
|
const message = typeof decided.message === "string" && decided.message ? decided.message : "Passport didn't allow this command.";
|
|
227
226
|
if (decided.decision === "undecided")
|
|
228
227
|
return failure(message, 5, "undecided");
|
|
229
|
-
//
|
|
230
|
-
const link = decided.decision === "block" ? hashLink(auth.endpoint, decided.link) : null;
|
|
231
|
-
if (link)
|
|
232
|
-
return failure(message, 5, "no_access", { hint: `Access: ${link}` });
|
|
228
|
+
// A block's message carries the person's Why blocked link itself.
|
|
233
229
|
return failure(message, 5, "blocked");
|
|
234
230
|
}
|
|
235
231
|
let code;
|
package/dist/cliGuardHealth.js
CHANGED
|
@@ -71,7 +71,8 @@ export function localGuardState(report, cliVersion) {
|
|
|
71
71
|
export function guardStateFix(state, client) {
|
|
72
72
|
if (!state || state === "on" || state === "locked")
|
|
73
73
|
return null;
|
|
74
|
-
|
|
74
|
+
// My activity: its strip shows each agent's guard here.
|
|
75
|
+
const link = "#p";
|
|
75
76
|
const docs = `${DOCS_BASE}/member/cli-hook#guard-health`;
|
|
76
77
|
switch (state) {
|
|
77
78
|
case "off":
|
package/dist/cliHook.js
CHANGED
|
@@ -216,7 +216,11 @@ async function runAudit(args, runtime, deps) {
|
|
|
216
216
|
const findings = classifyLine(command, localMachine(workingFolder(input), runtime.env)).findings;
|
|
217
217
|
const built = buildReport(input, findings, runtime.env, declared);
|
|
218
218
|
// A sign-in that expired, what it created, a retry loop: the report, and what Claude Code reads.
|
|
219
|
-
const { report, output } = await after.afterCommand({ ...facts, command, findings, report: built, base });
|
|
219
|
+
const { report, output: learned } = await after.afterCommand({ ...facts, command, findings, report: built, base });
|
|
220
|
+
// A command Passport handled in Claude Code carries this person's waiting notices to them (never to the model).
|
|
221
|
+
const output = report && profile && runtimeName === "claude-code" && !event.cursorImported
|
|
222
|
+
? (await import("./cliHookNotices.js")).withNotices(learned, profile)
|
|
223
|
+
: learned;
|
|
220
224
|
if (output)
|
|
221
225
|
runtime.stdout.write(`${JSON.stringify(output)}\n`);
|
|
222
226
|
if (!report)
|
package/dist/cliHookAfter.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
import { classifyLine, localMachine, workingFolder } from "./hookLine.js";
|
|
22
22
|
import { execInner } from "./cliHookRewrite.js";
|
|
23
23
|
import { nextRetry, readSessionState, writeSessionState } from "./cliHookSessionState.js";
|
|
24
|
-
import { EXEC_VENDOR_NAMES, vendorCommand } from "./execVendors.js";
|
|
24
|
+
import { EXEC_LOGIN_COMMAND, EXEC_VENDOR_NAMES, vendorCommand } from "./execVendors.js";
|
|
25
25
|
import { outcomeOfInput } from "./cliHookOutcome.js";
|
|
26
26
|
/** The agent hears about a retry loop from this many failures in a row. */
|
|
27
27
|
export const RETRY_TELL_AT = 3;
|
|
@@ -32,7 +32,7 @@ export function signInContext(vendor, held, rerouted) {
|
|
|
32
32
|
if (held) {
|
|
33
33
|
return `Passport: the ${name} sign-in on this computer expired. Passport holds your ${name} key, so run it as \`passport exec -- ${command} <command>\`${rerouted ? " or just rerun it" : ""}.`;
|
|
34
34
|
}
|
|
35
|
-
return `Passport: the ${name} sign-in on this computer expired
|
|
35
|
+
return `Passport: the ${name} sign-in on this computer expired. Ask the user to run \`${EXEC_LOGIN_COMMAND[vendor]}\`, then retry.`;
|
|
36
36
|
}
|
|
37
37
|
/** What the agent reads when the same command keeps failing. */
|
|
38
38
|
export function retryContext(streak, program) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code's after-command output with this person's waiting notices as a system message (shown to the person,
|
|
3
|
+
* not the model, so it never steers the agent). A notice prints once: taking it removes it for the CLI too.
|
|
4
|
+
* Cursor and Codex have no person-only field on a command that ran, so their people see notices in the CLI,
|
|
5
|
+
* Slack and email instead (docs/design/v21/people.md, section 4).
|
|
6
|
+
*/
|
|
7
|
+
export declare function withNotices(output: Record<string, unknown> | null, profile: string): Record<string, unknown> | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { noticeLine, takeLocalNotices } from "./localNotices.js";
|
|
2
|
+
/**
|
|
3
|
+
* Claude Code's after-command output with this person's waiting notices as a system message (shown to the person,
|
|
4
|
+
* not the model, so it never steers the agent). A notice prints once: taking it removes it for the CLI too.
|
|
5
|
+
* Cursor and Codex have no person-only field on a command that ran, so their people see notices in the CLI,
|
|
6
|
+
* Slack and email instead (docs/design/v21/people.md, section 4).
|
|
7
|
+
*/
|
|
8
|
+
export function withNotices(output, profile) {
|
|
9
|
+
const notices = takeLocalNotices(profile);
|
|
10
|
+
if (!notices.length)
|
|
11
|
+
return output;
|
|
12
|
+
const message = notices.map((notice) => noticeLine(notice, "Passport")).join("\n");
|
|
13
|
+
return { ...(output ?? {}), systemMessage: message };
|
|
14
|
+
}
|
package/dist/cliMain.js
CHANGED
|
@@ -8,13 +8,14 @@ import { VERSION } from "./version.js";
|
|
|
8
8
|
import { ensureNodeRuntime, nodeVersionProblem } from "./nodeVersion.js";
|
|
9
9
|
import { login } from "./cliLogin.js";
|
|
10
10
|
import { asFailure, emitFailure, emitResult } from "./cliOutput.js";
|
|
11
|
+
import { noticeLine, takeLocalNotices } from "./localNotices.js";
|
|
11
12
|
import { completionResult, profilesResult, useProfileResult, versionResult } from "./cliOffline.js";
|
|
12
13
|
import { describedToolPayload, toolClassWord } from "./cliDescribe.js";
|
|
13
14
|
import { connect } from "./cliConnect.js";
|
|
14
15
|
import { firstText, hasNonText, payloadOf, refusalOf, requireSuccess } from "./cliResult.js";
|
|
15
|
-
import { callerFrom, endpoint, failure, FIRST_LOGIN_NEXT, firstSentence, holdForCommand, NOT_SIGNED_IN, passportOrigin, resolveCliAuth, sanitize, sleep, timeoutMs } from "./cliSupport.js";
|
|
16
|
+
import { callerFrom, endpoint, failure, FIRST_LOGIN_NEXT, firstSentence, holdForCommand, NOT_SIGNED_IN, passportOrigin, resolveCliAuth, sanitize, selectStoredProfile, sleep, timeoutMs } from "./cliSupport.js";
|
|
16
17
|
import { readBoundedUtf8Descriptor } from "./boundedFile.js";
|
|
17
|
-
import {
|
|
18
|
+
import { runCliSession, writeCliSessionFailure } from "./cliSession.js";
|
|
18
19
|
export { refusalOf } from "./cliResult.js";
|
|
19
20
|
export { callerFrom, sanitize } from "./cliSupport.js";
|
|
20
21
|
const APPROVAL_RETRY_MS = 3_000;
|
|
@@ -451,6 +452,8 @@ async function dispatch(args, runtime) {
|
|
|
451
452
|
return connect(args, runtime, withGateway);
|
|
452
453
|
case "connections":
|
|
453
454
|
return (await import("./cliConnections.js")).connections(args, runtime, withGateway);
|
|
455
|
+
case "request":
|
|
456
|
+
return (await import("./cliRequest.js")).request(args, runtime);
|
|
454
457
|
case "resources":
|
|
455
458
|
return resources(args, runtime);
|
|
456
459
|
case "prompts":
|
|
@@ -515,6 +518,32 @@ async function updateCheckAfter(args, runtime, exitCode) {
|
|
|
515
518
|
/* The next command tries again. */
|
|
516
519
|
}
|
|
517
520
|
}
|
|
521
|
+
/** Commands that never print Passport's one-time notices: machine output, the guard, and helpers other programs read. */
|
|
522
|
+
const QUIET_COMMANDS = new Set([
|
|
523
|
+
"hook",
|
|
524
|
+
"session",
|
|
525
|
+
"completion",
|
|
526
|
+
"git-credential",
|
|
527
|
+
"kube-credential",
|
|
528
|
+
"exec",
|
|
529
|
+
"access",
|
|
530
|
+
"version"
|
|
531
|
+
]);
|
|
532
|
+
/** A request decided, a setup nudge: printed once after a human-readable command (localNotices.ts). */
|
|
533
|
+
function printNotices(args, runtime, result) {
|
|
534
|
+
if (result.silent || QUIET_COMMANDS.has(args.command) || bool(args, "json") || bool(args, "quiet"))
|
|
535
|
+
return;
|
|
536
|
+
try {
|
|
537
|
+
const selection = selectStoredProfile(args, runtime.env);
|
|
538
|
+
if (!selection.profile || runtime.env.PASSPORT_AGENT_KEY)
|
|
539
|
+
return;
|
|
540
|
+
for (const notice of takeLocalNotices(selection.profile))
|
|
541
|
+
runtime.stderr.write(`${noticeLine(notice)}\n`);
|
|
542
|
+
}
|
|
543
|
+
catch {
|
|
544
|
+
/* Notices wait for the next command. */
|
|
545
|
+
}
|
|
546
|
+
}
|
|
518
547
|
export async function main(argv = process.argv.slice(2), env = process.env, io = {
|
|
519
548
|
stdin: process.stdin,
|
|
520
549
|
stdout: process.stdout,
|
|
@@ -545,11 +574,12 @@ export async function main(argv = process.argv.slice(2), env = process.env, io =
|
|
|
545
574
|
const result = await dispatch(args, runtime);
|
|
546
575
|
if (args.command !== "session")
|
|
547
576
|
emitResult(result, args, runtime);
|
|
577
|
+
printNotices(args, runtime, result);
|
|
548
578
|
await updateCheckAfter(args, runtime, result.exitCode ?? 0);
|
|
549
579
|
return result.exitCode ?? 0;
|
|
550
580
|
}
|
|
551
581
|
catch (error) {
|
|
552
|
-
let cliError =
|
|
582
|
+
let cliError = asFailure(error, args && passportOrigin(args, env));
|
|
553
583
|
// Signed out on a computer with nothing set up: the next step is init, not login.
|
|
554
584
|
if (cliError.message === NOT_SIGNED_IN && cliError.details.next === FIRST_LOGIN_NEXT) {
|
|
555
585
|
cliError = (await import("./firstRun.js")).firstRunFailure(cliError, env);
|
package/dist/cliOutput.js
CHANGED
|
@@ -113,6 +113,7 @@ const HELP_GROUPS = [
|
|
|
113
113
|
["hook", "Record the CLIs your agents run, and decide before they run"],
|
|
114
114
|
["connections", "Your connections: what's connected and what needs you"],
|
|
115
115
|
["connect", "Sign in to your apps"],
|
|
116
|
+
["request", "Ask for an app"],
|
|
116
117
|
["search", "Find tools you can run"],
|
|
117
118
|
["describe", "Show one tool and its parameters"],
|
|
118
119
|
["run", "Run a tool through your rules"]
|
|
@@ -177,15 +178,16 @@ function helpText(verb, all = false) {
|
|
|
177
178
|
describe: "passport describe <tool>\nShows one tool: what it does and every parameter it takes.",
|
|
178
179
|
// copy-style-allow double-space: help columns line up
|
|
179
180
|
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.",
|
|
180
|
-
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
|
|
181
|
+
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 is only for you and still needs your own sign-in.\nJSON: {workspace,apps,needsYou,url?,expiresAt?,opened}",
|
|
181
182
|
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.",
|
|
183
|
+
request: "passport request <app> --reason \"<what it's for>\"\npassport request\npassport request <app> --cancel\nAsks for an app your company doesn't offer you yet. Its owner or an admin decides; you hear back in your next command, in Slack and by email. With no app, lists your requests. --cancel takes one back.\nJSON: the request (status, who decides) or your requests.",
|
|
182
184
|
resources: "passport resources [uri] [--out <file>]\nLists or reads workspace MCP resources. Binary content requires --out or --json.",
|
|
183
185
|
prompts: "passport prompts [name] [--set key=value] [--out <file>]\nLists or gets workspace MCP prompts. Binary content requires --out or --json.",
|
|
184
186
|
// copy-style-allow double-space: help columns line up
|
|
185
187
|
scan: "passport scan [--path <folder>] [--verbose] [--check] [--local] [--json]\nnpx passport-bridge@latest scan [same options]\nFinds keys your agents can reach: agent configs, CLI sign-ins, your shell environment, and this project's .env files. Runs locally with no account, and no part of a key is ever printed or sent. It ends with the CLI keys Passport could hold for your agents, the same list passport status shows, and the step to move them.\nSigned in, it then sends Passport this computer's name, each MCP server's name and how it connects (a host, or a command like npx), and how many keys each app has here. Never env values, arguments, files, or keys. It exits 5 when your workspace's policy doesn't allow an MCP server.\n --path <folder> scan this project instead of the current folder\n --verbose show every place a key was found, files it couldn't read, and each key's file and fingerprint\n --check files only, no shell environment; exit 5 on a high or medium key (CI, pre-commit); sends nothing\n --local send nothing, even when signed in\n --json one JSON document: {version,findings,agents,unreadable,checked,keys,inventory?}",
|
|
186
188
|
discover: "passport discover\nNow part of passport scan, which reports the same MCP servers when you're signed in.\nRun: passport scan",
|
|
187
189
|
setup: "passport setup --org <pek_key> --yes\nNow passport init --org, which sets up a company's computers.\nRun: passport init --org <key> --yes",
|
|
188
|
-
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 rules: it runs what your rules allow
|
|
190
|
+
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 rules: it runs what your rules allow and blocks what they block. Neither hook sends the command line, its output, your folder path, or your environment. 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. Changes are previewed unless --apply is supplied; --verbose shows each hook's full command. uninstall --guard removes only the guard.",
|
|
189
191
|
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.',
|
|
190
192
|
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>",
|
|
191
193
|
completion: "passport completion <bash|zsh|fish>\nPrints an offline shell-completion script to stdout.",
|
|
@@ -352,9 +354,6 @@ export function emitFailure(error, json, quiet, runtime) {
|
|
|
352
354
|
}
|
|
353
355
|
if (error.details.hint && !quiet)
|
|
354
356
|
say(under(error.details.hint));
|
|
355
|
-
if (error.details.approvalUrl && !json && !quiet && !error.details.linkShown) {
|
|
356
|
-
say(under(`Open in Passport: ${error.details.approvalUrl}`));
|
|
357
|
-
}
|
|
358
357
|
}
|
|
359
358
|
export function failurePayload(error) {
|
|
360
359
|
return {
|
|
@@ -362,7 +361,6 @@ export function failurePayload(error) {
|
|
|
362
361
|
cause: error.cause,
|
|
363
362
|
exitCode: error.exitCode,
|
|
364
363
|
...(error.details.approvalId ? { approvalId: error.details.approvalId } : {}),
|
|
365
|
-
...(error.details.approvalUrl ? { approvalUrl: error.details.approvalUrl } : {}),
|
|
366
364
|
...(error.details.app ? { app: error.details.app } : {}),
|
|
367
365
|
...(error.details.connectUrl ? { connectUrl: error.details.connectUrl } : {}),
|
|
368
366
|
...(error.details.hint ? { hint: error.details.hint } : {}),
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `passport request`: ask for an app, see your requests, take one back (docs/design/v21/requests.md, section 4).
|
|
3
|
+
*
|
|
4
|
+
* passport request <app> --reason "<what it's for>" ask; an admin or the app's owner decides
|
|
5
|
+
* passport request your requests
|
|
6
|
+
* passport request <app> --cancel take back your request
|
|
7
|
+
*
|
|
8
|
+
* The answer arrives later as a one-time line in the next command's output (localNotices.ts), and by Slack and email.
|
|
9
|
+
* A person asks; an agent token can't.
|
|
10
|
+
*/
|
|
11
|
+
import { type ParsedArgs } from "./cliArgs.js";
|
|
12
|
+
import { type MemberCallDependencies } from "./cliMemberCall.js";
|
|
13
|
+
import { type CommandResult, type Runtime } from "./cliSupport.js";
|
|
14
|
+
type AppRef = {
|
|
15
|
+
key: string;
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
export type RequestFiled = {
|
|
19
|
+
filed: true;
|
|
20
|
+
created: boolean;
|
|
21
|
+
requestId: string;
|
|
22
|
+
status: "pending" | "approved_pending_setup";
|
|
23
|
+
app: AppRef;
|
|
24
|
+
deciders: string[];
|
|
25
|
+
decidersLine: string;
|
|
26
|
+
askedAt: number;
|
|
27
|
+
reach: {
|
|
28
|
+
slack: boolean;
|
|
29
|
+
email: boolean;
|
|
30
|
+
};
|
|
31
|
+
workspace: string;
|
|
32
|
+
} | {
|
|
33
|
+
filed: true;
|
|
34
|
+
created: boolean;
|
|
35
|
+
requestId: string;
|
|
36
|
+
status: "auto_approved";
|
|
37
|
+
app: AppRef;
|
|
38
|
+
connectUrl?: string;
|
|
39
|
+
workspace: string;
|
|
40
|
+
} | {
|
|
41
|
+
filed: false;
|
|
42
|
+
reason: "connected" | "blocked_by_policy" | "not_requestable";
|
|
43
|
+
message: string;
|
|
44
|
+
};
|
|
45
|
+
export type MyRequest = {
|
|
46
|
+
id: string;
|
|
47
|
+
app: AppRef;
|
|
48
|
+
status: string;
|
|
49
|
+
statusLine: string;
|
|
50
|
+
askedAt: number;
|
|
51
|
+
decidedAt?: number;
|
|
52
|
+
};
|
|
53
|
+
export type RequestDependencies = MemberCallDependencies & {
|
|
54
|
+
/** Asks "What's it for?" on a terminal; absent: no terminal. */
|
|
55
|
+
ask?: (prompt: string) => Promise<string>;
|
|
56
|
+
};
|
|
57
|
+
/** "Nov 16" in the person's own time zone. */
|
|
58
|
+
export declare function shortDate(at: number): string;
|
|
59
|
+
/** "You'll hear back here, in Slack and by email." without the ways that don't reach them. */
|
|
60
|
+
export declare function hearBackLine(reach: {
|
|
61
|
+
slack: boolean;
|
|
62
|
+
email: boolean;
|
|
63
|
+
}): string;
|
|
64
|
+
export declare function request(args: ParsedArgs, runtime: Runtime, deps?: RequestDependencies): Promise<CommandResult>;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `passport request`: ask for an app, see your requests, take one back (docs/design/v21/requests.md, section 4).
|
|
3
|
+
*
|
|
4
|
+
* passport request <app> --reason "<what it's for>" ask; an admin or the app's owner decides
|
|
5
|
+
* passport request your requests
|
|
6
|
+
* passport request <app> --cancel take back your request
|
|
7
|
+
*
|
|
8
|
+
* The answer arrives later as a one-time line in the next command's output (localNotices.ts), and by Slack and email.
|
|
9
|
+
* A person asks; an agent token can't.
|
|
10
|
+
*/
|
|
11
|
+
import { bool, value } from "./cliArgs.js";
|
|
12
|
+
import { api, json } from "./cliMemberCall.js";
|
|
13
|
+
import { failure, readBoundedJson, safeApiError, sanitize } from "./cliSupport.js";
|
|
14
|
+
import { processTerminal } from "./initUi.js";
|
|
15
|
+
import { mark, termOf } from "./term.js";
|
|
16
|
+
const REASON_MIN = 10;
|
|
17
|
+
const REASON_MAX = 280;
|
|
18
|
+
const APP_NAME = /^[\p{L}\p{N}][\p{L}\p{N} ._-]{1,63}$/u;
|
|
19
|
+
const PATH = "/api/my/app-requests";
|
|
20
|
+
/** "Nov 16" in the person's own time zone. */
|
|
21
|
+
export function shortDate(at) {
|
|
22
|
+
return new Date(at).toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
23
|
+
}
|
|
24
|
+
/** "You'll hear back here, in Slack and by email." without the ways that don't reach them. */
|
|
25
|
+
export function hearBackLine(reach) {
|
|
26
|
+
const ways = [...(reach.slack ? ["in Slack"] : []), ...(reach.email ? ["by email"] : [])];
|
|
27
|
+
if (!ways.length)
|
|
28
|
+
return "You'll hear back here.";
|
|
29
|
+
return `You'll hear back here, ${ways.join(" and ")}.`;
|
|
30
|
+
}
|
|
31
|
+
function cleanReason(raw) {
|
|
32
|
+
const reason = (raw ?? "").replace(/\s+/g, " ").trim();
|
|
33
|
+
return reason.length >= REASON_MIN && reason.length <= REASON_MAX ? reason : undefined;
|
|
34
|
+
}
|
|
35
|
+
async function askedReason(app, runtime, deps) {
|
|
36
|
+
const usage = `Say what it's for: passport request ${app} --reason "…"`;
|
|
37
|
+
let ask = deps.ask;
|
|
38
|
+
if (!ask && !deps.api) {
|
|
39
|
+
const terminal = processTerminal(runtime, process.platform, false);
|
|
40
|
+
if (terminal.interactive)
|
|
41
|
+
ask = (prompt) => terminal.question(prompt, runtime.signal);
|
|
42
|
+
}
|
|
43
|
+
if (!ask)
|
|
44
|
+
return failure(usage, 6, "usage");
|
|
45
|
+
const typed = cleanReason(await ask("What's it for? "));
|
|
46
|
+
return (typed ?? failure(`Give a reason of ${REASON_MIN}-${REASON_MAX} characters saying what you need it for.`, 6, "usage"));
|
|
47
|
+
}
|
|
48
|
+
function humanFiled(result, ok) {
|
|
49
|
+
if (!result.filed)
|
|
50
|
+
return `${ok} ${result.message}`;
|
|
51
|
+
if (result.status === "auto_approved") {
|
|
52
|
+
const link = result.connectUrl ? ` Connect: ${result.connectUrl}` : "";
|
|
53
|
+
return `${ok} ${result.app.name} is offered to your team.${link}`;
|
|
54
|
+
}
|
|
55
|
+
if (!result.created)
|
|
56
|
+
return `${ok} You already asked on ${shortDate(result.askedAt)}. Waiting for ${result.decidersLine}.`;
|
|
57
|
+
return `${ok} Sent to ${result.decidersLine}.\n ${hearBackLine(result.reach)}`;
|
|
58
|
+
}
|
|
59
|
+
async function file(args, runtime, deps, app) {
|
|
60
|
+
const given = value(args, "reason");
|
|
61
|
+
const reason = given === undefined ? await askedReason(app, runtime, deps) : cleanReason(given);
|
|
62
|
+
if (!reason) {
|
|
63
|
+
return failure(`Give a reason of ${REASON_MIN}-${REASON_MAX} characters saying what you need it for.`, 6, "usage");
|
|
64
|
+
}
|
|
65
|
+
const response = await api(args, runtime, deps).fetchApi(PATH, {
|
|
66
|
+
method: "POST",
|
|
67
|
+
headers: { "content-type": "application/json", accept: "application/json" },
|
|
68
|
+
body: JSON.stringify({ app, reason, via: "cli" }),
|
|
69
|
+
signal: runtime.signal
|
|
70
|
+
});
|
|
71
|
+
if (response.status === 400 || response.status === 429) {
|
|
72
|
+
return failure(await safeApiError(response, "Passport couldn't file that request."), response.status === 429 ? 1 : 6, "refused");
|
|
73
|
+
}
|
|
74
|
+
const result = await json(response, "Passport couldn't file that request.");
|
|
75
|
+
if (!result.filed && result.reason !== "connected")
|
|
76
|
+
return failure(sanitize(result.message), 1, result.reason);
|
|
77
|
+
const term = termOf(runtime.stdout, runtime.env);
|
|
78
|
+
return { json: result, human: humanFiled(result, mark(term, "done")) };
|
|
79
|
+
}
|
|
80
|
+
async function mine(args, runtime, deps) {
|
|
81
|
+
const response = await api(args, runtime, deps).fetchApi(PATH, {
|
|
82
|
+
method: "GET",
|
|
83
|
+
headers: { accept: "application/json" },
|
|
84
|
+
signal: runtime.signal
|
|
85
|
+
});
|
|
86
|
+
return (await json(response, "Passport couldn't list your requests.")).requests;
|
|
87
|
+
}
|
|
88
|
+
async function cancel(args, runtime, deps, app) {
|
|
89
|
+
const needle = app.trim().toLowerCase();
|
|
90
|
+
const open = (await mine(args, runtime, deps)).find((row) => row.status === "pending" && (row.app.key === needle || row.app.name.toLowerCase() === needle));
|
|
91
|
+
if (!open)
|
|
92
|
+
return failure(`You have no waiting request for ${app}.`, 1, "not_found", { hint: "Run: passport request" });
|
|
93
|
+
const response = await api(args, runtime, deps).fetchApi(`${PATH}/${encodeURIComponent(open.id)}`, {
|
|
94
|
+
method: "DELETE",
|
|
95
|
+
headers: { accept: "application/json" },
|
|
96
|
+
signal: runtime.signal
|
|
97
|
+
});
|
|
98
|
+
if (!response.ok)
|
|
99
|
+
return failure(await safeApiError(response, "Passport couldn't cancel it."), 1, "server");
|
|
100
|
+
await readBoundedJson(response).catch(() => undefined);
|
|
101
|
+
const term = termOf(runtime.stdout, runtime.env);
|
|
102
|
+
return {
|
|
103
|
+
json: { cancelled: open.id, app: open.app },
|
|
104
|
+
human: `${mark(term, "done")} Cancelled your request for ${open.app.name}.`
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
async function list(args, runtime, deps) {
|
|
108
|
+
const rows = await mine(args, runtime, deps);
|
|
109
|
+
if (!rows.length)
|
|
110
|
+
return { json: { requests: [] }, human: "No requests." };
|
|
111
|
+
const width = Math.max(...rows.map((row) => row.app.name.length)) + 3;
|
|
112
|
+
const human = rows
|
|
113
|
+
.map((row) => {
|
|
114
|
+
const when = row.status === "pending" ? ` · asked ${shortDate(row.askedAt)}` : "";
|
|
115
|
+
return `${row.app.name.padEnd(width)}${row.statusLine}${when}`;
|
|
116
|
+
})
|
|
117
|
+
.join("\n");
|
|
118
|
+
return { json: { requests: rows }, human };
|
|
119
|
+
}
|
|
120
|
+
export async function request(args, runtime, deps = {}) {
|
|
121
|
+
const [app, ...extra] = args.positionals;
|
|
122
|
+
if (extra.length)
|
|
123
|
+
return failure('Name one app: passport request <app> --reason "…"', 6, "usage");
|
|
124
|
+
if (app === undefined) {
|
|
125
|
+
if (bool(args, "cancel") || value(args, "reason") !== undefined) {
|
|
126
|
+
return failure('Name the app: passport request <app> --reason "…"', 6, "usage");
|
|
127
|
+
}
|
|
128
|
+
return list(args, runtime, deps);
|
|
129
|
+
}
|
|
130
|
+
if (!APP_NAME.test(app.trim()))
|
|
131
|
+
return failure("Name the app by its key, like github or linear.", 6, "usage");
|
|
132
|
+
if (bool(args, "cancel"))
|
|
133
|
+
return cancel(args, runtime, deps, app.trim());
|
|
134
|
+
return file(args, runtime, deps, app.trim());
|
|
135
|
+
}
|
package/dist/cliScan.js
CHANGED
|
@@ -182,7 +182,7 @@ export function renderScan(result, options) {
|
|
|
182
182
|
else
|
|
183
183
|
lines.push(paint("dim", "Nothing left this computer."));
|
|
184
184
|
if (count && options.initCommand) {
|
|
185
|
-
lines.push("", `
|
|
185
|
+
lines.push("", `Put your agents under your company's rules: ${paint("bold", options.initCommand)}`);
|
|
186
186
|
}
|
|
187
187
|
else if (options.notSetUp && options.initCommand) {
|
|
188
188
|
lines.push("", `Turn on the guard for your agents: ${paint("bold", options.initCommand)}`);
|