passport-bridge 0.16.13 → 0.17.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 +20 -20
- package/dist/bridgeExchange.d.ts +7 -1
- package/dist/bridgeExchange.js +11 -2
- package/dist/cli.js +3 -1
- package/dist/cliActions.js +38 -18
- package/dist/cliArgs.js +14 -9
- package/dist/cliAutopilot.js +36 -21
- package/dist/cliAutopilotPolicy.d.ts +22 -0
- package/dist/cliAutopilotPolicy.js +61 -0
- package/dist/cliConnect.js +8 -7
- package/dist/cliDeadline.js +2 -1
- package/dist/cliDescribe.d.ts +4 -0
- package/dist/cliDescribe.js +11 -0
- 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 +5 -11
- 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 +24 -8
- package/dist/cliMain.js +50 -22
- package/dist/cliMemberCall.js +1 -1
- package/dist/cliOffline.d.ts +2 -2
- package/dist/cliOffline.js +32 -9
- package/dist/cliOutput.js +73 -43
- 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/cliScriptRead.d.ts +1 -1
- package/dist/cliScriptRead.js +2 -2
- package/dist/cliSessions.d.ts +3 -2
- package/dist/cliSessions.js +19 -17
- package/dist/cliSetup.js +6 -4
- package/dist/cliSetupLock.js +2 -1
- package/dist/cliSetupOrg.js +7 -5
- package/dist/cliStatus.d.ts +2 -4
- package/dist/cliStatus.js +56 -61
- 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 +48 -29
- 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.d.ts +2 -1
- package/dist/initLocalSteps.js +10 -7
- package/dist/initOutro.d.ts +1 -3
- package/dist/initOutro.js +8 -16
- package/dist/initPlan.js +7 -7
- 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/lockedHooks.d.ts +1 -1
- package/dist/lockedHooks.js +1 -1
- 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/initOutro.js
CHANGED
|
@@ -12,6 +12,7 @@ import { EXEC_TOKEN_PAGES, EXEC_VENDOR_NAMES } from "./execVendors.js";
|
|
|
12
12
|
import { AGENT_NAMES } from "./initAgents.js";
|
|
13
13
|
import { CODEX_BLOCK_ONLY } from "./cliHookInstall.js";
|
|
14
14
|
import { pathLine } from "./initInstall.js";
|
|
15
|
+
import { pathLines } from "./pathLines.js";
|
|
15
16
|
import { desktopLine } from "./initLocalSteps.js";
|
|
16
17
|
import { TRY_IT, appLabel } from "./initState.js";
|
|
17
18
|
import { listOf } from "./initUi.js";
|
|
@@ -93,7 +94,7 @@ export function outro(s) {
|
|
|
93
94
|
if (s.autopilotSummary && steps.autopilot?.status === "done")
|
|
94
95
|
items.push(done(s.autopilotSummary));
|
|
95
96
|
if (steps.safety?.status === "done")
|
|
96
|
-
items.push(done("
|
|
97
|
+
items.push(done("Deletes ask first"));
|
|
97
98
|
items.push(...keyItems(movedVendors(s.summary)).rotate, ...agentFollowUps(s));
|
|
98
99
|
s.summary.next.push({ argv: ["passport", "status"], description: "Check your workspace and app connections." });
|
|
99
100
|
const lines = items.flatMap((item) => wrap(s.screen.text(item.text), s.terminal.width, ` ${s.screen.symbol(item.mark)} `, " "));
|
|
@@ -105,9 +106,9 @@ export function outro(s) {
|
|
|
105
106
|
function agentFollowUps(s) {
|
|
106
107
|
const items = [];
|
|
107
108
|
if (s.codexNext)
|
|
108
|
-
items.push(warn(`Codex: sign in to Passport once: ${s.codexNext}`));
|
|
109
|
+
items.push(warn(`Codex: sign in to Passport once.\nRun: ${s.codexNext}`));
|
|
109
110
|
if (s.codexTrust)
|
|
110
|
-
items.push(warn(`Codex:
|
|
111
|
+
items.push(warn(`Codex: Open Codex → /hooks and trust Passport's hooks. ${CODEX_BLOCK_ONLY}`));
|
|
111
112
|
const rows = (s.summary.steps.agents?.agents ?? []);
|
|
112
113
|
if (s.terminal.interactive && rows.some((row) => row.agent === "claude" && row.status === "needs_attention")) {
|
|
113
114
|
items.push(warn(desktopLine(Boolean(s.desktopCopied))));
|
|
@@ -124,25 +125,16 @@ function nextCommand(s, waiting) {
|
|
|
124
125
|
return pathNext(line, s.terminal.width);
|
|
125
126
|
}
|
|
126
127
|
if (waiting && !s.terminal.interactive)
|
|
127
|
-
return ["
|
|
128
|
+
return ["Run: passport connect --wait 300"];
|
|
128
129
|
const agent = s.agentsReady[0];
|
|
129
130
|
if (agent && s.newlyAddedClaudeCode) {
|
|
130
131
|
const app = s.connected[0] ?? s.candidates[0];
|
|
131
132
|
const ask = app ? TRY_IT[app] : "list your Passport tools";
|
|
132
133
|
return wrap(`Next: in Claude Code, run /mcp to sign in, then ask it to ${ask}.`, s.terminal.width);
|
|
133
134
|
}
|
|
134
|
-
return ["
|
|
135
|
+
return ["Run: passport status"];
|
|
135
136
|
}
|
|
136
|
-
/**
|
|
137
|
-
* never broken. Too narrow for the `echo … >> ~/.zshrc` form, it names the
|
|
138
|
-
* file and the shorter line to add to it. */
|
|
137
|
+
/** What to do next about PATH: the step, then the command on its own line. */
|
|
139
138
|
export function pathNext(line, width) {
|
|
140
|
-
|
|
141
|
-
if (!command)
|
|
142
|
-
return [`Next: ${line}`];
|
|
143
|
-
const appended = command.match(/^echo 'export PATH="\$HOME(\/[^"]+):\$PATH"' >> (\S+)$/);
|
|
144
|
-
if (appended && 2 + command.length > width) {
|
|
145
|
-
return [`Next: add this line to ${appended[2]}:`, ` export PATH=~${appended[1]}:$PATH`];
|
|
146
|
-
}
|
|
147
|
-
return [`Next: ${lead.charAt(0).toLowerCase()}${lead.slice(1)}:`, ` ${command}`];
|
|
139
|
+
return pathLines(line, width);
|
|
148
140
|
}
|
package/dist/initPlan.js
CHANGED
|
@@ -72,7 +72,7 @@ function planKeys(b, keys, options) {
|
|
|
72
72
|
b.will("keys", `Move your ${listOf(keys.names)} ${one ? "key" : "keys"} into Passport and sign ${one ? "that CLI" : "those CLIs"} out on this computer`);
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
75
|
-
b.kept("keys", `Your ${listOf(keys.names)} ${one ? "key stays" : "keys stay"} on this computer. Move ${one ? "it" : "them"} any time: passport keys move`);
|
|
75
|
+
b.kept("keys", `Your ${listOf(keys.names)} ${one ? "key stays" : "keys stay"} on this computer. Move ${one ? "it" : "them"} any time.\nRun: passport keys move`);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
for (const file of keys?.envFiles ?? [])
|
|
@@ -103,7 +103,7 @@ function planDesktop(b, agents, options) {
|
|
|
103
103
|
if (options.interactive)
|
|
104
104
|
b.will("agents", "Copy the Claude Desktop connector URL for you to paste");
|
|
105
105
|
else
|
|
106
|
-
b.you("agents", `Claude Desktop: Settings → Connectors → Add custom connector
|
|
106
|
+
b.you("agents", `Claude Desktop: in Settings → Connectors → Add custom connector, paste ${agents.context?.url ?? "the URL"}`);
|
|
107
107
|
}
|
|
108
108
|
function planGuard(b, s, guard) {
|
|
109
109
|
if (!guard || guard.skipped)
|
|
@@ -137,7 +137,7 @@ function planAutopilot(b, autopilot) {
|
|
|
137
137
|
else if (safety.kind === "failed")
|
|
138
138
|
b.you("rules", safety.message);
|
|
139
139
|
else if (safety.profile === "off")
|
|
140
|
-
b.will("rules", `Ask before
|
|
140
|
+
b.will("rules", `Ask before deletes ${safety.where}`);
|
|
141
141
|
else
|
|
142
142
|
b.already("rules", safetyLine(safety));
|
|
143
143
|
}
|
|
@@ -170,13 +170,13 @@ export function showPlan(s, d, plan) {
|
|
|
170
170
|
});
|
|
171
171
|
};
|
|
172
172
|
screen.gap();
|
|
173
|
-
section("
|
|
173
|
+
section("Plan", plan.will);
|
|
174
174
|
if (plan.edits.length) {
|
|
175
175
|
screen.endStep();
|
|
176
176
|
screen.step("Edits", `${listOf(plan.edits)}. Keeps a backup of each.`);
|
|
177
177
|
}
|
|
178
|
-
section("
|
|
179
|
-
section("
|
|
178
|
+
section("Done", plan.alreadySetUp, "done");
|
|
179
|
+
section("Kept", plan.notChanged, "skip");
|
|
180
180
|
section("You do", plan.youDo, "warn");
|
|
181
181
|
const autopilot = d.autopilot;
|
|
182
182
|
if (autopilot?.kind === "autopilot") {
|
|
@@ -187,7 +187,7 @@ export function showPlan(s, d, plan) {
|
|
|
187
187
|
}
|
|
188
188
|
if (d.environments && (d.environments.status === "ok" || d.environments.project.length)) {
|
|
189
189
|
screen.endStep();
|
|
190
|
-
screen.block(environmentLines(d.environments, screen.contentWidth), "
|
|
190
|
+
screen.block(environmentLines(d.environments, screen.contentWidth), "Where");
|
|
191
191
|
}
|
|
192
192
|
screen.endStep();
|
|
193
193
|
}
|
package/dist/initUi.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Runtime } from "./cliSupport.js";
|
|
2
2
|
import { supportsUnicode, visibleLength, type Mark as TermMark } from "./term.js";
|
|
3
3
|
export { supportsUnicode, visibleLength };
|
|
4
|
-
export declare const LABEL_WIDTH =
|
|
4
|
+
export declare const LABEL_WIDTH = 11;
|
|
5
5
|
export declare const CONTINUATION: string;
|
|
6
6
|
export type Mark = Extract<TermMark, "done" | "skip" | "warn" | "wait">;
|
|
7
7
|
export declare class InitPaused extends Error {
|
|
@@ -43,8 +43,6 @@ export type TerminalInput = NodeJS.ReadableStream & {
|
|
|
43
43
|
export declare function discardTypeAhead(stdin: TerminalInput, ms?: number): Promise<boolean>;
|
|
44
44
|
/** The real terminal behind a Runtime. */
|
|
45
45
|
export declare function processTerminal(runtime: Runtime, platform: NodeJS.Platform, json: boolean): InitTerminal;
|
|
46
|
-
/** Word-wrap without breaking a URL, path, or `passport` command. */
|
|
47
|
-
export declare function wrapText(text: string, width: number): string[];
|
|
48
46
|
/**
|
|
49
47
|
* Rows of cells padded so the columns line up, two spaces apart. Null when the
|
|
50
48
|
* widest row doesn't fit in `width`: the caller lays those rows out another way.
|
|
@@ -83,7 +81,7 @@ export declare class InitScreen {
|
|
|
83
81
|
private get liveColumns();
|
|
84
82
|
header(): void;
|
|
85
83
|
/** The lead of a step's first row: ` Apps `, or a row of its own for
|
|
86
|
-
* a label wider than the column
|
|
84
|
+
* a label wider than the column. */
|
|
87
85
|
private leadFor;
|
|
88
86
|
private emit;
|
|
89
87
|
/** Something new is on screen; the activity clock starts again. */
|
package/dist/initUi.js
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { createInterface } from "node:readline";
|
|
17
17
|
import { answerOf, ASK_AGAIN, choices, nameConfirmed, typeNamePrompt } from "./cliAsk.js";
|
|
18
|
-
import { clip, mark as markOf, paint as paintText, plainText, supportsUnicode, table, termOf, visibleLength, wrap } from "./term.js";
|
|
18
|
+
import { clip, stripAnsi, mark as markOf, paint as paintText, plainText, supportsUnicode, table, termOf, visibleLength, wrap } from "./term.js";
|
|
19
19
|
export { supportsUnicode, visibleLength };
|
|
20
|
-
export const LABEL_WIDTH =
|
|
20
|
+
export const LABEL_WIDTH = 11;
|
|
21
21
|
const INDENT = " ";
|
|
22
22
|
export const CONTINUATION = " ".repeat(INDENT.length + LABEL_WIDTH);
|
|
23
23
|
export class InitPaused extends Error {
|
|
@@ -164,10 +164,6 @@ export function processTerminal(runtime, platform, json) {
|
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
|
-
/** Word-wrap without breaking a URL, path, or `passport` command. */
|
|
168
|
-
export function wrapText(text, width) {
|
|
169
|
-
return wrap(text, width);
|
|
170
|
-
}
|
|
171
167
|
/**
|
|
172
168
|
* Rows of cells padded so the columns line up, two spaces apart. Null when the
|
|
173
169
|
* widest row doesn't fit in `width`: the caller lays those rows out another way.
|
|
@@ -250,7 +246,7 @@ export class InitScreen {
|
|
|
250
246
|
this.out(`\n${this.paint("1", "Passport setup")}\n\n`);
|
|
251
247
|
}
|
|
252
248
|
/** The lead of a step's first row: ` Apps `, or a row of its own for
|
|
253
|
-
* a label wider than the column
|
|
249
|
+
* a label wider than the column. */
|
|
254
250
|
leadFor(label) {
|
|
255
251
|
if (label === undefined)
|
|
256
252
|
return CONTINUATION;
|
|
@@ -262,15 +258,8 @@ export class InitScreen {
|
|
|
262
258
|
}
|
|
263
259
|
emit(label, text) {
|
|
264
260
|
this.clearLive();
|
|
265
|
-
// A link
|
|
266
|
-
//
|
|
267
|
-
if (label === undefined &&
|
|
268
|
-
/^https?:\/\/\S+$/.test(text) &&
|
|
269
|
-
CONTINUATION.length + text.length > this.terminal.width) {
|
|
270
|
-
this.out(`${text}\n`);
|
|
271
|
-
this.quiet();
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
261
|
+
// A link stays at the step's indent, in the content column, and is never
|
|
262
|
+
// broken: one too long for the line runs past the edge, still one link.
|
|
274
263
|
const lead = this.leadFor(label);
|
|
275
264
|
for (const line of wrap(this.text(text), this.terminal.width, lead, CONTINUATION)) {
|
|
276
265
|
this.out(`${line}\n`);
|
|
@@ -328,7 +317,8 @@ export class InitScreen {
|
|
|
328
317
|
/** One row, clipped to the terminal so `\r` and erase-line replace all of it. */
|
|
329
318
|
drawLive(lead, text) {
|
|
330
319
|
const room = Math.max(1, this.liveColumns - lead.length);
|
|
331
|
-
|
|
320
|
+
// One dim span: marks already dimmed inside the text would end it early.
|
|
321
|
+
const row = clip(stripAnsi(this.text(text)), room, this.terminal.unicode);
|
|
332
322
|
this.out(`\r\u001b[2K${clip(lead, this.liveColumns, this.terminal.unicode)}${this.paint("2", row)}`);
|
|
333
323
|
this.liveShown = true;
|
|
334
324
|
}
|
|
@@ -477,6 +467,7 @@ export class InitScreen {
|
|
|
477
467
|
/** A numbered choice. Returns an index, or undefined when there is no answer. */
|
|
478
468
|
async choose(question, options, signal, label) {
|
|
479
469
|
this.line(question, label);
|
|
470
|
+
// copy-style-allow double-space: columns line up
|
|
480
471
|
options.forEach((option, index) => this.line(` ${index + 1} ${option}`));
|
|
481
472
|
if (!this.terminal.interactive)
|
|
482
473
|
return undefined;
|
package/dist/keysLocal.js
CHANGED
|
@@ -200,7 +200,7 @@ function railwayKeys(home) {
|
|
|
200
200
|
kind: "railway-account-token",
|
|
201
201
|
label: "Railway sign-in",
|
|
202
202
|
location,
|
|
203
|
-
unholdable: `Railway is signed in with a browser session Passport can't hold. Create an account token at ${EXEC_TOKEN_PAGES.railway}, then
|
|
203
|
+
unholdable: `Railway is signed in with a browser session Passport can't hold. Create an account token at ${EXEC_TOKEN_PAGES.railway}, then add it.\nRun: passport keys add railway`,
|
|
204
204
|
removalWords: SIGN_OUT.railway
|
|
205
205
|
}
|
|
206
206
|
];
|
|
@@ -242,7 +242,7 @@ function vercelKeys(context, home) {
|
|
|
242
242
|
kind: "vercel-token",
|
|
243
243
|
label: "Vercel sign-in",
|
|
244
244
|
location: display(path, home),
|
|
245
|
-
unholdable: `Vercel is signed in with a browser session Passport can't hold. Create a token at ${EXEC_TOKEN_PAGES.vercel}, then
|
|
245
|
+
unholdable: `Vercel is signed in with a browser session Passport can't hold. Create a token at ${EXEC_TOKEN_PAGES.vercel}, then add it.\nRun: passport keys add vercel`,
|
|
246
246
|
removalWords: SIGN_OUT.vercel
|
|
247
247
|
}
|
|
248
248
|
];
|
|
@@ -295,7 +295,7 @@ function wranglerKeys(context, home) {
|
|
|
295
295
|
kind: "cloudflare-cli-token",
|
|
296
296
|
label: "Wrangler sign-in",
|
|
297
297
|
location,
|
|
298
|
-
unholdable: `Wrangler is signed in with a browser session Passport can't hold. Create an API token at ${EXEC_TOKEN_PAGES.wrangler}, then
|
|
298
|
+
unholdable: `Wrangler is signed in with a browser session Passport can't hold. Create an API token at ${EXEC_TOKEN_PAGES.wrangler}, then add it.\nRun: passport keys add wrangler`,
|
|
299
299
|
removalWords: SIGN_OUT.wrangler
|
|
300
300
|
}
|
|
301
301
|
];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `passport keys add`: the key a person pastes. Hidden input on a terminal
|
|
3
|
+
* (never echoed), the whole of stdin otherwise, at most 16 KB.
|
|
4
|
+
*/
|
|
5
|
+
import type { Runtime } from "./cliSupport.js";
|
|
6
|
+
export declare function readSecret(runtime: Runtime, prompt: string): Promise<string>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { discardTypeAhead } from "./initUi.js";
|
|
2
|
+
export async function readSecret(runtime, prompt) {
|
|
3
|
+
const stdin = runtime.stdin;
|
|
4
|
+
if (!stdin)
|
|
5
|
+
return "";
|
|
6
|
+
if (!stdin.isTTY || !stdin.setRawMode) {
|
|
7
|
+
const chunks = [];
|
|
8
|
+
let bytes = 0;
|
|
9
|
+
for await (const chunk of stdin) {
|
|
10
|
+
const buffer = Buffer.from(chunk);
|
|
11
|
+
bytes += buffer.byteLength;
|
|
12
|
+
if (bytes > 16 * 1024)
|
|
13
|
+
break;
|
|
14
|
+
chunks.push(buffer);
|
|
15
|
+
}
|
|
16
|
+
return Buffer.concat(chunks).toString("utf8").trim();
|
|
17
|
+
}
|
|
18
|
+
// Keys typed before the prompt aren't part of the key.
|
|
19
|
+
if (await discardTypeAhead(stdin))
|
|
20
|
+
throw new Error("Cancelled.");
|
|
21
|
+
runtime.stderr.write(prompt);
|
|
22
|
+
stdin.setRawMode(true);
|
|
23
|
+
let value = "";
|
|
24
|
+
try {
|
|
25
|
+
for await (const chunk of stdin) {
|
|
26
|
+
for (const char of String(chunk)) {
|
|
27
|
+
if (char === "\u0003")
|
|
28
|
+
throw new Error("Cancelled.");
|
|
29
|
+
if (char === "\r" || char === "\n")
|
|
30
|
+
return value.trim();
|
|
31
|
+
if (char === "\u007f")
|
|
32
|
+
value = value.slice(0, -1);
|
|
33
|
+
else
|
|
34
|
+
value += char;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
stdin.setRawMode(false);
|
|
40
|
+
runtime.stderr.write("\n");
|
|
41
|
+
}
|
|
42
|
+
return value.trim();
|
|
43
|
+
}
|
package/dist/launcherFastPath.js
CHANGED
|
@@ -126,6 +126,7 @@ export function fastPathShell() {
|
|
|
126
126
|
' while [ -n "$pp_w" ]; do',
|
|
127
127
|
" pp_c=${pp_w%%/*}",
|
|
128
128
|
" case $pp_w in */*) pp_w=${pp_w#*/} ;; *) pp_w= ;; esac",
|
|
129
|
+
// copy-style-allow three-dots: a shell case pattern, not prose
|
|
129
130
|
" case $pp_c in '' | .) continue ;; ...) ;; .*) return 1 ;; esac",
|
|
130
131
|
" pp_p=$pp_p/$pp_c",
|
|
131
132
|
' [ -L "$pp_p" ] && return 1',
|
package/dist/lockedHooks.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Locked hooks: Passport's guard and audit hooks in each agent's managed
|
|
3
3
|
* (system) settings, where a person can't turn them off. Pure and secretless,
|
|
4
|
-
* shared by the web's Rollout
|
|
4
|
+
* shared by the web's Agents › Rollout tab and `passport setup --org --lock`.
|
|
5
5
|
*
|
|
6
6
|
* A checked copy of shared/lockedHooks.ts: the bridge never imports shared/
|
|
7
7
|
* in shipped code, and lockedHooks.test.ts proves the two say the same thing.
|
package/dist/lockedHooks.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Locked hooks: Passport's guard and audit hooks in each agent's managed
|
|
3
3
|
* (system) settings, where a person can't turn them off. Pure and secretless,
|
|
4
|
-
* shared by the web's Rollout
|
|
4
|
+
* shared by the web's Agents › Rollout tab and `passport setup --org --lock`.
|
|
5
5
|
*
|
|
6
6
|
* A checked copy of shared/lockedHooks.ts: the bridge never imports shared/
|
|
7
7
|
* in shipped code, and lockedHooks.test.ts proves the two say the same thing.
|
package/dist/loginFlow.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export type Approval = {
|
|
|
21
21
|
/** The server's window plus a little slack, so its own "expired" wins. */
|
|
22
22
|
export declare const POLL_SLACK_MS = 15000;
|
|
23
23
|
export declare const IDENTITY_TIMEOUT_MS = 5000;
|
|
24
|
-
export declare const EXPIRED = "This sign-in code expired
|
|
24
|
+
export declare const EXPIRED = "This sign-in code expired.\nRun: passport login";
|
|
25
25
|
/** What the person must do in the browser, for a caller that draws its own
|
|
26
26
|
* screen (`passport init`). `opened` is false when no browser was launched. */
|
|
27
27
|
export type SignInPrompt = {
|
package/dist/loginFlow.js
CHANGED
|
@@ -37,7 +37,7 @@ const SIGN_IN_WINDOW_MS = 10 * 60 * 1000;
|
|
|
37
37
|
export const POLL_SLACK_MS = 15_000;
|
|
38
38
|
const MAX_TRANSIENT_POLL_FAILURES = 5;
|
|
39
39
|
export const IDENTITY_TIMEOUT_MS = 5_000;
|
|
40
|
-
export const EXPIRED = "This sign-in code expired
|
|
40
|
+
export const EXPIRED = "This sign-in code expired.\nRun: passport login";
|
|
41
41
|
const DENIED = "Sign-in was denied in the browser. Nothing was saved.";
|
|
42
42
|
const CANCELLED = "Sign-in cancelled. Nothing was saved.";
|
|
43
43
|
const OTHER_WORKSPACE = "Passport approved a different workspace than the one requested; no credential was saved.";
|
|
@@ -55,7 +55,7 @@ export function signInLines(prompt) {
|
|
|
55
55
|
` Code: ${prompt.userCode}`,
|
|
56
56
|
` Link: ${prompt.verifyUrl}${prompt.opened ? " (opened in your browser)" : ""}`,
|
|
57
57
|
"Check the code matches the one in your browser before you approve.",
|
|
58
|
-
"Waiting for the browser
|
|
58
|
+
"Waiting for the browser… (Ctrl-C to stop)"
|
|
59
59
|
];
|
|
60
60
|
}
|
|
61
61
|
export function printPrompt(runtime, opts, hooks) {
|
|
@@ -173,8 +173,8 @@ export async function startSignIn(options, args, runtime) {
|
|
|
173
173
|
async function waitForBrowserApproval(cloud, code, intervalMs, deadlineAt, args, runtime) {
|
|
174
174
|
let transient = 0;
|
|
175
175
|
const lostContact = (status) => failure(status
|
|
176
|
-
? `
|
|
177
|
-
: "Lost contact with Passport while waiting. Check your connection
|
|
176
|
+
? `Couldn't check the sign-in (${status}). Sign in again.\nRun: passport login`
|
|
177
|
+
: "Lost contact with Passport while waiting. Check your connection, then sign in again.\nRun: passport login", 1, "network_or_server");
|
|
178
178
|
while (Date.now() < deadlineAt) {
|
|
179
179
|
await sleep(intervalMs, runtime.signal);
|
|
180
180
|
let poll;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function pathLines(line: string, width?: number): string[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The PATH line on screen (`initInstall.ts` `pathLine` says what it is): what
|
|
3
|
+
* to do, then the command on its own line, never broken. Too narrow for the
|
|
4
|
+
* `echo … >> ~/.zshrc` form, it names the file and the shorter line to add.
|
|
5
|
+
*
|
|
6
|
+
* Add Passport's folder to your PATH, then open a new terminal:
|
|
7
|
+
* echo 'export PATH="$HOME/.passport/cli/bin:$PATH"' >> ~/.zshrc
|
|
8
|
+
*/
|
|
9
|
+
import { wrap } from "./term.js";
|
|
10
|
+
export function pathLines(line, width = Number.POSITIVE_INFINITY) {
|
|
11
|
+
const at = line.indexOf(": ");
|
|
12
|
+
if (at < 0)
|
|
13
|
+
return wrap(line, width);
|
|
14
|
+
const command = line.slice(at + 2);
|
|
15
|
+
const appended = command.match(/^echo 'export PATH="\$HOME(\/[^"]+):\$PATH"' >> (\S+)$/);
|
|
16
|
+
if (appended && 2 + command.length > width) {
|
|
17
|
+
return [
|
|
18
|
+
...wrap(`Add this line to ${appended[2]}, then open a new terminal:`, width),
|
|
19
|
+
` export PATH=~${appended[1]}:$PATH`
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
return [...wrap(`${line.slice(0, at)}:`, width), ` ${command}`];
|
|
23
|
+
}
|
package/dist/pluginPin.d.ts
CHANGED
package/dist/pluginPin.js
CHANGED
package/dist/plural.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Counts with the right noun: "1 key", "3 keys", "1,204 calls".
|
|
3
|
+
*
|
|
4
|
+
* A checked copy of shared/plural.ts (the CLI can't import shared/ in
|
|
5
|
+
* shipped code; termLayout.test.ts compares them word for word).
|
|
6
|
+
*/
|
|
7
|
+
/** "1 key" or "3 keys"; `many` for irregular plurals ("1 repository", "2 repositories"). */
|
|
8
|
+
export declare function countOf(n: number, one: string, many?: string): string;
|
|
9
|
+
/** The word that agrees with a count: agree(n, "needs", "need"), agree(n, "it", "them"). */
|
|
10
|
+
export declare function agree(n: number, one: string, many: string): string;
|
package/dist/plural.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Counts with the right noun: "1 key", "3 keys", "1,204 calls".
|
|
3
|
+
*
|
|
4
|
+
* A checked copy of shared/plural.ts (the CLI can't import shared/ in
|
|
5
|
+
* shipped code; termLayout.test.ts compares them word for word).
|
|
6
|
+
*/
|
|
7
|
+
/** "1 key" or "3 keys"; `many` for irregular plurals ("1 repository", "2 repositories"). */
|
|
8
|
+
export function countOf(n, one, many = `${one}s`) {
|
|
9
|
+
return `${n.toLocaleString("en-US")} ${n === 1 ? one : many}`;
|
|
10
|
+
}
|
|
11
|
+
/** The word that agrees with a count: agree(n, "needs", "need"), agree(n, "it", "them"). */
|
|
12
|
+
export function agree(n, one, many) {
|
|
13
|
+
return n === 1 ? one : many;
|
|
14
|
+
}
|
package/dist/term.d.ts
CHANGED
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
* small `Term` value, so a test can lay out any width without a terminal.
|
|
5
5
|
*
|
|
6
6
|
* const out = termOf(runtime.stdout, runtime.env);
|
|
7
|
+
* layout(text, out.width) every line fitted, each with its own hang
|
|
8
|
+
* say(stream, env, text) a laid-out message, written
|
|
9
|
+
* promptRows(question, out.width) a question's rows; the last is the prompt
|
|
7
10
|
* wrap(text, out.width, " ") word-wrapped lines, hanging indent
|
|
8
11
|
* clip(text, out.columns) one row, cut with "…"
|
|
9
12
|
* table(rows, out.width) aligned columns, or one block per row
|
|
10
13
|
* paint(out, "dim", text) 8-color ANSI, only when out.color
|
|
11
|
-
* mark(out, "done") ✓ – ! ✗ … (+ - ! x . without Unicode)
|
|
14
|
+
* mark(out, "done") ✓ – ! ✗ … ● (+ - ! x . * without Unicode)
|
|
12
15
|
* const live = new LiveLine(out, write); live.show(text); live.clear();
|
|
13
16
|
* countdown(92_000) "1:32"
|
|
14
17
|
*
|
|
@@ -17,7 +20,10 @@
|
|
|
17
20
|
* columns. Off a terminal (piped, CI) nothing wraps: `width` and `columns`
|
|
18
21
|
* are Infinity, color is off, and live lines print nothing.
|
|
19
22
|
* - NO_COLOR, TERM=dumb, and a non-terminal stream turn color off.
|
|
20
|
-
* -
|
|
23
|
+
* - Every human line goes through `layout` (or `wrap`): nothing else wraps.
|
|
24
|
+
* - A URL, a path, or a command to paste never breaks across lines. A
|
|
25
|
+
* command goes on its own line, as "Run: <command>" or after a colon.
|
|
26
|
+
* - A short last word never sits alone on its line.
|
|
21
27
|
* - A live line is clipped to one row of the real terminal, so `\r` and
|
|
22
28
|
* erase-line replace all of it.
|
|
23
29
|
* - Marks always sit beside words; they are never the only signal.
|
|
@@ -62,16 +68,46 @@ declare const STYLES: {
|
|
|
62
68
|
};
|
|
63
69
|
export type Style = keyof typeof STYLES;
|
|
64
70
|
export declare function paint(term: Pick<Term, "color">, style: Style, text: string): string;
|
|
65
|
-
export type Mark = "done" | "skip" | "warn" | "fail" | "wait";
|
|
71
|
+
export type Mark = "done" | "skip" | "warn" | "fail" | "wait" | "live";
|
|
66
72
|
export declare function mark(term: Pick<Term, "color" | "unicode">, kind: Mark): string;
|
|
67
73
|
/** Unicode punctuation a terminal without it can still show. */
|
|
68
74
|
export declare function plainText(term: Pick<Term, "unicode">, text: string): string;
|
|
75
|
+
/** "Run: <command>": the one way the CLI tells a person to run something. */
|
|
76
|
+
export declare function runLine(command: string): string;
|
|
69
77
|
/**
|
|
70
78
|
* Word-wrap `text` to `width` columns. The first line starts with `lead`, the
|
|
71
79
|
* rest with `rest` (a hanging indent; `lead` by default). A word longer than
|
|
72
|
-
* the line (a URL) gets a line of its own and is never cut
|
|
80
|
+
* the line (a URL, a command) gets a line of its own and is never cut, and a
|
|
81
|
+
* short last word never sits alone. `groups` keeps `[…]`, `<…>`, and `"…"`
|
|
82
|
+
* whole, for usage lines.
|
|
73
83
|
*/
|
|
74
|
-
export declare function wrap(text: string, width: number, lead?: string, rest?: string
|
|
84
|
+
export declare function wrap(text: string, width: number, lead?: string, rest?: string, options?: {
|
|
85
|
+
groups?: boolean;
|
|
86
|
+
usage?: boolean;
|
|
87
|
+
}): string[];
|
|
88
|
+
/**
|
|
89
|
+
* Text laid out to `width`, the one way the CLI fits a terminal. A line that
|
|
90
|
+
* fits stays as it is. A longer line wraps with a hanging indent: under its
|
|
91
|
+
* value column, after its mark, under a usage line's command, or at its own
|
|
92
|
+
* indent. A command to paste is never broken: `Run: <command>` too long for
|
|
93
|
+
* the line puts the command on the next line, under "Run:". Off a terminal
|
|
94
|
+
* (`width` is Infinity) text is unchanged.
|
|
95
|
+
*/
|
|
96
|
+
export declare function layout(text: string, width: number, options?: {
|
|
97
|
+
groups?: boolean;
|
|
98
|
+
}): string;
|
|
99
|
+
/** One message written to a stream, laid out to its width on a terminal. */
|
|
100
|
+
export declare function say(stream: Stream & {
|
|
101
|
+
write(text: string): unknown;
|
|
102
|
+
}, env: Env, text: string): void;
|
|
103
|
+
/**
|
|
104
|
+
* A question laid out as a prompt: `rows` print first, and `prompt`, the last
|
|
105
|
+
* row with the choices (`[y/N]`) on it, is what the prompt shows.
|
|
106
|
+
*/
|
|
107
|
+
export declare function promptRows(question: string, width: number, lead?: string, rest?: string): {
|
|
108
|
+
rows: string[];
|
|
109
|
+
prompt: string;
|
|
110
|
+
};
|
|
75
111
|
/** One row of at most `width` columns, cut with an ellipsis. Color is dropped
|
|
76
112
|
* from a line that has to be cut. */
|
|
77
113
|
export declare function clip(text: string, width: number, unicode?: boolean): string;
|
|
@@ -85,6 +121,14 @@ export declare function table(rows: string[][], width: number, options?: {
|
|
|
85
121
|
indent?: string;
|
|
86
122
|
separator?: string;
|
|
87
123
|
}): string[];
|
|
124
|
+
/**
|
|
125
|
+
* Parts joined with " · ", wrapped only between parts: "started 12:16 PM ·
|
|
126
|
+
* 3 ran · 4 asked" never breaks inside "Waiting for you (2)". A line ends
|
|
127
|
+
* without its separator; the break separates.
|
|
128
|
+
*/
|
|
129
|
+
export declare function joinParts(parts: string[], width: number, lead?: string, rest?: string, separator?: string): string[];
|
|
130
|
+
/** "just now", "4 min ago", "3 h ago", "2 days ago". */
|
|
131
|
+
export declare function ago(ms: number): string;
|
|
88
132
|
/** "1:32", or "12:05" for longer waits. Never negative. */
|
|
89
133
|
export declare function countdown(ms: number): string;
|
|
90
134
|
/**
|