@tickernelz/wardmote-adapter-utils 2026.1108.2 → 2026.1109.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/acpx-engine/ephemeral-session-environment.test.js +5 -5
- package/dist/acpx-engine/ephemeral-session-environment.test.js.map +1 -1
- package/dist/acpx-engine/execute-identity.test.js +11 -11
- package/dist/acpx-engine/execute-identity.test.js.map +1 -1
- package/dist/acpx-engine/execute.d.ts.map +1 -1
- package/dist/acpx-engine/execute.js +39 -40
- package/dist/acpx-engine/execute.js.map +1 -1
- package/dist/acpx-engine/execute.test.js +78 -78
- package/dist/acpx-engine/execute.test.js.map +1 -1
- package/dist/acpx-engine/filesystem-protocol.test.js +1 -1
- package/dist/acpx-engine/filesystem-protocol.test.js.map +1 -1
- package/dist/acpx-engine/operator-stop.test.js +2 -2
- package/dist/acpx-engine/operator-stop.test.js.map +1 -1
- package/dist/acpx-engine/run-site-sandbox.test.js +3 -3
- package/dist/acpx-engine/run-site-sandbox.test.js.map +1 -1
- package/dist/acpx-engine/spawn-smoke.test.js +6 -6
- package/dist/acpx-engine/spawn-smoke.test.js.map +1 -1
- package/dist/acpx-engine/startup-characterization.test.js +13 -13
- package/dist/acpx-engine/startup-characterization.test.js.map +1 -1
- package/dist/acpx-engine/startup-timing.test.js +2 -2
- package/dist/acpx-engine/startup-timing.test.js.map +1 -1
- package/dist/acpx-engine/terminal-session-failure.js +1 -1
- package/dist/acpx-engine/terminal-session-failure.js.map +1 -1
- package/dist/command-managed-runtime.test.js +2 -2
- package/dist/command-managed-runtime.test.js.map +1 -1
- package/dist/directory-merge-lock.test.js +2 -2
- package/dist/directory-merge-lock.test.js.map +1 -1
- package/dist/execution-target-sandbox.test.js +102 -102
- package/dist/execution-target-sandbox.test.js.map +1 -1
- package/dist/execution-target-stdin-race.test.js +25 -25
- package/dist/execution-target-stdin-race.test.js.map +1 -1
- package/dist/execution-target.d.ts.map +1 -1
- package/dist/execution-target.js +59 -60
- package/dist/execution-target.js.map +1 -1
- package/dist/execution-target.test.js +2 -2
- package/dist/execution-target.test.js.map +1 -1
- package/dist/forbidden-config-env.test.d.ts +2 -0
- package/dist/forbidden-config-env.test.d.ts.map +1 -0
- package/dist/forbidden-config-env.test.js +35 -0
- package/dist/forbidden-config-env.test.js.map +1 -0
- package/dist/git-workspace-sync.js +1 -1
- package/dist/git-workspace-sync.js.map +1 -1
- package/dist/github-launcher-environment.test.js +31 -31
- package/dist/github-launcher-environment.test.js.map +1 -1
- package/dist/github-launcher.js +9 -9
- package/dist/github-launcher.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/local-process-sandbox.test.js +8 -8
- package/dist/local-process-sandbox.test.js.map +1 -1
- package/dist/provider-models/codex.d.ts.map +1 -1
- package/dist/provider-models/codex.js +2 -2
- package/dist/provider-models/codex.js.map +1 -1
- package/dist/run-oom-score.d.ts +1 -1
- package/dist/run-oom-score.d.ts.map +1 -1
- package/dist/run-oom-score.js +1 -1
- package/dist/run-oom-score.js.map +1 -1
- package/dist/runner-connectivity.d.ts +2 -2
- package/dist/runner-connectivity.d.ts.map +1 -1
- package/dist/runner-connectivity.js +5 -5
- package/dist/runner-connectivity.js.map +1 -1
- package/dist/sandbox-callback-bridge.js +27 -27
- package/dist/sandbox-callback-bridge.js.map +1 -1
- package/dist/sandbox-callback-bridge.test.js +27 -27
- package/dist/sandbox-callback-bridge.test.js.map +1 -1
- package/dist/sandbox-install-command.js +4 -4
- package/dist/sandbox-install-command.js.map +1 -1
- package/dist/sandbox-managed-runtime.test.js +4 -4
- package/dist/sandbox-managed-runtime.test.js.map +1 -1
- package/dist/sandbox-run-log-stream.js +4 -4
- package/dist/sandbox-run-log-stream.js.map +1 -1
- package/dist/server-utils-env.test.js +2 -2
- package/dist/server-utils-env.test.js.map +1 -1
- package/dist/server-utils.d.ts +5 -5
- package/dist/server-utils.d.ts.map +1 -1
- package/dist/server-utils.js +87 -87
- package/dist/server-utils.js.map +1 -1
- package/dist/server-utils.test.js +75 -75
- package/dist/server-utils.test.js.map +1 -1
- package/dist/skill-library-manifest.test.js +4 -4
- package/dist/skill-library-manifest.test.js.map +1 -1
- package/dist/ssh.js +2 -2
- package/dist/ssh.js.map +1 -1
- package/dist/test-support/mcp-isolation-harness.js +1 -1
- package/dist/test-support/mcp-isolation-harness.js.map +1 -1
- package/dist/{paperclip-mcp-mount.d.ts → wardmote-mcp-mount.d.ts} +1 -1
- package/dist/wardmote-mcp-mount.d.ts.map +1 -0
- package/dist/{paperclip-mcp-mount.js → wardmote-mcp-mount.js} +10 -10
- package/dist/wardmote-mcp-mount.js.map +1 -0
- package/dist/{paperclip-mcp.d.ts → wardmote-mcp.d.ts} +9 -9
- package/dist/wardmote-mcp.d.ts.map +1 -0
- package/dist/{paperclip-mcp.js → wardmote-mcp.js} +36 -36
- package/dist/wardmote-mcp.js.map +1 -0
- package/dist/wardmote-mcp.test.d.ts +2 -0
- package/dist/wardmote-mcp.test.d.ts.map +1 -0
- package/dist/{paperclip-mcp.test.js → wardmote-mcp.test.js} +14 -14
- package/dist/wardmote-mcp.test.js.map +1 -0
- package/dist/{paperclip-runner-permissions.d.ts → wardmote-runner-permissions.d.ts} +18 -18
- package/dist/wardmote-runner-permissions.d.ts.map +1 -0
- package/dist/{paperclip-runner-permissions.js → wardmote-runner-permissions.js} +22 -22
- package/dist/wardmote-runner-permissions.js.map +1 -0
- package/dist/wardmote-runner-permissions.test.d.ts +2 -0
- package/dist/wardmote-runner-permissions.test.d.ts.map +1 -0
- package/dist/{paperclip-runner-permissions.test.js → wardmote-runner-permissions.test.js} +7 -7
- package/dist/wardmote-runner-permissions.test.js.map +1 -0
- package/dist/workspace-manifest.js +1 -1
- package/dist/workspace-manifest.js.map +1 -1
- package/dist/workspace-manifest.test.js +2 -2
- package/dist/workspace-manifest.test.js.map +1 -1
- package/dist/workspace-restore-merge.js +5 -5
- package/dist/workspace-restore-merge.js.map +1 -1
- package/dist/workspace-restore-merge.test.js +27 -27
- package/dist/workspace-restore-merge.test.js.map +1 -1
- package/node_modules/@clack/core/dist/index.d.mts +5 -3
- package/node_modules/@clack/core/dist/index.mjs +70 -67
- package/node_modules/@clack/core/package.json +3 -2
- package/node_modules/@clack/prompts/dist/index.d.mts +5 -4
- package/node_modules/@clack/prompts/dist/index.mjs +212 -187
- package/node_modules/@clack/prompts/package.json +3 -3
- package/node_modules/sisteransi/dist/index.d.ts +33 -0
- package/node_modules/sisteransi/dist/index.js +57 -0
- package/node_modules/sisteransi/package.json +18 -7
- package/node_modules/sisteransi/readme.md +19 -6
- package/package.json +2 -2
- package/dist/env-aliases-run.test.d.ts +0 -2
- package/dist/env-aliases-run.test.d.ts.map +0 -1
- package/dist/env-aliases-run.test.js +0 -49
- package/dist/env-aliases-run.test.js.map +0 -1
- package/dist/paperclip-mcp-mount.d.ts.map +0 -1
- package/dist/paperclip-mcp-mount.js.map +0 -1
- package/dist/paperclip-mcp.d.ts.map +0 -1
- package/dist/paperclip-mcp.js.map +0 -1
- package/dist/paperclip-mcp.test.d.ts +0 -2
- package/dist/paperclip-mcp.test.d.ts.map +0 -1
- package/dist/paperclip-mcp.test.js.map +0 -1
- package/dist/paperclip-runner-permissions.d.ts.map +0 -1
- package/dist/paperclip-runner-permissions.js.map +0 -1
- package/dist/paperclip-runner-permissions.test.d.ts +0 -2
- package/dist/paperclip-runner-permissions.test.d.ts.map +0 -1
- package/dist/paperclip-runner-permissions.test.js.map +0 -1
- package/node_modules/sisteransi/src/index.js +0 -58
- package/node_modules/sisteransi/src/sisteransi.d.ts +0 -35
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getColumns, getRows, AutocompletePrompt, settings, ConfirmPrompt,
|
|
1
|
+
import { wrapTextWithPrefix, getColumns, getRows, AutocompletePrompt, settings, ConfirmPrompt, DatePrompt, runValidation, isCancel, MultiSelectPrompt, GroupMultiSelectPrompt, MultiLinePrompt, PasswordPrompt, isAccessible, block, SelectPrompt, SelectKeyPrompt, TextPrompt } from '@clack/core';
|
|
2
2
|
export { CANCEL_SYMBOL, isCancel, settings, updateSettings } from '@clack/core';
|
|
3
3
|
import { styleText, stripVTControlCharacters } from 'node:util';
|
|
4
4
|
import process$1 from 'node:process';
|
|
@@ -24,8 +24,8 @@ function isUnicodeSupported() {
|
|
|
24
24
|
|| process$1.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const unicode = isUnicodeSupported(), isCI = () => process.env.CI === "true", isTTY = (
|
|
28
|
-
switch (
|
|
27
|
+
const unicode = isUnicodeSupported(), isCI = () => process.env.CI === "true", isTTY = (e) => e.isTTY === true, unicodeOr = (e, o) => unicode ? e : o, S_STEP_ACTIVE = unicodeOr("\u25C6", "*"), S_STEP_CANCEL = unicodeOr("\u25A0", "x"), S_STEP_ERROR = unicodeOr("\u25B2", "x"), S_STEP_SUBMIT = unicodeOr("\u25C7", "o"), S_BAR_START = unicodeOr("\u250C", "T"), S_BAR = unicodeOr("\u2502", "|"), S_BAR_END = unicodeOr("\u2514", "\u2014"), S_BAR_START_RIGHT = unicodeOr("\u2510", "T"), S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014"), S_RADIO_ACTIVE = unicodeOr("\u25CF", ">"), S_RADIO_INACTIVE = unicodeOr("\u25CB", " "), S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]"), S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]"), S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]"), S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022"), S_BAR_H = unicodeOr("\u2500", "-"), S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+"), S_CONNECT_LEFT = unicodeOr("\u251C", "+"), S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+"), S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+"), S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+"), S_INFO = unicodeOr("\u25CF", "\u2022"), S_SUCCESS = unicodeOr("\u25C6", "*"), S_WARN = unicodeOr("\u25B2", "!"), S_ERROR = unicodeOr("\u25A0", "x"), symbol = (e) => {
|
|
28
|
+
switch (e) {
|
|
29
29
|
case "initial":
|
|
30
30
|
case "active":
|
|
31
31
|
return styleText("cyan", S_STEP_ACTIVE);
|
|
@@ -38,8 +38,8 @@ const unicode = isUnicodeSupported(), isCI = () => process.env.CI === "true", is
|
|
|
38
38
|
case "validating":
|
|
39
39
|
return styleText("dim", S_STEP_ACTIVE);
|
|
40
40
|
}
|
|
41
|
-
}, symbolBar = (
|
|
42
|
-
switch (
|
|
41
|
+
}, symbolBar = (e) => {
|
|
42
|
+
switch (e) {
|
|
43
43
|
case "initial":
|
|
44
44
|
case "active":
|
|
45
45
|
return styleText("cyan", S_BAR);
|
|
@@ -51,12 +51,13 @@ const unicode = isUnicodeSupported(), isCI = () => process.env.CI === "true", is
|
|
|
51
51
|
return styleText("green", S_BAR);
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
function formatInstructionFooter(o,
|
|
55
|
-
const
|
|
56
|
-
|
|
54
|
+
function formatInstructionFooter(e, o, r) {
|
|
55
|
+
const s = r ? `${styleText("cyan", S_BAR)} ` : "", n = wrapTextWithPrefix(e, o.join(" \u2022 "), s).split(`
|
|
56
|
+
`);
|
|
57
|
+
return r && n.push(styleText("cyan", S_BAR_END)), n;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
const
|
|
60
|
+
const E$1 = (l, e, w, p, b, C = false) => {
|
|
60
61
|
let r = e, O = 0;
|
|
61
62
|
if (C)
|
|
62
63
|
for (let i = p - 1; i >= w; i--) {
|
|
@@ -86,15 +87,15 @@ const limitOptions = ({
|
|
|
86
87
|
0
|
|
87
88
|
));
|
|
88
89
|
let d = a < e.length && f > 0, c = a < e.length && f + a < e.length;
|
|
89
|
-
const
|
|
90
|
+
const I = Math.min(
|
|
90
91
|
f + a,
|
|
91
92
|
e.length
|
|
92
93
|
), s = [];
|
|
93
94
|
let g = 0;
|
|
94
95
|
d && g++, c && g++;
|
|
95
|
-
const T = f + (d ? 1 : 0),
|
|
96
|
-
for (let t = T; t <
|
|
97
|
-
const n = e[t], o = n ? w(n, t === l) : "", h = wrapAnsi(o, i, {
|
|
96
|
+
const T = f + (d ? 1 : 0), W = I - (c ? 1 : 0);
|
|
97
|
+
for (let t = T; t < W; t++) {
|
|
98
|
+
const n = e[t], o = n !== void 0 ? w(n, t === l) : "", h = wrapAnsi(o, i, {
|
|
98
99
|
hard: true,
|
|
99
100
|
trim: false
|
|
100
101
|
}).split(`
|
|
@@ -105,7 +106,7 @@ const limitOptions = ({
|
|
|
105
106
|
let t = 0, n = 0, o = g;
|
|
106
107
|
const h = l - T;
|
|
107
108
|
let u = v;
|
|
108
|
-
const L = () =>
|
|
109
|
+
const L = () => E$1(s, o, 0, h, u), y = () => E$1(
|
|
109
110
|
s,
|
|
110
111
|
o,
|
|
111
112
|
h + 1,
|
|
@@ -113,7 +114,7 @@ const limitOptions = ({
|
|
|
113
114
|
u,
|
|
114
115
|
true
|
|
115
116
|
);
|
|
116
|
-
d ? ({ lineCount: o, removals: t } = L(), o > u && (c || (u -= 1), { lineCount: o, removals: n } =
|
|
117
|
+
d ? ({ lineCount: o, removals: t } = L(), o > u && (c || (u -= 1), { lineCount: o, removals: n } = y())) : (c || (u -= 1), { lineCount: o, removals: n } = y(), o > u && (u -= 1, { lineCount: o, removals: t } = L())), t > 0 && (d = true, s.splice(0, t)), n > 0 && (c = true, s.splice(s.length - n, n));
|
|
117
118
|
}
|
|
118
119
|
const x = [];
|
|
119
120
|
d && x.push(M);
|
|
@@ -140,7 +141,7 @@ function j(t, c) {
|
|
|
140
141
|
}
|
|
141
142
|
const autocomplete = (t) => new AutocompletePrompt({
|
|
142
143
|
options: t.options,
|
|
143
|
-
initialValue: t.initialValue ? [t.initialValue] : void 0,
|
|
144
|
+
initialValue: t.initialValue !== void 0 ? [t.initialValue] : void 0,
|
|
144
145
|
initialUserInput: t.initialUserInput,
|
|
145
146
|
placeholder: t.placeholder,
|
|
146
147
|
completeOnTab: t.completeOnTab,
|
|
@@ -470,22 +471,22 @@ const MULTISELECT_INSTRUCTIONS = [
|
|
|
470
471
|
`${styleText("dim", "Space:")} select`,
|
|
471
472
|
`${styleText("dim", "Enter:")} confirm`
|
|
472
473
|
];
|
|
473
|
-
const m = (
|
|
474
|
+
const m = (n, u) => n.split(`
|
|
474
475
|
`).map((d) => u(d)).join(`
|
|
475
476
|
`);
|
|
476
|
-
const multiselect = (
|
|
477
|
+
const multiselect = (n) => {
|
|
477
478
|
const u = (t, a) => {
|
|
478
479
|
const r = t.label ?? String(t.value);
|
|
479
480
|
return a === "disabled" ? `${styleText("gray", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText(["strikethrough", "gray"], o))}${t.hint ? ` ${styleText("dim", `(${t.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${styleText("cyan", S_CHECKBOX_ACTIVE)} ${r}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${m(r, (o) => styleText("dim", o))}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "cancelled" ? `${m(r, (o) => styleText(["strikethrough", "dim"], o))}` : a === "active-selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${r}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "submitted" ? `${m(r, (o) => styleText("dim", o))}` : `${styleText("dim", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText("dim", o))}`;
|
|
480
|
-
}, d =
|
|
481
|
+
}, d = n.required ?? true, x = n.showInstructions ?? true;
|
|
481
482
|
return new MultiSelectPrompt({
|
|
482
|
-
options:
|
|
483
|
-
signal:
|
|
484
|
-
input:
|
|
485
|
-
output:
|
|
486
|
-
initialValues:
|
|
483
|
+
options: n.options,
|
|
484
|
+
signal: n.signal,
|
|
485
|
+
input: n.input,
|
|
486
|
+
output: n.output,
|
|
487
|
+
initialValues: n.initialValues,
|
|
487
488
|
required: d,
|
|
488
|
-
cursorAt:
|
|
489
|
+
cursorAt: n.cursorAt,
|
|
489
490
|
validate(t) {
|
|
490
491
|
if (d && (t === void 0 || t.length === 0))
|
|
491
492
|
return `Please select at least one option.
|
|
@@ -501,75 +502,75 @@ ${styleText(
|
|
|
501
502
|
)}`;
|
|
502
503
|
},
|
|
503
504
|
render() {
|
|
504
|
-
const t =
|
|
505
|
-
|
|
506
|
-
|
|
505
|
+
const t = n.withGuide ?? settings.withGuide, a = wrapTextWithPrefix(
|
|
506
|
+
n.output,
|
|
507
|
+
n.message,
|
|
507
508
|
t ? `${symbolBar(this.state)} ` : "",
|
|
508
509
|
`${symbol(this.state)} `
|
|
509
510
|
), r = `${t ? `${styleText("gray", S_BAR)}
|
|
510
511
|
` : ""}${a}
|
|
511
|
-
`, o = this.value ?? [], g = (
|
|
512
|
-
if (
|
|
513
|
-
return u(
|
|
514
|
-
const s = o.includes(
|
|
515
|
-
return l && s ? u(
|
|
512
|
+
`, o = this.value ?? [], g = (i, l) => {
|
|
513
|
+
if (i.disabled)
|
|
514
|
+
return u(i, "disabled");
|
|
515
|
+
const s = o.includes(i.value);
|
|
516
|
+
return l && s ? u(i, "active-selected") : s ? u(i, "selected") : u(i, l ? "active" : "inactive");
|
|
516
517
|
};
|
|
517
518
|
switch (this.state) {
|
|
518
519
|
case "submit": {
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
|
|
520
|
+
const i = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none"), l = wrapTextWithPrefix(
|
|
521
|
+
n.output,
|
|
522
|
+
i,
|
|
522
523
|
t ? `${styleText("gray", S_BAR)} ` : ""
|
|
523
524
|
);
|
|
524
525
|
return `${r}${l}`;
|
|
525
526
|
}
|
|
526
527
|
case "cancel": {
|
|
527
|
-
const
|
|
528
|
-
if (
|
|
528
|
+
const i = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "cancelled")).join(styleText("dim", ", "));
|
|
529
|
+
if (i.trim() === "")
|
|
529
530
|
return `${r}${styleText("gray", S_BAR)}`;
|
|
530
531
|
const l = wrapTextWithPrefix(
|
|
531
|
-
|
|
532
|
-
|
|
532
|
+
n.output,
|
|
533
|
+
i,
|
|
533
534
|
t ? `${styleText("gray", S_BAR)} ` : ""
|
|
534
535
|
);
|
|
535
536
|
return `${r}${l}${t ? `
|
|
536
537
|
${styleText("gray", S_BAR)}` : ""}`;
|
|
537
538
|
}
|
|
538
539
|
case "error": {
|
|
539
|
-
const
|
|
540
|
+
const i = t ? `${styleText("yellow", S_BAR)} ` : "", l = this.error.split(`
|
|
540
541
|
`).map(
|
|
541
542
|
($, v) => v === 0 ? `${t ? `${styleText("yellow", S_BAR_END)} ` : ""}${styleText("yellow", $)}` : ` ${$}`
|
|
542
543
|
).join(`
|
|
543
544
|
`), s = r.split(`
|
|
544
545
|
`).length, h = l.split(`
|
|
545
546
|
`).length + 1;
|
|
546
|
-
return `${r}${
|
|
547
|
-
output:
|
|
547
|
+
return `${r}${i}${limitOptions({
|
|
548
|
+
output: n.output,
|
|
548
549
|
options: this.options,
|
|
549
550
|
cursor: this.cursor,
|
|
550
|
-
maxItems:
|
|
551
|
-
columnPadding:
|
|
551
|
+
maxItems: n.maxItems,
|
|
552
|
+
columnPadding: i.length,
|
|
552
553
|
rowPadding: s + h,
|
|
553
554
|
style: g
|
|
554
555
|
}).join(`
|
|
555
|
-
${
|
|
556
|
+
${i}`)}
|
|
556
557
|
${l}
|
|
557
558
|
`;
|
|
558
559
|
}
|
|
559
560
|
default: {
|
|
560
|
-
const
|
|
561
|
-
`).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t) : t ? [styleText("cyan", S_BAR_END)] : [], h = s.join(`
|
|
561
|
+
const i = t ? `${styleText("cyan", S_BAR)} ` : "", l = r.split(`
|
|
562
|
+
`).length, s = x ? formatInstructionFooter(n.output, MULTISELECT_INSTRUCTIONS, t) : t ? [styleText("cyan", S_BAR_END)] : [], h = s.join(`
|
|
562
563
|
`), $ = s.length + 1;
|
|
563
|
-
return `${r}${
|
|
564
|
-
output:
|
|
564
|
+
return `${r}${i}${limitOptions({
|
|
565
|
+
output: n.output,
|
|
565
566
|
options: this.options,
|
|
566
567
|
cursor: this.cursor,
|
|
567
|
-
maxItems:
|
|
568
|
-
columnPadding:
|
|
568
|
+
maxItems: n.maxItems,
|
|
569
|
+
columnPadding: i.length,
|
|
569
570
|
rowPadding: l + $,
|
|
570
571
|
style: g
|
|
571
572
|
}).join(`
|
|
572
|
-
${
|
|
573
|
+
${i}`)}
|
|
573
574
|
${h}
|
|
574
575
|
`;
|
|
575
576
|
}
|
|
@@ -578,46 +579,46 @@ ${h}
|
|
|
578
579
|
}).prompt();
|
|
579
580
|
};
|
|
580
581
|
|
|
581
|
-
const groupMultiselect = (
|
|
582
|
-
const { selectableGroups: f = true, groupSpacing: x = 0 } =
|
|
583
|
-
const a = n.label ?? String(n.value), t = typeof n.group == "string",
|
|
584
|
-
let
|
|
585
|
-
t && (f ? (
|
|
582
|
+
const groupMultiselect = (r) => {
|
|
583
|
+
const { selectableGroups: f = true, groupSpacing: x = 0 } = r, d = (n, l, p = []) => {
|
|
584
|
+
const a = n.label ?? String(n.value), t = typeof n.group == "string", u = t && (p[p.indexOf(n) + 1] ?? { group: true }), s = t && u && u.group === true;
|
|
585
|
+
let o = "", c = "";
|
|
586
|
+
t && (f ? (o = s ? `${S_BAR_END} ` : `${S_BAR} `, c = s ? " " : `${S_BAR} `) : o = " ");
|
|
586
587
|
let i = "";
|
|
587
588
|
if (x > 0 && !t && (i = `
|
|
588
589
|
`.repeat(x)), l === "active")
|
|
589
590
|
return wrapTextWithPrefix(
|
|
590
|
-
|
|
591
|
+
r.output,
|
|
591
592
|
`${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`,
|
|
592
|
-
`${i}${styleText("dim",
|
|
593
|
-
`${i}${styleText("dim",
|
|
593
|
+
`${i}${styleText("dim", o)} `,
|
|
594
|
+
`${i}${styleText("dim", o)}${styleText("cyan", S_CHECKBOX_ACTIVE)} `,
|
|
594
595
|
`${i}${styleText("dim", c)} `
|
|
595
596
|
);
|
|
596
597
|
if (l === "group-active")
|
|
597
598
|
return wrapTextWithPrefix(
|
|
598
|
-
|
|
599
|
+
r.output,
|
|
599
600
|
a,
|
|
600
|
-
`${i}${
|
|
601
|
-
`${i}${
|
|
601
|
+
`${i}${o} `,
|
|
602
|
+
`${i}${o}${styleText("cyan", S_CHECKBOX_ACTIVE)} `,
|
|
602
603
|
`${i}${c} `,
|
|
603
604
|
(m) => styleText("dim", m)
|
|
604
605
|
);
|
|
605
606
|
if (l === "group-active-selected")
|
|
606
607
|
return wrapTextWithPrefix(
|
|
607
|
-
|
|
608
|
+
r.output,
|
|
608
609
|
a,
|
|
609
|
-
`${i}${
|
|
610
|
-
`${i}${
|
|
610
|
+
`${i}${o} `,
|
|
611
|
+
`${i}${o}${styleText("green", S_CHECKBOX_SELECTED)} `,
|
|
611
612
|
`${i}${c} `,
|
|
612
613
|
(m) => styleText("dim", m)
|
|
613
614
|
);
|
|
614
615
|
if (l === "selected") {
|
|
615
616
|
const m = t || f ? styleText("green", S_CHECKBOX_SELECTED) : "";
|
|
616
617
|
return wrapTextWithPrefix(
|
|
617
|
-
|
|
618
|
+
r.output,
|
|
618
619
|
`${a}${n.hint ? ` (${n.hint})` : ""}`,
|
|
619
|
-
`${i}${styleText("dim",
|
|
620
|
-
`${i}${styleText("dim",
|
|
620
|
+
`${i}${styleText("dim", o)} `,
|
|
621
|
+
`${i}${styleText("dim", o)}${m} `,
|
|
621
622
|
`${i}${styleText("dim", c)} `,
|
|
622
623
|
(I) => styleText("dim", I)
|
|
623
624
|
);
|
|
@@ -626,32 +627,32 @@ const groupMultiselect = (o) => {
|
|
|
626
627
|
return `${styleText(["strikethrough", "dim"], a)}`;
|
|
627
628
|
if (l === "active-selected")
|
|
628
629
|
return wrapTextWithPrefix(
|
|
629
|
-
|
|
630
|
+
r.output,
|
|
630
631
|
`${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`,
|
|
631
|
-
`${i}${styleText("dim",
|
|
632
|
-
`${i}${styleText("dim",
|
|
632
|
+
`${i}${styleText("dim", o)} `,
|
|
633
|
+
`${i}${styleText("dim", o)}${styleText("green", S_CHECKBOX_SELECTED)} `,
|
|
633
634
|
`${i}${styleText("dim", c)} `
|
|
634
635
|
);
|
|
635
636
|
if (l === "submitted")
|
|
636
637
|
return `${styleText("dim", a)}`;
|
|
637
638
|
const h = t || f ? styleText("dim", S_CHECKBOX_INACTIVE) : "";
|
|
638
639
|
return wrapTextWithPrefix(
|
|
639
|
-
|
|
640
|
+
r.output,
|
|
640
641
|
a,
|
|
641
|
-
`${i}${styleText("dim",
|
|
642
|
-
`${i}${styleText("dim",
|
|
642
|
+
`${i}${styleText("dim", o)} `,
|
|
643
|
+
`${i}${styleText("dim", o)}${h} `,
|
|
643
644
|
`${i}${styleText("dim", c)} `,
|
|
644
645
|
(m) => styleText("dim", m)
|
|
645
646
|
);
|
|
646
|
-
}, y =
|
|
647
|
+
}, y = r.required ?? true, S = r.showInstructions ?? true;
|
|
647
648
|
return new GroupMultiSelectPrompt({
|
|
648
|
-
options:
|
|
649
|
-
signal:
|
|
650
|
-
input:
|
|
651
|
-
output:
|
|
652
|
-
initialValues:
|
|
649
|
+
options: r.options,
|
|
650
|
+
signal: r.signal,
|
|
651
|
+
input: r.input,
|
|
652
|
+
output: r.output,
|
|
653
|
+
initialValues: r.initialValues,
|
|
653
654
|
required: y,
|
|
654
|
-
cursorAt:
|
|
655
|
+
cursorAt: r.cursorAt,
|
|
655
656
|
selectableGroups: f,
|
|
656
657
|
validate(n) {
|
|
657
658
|
if (y && (n === void 0 || n.length === 0))
|
|
@@ -668,58 +669,58 @@ ${styleText(
|
|
|
668
669
|
)}`;
|
|
669
670
|
},
|
|
670
671
|
render() {
|
|
671
|
-
const n =
|
|
672
|
-
` : ""}${symbol(this.state)} ${
|
|
673
|
-
`, p = this.value ?? [], a = (t,
|
|
674
|
-
const
|
|
675
|
-
return !
|
|
672
|
+
const n = r.withGuide ?? settings.withGuide, l = `${n ? `${styleText("gray", S_BAR)}
|
|
673
|
+
` : ""}${symbol(this.state)} ${r.message}
|
|
674
|
+
`, p = this.value ?? [], a = (t, u) => {
|
|
675
|
+
const s = this.options, o = p.includes(t.value) || t.group === true && this.isGroupSelected(`${t.value}`);
|
|
676
|
+
return !u && typeof t.group == "string" && this.options[this.cursor]?.value === t.group ? d(t, o ? "group-active-selected" : "group-active", s) : u && o ? d(t, "active-selected", s) : o ? d(t, "selected", s) : d(t, u ? "active" : "inactive", s);
|
|
676
677
|
};
|
|
677
678
|
switch (this.state) {
|
|
678
679
|
case "submit": {
|
|
679
|
-
const t = this.options.filter(({ value:
|
|
680
|
-
return `${l}${n ? styleText("gray", S_BAR) : ""}${
|
|
680
|
+
const t = this.options.filter(({ value: s }) => p.includes(s)).map((s) => d(s, "submitted")), u = t.length === 0 ? "" : ` ${t.join(styleText("dim", ", "))}`;
|
|
681
|
+
return `${l}${n ? styleText("gray", S_BAR) : ""}${u}`;
|
|
681
682
|
}
|
|
682
683
|
case "cancel": {
|
|
683
|
-
const t = this.options.filter(({ value:
|
|
684
|
+
const t = this.options.filter(({ value: u }) => p.includes(u)).map((u) => d(u, "cancelled")).join(styleText("dim", ", "));
|
|
684
685
|
return `${l}${n ? `${styleText("gray", S_BAR)} ` : ""}${t.trim() ? `${t}${n ? `
|
|
685
686
|
${styleText("gray", S_BAR)}` : ""}` : ""}`;
|
|
686
687
|
}
|
|
687
688
|
case "error": {
|
|
688
|
-
const t = n ? `${styleText("yellow", S_BAR)} ` : "",
|
|
689
|
+
const t = n ? `${styleText("yellow", S_BAR)} ` : "", u = this.error.split(`
|
|
689
690
|
`).map(
|
|
690
691
|
(i, h) => h === 0 ? `${n ? `${styleText("yellow", S_BAR_END)} ` : ""}${styleText("yellow", i)}` : ` ${i}`
|
|
691
692
|
).join(`
|
|
692
|
-
`),
|
|
693
|
-
`).length,
|
|
693
|
+
`), s = l.split(`
|
|
694
|
+
`).length, o = u.split(`
|
|
694
695
|
`).length + 1, c = limitOptions({
|
|
695
|
-
output:
|
|
696
|
+
output: r.output,
|
|
696
697
|
options: this.options,
|
|
697
698
|
cursor: this.cursor,
|
|
698
|
-
maxItems:
|
|
699
|
+
maxItems: r.maxItems,
|
|
699
700
|
columnPadding: t.length,
|
|
700
|
-
rowPadding:
|
|
701
|
+
rowPadding: s + o,
|
|
701
702
|
style: a
|
|
702
703
|
}).join(`
|
|
703
704
|
${t}`);
|
|
704
705
|
return `${l}${t}${c}
|
|
705
|
-
${
|
|
706
|
+
${u}
|
|
706
707
|
`;
|
|
707
708
|
}
|
|
708
709
|
default: {
|
|
709
|
-
const t = n ? `${styleText("cyan", S_BAR)} ` : "",
|
|
710
|
-
`).length,
|
|
711
|
-
`), c =
|
|
712
|
-
output:
|
|
710
|
+
const t = n ? `${styleText("cyan", S_BAR)} ` : "", u = l.split(`
|
|
711
|
+
`).length, s = S ? formatInstructionFooter(r.output, MULTISELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], o = s.join(`
|
|
712
|
+
`), c = s.length + 1, i = limitOptions({
|
|
713
|
+
output: r.output,
|
|
713
714
|
options: this.options,
|
|
714
715
|
cursor: this.cursor,
|
|
715
|
-
maxItems:
|
|
716
|
+
maxItems: r.maxItems,
|
|
716
717
|
columnPadding: t.length,
|
|
717
|
-
rowPadding:
|
|
718
|
+
rowPadding: u + c,
|
|
718
719
|
style: a
|
|
719
720
|
}).join(`
|
|
720
721
|
${t}`);
|
|
721
722
|
return `${l}${t}${i}
|
|
722
|
-
${
|
|
723
|
+
${o}
|
|
723
724
|
`;
|
|
724
725
|
}
|
|
725
726
|
}
|
|
@@ -844,7 +845,7 @@ ${r}${d}
|
|
|
844
845
|
}
|
|
845
846
|
}).prompt();
|
|
846
847
|
|
|
847
|
-
const W
|
|
848
|
+
const W = (o) => o, C = (o, e, s) => {
|
|
848
849
|
const a = {
|
|
849
850
|
hard: true,
|
|
850
851
|
trim: false
|
|
@@ -853,7 +854,7 @@ const W$1 = (o) => o, C = (o, e, s) => {
|
|
|
853
854
|
return wrapAnsi(o, g, a);
|
|
854
855
|
};
|
|
855
856
|
const note = (o = "", e = "", s) => {
|
|
856
|
-
const a = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c = s?.format ?? W
|
|
857
|
+
const a = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c = s?.format ?? W, g = ["", ...C(o, getColumns(a) - 6, c).split(`
|
|
857
858
|
`).map(c), ""], n = l(e), t = Math.max(
|
|
858
859
|
g.reduce((m, F) => {
|
|
859
860
|
const O = l(F);
|
|
@@ -934,17 +935,18 @@ const path = (e) => {
|
|
|
934
935
|
return [];
|
|
935
936
|
try {
|
|
936
937
|
let i;
|
|
937
|
-
|
|
938
|
-
|
|
938
|
+
const o = t.endsWith("/") || t.endsWith("\\");
|
|
939
|
+
existsSync(t) ? lstatSync(t).isDirectory() && (!e.directory || o) ? i = t : i = dirname(t) : i = dirname(t);
|
|
940
|
+
const m = t.length > 1 && o ? t.slice(0, -1) : t;
|
|
939
941
|
return readdirSync(i).map((r) => {
|
|
940
|
-
const n = join(i, r),
|
|
942
|
+
const n = join(i, r), l = lstatSync(n);
|
|
941
943
|
return {
|
|
942
944
|
name: r,
|
|
943
945
|
path: n,
|
|
944
|
-
isDirectory:
|
|
946
|
+
isDirectory: l.isDirectory()
|
|
945
947
|
};
|
|
946
948
|
}).filter(
|
|
947
|
-
({ path: r, isDirectory: n }) => r.startsWith(
|
|
949
|
+
({ path: r, isDirectory: n }) => r.startsWith(m) && (n || !e.directory)
|
|
948
950
|
).map((r) => ({
|
|
949
951
|
value: r.path
|
|
950
952
|
}));
|
|
@@ -955,83 +957,101 @@ const path = (e) => {
|
|
|
955
957
|
});
|
|
956
958
|
};
|
|
957
959
|
|
|
958
|
-
const
|
|
960
|
+
const Y = 3e4, Z = (c) => styleText("magenta", c);
|
|
959
961
|
const spinner = ({
|
|
960
|
-
indicator:
|
|
961
|
-
onCancel:
|
|
962
|
+
indicator: c = "dots",
|
|
963
|
+
onCancel: b,
|
|
962
964
|
output: n = process.stdout,
|
|
963
|
-
cancelMessage:
|
|
964
|
-
errorMessage:
|
|
965
|
-
frames:
|
|
966
|
-
delay:
|
|
967
|
-
signal:
|
|
968
|
-
...
|
|
965
|
+
cancelMessage: _,
|
|
966
|
+
errorMessage: C,
|
|
967
|
+
frames: M = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
|
|
968
|
+
delay: O = unicode ? 80 : 120,
|
|
969
|
+
signal: g,
|
|
970
|
+
...E
|
|
969
971
|
} = {}) => {
|
|
970
|
-
const u = isCI();
|
|
971
|
-
let
|
|
972
|
-
const
|
|
973
|
-
const
|
|
974
|
-
|
|
975
|
-
},
|
|
976
|
-
process.on("uncaughtExceptionMonitor",
|
|
977
|
-
},
|
|
978
|
-
process.removeListener("uncaughtExceptionMonitor",
|
|
979
|
-
},
|
|
980
|
-
if (
|
|
972
|
+
const u = isCI(), h = isAccessible(E.accessible);
|
|
973
|
+
let x, I, p = false, l = false, r = "", v, w = performance.now();
|
|
974
|
+
const y = getColumns(n), F = E?.styleFrame ?? Z, S = (e) => {
|
|
975
|
+
const s = e > 1 ? C ?? settings.messages.error : _ ?? settings.messages.cancel;
|
|
976
|
+
l = e === 1, p && (m(s, e), l && typeof b == "function" && b());
|
|
977
|
+
}, $ = () => S(2), a = () => S(1), H = () => {
|
|
978
|
+
process.on("uncaughtExceptionMonitor", $), process.on("unhandledRejection", $), process.on("SIGINT", a), process.on("SIGTERM", a), process.on("exit", S), g && g.addEventListener("abort", a);
|
|
979
|
+
}, B = () => {
|
|
980
|
+
process.removeListener("uncaughtExceptionMonitor", $), process.removeListener("unhandledRejection", $), process.removeListener("SIGINT", a), process.removeListener("SIGTERM", a), process.removeListener("exit", S), g && g.removeEventListener("abort", a);
|
|
981
|
+
}, R = () => {
|
|
982
|
+
if (v === void 0) return;
|
|
981
983
|
u && n.write(`
|
|
982
984
|
`);
|
|
983
|
-
const
|
|
985
|
+
const s = wrapAnsi(v, y, {
|
|
984
986
|
hard: true,
|
|
985
987
|
trim: false
|
|
986
988
|
}).split(`
|
|
987
989
|
`);
|
|
988
|
-
|
|
989
|
-
},
|
|
990
|
-
const
|
|
991
|
-
return
|
|
992
|
-
}, N =
|
|
993
|
-
|
|
990
|
+
s.length > 1 && n.write(cursor.up(s.length - 1)), n.write(cursor.to(0)), n.write(erase.down());
|
|
991
|
+
}, L = (e) => e.replace(/\.+$/, ""), T = (e) => {
|
|
992
|
+
const s = (performance.now() - e) / 1e3, i = Math.floor(s / 60), t = Math.floor(s % 60);
|
|
993
|
+
return i > 0 ? `[${i}m ${t}s]` : `[${t}s]`;
|
|
994
|
+
}, N = E.withGuide ?? settings.withGuide, P = (e = "") => {
|
|
995
|
+
if (p = true, l = false, r = L(e), w = performance.now(), H(), h) {
|
|
996
|
+
r !== "" && n.write(`${r}
|
|
997
|
+
`), I = setInterval(() => {
|
|
998
|
+
n.write(r === "" ? `still working
|
|
999
|
+
` : `still working: ${r}
|
|
1000
|
+
`);
|
|
1001
|
+
}, Y);
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
x = block({ output: n }), N && n.write(`${styleText("gray", S_BAR)}
|
|
994
1005
|
`);
|
|
995
|
-
let
|
|
996
|
-
|
|
997
|
-
if (u &&
|
|
1006
|
+
let s = 0, i = 0;
|
|
1007
|
+
I = setInterval(() => {
|
|
1008
|
+
if (u && r === v)
|
|
998
1009
|
return;
|
|
999
|
-
|
|
1000
|
-
const
|
|
1001
|
-
let
|
|
1010
|
+
R(), v = r;
|
|
1011
|
+
const t = F(M[s]);
|
|
1012
|
+
let o;
|
|
1002
1013
|
if (u)
|
|
1003
|
-
|
|
1004
|
-
else if (
|
|
1005
|
-
|
|
1014
|
+
o = `${t} ${r}...`;
|
|
1015
|
+
else if (c === "timer")
|
|
1016
|
+
o = `${t} ${r} ${T(w)}`;
|
|
1006
1017
|
else {
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1018
|
+
const j = ".".repeat(Math.floor(i)).slice(0, 3);
|
|
1019
|
+
o = `${t} ${r}${j}`;
|
|
1009
1020
|
}
|
|
1010
|
-
const
|
|
1021
|
+
const D = wrapAnsi(o, y, {
|
|
1011
1022
|
hard: true,
|
|
1012
1023
|
trim: false
|
|
1013
1024
|
});
|
|
1014
|
-
n.write(
|
|
1015
|
-
},
|
|
1016
|
-
},
|
|
1017
|
-
if (
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
`)
|
|
1025
|
+
n.write(D), s = s + 1 < M.length ? s + 1 : 0, i = i < 4 ? i + 0.125 : 0;
|
|
1026
|
+
}, O);
|
|
1027
|
+
}, m = (e = "", s = 0, i = false) => {
|
|
1028
|
+
if (p) {
|
|
1029
|
+
if (p = false, l = s === 1, clearInterval(I), h || R(), r = e ?? r, !i)
|
|
1030
|
+
if (h) {
|
|
1031
|
+
const t = s === 1 ? _ ?? settings.messages.cancel : s === 2 ? C ?? settings.messages.error : "Done", o = r || t;
|
|
1032
|
+
c === "timer" ? n.write(`${o} ${T(w)}
|
|
1033
|
+
`) : n.write(`${o}
|
|
1034
|
+
`);
|
|
1035
|
+
} else {
|
|
1036
|
+
const t = s === 0 ? styleText("green", S_STEP_SUBMIT) : s === 1 ? styleText("red", S_STEP_CANCEL) : styleText("red", S_STEP_ERROR);
|
|
1037
|
+
c === "timer" ? n.write(`${t} ${r} ${T(w)}
|
|
1038
|
+
`) : n.write(`${t} ${r}
|
|
1039
|
+
`);
|
|
1040
|
+
}
|
|
1041
|
+
B(), x?.();
|
|
1042
|
+
}
|
|
1023
1043
|
};
|
|
1024
1044
|
return {
|
|
1025
1045
|
start: P,
|
|
1026
|
-
stop: (e = "") =>
|
|
1046
|
+
stop: (e = "") => m(e, 0),
|
|
1027
1047
|
message: (e = "") => {
|
|
1028
|
-
|
|
1048
|
+
r = L(e ?? r);
|
|
1029
1049
|
},
|
|
1030
|
-
cancel: (e = "") =>
|
|
1031
|
-
error: (e = "") =>
|
|
1032
|
-
clear: () =>
|
|
1050
|
+
cancel: (e = "") => m(e, 1),
|
|
1051
|
+
error: (e = "") => m(e, 2),
|
|
1052
|
+
clear: () => m("", 0, true),
|
|
1033
1053
|
get isCancelled() {
|
|
1034
|
-
return
|
|
1054
|
+
return l;
|
|
1035
1055
|
}
|
|
1036
1056
|
};
|
|
1037
1057
|
};
|
|
@@ -1077,7 +1097,9 @@ function progress({
|
|
|
1077
1097
|
error: r.error,
|
|
1078
1098
|
clear: r.clear,
|
|
1079
1099
|
advance: g,
|
|
1080
|
-
isCancelled
|
|
1100
|
+
get isCancelled() {
|
|
1101
|
+
return r.isCancelled;
|
|
1102
|
+
},
|
|
1081
1103
|
message: (t) => g(0, t)
|
|
1082
1104
|
};
|
|
1083
1105
|
}
|
|
@@ -1143,7 +1165,7 @@ ${styleText("gray", S_BAR)}` : ""}`;
|
|
|
1143
1165
|
}
|
|
1144
1166
|
default: {
|
|
1145
1167
|
const r = n ? `${styleText("cyan", S_BAR)} ` : "", a = u.split(`
|
|
1146
|
-
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1168
|
+
`).length, p = d ? formatInstructionFooter(t.output, SELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1147
1169
|
`), b = p.length + 1;
|
|
1148
1170
|
return `${u}${r}${limitOptions({
|
|
1149
1171
|
output: t.output,
|
|
@@ -1163,36 +1185,36 @@ ${f}
|
|
|
1163
1185
|
}).prompt();
|
|
1164
1186
|
};
|
|
1165
1187
|
|
|
1166
|
-
const selectKey = (
|
|
1188
|
+
const selectKey = (i) => {
|
|
1167
1189
|
const c = (e, a = "inactive") => {
|
|
1168
1190
|
if (e === void 0)
|
|
1169
1191
|
return "";
|
|
1170
1192
|
const n = e.label ?? String(e.value);
|
|
1171
|
-
return a === "selected" ? `${styleText("dim", n)}` : a === "cancelled" ? `${styleText(["strikethrough", "dim"], n)}` : a === "active" ? `${styleText(["bgCyan", "gray"], ` ${e.value} `)} ${n}${e.hint ? ` ${styleText("dim", `(${e.hint})`)}` : ""}` : `${styleText(["gray", "bgWhite", "inverse"], ` ${e.value} `)} ${n}${e.hint ? ` ${styleText("dim", `(${e.hint})`)}` : ""}`;
|
|
1193
|
+
return a === "disabled" ? `${styleText("dim", ` ${e.value} `)} ${styleText("gray", n)}${e.hint ? ` ${styleText("dim", `(${e.hint})`)}` : ""}` : a === "selected" ? `${styleText("dim", n)}` : a === "cancelled" ? `${styleText(["strikethrough", "dim"], n)}` : a === "active" ? `${styleText(["bgCyan", "gray"], ` ${e.value} `)} ${n}${e.hint ? ` ${styleText("dim", `(${e.hint})`)}` : ""}` : `${styleText(["gray", "bgWhite", "inverse"], ` ${e.value} `)} ${n}${e.hint ? ` ${styleText("dim", `(${e.hint})`)}` : ""}`;
|
|
1172
1194
|
};
|
|
1173
1195
|
return new SelectKeyPrompt({
|
|
1174
|
-
options:
|
|
1175
|
-
signal:
|
|
1176
|
-
input:
|
|
1177
|
-
output:
|
|
1178
|
-
initialValue:
|
|
1179
|
-
caseSensitive:
|
|
1196
|
+
options: i.options,
|
|
1197
|
+
signal: i.signal,
|
|
1198
|
+
input: i.input,
|
|
1199
|
+
output: i.output,
|
|
1200
|
+
initialValue: i.initialValue,
|
|
1201
|
+
caseSensitive: i.caseSensitive,
|
|
1180
1202
|
render() {
|
|
1181
|
-
const e =
|
|
1182
|
-
` : ""}${symbol(this.state)} ${
|
|
1203
|
+
const e = i.withGuide ?? settings.withGuide, a = `${e ? `${styleText("gray", S_BAR)}
|
|
1204
|
+
` : ""}${symbol(this.state)} ${i.message}
|
|
1183
1205
|
`;
|
|
1184
1206
|
switch (this.state) {
|
|
1185
1207
|
case "submit": {
|
|
1186
|
-
const n = e ? `${styleText("gray", S_BAR)} ` : "", r = this.options.find((
|
|
1187
|
-
|
|
1208
|
+
const n = e ? `${styleText("gray", S_BAR)} ` : "", r = this.options.find((l) => l.value === this.value) ?? i.options[0], u = wrapTextWithPrefix(
|
|
1209
|
+
i.output,
|
|
1188
1210
|
c(r, "selected"),
|
|
1189
1211
|
n
|
|
1190
1212
|
);
|
|
1191
|
-
return `${a}${
|
|
1213
|
+
return `${a}${u}`;
|
|
1192
1214
|
}
|
|
1193
1215
|
case "cancel": {
|
|
1194
1216
|
const n = e ? `${styleText("gray", S_BAR)} ` : "", r = wrapTextWithPrefix(
|
|
1195
|
-
|
|
1217
|
+
i.output,
|
|
1196
1218
|
c(this.options[0], "cancelled"),
|
|
1197
1219
|
n
|
|
1198
1220
|
);
|
|
@@ -1200,15 +1222,18 @@ const selectKey = (t) => {
|
|
|
1200
1222
|
${styleText("gray", S_BAR)}` : ""}`;
|
|
1201
1223
|
}
|
|
1202
1224
|
default: {
|
|
1203
|
-
const n = e ? `${styleText("cyan", S_BAR)} ` : "", r = e ? styleText("cyan", S_BAR_END) : "",
|
|
1204
|
-
(
|
|
1205
|
-
|
|
1206
|
-
c(
|
|
1225
|
+
const n = e ? `${styleText("cyan", S_BAR)} ` : "", r = e ? styleText("cyan", S_BAR_END) : "", u = this.options.map(
|
|
1226
|
+
(l, $) => wrapTextWithPrefix(
|
|
1227
|
+
i.output,
|
|
1228
|
+
c(
|
|
1229
|
+
l,
|
|
1230
|
+
l.disabled ? "disabled" : $ === this.cursor ? "active" : "inactive"
|
|
1231
|
+
),
|
|
1207
1232
|
n
|
|
1208
1233
|
)
|
|
1209
1234
|
).join(`
|
|
1210
1235
|
`);
|
|
1211
|
-
return `${a}${
|
|
1236
|
+
return `${a}${u}
|
|
1212
1237
|
${r}
|
|
1213
1238
|
`;
|
|
1214
1239
|
}
|