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/term.js
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.
|
|
@@ -83,12 +89,15 @@ const STYLES = { bold: "1", dim: "2", red: "31", green: "32", yellow: "33" };
|
|
|
83
89
|
export function paint(term, style, text) {
|
|
84
90
|
return term.color && text ? `\u001b[${STYLES[style]}m${text}\u001b[0m` : text;
|
|
85
91
|
}
|
|
92
|
+
/** The house symbols. Every command takes its marks from here, so ✓ is
|
|
93
|
+
* always green, ✗ red, ! yellow, – dim, and ● (running) green. */
|
|
86
94
|
const MARKS = {
|
|
87
95
|
done: { unicode: "✓", ascii: "+", style: "green" },
|
|
88
96
|
skip: { unicode: "–", ascii: "-", style: "dim" },
|
|
89
97
|
warn: { unicode: "!", ascii: "!", style: "yellow" },
|
|
90
98
|
fail: { unicode: "✗", ascii: "x", style: "red" },
|
|
91
|
-
wait: { unicode: "…", ascii: ".", style: "dim" }
|
|
99
|
+
wait: { unicode: "…", ascii: ".", style: "dim" },
|
|
100
|
+
live: { unicode: "●", ascii: "*", style: "green" }
|
|
92
101
|
};
|
|
93
102
|
export function mark(term, kind) {
|
|
94
103
|
const spec = MARKS[kind];
|
|
@@ -104,40 +113,172 @@ export function plainText(term, text) {
|
|
|
104
113
|
.replace(/[–—]/g, "-")
|
|
105
114
|
.replace(/·/g, "-")
|
|
106
115
|
.replace(/[✓]/g, "+")
|
|
107
|
-
.replace(/[✗]/g, "x")
|
|
116
|
+
.replace(/[✗]/g, "x")
|
|
117
|
+
.replace(/[●]/g, "*");
|
|
108
118
|
}
|
|
109
|
-
// A command a person may copy stays on one line
|
|
110
|
-
// `npx passport-bridge@latest init`,
|
|
111
|
-
// `passport connect railway --wait 120
|
|
112
|
-
|
|
119
|
+
// A command a person may copy stays on one line, with the "Run" or "Use"
|
|
120
|
+
// before it: `passport keys move`, `npx passport-bridge@latest init`,
|
|
121
|
+
// `passport wait apr_123`, `passport connect railway --wait 120`,
|
|
122
|
+
// `passport keys move railway`, `passport exec -- railway`, `passport
|
|
123
|
+
// describe <tool>`.
|
|
124
|
+
const COMMAND = /(?:\b(?:Run|Use) )?\b(?:npx passport-bridge(?:@latest)?|passport) [a-z][a-z-]*(?: (?:move|add|list|test|install|uninstall|status|set|guard|shim|apr_[A-Za-z0-9_-]+))?(?: -- [a-z][a-z0-9-]*)?(?: <[a-z-]+>)?(?: (?!to\b|and\b|or\b|then\b|for\b|in\b|on\b|with\b|yourself\b)[a-z][a-z0-9_-]*(?= --|[.,]?$))?(?: --[a-z][a-z-]*(?: \d+| [a-z][a-z0-9-]*(?= --|[.,]?$))?)*/g;
|
|
113
125
|
const KEEP = "\u0000";
|
|
126
|
+
/** How far a command sits under its "Run:" when it moves to its own line. */
|
|
127
|
+
const UNDER_RUN = " ";
|
|
128
|
+
/** A line that is a command to paste: never broken, only moved. */
|
|
129
|
+
const SHELL_LINE = /^(?:Run: )?(?:sudo )?(?:passport|npx|echo|codex|claude|fish_add_path|set -Ux|export|gh|railway|cursor-agent) /;
|
|
130
|
+
/** A command to paste, not a usage line (usage has `[options]` and wraps)
|
|
131
|
+
* and not a sentence that starts with a command's name. */
|
|
132
|
+
function shellLine(text) {
|
|
133
|
+
return SHELL_LINE.test(text) && !/ \[|\S {2,}\S|[,;](?:\s|$)|\.(?:\s|$)/.test(text);
|
|
134
|
+
}
|
|
135
|
+
/** "Run: <command>": the one way the CLI tells a person to run something. */
|
|
136
|
+
export function runLine(command) {
|
|
137
|
+
return `Run: ${command}`;
|
|
138
|
+
}
|
|
139
|
+
/** Spaces a wrap never breaks at: inside a command (`passport …`, or all of
|
|
140
|
+
* `Run: <command>`), between a prompt's `[y/N]` and the word before it, and
|
|
141
|
+
* inside `[--flag <value>]` groups when asked. A " · " separator ends a line
|
|
142
|
+
* rather than starting the next one. */
|
|
143
|
+
function protect(paragraph, groups, usage = false) {
|
|
144
|
+
const keep = (part) => part.replace(/ /g, KEEP);
|
|
145
|
+
// A usage line breaks between its options, even one with <placeholders>.
|
|
146
|
+
if (shellLine(paragraph) && !(usage && / </.test(paragraph)))
|
|
147
|
+
return keep(paragraph);
|
|
148
|
+
let text = paragraph.replace(/\bRun: .*$/, keep);
|
|
149
|
+
if (!usage)
|
|
150
|
+
text = text.replace(COMMAND, keep);
|
|
151
|
+
// A flag stays with its value (`--environment production|staging`), and a
|
|
152
|
+
// usage line keeps `[--flag <value>]` groups and quoted words whole.
|
|
153
|
+
text = text.replace(/--[a-z][a-z-]* (?=[a-z<"])/g, keep).replace(/ -- (?=\S)/g, ` --${KEEP}`);
|
|
154
|
+
if (groups)
|
|
155
|
+
text = text.replace(/\[[^\]]*\]|<[^>]*>|"[^"]*"/g, keep);
|
|
156
|
+
return text.replace(/ (\[(?:y\/N|Y\/n)\]|\[[^\]]*default[^\]]*\])/g, `${KEEP}$1`).replace(/ · /g, `${KEEP}· `);
|
|
157
|
+
}
|
|
158
|
+
/** A short word never sits alone on its line (the last line, or one before a
|
|
159
|
+
* word too long to join it): the word before it moves down too, when that
|
|
160
|
+
* leaves a word above. */
|
|
161
|
+
function noWidow(lines, room) {
|
|
162
|
+
for (let index = 1; index < lines.length; index += 1) {
|
|
163
|
+
const line = lines[index];
|
|
164
|
+
const before = lines[index - 1];
|
|
165
|
+
if (line.length !== 1 || before.length < 2)
|
|
166
|
+
continue;
|
|
167
|
+
const word = line[0];
|
|
168
|
+
if (visibleLength(word) > 12 || word.includes(KEEP))
|
|
169
|
+
continue;
|
|
170
|
+
const moved = before.at(-1);
|
|
171
|
+
if (visibleLength(`${moved} ${word}`) > room(index))
|
|
172
|
+
continue;
|
|
173
|
+
before.pop();
|
|
174
|
+
line.unshift(moved);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
114
177
|
/**
|
|
115
178
|
* Word-wrap `text` to `width` columns. The first line starts with `lead`, the
|
|
116
179
|
* rest with `rest` (a hanging indent; `lead` by default). A word longer than
|
|
117
|
-
* the line (a URL) gets a line of its own and is never cut
|
|
180
|
+
* the line (a URL, a command) gets a line of its own and is never cut, and a
|
|
181
|
+
* short last word never sits alone. `groups` keeps `[…]`, `<…>`, and `"…"`
|
|
182
|
+
* whole, for usage lines.
|
|
118
183
|
*/
|
|
119
|
-
export function wrap(text, width, lead = "", rest = lead) {
|
|
120
|
-
// …and a "·" separator ends a line instead of starting the next one.
|
|
121
|
-
const kept = text.replace(COMMAND, (command) => command.replace(/ /g, KEEP)).replace(/ · /g, `${KEEP}· `);
|
|
184
|
+
export function wrap(text, width, lead = "", rest = lead, options = {}) {
|
|
122
185
|
const out = [];
|
|
123
|
-
for (const paragraph of
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
186
|
+
for (const paragraph of text.split("\n")) {
|
|
187
|
+
const first = out.length === 0;
|
|
188
|
+
const prefixOf = (index) => (first && index === 0 ? lead : rest);
|
|
189
|
+
const room = (index) => width - visibleLength(prefixOf(index));
|
|
190
|
+
// "Run: <command>" too long for the line: the command goes under "Run:".
|
|
191
|
+
const run = paragraph.match(/^Run: (.+)$/);
|
|
192
|
+
if (run && visibleLength(paragraph) > room(0)) {
|
|
193
|
+
out.push(`${prefixOf(0)}Run:`, `${rest}${UNDER_RUN}${run[1]}`);
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
const lines = [[]];
|
|
197
|
+
for (const word of protect(paragraph, options.groups ?? false, options.usage).split(" ")) {
|
|
198
|
+
const current = lines.at(-1);
|
|
199
|
+
if (word === "" && !current.length)
|
|
128
200
|
continue;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
out.push(prefix + current);
|
|
132
|
-
prefix = rest;
|
|
133
|
-
current = word;
|
|
201
|
+
if (current.length && visibleLength(current.join(" ")) + 1 + visibleLength(word) > room(lines.length - 1)) {
|
|
202
|
+
lines.push([word]);
|
|
134
203
|
}
|
|
135
204
|
else
|
|
136
|
-
current
|
|
205
|
+
current.push(word);
|
|
137
206
|
}
|
|
138
|
-
|
|
207
|
+
noWidow(lines, room);
|
|
208
|
+
lines.forEach((words, index) => out.push(prefixOf(index) + words.join(" ")));
|
|
139
209
|
}
|
|
140
|
-
|
|
210
|
+
// A line ends without its " ·": the break separates.
|
|
211
|
+
return out.map((line) => line.split(KEEP).join(" ").trimEnd().replace(/ ·$/, ""));
|
|
212
|
+
}
|
|
213
|
+
/** " Label value" or " --flag what it does": a long line's value
|
|
214
|
+
* hangs under its column. */
|
|
215
|
+
const COLUMN = /^(\s*\S+(?: \S+)*?\s{2,})\S/;
|
|
216
|
+
/** " ✓ text" or "! text": a marked line hangs under its text. */
|
|
217
|
+
const MARKED = /^(\s*[✓✗!–●…+x*] )\S/;
|
|
218
|
+
/**
|
|
219
|
+
* Text laid out to `width`, the one way the CLI fits a terminal. A line that
|
|
220
|
+
* fits stays as it is. A longer line wraps with a hanging indent: under its
|
|
221
|
+
* value column, after its mark, under a usage line's command, or at its own
|
|
222
|
+
* indent. A command to paste is never broken: `Run: <command>` too long for
|
|
223
|
+
* the line puts the command on the next line, under "Run:". Off a terminal
|
|
224
|
+
* (`width` is Infinity) text is unchanged.
|
|
225
|
+
*/
|
|
226
|
+
export function layout(text, width, options = {}) {
|
|
227
|
+
if (!Number.isFinite(width))
|
|
228
|
+
return text;
|
|
229
|
+
return text
|
|
230
|
+
.split("\n")
|
|
231
|
+
.flatMap((line) => layoutLine(line, width, options))
|
|
232
|
+
.join("\n");
|
|
233
|
+
}
|
|
234
|
+
function layoutLine(raw, width, options) {
|
|
235
|
+
if (visibleLength(raw) <= width)
|
|
236
|
+
return [raw];
|
|
237
|
+
const indent = raw.match(/^\s*/)[0];
|
|
238
|
+
const run = raw.slice(indent.length).match(/^Run: (.+)$/);
|
|
239
|
+
if (run)
|
|
240
|
+
return [`${indent}Run:`, `${indent}${UNDER_RUN}${run[1]}`];
|
|
241
|
+
// A command to paste stays whole; an unindented one with <placeholders> is a usage line.
|
|
242
|
+
const body0 = raw.slice(indent.length);
|
|
243
|
+
if (shellLine(body0) && (indent.length > 0 || !/ </.test(body0)))
|
|
244
|
+
return [raw];
|
|
245
|
+
// A JSON shape ({id,name,steps:[…]}) breaks after a comma, never mid-name.
|
|
246
|
+
const line = raw.replace(/[{[][^\s]*[}\]]/g, (shape) => shape.replace(/,(?=\S)/g, ", "));
|
|
247
|
+
const body = line.slice(indent.length);
|
|
248
|
+
const column = line.match(COLUMN);
|
|
249
|
+
const marked = line.match(MARKED);
|
|
250
|
+
const label = body.match(/^(?:JSON|Global): /)?.[0];
|
|
251
|
+
const json = label ? `${indent}${label}` : undefined;
|
|
252
|
+
const hangAt = json ?? marked?.[1] ?? (column && visibleLength(column[1]) < width / 2 ? column[1] : undefined);
|
|
253
|
+
if (hangAt) {
|
|
254
|
+
// A JSON shape breaks after any comma, inside its brackets too.
|
|
255
|
+
const within = json ? { groups: false } : options;
|
|
256
|
+
return wrap(line.slice(hangAt.length), width, hangAt, " ".repeat(visibleLength(hangAt)), within);
|
|
257
|
+
}
|
|
258
|
+
// A first column too wide to hang under (" passport exec -- railway up
|
|
259
|
+
// Run a CLI…" at 40 columns): it gets its own line, the rest under it.
|
|
260
|
+
if (column) {
|
|
261
|
+
const cell = column[1].trimEnd();
|
|
262
|
+
return [cell, ...wrap(line.slice(column[1].length), width, `${indent} `, `${indent} `, options)];
|
|
263
|
+
}
|
|
264
|
+
// A usage line hangs its options under the command, keeping each
|
|
265
|
+
// `[--flag <value>]` whole; an option line hangs under the option.
|
|
266
|
+
const usage = /^(?:Use: )?(?:sudo )?(?:passport|npx) /.test(body);
|
|
267
|
+
const hang = usage ? " " : body.startsWith("-") ? " " : "";
|
|
268
|
+
return wrap(body, width, indent, `${indent}${hang}`, { groups: options.groups || usage, usage });
|
|
269
|
+
}
|
|
270
|
+
/** One message written to a stream, laid out to its width on a terminal. */
|
|
271
|
+
export function say(stream, env, text) {
|
|
272
|
+
stream.write(`${layout(text, termOf(stream, env).width)}\n`);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* A question laid out as a prompt: `rows` print first, and `prompt`, the last
|
|
276
|
+
* row with the choices (`[y/N]`) on it, is what the prompt shows.
|
|
277
|
+
*/
|
|
278
|
+
export function promptRows(question, width, lead = "", rest = lead) {
|
|
279
|
+
const lines = wrap(question.trimEnd(), width, lead, rest);
|
|
280
|
+
const prompt = lines.pop() ?? lead;
|
|
281
|
+
return { rows: lines, prompt: `${prompt} ` };
|
|
141
282
|
}
|
|
142
283
|
/** One row of at most `width` columns, cut with an ellipsis. Color is dropped
|
|
143
284
|
* from a line that has to be cut. */
|
|
@@ -169,9 +310,42 @@ export function table(rows, width, options = {}) {
|
|
|
169
310
|
return rows.flatMap((row) => {
|
|
170
311
|
const [head = "", ...tail] = row;
|
|
171
312
|
const detail = tail.filter((cell) => stripAnsi(cell).trim()).join(options.separator ?? " · ");
|
|
172
|
-
|
|
313
|
+
// A head that starts indented (" Railway key") keeps its indent.
|
|
314
|
+
const lead = head.match(/^\s*/)[0];
|
|
315
|
+
return [...wrap(head.slice(lead.length), width, lead), ...(detail ? wrap(detail, width, `${lead}${indent}`) : [])];
|
|
173
316
|
});
|
|
174
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Parts joined with " · ", wrapped only between parts: "started 12:16 PM ·
|
|
320
|
+
* 3 ran · 4 asked" never breaks inside "Waiting for you (2)". A line ends
|
|
321
|
+
* without its separator; the break separates.
|
|
322
|
+
*/
|
|
323
|
+
export function joinParts(parts, width, lead = "", rest = lead, separator = " · ") {
|
|
324
|
+
const lines = [];
|
|
325
|
+
let current = "";
|
|
326
|
+
for (const part of parts.filter(Boolean)) {
|
|
327
|
+
const prefix = lines.length ? rest : lead;
|
|
328
|
+
if (current && visibleLength(prefix + current + separator + part) > width) {
|
|
329
|
+
lines.push(prefix + current);
|
|
330
|
+
current = part;
|
|
331
|
+
}
|
|
332
|
+
else
|
|
333
|
+
current = current ? `${current}${separator}${part}` : part;
|
|
334
|
+
}
|
|
335
|
+
if (current)
|
|
336
|
+
lines.push((lines.length ? rest : lead) + current);
|
|
337
|
+
return lines;
|
|
338
|
+
}
|
|
339
|
+
/** "just now", "4 min ago", "3 h ago", "2 days ago". */
|
|
340
|
+
export function ago(ms) {
|
|
341
|
+
const minutes = Math.round(Math.max(0, ms) / 60_000);
|
|
342
|
+
if (minutes < 1)
|
|
343
|
+
return "just now";
|
|
344
|
+
if (minutes < 60)
|
|
345
|
+
return `${minutes} min ago`;
|
|
346
|
+
const hours = Math.round(minutes / 60);
|
|
347
|
+
return hours < 48 ? `${hours} h ago` : `${Math.round(hours / 24)} days ago`;
|
|
348
|
+
}
|
|
175
349
|
/** "1:32", or "12:05" for longer waits. Never negative. */
|
|
176
350
|
export function countdown(ms) {
|
|
177
351
|
const seconds = Math.max(0, Math.ceil(ms / 1000));
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.17.0";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Keep in lockstep with bridge/package.json.
|
|
2
|
-
export const VERSION = "0.
|
|
2
|
+
export const VERSION = "0.17.0";
|
package/dist/waitingLine.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* has the link. `stop()` clears the live row; Ctrl-C copy is the caller's.
|
|
13
13
|
*/
|
|
14
14
|
import { LiveLine, countdown, termOf, visibleLength, wrap } from "./term.js";
|
|
15
|
+
import { countOf } from "./plural.js";
|
|
15
16
|
export function startWaiting(options) {
|
|
16
17
|
const term = termOf(options.stderr, options.env);
|
|
17
18
|
const write = (text) => options.stderr.write(text);
|
|
@@ -72,7 +73,7 @@ export function declinedLine(declined, now) {
|
|
|
72
73
|
.slice(0, 200);
|
|
73
74
|
const at = typeof declined.at === "number" ? declined.at : undefined;
|
|
74
75
|
const minutes = at === undefined ? undefined : Math.max(0, Math.round((now - at) / 60_000));
|
|
75
|
-
const when = minutes === undefined ? "" : minutes < 1 ? " just now" : ` ${minutes
|
|
76
|
+
const when = minutes === undefined ? "" : minutes < 1 ? " just now" : ` ${countOf(minutes, "minute")} ago`;
|
|
76
77
|
const note = typeof declined.note === "string" && clean(declined.note) ? `: ${clean(declined.note)}` : "";
|
|
77
78
|
return `Declined${when} by ${clean(declined.by)}${note}${note && /[.!?]$/.test(note) ? "" : "."}`;
|
|
78
79
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passport-bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "passport-bridge",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.17.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@modelcontextprotocol/sdk": "1.32.1"
|