levante 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-2pkertsv.js +936 -0
- package/dist/cli-92c6g8hy.js +263 -0
- package/dist/cli-hfteq0z5.js +76 -0
- package/dist/cli-k9cte8rh.js +888 -0
- package/dist/cli-kysyzfpx.js +251 -0
- package/dist/cli-pz51hgax.js +936 -0
- package/dist/cli-r8kj2y2g.js +888 -0
- package/dist/cli-wayz3w81.js +1881 -0
- package/dist/cli-xty0cr8k.js +13612 -0
- package/dist/cli.js +514 -2016
- package/dist/config/schema.js +1 -1
- package/dist/index-55bhcbyf.js +19 -0
- package/dist/index-c7tmqtec.js +19 -0
- package/dist/index-d4by4amj.js +19 -0
- package/dist/index-fbvbnntc.js +19 -0
- package/dist/index-pzzp72dd.js +27 -0
- package/dist/index.js +2 -2
- package/dist/mcp.js +3 -3
- package/package.json +3 -1
- package/scripts/auth/setup-auth.mjs +4 -11
- package/scripts/codegen-env.mjs +358 -76
- package/scripts/companion/open-url.mjs +20 -0
- package/scripts/companion/server.mjs +258 -0
- package/scripts/companion/state.mjs +97 -0
- package/scripts/companion/ui/companion.html +681 -0
- package/scripts/companion/ui/pill.js +65 -0
- package/scripts/ui.mjs +98 -0
|
@@ -0,0 +1,1881 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__require,
|
|
4
|
+
__toESM
|
|
5
|
+
} from "./cli-wckvcay0.js";
|
|
6
|
+
|
|
7
|
+
// ../../node_modules/.bun/cli-width@4.1.0/node_modules/cli-width/index.js
|
|
8
|
+
var require_cli_width = __commonJS((exports, module) => {
|
|
9
|
+
module.exports = cliWidth;
|
|
10
|
+
function normalizeOpts(options) {
|
|
11
|
+
const defaultOpts = {
|
|
12
|
+
defaultWidth: 0,
|
|
13
|
+
output: process.stdout,
|
|
14
|
+
tty: __require("tty")
|
|
15
|
+
};
|
|
16
|
+
if (!options) {
|
|
17
|
+
return defaultOpts;
|
|
18
|
+
}
|
|
19
|
+
Object.keys(defaultOpts).forEach(function(key) {
|
|
20
|
+
if (!options[key]) {
|
|
21
|
+
options[key] = defaultOpts[key];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return options;
|
|
25
|
+
}
|
|
26
|
+
function cliWidth(options) {
|
|
27
|
+
const opts = normalizeOpts(options);
|
|
28
|
+
if (opts.output.getWindowSize) {
|
|
29
|
+
return opts.output.getWindowSize()[0] || opts.defaultWidth;
|
|
30
|
+
}
|
|
31
|
+
if (opts.tty.getWindowSize) {
|
|
32
|
+
return opts.tty.getWindowSize()[1] || opts.defaultWidth;
|
|
33
|
+
}
|
|
34
|
+
if (opts.output.columns) {
|
|
35
|
+
return opts.output.columns;
|
|
36
|
+
}
|
|
37
|
+
if (process.env.CLI_WIDTH) {
|
|
38
|
+
const width = parseInt(process.env.CLI_WIDTH, 10);
|
|
39
|
+
if (!isNaN(width) && width !== 0) {
|
|
40
|
+
return width;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return opts.defaultWidth;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// ../../node_modules/.bun/mute-stream@3.0.0/node_modules/mute-stream/lib/index.js
|
|
48
|
+
var require_lib = __commonJS((exports, module) => {
|
|
49
|
+
var Stream = __require("stream");
|
|
50
|
+
|
|
51
|
+
class MuteStream extends Stream {
|
|
52
|
+
#isTTY = null;
|
|
53
|
+
constructor(opts = {}) {
|
|
54
|
+
super(opts);
|
|
55
|
+
this.writable = this.readable = true;
|
|
56
|
+
this.muted = false;
|
|
57
|
+
this.on("pipe", this._onpipe);
|
|
58
|
+
this.replace = opts.replace;
|
|
59
|
+
this._prompt = opts.prompt || null;
|
|
60
|
+
this._hadControl = false;
|
|
61
|
+
}
|
|
62
|
+
#destSrc(key, def) {
|
|
63
|
+
if (this._dest) {
|
|
64
|
+
return this._dest[key];
|
|
65
|
+
}
|
|
66
|
+
if (this._src) {
|
|
67
|
+
return this._src[key];
|
|
68
|
+
}
|
|
69
|
+
return def;
|
|
70
|
+
}
|
|
71
|
+
#proxy(method, ...args) {
|
|
72
|
+
if (typeof this._dest?.[method] === "function") {
|
|
73
|
+
this._dest[method](...args);
|
|
74
|
+
}
|
|
75
|
+
if (typeof this._src?.[method] === "function") {
|
|
76
|
+
this._src[method](...args);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
get isTTY() {
|
|
80
|
+
if (this.#isTTY !== null) {
|
|
81
|
+
return this.#isTTY;
|
|
82
|
+
}
|
|
83
|
+
return this.#destSrc("isTTY", false);
|
|
84
|
+
}
|
|
85
|
+
set isTTY(val) {
|
|
86
|
+
this.#isTTY = val;
|
|
87
|
+
}
|
|
88
|
+
get rows() {
|
|
89
|
+
return this.#destSrc("rows");
|
|
90
|
+
}
|
|
91
|
+
get columns() {
|
|
92
|
+
return this.#destSrc("columns");
|
|
93
|
+
}
|
|
94
|
+
mute() {
|
|
95
|
+
this.muted = true;
|
|
96
|
+
}
|
|
97
|
+
unmute() {
|
|
98
|
+
this.muted = false;
|
|
99
|
+
}
|
|
100
|
+
_onpipe(src) {
|
|
101
|
+
this._src = src;
|
|
102
|
+
}
|
|
103
|
+
pipe(dest, options) {
|
|
104
|
+
this._dest = dest;
|
|
105
|
+
return super.pipe(dest, options);
|
|
106
|
+
}
|
|
107
|
+
pause() {
|
|
108
|
+
if (this._src) {
|
|
109
|
+
return this._src.pause();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
resume() {
|
|
113
|
+
if (this._src) {
|
|
114
|
+
return this._src.resume();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
write(c) {
|
|
118
|
+
if (this.muted) {
|
|
119
|
+
if (!this.replace) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
if (c.match(/^\u001b/)) {
|
|
123
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
124
|
+
c = c.slice(this._prompt.length);
|
|
125
|
+
c = c.replace(/./g, this.replace);
|
|
126
|
+
c = this._prompt + c;
|
|
127
|
+
}
|
|
128
|
+
this._hadControl = true;
|
|
129
|
+
return this.emit("data", c);
|
|
130
|
+
} else {
|
|
131
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
132
|
+
this._hadControl = false;
|
|
133
|
+
this.emit("data", this._prompt);
|
|
134
|
+
c = c.slice(this._prompt.length);
|
|
135
|
+
}
|
|
136
|
+
c = c.toString().replace(/./g, this.replace);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
this.emit("data", c);
|
|
140
|
+
}
|
|
141
|
+
end(c) {
|
|
142
|
+
if (this.muted) {
|
|
143
|
+
if (c && this.replace) {
|
|
144
|
+
c = c.toString().replace(/./g, this.replace);
|
|
145
|
+
} else {
|
|
146
|
+
c = null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (c) {
|
|
150
|
+
this.emit("data", c);
|
|
151
|
+
}
|
|
152
|
+
this.emit("end");
|
|
153
|
+
}
|
|
154
|
+
destroy(...args) {
|
|
155
|
+
return this.#proxy("destroy", ...args);
|
|
156
|
+
}
|
|
157
|
+
destroySoon(...args) {
|
|
158
|
+
return this.#proxy("destroySoon", ...args);
|
|
159
|
+
}
|
|
160
|
+
close(...args) {
|
|
161
|
+
return this.#proxy("close", ...args);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
module.exports = MuteStream;
|
|
165
|
+
});
|
|
166
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/key.js
|
|
167
|
+
var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
168
|
+
var isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
169
|
+
var isBackspaceKey = (key) => key.name === "backspace";
|
|
170
|
+
var isTabKey = (key) => key.name === "tab";
|
|
171
|
+
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
172
|
+
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
173
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/errors.js
|
|
174
|
+
class AbortPromptError extends Error {
|
|
175
|
+
name = "AbortPromptError";
|
|
176
|
+
message = "Prompt was aborted";
|
|
177
|
+
constructor(options) {
|
|
178
|
+
super();
|
|
179
|
+
this.cause = options?.cause;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
class CancelPromptError extends Error {
|
|
184
|
+
name = "CancelPromptError";
|
|
185
|
+
message = "Prompt was canceled";
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
class ExitPromptError extends Error {
|
|
189
|
+
name = "ExitPromptError";
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
class HookError extends Error {
|
|
193
|
+
name = "HookError";
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
class ValidationError extends Error {
|
|
197
|
+
name = "ValidationError";
|
|
198
|
+
}
|
|
199
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
200
|
+
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
201
|
+
|
|
202
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
203
|
+
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
204
|
+
var hookStorage = new AsyncLocalStorage;
|
|
205
|
+
function createStore(rl) {
|
|
206
|
+
const store = {
|
|
207
|
+
rl,
|
|
208
|
+
hooks: [],
|
|
209
|
+
hooksCleanup: [],
|
|
210
|
+
hooksEffect: [],
|
|
211
|
+
index: 0,
|
|
212
|
+
handleChange() {}
|
|
213
|
+
};
|
|
214
|
+
return store;
|
|
215
|
+
}
|
|
216
|
+
function withHooks(rl, cb) {
|
|
217
|
+
const store = createStore(rl);
|
|
218
|
+
return hookStorage.run(store, () => {
|
|
219
|
+
function cycle(render) {
|
|
220
|
+
store.handleChange = () => {
|
|
221
|
+
store.index = 0;
|
|
222
|
+
render();
|
|
223
|
+
};
|
|
224
|
+
store.handleChange();
|
|
225
|
+
}
|
|
226
|
+
return cb(cycle);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
function getStore() {
|
|
230
|
+
const store = hookStorage.getStore();
|
|
231
|
+
if (!store) {
|
|
232
|
+
throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
233
|
+
}
|
|
234
|
+
return store;
|
|
235
|
+
}
|
|
236
|
+
function readline() {
|
|
237
|
+
return getStore().rl;
|
|
238
|
+
}
|
|
239
|
+
function withUpdates(fn) {
|
|
240
|
+
const wrapped = (...args) => {
|
|
241
|
+
const store = getStore();
|
|
242
|
+
let shouldUpdate = false;
|
|
243
|
+
const oldHandleChange = store.handleChange;
|
|
244
|
+
store.handleChange = () => {
|
|
245
|
+
shouldUpdate = true;
|
|
246
|
+
};
|
|
247
|
+
const returnValue = fn(...args);
|
|
248
|
+
if (shouldUpdate) {
|
|
249
|
+
oldHandleChange();
|
|
250
|
+
}
|
|
251
|
+
store.handleChange = oldHandleChange;
|
|
252
|
+
return returnValue;
|
|
253
|
+
};
|
|
254
|
+
return AsyncResource.bind(wrapped);
|
|
255
|
+
}
|
|
256
|
+
function withPointer(cb) {
|
|
257
|
+
const store = getStore();
|
|
258
|
+
const { index } = store;
|
|
259
|
+
const pointer = {
|
|
260
|
+
get() {
|
|
261
|
+
return store.hooks[index];
|
|
262
|
+
},
|
|
263
|
+
set(value) {
|
|
264
|
+
store.hooks[index] = value;
|
|
265
|
+
},
|
|
266
|
+
initialized: index in store.hooks
|
|
267
|
+
};
|
|
268
|
+
const returnValue = cb(pointer);
|
|
269
|
+
store.index++;
|
|
270
|
+
return returnValue;
|
|
271
|
+
}
|
|
272
|
+
function handleChange() {
|
|
273
|
+
getStore().handleChange();
|
|
274
|
+
}
|
|
275
|
+
var effectScheduler = {
|
|
276
|
+
queue(cb) {
|
|
277
|
+
const store = getStore();
|
|
278
|
+
const { index } = store;
|
|
279
|
+
store.hooksEffect.push(() => {
|
|
280
|
+
store.hooksCleanup[index]?.();
|
|
281
|
+
const cleanFn = cb(readline());
|
|
282
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
283
|
+
throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
284
|
+
}
|
|
285
|
+
store.hooksCleanup[index] = cleanFn;
|
|
286
|
+
});
|
|
287
|
+
},
|
|
288
|
+
run() {
|
|
289
|
+
const store = getStore();
|
|
290
|
+
withUpdates(() => {
|
|
291
|
+
store.hooksEffect.forEach((effect) => {
|
|
292
|
+
effect();
|
|
293
|
+
});
|
|
294
|
+
store.hooksEffect.length = 0;
|
|
295
|
+
})();
|
|
296
|
+
},
|
|
297
|
+
clearAll() {
|
|
298
|
+
const store = getStore();
|
|
299
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
300
|
+
cleanFn?.();
|
|
301
|
+
});
|
|
302
|
+
store.hooksEffect.length = 0;
|
|
303
|
+
store.hooksCleanup.length = 0;
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
308
|
+
function useState(defaultValue) {
|
|
309
|
+
return withPointer((pointer) => {
|
|
310
|
+
const setState = AsyncResource2.bind(function setState2(newValue) {
|
|
311
|
+
if (pointer.get() !== newValue) {
|
|
312
|
+
pointer.set(newValue);
|
|
313
|
+
handleChange();
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
if (pointer.initialized) {
|
|
317
|
+
return [pointer.get(), setState];
|
|
318
|
+
}
|
|
319
|
+
const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
320
|
+
pointer.set(value);
|
|
321
|
+
return [value, setState];
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
326
|
+
function useEffect(cb, depArray) {
|
|
327
|
+
withPointer((pointer) => {
|
|
328
|
+
const oldDeps = pointer.get();
|
|
329
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
330
|
+
if (hasChanged) {
|
|
331
|
+
effectScheduler.queue(cb);
|
|
332
|
+
}
|
|
333
|
+
pointer.set(depArray);
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/theme.js
|
|
338
|
+
import { styleText } from "node:util";
|
|
339
|
+
|
|
340
|
+
// ../../node_modules/.bun/@inquirer+figures@2.0.3/node_modules/@inquirer/figures/dist/index.js
|
|
341
|
+
import process2 from "node:process";
|
|
342
|
+
function isUnicodeSupported() {
|
|
343
|
+
if (process2.platform !== "win32") {
|
|
344
|
+
return process2.env["TERM"] !== "linux";
|
|
345
|
+
}
|
|
346
|
+
return Boolean(process2.env["WT_SESSION"]) || Boolean(process2.env["TERMINUS_SUBLIME"]) || process2.env["ConEmuTask"] === "{cmd::Cmder}" || process2.env["TERM_PROGRAM"] === "Terminus-Sublime" || process2.env["TERM_PROGRAM"] === "vscode" || process2.env["TERM"] === "xterm-256color" || process2.env["TERM"] === "alacritty" || process2.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
|
|
347
|
+
}
|
|
348
|
+
var common = {
|
|
349
|
+
circleQuestionMark: "(?)",
|
|
350
|
+
questionMarkPrefix: "(?)",
|
|
351
|
+
square: "█",
|
|
352
|
+
squareDarkShade: "▓",
|
|
353
|
+
squareMediumShade: "▒",
|
|
354
|
+
squareLightShade: "░",
|
|
355
|
+
squareTop: "▀",
|
|
356
|
+
squareBottom: "▄",
|
|
357
|
+
squareLeft: "▌",
|
|
358
|
+
squareRight: "▐",
|
|
359
|
+
squareCenter: "■",
|
|
360
|
+
bullet: "●",
|
|
361
|
+
dot: "․",
|
|
362
|
+
ellipsis: "…",
|
|
363
|
+
pointerSmall: "›",
|
|
364
|
+
triangleUp: "▲",
|
|
365
|
+
triangleUpSmall: "▴",
|
|
366
|
+
triangleDown: "▼",
|
|
367
|
+
triangleDownSmall: "▾",
|
|
368
|
+
triangleLeftSmall: "◂",
|
|
369
|
+
triangleRightSmall: "▸",
|
|
370
|
+
home: "⌂",
|
|
371
|
+
heart: "♥",
|
|
372
|
+
musicNote: "♪",
|
|
373
|
+
musicNoteBeamed: "♫",
|
|
374
|
+
arrowUp: "↑",
|
|
375
|
+
arrowDown: "↓",
|
|
376
|
+
arrowLeft: "←",
|
|
377
|
+
arrowRight: "→",
|
|
378
|
+
arrowLeftRight: "↔",
|
|
379
|
+
arrowUpDown: "↕",
|
|
380
|
+
almostEqual: "≈",
|
|
381
|
+
notEqual: "≠",
|
|
382
|
+
lessOrEqual: "≤",
|
|
383
|
+
greaterOrEqual: "≥",
|
|
384
|
+
identical: "≡",
|
|
385
|
+
infinity: "∞",
|
|
386
|
+
subscriptZero: "₀",
|
|
387
|
+
subscriptOne: "₁",
|
|
388
|
+
subscriptTwo: "₂",
|
|
389
|
+
subscriptThree: "₃",
|
|
390
|
+
subscriptFour: "₄",
|
|
391
|
+
subscriptFive: "₅",
|
|
392
|
+
subscriptSix: "₆",
|
|
393
|
+
subscriptSeven: "₇",
|
|
394
|
+
subscriptEight: "₈",
|
|
395
|
+
subscriptNine: "₉",
|
|
396
|
+
oneHalf: "½",
|
|
397
|
+
oneThird: "⅓",
|
|
398
|
+
oneQuarter: "¼",
|
|
399
|
+
oneFifth: "⅕",
|
|
400
|
+
oneSixth: "⅙",
|
|
401
|
+
oneEighth: "⅛",
|
|
402
|
+
twoThirds: "⅔",
|
|
403
|
+
twoFifths: "⅖",
|
|
404
|
+
threeQuarters: "¾",
|
|
405
|
+
threeFifths: "⅗",
|
|
406
|
+
threeEighths: "⅜",
|
|
407
|
+
fourFifths: "⅘",
|
|
408
|
+
fiveSixths: "⅚",
|
|
409
|
+
fiveEighths: "⅝",
|
|
410
|
+
sevenEighths: "⅞",
|
|
411
|
+
line: "─",
|
|
412
|
+
lineBold: "━",
|
|
413
|
+
lineDouble: "═",
|
|
414
|
+
lineDashed0: "┄",
|
|
415
|
+
lineDashed1: "┅",
|
|
416
|
+
lineDashed2: "┈",
|
|
417
|
+
lineDashed3: "┉",
|
|
418
|
+
lineDashed4: "╌",
|
|
419
|
+
lineDashed5: "╍",
|
|
420
|
+
lineDashed6: "╴",
|
|
421
|
+
lineDashed7: "╶",
|
|
422
|
+
lineDashed8: "╸",
|
|
423
|
+
lineDashed9: "╺",
|
|
424
|
+
lineDashed10: "╼",
|
|
425
|
+
lineDashed11: "╾",
|
|
426
|
+
lineDashed12: "−",
|
|
427
|
+
lineDashed13: "–",
|
|
428
|
+
lineDashed14: "‐",
|
|
429
|
+
lineDashed15: "⁃",
|
|
430
|
+
lineVertical: "│",
|
|
431
|
+
lineVerticalBold: "┃",
|
|
432
|
+
lineVerticalDouble: "║",
|
|
433
|
+
lineVerticalDashed0: "┆",
|
|
434
|
+
lineVerticalDashed1: "┇",
|
|
435
|
+
lineVerticalDashed2: "┊",
|
|
436
|
+
lineVerticalDashed3: "┋",
|
|
437
|
+
lineVerticalDashed4: "╎",
|
|
438
|
+
lineVerticalDashed5: "╏",
|
|
439
|
+
lineVerticalDashed6: "╵",
|
|
440
|
+
lineVerticalDashed7: "╷",
|
|
441
|
+
lineVerticalDashed8: "╹",
|
|
442
|
+
lineVerticalDashed9: "╻",
|
|
443
|
+
lineVerticalDashed10: "╽",
|
|
444
|
+
lineVerticalDashed11: "╿",
|
|
445
|
+
lineDownLeft: "┐",
|
|
446
|
+
lineDownLeftArc: "╮",
|
|
447
|
+
lineDownBoldLeftBold: "┓",
|
|
448
|
+
lineDownBoldLeft: "┒",
|
|
449
|
+
lineDownLeftBold: "┑",
|
|
450
|
+
lineDownDoubleLeftDouble: "╗",
|
|
451
|
+
lineDownDoubleLeft: "╖",
|
|
452
|
+
lineDownLeftDouble: "╕",
|
|
453
|
+
lineDownRight: "┌",
|
|
454
|
+
lineDownRightArc: "╭",
|
|
455
|
+
lineDownBoldRightBold: "┏",
|
|
456
|
+
lineDownBoldRight: "┎",
|
|
457
|
+
lineDownRightBold: "┍",
|
|
458
|
+
lineDownDoubleRightDouble: "╔",
|
|
459
|
+
lineDownDoubleRight: "╓",
|
|
460
|
+
lineDownRightDouble: "╒",
|
|
461
|
+
lineUpLeft: "┘",
|
|
462
|
+
lineUpLeftArc: "╯",
|
|
463
|
+
lineUpBoldLeftBold: "┛",
|
|
464
|
+
lineUpBoldLeft: "┚",
|
|
465
|
+
lineUpLeftBold: "┙",
|
|
466
|
+
lineUpDoubleLeftDouble: "╝",
|
|
467
|
+
lineUpDoubleLeft: "╜",
|
|
468
|
+
lineUpLeftDouble: "╛",
|
|
469
|
+
lineUpRight: "└",
|
|
470
|
+
lineUpRightArc: "╰",
|
|
471
|
+
lineUpBoldRightBold: "┗",
|
|
472
|
+
lineUpBoldRight: "┖",
|
|
473
|
+
lineUpRightBold: "┕",
|
|
474
|
+
lineUpDoubleRightDouble: "╚",
|
|
475
|
+
lineUpDoubleRight: "╙",
|
|
476
|
+
lineUpRightDouble: "╘",
|
|
477
|
+
lineUpDownLeft: "┤",
|
|
478
|
+
lineUpBoldDownBoldLeftBold: "┫",
|
|
479
|
+
lineUpBoldDownBoldLeft: "┨",
|
|
480
|
+
lineUpDownLeftBold: "┥",
|
|
481
|
+
lineUpBoldDownLeftBold: "┩",
|
|
482
|
+
lineUpDownBoldLeftBold: "┪",
|
|
483
|
+
lineUpDownBoldLeft: "┧",
|
|
484
|
+
lineUpBoldDownLeft: "┦",
|
|
485
|
+
lineUpDoubleDownDoubleLeftDouble: "╣",
|
|
486
|
+
lineUpDoubleDownDoubleLeft: "╢",
|
|
487
|
+
lineUpDownLeftDouble: "╡",
|
|
488
|
+
lineUpDownRight: "├",
|
|
489
|
+
lineUpBoldDownBoldRightBold: "┣",
|
|
490
|
+
lineUpBoldDownBoldRight: "┠",
|
|
491
|
+
lineUpDownRightBold: "┝",
|
|
492
|
+
lineUpBoldDownRightBold: "┡",
|
|
493
|
+
lineUpDownBoldRightBold: "┢",
|
|
494
|
+
lineUpDownBoldRight: "┟",
|
|
495
|
+
lineUpBoldDownRight: "┞",
|
|
496
|
+
lineUpDoubleDownDoubleRightDouble: "╠",
|
|
497
|
+
lineUpDoubleDownDoubleRight: "╟",
|
|
498
|
+
lineUpDownRightDouble: "╞",
|
|
499
|
+
lineDownLeftRight: "┬",
|
|
500
|
+
lineDownBoldLeftBoldRightBold: "┳",
|
|
501
|
+
lineDownLeftBoldRightBold: "┯",
|
|
502
|
+
lineDownBoldLeftRight: "┰",
|
|
503
|
+
lineDownBoldLeftBoldRight: "┱",
|
|
504
|
+
lineDownBoldLeftRightBold: "┲",
|
|
505
|
+
lineDownLeftRightBold: "┮",
|
|
506
|
+
lineDownLeftBoldRight: "┭",
|
|
507
|
+
lineDownDoubleLeftDoubleRightDouble: "╦",
|
|
508
|
+
lineDownDoubleLeftRight: "╥",
|
|
509
|
+
lineDownLeftDoubleRightDouble: "╤",
|
|
510
|
+
lineUpLeftRight: "┴",
|
|
511
|
+
lineUpBoldLeftBoldRightBold: "┻",
|
|
512
|
+
lineUpLeftBoldRightBold: "┷",
|
|
513
|
+
lineUpBoldLeftRight: "┸",
|
|
514
|
+
lineUpBoldLeftBoldRight: "┹",
|
|
515
|
+
lineUpBoldLeftRightBold: "┺",
|
|
516
|
+
lineUpLeftRightBold: "┶",
|
|
517
|
+
lineUpLeftBoldRight: "┵",
|
|
518
|
+
lineUpDoubleLeftDoubleRightDouble: "╩",
|
|
519
|
+
lineUpDoubleLeftRight: "╨",
|
|
520
|
+
lineUpLeftDoubleRightDouble: "╧",
|
|
521
|
+
lineUpDownLeftRight: "┼",
|
|
522
|
+
lineUpBoldDownBoldLeftBoldRightBold: "╋",
|
|
523
|
+
lineUpDownBoldLeftBoldRightBold: "╈",
|
|
524
|
+
lineUpBoldDownLeftBoldRightBold: "╇",
|
|
525
|
+
lineUpBoldDownBoldLeftRightBold: "╊",
|
|
526
|
+
lineUpBoldDownBoldLeftBoldRight: "╉",
|
|
527
|
+
lineUpBoldDownLeftRight: "╀",
|
|
528
|
+
lineUpDownBoldLeftRight: "╁",
|
|
529
|
+
lineUpDownLeftBoldRight: "┽",
|
|
530
|
+
lineUpDownLeftRightBold: "┾",
|
|
531
|
+
lineUpBoldDownBoldLeftRight: "╂",
|
|
532
|
+
lineUpDownLeftBoldRightBold: "┿",
|
|
533
|
+
lineUpBoldDownLeftBoldRight: "╃",
|
|
534
|
+
lineUpBoldDownLeftRightBold: "╄",
|
|
535
|
+
lineUpDownBoldLeftBoldRight: "╅",
|
|
536
|
+
lineUpDownBoldLeftRightBold: "╆",
|
|
537
|
+
lineUpDoubleDownDoubleLeftDoubleRightDouble: "╬",
|
|
538
|
+
lineUpDoubleDownDoubleLeftRight: "╫",
|
|
539
|
+
lineUpDownLeftDoubleRightDouble: "╪",
|
|
540
|
+
lineCross: "╳",
|
|
541
|
+
lineBackslash: "╲",
|
|
542
|
+
lineSlash: "╱"
|
|
543
|
+
};
|
|
544
|
+
var specialMainSymbols = {
|
|
545
|
+
tick: "✔",
|
|
546
|
+
info: "ℹ",
|
|
547
|
+
warning: "⚠",
|
|
548
|
+
cross: "✘",
|
|
549
|
+
squareSmall: "◻",
|
|
550
|
+
squareSmallFilled: "◼",
|
|
551
|
+
circle: "◯",
|
|
552
|
+
circleFilled: "◉",
|
|
553
|
+
circleDotted: "◌",
|
|
554
|
+
circleDouble: "◎",
|
|
555
|
+
circleCircle: "ⓞ",
|
|
556
|
+
circleCross: "ⓧ",
|
|
557
|
+
circlePipe: "Ⓘ",
|
|
558
|
+
radioOn: "◉",
|
|
559
|
+
radioOff: "◯",
|
|
560
|
+
checkboxOn: "☒",
|
|
561
|
+
checkboxOff: "☐",
|
|
562
|
+
checkboxCircleOn: "ⓧ",
|
|
563
|
+
checkboxCircleOff: "Ⓘ",
|
|
564
|
+
pointer: "❯",
|
|
565
|
+
triangleUpOutline: "△",
|
|
566
|
+
triangleLeft: "◀",
|
|
567
|
+
triangleRight: "▶",
|
|
568
|
+
lozenge: "◆",
|
|
569
|
+
lozengeOutline: "◇",
|
|
570
|
+
hamburger: "☰",
|
|
571
|
+
smiley: "㋡",
|
|
572
|
+
mustache: "෴",
|
|
573
|
+
star: "★",
|
|
574
|
+
play: "▶",
|
|
575
|
+
nodejs: "⬢",
|
|
576
|
+
oneSeventh: "⅐",
|
|
577
|
+
oneNinth: "⅑",
|
|
578
|
+
oneTenth: "⅒"
|
|
579
|
+
};
|
|
580
|
+
var specialFallbackSymbols = {
|
|
581
|
+
tick: "√",
|
|
582
|
+
info: "i",
|
|
583
|
+
warning: "‼",
|
|
584
|
+
cross: "×",
|
|
585
|
+
squareSmall: "□",
|
|
586
|
+
squareSmallFilled: "■",
|
|
587
|
+
circle: "( )",
|
|
588
|
+
circleFilled: "(*)",
|
|
589
|
+
circleDotted: "( )",
|
|
590
|
+
circleDouble: "( )",
|
|
591
|
+
circleCircle: "(○)",
|
|
592
|
+
circleCross: "(×)",
|
|
593
|
+
circlePipe: "(│)",
|
|
594
|
+
radioOn: "(*)",
|
|
595
|
+
radioOff: "( )",
|
|
596
|
+
checkboxOn: "[×]",
|
|
597
|
+
checkboxOff: "[ ]",
|
|
598
|
+
checkboxCircleOn: "(×)",
|
|
599
|
+
checkboxCircleOff: "( )",
|
|
600
|
+
pointer: ">",
|
|
601
|
+
triangleUpOutline: "∆",
|
|
602
|
+
triangleLeft: "◄",
|
|
603
|
+
triangleRight: "►",
|
|
604
|
+
lozenge: "♦",
|
|
605
|
+
lozengeOutline: "◊",
|
|
606
|
+
hamburger: "≡",
|
|
607
|
+
smiley: "☺",
|
|
608
|
+
mustache: "┌─┐",
|
|
609
|
+
star: "✶",
|
|
610
|
+
play: "►",
|
|
611
|
+
nodejs: "♦",
|
|
612
|
+
oneSeventh: "1/7",
|
|
613
|
+
oneNinth: "1/9",
|
|
614
|
+
oneTenth: "1/10"
|
|
615
|
+
};
|
|
616
|
+
var mainSymbols = {
|
|
617
|
+
...common,
|
|
618
|
+
...specialMainSymbols
|
|
619
|
+
};
|
|
620
|
+
var fallbackSymbols = {
|
|
621
|
+
...common,
|
|
622
|
+
...specialFallbackSymbols
|
|
623
|
+
};
|
|
624
|
+
var shouldUseMain = isUnicodeSupported();
|
|
625
|
+
var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
626
|
+
var dist_default = figures;
|
|
627
|
+
var replacements = Object.entries(specialMainSymbols);
|
|
628
|
+
|
|
629
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/theme.js
|
|
630
|
+
var defaultTheme = {
|
|
631
|
+
prefix: {
|
|
632
|
+
idle: styleText("blue", "?"),
|
|
633
|
+
done: styleText("green", dist_default.tick)
|
|
634
|
+
},
|
|
635
|
+
spinner: {
|
|
636
|
+
interval: 80,
|
|
637
|
+
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => styleText("yellow", frame))
|
|
638
|
+
},
|
|
639
|
+
style: {
|
|
640
|
+
answer: (text) => styleText("cyan", text),
|
|
641
|
+
message: (text) => styleText("bold", text),
|
|
642
|
+
error: (text) => styleText("red", `> ${text}`),
|
|
643
|
+
defaultAnswer: (text) => styleText("dim", `(${text})`),
|
|
644
|
+
help: (text) => styleText("dim", text),
|
|
645
|
+
highlight: (text) => styleText("cyan", text),
|
|
646
|
+
key: (text) => styleText("cyan", styleText("bold", `<${text}>`))
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
651
|
+
function isPlainObject(value) {
|
|
652
|
+
if (typeof value !== "object" || value === null)
|
|
653
|
+
return false;
|
|
654
|
+
let proto = value;
|
|
655
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
656
|
+
proto = Object.getPrototypeOf(proto);
|
|
657
|
+
}
|
|
658
|
+
return Object.getPrototypeOf(value) === proto;
|
|
659
|
+
}
|
|
660
|
+
function deepMerge(...objects) {
|
|
661
|
+
const output = {};
|
|
662
|
+
for (const obj of objects) {
|
|
663
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
664
|
+
const prevValue = output[key];
|
|
665
|
+
output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
return output;
|
|
669
|
+
}
|
|
670
|
+
function makeTheme(...themes) {
|
|
671
|
+
const themesToMerge = [
|
|
672
|
+
defaultTheme,
|
|
673
|
+
...themes.filter((theme) => theme != null)
|
|
674
|
+
];
|
|
675
|
+
return deepMerge(...themesToMerge);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
679
|
+
function usePrefix({ status = "idle", theme }) {
|
|
680
|
+
const [showLoader, setShowLoader] = useState(false);
|
|
681
|
+
const [tick, setTick] = useState(0);
|
|
682
|
+
const { prefix, spinner } = makeTheme(theme);
|
|
683
|
+
useEffect(() => {
|
|
684
|
+
if (status === "loading") {
|
|
685
|
+
let tickInterval;
|
|
686
|
+
let inc = -1;
|
|
687
|
+
const delayTimeout = setTimeout(() => {
|
|
688
|
+
setShowLoader(true);
|
|
689
|
+
tickInterval = setInterval(() => {
|
|
690
|
+
inc = inc + 1;
|
|
691
|
+
setTick(inc % spinner.frames.length);
|
|
692
|
+
}, spinner.interval);
|
|
693
|
+
}, 300);
|
|
694
|
+
return () => {
|
|
695
|
+
clearTimeout(delayTimeout);
|
|
696
|
+
clearInterval(tickInterval);
|
|
697
|
+
};
|
|
698
|
+
} else {
|
|
699
|
+
setShowLoader(false);
|
|
700
|
+
}
|
|
701
|
+
}, [status]);
|
|
702
|
+
if (showLoader) {
|
|
703
|
+
return spinner.frames[tick];
|
|
704
|
+
}
|
|
705
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
706
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
707
|
+
}
|
|
708
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
709
|
+
function useMemo(fn, dependencies) {
|
|
710
|
+
return withPointer((pointer) => {
|
|
711
|
+
const prev = pointer.get();
|
|
712
|
+
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
|
|
713
|
+
const value = fn();
|
|
714
|
+
pointer.set({ value, dependencies });
|
|
715
|
+
return value;
|
|
716
|
+
}
|
|
717
|
+
return prev.value;
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
721
|
+
function useRef(val) {
|
|
722
|
+
return useState({ current: val })[0];
|
|
723
|
+
}
|
|
724
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
725
|
+
function useKeypress(userHandler) {
|
|
726
|
+
const signal = useRef(userHandler);
|
|
727
|
+
signal.current = userHandler;
|
|
728
|
+
useEffect((rl) => {
|
|
729
|
+
let ignore = false;
|
|
730
|
+
const handler = withUpdates((_input, event) => {
|
|
731
|
+
if (ignore)
|
|
732
|
+
return;
|
|
733
|
+
signal.current(event, rl);
|
|
734
|
+
});
|
|
735
|
+
rl.input.on("keypress", handler);
|
|
736
|
+
return () => {
|
|
737
|
+
ignore = true;
|
|
738
|
+
rl.input.removeListener("keypress", handler);
|
|
739
|
+
};
|
|
740
|
+
}, []);
|
|
741
|
+
}
|
|
742
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/utils.js
|
|
743
|
+
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
744
|
+
|
|
745
|
+
// ../../node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
746
|
+
var getCodePointsLength = (() => {
|
|
747
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
748
|
+
return (input) => {
|
|
749
|
+
let surrogatePairsNr = 0;
|
|
750
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
751
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
752
|
+
surrogatePairsNr += 1;
|
|
753
|
+
}
|
|
754
|
+
return input.length - surrogatePairsNr;
|
|
755
|
+
};
|
|
756
|
+
})();
|
|
757
|
+
var isFullWidth = (x) => {
|
|
758
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
759
|
+
};
|
|
760
|
+
var isWideNotCJKTNotEmoji = (x) => {
|
|
761
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
// ../../node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
765
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
766
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
767
|
+
var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
768
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
769
|
+
var EMOJI_RE = /[\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?))*/yu;
|
|
770
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
771
|
+
var MODIFIER_RE = /\p{M}+/gu;
|
|
772
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
773
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
774
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
775
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
776
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
777
|
+
const ANSI_WIDTH = 0;
|
|
778
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
779
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
780
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
781
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
782
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
783
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
784
|
+
const PARSE_BLOCKS = [
|
|
785
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
786
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
787
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
788
|
+
[TAB_RE, TAB_WIDTH],
|
|
789
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
790
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
791
|
+
];
|
|
792
|
+
let indexPrev = 0;
|
|
793
|
+
let index = 0;
|
|
794
|
+
let length = input.length;
|
|
795
|
+
let lengthExtra = 0;
|
|
796
|
+
let truncationEnabled = false;
|
|
797
|
+
let truncationIndex = length;
|
|
798
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
799
|
+
let unmatchedStart = 0;
|
|
800
|
+
let unmatchedEnd = 0;
|
|
801
|
+
let width = 0;
|
|
802
|
+
let widthExtra = 0;
|
|
803
|
+
outer:
|
|
804
|
+
while (true) {
|
|
805
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
806
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
807
|
+
lengthExtra = 0;
|
|
808
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
809
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
810
|
+
if (isFullWidth(codePoint)) {
|
|
811
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
812
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
813
|
+
widthExtra = WIDE_WIDTH;
|
|
814
|
+
} else {
|
|
815
|
+
widthExtra = REGULAR_WIDTH;
|
|
816
|
+
}
|
|
817
|
+
if (width + widthExtra > truncationLimit) {
|
|
818
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
819
|
+
}
|
|
820
|
+
if (width + widthExtra > LIMIT) {
|
|
821
|
+
truncationEnabled = true;
|
|
822
|
+
break outer;
|
|
823
|
+
}
|
|
824
|
+
lengthExtra += char.length;
|
|
825
|
+
width += widthExtra;
|
|
826
|
+
}
|
|
827
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
828
|
+
}
|
|
829
|
+
if (index >= length) {
|
|
830
|
+
break outer;
|
|
831
|
+
}
|
|
832
|
+
for (let i = 0, l = PARSE_BLOCKS.length;i < l; i++) {
|
|
833
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
|
|
834
|
+
BLOCK_RE.lastIndex = index;
|
|
835
|
+
if (BLOCK_RE.test(input)) {
|
|
836
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
837
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
838
|
+
if (width + widthExtra > truncationLimit) {
|
|
839
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
840
|
+
}
|
|
841
|
+
if (width + widthExtra > LIMIT) {
|
|
842
|
+
truncationEnabled = true;
|
|
843
|
+
break outer;
|
|
844
|
+
}
|
|
845
|
+
width += widthExtra;
|
|
846
|
+
unmatchedStart = indexPrev;
|
|
847
|
+
unmatchedEnd = index;
|
|
848
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
849
|
+
continue outer;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
index += 1;
|
|
853
|
+
}
|
|
854
|
+
return {
|
|
855
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
856
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
857
|
+
truncated: truncationEnabled,
|
|
858
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
859
|
+
};
|
|
860
|
+
};
|
|
861
|
+
var dist_default2 = getStringTruncatedWidth;
|
|
862
|
+
|
|
863
|
+
// ../../node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
864
|
+
var NO_TRUNCATION2 = {
|
|
865
|
+
limit: Infinity,
|
|
866
|
+
ellipsis: "",
|
|
867
|
+
ellipsisWidth: 0
|
|
868
|
+
};
|
|
869
|
+
var fastStringWidth = (input, options = {}) => {
|
|
870
|
+
return dist_default2(input, NO_TRUNCATION2, options).width;
|
|
871
|
+
};
|
|
872
|
+
var dist_default3 = fastStringWidth;
|
|
873
|
+
|
|
874
|
+
// ../../node_modules/.bun/fast-wrap-ansi@0.2.0/node_modules/fast-wrap-ansi/lib/main.js
|
|
875
|
+
var ESC = "\x1B";
|
|
876
|
+
var CSI = "";
|
|
877
|
+
var END_CODE = 39;
|
|
878
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
879
|
+
var ANSI_CSI = "[";
|
|
880
|
+
var ANSI_OSC = "]";
|
|
881
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
882
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
883
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
884
|
+
var getClosingCode = (openingCode) => {
|
|
885
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
886
|
+
return 39;
|
|
887
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
888
|
+
return 39;
|
|
889
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
890
|
+
return 49;
|
|
891
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
892
|
+
return 49;
|
|
893
|
+
if (openingCode === 1 || openingCode === 2)
|
|
894
|
+
return 22;
|
|
895
|
+
if (openingCode === 3)
|
|
896
|
+
return 23;
|
|
897
|
+
if (openingCode === 4)
|
|
898
|
+
return 24;
|
|
899
|
+
if (openingCode === 7)
|
|
900
|
+
return 27;
|
|
901
|
+
if (openingCode === 8)
|
|
902
|
+
return 28;
|
|
903
|
+
if (openingCode === 9)
|
|
904
|
+
return 29;
|
|
905
|
+
if (openingCode === 0)
|
|
906
|
+
return 0;
|
|
907
|
+
return;
|
|
908
|
+
};
|
|
909
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
910
|
+
var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
911
|
+
var wrapWord = (rows, word, columns) => {
|
|
912
|
+
const characters = word[Symbol.iterator]();
|
|
913
|
+
let isInsideEscape = false;
|
|
914
|
+
let isInsideLinkEscape = false;
|
|
915
|
+
let lastRow = rows.at(-1);
|
|
916
|
+
let visible = lastRow === undefined ? 0 : dist_default3(lastRow);
|
|
917
|
+
let currentCharacter = characters.next();
|
|
918
|
+
let nextCharacter = characters.next();
|
|
919
|
+
let rawCharacterIndex = 0;
|
|
920
|
+
while (!currentCharacter.done) {
|
|
921
|
+
const character = currentCharacter.value;
|
|
922
|
+
const characterLength = dist_default3(character);
|
|
923
|
+
if (visible + characterLength <= columns) {
|
|
924
|
+
rows[rows.length - 1] += character;
|
|
925
|
+
} else {
|
|
926
|
+
rows.push(character);
|
|
927
|
+
visible = 0;
|
|
928
|
+
}
|
|
929
|
+
if (character === ESC || character === CSI) {
|
|
930
|
+
isInsideEscape = true;
|
|
931
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
932
|
+
}
|
|
933
|
+
if (isInsideEscape) {
|
|
934
|
+
if (isInsideLinkEscape) {
|
|
935
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
936
|
+
isInsideEscape = false;
|
|
937
|
+
isInsideLinkEscape = false;
|
|
938
|
+
}
|
|
939
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
940
|
+
isInsideEscape = false;
|
|
941
|
+
}
|
|
942
|
+
} else {
|
|
943
|
+
visible += characterLength;
|
|
944
|
+
if (visible === columns && !nextCharacter.done) {
|
|
945
|
+
rows.push("");
|
|
946
|
+
visible = 0;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
currentCharacter = nextCharacter;
|
|
950
|
+
nextCharacter = characters.next();
|
|
951
|
+
rawCharacterIndex += character.length;
|
|
952
|
+
}
|
|
953
|
+
lastRow = rows.at(-1);
|
|
954
|
+
if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
|
|
955
|
+
rows[rows.length - 2] += rows.pop();
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
959
|
+
const words = string.split(" ");
|
|
960
|
+
let last = words.length;
|
|
961
|
+
while (last) {
|
|
962
|
+
if (dist_default3(words[last - 1])) {
|
|
963
|
+
break;
|
|
964
|
+
}
|
|
965
|
+
last--;
|
|
966
|
+
}
|
|
967
|
+
if (last === words.length) {
|
|
968
|
+
return string;
|
|
969
|
+
}
|
|
970
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
971
|
+
};
|
|
972
|
+
var exec = (string, columns, options = {}) => {
|
|
973
|
+
if (options.trim !== false && string.trim() === "") {
|
|
974
|
+
return "";
|
|
975
|
+
}
|
|
976
|
+
let returnValue = "";
|
|
977
|
+
let escapeCode;
|
|
978
|
+
let escapeUrl;
|
|
979
|
+
const words = string.split(" ");
|
|
980
|
+
let rows = [""];
|
|
981
|
+
let rowLength = 0;
|
|
982
|
+
for (let index = 0;index < words.length; index++) {
|
|
983
|
+
const word = words[index];
|
|
984
|
+
if (options.trim !== false) {
|
|
985
|
+
const row = rows.at(-1) ?? "";
|
|
986
|
+
const trimmed = row.trimStart();
|
|
987
|
+
if (row.length !== trimmed.length) {
|
|
988
|
+
rows[rows.length - 1] = trimmed;
|
|
989
|
+
rowLength = dist_default3(trimmed);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
if (index !== 0) {
|
|
993
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
994
|
+
rows.push("");
|
|
995
|
+
rowLength = 0;
|
|
996
|
+
}
|
|
997
|
+
if (rowLength || options.trim === false) {
|
|
998
|
+
rows[rows.length - 1] += " ";
|
|
999
|
+
rowLength++;
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
const wordLength = dist_default3(word);
|
|
1003
|
+
if (options.hard && wordLength > columns) {
|
|
1004
|
+
const remainingColumns = columns - rowLength;
|
|
1005
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
1006
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
1007
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
1008
|
+
rows.push("");
|
|
1009
|
+
}
|
|
1010
|
+
wrapWord(rows, word, columns);
|
|
1011
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
1012
|
+
continue;
|
|
1013
|
+
}
|
|
1014
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
1015
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
1016
|
+
wrapWord(rows, word, columns);
|
|
1017
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
1018
|
+
continue;
|
|
1019
|
+
}
|
|
1020
|
+
rows.push("");
|
|
1021
|
+
rowLength = 0;
|
|
1022
|
+
}
|
|
1023
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
1024
|
+
wrapWord(rows, word, columns);
|
|
1025
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
1026
|
+
continue;
|
|
1027
|
+
}
|
|
1028
|
+
rows[rows.length - 1] += word;
|
|
1029
|
+
rowLength += wordLength;
|
|
1030
|
+
}
|
|
1031
|
+
if (options.trim !== false) {
|
|
1032
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
1033
|
+
}
|
|
1034
|
+
const preString = rows.join(`
|
|
1035
|
+
`);
|
|
1036
|
+
let inSurrogate = false;
|
|
1037
|
+
for (let i = 0;i < preString.length; i++) {
|
|
1038
|
+
const character = preString[i];
|
|
1039
|
+
returnValue += character;
|
|
1040
|
+
if (!inSurrogate) {
|
|
1041
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
1042
|
+
if (inSurrogate) {
|
|
1043
|
+
continue;
|
|
1044
|
+
}
|
|
1045
|
+
} else {
|
|
1046
|
+
inSurrogate = false;
|
|
1047
|
+
}
|
|
1048
|
+
if (character === ESC || character === CSI) {
|
|
1049
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
1050
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
1051
|
+
const groups = groupsResult?.groups;
|
|
1052
|
+
if (groups?.code !== undefined) {
|
|
1053
|
+
const code = Number.parseFloat(groups.code);
|
|
1054
|
+
escapeCode = code === END_CODE ? undefined : code;
|
|
1055
|
+
} else if (groups?.uri !== undefined) {
|
|
1056
|
+
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
if (preString[i + 1] === `
|
|
1060
|
+
`) {
|
|
1061
|
+
if (escapeUrl) {
|
|
1062
|
+
returnValue += wrapAnsiHyperlink("");
|
|
1063
|
+
}
|
|
1064
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
|
|
1065
|
+
if (escapeCode && closingCode) {
|
|
1066
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
1067
|
+
}
|
|
1068
|
+
} else if (character === `
|
|
1069
|
+
`) {
|
|
1070
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
1071
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
1072
|
+
}
|
|
1073
|
+
if (escapeUrl) {
|
|
1074
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
return returnValue;
|
|
1079
|
+
};
|
|
1080
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
1081
|
+
function wrapAnsi(string, columns, options) {
|
|
1082
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join(`
|
|
1083
|
+
`);
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/utils.js
|
|
1087
|
+
function breakLines(content, width) {
|
|
1088
|
+
return content.split(`
|
|
1089
|
+
`).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
|
|
1090
|
+
`).map((str) => str.trimEnd())).join(`
|
|
1091
|
+
`);
|
|
1092
|
+
}
|
|
1093
|
+
function readlineWidth() {
|
|
1094
|
+
return import_cli_width.default({ defaultWidth: 80, output: readline().output });
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
1098
|
+
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
1099
|
+
const state = useRef({
|
|
1100
|
+
lastPointer: active,
|
|
1101
|
+
lastActive: undefined
|
|
1102
|
+
});
|
|
1103
|
+
const { lastPointer, lastActive } = state.current;
|
|
1104
|
+
const middle = Math.floor(pageSize / 2);
|
|
1105
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
1106
|
+
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
|
1107
|
+
let pointer = defaultPointerPosition;
|
|
1108
|
+
if (renderedLength > pageSize) {
|
|
1109
|
+
if (loop) {
|
|
1110
|
+
pointer = lastPointer;
|
|
1111
|
+
if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
|
|
1112
|
+
pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
|
|
1113
|
+
}
|
|
1114
|
+
} else {
|
|
1115
|
+
const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
|
|
1116
|
+
pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
state.current.lastPointer = pointer;
|
|
1120
|
+
state.current.lastActive = active;
|
|
1121
|
+
return pointer;
|
|
1122
|
+
}
|
|
1123
|
+
function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
1124
|
+
const width = readlineWidth();
|
|
1125
|
+
const bound = (num) => (num % items.length + items.length) % items.length;
|
|
1126
|
+
const renderedItems = items.map((item, index) => {
|
|
1127
|
+
if (item == null)
|
|
1128
|
+
return [];
|
|
1129
|
+
return breakLines(renderItem({ item, index, isActive: index === active }), width).split(`
|
|
1130
|
+
`);
|
|
1131
|
+
});
|
|
1132
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
1133
|
+
const renderItemAtIndex = (index) => renderedItems[index] ?? [];
|
|
1134
|
+
const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
|
|
1135
|
+
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
|
1136
|
+
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
|
1137
|
+
const pageBuffer = Array.from({ length: pageSize });
|
|
1138
|
+
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
|
1139
|
+
const itemVisited = new Set([active]);
|
|
1140
|
+
let bufferPointer = activeItemPosition + activeItem.length;
|
|
1141
|
+
let itemPointer = bound(active + 1);
|
|
1142
|
+
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
|
1143
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
1144
|
+
const linesToAdd = lines.slice(0, pageSize - bufferPointer);
|
|
1145
|
+
pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
|
|
1146
|
+
itemVisited.add(itemPointer);
|
|
1147
|
+
bufferPointer += linesToAdd.length;
|
|
1148
|
+
itemPointer = bound(itemPointer + 1);
|
|
1149
|
+
}
|
|
1150
|
+
bufferPointer = activeItemPosition - 1;
|
|
1151
|
+
itemPointer = bound(active - 1);
|
|
1152
|
+
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
|
1153
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
1154
|
+
const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
|
|
1155
|
+
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
|
1156
|
+
itemVisited.add(itemPointer);
|
|
1157
|
+
bufferPointer -= linesToAdd.length;
|
|
1158
|
+
itemPointer = bound(itemPointer - 1);
|
|
1159
|
+
}
|
|
1160
|
+
return pageBuffer.filter((line) => typeof line === "string").join(`
|
|
1161
|
+
`);
|
|
1162
|
+
}
|
|
1163
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
1164
|
+
var import_mute_stream = __toESM(require_lib(), 1);
|
|
1165
|
+
import * as readline2 from "node:readline";
|
|
1166
|
+
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
1167
|
+
|
|
1168
|
+
// ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
1169
|
+
var signals = [];
|
|
1170
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
1171
|
+
if (process.platform !== "win32") {
|
|
1172
|
+
signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
1173
|
+
}
|
|
1174
|
+
if (process.platform === "linux") {
|
|
1175
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
// ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
1179
|
+
var processOk = (process3) => !!process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
|
|
1180
|
+
var kExitEmitter = Symbol.for("signal-exit emitter");
|
|
1181
|
+
var global = globalThis;
|
|
1182
|
+
var ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
1183
|
+
|
|
1184
|
+
class Emitter {
|
|
1185
|
+
emitted = {
|
|
1186
|
+
afterExit: false,
|
|
1187
|
+
exit: false
|
|
1188
|
+
};
|
|
1189
|
+
listeners = {
|
|
1190
|
+
afterExit: [],
|
|
1191
|
+
exit: []
|
|
1192
|
+
};
|
|
1193
|
+
count = 0;
|
|
1194
|
+
id = Math.random();
|
|
1195
|
+
constructor() {
|
|
1196
|
+
if (global[kExitEmitter]) {
|
|
1197
|
+
return global[kExitEmitter];
|
|
1198
|
+
}
|
|
1199
|
+
ObjectDefineProperty(global, kExitEmitter, {
|
|
1200
|
+
value: this,
|
|
1201
|
+
writable: false,
|
|
1202
|
+
enumerable: false,
|
|
1203
|
+
configurable: false
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
on(ev, fn) {
|
|
1207
|
+
this.listeners[ev].push(fn);
|
|
1208
|
+
}
|
|
1209
|
+
removeListener(ev, fn) {
|
|
1210
|
+
const list = this.listeners[ev];
|
|
1211
|
+
const i = list.indexOf(fn);
|
|
1212
|
+
if (i === -1) {
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
if (i === 0 && list.length === 1) {
|
|
1216
|
+
list.length = 0;
|
|
1217
|
+
} else {
|
|
1218
|
+
list.splice(i, 1);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
emit(ev, code, signal) {
|
|
1222
|
+
if (this.emitted[ev]) {
|
|
1223
|
+
return false;
|
|
1224
|
+
}
|
|
1225
|
+
this.emitted[ev] = true;
|
|
1226
|
+
let ret = false;
|
|
1227
|
+
for (const fn of this.listeners[ev]) {
|
|
1228
|
+
ret = fn(code, signal) === true || ret;
|
|
1229
|
+
}
|
|
1230
|
+
if (ev === "exit") {
|
|
1231
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
1232
|
+
}
|
|
1233
|
+
return ret;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
class SignalExitBase {
|
|
1238
|
+
}
|
|
1239
|
+
var signalExitWrap = (handler) => {
|
|
1240
|
+
return {
|
|
1241
|
+
onExit(cb, opts) {
|
|
1242
|
+
return handler.onExit(cb, opts);
|
|
1243
|
+
},
|
|
1244
|
+
load() {
|
|
1245
|
+
return handler.load();
|
|
1246
|
+
},
|
|
1247
|
+
unload() {
|
|
1248
|
+
return handler.unload();
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
class SignalExitFallback extends SignalExitBase {
|
|
1254
|
+
onExit() {
|
|
1255
|
+
return () => {};
|
|
1256
|
+
}
|
|
1257
|
+
load() {}
|
|
1258
|
+
unload() {}
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
class SignalExit extends SignalExitBase {
|
|
1262
|
+
#hupSig = process3.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
1263
|
+
#emitter = new Emitter;
|
|
1264
|
+
#process;
|
|
1265
|
+
#originalProcessEmit;
|
|
1266
|
+
#originalProcessReallyExit;
|
|
1267
|
+
#sigListeners = {};
|
|
1268
|
+
#loaded = false;
|
|
1269
|
+
constructor(process3) {
|
|
1270
|
+
super();
|
|
1271
|
+
this.#process = process3;
|
|
1272
|
+
this.#sigListeners = {};
|
|
1273
|
+
for (const sig of signals) {
|
|
1274
|
+
this.#sigListeners[sig] = () => {
|
|
1275
|
+
const listeners = this.#process.listeners(sig);
|
|
1276
|
+
let { count } = this.#emitter;
|
|
1277
|
+
const p = process3;
|
|
1278
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
1279
|
+
count += p.__signal_exit_emitter__.count;
|
|
1280
|
+
}
|
|
1281
|
+
if (listeners.length === count) {
|
|
1282
|
+
this.unload();
|
|
1283
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
1284
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
1285
|
+
if (!ret)
|
|
1286
|
+
process3.kill(process3.pid, s);
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
this.#originalProcessReallyExit = process3.reallyExit;
|
|
1291
|
+
this.#originalProcessEmit = process3.emit;
|
|
1292
|
+
}
|
|
1293
|
+
onExit(cb, opts) {
|
|
1294
|
+
if (!processOk(this.#process)) {
|
|
1295
|
+
return () => {};
|
|
1296
|
+
}
|
|
1297
|
+
if (this.#loaded === false) {
|
|
1298
|
+
this.load();
|
|
1299
|
+
}
|
|
1300
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
1301
|
+
this.#emitter.on(ev, cb);
|
|
1302
|
+
return () => {
|
|
1303
|
+
this.#emitter.removeListener(ev, cb);
|
|
1304
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
1305
|
+
this.unload();
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
}
|
|
1309
|
+
load() {
|
|
1310
|
+
if (this.#loaded) {
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1313
|
+
this.#loaded = true;
|
|
1314
|
+
this.#emitter.count += 1;
|
|
1315
|
+
for (const sig of signals) {
|
|
1316
|
+
try {
|
|
1317
|
+
const fn = this.#sigListeners[sig];
|
|
1318
|
+
if (fn)
|
|
1319
|
+
this.#process.on(sig, fn);
|
|
1320
|
+
} catch (_) {}
|
|
1321
|
+
}
|
|
1322
|
+
this.#process.emit = (ev, ...a) => {
|
|
1323
|
+
return this.#processEmit(ev, ...a);
|
|
1324
|
+
};
|
|
1325
|
+
this.#process.reallyExit = (code) => {
|
|
1326
|
+
return this.#processReallyExit(code);
|
|
1327
|
+
};
|
|
1328
|
+
}
|
|
1329
|
+
unload() {
|
|
1330
|
+
if (!this.#loaded) {
|
|
1331
|
+
return;
|
|
1332
|
+
}
|
|
1333
|
+
this.#loaded = false;
|
|
1334
|
+
signals.forEach((sig) => {
|
|
1335
|
+
const listener = this.#sigListeners[sig];
|
|
1336
|
+
if (!listener) {
|
|
1337
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
1338
|
+
}
|
|
1339
|
+
try {
|
|
1340
|
+
this.#process.removeListener(sig, listener);
|
|
1341
|
+
} catch (_) {}
|
|
1342
|
+
});
|
|
1343
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
1344
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
1345
|
+
this.#emitter.count -= 1;
|
|
1346
|
+
}
|
|
1347
|
+
#processReallyExit(code) {
|
|
1348
|
+
if (!processOk(this.#process)) {
|
|
1349
|
+
return 0;
|
|
1350
|
+
}
|
|
1351
|
+
this.#process.exitCode = code || 0;
|
|
1352
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1353
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
1354
|
+
}
|
|
1355
|
+
#processEmit(ev, ...args) {
|
|
1356
|
+
const og = this.#originalProcessEmit;
|
|
1357
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
1358
|
+
if (typeof args[0] === "number") {
|
|
1359
|
+
this.#process.exitCode = args[0];
|
|
1360
|
+
}
|
|
1361
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
1362
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1363
|
+
return ret;
|
|
1364
|
+
} else {
|
|
1365
|
+
return og.call(this.#process, ev, ...args);
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
var process3 = globalThis.process;
|
|
1370
|
+
var {
|
|
1371
|
+
onExit,
|
|
1372
|
+
load,
|
|
1373
|
+
unload
|
|
1374
|
+
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
|
|
1375
|
+
|
|
1376
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
1377
|
+
import { stripVTControlCharacters } from "node:util";
|
|
1378
|
+
|
|
1379
|
+
// ../../node_modules/.bun/@inquirer+ansi@2.0.3/node_modules/@inquirer/ansi/dist/index.js
|
|
1380
|
+
var ESC2 = "\x1B[";
|
|
1381
|
+
var cursorLeft = ESC2 + "G";
|
|
1382
|
+
var cursorHide = ESC2 + "?25l";
|
|
1383
|
+
var cursorShow = ESC2 + "?25h";
|
|
1384
|
+
var cursorUp = (rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "";
|
|
1385
|
+
var cursorDown = (rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "";
|
|
1386
|
+
var cursorTo = (x, y) => {
|
|
1387
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
1388
|
+
return `${ESC2}${y + 1};${x + 1}H`;
|
|
1389
|
+
}
|
|
1390
|
+
return `${ESC2}${x + 1}G`;
|
|
1391
|
+
};
|
|
1392
|
+
var eraseLine = ESC2 + "2K";
|
|
1393
|
+
var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
1394
|
+
|
|
1395
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
1396
|
+
var height = (content) => content.split(`
|
|
1397
|
+
`).length;
|
|
1398
|
+
var lastLine = (content) => content.split(`
|
|
1399
|
+
`).pop() ?? "";
|
|
1400
|
+
|
|
1401
|
+
class ScreenManager {
|
|
1402
|
+
height = 0;
|
|
1403
|
+
extraLinesUnderPrompt = 0;
|
|
1404
|
+
cursorPos;
|
|
1405
|
+
rl;
|
|
1406
|
+
constructor(rl) {
|
|
1407
|
+
this.rl = rl;
|
|
1408
|
+
this.cursorPos = rl.getCursorPos();
|
|
1409
|
+
}
|
|
1410
|
+
write(content) {
|
|
1411
|
+
this.rl.output.unmute();
|
|
1412
|
+
this.rl.output.write(content);
|
|
1413
|
+
this.rl.output.mute();
|
|
1414
|
+
}
|
|
1415
|
+
render(content, bottomContent = "") {
|
|
1416
|
+
const promptLine = lastLine(content);
|
|
1417
|
+
const rawPromptLine = stripVTControlCharacters(promptLine);
|
|
1418
|
+
let prompt = rawPromptLine;
|
|
1419
|
+
if (this.rl.line.length > 0) {
|
|
1420
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
1421
|
+
}
|
|
1422
|
+
this.rl.setPrompt(prompt);
|
|
1423
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
1424
|
+
const width = readlineWidth();
|
|
1425
|
+
content = breakLines(content, width);
|
|
1426
|
+
bottomContent = breakLines(bottomContent, width);
|
|
1427
|
+
if (rawPromptLine.length % width === 0) {
|
|
1428
|
+
content += `
|
|
1429
|
+
`;
|
|
1430
|
+
}
|
|
1431
|
+
let output = content + (bottomContent ? `
|
|
1432
|
+
` + bottomContent : "");
|
|
1433
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
1434
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
|
|
1435
|
+
if (bottomContentHeight > 0)
|
|
1436
|
+
output += cursorUp(bottomContentHeight);
|
|
1437
|
+
output += cursorTo(this.cursorPos.cols);
|
|
1438
|
+
this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
|
|
1439
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
1440
|
+
this.height = height(output);
|
|
1441
|
+
}
|
|
1442
|
+
checkCursorPos() {
|
|
1443
|
+
const cursorPos = this.rl.getCursorPos();
|
|
1444
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
1445
|
+
this.write(cursorTo(cursorPos.cols));
|
|
1446
|
+
this.cursorPos = cursorPos;
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
done({ clearContent }) {
|
|
1450
|
+
this.rl.setPrompt("");
|
|
1451
|
+
let output = cursorDown(this.extraLinesUnderPrompt);
|
|
1452
|
+
output += clearContent ? eraseLines(this.height) : `
|
|
1453
|
+
`;
|
|
1454
|
+
output += cursorShow;
|
|
1455
|
+
this.write(output);
|
|
1456
|
+
this.rl.close();
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
1461
|
+
class PromisePolyfill extends Promise {
|
|
1462
|
+
static withResolver() {
|
|
1463
|
+
let resolve;
|
|
1464
|
+
let reject;
|
|
1465
|
+
const promise = new Promise((res, rej) => {
|
|
1466
|
+
resolve = res;
|
|
1467
|
+
reject = rej;
|
|
1468
|
+
});
|
|
1469
|
+
return { promise, resolve, reject };
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
1474
|
+
var nativeSetImmediate = globalThis.setImmediate;
|
|
1475
|
+
function getCallSites() {
|
|
1476
|
+
const _prepareStackTrace = Error.prepareStackTrace;
|
|
1477
|
+
let result = [];
|
|
1478
|
+
try {
|
|
1479
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
1480
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
1481
|
+
result = callSitesWithoutCurrent;
|
|
1482
|
+
return callSitesWithoutCurrent;
|
|
1483
|
+
};
|
|
1484
|
+
new Error().stack;
|
|
1485
|
+
} catch {
|
|
1486
|
+
return result;
|
|
1487
|
+
}
|
|
1488
|
+
Error.prepareStackTrace = _prepareStackTrace;
|
|
1489
|
+
return result;
|
|
1490
|
+
}
|
|
1491
|
+
function createPrompt(view) {
|
|
1492
|
+
const callSites = getCallSites();
|
|
1493
|
+
const prompt = (config, context = {}) => {
|
|
1494
|
+
const { input = process.stdin, signal } = context;
|
|
1495
|
+
const cleanups = new Set;
|
|
1496
|
+
const output = new import_mute_stream.default;
|
|
1497
|
+
output.pipe(context.output ?? process.stdout);
|
|
1498
|
+
output.mute();
|
|
1499
|
+
const rl = readline2.createInterface({
|
|
1500
|
+
terminal: true,
|
|
1501
|
+
input,
|
|
1502
|
+
output
|
|
1503
|
+
});
|
|
1504
|
+
const screen = new ScreenManager(rl);
|
|
1505
|
+
const { promise, resolve, reject } = PromisePolyfill.withResolver();
|
|
1506
|
+
const cancel = () => reject(new CancelPromptError);
|
|
1507
|
+
if (signal) {
|
|
1508
|
+
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
1509
|
+
if (signal.aborted) {
|
|
1510
|
+
abort();
|
|
1511
|
+
return Object.assign(promise, { cancel });
|
|
1512
|
+
}
|
|
1513
|
+
signal.addEventListener("abort", abort);
|
|
1514
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
1515
|
+
}
|
|
1516
|
+
cleanups.add(onExit((code, signal2) => {
|
|
1517
|
+
reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
|
|
1518
|
+
}));
|
|
1519
|
+
const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
|
|
1520
|
+
rl.on("SIGINT", sigint);
|
|
1521
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
1522
|
+
return withHooks(rl, (cycle) => {
|
|
1523
|
+
const hooksCleanup = AsyncResource3.bind(() => effectScheduler.clearAll());
|
|
1524
|
+
rl.on("close", hooksCleanup);
|
|
1525
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
1526
|
+
const startCycle = () => {
|
|
1527
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
1528
|
+
rl.input.on("keypress", checkCursorPos);
|
|
1529
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
1530
|
+
cycle(() => {
|
|
1531
|
+
try {
|
|
1532
|
+
const nextView = view(config, (value) => {
|
|
1533
|
+
setImmediate(() => resolve(value));
|
|
1534
|
+
});
|
|
1535
|
+
if (nextView === undefined) {
|
|
1536
|
+
const callerFilename = callSites[1]?.getFileName();
|
|
1537
|
+
throw new Error(`Prompt functions must return a string.
|
|
1538
|
+
at ${callerFilename}`);
|
|
1539
|
+
}
|
|
1540
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
1541
|
+
screen.render(content, bottomContent);
|
|
1542
|
+
effectScheduler.run();
|
|
1543
|
+
} catch (error) {
|
|
1544
|
+
reject(error);
|
|
1545
|
+
}
|
|
1546
|
+
});
|
|
1547
|
+
};
|
|
1548
|
+
if ("readableFlowing" in input) {
|
|
1549
|
+
nativeSetImmediate(startCycle);
|
|
1550
|
+
} else {
|
|
1551
|
+
startCycle();
|
|
1552
|
+
}
|
|
1553
|
+
return Object.assign(promise.then((answer) => {
|
|
1554
|
+
effectScheduler.clearAll();
|
|
1555
|
+
return answer;
|
|
1556
|
+
}, (error) => {
|
|
1557
|
+
effectScheduler.clearAll();
|
|
1558
|
+
throw error;
|
|
1559
|
+
}).finally(() => {
|
|
1560
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
1561
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
1562
|
+
output.end();
|
|
1563
|
+
}).then(() => promise), { cancel });
|
|
1564
|
+
});
|
|
1565
|
+
};
|
|
1566
|
+
return prompt;
|
|
1567
|
+
}
|
|
1568
|
+
// ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/Separator.js
|
|
1569
|
+
import { styleText as styleText2 } from "node:util";
|
|
1570
|
+
class Separator {
|
|
1571
|
+
separator = styleText2("dim", Array.from({ length: 15 }).join(dist_default.line));
|
|
1572
|
+
type = "separator";
|
|
1573
|
+
constructor(separator) {
|
|
1574
|
+
if (separator) {
|
|
1575
|
+
this.separator = separator;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
static isSeparator(choice) {
|
|
1579
|
+
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
// ../../node_modules/.bun/@inquirer+confirm@6.0.8+aab3160543ca59a9/node_modules/@inquirer/confirm/dist/index.js
|
|
1583
|
+
function getBooleanValue(value, defaultValue) {
|
|
1584
|
+
let answer = defaultValue !== false;
|
|
1585
|
+
if (/^(y|yes)/i.test(value))
|
|
1586
|
+
answer = true;
|
|
1587
|
+
else if (/^(n|no)/i.test(value))
|
|
1588
|
+
answer = false;
|
|
1589
|
+
return answer;
|
|
1590
|
+
}
|
|
1591
|
+
function boolToString(value) {
|
|
1592
|
+
return value ? "Yes" : "No";
|
|
1593
|
+
}
|
|
1594
|
+
var dist_default4 = createPrompt((config, done) => {
|
|
1595
|
+
const { transformer = boolToString } = config;
|
|
1596
|
+
const [status, setStatus] = useState("idle");
|
|
1597
|
+
const [value, setValue] = useState("");
|
|
1598
|
+
const theme = makeTheme(config.theme);
|
|
1599
|
+
const prefix = usePrefix({ status, theme });
|
|
1600
|
+
useKeypress((key, rl) => {
|
|
1601
|
+
if (status !== "idle")
|
|
1602
|
+
return;
|
|
1603
|
+
if (isEnterKey(key)) {
|
|
1604
|
+
const answer = getBooleanValue(value, config.default);
|
|
1605
|
+
setValue(transformer(answer));
|
|
1606
|
+
setStatus("done");
|
|
1607
|
+
done(answer);
|
|
1608
|
+
} else if (isTabKey(key)) {
|
|
1609
|
+
const answer = boolToString(!getBooleanValue(value, config.default));
|
|
1610
|
+
rl.clearLine(0);
|
|
1611
|
+
rl.write(answer);
|
|
1612
|
+
setValue(answer);
|
|
1613
|
+
} else {
|
|
1614
|
+
setValue(rl.line);
|
|
1615
|
+
}
|
|
1616
|
+
});
|
|
1617
|
+
let formattedValue = value;
|
|
1618
|
+
let defaultValue = "";
|
|
1619
|
+
if (status === "done") {
|
|
1620
|
+
formattedValue = theme.style.answer(value);
|
|
1621
|
+
} else {
|
|
1622
|
+
defaultValue = ` ${theme.style.defaultAnswer(config.default === false ? "y/N" : "Y/n")}`;
|
|
1623
|
+
}
|
|
1624
|
+
const message = theme.style.message(config.message, status);
|
|
1625
|
+
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
1626
|
+
});
|
|
1627
|
+
// ../../node_modules/.bun/@inquirer+input@5.0.8+aab3160543ca59a9/node_modules/@inquirer/input/dist/index.js
|
|
1628
|
+
var inputTheme = {
|
|
1629
|
+
validationFailureMode: "keep"
|
|
1630
|
+
};
|
|
1631
|
+
var dist_default5 = createPrompt((config, done) => {
|
|
1632
|
+
const { prefill = "tab" } = config;
|
|
1633
|
+
const theme = makeTheme(inputTheme, config.theme);
|
|
1634
|
+
const [status, setStatus] = useState("idle");
|
|
1635
|
+
const [defaultValue, setDefaultValue] = useState(String(config.default ?? ""));
|
|
1636
|
+
const [errorMsg, setError] = useState();
|
|
1637
|
+
const [value, setValue] = useState("");
|
|
1638
|
+
const prefix = usePrefix({ status, theme });
|
|
1639
|
+
async function validate(value2) {
|
|
1640
|
+
const { required, pattern, patternError = "Invalid input" } = config;
|
|
1641
|
+
if (required && !value2) {
|
|
1642
|
+
return "You must provide a value";
|
|
1643
|
+
}
|
|
1644
|
+
if (pattern && !pattern.test(value2)) {
|
|
1645
|
+
return patternError;
|
|
1646
|
+
}
|
|
1647
|
+
if (typeof config.validate === "function") {
|
|
1648
|
+
return await config.validate(value2) || "You must provide a valid value";
|
|
1649
|
+
}
|
|
1650
|
+
return true;
|
|
1651
|
+
}
|
|
1652
|
+
useKeypress(async (key, rl) => {
|
|
1653
|
+
if (status !== "idle") {
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1656
|
+
if (isEnterKey(key)) {
|
|
1657
|
+
const answer = value || defaultValue;
|
|
1658
|
+
setStatus("loading");
|
|
1659
|
+
const isValid = await validate(answer);
|
|
1660
|
+
if (isValid === true) {
|
|
1661
|
+
setValue(answer);
|
|
1662
|
+
setStatus("done");
|
|
1663
|
+
done(answer);
|
|
1664
|
+
} else {
|
|
1665
|
+
if (theme.validationFailureMode === "clear") {
|
|
1666
|
+
setValue("");
|
|
1667
|
+
} else {
|
|
1668
|
+
rl.write(value);
|
|
1669
|
+
}
|
|
1670
|
+
setError(isValid);
|
|
1671
|
+
setStatus("idle");
|
|
1672
|
+
}
|
|
1673
|
+
} else if (isBackspaceKey(key) && !value) {
|
|
1674
|
+
setDefaultValue("");
|
|
1675
|
+
} else if (isTabKey(key) && !value) {
|
|
1676
|
+
setDefaultValue("");
|
|
1677
|
+
rl.clearLine(0);
|
|
1678
|
+
rl.write(defaultValue);
|
|
1679
|
+
setValue(defaultValue);
|
|
1680
|
+
} else {
|
|
1681
|
+
setValue(rl.line);
|
|
1682
|
+
setError(undefined);
|
|
1683
|
+
}
|
|
1684
|
+
});
|
|
1685
|
+
useEffect((rl) => {
|
|
1686
|
+
if (prefill === "editable" && defaultValue) {
|
|
1687
|
+
rl.write(defaultValue);
|
|
1688
|
+
setValue(defaultValue);
|
|
1689
|
+
}
|
|
1690
|
+
}, []);
|
|
1691
|
+
const message = theme.style.message(config.message, status);
|
|
1692
|
+
let formattedValue = value;
|
|
1693
|
+
if (typeof config.transformer === "function") {
|
|
1694
|
+
formattedValue = config.transformer(value, { isFinal: status === "done" });
|
|
1695
|
+
} else if (status === "done") {
|
|
1696
|
+
formattedValue = theme.style.answer(value);
|
|
1697
|
+
}
|
|
1698
|
+
let defaultStr;
|
|
1699
|
+
if (defaultValue && status !== "done" && !value) {
|
|
1700
|
+
defaultStr = theme.style.defaultAnswer(defaultValue);
|
|
1701
|
+
}
|
|
1702
|
+
let error = "";
|
|
1703
|
+
if (errorMsg) {
|
|
1704
|
+
error = theme.style.error(errorMsg);
|
|
1705
|
+
}
|
|
1706
|
+
return [
|
|
1707
|
+
[prefix, message, defaultStr, formattedValue].filter((v) => v !== undefined).join(" "),
|
|
1708
|
+
error
|
|
1709
|
+
];
|
|
1710
|
+
});
|
|
1711
|
+
// ../../node_modules/.bun/@inquirer+select@5.1.0+aab3160543ca59a9/node_modules/@inquirer/select/dist/index.js
|
|
1712
|
+
import { styleText as styleText3 } from "node:util";
|
|
1713
|
+
var selectTheme = {
|
|
1714
|
+
icon: { cursor: dist_default.pointer },
|
|
1715
|
+
style: {
|
|
1716
|
+
disabled: (text) => styleText3("dim", text),
|
|
1717
|
+
description: (text) => styleText3("cyan", text),
|
|
1718
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${styleText3("bold", key)} ${styleText3("dim", action)}`).join(styleText3("dim", " • "))
|
|
1719
|
+
},
|
|
1720
|
+
i18n: { disabledError: "This option is disabled and cannot be selected." },
|
|
1721
|
+
indexMode: "hidden",
|
|
1722
|
+
keybindings: []
|
|
1723
|
+
};
|
|
1724
|
+
function isSelectable(item) {
|
|
1725
|
+
return !Separator.isSeparator(item) && !item.disabled;
|
|
1726
|
+
}
|
|
1727
|
+
function isNavigable(item) {
|
|
1728
|
+
return !Separator.isSeparator(item);
|
|
1729
|
+
}
|
|
1730
|
+
function normalizeChoices(choices) {
|
|
1731
|
+
return choices.map((choice) => {
|
|
1732
|
+
if (Separator.isSeparator(choice))
|
|
1733
|
+
return choice;
|
|
1734
|
+
if (typeof choice !== "object" || choice === null || !("value" in choice)) {
|
|
1735
|
+
const name2 = String(choice);
|
|
1736
|
+
return {
|
|
1737
|
+
value: choice,
|
|
1738
|
+
name: name2,
|
|
1739
|
+
short: name2,
|
|
1740
|
+
disabled: false
|
|
1741
|
+
};
|
|
1742
|
+
}
|
|
1743
|
+
const name = choice.name ?? String(choice.value);
|
|
1744
|
+
const normalizedChoice = {
|
|
1745
|
+
value: choice.value,
|
|
1746
|
+
name,
|
|
1747
|
+
short: choice.short ?? name,
|
|
1748
|
+
disabled: choice.disabled ?? false
|
|
1749
|
+
};
|
|
1750
|
+
if (choice.description) {
|
|
1751
|
+
normalizedChoice.description = choice.description;
|
|
1752
|
+
}
|
|
1753
|
+
return normalizedChoice;
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1756
|
+
var dist_default6 = createPrompt((config, done) => {
|
|
1757
|
+
const { loop = true, pageSize = 7 } = config;
|
|
1758
|
+
const theme = makeTheme(selectTheme, config.theme);
|
|
1759
|
+
const { keybindings } = theme;
|
|
1760
|
+
const [status, setStatus] = useState("idle");
|
|
1761
|
+
const prefix = usePrefix({ status, theme });
|
|
1762
|
+
const searchTimeoutRef = useRef();
|
|
1763
|
+
const searchEnabled = !keybindings.includes("vim");
|
|
1764
|
+
const items = useMemo(() => normalizeChoices(config.choices), [config.choices]);
|
|
1765
|
+
const bounds = useMemo(() => {
|
|
1766
|
+
const first = items.findIndex(isNavigable);
|
|
1767
|
+
const last = items.findLastIndex(isNavigable);
|
|
1768
|
+
if (first === -1) {
|
|
1769
|
+
throw new ValidationError("[select prompt] No selectable choices. All choices are disabled.");
|
|
1770
|
+
}
|
|
1771
|
+
return { first, last };
|
|
1772
|
+
}, [items]);
|
|
1773
|
+
const defaultItemIndex = useMemo(() => {
|
|
1774
|
+
if (!("default" in config))
|
|
1775
|
+
return -1;
|
|
1776
|
+
return items.findIndex((item) => isSelectable(item) && item.value === config.default);
|
|
1777
|
+
}, [config.default, items]);
|
|
1778
|
+
const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
|
|
1779
|
+
const selectedChoice = items[active];
|
|
1780
|
+
const [errorMsg, setError] = useState();
|
|
1781
|
+
useKeypress((key, rl) => {
|
|
1782
|
+
clearTimeout(searchTimeoutRef.current);
|
|
1783
|
+
if (errorMsg) {
|
|
1784
|
+
setError(undefined);
|
|
1785
|
+
}
|
|
1786
|
+
if (isEnterKey(key)) {
|
|
1787
|
+
if (selectedChoice.disabled) {
|
|
1788
|
+
setError(theme.i18n.disabledError);
|
|
1789
|
+
} else {
|
|
1790
|
+
setStatus("done");
|
|
1791
|
+
done(selectedChoice.value);
|
|
1792
|
+
}
|
|
1793
|
+
} else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {
|
|
1794
|
+
rl.clearLine(0);
|
|
1795
|
+
if (loop || isUpKey(key, keybindings) && active !== bounds.first || isDownKey(key, keybindings) && active !== bounds.last) {
|
|
1796
|
+
const offset = isUpKey(key, keybindings) ? -1 : 1;
|
|
1797
|
+
let next = active;
|
|
1798
|
+
do {
|
|
1799
|
+
next = (next + offset + items.length) % items.length;
|
|
1800
|
+
} while (!isNavigable(items[next]));
|
|
1801
|
+
setActive(next);
|
|
1802
|
+
}
|
|
1803
|
+
} else if (isNumberKey(key) && !Number.isNaN(Number(rl.line))) {
|
|
1804
|
+
const selectedIndex = Number(rl.line) - 1;
|
|
1805
|
+
let selectableIndex = -1;
|
|
1806
|
+
const position = items.findIndex((item2) => {
|
|
1807
|
+
if (Separator.isSeparator(item2))
|
|
1808
|
+
return false;
|
|
1809
|
+
selectableIndex++;
|
|
1810
|
+
return selectableIndex === selectedIndex;
|
|
1811
|
+
});
|
|
1812
|
+
const item = items[position];
|
|
1813
|
+
if (item != null && isSelectable(item)) {
|
|
1814
|
+
setActive(position);
|
|
1815
|
+
}
|
|
1816
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
1817
|
+
rl.clearLine(0);
|
|
1818
|
+
}, 700);
|
|
1819
|
+
} else if (isBackspaceKey(key)) {
|
|
1820
|
+
rl.clearLine(0);
|
|
1821
|
+
} else if (searchEnabled) {
|
|
1822
|
+
const searchTerm = rl.line.toLowerCase();
|
|
1823
|
+
const matchIndex = items.findIndex((item) => {
|
|
1824
|
+
if (Separator.isSeparator(item) || !isSelectable(item))
|
|
1825
|
+
return false;
|
|
1826
|
+
return item.name.toLowerCase().startsWith(searchTerm);
|
|
1827
|
+
});
|
|
1828
|
+
if (matchIndex !== -1) {
|
|
1829
|
+
setActive(matchIndex);
|
|
1830
|
+
}
|
|
1831
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
1832
|
+
rl.clearLine(0);
|
|
1833
|
+
}, 700);
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1836
|
+
useEffect(() => () => {
|
|
1837
|
+
clearTimeout(searchTimeoutRef.current);
|
|
1838
|
+
}, []);
|
|
1839
|
+
const message = theme.style.message(config.message, status);
|
|
1840
|
+
const helpLine = theme.style.keysHelpTip([
|
|
1841
|
+
["↑↓", "navigate"],
|
|
1842
|
+
["⏎", "select"]
|
|
1843
|
+
]);
|
|
1844
|
+
let separatorCount = 0;
|
|
1845
|
+
const page = usePagination({
|
|
1846
|
+
items,
|
|
1847
|
+
active,
|
|
1848
|
+
renderItem({ item, isActive, index }) {
|
|
1849
|
+
if (Separator.isSeparator(item)) {
|
|
1850
|
+
separatorCount++;
|
|
1851
|
+
return ` ${item.separator}`;
|
|
1852
|
+
}
|
|
1853
|
+
const cursor = isActive ? theme.icon.cursor : " ";
|
|
1854
|
+
const indexLabel = theme.indexMode === "number" ? `${index + 1 - separatorCount}. ` : "";
|
|
1855
|
+
if (item.disabled) {
|
|
1856
|
+
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
1857
|
+
const disabledCursor = isActive ? theme.icon.cursor : "-";
|
|
1858
|
+
return theme.style.disabled(`${disabledCursor} ${indexLabel}${item.name} ${disabledLabel}`);
|
|
1859
|
+
}
|
|
1860
|
+
const color = isActive ? theme.style.highlight : (x) => x;
|
|
1861
|
+
return color(`${cursor} ${indexLabel}${item.name}`);
|
|
1862
|
+
},
|
|
1863
|
+
pageSize,
|
|
1864
|
+
loop
|
|
1865
|
+
});
|
|
1866
|
+
if (status === "done") {
|
|
1867
|
+
return [prefix, message, theme.style.answer(selectedChoice.short)].filter(Boolean).join(" ");
|
|
1868
|
+
}
|
|
1869
|
+
const { description } = selectedChoice;
|
|
1870
|
+
const lines = [
|
|
1871
|
+
[prefix, message].filter(Boolean).join(" "),
|
|
1872
|
+
page,
|
|
1873
|
+
" ",
|
|
1874
|
+
description ? theme.style.description(description) : "",
|
|
1875
|
+
errorMsg ? theme.style.error(errorMsg) : "",
|
|
1876
|
+
helpLine
|
|
1877
|
+
].filter(Boolean).join(`
|
|
1878
|
+
`).trimEnd();
|
|
1879
|
+
return `${lines}${cursorHide}`;
|
|
1880
|
+
});
|
|
1881
|
+
export { onExit, dist_default4 as dist_default, dist_default5 as dist_default1, dist_default6 as dist_default2, default2 as default, Separator2 as Separator, default3 as default1, default4 as default2, default5 as default3, default6 as default4, default7 as default5, default8 as default6 };
|