@jakejarvis/acai 0.1.1 → 0.2.1
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/cli.mjs +699 -1375
- package/package.json +6 -6
package/dist/cli.mjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "module";
|
|
3
|
+
import { parseArgs, stripVTControlCharacters, styleText } from "util";
|
|
3
4
|
import N, { cwd, stdin, stdout } from "process";
|
|
4
|
-
import * as k
|
|
5
|
+
import * as k from "readline";
|
|
5
6
|
import c from "readline";
|
|
6
7
|
import { ReadStream } from "tty";
|
|
7
|
-
import {
|
|
8
|
+
import { mkdtempSync, rmSync, writeFileSync } from "fs";
|
|
8
9
|
import { delimiter, dirname, join, normalize, resolve } from "path";
|
|
9
|
-
import { parseArgs, stripVTControlCharacters } from "util";
|
|
10
10
|
import { spawn } from "child_process";
|
|
11
11
|
import { PassThrough } from "stream";
|
|
12
12
|
import { tmpdir } from "os";
|
|
13
|
-
|
|
14
13
|
//#region \0rolldown/runtime.js
|
|
15
14
|
var __create = Object.create;
|
|
16
15
|
var __defProp = Object.defineProperty;
|
|
@@ -20,16 +19,12 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
20
19
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
21
20
|
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
22
21
|
var __copyProps = (to, from, except, desc) => {
|
|
23
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
23
|
+
key = keys[i];
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
25
|
+
get: ((k) => from[k]).bind(null, key),
|
|
26
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
27
|
+
});
|
|
33
28
|
}
|
|
34
29
|
return to;
|
|
35
30
|
};
|
|
@@ -37,79 +32,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
37
32
|
value: mod,
|
|
38
33
|
enumerable: true
|
|
39
34
|
}) : target, mod));
|
|
40
|
-
|
|
41
35
|
//#endregion
|
|
42
|
-
//#region node_modules/
|
|
43
|
-
var
|
|
44
|
-
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
45
|
-
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
46
|
-
let formatter = (open, close, replace = open) => (input) => {
|
|
47
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
48
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
49
|
-
};
|
|
50
|
-
let replaceClose = (string, close, replace, index) => {
|
|
51
|
-
let result = "", cursor = 0;
|
|
52
|
-
do {
|
|
53
|
-
result += string.substring(cursor, index) + replace;
|
|
54
|
-
cursor = index + close.length;
|
|
55
|
-
index = string.indexOf(close, cursor);
|
|
56
|
-
} while (~index);
|
|
57
|
-
return result + string.substring(cursor);
|
|
58
|
-
};
|
|
59
|
-
let createColors = (enabled = isColorSupported) => {
|
|
60
|
-
let f = enabled ? formatter : () => String;
|
|
61
|
-
return {
|
|
62
|
-
isColorSupported: enabled,
|
|
63
|
-
reset: f("\x1B[0m", "\x1B[0m"),
|
|
64
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
65
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
66
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
67
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
68
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
69
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
70
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
71
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
72
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
73
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
74
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
75
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
76
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
77
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
78
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
79
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
80
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
81
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
82
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
83
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
84
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
85
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
86
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
87
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
88
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
89
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
90
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
91
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
92
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
93
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
94
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
95
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
96
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
97
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
98
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
99
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
100
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
101
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
102
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
103
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
module.exports = createColors();
|
|
107
|
-
module.exports.createColors = createColors;
|
|
108
|
-
}));
|
|
109
|
-
|
|
110
|
-
//#endregion
|
|
111
|
-
//#region node_modules/sisteransi/src/index.js
|
|
112
|
-
var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
36
|
+
//#region node_modules/@clack/core/dist/index.mjs
|
|
37
|
+
var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
113
38
|
const ESC = "\x1B";
|
|
114
39
|
const CSI = `${ESC}[`;
|
|
115
40
|
const beep = "\x07";
|
|
@@ -138,42 +63,35 @@ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
138
63
|
save: `${ESC}7`,
|
|
139
64
|
restore: `${ESC}8`
|
|
140
65
|
};
|
|
141
|
-
const scroll = {
|
|
142
|
-
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
143
|
-
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
144
|
-
};
|
|
145
|
-
const erase = {
|
|
146
|
-
screen: `${CSI}2J`,
|
|
147
|
-
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
148
|
-
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
149
|
-
line: `${CSI}2K`,
|
|
150
|
-
lineEnd: `${CSI}K`,
|
|
151
|
-
lineStart: `${CSI}1K`,
|
|
152
|
-
lines(count) {
|
|
153
|
-
let clear = "";
|
|
154
|
-
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
155
|
-
if (count) clear += cursor.left;
|
|
156
|
-
return clear;
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
66
|
module.exports = {
|
|
160
67
|
cursor,
|
|
161
|
-
scroll
|
|
162
|
-
|
|
68
|
+
scroll: {
|
|
69
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
70
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
71
|
+
},
|
|
72
|
+
erase: {
|
|
73
|
+
screen: `${CSI}2J`,
|
|
74
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
75
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
76
|
+
line: `${CSI}2K`,
|
|
77
|
+
lineEnd: `${CSI}K`,
|
|
78
|
+
lineStart: `${CSI}1K`,
|
|
79
|
+
lines(count) {
|
|
80
|
+
let clear = "";
|
|
81
|
+
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
82
|
+
if (count) clear += cursor.left;
|
|
83
|
+
return clear;
|
|
84
|
+
}
|
|
85
|
+
},
|
|
163
86
|
beep
|
|
164
87
|
};
|
|
165
|
-
}));
|
|
166
|
-
|
|
167
|
-
//#endregion
|
|
168
|
-
//#region node_modules/@clack/core/dist/index.mjs
|
|
169
|
-
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
170
|
-
var import_src = require_src();
|
|
171
|
-
function B$1(t, e, s) {
|
|
88
|
+
})))();
|
|
89
|
+
function x$2(t, e, s) {
|
|
172
90
|
if (!s.some((u) => !u.disabled)) return t;
|
|
173
91
|
const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
174
|
-
return s[n].disabled ?
|
|
92
|
+
return s[n].disabled ? x$2(n, e < 0 ? -1 : 1, s) : n;
|
|
175
93
|
}
|
|
176
|
-
const at
|
|
94
|
+
const at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, O$1 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, y$1 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, L$1 = /\t{1,1000}/y, P$1 = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy, M$1 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct = /\p{M}+/gu, ft$1 = {
|
|
177
95
|
limit: Infinity,
|
|
178
96
|
ellipsis: ""
|
|
179
97
|
}, X$1 = (t, e = {}, s = {}) => {
|
|
@@ -183,9 +101,9 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
183
101
|
if (w > C || o >= p && o > h) {
|
|
184
102
|
const ut = t.slice(C, w) || t.slice(h, o);
|
|
185
103
|
v = 0;
|
|
186
|
-
for (const Y of ut.replaceAll(ct
|
|
104
|
+
for (const Y of ut.replaceAll(ct, "")) {
|
|
187
105
|
const $ = Y.codePointAt(0) || 0;
|
|
188
|
-
if (lt
|
|
106
|
+
if (lt($) ? f = m : ht($) ? f = V : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
|
|
189
107
|
F = !0;
|
|
190
108
|
break t;
|
|
191
109
|
}
|
|
@@ -194,12 +112,12 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
194
112
|
C = w = 0;
|
|
195
113
|
}
|
|
196
114
|
if (o >= p) break;
|
|
197
|
-
if (M$
|
|
198
|
-
if (v = M$
|
|
115
|
+
if (M$1.lastIndex = o, M$1.test(t)) {
|
|
116
|
+
if (v = M$1.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
|
|
199
117
|
F = !0;
|
|
200
118
|
break;
|
|
201
119
|
}
|
|
202
|
-
c += f, C = h, w = o, o = h = M$
|
|
120
|
+
c += f, C = h, w = o, o = h = M$1.lastIndex;
|
|
203
121
|
continue;
|
|
204
122
|
}
|
|
205
123
|
if (O$1.lastIndex = o, O$1.test(t)) {
|
|
@@ -218,12 +136,12 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
218
136
|
c += f, C = h, w = o, o = h = y$1.lastIndex;
|
|
219
137
|
continue;
|
|
220
138
|
}
|
|
221
|
-
if (L.lastIndex = o, L.test(t)) {
|
|
222
|
-
if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
|
|
139
|
+
if (L$1.lastIndex = o, L$1.test(t)) {
|
|
140
|
+
if (v = L$1.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
|
|
223
141
|
F = !0;
|
|
224
142
|
break;
|
|
225
143
|
}
|
|
226
|
-
c += f, C = h, w = o, o = h = L.lastIndex;
|
|
144
|
+
c += f, C = h, w = o, o = h = L$1.lastIndex;
|
|
227
145
|
continue;
|
|
228
146
|
}
|
|
229
147
|
if (P$1.lastIndex = o, P$1.test(t)) {
|
|
@@ -246,7 +164,7 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
246
164
|
limit: Infinity,
|
|
247
165
|
ellipsis: "",
|
|
248
166
|
ellipsisWidth: 0
|
|
249
|
-
}, S$1 = (t, e = {}) => X$1(t, pt$1, e).width,
|
|
167
|
+
}, S$1 = (t, e = {}) => X$1(t, pt$1, e).width, T$1 = "\x1B", Z = "", Ft$1 = 39, j$1 = "\x07", Q$1 = "[", dt = "]", tt = "m", U$1 = `${dt}8;;`, et = new RegExp(`(?:\\${Q$1}(?<code>\\d+)m|\\${U$1}(?<uri>.*)${j$1})`, "y"), mt$1 = (t) => {
|
|
250
168
|
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
|
|
251
169
|
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
|
|
252
170
|
if (t === 1 || t === 2) return 22;
|
|
@@ -256,12 +174,12 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
256
174
|
if (t === 8) return 28;
|
|
257
175
|
if (t === 9) return 29;
|
|
258
176
|
if (t === 0) return 0;
|
|
259
|
-
}, st
|
|
177
|
+
}, st = (t) => `${T$1}${Q$1}${t}${tt}`, it = (t) => `${T$1}${U$1}${t}${j$1}`, gt$1 = (t) => t.map((e) => S$1(e)), G = (t, e, s) => {
|
|
260
178
|
const i = e[Symbol.iterator]();
|
|
261
179
|
let r = !1, n = !1, u = t.at(-1), a = u === void 0 ? 0 : S$1(u), l = i.next(), E = i.next(), g = 0;
|
|
262
180
|
for (; !l.done;) {
|
|
263
181
|
const m = l.value, A = S$1(m);
|
|
264
|
-
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m ===
|
|
182
|
+
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === T$1 || m === Z) && (r = !0, n = e.startsWith(U$1, g + 1)), r ? n ? m === j$1 && (r = !1, n = !1) : m === tt && (r = !1) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
|
|
265
183
|
}
|
|
266
184
|
u = t.at(-1), !a && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
267
185
|
}, vt$1 = (t) => {
|
|
@@ -279,18 +197,18 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
279
197
|
let p = S$1(l.at(-1) ?? "");
|
|
280
198
|
if (h !== 0 && (p >= e && (s.wordWrap === !1 || s.trim === !1) && (l.push(""), p = 0), (p > 0 || s.trim === !1) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
|
|
281
199
|
const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
|
|
282
|
-
Math.floor((a[h] - 1) / e) < F && l.push(""), G
|
|
200
|
+
Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
|
|
283
201
|
continue;
|
|
284
202
|
}
|
|
285
203
|
if (p + a[h] > e && p > 0 && a[h] > 0) {
|
|
286
204
|
if (s.wordWrap === !1 && p < e) {
|
|
287
|
-
G
|
|
205
|
+
G(l, o, e);
|
|
288
206
|
continue;
|
|
289
207
|
}
|
|
290
208
|
l.push("");
|
|
291
209
|
}
|
|
292
210
|
if (p + a[h] > e && s.wordWrap === !1) {
|
|
293
|
-
G
|
|
211
|
+
G(l, o, e);
|
|
294
212
|
continue;
|
|
295
213
|
}
|
|
296
214
|
l[l.length - 1] += o;
|
|
@@ -301,9 +219,9 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
301
219
|
let m = g.next(), A = g.next(), V = 0;
|
|
302
220
|
for (; !m.done;) {
|
|
303
221
|
const h = m.value, o = A.value;
|
|
304
|
-
if (i += h, h ===
|
|
305
|
-
et
|
|
306
|
-
const F = et
|
|
222
|
+
if (i += h, h === T$1 || h === Z) {
|
|
223
|
+
et.lastIndex = V + 1;
|
|
224
|
+
const F = et.exec(E)?.groups;
|
|
307
225
|
if (F?.code !== void 0) {
|
|
308
226
|
const d = Number.parseFloat(F.code);
|
|
309
227
|
r = d === Ft$1 ? void 0 : d;
|
|
@@ -311,12 +229,12 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
311
229
|
}
|
|
312
230
|
const p = r ? mt$1(r) : void 0;
|
|
313
231
|
o === `
|
|
314
|
-
` ? (n && (i += it
|
|
315
|
-
` && (r && p && (i += st
|
|
232
|
+
` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
|
|
233
|
+
` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
|
|
316
234
|
}
|
|
317
235
|
return i;
|
|
318
236
|
};
|
|
319
|
-
function K$
|
|
237
|
+
function K$1(t, e, s) {
|
|
320
238
|
return String(t).normalize().replaceAll(`\r
|
|
321
239
|
`, `
|
|
322
240
|
`).split(`
|
|
@@ -347,12 +265,12 @@ const _$1 = {
|
|
|
347
265
|
},
|
|
348
266
|
withGuide: !0
|
|
349
267
|
};
|
|
350
|
-
function H$
|
|
268
|
+
function H$1(t, e) {
|
|
351
269
|
if (typeof t == "string") return _$1.aliases.get(t) === e;
|
|
352
|
-
for (const s of t) if (s !== void 0 && H$
|
|
270
|
+
for (const s of t) if (s !== void 0 && H$1(s, e)) return !0;
|
|
353
271
|
return !1;
|
|
354
272
|
}
|
|
355
|
-
function _t(t, e) {
|
|
273
|
+
function _t$1(t, e) {
|
|
356
274
|
if (t === e) return;
|
|
357
275
|
const s = t.split(`
|
|
358
276
|
`), i = e.split(`
|
|
@@ -365,24 +283,24 @@ function _t(t, e) {
|
|
|
365
283
|
numLines: r
|
|
366
284
|
};
|
|
367
285
|
}
|
|
368
|
-
const bt$1 = globalThis.process.platform.startsWith("win"), z$
|
|
286
|
+
const bt$1 = globalThis.process.platform.startsWith("win"), z$2 = Symbol("clack:cancel");
|
|
369
287
|
function Ct$1(t) {
|
|
370
|
-
return t === z$
|
|
288
|
+
return t === z$2;
|
|
371
289
|
}
|
|
372
|
-
function
|
|
290
|
+
function W$1(t, e) {
|
|
373
291
|
const s = t;
|
|
374
292
|
s.isTTY && s.setRawMode(e);
|
|
375
293
|
}
|
|
376
|
-
function
|
|
377
|
-
const r = k
|
|
294
|
+
function xt$1({ input: t = stdin, output: e = stdout, overwrite: s = !0, hideCursor: i = !0 } = {}) {
|
|
295
|
+
const r = k.createInterface({
|
|
378
296
|
input: t,
|
|
379
297
|
output: e,
|
|
380
298
|
prompt: "",
|
|
381
299
|
tabSize: 1
|
|
382
300
|
});
|
|
383
|
-
k
|
|
301
|
+
k.emitKeypressEvents(t, r), t instanceof ReadStream && t.isTTY && t.setRawMode(!0);
|
|
384
302
|
const n = (u, { name: a, sequence: l }) => {
|
|
385
|
-
if (H$
|
|
303
|
+
if (H$1([
|
|
386
304
|
String(u),
|
|
387
305
|
a,
|
|
388
306
|
l
|
|
@@ -392,8 +310,8 @@ function Bt({ input: t = stdin, output: e = stdout, overwrite: s = !0, hideCurso
|
|
|
392
310
|
}
|
|
393
311
|
if (!s) return;
|
|
394
312
|
const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
|
|
395
|
-
k
|
|
396
|
-
k
|
|
313
|
+
k.moveCursor(e, g, m, () => {
|
|
314
|
+
k.clearLine(e, 1, () => {
|
|
397
315
|
t.once("keypress", n);
|
|
398
316
|
});
|
|
399
317
|
});
|
|
@@ -402,16 +320,16 @@ function Bt({ input: t = stdin, output: e = stdout, overwrite: s = !0, hideCurso
|
|
|
402
320
|
t.off("keypress", n), i && e.write(import_src.cursor.show), t instanceof ReadStream && t.isTTY && !bt$1 && t.setRawMode(!1), r.terminal = !1, r.close();
|
|
403
321
|
};
|
|
404
322
|
}
|
|
405
|
-
const rt
|
|
406
|
-
function
|
|
407
|
-
return K$
|
|
323
|
+
const rt = (t) => "columns" in t && typeof t.columns == "number" ? t.columns : 80, nt = (t) => "rows" in t && typeof t.rows == "number" ? t.rows : 20;
|
|
324
|
+
function Bt$1(t, e, s, i = s) {
|
|
325
|
+
return K$1(e, rt(t ?? stdout) - s.length, {
|
|
408
326
|
hard: !0,
|
|
409
327
|
trim: !1
|
|
410
328
|
}).split(`
|
|
411
329
|
`).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
|
|
412
330
|
`);
|
|
413
331
|
}
|
|
414
|
-
var
|
|
332
|
+
var B = class {
|
|
415
333
|
input;
|
|
416
334
|
output;
|
|
417
335
|
_abortSignal;
|
|
@@ -454,7 +372,7 @@ var x$2 = class {
|
|
|
454
372
|
prompt() {
|
|
455
373
|
return new Promise((e) => {
|
|
456
374
|
if (this._abortSignal) {
|
|
457
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z$
|
|
375
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z$2);
|
|
458
376
|
this._abortSignal.addEventListener("abort", () => {
|
|
459
377
|
this.state = "cancel", this.close();
|
|
460
378
|
}, { once: !0 });
|
|
@@ -465,10 +383,10 @@ var x$2 = class {
|
|
|
465
383
|
prompt: "",
|
|
466
384
|
escapeCodeTimeout: 50,
|
|
467
385
|
terminal: !0
|
|
468
|
-
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress),
|
|
469
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
386
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), W$1(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
387
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), W$1(this.input, !1), e(this.value);
|
|
470
388
|
}), this.once("cancel", () => {
|
|
471
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
389
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), W$1(this.input, !1), e(z$2);
|
|
472
390
|
});
|
|
473
391
|
});
|
|
474
392
|
}
|
|
@@ -498,7 +416,7 @@ var x$2 = class {
|
|
|
498
416
|
}
|
|
499
417
|
this.state !== "error" && (this.state = "submit");
|
|
500
418
|
}
|
|
501
|
-
H$
|
|
419
|
+
H$1([
|
|
502
420
|
e,
|
|
503
421
|
s?.name,
|
|
504
422
|
s?.sequence
|
|
@@ -506,10 +424,10 @@ var x$2 = class {
|
|
|
506
424
|
}
|
|
507
425
|
close() {
|
|
508
426
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
509
|
-
`),
|
|
427
|
+
`), W$1(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
510
428
|
}
|
|
511
429
|
restoreCursor() {
|
|
512
|
-
const e = K$
|
|
430
|
+
const e = K$1(this._prevFrame, process.stdout.columns, {
|
|
513
431
|
hard: !0,
|
|
514
432
|
trim: !1
|
|
515
433
|
}).split(`
|
|
@@ -517,14 +435,14 @@ var x$2 = class {
|
|
|
517
435
|
this.output.write(import_src.cursor.move(-999, e * -1));
|
|
518
436
|
}
|
|
519
437
|
render() {
|
|
520
|
-
const e = K$
|
|
438
|
+
const e = K$1(this._render(this) ?? "", process.stdout.columns, {
|
|
521
439
|
hard: !0,
|
|
522
440
|
trim: !1
|
|
523
441
|
});
|
|
524
442
|
if (e !== this._prevFrame) {
|
|
525
443
|
if (this.state === "initial") this.output.write(import_src.cursor.hide);
|
|
526
444
|
else {
|
|
527
|
-
const s = _t(this._prevFrame, e), i = nt
|
|
445
|
+
const s = _t$1(this._prevFrame, e), i = nt(this.output);
|
|
528
446
|
if (this.restoreCursor(), s) {
|
|
529
447
|
const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
|
|
530
448
|
let u = s.lines.find((a) => a >= r);
|
|
@@ -558,75 +476,7 @@ var x$2 = class {
|
|
|
558
476
|
}
|
|
559
477
|
}
|
|
560
478
|
};
|
|
561
|
-
|
|
562
|
-
if (t === void 0 || e.length === 0) return 0;
|
|
563
|
-
const s = e.findIndex((i) => i.value === t);
|
|
564
|
-
return s !== -1 ? s : 0;
|
|
565
|
-
}
|
|
566
|
-
function Dt$1(t, e) {
|
|
567
|
-
return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
|
|
568
|
-
}
|
|
569
|
-
function St$1(t, e) {
|
|
570
|
-
if (e) return t ? e : e[0];
|
|
571
|
-
}
|
|
572
|
-
var Vt$1 = class extends x$2 {
|
|
573
|
-
filteredOptions;
|
|
574
|
-
multiple;
|
|
575
|
-
isNavigating = !1;
|
|
576
|
-
selectedValues = [];
|
|
577
|
-
focusedValue;
|
|
578
|
-
#t = 0;
|
|
579
|
-
#s = "";
|
|
580
|
-
#i;
|
|
581
|
-
#e;
|
|
582
|
-
get cursor() {
|
|
583
|
-
return this.#t;
|
|
584
|
-
}
|
|
585
|
-
get userInputWithCursor() {
|
|
586
|
-
if (!this.userInput) return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
|
|
587
|
-
if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
|
|
588
|
-
const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
|
|
589
|
-
return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
|
|
590
|
-
}
|
|
591
|
-
get options() {
|
|
592
|
-
return typeof this.#e == "function" ? this.#e() : this.#e;
|
|
593
|
-
}
|
|
594
|
-
constructor(e) {
|
|
595
|
-
super(e), this.#e = e.options;
|
|
596
|
-
const s = this.options;
|
|
597
|
-
this.filteredOptions = [...s], this.multiple = e.multiple === !0, this.#i = e.filter ?? Dt$1;
|
|
598
|
-
let i;
|
|
599
|
-
if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i) for (const r of i) {
|
|
600
|
-
const n = s.findIndex((u) => u.value === r);
|
|
601
|
-
n !== -1 && (this.toggleSelected(r), this.#t = n);
|
|
602
|
-
}
|
|
603
|
-
this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
|
|
604
|
-
}
|
|
605
|
-
_isActionKey(e, s) {
|
|
606
|
-
return e === " " || this.multiple && this.isNavigating && s.name === "space" && e !== void 0 && e !== "";
|
|
607
|
-
}
|
|
608
|
-
#r(e, s) {
|
|
609
|
-
const i = s.name === "up", r = s.name === "down", n = s.name === "return";
|
|
610
|
-
i || r ? (this.#t = B$1(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = !0) : n ? this.value = St$1(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== void 0 && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = !1 : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = !1);
|
|
611
|
-
}
|
|
612
|
-
deselectAll() {
|
|
613
|
-
this.selectedValues = [];
|
|
614
|
-
}
|
|
615
|
-
toggleSelected(e) {
|
|
616
|
-
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
|
|
617
|
-
}
|
|
618
|
-
#n(e) {
|
|
619
|
-
if (e !== this.#s) {
|
|
620
|
-
this.#s = e;
|
|
621
|
-
const s = this.options;
|
|
622
|
-
e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
|
|
623
|
-
this.#t = B$1(wt$1(this.focusedValue, this.filteredOptions), 0, this.filteredOptions);
|
|
624
|
-
const r = this.filteredOptions[this.#t];
|
|
625
|
-
r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
var kt$1 = class extends x$2 {
|
|
479
|
+
var kt$1 = class extends B {
|
|
630
480
|
get cursor() {
|
|
631
481
|
return this.value ? 0 : 1;
|
|
632
482
|
}
|
|
@@ -643,7 +493,7 @@ var kt$1 = class extends x$2 {
|
|
|
643
493
|
});
|
|
644
494
|
}
|
|
645
495
|
};
|
|
646
|
-
var yt$1 = class extends
|
|
496
|
+
var yt$1 = class extends B {
|
|
647
497
|
options;
|
|
648
498
|
cursor = 0;
|
|
649
499
|
#t;
|
|
@@ -694,75 +544,7 @@ var yt$1 = class extends x$2 {
|
|
|
694
544
|
});
|
|
695
545
|
}
|
|
696
546
|
};
|
|
697
|
-
var
|
|
698
|
-
options;
|
|
699
|
-
cursor = 0;
|
|
700
|
-
get _value() {
|
|
701
|
-
return this.options[this.cursor].value;
|
|
702
|
-
}
|
|
703
|
-
get _enabledOptions() {
|
|
704
|
-
return this.options.filter((e) => e.disabled !== !0);
|
|
705
|
-
}
|
|
706
|
-
toggleAll() {
|
|
707
|
-
const e = this._enabledOptions;
|
|
708
|
-
this.value = this.value !== void 0 && this.value.length === e.length ? [] : e.map((i) => i.value);
|
|
709
|
-
}
|
|
710
|
-
toggleInvert() {
|
|
711
|
-
const e = this.value;
|
|
712
|
-
if (!e) return;
|
|
713
|
-
this.value = this._enabledOptions.filter((i) => !e.includes(i.value)).map((i) => i.value);
|
|
714
|
-
}
|
|
715
|
-
toggleValue() {
|
|
716
|
-
this.value === void 0 && (this.value = []);
|
|
717
|
-
this.value = this.value.includes(this._value) ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
|
|
718
|
-
}
|
|
719
|
-
constructor(e) {
|
|
720
|
-
super(e, !1), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
721
|
-
const s = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), 0);
|
|
722
|
-
this.cursor = this.options[s].disabled ? B$1(s, 1, this.options) : s, this.on("key", (i) => {
|
|
723
|
-
i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
|
|
724
|
-
}), this.on("cursor", (i) => {
|
|
725
|
-
switch (i) {
|
|
726
|
-
case "left":
|
|
727
|
-
case "up":
|
|
728
|
-
this.cursor = B$1(this.cursor, -1, this.options);
|
|
729
|
-
break;
|
|
730
|
-
case "down":
|
|
731
|
-
case "right":
|
|
732
|
-
this.cursor = B$1(this.cursor, 1, this.options);
|
|
733
|
-
break;
|
|
734
|
-
case "space":
|
|
735
|
-
this.toggleValue();
|
|
736
|
-
break;
|
|
737
|
-
}
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
};
|
|
741
|
-
let Mt$1 = class extends x$2 {
|
|
742
|
-
_mask = "•";
|
|
743
|
-
get cursor() {
|
|
744
|
-
return this._cursor;
|
|
745
|
-
}
|
|
746
|
-
get masked() {
|
|
747
|
-
return this.userInput.replaceAll(/./g, this._mask);
|
|
748
|
-
}
|
|
749
|
-
get userInputWithCursor() {
|
|
750
|
-
if (this.state === "submit" || this.state === "cancel") return this.masked;
|
|
751
|
-
const e = this.userInput;
|
|
752
|
-
if (this.cursor >= e.length) return `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
|
|
753
|
-
const s = this.masked, i = s.slice(0, this.cursor), r = s.slice(this.cursor);
|
|
754
|
-
return `${i}${import_picocolors.default.inverse(r[0])}${r.slice(1)}`;
|
|
755
|
-
}
|
|
756
|
-
clear() {
|
|
757
|
-
this._clearUserInput();
|
|
758
|
-
}
|
|
759
|
-
constructor({ mask: e, ...s }) {
|
|
760
|
-
super(s), this._mask = e ?? "•", this.on("userInput", (i) => {
|
|
761
|
-
this._setValue(i);
|
|
762
|
-
});
|
|
763
|
-
}
|
|
764
|
-
};
|
|
765
|
-
var Wt$1 = class extends x$2 {
|
|
547
|
+
var Tt$1 = class extends B {
|
|
766
548
|
options;
|
|
767
549
|
cursor = 0;
|
|
768
550
|
get _selectedValue() {
|
|
@@ -774,43 +556,28 @@ var Wt$1 = class extends x$2 {
|
|
|
774
556
|
constructor(e) {
|
|
775
557
|
super(e, !1), this.options = e.options;
|
|
776
558
|
const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
|
|
777
|
-
this.cursor = this.options[i].disabled ?
|
|
559
|
+
this.cursor = this.options[i].disabled ? x$2(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
|
|
778
560
|
switch (r) {
|
|
779
561
|
case "left":
|
|
780
562
|
case "up":
|
|
781
|
-
this.cursor =
|
|
563
|
+
this.cursor = x$2(this.cursor, -1, this.options);
|
|
782
564
|
break;
|
|
783
565
|
case "down":
|
|
784
566
|
case "right":
|
|
785
|
-
this.cursor =
|
|
567
|
+
this.cursor = x$2(this.cursor, 1, this.options);
|
|
786
568
|
break;
|
|
787
569
|
}
|
|
788
570
|
this.changeValue();
|
|
789
571
|
});
|
|
790
572
|
}
|
|
791
573
|
};
|
|
792
|
-
var
|
|
793
|
-
options;
|
|
794
|
-
cursor = 0;
|
|
795
|
-
constructor(e) {
|
|
796
|
-
super(e, !1), this.options = e.options;
|
|
797
|
-
const s = e.caseSensitive === !0, i = this.options.map(({ value: [r] }) => s ? r : r?.toLowerCase());
|
|
798
|
-
this.cursor = Math.max(i.indexOf(e.initialValue), 0), this.on("key", (r, n) => {
|
|
799
|
-
if (!r) return;
|
|
800
|
-
const u = s && n.shift ? r.toUpperCase() : r;
|
|
801
|
-
if (!i.includes(u)) return;
|
|
802
|
-
const a = this.options.find(({ value: [l] }) => s ? l === u : l?.toLowerCase() === r);
|
|
803
|
-
a && (this.value = a.value, this.state = "submit", this.emit("submit"));
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
};
|
|
807
|
-
var $t$1 = class extends x$2 {
|
|
574
|
+
var $t = class extends B {
|
|
808
575
|
get userInputWithCursor() {
|
|
809
576
|
if (this.state === "submit") return this.userInput;
|
|
810
577
|
const e = this.userInput;
|
|
811
578
|
if (this.cursor >= e.length) return `${this.userInput}\u2588`;
|
|
812
579
|
const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
|
|
813
|
-
return `${s}${
|
|
580
|
+
return `${s}${styleText("inverse", i)}${r.join("")}`;
|
|
814
581
|
}
|
|
815
582
|
get cursor() {
|
|
816
583
|
return this._cursor;
|
|
@@ -826,722 +593,398 @@ var $t$1 = class extends x$2 {
|
|
|
826
593
|
});
|
|
827
594
|
}
|
|
828
595
|
};
|
|
829
|
-
|
|
830
596
|
//#endregion
|
|
831
597
|
//#region node_modules/@clack/prompts/dist/index.mjs
|
|
832
|
-
function
|
|
598
|
+
function pt() {
|
|
833
599
|
return N.platform !== "win32" ? N.env.TERM !== "linux" : !!N.env.CI || !!N.env.WT_SESSION || !!N.env.TERMINUS_SUBLIME || N.env.ConEmuTask === "{cmd::Cmder}" || N.env.TERM_PROGRAM === "Terminus-Sublime" || N.env.TERM_PROGRAM === "vscode" || N.env.TERM === "xterm-256color" || N.env.TERM === "alacritty" || N.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
834
600
|
}
|
|
835
|
-
const
|
|
836
|
-
|
|
601
|
+
const ee = pt(), ce = () => process.env.CI === "true", I$1 = (e, r) => ee ? e : r, Re = I$1("◆", "*"), $e = I$1("■", "x"), de = I$1("▲", "x"), V = I$1("◇", "o"), he = I$1("┌", "T"), h$1 = I$1("│", "|"), x$1 = I$1("└", "—");
|
|
602
|
+
I$1("┐", "T");
|
|
603
|
+
I$1("┘", "—");
|
|
604
|
+
const z$1 = I$1("●", ">"), H = I$1("○", " "), te = I$1("◻", "[•]"), U = I$1("◼", "[+]"), q = I$1("◻", "[ ]");
|
|
605
|
+
I$1("▪", "•");
|
|
606
|
+
I$1("─", "-");
|
|
607
|
+
I$1("╮", "+");
|
|
608
|
+
I$1("├", "+");
|
|
609
|
+
I$1("╯", "+");
|
|
610
|
+
I$1("╰", "+");
|
|
611
|
+
I$1("╭", "+");
|
|
612
|
+
const fe = I$1("●", "•"), Fe = I$1("◆", "*"), ye = I$1("▲", "!"), Ee = I$1("■", "x"), W = (e) => {
|
|
613
|
+
switch (e) {
|
|
837
614
|
case "initial":
|
|
838
|
-
case "active": return
|
|
839
|
-
case "cancel": return
|
|
840
|
-
case "error": return
|
|
841
|
-
case "submit": return
|
|
615
|
+
case "active": return styleText("cyan", Re);
|
|
616
|
+
case "cancel": return styleText("red", $e);
|
|
617
|
+
case "error": return styleText("yellow", de);
|
|
618
|
+
case "submit": return styleText("green", V);
|
|
842
619
|
}
|
|
843
|
-
},
|
|
844
|
-
switch (
|
|
620
|
+
}, ve = (e) => {
|
|
621
|
+
switch (e) {
|
|
845
622
|
case "initial":
|
|
846
|
-
case "active": return
|
|
847
|
-
case "cancel": return
|
|
848
|
-
case "error": return
|
|
849
|
-
case "submit": return
|
|
623
|
+
case "active": return styleText("cyan", h$1);
|
|
624
|
+
case "cancel": return styleText("red", h$1);
|
|
625
|
+
case "error": return styleText("yellow", h$1);
|
|
626
|
+
case "submit": return styleText("green", h$1);
|
|
850
627
|
}
|
|
851
|
-
},
|
|
628
|
+
}, mt = (e) => e === 161 || e === 164 || e === 167 || e === 168 || e === 170 || e === 173 || e === 174 || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || e === 198 || e === 208 || e === 215 || e === 216 || e >= 222 && e <= 225 || e === 230 || e >= 232 && e <= 234 || e === 236 || e === 237 || e === 240 || e === 242 || e === 243 || e >= 247 && e <= 250 || e === 252 || e === 254 || e === 257 || e === 273 || e === 275 || e === 283 || e === 294 || e === 295 || e === 299 || e >= 305 && e <= 307 || e === 312 || e >= 319 && e <= 322 || e === 324 || e >= 328 && e <= 331 || e === 333 || e === 338 || e === 339 || e === 358 || e === 359 || e === 363 || e === 462 || e === 464 || e === 466 || e === 468 || e === 470 || e === 472 || e === 474 || e === 476 || e === 593 || e === 609 || e === 708 || e === 711 || e >= 713 && e <= 715 || e === 717 || e === 720 || e >= 728 && e <= 731 || e === 733 || e === 735 || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || e === 1025 || e >= 1040 && e <= 1103 || e === 1105 || e === 8208 || e >= 8211 && e <= 8214 || e === 8216 || e === 8217 || e === 8220 || e === 8221 || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || e === 8240 || e === 8242 || e === 8243 || e === 8245 || e === 8251 || e === 8254 || e === 8308 || e === 8319 || e >= 8321 && e <= 8324 || e === 8364 || e === 8451 || e === 8453 || e === 8457 || e === 8467 || e === 8470 || e === 8481 || e === 8482 || e === 8486 || e === 8491 || e === 8531 || e === 8532 || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || e === 8585 || e >= 8592 && e <= 8601 || e === 8632 || e === 8633 || e === 8658 || e === 8660 || e === 8679 || e === 8704 || e === 8706 || e === 8707 || e === 8711 || e === 8712 || e === 8715 || e === 8719 || e === 8721 || e === 8725 || e === 8730 || e >= 8733 && e <= 8736 || e === 8739 || e === 8741 || e >= 8743 && e <= 8748 || e === 8750 || e >= 8756 && e <= 8759 || e === 8764 || e === 8765 || e === 8776 || e === 8780 || e === 8786 || e === 8800 || e === 8801 || e >= 8804 && e <= 8807 || e === 8810 || e === 8811 || e === 8814 || e === 8815 || e === 8834 || e === 8835 || e === 8838 || e === 8839 || e === 8853 || e === 8857 || e === 8869 || e === 8895 || e === 8978 || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || e === 9632 || e === 9633 || e >= 9635 && e <= 9641 || e === 9650 || e === 9651 || e === 9654 || e === 9655 || e === 9660 || e === 9661 || e === 9664 || e === 9665 || e >= 9670 && e <= 9672 || e === 9675 || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || e === 9711 || e === 9733 || e === 9734 || e === 9737 || e === 9742 || e === 9743 || e === 9756 || e === 9758 || e === 9792 || e === 9794 || e === 9824 || e === 9825 || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || e === 9836 || e === 9837 || e === 9839 || e === 9886 || e === 9887 || e === 9919 || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || e === 9955 || e === 9960 || e === 9961 || e >= 9963 && e <= 9969 || e === 9972 || e >= 9974 && e <= 9977 || e === 9979 || e === 9980 || e === 9982 || e === 9983 || e === 10045 || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || e === 65533 || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || e === 127375 || e === 127376 || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109, gt = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, ft = (e) => e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9800 && e <= 9811 || e === 9855 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141, we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, ie = /\t{1,1000}/y, Ae = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy, ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, Ft = /\p{M}+/gu, yt = {
|
|
852
629
|
limit: Infinity,
|
|
853
630
|
ellipsis: ""
|
|
854
|
-
},
|
|
855
|
-
const i = r.limit ?? Infinity, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ?
|
|
856
|
-
let $ = 0, m = 0,
|
|
857
|
-
|
|
858
|
-
if (
|
|
859
|
-
const
|
|
860
|
-
|
|
861
|
-
for (const
|
|
862
|
-
const
|
|
863
|
-
if (
|
|
864
|
-
|
|
865
|
-
break
|
|
631
|
+
}, Le = (e, r = {}, s = {}) => {
|
|
632
|
+
const i = r.limit ?? Infinity, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, yt, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
|
|
633
|
+
let $ = 0, m = 0, d = e.length, F = 0, y = !1, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S = 0;
|
|
634
|
+
e: for (;;) {
|
|
635
|
+
if (b > A || m >= d && m > $) {
|
|
636
|
+
const T = e.slice(A, b) || e.slice($, m);
|
|
637
|
+
F = 0;
|
|
638
|
+
for (const M of T.replaceAll(Ft, "")) {
|
|
639
|
+
const O = M.codePointAt(0) || 0;
|
|
640
|
+
if (gt(O) ? S = f : ft(O) ? S = E : c !== g && mt(O) ? S = c : S = g, w + S > C && (v = Math.min(v, Math.max(A, $) + F)), w + S > i) {
|
|
641
|
+
y = !0;
|
|
642
|
+
break e;
|
|
866
643
|
}
|
|
867
|
-
|
|
644
|
+
F += M.length, w += S;
|
|
868
645
|
}
|
|
869
|
-
|
|
646
|
+
A = b = 0;
|
|
870
647
|
}
|
|
871
|
-
if (m >=
|
|
872
|
-
if (
|
|
873
|
-
if (
|
|
874
|
-
|
|
648
|
+
if (m >= d) break;
|
|
649
|
+
if (ne.lastIndex = m, ne.test(e)) {
|
|
650
|
+
if (F = ne.lastIndex - m, S = F * g, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S > i) {
|
|
651
|
+
y = !0;
|
|
875
652
|
break;
|
|
876
653
|
}
|
|
877
|
-
|
|
654
|
+
w += S, A = $, b = m, m = $ = ne.lastIndex;
|
|
878
655
|
continue;
|
|
879
656
|
}
|
|
880
|
-
if (
|
|
881
|
-
if (
|
|
882
|
-
|
|
657
|
+
if (we.lastIndex = m, we.test(e)) {
|
|
658
|
+
if (w + u > C && (v = Math.min(v, m)), w + u > i) {
|
|
659
|
+
y = !0;
|
|
883
660
|
break;
|
|
884
661
|
}
|
|
885
|
-
|
|
662
|
+
w += u, A = $, b = m, m = $ = we.lastIndex;
|
|
886
663
|
continue;
|
|
887
664
|
}
|
|
888
|
-
if (
|
|
889
|
-
if (
|
|
890
|
-
|
|
665
|
+
if (re.lastIndex = m, re.test(e)) {
|
|
666
|
+
if (F = re.lastIndex - m, S = F * l, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S > i) {
|
|
667
|
+
y = !0;
|
|
891
668
|
break;
|
|
892
669
|
}
|
|
893
|
-
|
|
670
|
+
w += S, A = $, b = m, m = $ = re.lastIndex;
|
|
894
671
|
continue;
|
|
895
672
|
}
|
|
896
|
-
if (
|
|
897
|
-
if (
|
|
898
|
-
|
|
673
|
+
if (ie.lastIndex = m, ie.test(e)) {
|
|
674
|
+
if (F = ie.lastIndex - m, S = F * n, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S > i) {
|
|
675
|
+
y = !0;
|
|
899
676
|
break;
|
|
900
677
|
}
|
|
901
|
-
|
|
678
|
+
w += S, A = $, b = m, m = $ = ie.lastIndex;
|
|
902
679
|
continue;
|
|
903
680
|
}
|
|
904
|
-
if (
|
|
905
|
-
if (
|
|
906
|
-
|
|
681
|
+
if (Ae.lastIndex = m, Ae.test(e)) {
|
|
682
|
+
if (w + p > C && (v = Math.min(v, m)), w + p > i) {
|
|
683
|
+
y = !0;
|
|
907
684
|
break;
|
|
908
685
|
}
|
|
909
|
-
|
|
686
|
+
w += p, A = $, b = m, m = $ = Ae.lastIndex;
|
|
910
687
|
continue;
|
|
911
688
|
}
|
|
912
689
|
m += 1;
|
|
913
690
|
}
|
|
914
691
|
return {
|
|
915
|
-
width:
|
|
916
|
-
index:
|
|
917
|
-
truncated:
|
|
918
|
-
ellipsed:
|
|
692
|
+
width: y ? C : w,
|
|
693
|
+
index: y ? v : d,
|
|
694
|
+
truncated: y,
|
|
695
|
+
ellipsed: y && i >= o
|
|
919
696
|
};
|
|
920
|
-
},
|
|
697
|
+
}, Et = {
|
|
921
698
|
limit: Infinity,
|
|
922
699
|
ellipsis: "",
|
|
923
700
|
ellipsisWidth: 0
|
|
924
|
-
},
|
|
925
|
-
if (
|
|
926
|
-
if (
|
|
927
|
-
if (
|
|
928
|
-
if (
|
|
929
|
-
if (
|
|
930
|
-
if (
|
|
931
|
-
if (
|
|
932
|
-
if (
|
|
933
|
-
if (
|
|
934
|
-
},
|
|
701
|
+
}, D$1 = (e, r = {}) => Le(e, Et, r).width, ae = "\x1B", je = "", vt = 39, Ce = "\x07", ke = "[", wt = "]", Ve = "m", Se = `${wt}8;;`, He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y"), At = (e) => {
|
|
702
|
+
if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
|
|
703
|
+
if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
|
|
704
|
+
if (e === 1 || e === 2) return 22;
|
|
705
|
+
if (e === 3) return 23;
|
|
706
|
+
if (e === 4) return 24;
|
|
707
|
+
if (e === 7) return 27;
|
|
708
|
+
if (e === 8) return 28;
|
|
709
|
+
if (e === 9) return 29;
|
|
710
|
+
if (e === 0) return 0;
|
|
711
|
+
}, Ue = (e) => `${ae}${ke}${e}${Ve}`, Ke = (e) => `${ae}${Se}${e}${Ce}`, Ct = (e) => e.map((r) => D$1(r)), Ie = (e, r, s) => {
|
|
935
712
|
const i = r[Symbol.iterator]();
|
|
936
|
-
let a = !1, o = !1, u =
|
|
713
|
+
let a = !1, o = !1, u = e.at(-1), l = u === void 0 ? 0 : D$1(u), n = i.next(), c = i.next(), p = 0;
|
|
937
714
|
for (; !n.done;) {
|
|
938
|
-
const
|
|
939
|
-
l +
|
|
715
|
+
const f = n.value, g = D$1(f);
|
|
716
|
+
l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = !0, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = !1, o = !1) : f === Ve && (a = !1) : (l += g, l === s && !c.done && (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
|
|
940
717
|
}
|
|
941
|
-
u =
|
|
942
|
-
},
|
|
943
|
-
const r =
|
|
718
|
+
u = e.at(-1), !l && u !== void 0 && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
719
|
+
}, St = (e) => {
|
|
720
|
+
const r = e.split(" ");
|
|
944
721
|
let s = r.length;
|
|
945
|
-
for (; s > 0 && !(
|
|
946
|
-
return s === r.length ?
|
|
947
|
-
},
|
|
948
|
-
if (s.trim !== !1 &&
|
|
722
|
+
for (; s > 0 && !(D$1(r[s - 1]) > 0);) s--;
|
|
723
|
+
return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
724
|
+
}, It = (e, r, s = {}) => {
|
|
725
|
+
if (s.trim !== !1 && e.trim() === "") return "";
|
|
949
726
|
let i = "", a, o;
|
|
950
|
-
const u =
|
|
727
|
+
const u = e.split(" "), l = Ct(u);
|
|
951
728
|
let n = [""];
|
|
952
729
|
for (const [$, m] of u.entries()) {
|
|
953
730
|
s.trim !== !1 && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
954
|
-
let
|
|
955
|
-
if ($ !== 0 && (
|
|
956
|
-
const
|
|
957
|
-
Math.floor((l[$] - 1) / r) <
|
|
731
|
+
let d = D$1(n.at(-1) ?? "");
|
|
732
|
+
if ($ !== 0 && (d >= r && (s.wordWrap === !1 || s.trim === !1) && (n.push(""), d = 0), (d > 0 || s.trim === !1) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
|
|
733
|
+
const F = r - d, y = 1 + Math.floor((l[$] - F - 1) / r);
|
|
734
|
+
Math.floor((l[$] - 1) / r) < y && n.push(""), Ie(n, m, r);
|
|
958
735
|
continue;
|
|
959
736
|
}
|
|
960
|
-
if (
|
|
961
|
-
if (s.wordWrap === !1 &&
|
|
962
|
-
|
|
737
|
+
if (d + l[$] > r && d > 0 && l[$] > 0) {
|
|
738
|
+
if (s.wordWrap === !1 && d < r) {
|
|
739
|
+
Ie(n, m, r);
|
|
963
740
|
continue;
|
|
964
741
|
}
|
|
965
742
|
n.push("");
|
|
966
743
|
}
|
|
967
|
-
if (
|
|
968
|
-
|
|
744
|
+
if (d + l[$] > r && s.wordWrap === !1) {
|
|
745
|
+
Ie(n, m, r);
|
|
969
746
|
continue;
|
|
970
747
|
}
|
|
971
748
|
n[n.length - 1] += m;
|
|
972
749
|
}
|
|
973
|
-
s.trim !== !1 && (n = n.map(($) =>
|
|
750
|
+
s.trim !== !1 && (n = n.map(($) => St($)));
|
|
974
751
|
const c = n.join(`
|
|
975
|
-
`),
|
|
976
|
-
let
|
|
977
|
-
for (; !
|
|
978
|
-
const $ =
|
|
979
|
-
if (i += $, $ ===
|
|
980
|
-
|
|
981
|
-
const
|
|
982
|
-
if (
|
|
983
|
-
const v = Number.parseFloat(
|
|
984
|
-
a = v ===
|
|
985
|
-
} else
|
|
986
|
-
}
|
|
987
|
-
const
|
|
752
|
+
`), p = c[Symbol.iterator]();
|
|
753
|
+
let f = p.next(), g = p.next(), E = 0;
|
|
754
|
+
for (; !f.done;) {
|
|
755
|
+
const $ = f.value, m = g.value;
|
|
756
|
+
if (i += $, $ === ae || $ === je) {
|
|
757
|
+
He.lastIndex = E + 1;
|
|
758
|
+
const y = He.exec(c)?.groups;
|
|
759
|
+
if (y?.code !== void 0) {
|
|
760
|
+
const v = Number.parseFloat(y.code);
|
|
761
|
+
a = v === vt ? void 0 : v;
|
|
762
|
+
} else y?.uri !== void 0 && (o = y.uri.length === 0 ? void 0 : y.uri);
|
|
763
|
+
}
|
|
764
|
+
const d = a ? At(a) : void 0;
|
|
988
765
|
m === `
|
|
989
|
-
` ? (o && (i +=
|
|
990
|
-
` && (a &&
|
|
766
|
+
` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
|
|
767
|
+
` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
|
|
991
768
|
}
|
|
992
769
|
return i;
|
|
993
770
|
};
|
|
994
|
-
function J(
|
|
995
|
-
return String(
|
|
771
|
+
function J(e, r, s) {
|
|
772
|
+
return String(e).normalize().replaceAll(`\r
|
|
996
773
|
`, `
|
|
997
774
|
`).split(`
|
|
998
|
-
`).map((i) =>
|
|
775
|
+
`).map((i) => It(i, r, s)).join(`
|
|
999
776
|
`);
|
|
1000
777
|
}
|
|
1001
|
-
const
|
|
778
|
+
const bt = (e, r, s, i, a) => {
|
|
1002
779
|
let o = r, u = 0;
|
|
1003
780
|
for (let l = s; l < i; l++) {
|
|
1004
|
-
const n =
|
|
781
|
+
const n = e[l];
|
|
1005
782
|
if (o = o - n.length, u++, o <= a) break;
|
|
1006
783
|
}
|
|
1007
784
|
return {
|
|
1008
785
|
lineCount: o,
|
|
1009
786
|
removals: u
|
|
1010
787
|
};
|
|
1011
|
-
}, X = (
|
|
1012
|
-
const
|
|
1013
|
-
let
|
|
1014
|
-
|
|
1015
|
-
let
|
|
1016
|
-
const
|
|
1017
|
-
let
|
|
1018
|
-
|
|
1019
|
-
const
|
|
1020
|
-
for (let A =
|
|
1021
|
-
const
|
|
788
|
+
}, X = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = Number.POSITIVE_INFINITY, columnPadding: o = 0, rowPadding: u = 4 }) => {
|
|
789
|
+
const l = rt(i) - o, n = nt(i), c = styleText("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
|
|
790
|
+
let g = 0;
|
|
791
|
+
e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
|
|
792
|
+
let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
|
|
793
|
+
const m = Math.min(g + f, r.length), d = [];
|
|
794
|
+
let F = 0;
|
|
795
|
+
E && F++, $ && F++;
|
|
796
|
+
const y = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
|
|
797
|
+
for (let A = y; A < v; A++) {
|
|
798
|
+
const b = J(s(r[A], A === e), l, {
|
|
1022
799
|
hard: !0,
|
|
1023
800
|
trim: !1
|
|
1024
801
|
}).split(`
|
|
1025
802
|
`);
|
|
1026
|
-
|
|
803
|
+
d.push(b), F += b.length;
|
|
1027
804
|
}
|
|
1028
|
-
if (
|
|
1029
|
-
let A = 0,
|
|
1030
|
-
const
|
|
1031
|
-
|
|
805
|
+
if (F > p) {
|
|
806
|
+
let A = 0, b = 0, w = F;
|
|
807
|
+
const S = e - y, T = (M, O) => bt(d, w, M, O, p);
|
|
808
|
+
E ? ({lineCount: w, removals: A} = T(0, S), w > p && ({lineCount: w, removals: b} = T(S + 1, d.length))) : ({lineCount: w, removals: b} = T(S + 1, d.length), w > p && ({lineCount: w, removals: A} = T(0, S))), A > 0 && (E = !0, d.splice(0, A)), b > 0 && ($ = !0, d.splice(d.length - b, b));
|
|
1032
809
|
}
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1035
|
-
for (const A of
|
|
1036
|
-
return
|
|
810
|
+
const C = [];
|
|
811
|
+
E && C.push(c);
|
|
812
|
+
for (const A of d) for (const b of A) C.push(b);
|
|
813
|
+
return $ && C.push(c), C;
|
|
1037
814
|
};
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
}
|
|
1041
|
-
function Jt(t, r) {
|
|
1042
|
-
if (!t) return !0;
|
|
1043
|
-
const s = (r.label ?? String(r.value ?? "")).toLowerCase(), i = (r.hint ?? "").toLowerCase(), a = String(r.value).toLowerCase(), o = t.toLowerCase();
|
|
1044
|
-
return s.includes(o) || i.includes(o) || a.includes(o);
|
|
1045
|
-
}
|
|
1046
|
-
function Be(t, r) {
|
|
1047
|
-
const s = [];
|
|
1048
|
-
for (const i of r) t.includes(i.value) && s.push(i);
|
|
1049
|
-
return s;
|
|
1050
|
-
}
|
|
1051
|
-
const Xt = (t) => new Vt$1({
|
|
1052
|
-
options: t.options,
|
|
1053
|
-
initialValue: t.initialValue ? [t.initialValue] : void 0,
|
|
1054
|
-
initialUserInput: t.initialUserInput,
|
|
1055
|
-
filter: t.filter ?? ((r, s) => Jt(r, s)),
|
|
1056
|
-
signal: t.signal,
|
|
1057
|
-
input: t.input,
|
|
1058
|
-
output: t.output,
|
|
1059
|
-
validate: t.validate,
|
|
1060
|
-
render() {
|
|
1061
|
-
const r = t.withGuide ?? _$1.withGuide, s = r ? [`${import_picocolors.default.gray(d$1)}`, `${W$1(this.state)} ${t.message}`] : [`${W$1(this.state)} ${t.message}`], i = this.userInput, a = this.options, o = t.placeholder, u = i === "" && o !== void 0, l = (n, c) => {
|
|
1062
|
-
const g = qt(n), F = n.hint && n.value === this.focusedValue ? import_picocolors.default.dim(` (${n.hint})`) : "";
|
|
1063
|
-
switch (c) {
|
|
1064
|
-
case "active": return `${import_picocolors.default.green(Q)} ${g}${F}`;
|
|
1065
|
-
case "inactive": return `${import_picocolors.default.dim(H$1)} ${import_picocolors.default.dim(g)}`;
|
|
1066
|
-
case "disabled": return `${import_picocolors.default.gray(H$1)} ${import_picocolors.default.strikethrough(import_picocolors.default.gray(g))}`;
|
|
1067
|
-
}
|
|
1068
|
-
};
|
|
1069
|
-
switch (this.state) {
|
|
1070
|
-
case "submit": {
|
|
1071
|
-
const n = Be(this.selectedValues, a), c = n.length > 0 ? ` ${import_picocolors.default.dim(n.map(qt).join(", "))}` : "", g = r ? import_picocolors.default.gray(d$1) : "";
|
|
1072
|
-
return `${s.join(`
|
|
1073
|
-
`)}
|
|
1074
|
-
${g}${c}`;
|
|
1075
|
-
}
|
|
1076
|
-
case "cancel": {
|
|
1077
|
-
const n = i ? ` ${import_picocolors.default.strikethrough(import_picocolors.default.dim(i))}` : "", c = r ? import_picocolors.default.gray(d$1) : "";
|
|
1078
|
-
return `${s.join(`
|
|
1079
|
-
`)}
|
|
1080
|
-
${c}${n}`;
|
|
1081
|
-
}
|
|
1082
|
-
default: {
|
|
1083
|
-
const n = this.state === "error" ? import_picocolors.default.yellow : import_picocolors.default.cyan, c = r ? `${n(d$1)} ` : "", g = r ? n(x$1) : "";
|
|
1084
|
-
let F = "";
|
|
1085
|
-
if (this.isNavigating || u) {
|
|
1086
|
-
const f = u ? o : i;
|
|
1087
|
-
F = f !== "" ? ` ${import_picocolors.default.dim(f)}` : "";
|
|
1088
|
-
} else F = ` ${this.userInputWithCursor}`;
|
|
1089
|
-
const p = this.filteredOptions.length !== a.length ? import_picocolors.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", E = this.filteredOptions.length === 0 && i ? [`${c}${import_picocolors.default.yellow("No matches found")}`] : [], $ = this.state === "error" ? [`${c}${import_picocolors.default.yellow(this.error)}`] : [];
|
|
1090
|
-
r && s.push(`${c.trimEnd()}`), s.push(`${c}${import_picocolors.default.dim("Search:")}${F}${p}`, ...E, ...$);
|
|
1091
|
-
const h = [`${c}${[
|
|
1092
|
-
`${import_picocolors.default.dim("↑/↓")} to select`,
|
|
1093
|
-
`${import_picocolors.default.dim("Enter:")} confirm`,
|
|
1094
|
-
`${import_picocolors.default.dim("Type:")} to search`
|
|
1095
|
-
].join(" • ")}`, g], y = this.filteredOptions.length === 0 ? [] : X({
|
|
1096
|
-
cursor: this.cursor,
|
|
1097
|
-
options: this.filteredOptions,
|
|
1098
|
-
columnPadding: r ? 3 : 0,
|
|
1099
|
-
rowPadding: s.length + h.length,
|
|
1100
|
-
style: (f, v) => l(f, f.disabled ? "disabled" : v ? "active" : "inactive"),
|
|
1101
|
-
maxItems: t.maxItems,
|
|
1102
|
-
output: t.output
|
|
1103
|
-
});
|
|
1104
|
-
return [
|
|
1105
|
-
...s,
|
|
1106
|
-
...y.map((f) => `${c}${f}`),
|
|
1107
|
-
...h
|
|
1108
|
-
].join(`
|
|
1109
|
-
`);
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
}).prompt(), xe = (t) => {
|
|
1114
|
-
const r = (i, a, o, u) => {
|
|
1115
|
-
const l = o.includes(i.value), n = i.label ?? String(i.value ?? ""), c = i.hint && u !== void 0 && i.value === u ? import_picocolors.default.dim(` (${i.hint})`) : "", g = l ? import_picocolors.default.green(U$1) : import_picocolors.default.dim(q$1);
|
|
1116
|
-
return i.disabled ? `${import_picocolors.default.gray(q$1)} ${import_picocolors.default.strikethrough(import_picocolors.default.gray(n))}` : a ? `${g} ${n}${c}` : `${g} ${import_picocolors.default.dim(n)}`;
|
|
1117
|
-
}, s = new Vt$1({
|
|
1118
|
-
options: t.options,
|
|
1119
|
-
multiple: !0,
|
|
1120
|
-
filter: t.filter ?? ((i, a) => Jt(i, a)),
|
|
1121
|
-
validate: () => {
|
|
1122
|
-
if (t.required && s.selectedValues.length === 0) return "Please select at least one item";
|
|
1123
|
-
},
|
|
1124
|
-
initialValue: t.initialValues,
|
|
1125
|
-
signal: t.signal,
|
|
1126
|
-
input: t.input,
|
|
1127
|
-
output: t.output,
|
|
1128
|
-
render() {
|
|
1129
|
-
const i = `${import_picocolors.default.gray(d$1)}
|
|
1130
|
-
${W$1(this.state)} ${t.message}
|
|
1131
|
-
`, a = this.userInput, o = t.placeholder, u = a === "" && o !== void 0, l = this.isNavigating || u ? import_picocolors.default.dim(u ? o : a) : this.userInputWithCursor, n = this.options, c = this.filteredOptions.length !== n.length ? import_picocolors.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
|
|
1132
|
-
switch (this.state) {
|
|
1133
|
-
case "submit": return `${i}${import_picocolors.default.gray(d$1)} ${import_picocolors.default.dim(`${this.selectedValues.length} items selected`)}`;
|
|
1134
|
-
case "cancel": return `${i}${import_picocolors.default.gray(d$1)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(a))}`;
|
|
1135
|
-
default: {
|
|
1136
|
-
const g = this.state === "error" ? import_picocolors.default.yellow : import_picocolors.default.cyan, F = [
|
|
1137
|
-
`${import_picocolors.default.dim("↑/↓")} to navigate`,
|
|
1138
|
-
`${import_picocolors.default.dim(this.isNavigating ? "Space/Tab:" : "Tab:")} select`,
|
|
1139
|
-
`${import_picocolors.default.dim("Enter:")} confirm`,
|
|
1140
|
-
`${import_picocolors.default.dim("Type:")} to search`
|
|
1141
|
-
], p = this.filteredOptions.length === 0 && a ? [`${g(d$1)} ${import_picocolors.default.yellow("No matches found")}`] : [], E = this.state === "error" ? [`${g(d$1)} ${import_picocolors.default.yellow(this.error)}`] : [], $ = [
|
|
1142
|
-
...`${i}${g(d$1)}`.split(`
|
|
1143
|
-
`),
|
|
1144
|
-
`${g(d$1)} ${import_picocolors.default.dim("Search:")} ${l}${c}`,
|
|
1145
|
-
...p,
|
|
1146
|
-
...E
|
|
1147
|
-
], m = [`${g(d$1)} ${F.join(" • ")}`, `${g(x$1)}`], h = X({
|
|
1148
|
-
cursor: this.cursor,
|
|
1149
|
-
options: this.filteredOptions,
|
|
1150
|
-
style: (y, f) => r(y, f, this.selectedValues, this.focusedValue),
|
|
1151
|
-
maxItems: t.maxItems,
|
|
1152
|
-
output: t.output,
|
|
1153
|
-
rowPadding: $.length + m.length
|
|
1154
|
-
});
|
|
1155
|
-
return [
|
|
1156
|
-
...$,
|
|
1157
|
-
...h.map((y) => `${g(d$1)} ${y}`),
|
|
1158
|
-
...m
|
|
1159
|
-
].join(`
|
|
1160
|
-
`);
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
});
|
|
1165
|
-
return s.prompt();
|
|
1166
|
-
}, _e = [
|
|
1167
|
-
Lt,
|
|
1168
|
-
mt,
|
|
1169
|
-
gt,
|
|
1170
|
-
pt
|
|
1171
|
-
], De = [
|
|
1172
|
-
ht,
|
|
1173
|
-
Ot,
|
|
1174
|
-
x$1,
|
|
1175
|
-
Pt
|
|
1176
|
-
];
|
|
1177
|
-
function Yt(t, r, s, i) {
|
|
1178
|
-
let a = s, o = s;
|
|
1179
|
-
return i === "center" ? a = Math.floor((r - t) / 2) : i === "right" && (a = r - t - s), o = r - a - t, [a, o];
|
|
1180
|
-
}
|
|
1181
|
-
const Te = (t) => t, Me = (t = "", r = "", s) => {
|
|
1182
|
-
const i = s?.output ?? process.stdout, a = rt$1(i), o = 2, u = s?.titlePadding ?? 1, l = s?.contentPadding ?? 2, n = s?.width === void 0 || s.width === "auto" ? 1 : Math.min(1, s.width), c = s?.withGuide ?? _$1.withGuide ? `${d$1} ` : "", g = s?.formatBorder ?? Te, F = (s?.rounded ? _e : De).map(g), p = g(rt), E = g(d$1), $ = M$1(c), m = M$1(r), h = a - $;
|
|
1183
|
-
let y = Math.floor(a * n) - $;
|
|
1184
|
-
if (s?.width === "auto") {
|
|
1185
|
-
const _ = t.split(`
|
|
1186
|
-
`);
|
|
1187
|
-
let D = m + u * 2;
|
|
1188
|
-
for (const Y of _) {
|
|
1189
|
-
const L = M$1(Y) + l * 2;
|
|
1190
|
-
L > D && (D = L);
|
|
1191
|
-
}
|
|
1192
|
-
const T = D + o;
|
|
1193
|
-
T < y && (y = T);
|
|
1194
|
-
}
|
|
1195
|
-
y % 2 !== 0 && (y < h ? y++ : y--);
|
|
1196
|
-
const f = y - o, v = f - u * 2, S = m > v ? `${r.slice(0, v - 3)}...` : r, [I, B] = Yt(M$1(S), f, u, s?.titleAlign), A = J(t, f - l * 2, {
|
|
1197
|
-
hard: !0,
|
|
1198
|
-
trim: !1
|
|
1199
|
-
});
|
|
1200
|
-
i.write(`${c}${F[0]}${p.repeat(I)}${S}${p.repeat(B)}${F[1]}
|
|
1201
|
-
`);
|
|
1202
|
-
const w = A.split(`
|
|
1203
|
-
`);
|
|
1204
|
-
for (const _ of w) {
|
|
1205
|
-
const [D, T] = Yt(M$1(_), f, l, s?.contentAlign);
|
|
1206
|
-
i.write(`${c}${E}${" ".repeat(D)}${_}${" ".repeat(T)}${E}
|
|
1207
|
-
`);
|
|
1208
|
-
}
|
|
1209
|
-
i.write(`${c}${F[2]}${p.repeat(f)}${F[3]}
|
|
1210
|
-
`);
|
|
1211
|
-
}, Re = (t) => {
|
|
1212
|
-
const r = t.active ?? "Yes", s = t.inactive ?? "No";
|
|
815
|
+
const Rt = (e) => {
|
|
816
|
+
const r = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
1213
817
|
return new kt$1({
|
|
1214
818
|
active: r,
|
|
1215
819
|
inactive: s,
|
|
1216
|
-
signal:
|
|
1217
|
-
input:
|
|
1218
|
-
output:
|
|
1219
|
-
initialValue:
|
|
820
|
+
signal: e.signal,
|
|
821
|
+
input: e.input,
|
|
822
|
+
output: e.output,
|
|
823
|
+
initialValue: e.initialValue ?? !0,
|
|
1220
824
|
render() {
|
|
1221
|
-
const i =
|
|
1222
|
-
` : ""}${W
|
|
825
|
+
const i = e.withGuide ?? _$1.withGuide, a = `${i ? `${styleText("gray", h$1)}
|
|
826
|
+
` : ""}${W(this.state)} ${e.message}
|
|
1223
827
|
`, o = this.value ? r : s;
|
|
1224
828
|
switch (this.state) {
|
|
1225
|
-
case "submit": return `${a}${i ? `${
|
|
1226
|
-
case "cancel": return `${a}${i ? `${
|
|
1227
|
-
${
|
|
829
|
+
case "submit": return `${a}${i ? `${styleText("gray", h$1)} ` : ""}${styleText("dim", o)}`;
|
|
830
|
+
case "cancel": return `${a}${i ? `${styleText("gray", h$1)} ` : ""}${styleText(["strikethrough", "dim"], o)}${i ? `
|
|
831
|
+
${styleText("gray", h$1)}` : ""}`;
|
|
1228
832
|
default: {
|
|
1229
|
-
const u = i ? `${
|
|
1230
|
-
return `${a}${u}${this.value ? `${
|
|
1231
|
-
${
|
|
1232
|
-
` : ` ${
|
|
833
|
+
const u = i ? `${styleText("cyan", h$1)} ` : "", l = i ? styleText("cyan", x$1) : "";
|
|
834
|
+
return `${a}${u}${this.value ? `${styleText("green", z$1)} ${r}` : `${styleText("dim", H)} ${styleText("dim", r)}`}${e.vertical ? i ? `
|
|
835
|
+
${styleText("cyan", h$1)} ` : `
|
|
836
|
+
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", H)} ${styleText("dim", s)}` : `${styleText("green", z$1)} ${s}`}
|
|
1233
837
|
${l}
|
|
1234
838
|
`;
|
|
1235
839
|
}
|
|
1236
840
|
}
|
|
1237
841
|
}
|
|
1238
842
|
}).prompt();
|
|
1239
|
-
},
|
|
1240
|
-
const s =
|
|
1241
|
-
|
|
1242
|
-
const o = t[a], u = await o({ results: s })?.catch((l) => {
|
|
1243
|
-
throw l;
|
|
1244
|
-
});
|
|
1245
|
-
if (typeof r?.onCancel == "function" && Ct$1(u)) {
|
|
1246
|
-
s[a] = "canceled", r.onCancel({ results: s });
|
|
1247
|
-
continue;
|
|
1248
|
-
}
|
|
1249
|
-
s[a] = u;
|
|
1250
|
-
}
|
|
1251
|
-
return s;
|
|
1252
|
-
}, Pe = (t) => {
|
|
1253
|
-
const { selectableGroups: r = !0, groupSpacing: s = 0 } = t, i = (o, u, l = []) => {
|
|
1254
|
-
const n = o.label ?? String(o.value), c = typeof o.group == "string", g = c && (l[l.indexOf(o) + 1] ?? { group: !0 }), F = c && g && g.group === !0, p = c ? r ? `${F ? x$1 : d$1} ` : " " : "";
|
|
843
|
+
}, Pt = (e) => {
|
|
844
|
+
const { selectableGroups: r = !0, groupSpacing: s = 0 } = e, i = (o, u, l = []) => {
|
|
845
|
+
const n = o.label ?? String(o.value), c = typeof o.group == "string", p = c && (l[l.indexOf(o) + 1] ?? { group: !0 }), f = c && p && p.group === !0, g = c ? r ? `${f ? x$1 : h$1} ` : " " : "";
|
|
1255
846
|
let E = "";
|
|
1256
847
|
if (s > 0 && !c) {
|
|
1257
848
|
const m = `
|
|
1258
|
-
${
|
|
849
|
+
${styleText("cyan", h$1)}`;
|
|
1259
850
|
E = `${m.repeat(s - 1)}${m} `;
|
|
1260
851
|
}
|
|
1261
|
-
if (u === "active") return `${E}${
|
|
1262
|
-
if (u === "group-active") return `${E}${
|
|
1263
|
-
if (u === "group-active-selected") return `${E}${
|
|
852
|
+
if (u === "active") return `${E}${styleText("dim", g)}${styleText("cyan", te)} ${n}${o.hint ? ` ${styleText("dim", `(${o.hint})`)}` : ""}`;
|
|
853
|
+
if (u === "group-active") return `${E}${g}${styleText("cyan", te)} ${styleText("dim", n)}`;
|
|
854
|
+
if (u === "group-active-selected") return `${E}${g}${styleText("green", U)} ${styleText("dim", n)}`;
|
|
1264
855
|
if (u === "selected") {
|
|
1265
|
-
const m = c || r ?
|
|
1266
|
-
return `${E}${
|
|
1267
|
-
}
|
|
1268
|
-
if (u === "cancelled") return `${
|
|
1269
|
-
if (u === "active-selected") return `${E}${
|
|
1270
|
-
if (u === "submitted") return `${
|
|
1271
|
-
const $ = c || r ?
|
|
1272
|
-
return `${E}${
|
|
1273
|
-
}, a =
|
|
856
|
+
const m = c || r ? styleText("green", U) : "";
|
|
857
|
+
return `${E}${styleText("dim", g)}${m} ${styleText("dim", n)}${o.hint ? ` ${styleText("dim", `(${o.hint})`)}` : ""}`;
|
|
858
|
+
}
|
|
859
|
+
if (u === "cancelled") return `${styleText(["strikethrough", "dim"], n)}`;
|
|
860
|
+
if (u === "active-selected") return `${E}${styleText("dim", g)}${styleText("green", U)} ${n}${o.hint ? ` ${styleText("dim", `(${o.hint})`)}` : ""}`;
|
|
861
|
+
if (u === "submitted") return `${styleText("dim", n)}`;
|
|
862
|
+
const $ = c || r ? styleText("dim", q) : "";
|
|
863
|
+
return `${E}${styleText("dim", g)}${$} ${styleText("dim", n)}`;
|
|
864
|
+
}, a = e.required ?? !0;
|
|
1274
865
|
return new yt$1({
|
|
1275
|
-
options:
|
|
1276
|
-
signal:
|
|
1277
|
-
input:
|
|
1278
|
-
output:
|
|
1279
|
-
initialValues:
|
|
866
|
+
options: e.options,
|
|
867
|
+
signal: e.signal,
|
|
868
|
+
input: e.input,
|
|
869
|
+
output: e.output,
|
|
870
|
+
initialValues: e.initialValues,
|
|
1280
871
|
required: a,
|
|
1281
|
-
cursorAt:
|
|
872
|
+
cursorAt: e.cursorAt,
|
|
1282
873
|
selectableGroups: r,
|
|
1283
874
|
validate(o) {
|
|
1284
875
|
if (a && (o === void 0 || o.length === 0)) return `Please select at least one option.
|
|
1285
|
-
${
|
|
876
|
+
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
877
|
+
"gray",
|
|
878
|
+
"bgWhite",
|
|
879
|
+
"inverse"
|
|
880
|
+
], " space ")} to select, ${styleText("gray", styleText(["bgWhite", "inverse"], " enter "))} to submit`))}`;
|
|
1286
881
|
},
|
|
1287
882
|
render() {
|
|
1288
|
-
const o = `${
|
|
1289
|
-
${W
|
|
883
|
+
const o = `${styleText("gray", h$1)}
|
|
884
|
+
${W(this.state)} ${e.message}
|
|
1290
885
|
`, u = this.value ?? [];
|
|
1291
886
|
switch (this.state) {
|
|
1292
887
|
case "submit": {
|
|
1293
|
-
const l = this.options.filter(({ value: c }) => u.includes(c)).map((c) => i(c, "submitted")), n = l.length === 0 ? "" : ` ${l.join(
|
|
1294
|
-
return `${o}${
|
|
888
|
+
const l = this.options.filter(({ value: c }) => u.includes(c)).map((c) => i(c, "submitted")), n = l.length === 0 ? "" : ` ${l.join(styleText("dim", ", "))}`;
|
|
889
|
+
return `${o}${styleText("gray", h$1)}${n}`;
|
|
1295
890
|
}
|
|
1296
891
|
case "cancel": {
|
|
1297
|
-
const l = this.options.filter(({ value: n }) => u.includes(n)).map((n) => i(n, "cancelled")).join(
|
|
1298
|
-
return `${o}${
|
|
1299
|
-
${
|
|
892
|
+
const l = this.options.filter(({ value: n }) => u.includes(n)).map((n) => i(n, "cancelled")).join(styleText("dim", ", "));
|
|
893
|
+
return `${o}${styleText("gray", h$1)} ${l.trim() ? `${l}
|
|
894
|
+
${styleText("gray", h$1)}` : ""}`;
|
|
1300
895
|
}
|
|
1301
896
|
case "error": {
|
|
1302
897
|
const l = this.error.split(`
|
|
1303
|
-
`).map((n, c) => c === 0 ? `${
|
|
898
|
+
`).map((n, c) => c === 0 ? `${styleText("yellow", x$1)} ${styleText("yellow", n)}` : ` ${n}`).join(`
|
|
1304
899
|
`);
|
|
1305
|
-
return `${o}${
|
|
1306
|
-
const
|
|
1307
|
-
return !
|
|
900
|
+
return `${o}${styleText("yellow", h$1)} ${this.options.map((n, c, p) => {
|
|
901
|
+
const f = u.includes(n.value) || n.group === !0 && this.isGroupSelected(`${n.value}`), g = c === this.cursor;
|
|
902
|
+
return !g && typeof n.group == "string" && this.options[this.cursor].value === n.group ? i(n, f ? "group-active-selected" : "group-active", p) : g && f ? i(n, "active-selected", p) : f ? i(n, "selected", p) : i(n, g ? "active" : "inactive", p);
|
|
1308
903
|
}).join(`
|
|
1309
|
-
${
|
|
904
|
+
${styleText("yellow", h$1)} `)}
|
|
1310
905
|
${l}
|
|
1311
906
|
`;
|
|
1312
907
|
}
|
|
1313
908
|
default: {
|
|
1314
|
-
const l = this.options.map((c,
|
|
1315
|
-
const
|
|
909
|
+
const l = this.options.map((c, p, f) => {
|
|
910
|
+
const g = u.includes(c.value) || c.group === !0 && this.isGroupSelected(`${c.value}`), E = p === this.cursor, $ = !E && typeof c.group == "string" && this.options[this.cursor].value === c.group;
|
|
1316
911
|
let m = "";
|
|
1317
|
-
return $ ? m = i(c,
|
|
912
|
+
return $ ? m = i(c, g ? "group-active-selected" : "group-active", f) : E && g ? m = i(c, "active-selected", f) : g ? m = i(c, "selected", f) : m = i(c, E ? "active" : "inactive", f), `${p !== 0 && !m.startsWith(`
|
|
1318
913
|
`) ? " " : ""}${m}`;
|
|
1319
914
|
}).join(`
|
|
1320
|
-
${
|
|
915
|
+
${styleText("cyan", h$1)}`), n = l.startsWith(`
|
|
1321
916
|
`) ? "" : " ";
|
|
1322
|
-
return `${o}${
|
|
1323
|
-
${
|
|
917
|
+
return `${o}${styleText("cyan", h$1)}${n}${l}
|
|
918
|
+
${styleText("cyan", x$1)}
|
|
1324
919
|
`;
|
|
1325
920
|
}
|
|
1326
921
|
}
|
|
1327
922
|
}
|
|
1328
923
|
}).prompt();
|
|
1329
924
|
}, R$1 = {
|
|
1330
|
-
message: (
|
|
1331
|
-
const u = [], l = o ?? _$1.withGuide, n = l ? s : "", c = l ? `${r} ` : "",
|
|
1332
|
-
for (let
|
|
1333
|
-
const
|
|
925
|
+
message: (e = [], { symbol: r = styleText("gray", h$1), secondarySymbol: s = styleText("gray", h$1), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
|
|
926
|
+
const u = [], l = o ?? _$1.withGuide, n = l ? s : "", c = l ? `${r} ` : "", p = l ? `${s} ` : "";
|
|
927
|
+
for (let g = 0; g < a; g++) u.push(n);
|
|
928
|
+
const f = Array.isArray(e) ? e : e.split(`
|
|
1334
929
|
`);
|
|
1335
|
-
if (
|
|
1336
|
-
const [
|
|
1337
|
-
|
|
1338
|
-
for (const $ of E) $.length > 0 ? u.push(`${
|
|
930
|
+
if (f.length > 0) {
|
|
931
|
+
const [g, ...E] = f;
|
|
932
|
+
g.length > 0 ? u.push(`${c}${g}`) : u.push(l ? r : "");
|
|
933
|
+
for (const $ of E) $.length > 0 ? u.push(`${p}${$}`) : u.push(l ? s : "");
|
|
1339
934
|
}
|
|
1340
935
|
i.write(`${u.join(`
|
|
1341
936
|
`)}
|
|
1342
937
|
`);
|
|
1343
938
|
},
|
|
1344
|
-
info: (
|
|
1345
|
-
R$1.message(
|
|
939
|
+
info: (e, r) => {
|
|
940
|
+
R$1.message(e, {
|
|
1346
941
|
...r,
|
|
1347
|
-
symbol:
|
|
942
|
+
symbol: styleText("blue", fe)
|
|
1348
943
|
});
|
|
1349
944
|
},
|
|
1350
|
-
success: (
|
|
1351
|
-
R$1.message(
|
|
945
|
+
success: (e, r) => {
|
|
946
|
+
R$1.message(e, {
|
|
1352
947
|
...r,
|
|
1353
|
-
symbol:
|
|
948
|
+
symbol: styleText("green", Fe)
|
|
1354
949
|
});
|
|
1355
950
|
},
|
|
1356
|
-
step: (
|
|
1357
|
-
R$1.message(
|
|
951
|
+
step: (e, r) => {
|
|
952
|
+
R$1.message(e, {
|
|
1358
953
|
...r,
|
|
1359
|
-
symbol:
|
|
954
|
+
symbol: styleText("green", V)
|
|
1360
955
|
});
|
|
1361
956
|
},
|
|
1362
|
-
warn: (
|
|
1363
|
-
R$1.message(
|
|
957
|
+
warn: (e, r) => {
|
|
958
|
+
R$1.message(e, {
|
|
1364
959
|
...r,
|
|
1365
|
-
symbol:
|
|
960
|
+
symbol: styleText("yellow", ye)
|
|
1366
961
|
});
|
|
1367
962
|
},
|
|
1368
|
-
warning: (
|
|
1369
|
-
R$1.warn(
|
|
963
|
+
warning: (e, r) => {
|
|
964
|
+
R$1.warn(e, r);
|
|
1370
965
|
},
|
|
1371
|
-
error: (
|
|
1372
|
-
R$1.message(
|
|
966
|
+
error: (e, r) => {
|
|
967
|
+
R$1.message(e, {
|
|
1373
968
|
...r,
|
|
1374
|
-
symbol:
|
|
969
|
+
symbol: styleText("red", Ee)
|
|
1375
970
|
});
|
|
1376
971
|
}
|
|
1377
|
-
},
|
|
1378
|
-
|
|
972
|
+
}, Nt = (e = "", r) => {
|
|
973
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _$1.withGuide ? `${styleText("gray", x$1)} ` : "";
|
|
974
|
+
s.write(`${i}${styleText("red", e)}
|
|
1379
975
|
|
|
1380
976
|
`);
|
|
1381
|
-
},
|
|
1382
|
-
|
|
977
|
+
}, Wt = (e = "", r) => {
|
|
978
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _$1.withGuide ? `${styleText("gray", he)} ` : "";
|
|
979
|
+
s.write(`${i}${e}
|
|
1383
980
|
`);
|
|
1384
|
-
},
|
|
1385
|
-
|
|
1386
|
-
${
|
|
981
|
+
}, Gt = (e = "", r) => {
|
|
982
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _$1.withGuide ? `${styleText("gray", h$1)}
|
|
983
|
+
${styleText("gray", x$1)} ` : "";
|
|
984
|
+
s.write(`${i}${e}
|
|
1387
985
|
|
|
1388
986
|
`);
|
|
1389
|
-
},
|
|
1390
|
-
`).map((s) => r(s)).join(`
|
|
1391
|
-
`), je = (t) => {
|
|
1392
|
-
const r = (i, a) => {
|
|
1393
|
-
const o = i.label ?? String(i.value);
|
|
1394
|
-
return a === "disabled" ? `${import_picocolors.default.gray(q$1)} ${Z(o, (u) => import_picocolors.default.strikethrough(import_picocolors.default.gray(u)))}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${import_picocolors.default.cyan(st)} ${o}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : a === "selected" ? `${import_picocolors.default.green(U$1)} ${Z(o, import_picocolors.default.dim)}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Z(o, (u) => import_picocolors.default.strikethrough(import_picocolors.default.dim(u)))}` : a === "active-selected" ? `${import_picocolors.default.green(U$1)} ${o}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : a === "submitted" ? `${Z(o, import_picocolors.default.dim)}` : `${import_picocolors.default.dim(q$1)} ${Z(o, import_picocolors.default.dim)}`;
|
|
1395
|
-
}, s = t.required ?? !0;
|
|
1396
|
-
return new Lt$1({
|
|
1397
|
-
options: t.options,
|
|
1398
|
-
signal: t.signal,
|
|
1399
|
-
input: t.input,
|
|
1400
|
-
output: t.output,
|
|
1401
|
-
initialValues: t.initialValues,
|
|
1402
|
-
required: s,
|
|
1403
|
-
cursorAt: t.cursorAt,
|
|
1404
|
-
validate(i) {
|
|
1405
|
-
if (s && (i === void 0 || i.length === 0)) return `Please select at least one option.
|
|
1406
|
-
${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
|
|
1407
|
-
},
|
|
1408
|
-
render() {
|
|
1409
|
-
const i = xt(t.output, t.message, `${vt(this.state)} `, `${W$1(this.state)} `), a = `${import_picocolors.default.gray(d$1)}
|
|
1410
|
-
${i}
|
|
1411
|
-
`, o = this.value ?? [], u = (l, n) => {
|
|
1412
|
-
if (l.disabled) return r(l, "disabled");
|
|
1413
|
-
const c = o.includes(l.value);
|
|
1414
|
-
return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
|
|
1415
|
-
};
|
|
1416
|
-
switch (this.state) {
|
|
1417
|
-
case "submit": {
|
|
1418
|
-
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(import_picocolors.default.dim(", ")) || import_picocolors.default.dim("none");
|
|
1419
|
-
return `${a}${xt(t.output, l, `${import_picocolors.default.gray(d$1)} `)}`;
|
|
1420
|
-
}
|
|
1421
|
-
case "cancel": {
|
|
1422
|
-
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(import_picocolors.default.dim(", "));
|
|
1423
|
-
if (l.trim() === "") return `${a}${import_picocolors.default.gray(d$1)}`;
|
|
1424
|
-
return `${a}${xt(t.output, l, `${import_picocolors.default.gray(d$1)} `)}
|
|
1425
|
-
${import_picocolors.default.gray(d$1)}`;
|
|
1426
|
-
}
|
|
1427
|
-
case "error": {
|
|
1428
|
-
const l = `${import_picocolors.default.yellow(d$1)} `, n = this.error.split(`
|
|
1429
|
-
`).map((F, p) => p === 0 ? `${import_picocolors.default.yellow(x$1)} ${import_picocolors.default.yellow(F)}` : ` ${F}`).join(`
|
|
1430
|
-
`), c = a.split(`
|
|
1431
|
-
`).length, g = n.split(`
|
|
1432
|
-
`).length + 1;
|
|
1433
|
-
return `${a}${l}${X({
|
|
1434
|
-
output: t.output,
|
|
1435
|
-
options: this.options,
|
|
1436
|
-
cursor: this.cursor,
|
|
1437
|
-
maxItems: t.maxItems,
|
|
1438
|
-
columnPadding: l.length,
|
|
1439
|
-
rowPadding: c + g,
|
|
1440
|
-
style: u
|
|
1441
|
-
}).join(`
|
|
1442
|
-
${l}`)}
|
|
1443
|
-
${n}
|
|
1444
|
-
`;
|
|
1445
|
-
}
|
|
1446
|
-
default: {
|
|
1447
|
-
const l = `${import_picocolors.default.cyan(d$1)} `, n = a.split(`
|
|
1448
|
-
`).length;
|
|
1449
|
-
return `${a}${l}${X({
|
|
1450
|
-
output: t.output,
|
|
1451
|
-
options: this.options,
|
|
1452
|
-
cursor: this.cursor,
|
|
1453
|
-
maxItems: t.maxItems,
|
|
1454
|
-
columnPadding: l.length,
|
|
1455
|
-
rowPadding: n + 2,
|
|
1456
|
-
style: u
|
|
1457
|
-
}).join(`
|
|
1458
|
-
${l}`)}
|
|
1459
|
-
${import_picocolors.default.cyan(x$1)}
|
|
1460
|
-
`;
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
}).prompt();
|
|
1465
|
-
}, Ge = (t) => import_picocolors.default.dim(t), ke = (t, r, s) => {
|
|
1466
|
-
const i = {
|
|
1467
|
-
hard: !0,
|
|
1468
|
-
trim: !1
|
|
1469
|
-
}, a = J(t, r, i).split(`
|
|
1470
|
-
`), o = a.reduce((n, c) => Math.max(M$1(c), n), 0);
|
|
1471
|
-
return J(t, r - (a.map(s).reduce((n, c) => Math.max(M$1(c), n), 0) - o), i);
|
|
1472
|
-
}, Ve = (t = "", r = "", s) => {
|
|
1473
|
-
const i = s?.output ?? N.stdout, a = s?.withGuide ?? _$1.withGuide, o = s?.format ?? Ge, u = [
|
|
1474
|
-
"",
|
|
1475
|
-
...ke(t, rt$1(i) - 6, o).split(`
|
|
1476
|
-
`).map(o),
|
|
1477
|
-
""
|
|
1478
|
-
], l = M$1(r), n = Math.max(u.reduce((p, E) => {
|
|
1479
|
-
const $ = M$1(E);
|
|
1480
|
-
return $ > p ? $ : p;
|
|
1481
|
-
}, 0), l) + 2, c = u.map((p) => `${import_picocolors.default.gray(d$1)} ${p}${" ".repeat(n - M$1(p))}${import_picocolors.default.gray(d$1)}`).join(`
|
|
1482
|
-
`), g = a ? `${import_picocolors.default.gray(d$1)}
|
|
1483
|
-
` : "", F = a ? Wt : gt;
|
|
1484
|
-
i.write(`${g}${import_picocolors.default.green(V$1)} ${import_picocolors.default.reset(r)} ${import_picocolors.default.gray(rt.repeat(Math.max(n - l - 1, 1)) + mt)}
|
|
1485
|
-
${c}
|
|
1486
|
-
${import_picocolors.default.gray(F + rt.repeat(n + 2) + pt)}
|
|
1487
|
-
`);
|
|
1488
|
-
}, He = (t) => new Mt$1({
|
|
1489
|
-
validate: t.validate,
|
|
1490
|
-
mask: t.mask ?? Nt,
|
|
1491
|
-
signal: t.signal,
|
|
1492
|
-
input: t.input,
|
|
1493
|
-
output: t.output,
|
|
1494
|
-
render() {
|
|
1495
|
-
const r = t.withGuide ?? _$1.withGuide, s = `${r ? `${import_picocolors.default.gray(d$1)}
|
|
1496
|
-
` : ""}${W$1(this.state)} ${t.message}
|
|
1497
|
-
`, i = this.userInputWithCursor, a = this.masked;
|
|
1498
|
-
switch (this.state) {
|
|
1499
|
-
case "error": {
|
|
1500
|
-
const o = r ? `${import_picocolors.default.yellow(d$1)} ` : "", u = r ? `${import_picocolors.default.yellow(x$1)} ` : "", l = a ?? "";
|
|
1501
|
-
return t.clearOnError && this.clear(), `${s.trim()}
|
|
1502
|
-
${o}${l}
|
|
1503
|
-
${u}${import_picocolors.default.yellow(this.error)}
|
|
1504
|
-
`;
|
|
1505
|
-
}
|
|
1506
|
-
case "submit": return `${s}${r ? `${import_picocolors.default.gray(d$1)} ` : ""}${a ? import_picocolors.default.dim(a) : ""}`;
|
|
1507
|
-
case "cancel": return `${s}${r ? `${import_picocolors.default.gray(d$1)} ` : ""}${a ? import_picocolors.default.strikethrough(import_picocolors.default.dim(a)) : ""}${a && r ? `
|
|
1508
|
-
${import_picocolors.default.gray(d$1)}` : ""}`;
|
|
1509
|
-
default: return `${s}${r ? `${import_picocolors.default.cyan(d$1)} ` : ""}${i}
|
|
1510
|
-
${r ? import_picocolors.default.cyan(x$1) : ""}
|
|
1511
|
-
`;
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
}).prompt(), Ue = (t) => {
|
|
1515
|
-
const r = t.validate;
|
|
1516
|
-
return Xt({
|
|
1517
|
-
...t,
|
|
1518
|
-
initialUserInput: t.initialValue ?? t.root ?? process.cwd(),
|
|
1519
|
-
maxItems: 5,
|
|
1520
|
-
validate(s) {
|
|
1521
|
-
if (!Array.isArray(s)) {
|
|
1522
|
-
if (!s) return "Please select a path";
|
|
1523
|
-
if (r) return r(s);
|
|
1524
|
-
}
|
|
1525
|
-
},
|
|
1526
|
-
options() {
|
|
1527
|
-
const s = this.userInput;
|
|
1528
|
-
if (s === "") return [];
|
|
1529
|
-
try {
|
|
1530
|
-
let i;
|
|
1531
|
-
return existsSync(s) ? lstatSync(s).isDirectory() ? i = s : i = dirname(s) : i = dirname(s), readdirSync(i).map((a) => {
|
|
1532
|
-
const o = join(i, a);
|
|
1533
|
-
return {
|
|
1534
|
-
name: a,
|
|
1535
|
-
path: o,
|
|
1536
|
-
isDirectory: lstatSync(o).isDirectory()
|
|
1537
|
-
};
|
|
1538
|
-
}).filter(({ path: a, isDirectory: o }) => a.startsWith(s) && (t.directory || !o)).map((a) => ({ value: a.path }));
|
|
1539
|
-
} catch {
|
|
1540
|
-
return [];
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
});
|
|
1544
|
-
}, Ke = import_picocolors.default.magenta, bt = ({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = et ? [
|
|
987
|
+
}, Kt = (e) => styleText("magenta", e), be = ({ indicator: e = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = ee ? [
|
|
1545
988
|
"◒",
|
|
1546
989
|
"◐",
|
|
1547
990
|
"◓",
|
|
@@ -1551,121 +994,118 @@ ${r ? import_picocolors.default.cyan(x$1) : ""}
|
|
|
1551
994
|
"o",
|
|
1552
995
|
"O",
|
|
1553
996
|
"0"
|
|
1554
|
-
], delay: u =
|
|
1555
|
-
const c =
|
|
1556
|
-
let
|
|
1557
|
-
const
|
|
1558
|
-
const
|
|
1559
|
-
E =
|
|
1560
|
-
},
|
|
1561
|
-
process.on("uncaughtExceptionMonitor",
|
|
1562
|
-
}, A = () => {
|
|
1563
|
-
process.removeListener("uncaughtExceptionMonitor", S), process.removeListener("unhandledRejection", S), process.removeListener("SIGINT", I), process.removeListener("SIGTERM", I), process.removeListener("exit", v), l && l.removeEventListener("abort", I);
|
|
997
|
+
], delay: u = ee ? 80 : 120, signal: l, ...n } = {}) => {
|
|
998
|
+
const c = ce();
|
|
999
|
+
let p, f, g = !1, E = !1, $ = "", m, d = performance.now();
|
|
1000
|
+
const F = rt(s), y = n?.styleFrame ?? Kt, v = (B) => {
|
|
1001
|
+
const P = B > 1 ? a ?? _$1.messages.error : i ?? _$1.messages.cancel;
|
|
1002
|
+
E = B === 1, g && (k(P, B), E && typeof r == "function" && r());
|
|
1003
|
+
}, C = () => v(2), A = () => v(1), b = () => {
|
|
1004
|
+
process.on("uncaughtExceptionMonitor", C), process.on("unhandledRejection", C), process.on("SIGINT", A), process.on("SIGTERM", A), process.on("exit", v), l && l.addEventListener("abort", A);
|
|
1564
1005
|
}, w = () => {
|
|
1006
|
+
process.removeListener("uncaughtExceptionMonitor", C), process.removeListener("unhandledRejection", C), process.removeListener("SIGINT", A), process.removeListener("SIGTERM", A), process.removeListener("exit", v), l && l.removeEventListener("abort", A);
|
|
1007
|
+
}, S = () => {
|
|
1565
1008
|
if (m === void 0) return;
|
|
1566
1009
|
c && s.write(`
|
|
1567
1010
|
`);
|
|
1568
|
-
const
|
|
1011
|
+
const B = J(m, F, {
|
|
1569
1012
|
hard: !0,
|
|
1570
1013
|
trim: !1
|
|
1571
1014
|
}).split(`
|
|
1572
1015
|
`);
|
|
1573
|
-
|
|
1574
|
-
},
|
|
1575
|
-
const
|
|
1576
|
-
return
|
|
1577
|
-
},
|
|
1578
|
-
|
|
1016
|
+
B.length > 1 && s.write(import_src.cursor.up(B.length - 1)), s.write(import_src.cursor.to(0)), s.write(import_src.erase.down());
|
|
1017
|
+
}, T = (B) => B.replace(/\.+$/, ""), M = (B) => {
|
|
1018
|
+
const P = (performance.now() - B) / 1e3, G = Math.floor(P / 60), L = Math.floor(P % 60);
|
|
1019
|
+
return G > 0 ? `[${G}m ${L}s]` : `[${L}s]`;
|
|
1020
|
+
}, O = n.withGuide ?? _$1.withGuide, le = (B = "") => {
|
|
1021
|
+
g = !0, p = xt$1({ output: s }), $ = T(B), d = performance.now(), O && s.write(`${styleText("gray", h$1)}
|
|
1579
1022
|
`);
|
|
1580
|
-
let
|
|
1581
|
-
|
|
1023
|
+
let P = 0, G = 0;
|
|
1024
|
+
b(), f = setInterval(() => {
|
|
1582
1025
|
if (c && $ === m) return;
|
|
1583
|
-
|
|
1584
|
-
const
|
|
1585
|
-
let
|
|
1586
|
-
if (c)
|
|
1587
|
-
else if (
|
|
1026
|
+
S(), m = $;
|
|
1027
|
+
const L = y(o[P]);
|
|
1028
|
+
let Z;
|
|
1029
|
+
if (c) Z = `${L} ${$}...`;
|
|
1030
|
+
else if (e === "timer") Z = `${L} ${$} ${M(d)}`;
|
|
1588
1031
|
else {
|
|
1589
|
-
const
|
|
1590
|
-
|
|
1032
|
+
const et = ".".repeat(Math.floor(G)).slice(0, 3);
|
|
1033
|
+
Z = `${L} ${$}${et}`;
|
|
1591
1034
|
}
|
|
1592
|
-
const
|
|
1035
|
+
const Ze = J(Z, F, {
|
|
1593
1036
|
hard: !0,
|
|
1594
1037
|
trim: !1
|
|
1595
1038
|
});
|
|
1596
|
-
s.write(
|
|
1039
|
+
s.write(Ze), P = P + 1 < o.length ? P + 1 : 0, G = G < 4 ? G + .125 : 0;
|
|
1597
1040
|
}, u);
|
|
1598
|
-
},
|
|
1599
|
-
if (!
|
|
1600
|
-
|
|
1601
|
-
const
|
|
1602
|
-
$ =
|
|
1603
|
-
`) : s.write(`${
|
|
1604
|
-
`)),
|
|
1041
|
+
}, k = (B = "", P = 0, G = !1) => {
|
|
1042
|
+
if (!g) return;
|
|
1043
|
+
g = !1, clearInterval(f), S();
|
|
1044
|
+
const L = P === 0 ? styleText("green", V) : P === 1 ? styleText("red", $e) : styleText("red", de);
|
|
1045
|
+
$ = B ?? $, G || (e === "timer" ? s.write(`${L} ${$} ${M(d)}
|
|
1046
|
+
`) : s.write(`${L} ${$}
|
|
1047
|
+
`)), w(), p();
|
|
1605
1048
|
};
|
|
1606
1049
|
return {
|
|
1607
|
-
start:
|
|
1608
|
-
stop: (
|
|
1609
|
-
message: (
|
|
1610
|
-
$ =
|
|
1050
|
+
start: le,
|
|
1051
|
+
stop: (B = "") => k(B, 0),
|
|
1052
|
+
message: (B = "") => {
|
|
1053
|
+
$ = T(B ?? $);
|
|
1611
1054
|
},
|
|
1612
|
-
cancel: (
|
|
1613
|
-
error: (
|
|
1614
|
-
clear: () =>
|
|
1055
|
+
cancel: (B = "") => k(B, 1),
|
|
1056
|
+
error: (B = "") => k(B, 2),
|
|
1057
|
+
clear: () => k("", 0, !0),
|
|
1615
1058
|
get isCancelled() {
|
|
1616
1059
|
return E;
|
|
1617
1060
|
}
|
|
1618
1061
|
};
|
|
1619
|
-
}, zt = {
|
|
1620
|
-
light: C$1("─", "-"),
|
|
1621
|
-
heavy: C$1("━", "="),
|
|
1622
|
-
block: C$1("█", "#")
|
|
1623
1062
|
};
|
|
1624
|
-
|
|
1625
|
-
|
|
1063
|
+
I$1("─", "-"), I$1("━", "="), I$1("█", "#");
|
|
1064
|
+
const oe = (e, r) => e.includes(`
|
|
1065
|
+
`) ? e.split(`
|
|
1626
1066
|
`).map((s) => r(s)).join(`
|
|
1627
|
-
`) : r(
|
|
1067
|
+
`) : r(e), Jt = (e) => {
|
|
1628
1068
|
const r = (s, i) => {
|
|
1629
1069
|
const a = s.label ?? String(s.value);
|
|
1630
1070
|
switch (i) {
|
|
1631
|
-
case "disabled": return `${
|
|
1632
|
-
case "selected": return `${
|
|
1633
|
-
case "active": return `${
|
|
1634
|
-
case "cancelled": return `${
|
|
1635
|
-
default: return `${
|
|
1071
|
+
case "disabled": return `${styleText("gray", H)} ${oe(a, (o) => styleText("gray", o))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
1072
|
+
case "selected": return `${oe(a, (o) => styleText("dim", o))}`;
|
|
1073
|
+
case "active": return `${styleText("green", z$1)} ${a}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
|
|
1074
|
+
case "cancelled": return `${oe(a, (o) => styleText(["strikethrough", "dim"], o))}`;
|
|
1075
|
+
default: return `${styleText("dim", H)} ${oe(a, (o) => styleText("dim", o))}`;
|
|
1636
1076
|
}
|
|
1637
1077
|
};
|
|
1638
|
-
return new
|
|
1639
|
-
options:
|
|
1640
|
-
signal:
|
|
1641
|
-
input:
|
|
1642
|
-
output:
|
|
1643
|
-
initialValue:
|
|
1078
|
+
return new Tt$1({
|
|
1079
|
+
options: e.options,
|
|
1080
|
+
signal: e.signal,
|
|
1081
|
+
input: e.input,
|
|
1082
|
+
output: e.output,
|
|
1083
|
+
initialValue: e.initialValue,
|
|
1644
1084
|
render() {
|
|
1645
|
-
const s =
|
|
1085
|
+
const s = e.withGuide ?? _$1.withGuide, i = `${W(this.state)} `, a = `${ve(this.state)} `, o = Bt$1(e.output, e.message, a, i), u = `${s ? `${styleText("gray", h$1)}
|
|
1646
1086
|
` : ""}${o}
|
|
1647
1087
|
`;
|
|
1648
1088
|
switch (this.state) {
|
|
1649
1089
|
case "submit": {
|
|
1650
|
-
const l = s ? `${
|
|
1651
|
-
return `${u}${
|
|
1090
|
+
const l = s ? `${styleText("gray", h$1)} ` : "";
|
|
1091
|
+
return `${u}${Bt$1(e.output, r(this.options[this.cursor], "selected"), l)}`;
|
|
1652
1092
|
}
|
|
1653
1093
|
case "cancel": {
|
|
1654
|
-
const l = s ? `${
|
|
1655
|
-
return `${u}${
|
|
1656
|
-
${
|
|
1094
|
+
const l = s ? `${styleText("gray", h$1)} ` : "";
|
|
1095
|
+
return `${u}${Bt$1(e.output, r(this.options[this.cursor], "cancelled"), l)}${s ? `
|
|
1096
|
+
${styleText("gray", h$1)}` : ""}`;
|
|
1657
1097
|
}
|
|
1658
1098
|
default: {
|
|
1659
|
-
const l = s ? `${
|
|
1660
|
-
`).length,
|
|
1099
|
+
const l = s ? `${styleText("cyan", h$1)} ` : "", n = s ? styleText("cyan", x$1) : "", c = u.split(`
|
|
1100
|
+
`).length, p = s ? 2 : 1;
|
|
1661
1101
|
return `${u}${l}${X({
|
|
1662
|
-
output:
|
|
1102
|
+
output: e.output,
|
|
1663
1103
|
cursor: this.cursor,
|
|
1664
1104
|
options: this.options,
|
|
1665
|
-
maxItems:
|
|
1105
|
+
maxItems: e.maxItems,
|
|
1666
1106
|
columnPadding: l.length,
|
|
1667
|
-
rowPadding: c +
|
|
1668
|
-
style: (
|
|
1107
|
+
rowPadding: c + p,
|
|
1108
|
+
style: (f, g) => r(f, f.disabled ? "disabled" : g ? "active" : "inactive")
|
|
1669
1109
|
}).join(`
|
|
1670
1110
|
${l}`)}
|
|
1671
1111
|
${n}
|
|
@@ -1674,293 +1114,177 @@ ${n}
|
|
|
1674
1114
|
}
|
|
1675
1115
|
}
|
|
1676
1116
|
}).prompt();
|
|
1677
|
-
},
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
return i === "selected" ? `${import_picocolors.default.dim(a)}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(a))}` : i === "active" ? `${import_picocolors.default.bgCyan(import_picocolors.default.gray(` ${s.value} `))} ${a}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}` : `${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(` ${s.value} `)))} ${a}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}`;
|
|
1681
|
-
};
|
|
1682
|
-
return new Tt$1({
|
|
1683
|
-
options: t.options,
|
|
1684
|
-
signal: t.signal,
|
|
1685
|
-
input: t.input,
|
|
1686
|
-
output: t.output,
|
|
1687
|
-
initialValue: t.initialValue,
|
|
1688
|
-
caseSensitive: t.caseSensitive,
|
|
1689
|
-
render() {
|
|
1690
|
-
const s = t.withGuide ?? _$1.withGuide, i = `${s ? `${import_picocolors.default.gray(d$1)}
|
|
1691
|
-
` : ""}${W$1(this.state)} ${t.message}
|
|
1692
|
-
`;
|
|
1693
|
-
switch (this.state) {
|
|
1694
|
-
case "submit": {
|
|
1695
|
-
const a = s ? `${import_picocolors.default.gray(d$1)} ` : "", o = this.options.find((l) => l.value === this.value) ?? t.options[0];
|
|
1696
|
-
return `${i}${xt(t.output, r(o, "selected"), a)}`;
|
|
1697
|
-
}
|
|
1698
|
-
case "cancel": {
|
|
1699
|
-
const a = s ? `${import_picocolors.default.gray(d$1)} ` : "";
|
|
1700
|
-
return `${i}${xt(t.output, r(this.options[0], "cancelled"), a)}${s ? `
|
|
1701
|
-
${import_picocolors.default.gray(d$1)}` : ""}`;
|
|
1702
|
-
}
|
|
1703
|
-
default: {
|
|
1704
|
-
const a = s ? `${import_picocolors.default.cyan(d$1)} ` : "", o = s ? import_picocolors.default.cyan(x$1) : "";
|
|
1705
|
-
return `${i}${this.options.map((l, n) => xt(t.output, r(l, n === this.cursor ? "active" : "inactive"), a)).join(`
|
|
1706
|
-
`)}
|
|
1707
|
-
${o}
|
|
1708
|
-
`;
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
}).prompt();
|
|
1713
|
-
}, Qt = `${import_picocolors.default.gray(d$1)} `, K$1 = {
|
|
1714
|
-
message: async (t, { symbol: r = import_picocolors.default.gray(d$1) } = {}) => {
|
|
1715
|
-
process.stdout.write(`${import_picocolors.default.gray(d$1)}
|
|
1117
|
+
}, Qe = `${styleText("gray", h$1)} `, K = {
|
|
1118
|
+
message: async (e, { symbol: r = styleText("gray", h$1) } = {}) => {
|
|
1119
|
+
process.stdout.write(`${styleText("gray", h$1)}
|
|
1716
1120
|
${r} `);
|
|
1717
1121
|
let s = 3;
|
|
1718
|
-
for await (let i of
|
|
1122
|
+
for await (let i of e) {
|
|
1719
1123
|
i = i.replace(/\n/g, `
|
|
1720
|
-
${
|
|
1124
|
+
${Qe}`), i.includes(`
|
|
1721
1125
|
`) && (s = 3 + stripVTControlCharacters(i.slice(i.lastIndexOf(`
|
|
1722
1126
|
`))).length);
|
|
1723
1127
|
const a = stripVTControlCharacters(i).length;
|
|
1724
1128
|
s + a < process.stdout.columns ? (s += a, process.stdout.write(i)) : (process.stdout.write(`
|
|
1725
|
-
${
|
|
1129
|
+
${Qe}${i.trimStart()}`), s = 3 + stripVTControlCharacters(i.trimStart()).length);
|
|
1726
1130
|
}
|
|
1727
1131
|
process.stdout.write(`
|
|
1728
1132
|
`);
|
|
1729
1133
|
},
|
|
1730
|
-
info: (
|
|
1731
|
-
success: (
|
|
1732
|
-
step: (
|
|
1733
|
-
warn: (
|
|
1734
|
-
warning: (
|
|
1735
|
-
error: (
|
|
1736
|
-
},
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
}, ze = (t) => t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ""), Qe = (t) => {
|
|
1745
|
-
const r = t.output ?? process.stdout, s = rt$1(r), i = import_picocolors.default.gray(d$1), a = t.spacing ?? 1, o = 3, u = t.retainLog === !0, l = !ct() && Mt(r);
|
|
1746
|
-
r.write(`${i}
|
|
1747
|
-
`), r.write(`${import_picocolors.default.green(V$1)} ${t.title}
|
|
1748
|
-
`);
|
|
1749
|
-
for (let h = 0; h < a; h++) r.write(`${i}
|
|
1750
|
-
`);
|
|
1751
|
-
const n = [{
|
|
1752
|
-
value: "",
|
|
1753
|
-
full: ""
|
|
1754
|
-
}];
|
|
1755
|
-
let c = !1;
|
|
1756
|
-
const g = (h) => {
|
|
1757
|
-
if (n.length === 0) return;
|
|
1758
|
-
let y = 0;
|
|
1759
|
-
h && (y += a + 2);
|
|
1760
|
-
for (const f of n) {
|
|
1761
|
-
const { value: v, result: S } = f;
|
|
1762
|
-
let I = S?.message ?? v;
|
|
1763
|
-
if (I.length === 0) continue;
|
|
1764
|
-
S === void 0 && f.header !== void 0 && f.header !== "" && (I += `
|
|
1765
|
-
${f.header}`);
|
|
1766
|
-
const B = I.split(`
|
|
1767
|
-
`).reduce((A, w) => w === "" ? A + 1 : A + Math.ceil((w.length + o) / s), 0);
|
|
1768
|
-
y += B;
|
|
1769
|
-
}
|
|
1770
|
-
y > 0 && (y += 1, r.write(import_src.erase.lines(y)));
|
|
1771
|
-
}, F = (h, y, f) => {
|
|
1772
|
-
const v = f ? `${h.full}
|
|
1773
|
-
${h.value}` : h.value;
|
|
1774
|
-
h.header !== void 0 && h.header !== "" && R$1.message(h.header.split(`
|
|
1775
|
-
`).map(import_picocolors.default.bold), {
|
|
1776
|
-
output: r,
|
|
1777
|
-
secondarySymbol: i,
|
|
1778
|
-
symbol: i,
|
|
1779
|
-
spacing: 0
|
|
1780
|
-
}), R$1.message(v.split(`
|
|
1781
|
-
`).map(import_picocolors.default.dim), {
|
|
1782
|
-
output: r,
|
|
1783
|
-
secondarySymbol: i,
|
|
1784
|
-
symbol: i,
|
|
1785
|
-
spacing: y ?? a
|
|
1786
|
-
});
|
|
1787
|
-
}, p = () => {
|
|
1788
|
-
for (const h of n) {
|
|
1789
|
-
const { header: y, value: f, full: v } = h;
|
|
1790
|
-
(y === void 0 || y.length === 0) && f.length === 0 || F(h, void 0, u === !0 && v.length > 0);
|
|
1791
|
-
}
|
|
1792
|
-
}, E = (h, y, f) => {
|
|
1793
|
-
if (g(!1), (f?.raw !== !0 || !c) && h.value !== "" && (h.value += `
|
|
1794
|
-
`), h.value += ze(y), c = f?.raw === !0, t.limit !== void 0) {
|
|
1795
|
-
const v = h.value.split(`
|
|
1796
|
-
`), S = v.length - t.limit;
|
|
1797
|
-
if (S > 0) {
|
|
1798
|
-
const I = v.splice(0, S);
|
|
1799
|
-
u && (h.full += (h.full === "" ? "" : `
|
|
1800
|
-
`) + I.join(`
|
|
1801
|
-
`));
|
|
1802
|
-
}
|
|
1803
|
-
h.value = v.join(`
|
|
1804
|
-
`);
|
|
1805
|
-
}
|
|
1806
|
-
l && $();
|
|
1807
|
-
}, $ = () => {
|
|
1808
|
-
for (const h of n) h.result ? h.result.status === "error" ? R$1.error(h.result.message, {
|
|
1809
|
-
output: r,
|
|
1810
|
-
secondarySymbol: i,
|
|
1811
|
-
spacing: 0
|
|
1812
|
-
}) : R$1.success(h.result.message, {
|
|
1813
|
-
output: r,
|
|
1814
|
-
secondarySymbol: i,
|
|
1815
|
-
spacing: 0
|
|
1816
|
-
}) : h.value !== "" && F(h, 0);
|
|
1817
|
-
}, m = (h, y) => {
|
|
1818
|
-
g(!1), h.result = y, l && $();
|
|
1819
|
-
};
|
|
1820
|
-
return {
|
|
1821
|
-
message(h, y) {
|
|
1822
|
-
E(n[0], h, y);
|
|
1823
|
-
},
|
|
1824
|
-
group(h) {
|
|
1825
|
-
const y = {
|
|
1826
|
-
header: h,
|
|
1827
|
-
value: "",
|
|
1828
|
-
full: ""
|
|
1829
|
-
};
|
|
1830
|
-
return n.push(y), {
|
|
1831
|
-
message(f, v) {
|
|
1832
|
-
E(y, f, v);
|
|
1833
|
-
},
|
|
1834
|
-
error(f) {
|
|
1835
|
-
m(y, {
|
|
1836
|
-
status: "error",
|
|
1837
|
-
message: f
|
|
1838
|
-
});
|
|
1839
|
-
},
|
|
1840
|
-
success(f) {
|
|
1841
|
-
m(y, {
|
|
1842
|
-
status: "success",
|
|
1843
|
-
message: f
|
|
1844
|
-
});
|
|
1845
|
-
}
|
|
1846
|
-
};
|
|
1847
|
-
},
|
|
1848
|
-
error(h, y) {
|
|
1849
|
-
g(!0), R$1.error(h, {
|
|
1850
|
-
output: r,
|
|
1851
|
-
secondarySymbol: i,
|
|
1852
|
-
spacing: 1
|
|
1853
|
-
}), y?.showLog !== !1 && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
|
|
1854
|
-
},
|
|
1855
|
-
success(h, y) {
|
|
1856
|
-
g(!0), R$1.success(h, {
|
|
1857
|
-
output: r,
|
|
1858
|
-
secondarySymbol: i,
|
|
1859
|
-
spacing: 1
|
|
1860
|
-
}), y?.showLog === !0 && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
|
|
1861
|
-
}
|
|
1862
|
-
};
|
|
1863
|
-
}, Ze = (t) => new $t$1({
|
|
1864
|
-
validate: t.validate,
|
|
1865
|
-
placeholder: t.placeholder,
|
|
1866
|
-
defaultValue: t.defaultValue,
|
|
1867
|
-
initialValue: t.initialValue,
|
|
1868
|
-
output: t.output,
|
|
1869
|
-
signal: t.signal,
|
|
1870
|
-
input: t.input,
|
|
1134
|
+
info: (e) => K.message(e, { symbol: styleText("blue", fe) }),
|
|
1135
|
+
success: (e) => K.message(e, { symbol: styleText("green", Fe) }),
|
|
1136
|
+
step: (e) => K.message(e, { symbol: styleText("green", V) }),
|
|
1137
|
+
warn: (e) => K.message(e, { symbol: styleText("yellow", ye) }),
|
|
1138
|
+
warning: (e) => K.warn(e),
|
|
1139
|
+
error: (e) => K.message(e, { symbol: styleText("red", Ee) })
|
|
1140
|
+
}, Zt = (e) => new $t({
|
|
1141
|
+
validate: e.validate,
|
|
1142
|
+
placeholder: e.placeholder,
|
|
1143
|
+
defaultValue: e.defaultValue,
|
|
1144
|
+
initialValue: e.initialValue,
|
|
1145
|
+
output: e.output,
|
|
1146
|
+
signal: e.signal,
|
|
1147
|
+
input: e.input,
|
|
1871
1148
|
render() {
|
|
1872
|
-
const r =
|
|
1873
|
-
` : ""}${W
|
|
1874
|
-
`, i =
|
|
1149
|
+
const r = e?.withGuide ?? _$1.withGuide, s = `${`${r ? `${styleText("gray", h$1)}
|
|
1150
|
+
` : ""}${W(this.state)} `}${e.message}
|
|
1151
|
+
`, i = e.placeholder ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
|
|
1875
1152
|
switch (this.state) {
|
|
1876
1153
|
case "error": {
|
|
1877
|
-
const u = this.error ? ` ${
|
|
1154
|
+
const u = this.error ? ` ${styleText("yellow", this.error)}` : "", l = r ? `${styleText("yellow", h$1)} ` : "", n = r ? styleText("yellow", x$1) : "";
|
|
1878
1155
|
return `${s.trim()}
|
|
1879
1156
|
${l}${a}
|
|
1880
1157
|
${n}${u}
|
|
1881
1158
|
`;
|
|
1882
1159
|
}
|
|
1883
1160
|
case "submit": {
|
|
1884
|
-
const u = o ? ` ${
|
|
1885
|
-
return `${s}${r ?
|
|
1161
|
+
const u = o ? ` ${styleText("dim", o)}` : "";
|
|
1162
|
+
return `${s}${r ? styleText("gray", h$1) : ""}${u}`;
|
|
1886
1163
|
}
|
|
1887
1164
|
case "cancel": {
|
|
1888
|
-
const u = o ? ` ${
|
|
1165
|
+
const u = o ? ` ${styleText(["strikethrough", "dim"], o)}` : "", l = r ? styleText("gray", h$1) : "";
|
|
1889
1166
|
return `${s}${l}${u}${o.trim() ? `
|
|
1890
1167
|
${l}` : ""}`;
|
|
1891
1168
|
}
|
|
1892
|
-
default: return `${s}${r ? `${
|
|
1893
|
-
${r ?
|
|
1169
|
+
default: return `${s}${r ? `${styleText("cyan", h$1)} ` : ""}${a}
|
|
1170
|
+
${r ? styleText("cyan", x$1) : ""}
|
|
1894
1171
|
`;
|
|
1895
1172
|
}
|
|
1896
1173
|
}
|
|
1897
1174
|
}).prompt();
|
|
1898
|
-
|
|
1899
1175
|
//#endregion
|
|
1900
|
-
//#region node_modules/tinyexec/dist/main.
|
|
1901
|
-
var
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
});
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1176
|
+
//#region node_modules/tinyexec/dist/main.mjs
|
|
1177
|
+
var import_picocolors = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1178
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
1179
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
1180
|
+
let formatter = (open, close, replace = open) => (input) => {
|
|
1181
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
1182
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
1183
|
+
};
|
|
1184
|
+
let replaceClose = (string, close, replace, index) => {
|
|
1185
|
+
let result = "", cursor = 0;
|
|
1186
|
+
do {
|
|
1187
|
+
result += string.substring(cursor, index) + replace;
|
|
1188
|
+
cursor = index + close.length;
|
|
1189
|
+
index = string.indexOf(close, cursor);
|
|
1190
|
+
} while (~index);
|
|
1191
|
+
return result + string.substring(cursor);
|
|
1192
|
+
};
|
|
1193
|
+
let createColors = (enabled = isColorSupported) => {
|
|
1194
|
+
let f = enabled ? formatter : () => String;
|
|
1195
|
+
return {
|
|
1196
|
+
isColorSupported: enabled,
|
|
1197
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
1198
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
1199
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
1200
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
1201
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
1202
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
1203
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
1204
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
1205
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
1206
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
1207
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
1208
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
1209
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
1210
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
1211
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
1212
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
1213
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
1214
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
1215
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
1216
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
1217
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
1218
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
1219
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
1220
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
1221
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
1222
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
1223
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
1224
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
1225
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
1226
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
1227
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
1228
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
1229
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
1230
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
1231
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
1232
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
1233
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
1234
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
1235
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
1236
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
1237
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
1238
|
+
};
|
|
1239
|
+
};
|
|
1240
|
+
module.exports = createColors();
|
|
1241
|
+
module.exports.createColors = createColors;
|
|
1242
|
+
})))(), 1);
|
|
1243
|
+
var l = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
|
|
1244
|
+
var u = /* @__PURE__ */ createRequire(import.meta.url);
|
|
1245
|
+
const d = /^path$/i;
|
|
1246
|
+
const f = {
|
|
1925
1247
|
key: "PATH",
|
|
1926
1248
|
value: ""
|
|
1927
1249
|
};
|
|
1928
|
-
function
|
|
1250
|
+
function p(e) {
|
|
1929
1251
|
for (const t in e) {
|
|
1930
|
-
if (!Object.prototype.hasOwnProperty.call(e, t) || !
|
|
1252
|
+
if (!Object.prototype.hasOwnProperty.call(e, t) || !d.test(t)) continue;
|
|
1931
1253
|
const n = e[t];
|
|
1932
|
-
if (!n) return
|
|
1254
|
+
if (!n) return f;
|
|
1933
1255
|
return {
|
|
1934
1256
|
key: t,
|
|
1935
1257
|
value: n
|
|
1936
1258
|
};
|
|
1937
1259
|
}
|
|
1938
|
-
return
|
|
1260
|
+
return f;
|
|
1939
1261
|
}
|
|
1940
|
-
function
|
|
1262
|
+
function m(e, t) {
|
|
1941
1263
|
const i = t.value.split(delimiter);
|
|
1942
|
-
|
|
1943
|
-
let s;
|
|
1264
|
+
const o = [];
|
|
1265
|
+
let s = e;
|
|
1266
|
+
let c;
|
|
1944
1267
|
do {
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
} while (
|
|
1268
|
+
o.push(resolve(s, "node_modules", ".bin"));
|
|
1269
|
+
c = s;
|
|
1270
|
+
s = dirname(s);
|
|
1271
|
+
} while (s !== c);
|
|
1272
|
+
const l = o.concat(i).join(delimiter);
|
|
1949
1273
|
return {
|
|
1950
1274
|
key: t.key,
|
|
1951
|
-
value:
|
|
1275
|
+
value: l
|
|
1952
1276
|
};
|
|
1953
1277
|
}
|
|
1954
|
-
function
|
|
1278
|
+
function h(e, t) {
|
|
1955
1279
|
const n = {
|
|
1956
1280
|
...process.env,
|
|
1957
1281
|
...t
|
|
1958
1282
|
};
|
|
1959
|
-
const r =
|
|
1283
|
+
const r = m(e, p(n));
|
|
1960
1284
|
n[r.key] = r.value;
|
|
1961
1285
|
return n;
|
|
1962
1286
|
}
|
|
1963
|
-
const
|
|
1287
|
+
const g = (e) => {
|
|
1964
1288
|
let t = e.length;
|
|
1965
1289
|
const n = new PassThrough();
|
|
1966
1290
|
const r = () => {
|
|
@@ -1972,10 +1296,10 @@ const w = (e) => {
|
|
|
1972
1296
|
}
|
|
1973
1297
|
return n;
|
|
1974
1298
|
};
|
|
1975
|
-
var
|
|
1299
|
+
var _ = /* @__PURE__ */ l(((e, t) => {
|
|
1976
1300
|
t.exports = a;
|
|
1977
1301
|
a.sync = o;
|
|
1978
|
-
var n =
|
|
1302
|
+
var n = u("fs");
|
|
1979
1303
|
function r(e, t) {
|
|
1980
1304
|
var n = t.pathExt !== void 0 ? t.pathExt : process.env.PATHEXT;
|
|
1981
1305
|
if (!n) return true;
|
|
@@ -1999,11 +1323,11 @@ var T = h((exports, t) => {
|
|
|
1999
1323
|
function o(e, t) {
|
|
2000
1324
|
return i(n.statSync(e), e, t);
|
|
2001
1325
|
}
|
|
2002
|
-
});
|
|
2003
|
-
var
|
|
1326
|
+
}));
|
|
1327
|
+
var v = /* @__PURE__ */ l(((e, t) => {
|
|
2004
1328
|
t.exports = r;
|
|
2005
1329
|
r.sync = i;
|
|
2006
|
-
var n =
|
|
1330
|
+
var n = u("fs");
|
|
2007
1331
|
function r(e, t, r) {
|
|
2008
1332
|
n.stat(e, function(e, n) {
|
|
2009
1333
|
r(e, e ? false : a(n, t));
|
|
@@ -2027,52 +1351,52 @@ var E = h((exports, t) => {
|
|
|
2027
1351
|
var u = s | c;
|
|
2028
1352
|
return n & l || n & c && i === o || n & s && r === a || n & u && a === 0;
|
|
2029
1353
|
}
|
|
2030
|
-
});
|
|
2031
|
-
var
|
|
2032
|
-
|
|
2033
|
-
var
|
|
2034
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS)
|
|
2035
|
-
else
|
|
2036
|
-
t.exports =
|
|
2037
|
-
|
|
2038
|
-
function
|
|
1354
|
+
}));
|
|
1355
|
+
var y = /* @__PURE__ */ l(((e, t) => {
|
|
1356
|
+
u("fs");
|
|
1357
|
+
var n;
|
|
1358
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) n = _();
|
|
1359
|
+
else n = v();
|
|
1360
|
+
t.exports = r;
|
|
1361
|
+
r.sync = i;
|
|
1362
|
+
function r(e, t, i) {
|
|
2039
1363
|
if (typeof t === "function") {
|
|
2040
|
-
|
|
1364
|
+
i = t;
|
|
2041
1365
|
t = {};
|
|
2042
1366
|
}
|
|
2043
|
-
if (!
|
|
1367
|
+
if (!i) {
|
|
2044
1368
|
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
2045
|
-
return new Promise(function(n,
|
|
2046
|
-
|
|
2047
|
-
if (e)
|
|
1369
|
+
return new Promise(function(n, i) {
|
|
1370
|
+
r(e, t || {}, function(e, t) {
|
|
1371
|
+
if (e) i(e);
|
|
2048
1372
|
else n(t);
|
|
2049
1373
|
});
|
|
2050
1374
|
});
|
|
2051
1375
|
}
|
|
2052
|
-
|
|
1376
|
+
n(e, t || {}, function(e, n) {
|
|
2053
1377
|
if (e) {
|
|
2054
1378
|
if (e.code === "EACCES" || t && t.ignoreErrors) {
|
|
2055
1379
|
e = null;
|
|
2056
|
-
|
|
1380
|
+
n = false;
|
|
2057
1381
|
}
|
|
2058
1382
|
}
|
|
2059
|
-
|
|
1383
|
+
i(e, n);
|
|
2060
1384
|
});
|
|
2061
1385
|
}
|
|
2062
|
-
function
|
|
1386
|
+
function i(e, t) {
|
|
2063
1387
|
try {
|
|
2064
|
-
return
|
|
1388
|
+
return n.sync(e, t || {});
|
|
2065
1389
|
} catch (e) {
|
|
2066
1390
|
if (t && t.ignoreErrors || e.code === "EACCES") return false;
|
|
2067
1391
|
else throw e;
|
|
2068
1392
|
}
|
|
2069
1393
|
}
|
|
2070
|
-
});
|
|
2071
|
-
var
|
|
1394
|
+
}));
|
|
1395
|
+
var b = /* @__PURE__ */ l(((e, t) => {
|
|
2072
1396
|
const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
2073
|
-
const r =
|
|
1397
|
+
const r = u("path");
|
|
2074
1398
|
const i = n ? ";" : ":";
|
|
2075
|
-
const a =
|
|
1399
|
+
const a = y();
|
|
2076
1400
|
const o = (e) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e}`), { code: "ENOENT" });
|
|
2077
1401
|
const s = (e, t) => {
|
|
2078
1402
|
const r = t.colon || i;
|
|
@@ -2137,8 +1461,8 @@ var O = h((exports, t) => {
|
|
|
2137
1461
|
};
|
|
2138
1462
|
t.exports = c;
|
|
2139
1463
|
c.sync = l;
|
|
2140
|
-
});
|
|
2141
|
-
var
|
|
1464
|
+
}));
|
|
1465
|
+
var x = /* @__PURE__ */ l(((e, t) => {
|
|
2142
1466
|
const n = (e = {}) => {
|
|
2143
1467
|
const t = e.env || process.env;
|
|
2144
1468
|
if ((e.platform || process.platform) !== "win32") return "PATH";
|
|
@@ -2146,11 +1470,11 @@ var k = h((exports, t) => {
|
|
|
2146
1470
|
};
|
|
2147
1471
|
t.exports = n;
|
|
2148
1472
|
t.exports.default = n;
|
|
2149
|
-
});
|
|
2150
|
-
var
|
|
2151
|
-
const n =
|
|
2152
|
-
const r =
|
|
2153
|
-
const i =
|
|
1473
|
+
}));
|
|
1474
|
+
var S = /* @__PURE__ */ l(((e, t) => {
|
|
1475
|
+
const n = u("path");
|
|
1476
|
+
const r = b();
|
|
1477
|
+
const i = x();
|
|
2154
1478
|
function a(e, t) {
|
|
2155
1479
|
const a = e.options.env || process.env;
|
|
2156
1480
|
const o = process.cwd();
|
|
@@ -2175,8 +1499,8 @@ var A = h((exports, t) => {
|
|
|
2175
1499
|
return a(e) || a(e, true);
|
|
2176
1500
|
}
|
|
2177
1501
|
t.exports = o;
|
|
2178
|
-
});
|
|
2179
|
-
var
|
|
1502
|
+
}));
|
|
1503
|
+
var C = /* @__PURE__ */ l(((e, t) => {
|
|
2180
1504
|
const n = /([()\][%!^"`<>&|;, *?])/g;
|
|
2181
1505
|
function r(e) {
|
|
2182
1506
|
e = e.replace(n, "^$1");
|
|
@@ -2184,8 +1508,8 @@ var j = h((exports, t) => {
|
|
|
2184
1508
|
}
|
|
2185
1509
|
function i(e, t) {
|
|
2186
1510
|
e = `${e}`;
|
|
2187
|
-
e = e.replace(/(
|
|
2188
|
-
e = e.replace(/(
|
|
1511
|
+
e = e.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
1512
|
+
e = e.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
2189
1513
|
e = `"${e}"`;
|
|
2190
1514
|
e = e.replace(n, "^$1");
|
|
2191
1515
|
if (t) e = e.replace(n, "^$1");
|
|
@@ -2193,12 +1517,12 @@ var j = h((exports, t) => {
|
|
|
2193
1517
|
}
|
|
2194
1518
|
t.exports.command = r;
|
|
2195
1519
|
t.exports.argument = i;
|
|
2196
|
-
});
|
|
2197
|
-
var
|
|
1520
|
+
}));
|
|
1521
|
+
var w = /* @__PURE__ */ l(((e, t) => {
|
|
2198
1522
|
t.exports = /^#!(.*)/;
|
|
2199
|
-
});
|
|
2200
|
-
var
|
|
2201
|
-
const n =
|
|
1523
|
+
}));
|
|
1524
|
+
var T = /* @__PURE__ */ l(((e, t) => {
|
|
1525
|
+
const n = w();
|
|
2202
1526
|
t.exports = (e = "") => {
|
|
2203
1527
|
const t = e.match(n);
|
|
2204
1528
|
if (!t) return null;
|
|
@@ -2207,10 +1531,10 @@ var N$1 = h((exports, t) => {
|
|
|
2207
1531
|
if (a === "env") return i;
|
|
2208
1532
|
return i ? `${a} ${i}` : a;
|
|
2209
1533
|
};
|
|
2210
|
-
});
|
|
2211
|
-
var
|
|
2212
|
-
const n =
|
|
2213
|
-
const r =
|
|
1534
|
+
}));
|
|
1535
|
+
var E = /* @__PURE__ */ l(((e, t) => {
|
|
1536
|
+
const n = u("fs");
|
|
1537
|
+
const r = T();
|
|
2214
1538
|
function i(e) {
|
|
2215
1539
|
const t = 150;
|
|
2216
1540
|
const i = Buffer.alloc(t);
|
|
@@ -2223,12 +1547,12 @@ var P = h((exports, t) => {
|
|
|
2223
1547
|
return r(i.toString());
|
|
2224
1548
|
}
|
|
2225
1549
|
t.exports = i;
|
|
2226
|
-
});
|
|
2227
|
-
var
|
|
2228
|
-
const n =
|
|
2229
|
-
const r =
|
|
2230
|
-
const i =
|
|
2231
|
-
const a =
|
|
1550
|
+
}));
|
|
1551
|
+
var D = /* @__PURE__ */ l(((e, t) => {
|
|
1552
|
+
const n = u("path");
|
|
1553
|
+
const r = S();
|
|
1554
|
+
const i = C();
|
|
1555
|
+
const a = E();
|
|
2232
1556
|
const o = process.platform === "win32";
|
|
2233
1557
|
const s = /\.(?:com|exe)$/i;
|
|
2234
1558
|
const c = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
@@ -2242,7 +1566,7 @@ var F = h((exports, t) => {
|
|
|
2242
1566
|
}
|
|
2243
1567
|
return e.file;
|
|
2244
1568
|
}
|
|
2245
|
-
function
|
|
1569
|
+
function d(e) {
|
|
2246
1570
|
if (!o) return e;
|
|
2247
1571
|
const t = l(e);
|
|
2248
1572
|
const r = !s.test(t);
|
|
@@ -2262,7 +1586,7 @@ var F = h((exports, t) => {
|
|
|
2262
1586
|
}
|
|
2263
1587
|
return e;
|
|
2264
1588
|
}
|
|
2265
|
-
function
|
|
1589
|
+
function f(e, t, n) {
|
|
2266
1590
|
if (t && !Array.isArray(t)) {
|
|
2267
1591
|
n = t;
|
|
2268
1592
|
t = null;
|
|
@@ -2279,11 +1603,11 @@ var F = h((exports, t) => {
|
|
|
2279
1603
|
args: t
|
|
2280
1604
|
}
|
|
2281
1605
|
};
|
|
2282
|
-
return n.shell ? r :
|
|
1606
|
+
return n.shell ? r : d(r);
|
|
2283
1607
|
}
|
|
2284
|
-
t.exports =
|
|
2285
|
-
});
|
|
2286
|
-
var
|
|
1608
|
+
t.exports = f;
|
|
1609
|
+
}));
|
|
1610
|
+
var O = /* @__PURE__ */ l(((e, t) => {
|
|
2287
1611
|
const n = process.platform === "win32";
|
|
2288
1612
|
function r(e, t) {
|
|
2289
1613
|
return Object.assign(/* @__PURE__ */ new Error(`${t} ${e.command} ENOENT`), {
|
|
@@ -2299,7 +1623,7 @@ var I = h((exports, t) => {
|
|
|
2299
1623
|
const r = e.emit;
|
|
2300
1624
|
e.emit = function(n, i) {
|
|
2301
1625
|
if (n === "exit") {
|
|
2302
|
-
const n = a(i, t
|
|
1626
|
+
const n = a(i, t);
|
|
2303
1627
|
if (n) return r.call(e, "error", n);
|
|
2304
1628
|
}
|
|
2305
1629
|
return r.apply(e, arguments);
|
|
@@ -2319,11 +1643,11 @@ var I = h((exports, t) => {
|
|
|
2319
1643
|
verifyENOENTSync: o,
|
|
2320
1644
|
notFoundError: r
|
|
2321
1645
|
};
|
|
2322
|
-
});
|
|
2323
|
-
var
|
|
2324
|
-
const n =
|
|
2325
|
-
const r =
|
|
2326
|
-
const i =
|
|
1646
|
+
}));
|
|
1647
|
+
var A = (/* @__PURE__ */ l(((e, t) => {
|
|
1648
|
+
const n = u("child_process");
|
|
1649
|
+
const r = D();
|
|
1650
|
+
const i = O();
|
|
2327
1651
|
function a(e, t, a) {
|
|
2328
1652
|
const o = r(e, t, a);
|
|
2329
1653
|
const s = n.spawn(o.command, o.args, o.options);
|
|
@@ -2341,8 +1665,8 @@ var R = _(h((exports, t) => {
|
|
|
2341
1665
|
t.exports.sync = o;
|
|
2342
1666
|
t.exports._parse = r;
|
|
2343
1667
|
t.exports._enoent = i;
|
|
2344
|
-
})()
|
|
2345
|
-
var
|
|
1668
|
+
})))();
|
|
1669
|
+
var j = class extends Error {
|
|
2346
1670
|
result;
|
|
2347
1671
|
output;
|
|
2348
1672
|
get exitCode() {
|
|
@@ -2354,18 +1678,18 @@ var z = class extends Error {
|
|
|
2354
1678
|
this.output = t;
|
|
2355
1679
|
}
|
|
2356
1680
|
};
|
|
2357
|
-
const
|
|
1681
|
+
const M = {
|
|
2358
1682
|
timeout: void 0,
|
|
2359
1683
|
persist: false
|
|
2360
1684
|
};
|
|
2361
|
-
const
|
|
2362
|
-
function
|
|
1685
|
+
const N$1 = { windowsHide: true };
|
|
1686
|
+
function P(e, t) {
|
|
2363
1687
|
return {
|
|
2364
1688
|
command: normalize(e),
|
|
2365
1689
|
args: t ?? []
|
|
2366
1690
|
};
|
|
2367
1691
|
}
|
|
2368
|
-
function
|
|
1692
|
+
function F(e) {
|
|
2369
1693
|
const t = new AbortController();
|
|
2370
1694
|
for (const n of e) {
|
|
2371
1695
|
if (n.aborted) {
|
|
@@ -2379,12 +1703,12 @@ function U(e) {
|
|
|
2379
1703
|
}
|
|
2380
1704
|
return t.signal;
|
|
2381
1705
|
}
|
|
2382
|
-
async function
|
|
1706
|
+
async function I(e) {
|
|
2383
1707
|
let t = "";
|
|
2384
1708
|
for await (const n of e) t += n.toString();
|
|
2385
1709
|
return t;
|
|
2386
1710
|
}
|
|
2387
|
-
var
|
|
1711
|
+
var L = class {
|
|
2388
1712
|
_process;
|
|
2389
1713
|
_aborted = false;
|
|
2390
1714
|
_options;
|
|
@@ -2404,7 +1728,7 @@ var G = class {
|
|
|
2404
1728
|
}
|
|
2405
1729
|
constructor(e, t, n) {
|
|
2406
1730
|
this._options = {
|
|
2407
|
-
...
|
|
1731
|
+
...M,
|
|
2408
1732
|
...n
|
|
2409
1733
|
};
|
|
2410
1734
|
this._command = e;
|
|
@@ -2423,7 +1747,7 @@ var G = class {
|
|
|
2423
1747
|
return this._process?.killed === true;
|
|
2424
1748
|
}
|
|
2425
1749
|
pipe(e, t, n) {
|
|
2426
|
-
return
|
|
1750
|
+
return z(e, t, {
|
|
2427
1751
|
...n,
|
|
2428
1752
|
stdin: this
|
|
2429
1753
|
});
|
|
@@ -2434,18 +1758,18 @@ var G = class {
|
|
|
2434
1758
|
const t = [];
|
|
2435
1759
|
if (this._streamErr) t.push(this._streamErr);
|
|
2436
1760
|
if (this._streamOut) t.push(this._streamOut);
|
|
2437
|
-
const n =
|
|
1761
|
+
const n = g(t);
|
|
2438
1762
|
const r = c.createInterface({ input: n });
|
|
2439
1763
|
for await (const e of r) yield e.toString();
|
|
2440
1764
|
await this._processClosed;
|
|
2441
1765
|
e.removeAllListeners();
|
|
2442
1766
|
if (this._thrownError) throw this._thrownError;
|
|
2443
|
-
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
1767
|
+
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new j(this);
|
|
2444
1768
|
}
|
|
2445
1769
|
async _waitForOutput() {
|
|
2446
1770
|
const e = this._process;
|
|
2447
1771
|
if (!e) throw new Error("No process was started");
|
|
2448
|
-
const [t, n] = await Promise.all([this._streamOut ?
|
|
1772
|
+
const [t, n] = await Promise.all([this._streamOut ? I(this._streamOut) : "", this._streamErr ? I(this._streamErr) : ""]);
|
|
2449
1773
|
await this._processClosed;
|
|
2450
1774
|
if (this._options?.stdin) await this._options.stdin;
|
|
2451
1775
|
e.removeAllListeners();
|
|
@@ -2455,7 +1779,7 @@ var G = class {
|
|
|
2455
1779
|
stdout: t,
|
|
2456
1780
|
exitCode: this.exitCode
|
|
2457
1781
|
};
|
|
2458
|
-
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
1782
|
+
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new j(this, r);
|
|
2459
1783
|
return r;
|
|
2460
1784
|
}
|
|
2461
1785
|
then(e, t) {
|
|
@@ -2467,7 +1791,7 @@ var G = class {
|
|
|
2467
1791
|
const e = cwd();
|
|
2468
1792
|
const n = this._options;
|
|
2469
1793
|
const r = {
|
|
2470
|
-
...
|
|
1794
|
+
...N$1,
|
|
2471
1795
|
...n.nodeOptions
|
|
2472
1796
|
};
|
|
2473
1797
|
const i = [];
|
|
@@ -2475,10 +1799,10 @@ var G = class {
|
|
|
2475
1799
|
if (n.timeout !== void 0) i.push(AbortSignal.timeout(n.timeout));
|
|
2476
1800
|
if (n.signal !== void 0) i.push(n.signal);
|
|
2477
1801
|
if (n.persist === true) r.detached = true;
|
|
2478
|
-
if (i.length > 0) r.signal =
|
|
2479
|
-
r.env =
|
|
2480
|
-
const { command: a, args: s } =
|
|
2481
|
-
const c = (0,
|
|
1802
|
+
if (i.length > 0) r.signal = F(i);
|
|
1803
|
+
r.env = h(e, r.env);
|
|
1804
|
+
const { command: a, args: s } = P(this._command, this._args);
|
|
1805
|
+
const c = (0, A._parse)(a, s, r);
|
|
2482
1806
|
const l = spawn(c.command, c.args, c.options);
|
|
2483
1807
|
if (l.stderr) this._streamErr = l.stderr;
|
|
2484
1808
|
if (l.stdout) this._streamOut = l.stdout;
|
|
@@ -2508,13 +1832,12 @@ var G = class {
|
|
|
2508
1832
|
if (this._resolveClose) this._resolveClose();
|
|
2509
1833
|
};
|
|
2510
1834
|
};
|
|
2511
|
-
const
|
|
2512
|
-
const r = new
|
|
1835
|
+
const R = (e, t, n) => {
|
|
1836
|
+
const r = new L(e, t, n);
|
|
2513
1837
|
r.spawn();
|
|
2514
1838
|
return r;
|
|
2515
1839
|
};
|
|
2516
|
-
const
|
|
2517
|
-
|
|
1840
|
+
const z = R;
|
|
2518
1841
|
//#endregion
|
|
2519
1842
|
//#region src/prompts.ts
|
|
2520
1843
|
/**
|
|
@@ -2532,8 +1855,8 @@ function buildSystemPrompt(commitLog, instructions) {
|
|
|
2532
1855
|
`\`\`\``,
|
|
2533
1856
|
``
|
|
2534
1857
|
];
|
|
2535
|
-
if (!hasHistory) parts.push(`Since this is a new repo with no commit history, use this default style:`, `- Conventional commits format (feat:, fix:, chore:, docs:, refactor:, etc.)`, `- Imperative mood, lowercase after prefix`, `- Subject line
|
|
2536
|
-
parts.push(`INSTRUCTIONS:`, `1. Study the commit history above carefully. Notice the format, conventions, tone, and style.`, ` - Do they use conventional commits (feat:, fix:, etc.)?`, ` - Gitmoji? Ticket prefixes? Brackets?`, ` - Imperative mood or past tense?`, ` - Capitalized or lowercase?`, ` - Subject-only, or subject + body?`, ` - What level of detail?`, `2. Generate a commit message for the staged changes that **matches the repo's existing style exactly**.`, `3. Do NOT invent issue/ticket numbers unless they appear in the diff.`, `4. If the style uses a subject + body format, separate them with a blank line.`, `
|
|
1858
|
+
if (!hasHistory) parts.push(`Since this is a new repo with no commit history, use this default style:`, `- Conventional commits format (feat:, fix:, chore:, docs:, refactor:, etc.)`, `- Imperative mood, lowercase after prefix`, `- Subject line, then a blank line, then an optional body with 1-3 bullet points summarizing key changes`, `- Do NOT hard-wrap body lines at any fixed width`, `- Only include body bullets when the diff warrants it — don't add filler`, ``);
|
|
1859
|
+
parts.push(`INSTRUCTIONS:`, `1. Study the commit history above carefully. Notice the format, conventions, tone, and style.`, ` - Do they use conventional commits (feat:, fix:, etc.)?`, ` - Gitmoji? Ticket prefixes? Brackets?`, ` - Imperative mood or past tense?`, ` - Capitalized or lowercase?`, ` - Subject-only, or subject + body?`, ` - What level of detail?`, `2. Generate a commit message for the staged changes that **matches the repo's existing style exactly**.`, `3. Do NOT invent issue/ticket numbers unless they appear in the diff.`, `4. If the style uses a subject + body format, separate them with a blank line.`, ` Do NOT hard-wrap body lines at any fixed width — let each point be a single unwrapped line.`, `5. When the repo has no established style, default to conventional commits (feat:, fix:, chore:, etc.)`, ` with an optional body of 1-3 concise bullet points. Do not hard-wrap lines. Only include bullets`, ` when the changes are complex enough to warrant them — do not pad with filler.`, `6. Disregard generated files (lockfiles, migration files, build output, etc.) when evaluating changes.`, ` Focus on the human-authored source changes to determine the commit message.`, `7. NEVER add "Co-authored-by", "Signed-off-by", or any git trailers to the commit message.`);
|
|
2537
1860
|
if (instructions) parts.push(``, `ADDITIONAL USER INSTRUCTIONS:`, instructions);
|
|
2538
1861
|
parts.push(``, `REMINDER: Output ONLY the raw commit message text. No quotes, no markdown fences, no explanation, no preamble.`);
|
|
2539
1862
|
return parts.join("\n");
|
|
@@ -2583,80 +1906,75 @@ function truncateDiff(diff, maxChars) {
|
|
|
2583
1906
|
if (result.length < diff.length) result += "\n\n[... diff truncated — stat summary above covers all files ...]";
|
|
2584
1907
|
return result;
|
|
2585
1908
|
}
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
throw new Error(`
|
|
1909
|
+
const providers = {
|
|
1910
|
+
claude: {
|
|
1911
|
+
name: "Claude",
|
|
1912
|
+
bin: "claude",
|
|
1913
|
+
versionArgs: ["--version"],
|
|
1914
|
+
defaultModel: "sonnet",
|
|
1915
|
+
buildArgs({ userPrompt, systemPrompt, model }) {
|
|
1916
|
+
return [
|
|
1917
|
+
"-p",
|
|
1918
|
+
userPrompt,
|
|
1919
|
+
"--output-format",
|
|
1920
|
+
"json",
|
|
1921
|
+
"--model",
|
|
1922
|
+
model,
|
|
1923
|
+
"--tools",
|
|
1924
|
+
"",
|
|
1925
|
+
"--strict-mcp-config",
|
|
1926
|
+
"--no-session-persistence",
|
|
1927
|
+
"--system-prompt",
|
|
1928
|
+
systemPrompt
|
|
1929
|
+
];
|
|
1930
|
+
},
|
|
1931
|
+
parseOutput(stdout) {
|
|
1932
|
+
let parsed;
|
|
1933
|
+
try {
|
|
1934
|
+
parsed = JSON.parse(stdout);
|
|
1935
|
+
} catch {
|
|
1936
|
+
throw new Error(`Failed to parse Claude response as JSON. Raw output:\n${stdout.slice(0, 500)}`);
|
|
1937
|
+
}
|
|
1938
|
+
if (parsed.is_error) throw new Error(`Claude error: ${parsed.result}`);
|
|
1939
|
+
const result = (parsed.result || "").trim();
|
|
1940
|
+
if (!result) throw new Error("Claude returned an empty commit message.");
|
|
1941
|
+
return result;
|
|
2616
1942
|
}
|
|
2617
|
-
if (parsed.is_error) throw new Error(`Claude error: ${parsed.result}`);
|
|
2618
|
-
const result = (parsed.result || "").trim();
|
|
2619
|
-
if (!result) throw new Error("Claude returned an empty commit message.");
|
|
2620
|
-
return result;
|
|
2621
|
-
}
|
|
2622
|
-
};
|
|
2623
|
-
const codex = {
|
|
2624
|
-
name: "Codex",
|
|
2625
|
-
bin: "codex",
|
|
2626
|
-
versionArgs: ["--version"],
|
|
2627
|
-
defaultModel: "gpt-5.1-codex-mini",
|
|
2628
|
-
buildArgs({ userPrompt, systemPrompt, model }) {
|
|
2629
|
-
return [
|
|
2630
|
-
"exec",
|
|
2631
|
-
userPrompt,
|
|
2632
|
-
"--model",
|
|
2633
|
-
model,
|
|
2634
|
-
"-c",
|
|
2635
|
-
`developer_instructions=${systemPrompt}`,
|
|
2636
|
-
"-c",
|
|
2637
|
-
"model_reasoning_effort=medium",
|
|
2638
|
-
"-c",
|
|
2639
|
-
"check_for_update_on_startup=false",
|
|
2640
|
-
"--ephemeral",
|
|
2641
|
-
"--sandbox",
|
|
2642
|
-
"read-only"
|
|
2643
|
-
];
|
|
2644
1943
|
},
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
1944
|
+
codex: {
|
|
1945
|
+
name: "Codex",
|
|
1946
|
+
bin: "codex",
|
|
1947
|
+
versionArgs: ["--version"],
|
|
1948
|
+
defaultModel: "gpt-5.1-codex-mini",
|
|
1949
|
+
buildArgs({ userPrompt, systemPrompt, model }) {
|
|
1950
|
+
return [
|
|
1951
|
+
"exec",
|
|
1952
|
+
userPrompt,
|
|
1953
|
+
"--model",
|
|
1954
|
+
model,
|
|
1955
|
+
"-c",
|
|
1956
|
+
`developer_instructions=${systemPrompt}`,
|
|
1957
|
+
"-c",
|
|
1958
|
+
"model_reasoning_effort=medium",
|
|
1959
|
+
"-c",
|
|
1960
|
+
"check_for_update_on_startup=false",
|
|
1961
|
+
"--ephemeral",
|
|
1962
|
+
"--sandbox",
|
|
1963
|
+
"read-only"
|
|
1964
|
+
];
|
|
1965
|
+
},
|
|
1966
|
+
parseOutput(stdout) {
|
|
1967
|
+
const result = stdout.trim();
|
|
1968
|
+
if (!result) throw new Error("Codex returned an empty commit message.");
|
|
1969
|
+
return result;
|
|
1970
|
+
}
|
|
2649
1971
|
}
|
|
2650
1972
|
};
|
|
2651
|
-
const providers = {
|
|
2652
|
-
claude,
|
|
2653
|
-
codex
|
|
2654
|
-
};
|
|
2655
1973
|
/**
|
|
2656
1974
|
* Check that a provider's CLI binary is installed and accessible.
|
|
2657
1975
|
*/
|
|
2658
1976
|
async function ensureProvider(provider) {
|
|
2659
|
-
const { exitCode } = await
|
|
1977
|
+
const { exitCode } = await z(provider.bin, provider.versionArgs, { nodeOptions: { stdio: [
|
|
2660
1978
|
"ignore",
|
|
2661
1979
|
"pipe",
|
|
2662
1980
|
"pipe"
|
|
@@ -2667,15 +1985,17 @@ async function ensureProvider(provider) {
|
|
|
2667
1985
|
* Generate a commit message using the given provider's CLI.
|
|
2668
1986
|
*/
|
|
2669
1987
|
async function generateCommitMessage(provider, opts) {
|
|
2670
|
-
const { diff, stat, files, commitLog, model, instructions } = opts;
|
|
1988
|
+
const { diff, stat, files, commitLog, model, instructions, log } = opts;
|
|
2671
1989
|
const systemPrompt = buildSystemPrompt(commitLog, instructions);
|
|
2672
1990
|
const userPrompt = buildUserPrompt(diff, stat, files);
|
|
1991
|
+
log?.(`System prompt:\n${systemPrompt}`);
|
|
1992
|
+
log?.(`User prompt:\n${userPrompt}`);
|
|
2673
1993
|
const args = provider.buildArgs({
|
|
2674
1994
|
userPrompt,
|
|
2675
1995
|
systemPrompt,
|
|
2676
1996
|
model
|
|
2677
1997
|
});
|
|
2678
|
-
const { stdout, stderr, exitCode } = await
|
|
1998
|
+
const { stdout, stderr, exitCode } = await z(provider.bin, args, {
|
|
2679
1999
|
timeout: 12e4,
|
|
2680
2000
|
nodeOptions: { stdio: [
|
|
2681
2001
|
"ignore",
|
|
@@ -2683,10 +2003,10 @@ async function generateCommitMessage(provider, opts) {
|
|
|
2683
2003
|
"pipe"
|
|
2684
2004
|
] }
|
|
2685
2005
|
});
|
|
2006
|
+
log?.(`Raw response:\n${stdout}${stderr ? `\nStderr:\n${stderr}` : ""}`);
|
|
2686
2007
|
if (exitCode !== 0) throw new Error(`${provider.name} exited with code ${exitCode}\n${stderr || stdout}`);
|
|
2687
2008
|
return provider.parseOutput(stdout);
|
|
2688
2009
|
}
|
|
2689
|
-
|
|
2690
2010
|
//#endregion
|
|
2691
2011
|
//#region src/args.ts
|
|
2692
2012
|
const DEFAULT_PROVIDER = "claude";
|
|
@@ -2703,6 +2023,10 @@ const options = {
|
|
|
2703
2023
|
type: "boolean",
|
|
2704
2024
|
short: "y"
|
|
2705
2025
|
},
|
|
2026
|
+
verbose: {
|
|
2027
|
+
type: "boolean",
|
|
2028
|
+
short: "v"
|
|
2029
|
+
},
|
|
2706
2030
|
help: {
|
|
2707
2031
|
type: "boolean",
|
|
2708
2032
|
short: "h"
|
|
@@ -2718,6 +2042,7 @@ function parseConfig() {
|
|
|
2718
2042
|
provider: values.provider ?? process.env.ACAI_PROVIDER ?? DEFAULT_PROVIDER,
|
|
2719
2043
|
model: values.model ?? process.env.ACAI_MODEL ?? "",
|
|
2720
2044
|
yolo: values.yolo ?? false,
|
|
2045
|
+
verbose: values.verbose ?? false,
|
|
2721
2046
|
help: values.help ?? false
|
|
2722
2047
|
};
|
|
2723
2048
|
}
|
|
@@ -2732,6 +2057,7 @@ Options:
|
|
|
2732
2057
|
-m, --model <model> Model to use (default: provider-specific)
|
|
2733
2058
|
Can also set ACAI_MODEL env var
|
|
2734
2059
|
-y, --yolo Stage all changes and commit without confirmation
|
|
2060
|
+
-v, --verbose Print prompts sent to the provider and raw responses
|
|
2735
2061
|
-h, --help Show this help message
|
|
2736
2062
|
|
|
2737
2063
|
Examples:
|
|
@@ -2742,19 +2068,18 @@ Examples:
|
|
|
2742
2068
|
acai --yolo # skip interaction and commit all changes
|
|
2743
2069
|
`.trimStart());
|
|
2744
2070
|
}
|
|
2745
|
-
|
|
2746
2071
|
//#endregion
|
|
2747
2072
|
//#region src/git.ts
|
|
2748
2073
|
async function ensureGitRepo() {
|
|
2749
|
-
const { stdout, exitCode } = await
|
|
2074
|
+
const { stdout, exitCode } = await z("git", ["rev-parse", "--is-inside-work-tree"]);
|
|
2750
2075
|
if (exitCode !== 0 || stdout.trim() !== "true") throw new Error("Not inside a git repository.");
|
|
2751
2076
|
}
|
|
2752
2077
|
async function getStagedDiff() {
|
|
2753
|
-
const { stdout, exitCode } = await
|
|
2078
|
+
const { stdout, exitCode } = await z("git", ["diff", "--cached"]);
|
|
2754
2079
|
return exitCode === 0 ? stdout.trim() : null;
|
|
2755
2080
|
}
|
|
2756
2081
|
async function getStagedStat() {
|
|
2757
|
-
const { stdout, exitCode } = await
|
|
2082
|
+
const { stdout, exitCode } = await z("git", [
|
|
2758
2083
|
"diff",
|
|
2759
2084
|
"--cached",
|
|
2760
2085
|
"--stat"
|
|
@@ -2762,7 +2087,7 @@ async function getStagedStat() {
|
|
|
2762
2087
|
return exitCode === 0 ? stdout.trim() : null;
|
|
2763
2088
|
}
|
|
2764
2089
|
async function getStagedFiles() {
|
|
2765
|
-
const { stdout, exitCode } = await
|
|
2090
|
+
const { stdout, exitCode } = await z("git", [
|
|
2766
2091
|
"diff",
|
|
2767
2092
|
"--cached",
|
|
2768
2093
|
"--name-only"
|
|
@@ -2775,7 +2100,7 @@ async function getStagedFiles() {
|
|
|
2775
2100
|
* Parses the index (XY) columns of `git status --porcelain`.
|
|
2776
2101
|
*/
|
|
2777
2102
|
async function getUnstagedFiles() {
|
|
2778
|
-
const { stdout, exitCode } = await
|
|
2103
|
+
const { stdout, exitCode } = await z("git", [
|
|
2779
2104
|
"status",
|
|
2780
2105
|
"--porcelain",
|
|
2781
2106
|
"-z"
|
|
@@ -2806,11 +2131,11 @@ async function getUnstagedFiles() {
|
|
|
2806
2131
|
return files;
|
|
2807
2132
|
}
|
|
2808
2133
|
async function stageAll() {
|
|
2809
|
-
await
|
|
2134
|
+
await z("git", ["add", "-A"], { throwOnError: true });
|
|
2810
2135
|
}
|
|
2811
2136
|
async function stageFiles(paths) {
|
|
2812
2137
|
if (paths.length === 0) return;
|
|
2813
|
-
await
|
|
2138
|
+
await z("git", [
|
|
2814
2139
|
"add",
|
|
2815
2140
|
"--",
|
|
2816
2141
|
...paths
|
|
@@ -2820,7 +2145,7 @@ async function stageFiles(paths) {
|
|
|
2820
2145
|
* Get the last N non-merge commit messages (subject + body).
|
|
2821
2146
|
*/
|
|
2822
2147
|
async function getRecentCommitLog(count = 10) {
|
|
2823
|
-
const { stdout, exitCode } = await
|
|
2148
|
+
const { stdout, exitCode } = await z("git", [
|
|
2824
2149
|
"log",
|
|
2825
2150
|
`--format=%s%n%b%n---`,
|
|
2826
2151
|
`-n`,
|
|
@@ -2837,7 +2162,7 @@ async function commit(message) {
|
|
|
2837
2162
|
const tmpPath = join(tmpDir, "commit-msg.txt");
|
|
2838
2163
|
writeFileSync(tmpPath, message, "utf-8");
|
|
2839
2164
|
try {
|
|
2840
|
-
await
|
|
2165
|
+
await z("git", [
|
|
2841
2166
|
"commit",
|
|
2842
2167
|
"-F",
|
|
2843
2168
|
tmpPath
|
|
@@ -2848,7 +2173,6 @@ async function commit(message) {
|
|
|
2848
2173
|
} catch {}
|
|
2849
2174
|
}
|
|
2850
2175
|
}
|
|
2851
|
-
|
|
2852
2176
|
//#endregion
|
|
2853
2177
|
//#region bin/cli.ts
|
|
2854
2178
|
async function main() {
|
|
@@ -2864,58 +2188,58 @@ async function main() {
|
|
|
2864
2188
|
process.exit(1);
|
|
2865
2189
|
}
|
|
2866
2190
|
const model = config.model || provider.defaultModel;
|
|
2867
|
-
|
|
2868
|
-
const s =
|
|
2191
|
+
Wt("acai");
|
|
2192
|
+
const s = be();
|
|
2869
2193
|
try {
|
|
2870
2194
|
await ensureGitRepo();
|
|
2871
2195
|
} catch {
|
|
2872
|
-
|
|
2196
|
+
Nt("Not a git repository.");
|
|
2873
2197
|
process.exit(1);
|
|
2874
2198
|
}
|
|
2875
2199
|
try {
|
|
2876
2200
|
await ensureProvider(provider);
|
|
2877
2201
|
} catch (e) {
|
|
2878
|
-
|
|
2202
|
+
Nt(e.message);
|
|
2879
2203
|
process.exit(1);
|
|
2880
2204
|
}
|
|
2881
2205
|
let diff = await getStagedDiff();
|
|
2882
2206
|
if (!diff) {
|
|
2883
2207
|
const unstaged = await getUnstagedFiles();
|
|
2884
2208
|
if (unstaged.length === 0) {
|
|
2885
|
-
|
|
2209
|
+
Nt("Nothing to commit — working tree clean.");
|
|
2886
2210
|
process.exit(0);
|
|
2887
2211
|
}
|
|
2888
2212
|
if (config.yolo) await stageAll();
|
|
2889
2213
|
else {
|
|
2890
|
-
const shouldStage = await
|
|
2214
|
+
const shouldStage = await Rt({
|
|
2891
2215
|
message: "Stage all changes?",
|
|
2892
2216
|
initialValue: true
|
|
2893
2217
|
});
|
|
2894
2218
|
if (Ct$1(shouldStage)) {
|
|
2895
|
-
|
|
2219
|
+
Nt("Aborted.");
|
|
2896
2220
|
process.exit(0);
|
|
2897
2221
|
}
|
|
2898
2222
|
if (shouldStage) await stageAll();
|
|
2899
2223
|
else if (!await promptFilePicker(unstaged, "Select files to stage")) {
|
|
2900
|
-
|
|
2224
|
+
Nt("Nothing staged.");
|
|
2901
2225
|
process.exit(0);
|
|
2902
2226
|
}
|
|
2903
2227
|
}
|
|
2904
2228
|
diff = await getStagedDiff();
|
|
2905
2229
|
if (!diff) {
|
|
2906
|
-
|
|
2230
|
+
Nt("Still no diff after staging. Nothing to commit.");
|
|
2907
2231
|
process.exit(0);
|
|
2908
2232
|
}
|
|
2909
2233
|
}
|
|
2910
2234
|
if (!config.yolo) {
|
|
2911
2235
|
const remaining = await getUnstagedFiles();
|
|
2912
2236
|
if (remaining.length > 0) {
|
|
2913
|
-
const addMore = await
|
|
2237
|
+
const addMore = await Rt({
|
|
2914
2238
|
message: `${remaining.length} other changed file${remaining.length === 1 ? "" : "s"} not staged. Add more?`,
|
|
2915
2239
|
initialValue: false
|
|
2916
2240
|
});
|
|
2917
2241
|
if (Ct$1(addMore)) {
|
|
2918
|
-
|
|
2242
|
+
Nt("Aborted.");
|
|
2919
2243
|
process.exit(0);
|
|
2920
2244
|
}
|
|
2921
2245
|
if (addMore) {
|
|
@@ -2942,11 +2266,12 @@ async function main() {
|
|
|
2942
2266
|
files,
|
|
2943
2267
|
commitLog,
|
|
2944
2268
|
model,
|
|
2945
|
-
instructions
|
|
2269
|
+
instructions,
|
|
2270
|
+
log: config.verbose ? (msg) => R$1.message(import_picocolors.default.dim(msg)) : void 0
|
|
2946
2271
|
});
|
|
2947
2272
|
} catch (e) {
|
|
2948
2273
|
s.stop("Failed");
|
|
2949
|
-
|
|
2274
|
+
Nt(`Generation failed: ${e.message}`);
|
|
2950
2275
|
process.exit(1);
|
|
2951
2276
|
}
|
|
2952
2277
|
s.stop(`Here's what ${provider.name} ${import_picocolors.default.dim(`(${model})`)} came up with:`);
|
|
@@ -2955,7 +2280,7 @@ async function main() {
|
|
|
2955
2280
|
await doCommit(message);
|
|
2956
2281
|
break;
|
|
2957
2282
|
}
|
|
2958
|
-
const action = await
|
|
2283
|
+
const action = await Jt({
|
|
2959
2284
|
message: "What should we do?",
|
|
2960
2285
|
options: [
|
|
2961
2286
|
{
|
|
@@ -2984,7 +2309,7 @@ async function main() {
|
|
|
2984
2309
|
]
|
|
2985
2310
|
});
|
|
2986
2311
|
if (Ct$1(action) || action === "cancel") {
|
|
2987
|
-
|
|
2312
|
+
Nt("Aborted.");
|
|
2988
2313
|
process.exit(0);
|
|
2989
2314
|
}
|
|
2990
2315
|
if (action === "commit") {
|
|
@@ -3002,11 +2327,11 @@ async function main() {
|
|
|
3002
2327
|
}
|
|
3003
2328
|
if (action === "copy") {
|
|
3004
2329
|
await copyToClipboard(message);
|
|
3005
|
-
|
|
2330
|
+
Gt("Copied to clipboard.");
|
|
3006
2331
|
process.exit(0);
|
|
3007
2332
|
}
|
|
3008
2333
|
if (action === "revise") {
|
|
3009
|
-
const feedback = await
|
|
2334
|
+
const feedback = await Zt({
|
|
3010
2335
|
message: `What should ${provider.name} change?`,
|
|
3011
2336
|
placeholder: "e.g. make it shorter, mention the API refactor, use past tense…"
|
|
3012
2337
|
});
|
|
@@ -3034,7 +2359,7 @@ async function promptFilePicker(files, message) {
|
|
|
3034
2359
|
label: file.path
|
|
3035
2360
|
});
|
|
3036
2361
|
}
|
|
3037
|
-
const selected = await
|
|
2362
|
+
const selected = await Pt({
|
|
3038
2363
|
message,
|
|
3039
2364
|
options: groups
|
|
3040
2365
|
});
|
|
@@ -3043,14 +2368,14 @@ async function promptFilePicker(files, message) {
|
|
|
3043
2368
|
return true;
|
|
3044
2369
|
}
|
|
3045
2370
|
async function doCommit(message) {
|
|
3046
|
-
const s =
|
|
2371
|
+
const s = be();
|
|
3047
2372
|
s.start("Committing");
|
|
3048
2373
|
try {
|
|
3049
2374
|
await commit(message);
|
|
3050
2375
|
s.stop("Committed!");
|
|
3051
2376
|
} catch (e) {
|
|
3052
2377
|
s.stop("Failed");
|
|
3053
|
-
|
|
2378
|
+
Nt(`Commit failed: ${e.message}`);
|
|
3054
2379
|
process.exit(1);
|
|
3055
2380
|
}
|
|
3056
2381
|
}
|
|
@@ -3117,9 +2442,8 @@ async function copyToClipboard(text) {
|
|
|
3117
2442
|
console.log(text);
|
|
3118
2443
|
}
|
|
3119
2444
|
main().catch((e) => {
|
|
3120
|
-
|
|
2445
|
+
Nt(e.message);
|
|
3121
2446
|
process.exit(1);
|
|
3122
2447
|
});
|
|
3123
|
-
|
|
3124
2448
|
//#endregion
|
|
3125
|
-
export {
|
|
2449
|
+
export {};
|