@mistweaverco/kulala-cli 0.2.1 → 0.4.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.cjs +1776 -10
- package/dist/install-backend.cjs +1 -1
- package/package.json +4 -1
package/dist/cli.cjs
CHANGED
|
@@ -41,9 +41,12 @@ fs = __toESM(fs, 1);
|
|
|
41
41
|
let path = require("path");
|
|
42
42
|
path = __toESM(path, 1);
|
|
43
43
|
let stream_promises = require("stream/promises");
|
|
44
|
+
let node_async_hooks = require("node:async_hooks");
|
|
45
|
+
let node_readline = require("node:readline");
|
|
46
|
+
node_readline = __toESM(node_readline, 1);
|
|
44
47
|
var package_default = {
|
|
45
48
|
name: "@mistweaverco/kulala-cli",
|
|
46
|
-
version: "0.
|
|
49
|
+
version: "0.4.0",
|
|
47
50
|
repository: {
|
|
48
51
|
"type": "git",
|
|
49
52
|
"url": "https://github.com/mistweaverco/kulala-cli"
|
|
@@ -59,6 +62,9 @@ var package_default = {
|
|
|
59
62
|
"postinstall": "node dist/install-backend.cjs || true"
|
|
60
63
|
},
|
|
61
64
|
devDependencies: {
|
|
65
|
+
"@inquirer/core": "^11.2.1",
|
|
66
|
+
"@inquirer/select": "4.3.4",
|
|
67
|
+
"@inquirer/type": "^4.0.7",
|
|
62
68
|
"@types/node": "25.9.1",
|
|
63
69
|
"chalk": "5.6.2",
|
|
64
70
|
"cli-highlight": "2.1.11",
|
|
@@ -3465,7 +3471,7 @@ function fileWalker(inputPath, extensions) {
|
|
|
3465
3471
|
}
|
|
3466
3472
|
//#endregion
|
|
3467
3473
|
//#region src/versions/backend.ts
|
|
3468
|
-
var KULALA_CORE_VERSION = "0.
|
|
3474
|
+
var KULALA_CORE_VERSION = "0.21.0";
|
|
3469
3475
|
//#endregion
|
|
3470
3476
|
//#region src/lib/downloader/index.ts
|
|
3471
3477
|
var BINARY_NAME = "kulala-core";
|
|
@@ -3627,6 +3633,7 @@ var downloader = {
|
|
|
3627
3633
|
var cachedExecutable = null;
|
|
3628
3634
|
async function executablePath() {
|
|
3629
3635
|
if (!cachedExecutable) cachedExecutable = await downloader.ensureInstalled();
|
|
3636
|
+
if (!cachedExecutable) throw new Error("kulala-core executable not resolved");
|
|
3630
3637
|
return cachedExecutable;
|
|
3631
3638
|
}
|
|
3632
3639
|
function invoke(payload, options = {}) {
|
|
@@ -3656,7 +3663,18 @@ async function runHttp(options, invokeOptions = {}) {
|
|
|
3656
3663
|
haltOnError: options.haltOnError
|
|
3657
3664
|
}, invokeOptions);
|
|
3658
3665
|
}
|
|
3659
|
-
|
|
3666
|
+
async function environments(options = {}, invokeOptions = {}) {
|
|
3667
|
+
await executablePath();
|
|
3668
|
+
return invoke({
|
|
3669
|
+
action: "environments",
|
|
3670
|
+
cwd: options.cwd,
|
|
3671
|
+
filepath: options.filepath
|
|
3672
|
+
}, invokeOptions);
|
|
3673
|
+
}
|
|
3674
|
+
var kulalaCore = {
|
|
3675
|
+
runHttp,
|
|
3676
|
+
environments
|
|
3677
|
+
};
|
|
3660
3678
|
//#endregion
|
|
3661
3679
|
//#region node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
3662
3680
|
var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -34625,7 +34643,7 @@ var require_zephir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
34625
34643
|
}));
|
|
34626
34644
|
//#endregion
|
|
34627
34645
|
//#region node_modules/.pnpm/highlight.js@10.7.3/node_modules/highlight.js/lib/index.js
|
|
34628
|
-
var require_lib$
|
|
34646
|
+
var require_lib$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
34629
34647
|
var hljs = require_core();
|
|
34630
34648
|
hljs.registerLanguage("1c", require__1c());
|
|
34631
34649
|
hljs.registerLanguage("abnf", require_abnf());
|
|
@@ -59656,7 +59674,7 @@ var require_serializer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
59656
59674
|
}));
|
|
59657
59675
|
//#endregion
|
|
59658
59676
|
//#region node_modules/.pnpm/parse5@5.1.1/node_modules/parse5/lib/index.js
|
|
59659
|
-
var require_lib$
|
|
59677
|
+
var require_lib$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
59660
59678
|
var Parser = require_parser();
|
|
59661
59679
|
var Serializer = require_serializer();
|
|
59662
59680
|
exports.parse = function parse(html, options) {
|
|
@@ -60032,7 +60050,7 @@ var require_doctype = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
60032
60050
|
}));
|
|
60033
60051
|
//#endregion
|
|
60034
60052
|
//#region node_modules/.pnpm/parse5-htmlparser2-tree-adapter@6.0.1/node_modules/parse5-htmlparser2-tree-adapter/lib/index.js
|
|
60035
|
-
var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
60053
|
+
var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
60036
60054
|
var doctype = require_doctype();
|
|
60037
60055
|
var { DOCUMENT_MODE } = require_html();
|
|
60038
60056
|
var nodeTypes = {
|
|
@@ -62712,9 +62730,9 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
62712
62730
|
};
|
|
62713
62731
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62714
62732
|
exports.supportsLanguage = exports.listLanguages = exports.highlight = void 0;
|
|
62715
|
-
var hljs = __importStar(require_lib$
|
|
62716
|
-
var parse5 = __importStar(require_lib$
|
|
62717
|
-
var parse5_htmlparser2_tree_adapter_1 = __importDefault(require_lib());
|
|
62733
|
+
var hljs = __importStar(require_lib$3());
|
|
62734
|
+
var parse5 = __importStar(require_lib$2());
|
|
62735
|
+
var parse5_htmlparser2_tree_adapter_1 = __importDefault(require_lib$1());
|
|
62718
62736
|
var theme_1 = require_theme();
|
|
62719
62737
|
function colorizeNode(node, theme, context) {
|
|
62720
62738
|
if (theme === void 0) theme = {};
|
|
@@ -63421,10 +63439,1758 @@ async function run(inputPath, options) {
|
|
|
63421
63439
|
if (hasFailures(results)) process.exit(1);
|
|
63422
63440
|
}
|
|
63423
63441
|
//#endregion
|
|
63442
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/key.js
|
|
63443
|
+
var keybindingLookup = new Set(["emacs", "vim"]);
|
|
63444
|
+
function isKeybinding(value) {
|
|
63445
|
+
return keybindingLookup.has(value);
|
|
63446
|
+
}
|
|
63447
|
+
function getDefaultKeybindings() {
|
|
63448
|
+
const env = process.env["INQUIRER_KEYBINDINGS"];
|
|
63449
|
+
if (!env) return [];
|
|
63450
|
+
return Array.from(new Set(env.toLowerCase().split(/[\s,]+/).filter(isKeybinding)));
|
|
63451
|
+
}
|
|
63452
|
+
var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
63453
|
+
var isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
63454
|
+
var isBackspaceKey = (key) => key.name === "backspace";
|
|
63455
|
+
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
63456
|
+
//#endregion
|
|
63457
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/errors.js
|
|
63458
|
+
var AbortPromptError = class extends Error {
|
|
63459
|
+
name = "AbortPromptError";
|
|
63460
|
+
message = "Prompt was aborted";
|
|
63461
|
+
constructor(options) {
|
|
63462
|
+
super();
|
|
63463
|
+
this.cause = options?.cause;
|
|
63464
|
+
}
|
|
63465
|
+
};
|
|
63466
|
+
var CancelPromptError = class extends Error {
|
|
63467
|
+
name = "CancelPromptError";
|
|
63468
|
+
message = "Prompt was canceled";
|
|
63469
|
+
};
|
|
63470
|
+
var ExitPromptError = class extends Error {
|
|
63471
|
+
name = "ExitPromptError";
|
|
63472
|
+
};
|
|
63473
|
+
var HookError = class extends Error {
|
|
63474
|
+
name = "HookError";
|
|
63475
|
+
};
|
|
63476
|
+
var ValidationError = class extends Error {
|
|
63477
|
+
name = "ValidationError";
|
|
63478
|
+
};
|
|
63479
|
+
//#endregion
|
|
63480
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
63481
|
+
var hookStorage = new node_async_hooks.AsyncLocalStorage();
|
|
63482
|
+
function createStore(rl) {
|
|
63483
|
+
return {
|
|
63484
|
+
rl,
|
|
63485
|
+
hooks: [],
|
|
63486
|
+
hooksCleanup: [],
|
|
63487
|
+
hooksEffect: [],
|
|
63488
|
+
index: 0,
|
|
63489
|
+
handleChange() {}
|
|
63490
|
+
};
|
|
63491
|
+
}
|
|
63492
|
+
function withHooks(rl, cb) {
|
|
63493
|
+
const store = createStore(rl);
|
|
63494
|
+
return hookStorage.run(store, () => {
|
|
63495
|
+
function cycle(render) {
|
|
63496
|
+
store.handleChange = () => {
|
|
63497
|
+
store.index = 0;
|
|
63498
|
+
render();
|
|
63499
|
+
};
|
|
63500
|
+
store.handleChange();
|
|
63501
|
+
}
|
|
63502
|
+
return cb(cycle);
|
|
63503
|
+
});
|
|
63504
|
+
}
|
|
63505
|
+
function getStore() {
|
|
63506
|
+
const store = hookStorage.getStore();
|
|
63507
|
+
if (!store) throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
63508
|
+
return store;
|
|
63509
|
+
}
|
|
63510
|
+
function readline() {
|
|
63511
|
+
return getStore().rl;
|
|
63512
|
+
}
|
|
63513
|
+
function withUpdates(fn) {
|
|
63514
|
+
const wrapped = (...args) => {
|
|
63515
|
+
const store = getStore();
|
|
63516
|
+
let shouldUpdate = false;
|
|
63517
|
+
const oldHandleChange = store.handleChange;
|
|
63518
|
+
store.handleChange = () => {
|
|
63519
|
+
shouldUpdate = true;
|
|
63520
|
+
};
|
|
63521
|
+
const returnValue = fn(...args);
|
|
63522
|
+
if (shouldUpdate) oldHandleChange();
|
|
63523
|
+
store.handleChange = oldHandleChange;
|
|
63524
|
+
return returnValue;
|
|
63525
|
+
};
|
|
63526
|
+
return node_async_hooks.AsyncResource.bind(wrapped);
|
|
63527
|
+
}
|
|
63528
|
+
function withPointer(cb) {
|
|
63529
|
+
const store = getStore();
|
|
63530
|
+
const { index } = store;
|
|
63531
|
+
const returnValue = cb({
|
|
63532
|
+
get() {
|
|
63533
|
+
return store.hooks[index];
|
|
63534
|
+
},
|
|
63535
|
+
set(value) {
|
|
63536
|
+
store.hooks[index] = value;
|
|
63537
|
+
},
|
|
63538
|
+
initialized: index in store.hooks
|
|
63539
|
+
});
|
|
63540
|
+
store.index++;
|
|
63541
|
+
return returnValue;
|
|
63542
|
+
}
|
|
63543
|
+
function handleChange() {
|
|
63544
|
+
getStore().handleChange();
|
|
63545
|
+
}
|
|
63546
|
+
var effectScheduler = {
|
|
63547
|
+
queue(cb) {
|
|
63548
|
+
const store = getStore();
|
|
63549
|
+
const { index } = store;
|
|
63550
|
+
store.hooksEffect.push(() => {
|
|
63551
|
+
store.hooksCleanup[index]?.();
|
|
63552
|
+
const cleanFn = cb(readline());
|
|
63553
|
+
if (cleanFn != null && typeof cleanFn !== "function") throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
63554
|
+
store.hooksCleanup[index] = cleanFn;
|
|
63555
|
+
});
|
|
63556
|
+
},
|
|
63557
|
+
run() {
|
|
63558
|
+
const store = getStore();
|
|
63559
|
+
withUpdates(() => {
|
|
63560
|
+
store.hooksEffect.forEach((effect) => {
|
|
63561
|
+
effect();
|
|
63562
|
+
});
|
|
63563
|
+
store.hooksEffect.length = 0;
|
|
63564
|
+
})();
|
|
63565
|
+
},
|
|
63566
|
+
clearAll() {
|
|
63567
|
+
const store = getStore();
|
|
63568
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
63569
|
+
cleanFn?.();
|
|
63570
|
+
});
|
|
63571
|
+
store.hooksEffect.length = 0;
|
|
63572
|
+
store.hooksCleanup.length = 0;
|
|
63573
|
+
}
|
|
63574
|
+
};
|
|
63575
|
+
//#endregion
|
|
63576
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
63577
|
+
function isFactory(value) {
|
|
63578
|
+
return typeof value === "function";
|
|
63579
|
+
}
|
|
63580
|
+
function useState(defaultValue) {
|
|
63581
|
+
return withPointer((pointer) => {
|
|
63582
|
+
const setState = node_async_hooks.AsyncResource.bind(function setState(newValue) {
|
|
63583
|
+
if (pointer.get() !== newValue) {
|
|
63584
|
+
pointer.set(newValue);
|
|
63585
|
+
handleChange();
|
|
63586
|
+
}
|
|
63587
|
+
});
|
|
63588
|
+
if (pointer.initialized) return [pointer.get(), setState];
|
|
63589
|
+
const value = isFactory(defaultValue) ? defaultValue() : defaultValue;
|
|
63590
|
+
pointer.set(value);
|
|
63591
|
+
return [value, setState];
|
|
63592
|
+
});
|
|
63593
|
+
}
|
|
63594
|
+
//#endregion
|
|
63595
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
63596
|
+
function useEffect(cb, depArray) {
|
|
63597
|
+
withPointer((pointer) => {
|
|
63598
|
+
const oldDeps = pointer.get();
|
|
63599
|
+
if (!Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]))) effectScheduler.queue(cb);
|
|
63600
|
+
pointer.set(depArray);
|
|
63601
|
+
});
|
|
63602
|
+
}
|
|
63603
|
+
//#endregion
|
|
63604
|
+
//#region node_modules/.pnpm/@inquirer+figures@2.0.7/node_modules/@inquirer/figures/dist/index.js
|
|
63605
|
+
function isUnicodeSupported() {
|
|
63606
|
+
if (!node_process.default.platform.startsWith("win")) return node_process.default.env["TERM"] !== "linux";
|
|
63607
|
+
return Boolean(node_process.default.env["CI"]) || Boolean(node_process.default.env["WT_SESSION"]) || Boolean(node_process.default.env["TERMINUS_SUBLIME"]) || node_process.default.env["ConEmuTask"] === "{cmd::Cmder}" || node_process.default.env["TERM_PROGRAM"] === "Terminus-Sublime" || node_process.default.env["TERM_PROGRAM"] === "vscode" || node_process.default.env["TERM"] === "xterm-256color" || node_process.default.env["TERM"] === "alacritty" || node_process.default.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
|
|
63608
|
+
}
|
|
63609
|
+
var common = {
|
|
63610
|
+
circleQuestionMark: "(?)",
|
|
63611
|
+
questionMarkPrefix: "(?)",
|
|
63612
|
+
square: "█",
|
|
63613
|
+
squareDarkShade: "▓",
|
|
63614
|
+
squareMediumShade: "▒",
|
|
63615
|
+
squareLightShade: "░",
|
|
63616
|
+
squareTop: "▀",
|
|
63617
|
+
squareBottom: "▄",
|
|
63618
|
+
squareLeft: "▌",
|
|
63619
|
+
squareRight: "▐",
|
|
63620
|
+
squareCenter: "■",
|
|
63621
|
+
bullet: "●",
|
|
63622
|
+
dot: "․",
|
|
63623
|
+
ellipsis: "…",
|
|
63624
|
+
pointerSmall: "›",
|
|
63625
|
+
triangleUp: "▲",
|
|
63626
|
+
triangleUpSmall: "▴",
|
|
63627
|
+
triangleDown: "▼",
|
|
63628
|
+
triangleDownSmall: "▾",
|
|
63629
|
+
triangleLeftSmall: "◂",
|
|
63630
|
+
triangleRightSmall: "▸",
|
|
63631
|
+
home: "⌂",
|
|
63632
|
+
heart: "♥",
|
|
63633
|
+
musicNote: "♪",
|
|
63634
|
+
musicNoteBeamed: "♫",
|
|
63635
|
+
arrowUp: "↑",
|
|
63636
|
+
arrowDown: "↓",
|
|
63637
|
+
arrowLeft: "←",
|
|
63638
|
+
arrowRight: "→",
|
|
63639
|
+
arrowLeftRight: "↔",
|
|
63640
|
+
arrowUpDown: "↕",
|
|
63641
|
+
almostEqual: "≈",
|
|
63642
|
+
notEqual: "≠",
|
|
63643
|
+
lessOrEqual: "≤",
|
|
63644
|
+
greaterOrEqual: "≥",
|
|
63645
|
+
identical: "≡",
|
|
63646
|
+
infinity: "∞",
|
|
63647
|
+
subscriptZero: "₀",
|
|
63648
|
+
subscriptOne: "₁",
|
|
63649
|
+
subscriptTwo: "₂",
|
|
63650
|
+
subscriptThree: "₃",
|
|
63651
|
+
subscriptFour: "₄",
|
|
63652
|
+
subscriptFive: "₅",
|
|
63653
|
+
subscriptSix: "₆",
|
|
63654
|
+
subscriptSeven: "₇",
|
|
63655
|
+
subscriptEight: "₈",
|
|
63656
|
+
subscriptNine: "₉",
|
|
63657
|
+
oneHalf: "½",
|
|
63658
|
+
oneThird: "⅓",
|
|
63659
|
+
oneQuarter: "¼",
|
|
63660
|
+
oneFifth: "⅕",
|
|
63661
|
+
oneSixth: "⅙",
|
|
63662
|
+
oneEighth: "⅛",
|
|
63663
|
+
twoThirds: "⅔",
|
|
63664
|
+
twoFifths: "⅖",
|
|
63665
|
+
threeQuarters: "¾",
|
|
63666
|
+
threeFifths: "⅗",
|
|
63667
|
+
threeEighths: "⅜",
|
|
63668
|
+
fourFifths: "⅘",
|
|
63669
|
+
fiveSixths: "⅚",
|
|
63670
|
+
fiveEighths: "⅝",
|
|
63671
|
+
sevenEighths: "⅞",
|
|
63672
|
+
line: "─",
|
|
63673
|
+
lineBold: "━",
|
|
63674
|
+
lineDouble: "═",
|
|
63675
|
+
lineDashed0: "┄",
|
|
63676
|
+
lineDashed1: "┅",
|
|
63677
|
+
lineDashed2: "┈",
|
|
63678
|
+
lineDashed3: "┉",
|
|
63679
|
+
lineDashed4: "╌",
|
|
63680
|
+
lineDashed5: "╍",
|
|
63681
|
+
lineDashed6: "╴",
|
|
63682
|
+
lineDashed7: "╶",
|
|
63683
|
+
lineDashed8: "╸",
|
|
63684
|
+
lineDashed9: "╺",
|
|
63685
|
+
lineDashed10: "╼",
|
|
63686
|
+
lineDashed11: "╾",
|
|
63687
|
+
lineDashed12: "−",
|
|
63688
|
+
lineDashed13: "–",
|
|
63689
|
+
lineDashed14: "‐",
|
|
63690
|
+
lineDashed15: "⁃",
|
|
63691
|
+
lineVertical: "│",
|
|
63692
|
+
lineVerticalBold: "┃",
|
|
63693
|
+
lineVerticalDouble: "║",
|
|
63694
|
+
lineVerticalDashed0: "┆",
|
|
63695
|
+
lineVerticalDashed1: "┇",
|
|
63696
|
+
lineVerticalDashed2: "┊",
|
|
63697
|
+
lineVerticalDashed3: "┋",
|
|
63698
|
+
lineVerticalDashed4: "╎",
|
|
63699
|
+
lineVerticalDashed5: "╏",
|
|
63700
|
+
lineVerticalDashed6: "╵",
|
|
63701
|
+
lineVerticalDashed7: "╷",
|
|
63702
|
+
lineVerticalDashed8: "╹",
|
|
63703
|
+
lineVerticalDashed9: "╻",
|
|
63704
|
+
lineVerticalDashed10: "╽",
|
|
63705
|
+
lineVerticalDashed11: "╿",
|
|
63706
|
+
lineDownLeft: "┐",
|
|
63707
|
+
lineDownLeftArc: "╮",
|
|
63708
|
+
lineDownBoldLeftBold: "┓",
|
|
63709
|
+
lineDownBoldLeft: "┒",
|
|
63710
|
+
lineDownLeftBold: "┑",
|
|
63711
|
+
lineDownDoubleLeftDouble: "╗",
|
|
63712
|
+
lineDownDoubleLeft: "╖",
|
|
63713
|
+
lineDownLeftDouble: "╕",
|
|
63714
|
+
lineDownRight: "┌",
|
|
63715
|
+
lineDownRightArc: "╭",
|
|
63716
|
+
lineDownBoldRightBold: "┏",
|
|
63717
|
+
lineDownBoldRight: "┎",
|
|
63718
|
+
lineDownRightBold: "┍",
|
|
63719
|
+
lineDownDoubleRightDouble: "╔",
|
|
63720
|
+
lineDownDoubleRight: "╓",
|
|
63721
|
+
lineDownRightDouble: "╒",
|
|
63722
|
+
lineUpLeft: "┘",
|
|
63723
|
+
lineUpLeftArc: "╯",
|
|
63724
|
+
lineUpBoldLeftBold: "┛",
|
|
63725
|
+
lineUpBoldLeft: "┚",
|
|
63726
|
+
lineUpLeftBold: "┙",
|
|
63727
|
+
lineUpDoubleLeftDouble: "╝",
|
|
63728
|
+
lineUpDoubleLeft: "╜",
|
|
63729
|
+
lineUpLeftDouble: "╛",
|
|
63730
|
+
lineUpRight: "└",
|
|
63731
|
+
lineUpRightArc: "╰",
|
|
63732
|
+
lineUpBoldRightBold: "┗",
|
|
63733
|
+
lineUpBoldRight: "┖",
|
|
63734
|
+
lineUpRightBold: "┕",
|
|
63735
|
+
lineUpDoubleRightDouble: "╚",
|
|
63736
|
+
lineUpDoubleRight: "╙",
|
|
63737
|
+
lineUpRightDouble: "╘",
|
|
63738
|
+
lineUpDownLeft: "┤",
|
|
63739
|
+
lineUpBoldDownBoldLeftBold: "┫",
|
|
63740
|
+
lineUpBoldDownBoldLeft: "┨",
|
|
63741
|
+
lineUpDownLeftBold: "┥",
|
|
63742
|
+
lineUpBoldDownLeftBold: "┩",
|
|
63743
|
+
lineUpDownBoldLeftBold: "┪",
|
|
63744
|
+
lineUpDownBoldLeft: "┧",
|
|
63745
|
+
lineUpBoldDownLeft: "┦",
|
|
63746
|
+
lineUpDoubleDownDoubleLeftDouble: "╣",
|
|
63747
|
+
lineUpDoubleDownDoubleLeft: "╢",
|
|
63748
|
+
lineUpDownLeftDouble: "╡",
|
|
63749
|
+
lineUpDownRight: "├",
|
|
63750
|
+
lineUpBoldDownBoldRightBold: "┣",
|
|
63751
|
+
lineUpBoldDownBoldRight: "┠",
|
|
63752
|
+
lineUpDownRightBold: "┝",
|
|
63753
|
+
lineUpBoldDownRightBold: "┡",
|
|
63754
|
+
lineUpDownBoldRightBold: "┢",
|
|
63755
|
+
lineUpDownBoldRight: "┟",
|
|
63756
|
+
lineUpBoldDownRight: "┞",
|
|
63757
|
+
lineUpDoubleDownDoubleRightDouble: "╠",
|
|
63758
|
+
lineUpDoubleDownDoubleRight: "╟",
|
|
63759
|
+
lineUpDownRightDouble: "╞",
|
|
63760
|
+
lineDownLeftRight: "┬",
|
|
63761
|
+
lineDownBoldLeftBoldRightBold: "┳",
|
|
63762
|
+
lineDownLeftBoldRightBold: "┯",
|
|
63763
|
+
lineDownBoldLeftRight: "┰",
|
|
63764
|
+
lineDownBoldLeftBoldRight: "┱",
|
|
63765
|
+
lineDownBoldLeftRightBold: "┲",
|
|
63766
|
+
lineDownLeftRightBold: "┮",
|
|
63767
|
+
lineDownLeftBoldRight: "┭",
|
|
63768
|
+
lineDownDoubleLeftDoubleRightDouble: "╦",
|
|
63769
|
+
lineDownDoubleLeftRight: "╥",
|
|
63770
|
+
lineDownLeftDoubleRightDouble: "╤",
|
|
63771
|
+
lineUpLeftRight: "┴",
|
|
63772
|
+
lineUpBoldLeftBoldRightBold: "┻",
|
|
63773
|
+
lineUpLeftBoldRightBold: "┷",
|
|
63774
|
+
lineUpBoldLeftRight: "┸",
|
|
63775
|
+
lineUpBoldLeftBoldRight: "┹",
|
|
63776
|
+
lineUpBoldLeftRightBold: "┺",
|
|
63777
|
+
lineUpLeftRightBold: "┶",
|
|
63778
|
+
lineUpLeftBoldRight: "┵",
|
|
63779
|
+
lineUpDoubleLeftDoubleRightDouble: "╩",
|
|
63780
|
+
lineUpDoubleLeftRight: "╨",
|
|
63781
|
+
lineUpLeftDoubleRightDouble: "╧",
|
|
63782
|
+
lineUpDownLeftRight: "┼",
|
|
63783
|
+
lineUpBoldDownBoldLeftBoldRightBold: "╋",
|
|
63784
|
+
lineUpDownBoldLeftBoldRightBold: "╈",
|
|
63785
|
+
lineUpBoldDownLeftBoldRightBold: "╇",
|
|
63786
|
+
lineUpBoldDownBoldLeftRightBold: "╊",
|
|
63787
|
+
lineUpBoldDownBoldLeftBoldRight: "╉",
|
|
63788
|
+
lineUpBoldDownLeftRight: "╀",
|
|
63789
|
+
lineUpDownBoldLeftRight: "╁",
|
|
63790
|
+
lineUpDownLeftBoldRight: "┽",
|
|
63791
|
+
lineUpDownLeftRightBold: "┾",
|
|
63792
|
+
lineUpBoldDownBoldLeftRight: "╂",
|
|
63793
|
+
lineUpDownLeftBoldRightBold: "┿",
|
|
63794
|
+
lineUpBoldDownLeftBoldRight: "╃",
|
|
63795
|
+
lineUpBoldDownLeftRightBold: "╄",
|
|
63796
|
+
lineUpDownBoldLeftBoldRight: "╅",
|
|
63797
|
+
lineUpDownBoldLeftRightBold: "╆",
|
|
63798
|
+
lineUpDoubleDownDoubleLeftDoubleRightDouble: "╬",
|
|
63799
|
+
lineUpDoubleDownDoubleLeftRight: "╫",
|
|
63800
|
+
lineUpDownLeftDoubleRightDouble: "╪",
|
|
63801
|
+
lineCross: "╳",
|
|
63802
|
+
lineBackslash: "╲",
|
|
63803
|
+
lineSlash: "╱"
|
|
63804
|
+
};
|
|
63805
|
+
var specialMainSymbols = {
|
|
63806
|
+
tick: "✔",
|
|
63807
|
+
info: "ℹ",
|
|
63808
|
+
warning: "⚠",
|
|
63809
|
+
cross: "✘",
|
|
63810
|
+
squareSmall: "◻",
|
|
63811
|
+
squareSmallFilled: "◼",
|
|
63812
|
+
circle: "◯",
|
|
63813
|
+
circleFilled: "◉",
|
|
63814
|
+
circleDotted: "◌",
|
|
63815
|
+
circleDouble: "◎",
|
|
63816
|
+
circleCircle: "ⓞ",
|
|
63817
|
+
circleCross: "ⓧ",
|
|
63818
|
+
circlePipe: "Ⓘ",
|
|
63819
|
+
radioOn: "◉",
|
|
63820
|
+
radioOff: "◯",
|
|
63821
|
+
checkboxOn: "☒",
|
|
63822
|
+
checkboxOff: "☐",
|
|
63823
|
+
checkboxCircleOn: "ⓧ",
|
|
63824
|
+
checkboxCircleOff: "Ⓘ",
|
|
63825
|
+
pointer: "❯",
|
|
63826
|
+
triangleUpOutline: "△",
|
|
63827
|
+
triangleLeft: "◀",
|
|
63828
|
+
triangleRight: "▶",
|
|
63829
|
+
lozenge: "◆",
|
|
63830
|
+
lozengeOutline: "◇",
|
|
63831
|
+
hamburger: "☰",
|
|
63832
|
+
smiley: "㋡",
|
|
63833
|
+
mustache: "෴",
|
|
63834
|
+
star: "★",
|
|
63835
|
+
play: "▶",
|
|
63836
|
+
nodejs: "⬢",
|
|
63837
|
+
oneSeventh: "⅐",
|
|
63838
|
+
oneNinth: "⅑",
|
|
63839
|
+
oneTenth: "⅒"
|
|
63840
|
+
};
|
|
63841
|
+
var specialFallbackSymbols = {
|
|
63842
|
+
tick: "√",
|
|
63843
|
+
info: "i",
|
|
63844
|
+
warning: "‼",
|
|
63845
|
+
cross: "×",
|
|
63846
|
+
squareSmall: "□",
|
|
63847
|
+
squareSmallFilled: "■",
|
|
63848
|
+
circle: "( )",
|
|
63849
|
+
circleFilled: "(*)",
|
|
63850
|
+
circleDotted: "( )",
|
|
63851
|
+
circleDouble: "( )",
|
|
63852
|
+
circleCircle: "(○)",
|
|
63853
|
+
circleCross: "(×)",
|
|
63854
|
+
circlePipe: "(│)",
|
|
63855
|
+
radioOn: "(*)",
|
|
63856
|
+
radioOff: "( )",
|
|
63857
|
+
checkboxOn: "[×]",
|
|
63858
|
+
checkboxOff: "[ ]",
|
|
63859
|
+
checkboxCircleOn: "(×)",
|
|
63860
|
+
checkboxCircleOff: "( )",
|
|
63861
|
+
pointer: ">",
|
|
63862
|
+
triangleUpOutline: "∆",
|
|
63863
|
+
triangleLeft: "◄",
|
|
63864
|
+
triangleRight: "►",
|
|
63865
|
+
lozenge: "♦",
|
|
63866
|
+
lozengeOutline: "◊",
|
|
63867
|
+
hamburger: "≡",
|
|
63868
|
+
smiley: "☺",
|
|
63869
|
+
mustache: "┌─┐",
|
|
63870
|
+
star: "✶",
|
|
63871
|
+
play: "►",
|
|
63872
|
+
nodejs: "♦",
|
|
63873
|
+
oneSeventh: "1/7",
|
|
63874
|
+
oneNinth: "1/9",
|
|
63875
|
+
oneTenth: "1/10"
|
|
63876
|
+
};
|
|
63877
|
+
var mainSymbols = {
|
|
63878
|
+
...common,
|
|
63879
|
+
...specialMainSymbols
|
|
63880
|
+
};
|
|
63881
|
+
var fallbackSymbols = {
|
|
63882
|
+
...common,
|
|
63883
|
+
...specialFallbackSymbols
|
|
63884
|
+
};
|
|
63885
|
+
var figures = isUnicodeSupported() ? mainSymbols : fallbackSymbols;
|
|
63886
|
+
Object.entries(specialMainSymbols);
|
|
63887
|
+
//#endregion
|
|
63888
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/theme.js
|
|
63889
|
+
var defaultTheme = {
|
|
63890
|
+
prefix: {
|
|
63891
|
+
idle: (0, node_util.styleText)("blue", "?"),
|
|
63892
|
+
done: (0, node_util.styleText)("green", figures.tick)
|
|
63893
|
+
},
|
|
63894
|
+
spinner: {
|
|
63895
|
+
interval: 80,
|
|
63896
|
+
frames: [
|
|
63897
|
+
"⠋",
|
|
63898
|
+
"⠙",
|
|
63899
|
+
"⠹",
|
|
63900
|
+
"⠸",
|
|
63901
|
+
"⠼",
|
|
63902
|
+
"⠴",
|
|
63903
|
+
"⠦",
|
|
63904
|
+
"⠧",
|
|
63905
|
+
"⠇",
|
|
63906
|
+
"⠏"
|
|
63907
|
+
].map((frame) => (0, node_util.styleText)("yellow", frame))
|
|
63908
|
+
},
|
|
63909
|
+
keybindings: [],
|
|
63910
|
+
style: {
|
|
63911
|
+
answer: (text) => (0, node_util.styleText)("cyan", text),
|
|
63912
|
+
message: (text) => (0, node_util.styleText)("bold", text),
|
|
63913
|
+
error: (text) => (0, node_util.styleText)("red", `> ${text}`),
|
|
63914
|
+
defaultAnswer: (text) => (0, node_util.styleText)("dim", `(${text})`),
|
|
63915
|
+
help: (text) => (0, node_util.styleText)("dim", text),
|
|
63916
|
+
highlight: (text) => (0, node_util.styleText)("cyan", text),
|
|
63917
|
+
key: (text) => (0, node_util.styleText)("cyan", (0, node_util.styleText)("bold", `<${text}>`))
|
|
63918
|
+
}
|
|
63919
|
+
};
|
|
63920
|
+
function getDefaultTheme() {
|
|
63921
|
+
return {
|
|
63922
|
+
...defaultTheme,
|
|
63923
|
+
keybindings: getDefaultKeybindings()
|
|
63924
|
+
};
|
|
63925
|
+
}
|
|
63926
|
+
//#endregion
|
|
63927
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
63928
|
+
function isPlainObject(value) {
|
|
63929
|
+
if (typeof value !== "object" || value === null) return false;
|
|
63930
|
+
let proto = value;
|
|
63931
|
+
while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
|
|
63932
|
+
return Object.getPrototypeOf(value) === proto;
|
|
63933
|
+
}
|
|
63934
|
+
function deepMerge(...objects) {
|
|
63935
|
+
const output = {};
|
|
63936
|
+
for (const obj of objects) for (const [key, value] of Object.entries(obj)) {
|
|
63937
|
+
const prevValue = output[key];
|
|
63938
|
+
output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
|
|
63939
|
+
}
|
|
63940
|
+
return output;
|
|
63941
|
+
}
|
|
63942
|
+
function makeTheme(...themes) {
|
|
63943
|
+
return deepMerge(...[getDefaultTheme(), ...themes.filter((theme) => theme != null)]);
|
|
63944
|
+
}
|
|
63945
|
+
//#endregion
|
|
63946
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
63947
|
+
function usePrefix({ status = "idle", theme }) {
|
|
63948
|
+
const [showLoader, setShowLoader] = useState(false);
|
|
63949
|
+
const [tick, setTick] = useState(0);
|
|
63950
|
+
const { prefix, spinner } = makeTheme(theme);
|
|
63951
|
+
useEffect(() => {
|
|
63952
|
+
if (status === "loading") {
|
|
63953
|
+
let tickInterval;
|
|
63954
|
+
let inc = -1;
|
|
63955
|
+
const delayTimeout = setTimeout(() => {
|
|
63956
|
+
setShowLoader(true);
|
|
63957
|
+
tickInterval = setInterval(() => {
|
|
63958
|
+
inc = inc + 1;
|
|
63959
|
+
setTick(inc % spinner.frames.length);
|
|
63960
|
+
}, spinner.interval);
|
|
63961
|
+
}, 300);
|
|
63962
|
+
return () => {
|
|
63963
|
+
clearTimeout(delayTimeout);
|
|
63964
|
+
clearInterval(tickInterval);
|
|
63965
|
+
};
|
|
63966
|
+
} else setShowLoader(false);
|
|
63967
|
+
}, [status]);
|
|
63968
|
+
if (showLoader) return spinner.frames[tick];
|
|
63969
|
+
return typeof prefix === "string" ? prefix : prefix[status === "loading" ? "idle" : status] ?? prefix["idle"];
|
|
63970
|
+
}
|
|
63971
|
+
//#endregion
|
|
63972
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
63973
|
+
function useMemo(fn, dependencies) {
|
|
63974
|
+
return withPointer((pointer) => {
|
|
63975
|
+
const prev = pointer.get();
|
|
63976
|
+
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
|
|
63977
|
+
const value = fn();
|
|
63978
|
+
pointer.set({
|
|
63979
|
+
value,
|
|
63980
|
+
dependencies
|
|
63981
|
+
});
|
|
63982
|
+
return value;
|
|
63983
|
+
}
|
|
63984
|
+
return prev.value;
|
|
63985
|
+
});
|
|
63986
|
+
}
|
|
63987
|
+
//#endregion
|
|
63988
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
63989
|
+
function useRef(val) {
|
|
63990
|
+
return useState({ current: val })[0];
|
|
63991
|
+
}
|
|
63992
|
+
//#endregion
|
|
63993
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
63994
|
+
function useKeypress(userHandler) {
|
|
63995
|
+
const signal = useRef(userHandler);
|
|
63996
|
+
signal.current = userHandler;
|
|
63997
|
+
useEffect((rl) => {
|
|
63998
|
+
let ignore = false;
|
|
63999
|
+
const handler = withUpdates((_input, event) => {
|
|
64000
|
+
if (ignore) return;
|
|
64001
|
+
signal.current(event, rl);
|
|
64002
|
+
});
|
|
64003
|
+
rl.input.on("keypress", handler);
|
|
64004
|
+
return () => {
|
|
64005
|
+
ignore = true;
|
|
64006
|
+
rl.input.removeListener("keypress", handler);
|
|
64007
|
+
};
|
|
64008
|
+
}, []);
|
|
64009
|
+
}
|
|
64010
|
+
//#endregion
|
|
64011
|
+
//#region node_modules/.pnpm/cli-width@4.1.0/node_modules/cli-width/index.js
|
|
64012
|
+
var require_cli_width = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
64013
|
+
module.exports = cliWidth;
|
|
64014
|
+
function normalizeOpts(options) {
|
|
64015
|
+
const defaultOpts = {
|
|
64016
|
+
defaultWidth: 0,
|
|
64017
|
+
output: process.stdout,
|
|
64018
|
+
tty: require("tty")
|
|
64019
|
+
};
|
|
64020
|
+
if (!options) return defaultOpts;
|
|
64021
|
+
Object.keys(defaultOpts).forEach(function(key) {
|
|
64022
|
+
if (!options[key]) options[key] = defaultOpts[key];
|
|
64023
|
+
});
|
|
64024
|
+
return options;
|
|
64025
|
+
}
|
|
64026
|
+
function cliWidth(options) {
|
|
64027
|
+
const opts = normalizeOpts(options);
|
|
64028
|
+
if (opts.output.getWindowSize) return opts.output.getWindowSize()[0] || opts.defaultWidth;
|
|
64029
|
+
if (opts.tty.getWindowSize) return opts.tty.getWindowSize()[1] || opts.defaultWidth;
|
|
64030
|
+
if (opts.output.columns) return opts.output.columns;
|
|
64031
|
+
if (process.env.CLI_WIDTH) {
|
|
64032
|
+
const width = parseInt(process.env.CLI_WIDTH, 10);
|
|
64033
|
+
if (!isNaN(width) && width !== 0) return width;
|
|
64034
|
+
}
|
|
64035
|
+
return opts.defaultWidth;
|
|
64036
|
+
}
|
|
64037
|
+
}));
|
|
64038
|
+
//#endregion
|
|
64039
|
+
//#region node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
64040
|
+
var getCodePointsLength = (() => {
|
|
64041
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
64042
|
+
return (input) => {
|
|
64043
|
+
let surrogatePairsNr = 0;
|
|
64044
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
64045
|
+
while (SURROGATE_PAIR_RE.test(input)) surrogatePairsNr += 1;
|
|
64046
|
+
return input.length - surrogatePairsNr;
|
|
64047
|
+
};
|
|
64048
|
+
})();
|
|
64049
|
+
var isFullWidth = (x) => {
|
|
64050
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
64051
|
+
};
|
|
64052
|
+
var isWideNotCJKTNotEmoji = (x) => {
|
|
64053
|
+
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;
|
|
64054
|
+
};
|
|
64055
|
+
//#endregion
|
|
64056
|
+
//#region node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
64057
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
64058
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
64059
|
+
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}/uy;
|
|
64060
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
64061
|
+
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?))*/uy;
|
|
64062
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
64063
|
+
var MODIFIER_RE = /\p{M}+/gu;
|
|
64064
|
+
var NO_TRUNCATION$1 = {
|
|
64065
|
+
limit: Infinity,
|
|
64066
|
+
ellipsis: ""
|
|
64067
|
+
};
|
|
64068
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
64069
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
64070
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
64071
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
|
|
64072
|
+
const ANSI_WIDTH = 0;
|
|
64073
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
64074
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
64075
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
64076
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
64077
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
64078
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
64079
|
+
const PARSE_BLOCKS = [
|
|
64080
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
64081
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
64082
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
64083
|
+
[TAB_RE, TAB_WIDTH],
|
|
64084
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
64085
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
64086
|
+
];
|
|
64087
|
+
let indexPrev = 0;
|
|
64088
|
+
let index = 0;
|
|
64089
|
+
let length = input.length;
|
|
64090
|
+
let lengthExtra = 0;
|
|
64091
|
+
let truncationEnabled = false;
|
|
64092
|
+
let truncationIndex = length;
|
|
64093
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
64094
|
+
let unmatchedStart = 0;
|
|
64095
|
+
let unmatchedEnd = 0;
|
|
64096
|
+
let width = 0;
|
|
64097
|
+
let widthExtra = 0;
|
|
64098
|
+
outer: while (true) {
|
|
64099
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
64100
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
64101
|
+
lengthExtra = 0;
|
|
64102
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
64103
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
64104
|
+
if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
|
|
64105
|
+
else if (isWideNotCJKTNotEmoji(codePoint)) widthExtra = WIDE_WIDTH;
|
|
64106
|
+
else widthExtra = REGULAR_WIDTH;
|
|
64107
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
64108
|
+
if (width + widthExtra > LIMIT) {
|
|
64109
|
+
truncationEnabled = true;
|
|
64110
|
+
break outer;
|
|
64111
|
+
}
|
|
64112
|
+
lengthExtra += char.length;
|
|
64113
|
+
width += widthExtra;
|
|
64114
|
+
}
|
|
64115
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
64116
|
+
}
|
|
64117
|
+
if (index >= length) break outer;
|
|
64118
|
+
for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
|
|
64119
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
|
|
64120
|
+
BLOCK_RE.lastIndex = index;
|
|
64121
|
+
if (BLOCK_RE.test(input)) {
|
|
64122
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
64123
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
64124
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
64125
|
+
if (width + widthExtra > LIMIT) {
|
|
64126
|
+
truncationEnabled = true;
|
|
64127
|
+
break outer;
|
|
64128
|
+
}
|
|
64129
|
+
width += widthExtra;
|
|
64130
|
+
unmatchedStart = indexPrev;
|
|
64131
|
+
unmatchedEnd = index;
|
|
64132
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
64133
|
+
continue outer;
|
|
64134
|
+
}
|
|
64135
|
+
}
|
|
64136
|
+
index += 1;
|
|
64137
|
+
}
|
|
64138
|
+
return {
|
|
64139
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
64140
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
64141
|
+
truncated: truncationEnabled,
|
|
64142
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
64143
|
+
};
|
|
64144
|
+
};
|
|
64145
|
+
//#endregion
|
|
64146
|
+
//#region node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
64147
|
+
var NO_TRUNCATION = {
|
|
64148
|
+
limit: Infinity,
|
|
64149
|
+
ellipsis: "",
|
|
64150
|
+
ellipsisWidth: 0
|
|
64151
|
+
};
|
|
64152
|
+
var fastStringWidth = (input, options = {}) => {
|
|
64153
|
+
return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
|
|
64154
|
+
};
|
|
64155
|
+
//#endregion
|
|
64156
|
+
//#region node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
64157
|
+
var ESC$1 = "\x1B";
|
|
64158
|
+
var CSI = "";
|
|
64159
|
+
var END_CODE = 39;
|
|
64160
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
64161
|
+
var ANSI_CSI = "[";
|
|
64162
|
+
var ANSI_OSC = "]";
|
|
64163
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
64164
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
64165
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
64166
|
+
var getClosingCode = (openingCode) => {
|
|
64167
|
+
if (openingCode >= 30 && openingCode <= 37) return 39;
|
|
64168
|
+
if (openingCode >= 90 && openingCode <= 97) return 39;
|
|
64169
|
+
if (openingCode >= 40 && openingCode <= 47) return 49;
|
|
64170
|
+
if (openingCode >= 100 && openingCode <= 107) return 49;
|
|
64171
|
+
if (openingCode === 1 || openingCode === 2) return 22;
|
|
64172
|
+
if (openingCode === 3) return 23;
|
|
64173
|
+
if (openingCode === 4) return 24;
|
|
64174
|
+
if (openingCode === 7) return 27;
|
|
64175
|
+
if (openingCode === 8) return 28;
|
|
64176
|
+
if (openingCode === 9) return 29;
|
|
64177
|
+
if (openingCode === 0) return 0;
|
|
64178
|
+
};
|
|
64179
|
+
var wrapAnsiCode = (code) => `${ESC$1}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
64180
|
+
var wrapAnsiHyperlink = (url) => `${ESC$1}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
64181
|
+
var wrapWord = (rows, word, columns) => {
|
|
64182
|
+
const characters = word[Symbol.iterator]();
|
|
64183
|
+
let isInsideEscape = false;
|
|
64184
|
+
let isInsideLinkEscape = false;
|
|
64185
|
+
let lastRow = rows.at(-1);
|
|
64186
|
+
let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
|
|
64187
|
+
let currentCharacter = characters.next();
|
|
64188
|
+
let nextCharacter = characters.next();
|
|
64189
|
+
let rawCharacterIndex = 0;
|
|
64190
|
+
while (!currentCharacter.done) {
|
|
64191
|
+
const character = currentCharacter.value;
|
|
64192
|
+
const characterLength = fastStringWidth(character);
|
|
64193
|
+
if (visible + characterLength <= columns) rows[rows.length - 1] += character;
|
|
64194
|
+
else {
|
|
64195
|
+
rows.push(character);
|
|
64196
|
+
visible = 0;
|
|
64197
|
+
}
|
|
64198
|
+
if (character === ESC$1 || character === CSI) {
|
|
64199
|
+
isInsideEscape = true;
|
|
64200
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
64201
|
+
}
|
|
64202
|
+
if (isInsideEscape) {
|
|
64203
|
+
if (isInsideLinkEscape) {
|
|
64204
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
64205
|
+
isInsideEscape = false;
|
|
64206
|
+
isInsideLinkEscape = false;
|
|
64207
|
+
}
|
|
64208
|
+
} else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
|
|
64209
|
+
} else {
|
|
64210
|
+
visible += characterLength;
|
|
64211
|
+
if (visible === columns && !nextCharacter.done) {
|
|
64212
|
+
rows.push("");
|
|
64213
|
+
visible = 0;
|
|
64214
|
+
}
|
|
64215
|
+
}
|
|
64216
|
+
currentCharacter = nextCharacter;
|
|
64217
|
+
nextCharacter = characters.next();
|
|
64218
|
+
rawCharacterIndex += character.length;
|
|
64219
|
+
}
|
|
64220
|
+
lastRow = rows.at(-1);
|
|
64221
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
|
|
64222
|
+
};
|
|
64223
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
64224
|
+
const words = string.split(" ");
|
|
64225
|
+
let last = words.length;
|
|
64226
|
+
while (last) {
|
|
64227
|
+
if (fastStringWidth(words[last - 1])) break;
|
|
64228
|
+
last--;
|
|
64229
|
+
}
|
|
64230
|
+
if (last === words.length) return string;
|
|
64231
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
64232
|
+
};
|
|
64233
|
+
var exec = (string, columns, options = {}) => {
|
|
64234
|
+
if (options.trim !== false && string.trim() === "") return "";
|
|
64235
|
+
let returnValue = "";
|
|
64236
|
+
let escapeCode;
|
|
64237
|
+
let escapeUrl;
|
|
64238
|
+
const words = string.split(" ");
|
|
64239
|
+
let rows = [""];
|
|
64240
|
+
let rowLength = 0;
|
|
64241
|
+
for (let index = 0; index < words.length; index++) {
|
|
64242
|
+
const word = words[index];
|
|
64243
|
+
if (options.trim !== false) {
|
|
64244
|
+
const row = rows.at(-1) ?? "";
|
|
64245
|
+
const trimmed = row.trimStart();
|
|
64246
|
+
if (row.length !== trimmed.length) {
|
|
64247
|
+
rows[rows.length - 1] = trimmed;
|
|
64248
|
+
rowLength = fastStringWidth(trimmed);
|
|
64249
|
+
}
|
|
64250
|
+
}
|
|
64251
|
+
if (index !== 0) {
|
|
64252
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
64253
|
+
rows.push("");
|
|
64254
|
+
rowLength = 0;
|
|
64255
|
+
}
|
|
64256
|
+
if (rowLength || options.trim === false) {
|
|
64257
|
+
rows[rows.length - 1] += " ";
|
|
64258
|
+
rowLength++;
|
|
64259
|
+
}
|
|
64260
|
+
}
|
|
64261
|
+
const wordLength = fastStringWidth(word);
|
|
64262
|
+
if (options.hard && wordLength > columns) {
|
|
64263
|
+
const remainingColumns = columns - rowLength;
|
|
64264
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
64265
|
+
if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
|
|
64266
|
+
wrapWord(rows, word, columns);
|
|
64267
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
64268
|
+
continue;
|
|
64269
|
+
}
|
|
64270
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
64271
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
64272
|
+
wrapWord(rows, word, columns);
|
|
64273
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
64274
|
+
continue;
|
|
64275
|
+
}
|
|
64276
|
+
rows.push("");
|
|
64277
|
+
rowLength = 0;
|
|
64278
|
+
}
|
|
64279
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
64280
|
+
wrapWord(rows, word, columns);
|
|
64281
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
64282
|
+
continue;
|
|
64283
|
+
}
|
|
64284
|
+
rows[rows.length - 1] += word;
|
|
64285
|
+
rowLength += wordLength;
|
|
64286
|
+
}
|
|
64287
|
+
if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
64288
|
+
const preString = rows.join("\n");
|
|
64289
|
+
let inSurrogate = false;
|
|
64290
|
+
for (let i = 0; i < preString.length; i++) {
|
|
64291
|
+
const character = preString[i];
|
|
64292
|
+
returnValue += character;
|
|
64293
|
+
if (!inSurrogate) {
|
|
64294
|
+
inSurrogate = character >= "\ud800" && character <= "\udbff";
|
|
64295
|
+
if (inSurrogate) continue;
|
|
64296
|
+
} else inSurrogate = false;
|
|
64297
|
+
if (character === ESC$1 || character === CSI) {
|
|
64298
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
64299
|
+
const groups = GROUP_REGEX.exec(preString)?.groups;
|
|
64300
|
+
if (groups?.code !== void 0) {
|
|
64301
|
+
const code = Number.parseFloat(groups.code);
|
|
64302
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
64303
|
+
} else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
64304
|
+
}
|
|
64305
|
+
if (preString[i + 1] === "\n") {
|
|
64306
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink("");
|
|
64307
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
64308
|
+
if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
|
|
64309
|
+
} else if (character === "\n") {
|
|
64310
|
+
if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
|
|
64311
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
64312
|
+
}
|
|
64313
|
+
}
|
|
64314
|
+
return returnValue;
|
|
64315
|
+
};
|
|
64316
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
64317
|
+
function wrapAnsi(string, columns, options) {
|
|
64318
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
64319
|
+
}
|
|
64320
|
+
//#endregion
|
|
64321
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/utils.js
|
|
64322
|
+
var import_cli_width = /* @__PURE__ */ __toESM(require_cli_width(), 1);
|
|
64323
|
+
/**
|
|
64324
|
+
* Force line returns at specific width. This function is ANSI code friendly and it'll
|
|
64325
|
+
* ignore invisible codes during width calculation.
|
|
64326
|
+
* @param {string} content
|
|
64327
|
+
* @param {number} width
|
|
64328
|
+
* @return {string}
|
|
64329
|
+
*/
|
|
64330
|
+
function breakLines(content, width) {
|
|
64331
|
+
return content.split("\n").flatMap((line) => wrapAnsi(line, width, {
|
|
64332
|
+
trim: false,
|
|
64333
|
+
wordWrap: false
|
|
64334
|
+
}).split("\n").map((str) => str.trimEnd())).join("\n");
|
|
64335
|
+
}
|
|
64336
|
+
/**
|
|
64337
|
+
* Returns the width of the active readline, or 80 as default value.
|
|
64338
|
+
* @returns {number}
|
|
64339
|
+
*/
|
|
64340
|
+
function readlineWidth() {
|
|
64341
|
+
return (0, import_cli_width.default)({
|
|
64342
|
+
defaultWidth: 80,
|
|
64343
|
+
output: readline().output
|
|
64344
|
+
});
|
|
64345
|
+
}
|
|
64346
|
+
//#endregion
|
|
64347
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
64348
|
+
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
64349
|
+
const state = useRef({
|
|
64350
|
+
lastPointer: active,
|
|
64351
|
+
lastActive: void 0
|
|
64352
|
+
});
|
|
64353
|
+
const { lastPointer, lastActive } = state.current;
|
|
64354
|
+
const middle = Math.floor(pageSize / 2);
|
|
64355
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
64356
|
+
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
|
64357
|
+
let pointer = defaultPointerPosition;
|
|
64358
|
+
if (renderedLength > pageSize) if (loop) {
|
|
64359
|
+
/**
|
|
64360
|
+
* Creates the next position for the pointer considering an infinitely
|
|
64361
|
+
* looping list of items to be rendered on the page.
|
|
64362
|
+
*
|
|
64363
|
+
* The goal is to progressively move the cursor to the middle position as the user move down, and then keep
|
|
64364
|
+
* the cursor there. When the user move up, maintain the cursor position.
|
|
64365
|
+
*/
|
|
64366
|
+
pointer = lastPointer;
|
|
64367
|
+
if (lastActive != null && lastActive < active && active - lastActive < pageSize) pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
|
|
64368
|
+
} else {
|
|
64369
|
+
/**
|
|
64370
|
+
* Creates the next position for the pointer considering a finite list of
|
|
64371
|
+
* items to be rendered on a page.
|
|
64372
|
+
*
|
|
64373
|
+
* The goal is to keep the pointer in the middle of the page whenever possible, until
|
|
64374
|
+
* we reach the bounds of the list (top or bottom). In which case, the cursor moves progressively
|
|
64375
|
+
* to the bottom or top of the list.
|
|
64376
|
+
*/
|
|
64377
|
+
const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
|
|
64378
|
+
pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
|
|
64379
|
+
}
|
|
64380
|
+
state.current.lastPointer = pointer;
|
|
64381
|
+
state.current.lastActive = active;
|
|
64382
|
+
return pointer;
|
|
64383
|
+
}
|
|
64384
|
+
function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
64385
|
+
const width = readlineWidth();
|
|
64386
|
+
const bound = (num) => (num % items.length + items.length) % items.length;
|
|
64387
|
+
const renderedItems = items.map((item, index) => {
|
|
64388
|
+
if (item == null) return [];
|
|
64389
|
+
return breakLines(renderItem({
|
|
64390
|
+
item,
|
|
64391
|
+
index,
|
|
64392
|
+
isActive: index === active
|
|
64393
|
+
}), width).split("\n");
|
|
64394
|
+
});
|
|
64395
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
64396
|
+
const renderItemAtIndex = (index) => renderedItems[index] ?? [];
|
|
64397
|
+
const pointer = usePointerPosition({
|
|
64398
|
+
active,
|
|
64399
|
+
renderedItems,
|
|
64400
|
+
pageSize,
|
|
64401
|
+
loop
|
|
64402
|
+
});
|
|
64403
|
+
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
|
64404
|
+
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
|
64405
|
+
const pageBuffer = Array.from({ length: pageSize });
|
|
64406
|
+
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
|
64407
|
+
const itemVisited = new Set([active]);
|
|
64408
|
+
let bufferPointer = activeItemPosition + activeItem.length;
|
|
64409
|
+
let itemPointer = bound(active + 1);
|
|
64410
|
+
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
|
64411
|
+
const linesToAdd = renderItemAtIndex(itemPointer).slice(0, pageSize - bufferPointer);
|
|
64412
|
+
pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
|
|
64413
|
+
itemVisited.add(itemPointer);
|
|
64414
|
+
bufferPointer += linesToAdd.length;
|
|
64415
|
+
itemPointer = bound(itemPointer + 1);
|
|
64416
|
+
}
|
|
64417
|
+
bufferPointer = activeItemPosition - 1;
|
|
64418
|
+
itemPointer = bound(active - 1);
|
|
64419
|
+
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
|
64420
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
64421
|
+
const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
|
|
64422
|
+
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
|
64423
|
+
itemVisited.add(itemPointer);
|
|
64424
|
+
bufferPointer -= linesToAdd.length;
|
|
64425
|
+
itemPointer = bound(itemPointer - 1);
|
|
64426
|
+
}
|
|
64427
|
+
return pageBuffer.filter((line) => typeof line === "string").join("\n");
|
|
64428
|
+
}
|
|
64429
|
+
//#endregion
|
|
64430
|
+
//#region node_modules/.pnpm/mute-stream@3.0.0/node_modules/mute-stream/lib/index.js
|
|
64431
|
+
var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
64432
|
+
var Stream = require("stream");
|
|
64433
|
+
var MuteStream = class extends Stream {
|
|
64434
|
+
#isTTY = null;
|
|
64435
|
+
constructor(opts = {}) {
|
|
64436
|
+
super(opts);
|
|
64437
|
+
this.writable = this.readable = true;
|
|
64438
|
+
this.muted = false;
|
|
64439
|
+
this.on("pipe", this._onpipe);
|
|
64440
|
+
this.replace = opts.replace;
|
|
64441
|
+
this._prompt = opts.prompt || null;
|
|
64442
|
+
this._hadControl = false;
|
|
64443
|
+
}
|
|
64444
|
+
#destSrc(key, def) {
|
|
64445
|
+
if (this._dest) return this._dest[key];
|
|
64446
|
+
if (this._src) return this._src[key];
|
|
64447
|
+
return def;
|
|
64448
|
+
}
|
|
64449
|
+
#proxy(method, ...args) {
|
|
64450
|
+
if (typeof this._dest?.[method] === "function") this._dest[method](...args);
|
|
64451
|
+
if (typeof this._src?.[method] === "function") this._src[method](...args);
|
|
64452
|
+
}
|
|
64453
|
+
get isTTY() {
|
|
64454
|
+
if (this.#isTTY !== null) return this.#isTTY;
|
|
64455
|
+
return this.#destSrc("isTTY", false);
|
|
64456
|
+
}
|
|
64457
|
+
set isTTY(val) {
|
|
64458
|
+
this.#isTTY = val;
|
|
64459
|
+
}
|
|
64460
|
+
get rows() {
|
|
64461
|
+
return this.#destSrc("rows");
|
|
64462
|
+
}
|
|
64463
|
+
get columns() {
|
|
64464
|
+
return this.#destSrc("columns");
|
|
64465
|
+
}
|
|
64466
|
+
mute() {
|
|
64467
|
+
this.muted = true;
|
|
64468
|
+
}
|
|
64469
|
+
unmute() {
|
|
64470
|
+
this.muted = false;
|
|
64471
|
+
}
|
|
64472
|
+
_onpipe(src) {
|
|
64473
|
+
this._src = src;
|
|
64474
|
+
}
|
|
64475
|
+
pipe(dest, options) {
|
|
64476
|
+
this._dest = dest;
|
|
64477
|
+
return super.pipe(dest, options);
|
|
64478
|
+
}
|
|
64479
|
+
pause() {
|
|
64480
|
+
if (this._src) return this._src.pause();
|
|
64481
|
+
}
|
|
64482
|
+
resume() {
|
|
64483
|
+
if (this._src) return this._src.resume();
|
|
64484
|
+
}
|
|
64485
|
+
write(c) {
|
|
64486
|
+
if (this.muted) {
|
|
64487
|
+
if (!this.replace) return true;
|
|
64488
|
+
if (c.match(/^\u001b/)) {
|
|
64489
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
64490
|
+
c = c.slice(this._prompt.length);
|
|
64491
|
+
c = c.replace(/./g, this.replace);
|
|
64492
|
+
c = this._prompt + c;
|
|
64493
|
+
}
|
|
64494
|
+
this._hadControl = true;
|
|
64495
|
+
return this.emit("data", c);
|
|
64496
|
+
} else {
|
|
64497
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
64498
|
+
this._hadControl = false;
|
|
64499
|
+
this.emit("data", this._prompt);
|
|
64500
|
+
c = c.slice(this._prompt.length);
|
|
64501
|
+
}
|
|
64502
|
+
c = c.toString().replace(/./g, this.replace);
|
|
64503
|
+
}
|
|
64504
|
+
}
|
|
64505
|
+
this.emit("data", c);
|
|
64506
|
+
}
|
|
64507
|
+
end(c) {
|
|
64508
|
+
if (this.muted) if (c && this.replace) c = c.toString().replace(/./g, this.replace);
|
|
64509
|
+
else c = null;
|
|
64510
|
+
if (c) this.emit("data", c);
|
|
64511
|
+
this.emit("end");
|
|
64512
|
+
}
|
|
64513
|
+
destroy(...args) {
|
|
64514
|
+
return this.#proxy("destroy", ...args);
|
|
64515
|
+
}
|
|
64516
|
+
destroySoon(...args) {
|
|
64517
|
+
return this.#proxy("destroySoon", ...args);
|
|
64518
|
+
}
|
|
64519
|
+
close(...args) {
|
|
64520
|
+
return this.#proxy("close", ...args);
|
|
64521
|
+
}
|
|
64522
|
+
};
|
|
64523
|
+
module.exports = MuteStream;
|
|
64524
|
+
}));
|
|
64525
|
+
//#endregion
|
|
64526
|
+
//#region node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
64527
|
+
/**
|
|
64528
|
+
* This is not the set of all possible signals.
|
|
64529
|
+
*
|
|
64530
|
+
* It IS, however, the set of all signals that trigger
|
|
64531
|
+
* an exit on either Linux or BSD systems. Linux is a
|
|
64532
|
+
* superset of the signal names supported on BSD, and
|
|
64533
|
+
* the unknown signals just fail to register, so we can
|
|
64534
|
+
* catch that easily enough.
|
|
64535
|
+
*
|
|
64536
|
+
* Windows signals are a different set, since there are
|
|
64537
|
+
* signals that terminate Windows processes, but don't
|
|
64538
|
+
* terminate (or don't even exist) on Posix systems.
|
|
64539
|
+
*
|
|
64540
|
+
* Don't bother with SIGKILL. It's uncatchable, which
|
|
64541
|
+
* means that we can't fire any callbacks anyway.
|
|
64542
|
+
*
|
|
64543
|
+
* If a user does happen to register a handler on a non-
|
|
64544
|
+
* fatal signal like SIGWINCH or something, and then
|
|
64545
|
+
* exit, it'll end up firing `process.emit('exit')`, so
|
|
64546
|
+
* the handler will be fired anyway.
|
|
64547
|
+
*
|
|
64548
|
+
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
64549
|
+
* artificially, inherently leave the process in a
|
|
64550
|
+
* state from which it is not safe to try and enter JS
|
|
64551
|
+
* listeners.
|
|
64552
|
+
*/
|
|
64553
|
+
var signals = [];
|
|
64554
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
64555
|
+
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
64556
|
+
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
64557
|
+
//#endregion
|
|
64558
|
+
//#region node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
64559
|
+
var processOk = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
|
|
64560
|
+
var kExitEmitter = Symbol.for("signal-exit emitter");
|
|
64561
|
+
var global = globalThis;
|
|
64562
|
+
var ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
64563
|
+
var Emitter = class {
|
|
64564
|
+
emitted = {
|
|
64565
|
+
afterExit: false,
|
|
64566
|
+
exit: false
|
|
64567
|
+
};
|
|
64568
|
+
listeners = {
|
|
64569
|
+
afterExit: [],
|
|
64570
|
+
exit: []
|
|
64571
|
+
};
|
|
64572
|
+
count = 0;
|
|
64573
|
+
id = Math.random();
|
|
64574
|
+
constructor() {
|
|
64575
|
+
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
64576
|
+
ObjectDefineProperty(global, kExitEmitter, {
|
|
64577
|
+
value: this,
|
|
64578
|
+
writable: false,
|
|
64579
|
+
enumerable: false,
|
|
64580
|
+
configurable: false
|
|
64581
|
+
});
|
|
64582
|
+
}
|
|
64583
|
+
on(ev, fn) {
|
|
64584
|
+
this.listeners[ev].push(fn);
|
|
64585
|
+
}
|
|
64586
|
+
removeListener(ev, fn) {
|
|
64587
|
+
const list = this.listeners[ev];
|
|
64588
|
+
const i = list.indexOf(fn);
|
|
64589
|
+
/* c8 ignore start */
|
|
64590
|
+
if (i === -1) return;
|
|
64591
|
+
/* c8 ignore stop */
|
|
64592
|
+
if (i === 0 && list.length === 1) list.length = 0;
|
|
64593
|
+
else list.splice(i, 1);
|
|
64594
|
+
}
|
|
64595
|
+
emit(ev, code, signal) {
|
|
64596
|
+
if (this.emitted[ev]) return false;
|
|
64597
|
+
this.emitted[ev] = true;
|
|
64598
|
+
let ret = false;
|
|
64599
|
+
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
|
|
64600
|
+
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
|
|
64601
|
+
return ret;
|
|
64602
|
+
}
|
|
64603
|
+
};
|
|
64604
|
+
var SignalExitBase = class {};
|
|
64605
|
+
var signalExitWrap = (handler) => {
|
|
64606
|
+
return {
|
|
64607
|
+
onExit(cb, opts) {
|
|
64608
|
+
return handler.onExit(cb, opts);
|
|
64609
|
+
},
|
|
64610
|
+
load() {
|
|
64611
|
+
return handler.load();
|
|
64612
|
+
},
|
|
64613
|
+
unload() {
|
|
64614
|
+
return handler.unload();
|
|
64615
|
+
}
|
|
64616
|
+
};
|
|
64617
|
+
};
|
|
64618
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
64619
|
+
onExit() {
|
|
64620
|
+
return () => {};
|
|
64621
|
+
}
|
|
64622
|
+
load() {}
|
|
64623
|
+
unload() {}
|
|
64624
|
+
};
|
|
64625
|
+
var SignalExit = class extends SignalExitBase {
|
|
64626
|
+
/* c8 ignore start */
|
|
64627
|
+
#hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
64628
|
+
/* c8 ignore stop */
|
|
64629
|
+
#emitter = new Emitter();
|
|
64630
|
+
#process;
|
|
64631
|
+
#originalProcessEmit;
|
|
64632
|
+
#originalProcessReallyExit;
|
|
64633
|
+
#sigListeners = {};
|
|
64634
|
+
#loaded = false;
|
|
64635
|
+
constructor(process) {
|
|
64636
|
+
super();
|
|
64637
|
+
this.#process = process;
|
|
64638
|
+
this.#sigListeners = {};
|
|
64639
|
+
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
64640
|
+
const listeners = this.#process.listeners(sig);
|
|
64641
|
+
let { count } = this.#emitter;
|
|
64642
|
+
/* c8 ignore start */
|
|
64643
|
+
const p = process;
|
|
64644
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
64645
|
+
/* c8 ignore stop */
|
|
64646
|
+
if (listeners.length === count) {
|
|
64647
|
+
this.unload();
|
|
64648
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
64649
|
+
/* c8 ignore start */
|
|
64650
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
64651
|
+
if (!ret) process.kill(process.pid, s);
|
|
64652
|
+
}
|
|
64653
|
+
};
|
|
64654
|
+
this.#originalProcessReallyExit = process.reallyExit;
|
|
64655
|
+
this.#originalProcessEmit = process.emit;
|
|
64656
|
+
}
|
|
64657
|
+
onExit(cb, opts) {
|
|
64658
|
+
/* c8 ignore start */
|
|
64659
|
+
if (!processOk(this.#process)) return () => {};
|
|
64660
|
+
/* c8 ignore stop */
|
|
64661
|
+
if (this.#loaded === false) this.load();
|
|
64662
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
64663
|
+
this.#emitter.on(ev, cb);
|
|
64664
|
+
return () => {
|
|
64665
|
+
this.#emitter.removeListener(ev, cb);
|
|
64666
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
64667
|
+
};
|
|
64668
|
+
}
|
|
64669
|
+
load() {
|
|
64670
|
+
if (this.#loaded) return;
|
|
64671
|
+
this.#loaded = true;
|
|
64672
|
+
this.#emitter.count += 1;
|
|
64673
|
+
for (const sig of signals) try {
|
|
64674
|
+
const fn = this.#sigListeners[sig];
|
|
64675
|
+
if (fn) this.#process.on(sig, fn);
|
|
64676
|
+
} catch (_) {}
|
|
64677
|
+
this.#process.emit = (ev, ...a) => {
|
|
64678
|
+
return this.#processEmit(ev, ...a);
|
|
64679
|
+
};
|
|
64680
|
+
this.#process.reallyExit = (code) => {
|
|
64681
|
+
return this.#processReallyExit(code);
|
|
64682
|
+
};
|
|
64683
|
+
}
|
|
64684
|
+
unload() {
|
|
64685
|
+
if (!this.#loaded) return;
|
|
64686
|
+
this.#loaded = false;
|
|
64687
|
+
signals.forEach((sig) => {
|
|
64688
|
+
const listener = this.#sigListeners[sig];
|
|
64689
|
+
/* c8 ignore start */
|
|
64690
|
+
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
64691
|
+
/* c8 ignore stop */
|
|
64692
|
+
try {
|
|
64693
|
+
this.#process.removeListener(sig, listener);
|
|
64694
|
+
} catch (_) {}
|
|
64695
|
+
/* c8 ignore stop */
|
|
64696
|
+
});
|
|
64697
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
64698
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
64699
|
+
this.#emitter.count -= 1;
|
|
64700
|
+
}
|
|
64701
|
+
#processReallyExit(code) {
|
|
64702
|
+
/* c8 ignore start */
|
|
64703
|
+
if (!processOk(this.#process)) return 0;
|
|
64704
|
+
this.#process.exitCode = code || 0;
|
|
64705
|
+
/* c8 ignore stop */
|
|
64706
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
64707
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
64708
|
+
}
|
|
64709
|
+
#processEmit(ev, ...args) {
|
|
64710
|
+
const og = this.#originalProcessEmit;
|
|
64711
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
64712
|
+
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
64713
|
+
/* c8 ignore start */
|
|
64714
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
64715
|
+
/* c8 ignore start */
|
|
64716
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
64717
|
+
/* c8 ignore stop */
|
|
64718
|
+
return ret;
|
|
64719
|
+
} else return og.call(this.#process, ev, ...args);
|
|
64720
|
+
}
|
|
64721
|
+
};
|
|
64722
|
+
var process$1 = globalThis.process;
|
|
64723
|
+
var { onExit, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
64724
|
+
//#endregion
|
|
64725
|
+
//#region node_modules/.pnpm/@inquirer+ansi@2.0.7/node_modules/@inquirer/ansi/dist/index.js
|
|
64726
|
+
var ESC = "\x1B[";
|
|
64727
|
+
/** Show the cursor */
|
|
64728
|
+
var cursorShow = "\x1B[?25h";
|
|
64729
|
+
/** Move cursor up by count rows */
|
|
64730
|
+
var cursorUp = (rows = 1) => rows > 0 ? `${ESC}${rows}A` : "";
|
|
64731
|
+
/** Move cursor down by count rows */
|
|
64732
|
+
var cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : "";
|
|
64733
|
+
/** Move cursor to position (x, y) */
|
|
64734
|
+
var cursorTo = (x, y) => {
|
|
64735
|
+
if (typeof y === "number" && !Number.isNaN(y)) return `${ESC}${y + 1};${x + 1}H`;
|
|
64736
|
+
return `${ESC}${x + 1}G`;
|
|
64737
|
+
};
|
|
64738
|
+
var eraseLine = "\x1B[2K";
|
|
64739
|
+
/** Erase the specified number of lines above the cursor */
|
|
64740
|
+
var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + "\x1B[2K\x1B[G" : "";
|
|
64741
|
+
//#endregion
|
|
64742
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
64743
|
+
var height = (content) => content.split("\n").length;
|
|
64744
|
+
var lastLine = (content) => content.split("\n").pop() ?? "";
|
|
64745
|
+
var ScreenManager = class {
|
|
64746
|
+
height = 0;
|
|
64747
|
+
extraLinesUnderPrompt = 0;
|
|
64748
|
+
cursorPos;
|
|
64749
|
+
rl;
|
|
64750
|
+
constructor(rl) {
|
|
64751
|
+
this.rl = rl;
|
|
64752
|
+
this.cursorPos = rl.getCursorPos();
|
|
64753
|
+
}
|
|
64754
|
+
write(content) {
|
|
64755
|
+
this.rl.output.unmute();
|
|
64756
|
+
this.rl.output.write(content);
|
|
64757
|
+
this.rl.output.mute();
|
|
64758
|
+
}
|
|
64759
|
+
render(content, bottomContent = "") {
|
|
64760
|
+
const rawPromptLine = (0, node_util.stripVTControlCharacters)(lastLine(content));
|
|
64761
|
+
let prompt = rawPromptLine;
|
|
64762
|
+
if (this.rl.line.length > 0) prompt = prompt.slice(0, -this.rl.line.length);
|
|
64763
|
+
this.rl.setPrompt(prompt);
|
|
64764
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
64765
|
+
const width = readlineWidth();
|
|
64766
|
+
content = breakLines(content, width);
|
|
64767
|
+
bottomContent = breakLines(bottomContent, width);
|
|
64768
|
+
if (rawPromptLine.length % width === 0) content += "\n";
|
|
64769
|
+
let output = content + (bottomContent ? "\n" + bottomContent : "");
|
|
64770
|
+
const bottomContentHeight = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows + (bottomContent ? height(bottomContent) : 0);
|
|
64771
|
+
if (bottomContentHeight > 0) output += cursorUp(bottomContentHeight);
|
|
64772
|
+
output += cursorTo(this.cursorPos.cols);
|
|
64773
|
+
/**
|
|
64774
|
+
* Render and store state for future re-rendering
|
|
64775
|
+
*/
|
|
64776
|
+
this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
|
|
64777
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
64778
|
+
this.height = height(output);
|
|
64779
|
+
}
|
|
64780
|
+
checkCursorPos() {
|
|
64781
|
+
const cursorPos = this.rl.getCursorPos();
|
|
64782
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
64783
|
+
this.write(cursorTo(cursorPos.cols));
|
|
64784
|
+
this.cursorPos = cursorPos;
|
|
64785
|
+
}
|
|
64786
|
+
}
|
|
64787
|
+
done({ clearContent }) {
|
|
64788
|
+
this.rl.setPrompt("");
|
|
64789
|
+
let output = cursorDown(this.extraLinesUnderPrompt);
|
|
64790
|
+
output += clearContent ? eraseLines(this.height) : "\n";
|
|
64791
|
+
output += "\x1B[G";
|
|
64792
|
+
output += cursorShow;
|
|
64793
|
+
this.write(output);
|
|
64794
|
+
this.rl.close();
|
|
64795
|
+
}
|
|
64796
|
+
};
|
|
64797
|
+
//#endregion
|
|
64798
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
64799
|
+
var PromisePolyfill = class extends Promise {
|
|
64800
|
+
static withResolver() {
|
|
64801
|
+
let resolve;
|
|
64802
|
+
let reject;
|
|
64803
|
+
return {
|
|
64804
|
+
promise: new Promise((res, rej) => {
|
|
64805
|
+
resolve = res;
|
|
64806
|
+
reject = rej;
|
|
64807
|
+
}),
|
|
64808
|
+
resolve,
|
|
64809
|
+
reject
|
|
64810
|
+
};
|
|
64811
|
+
}
|
|
64812
|
+
};
|
|
64813
|
+
//#endregion
|
|
64814
|
+
//#region node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@25.9.1/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
64815
|
+
var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
64816
|
+
var nativeSetImmediate = globalThis.setImmediate;
|
|
64817
|
+
function getCallSites() {
|
|
64818
|
+
const savedPrepareStackTrace = Error.prepareStackTrace;
|
|
64819
|
+
let result = [];
|
|
64820
|
+
try {
|
|
64821
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
64822
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
64823
|
+
result = callSitesWithoutCurrent;
|
|
64824
|
+
return callSitesWithoutCurrent;
|
|
64825
|
+
};
|
|
64826
|
+
(/* @__PURE__ */ new Error()).stack;
|
|
64827
|
+
} catch {
|
|
64828
|
+
return result;
|
|
64829
|
+
}
|
|
64830
|
+
Error.prepareStackTrace = savedPrepareStackTrace;
|
|
64831
|
+
return result;
|
|
64832
|
+
}
|
|
64833
|
+
function createPrompt(view) {
|
|
64834
|
+
const callSites = getCallSites();
|
|
64835
|
+
const prompt = (config, context = {}) => {
|
|
64836
|
+
const { input = process.stdin, signal } = context;
|
|
64837
|
+
const cleanups = /* @__PURE__ */ new Set();
|
|
64838
|
+
const output = new import_lib.default();
|
|
64839
|
+
output.pipe(context.output ?? process.stdout);
|
|
64840
|
+
const rl = node_readline.createInterface({
|
|
64841
|
+
terminal: true,
|
|
64842
|
+
input,
|
|
64843
|
+
output
|
|
64844
|
+
});
|
|
64845
|
+
output.mute();
|
|
64846
|
+
const screen = new ScreenManager(rl);
|
|
64847
|
+
const { promise, resolve, reject } = PromisePolyfill.withResolver();
|
|
64848
|
+
const cancel = () => reject(new CancelPromptError());
|
|
64849
|
+
if (signal) {
|
|
64850
|
+
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
64851
|
+
if (signal.aborted) {
|
|
64852
|
+
abort();
|
|
64853
|
+
return Object.assign(promise, { cancel });
|
|
64854
|
+
}
|
|
64855
|
+
signal.addEventListener("abort", abort);
|
|
64856
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
64857
|
+
}
|
|
64858
|
+
cleanups.add(onExit((code, signal) => {
|
|
64859
|
+
reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal}`));
|
|
64860
|
+
}));
|
|
64861
|
+
const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
|
|
64862
|
+
rl.on("SIGINT", sigint);
|
|
64863
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
64864
|
+
return withHooks(rl, (cycle) => {
|
|
64865
|
+
const hooksCleanup = node_async_hooks.AsyncResource.bind(() => effectScheduler.clearAll());
|
|
64866
|
+
rl.on("close", hooksCleanup);
|
|
64867
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
64868
|
+
const startCycle = () => {
|
|
64869
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
64870
|
+
rl.input.on("keypress", checkCursorPos);
|
|
64871
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
64872
|
+
let pendingDone = null;
|
|
64873
|
+
cycle(() => {
|
|
64874
|
+
let effectsSettled = false;
|
|
64875
|
+
try {
|
|
64876
|
+
const nextView = view(config, (value) => {
|
|
64877
|
+
if (effectsSettled) resolve(value);
|
|
64878
|
+
else pendingDone = { value };
|
|
64879
|
+
});
|
|
64880
|
+
if (nextView === void 0) {
|
|
64881
|
+
let callerFilename = callSites[1]?.getFileName();
|
|
64882
|
+
if (callerFilename && !callerFilename.startsWith("file://")) callerFilename = node_path.default.resolve(callerFilename);
|
|
64883
|
+
throw new Error(`Prompt functions must return a string.\n at ${callerFilename}`);
|
|
64884
|
+
}
|
|
64885
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
64886
|
+
screen.render(content, bottomContent);
|
|
64887
|
+
effectScheduler.run();
|
|
64888
|
+
} catch (error) {
|
|
64889
|
+
reject(error);
|
|
64890
|
+
}
|
|
64891
|
+
effectsSettled = true;
|
|
64892
|
+
if (pendingDone !== null) {
|
|
64893
|
+
const { value } = pendingDone;
|
|
64894
|
+
pendingDone = null;
|
|
64895
|
+
resolve(value);
|
|
64896
|
+
}
|
|
64897
|
+
});
|
|
64898
|
+
};
|
|
64899
|
+
if ("readableFlowing" in input) nativeSetImmediate(startCycle);
|
|
64900
|
+
else startCycle();
|
|
64901
|
+
return Object.assign(promise.then((answer) => {
|
|
64902
|
+
effectScheduler.clearAll();
|
|
64903
|
+
return answer;
|
|
64904
|
+
}, (error) => {
|
|
64905
|
+
effectScheduler.clearAll();
|
|
64906
|
+
throw error;
|
|
64907
|
+
}).finally(() => {
|
|
64908
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
64909
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
64910
|
+
output.end();
|
|
64911
|
+
}).then(() => promise), { cancel });
|
|
64912
|
+
});
|
|
64913
|
+
};
|
|
64914
|
+
return prompt;
|
|
64915
|
+
}
|
|
64916
|
+
//#endregion
|
|
64917
|
+
//#region src/lib/select.ts
|
|
64918
|
+
function isSelectable(item) {
|
|
64919
|
+
return !item.disabled;
|
|
64920
|
+
}
|
|
64921
|
+
function isCharKey(key) {
|
|
64922
|
+
if (key.ctrl || key.meta) return false;
|
|
64923
|
+
return (key.sequence ?? "").length === 1 && key.name !== "escape";
|
|
64924
|
+
}
|
|
64925
|
+
function normalize(s) {
|
|
64926
|
+
return s.toLowerCase();
|
|
64927
|
+
}
|
|
64928
|
+
function isSlashKey(key) {
|
|
64929
|
+
return key.name === "slash" || key.sequence === "/";
|
|
64930
|
+
}
|
|
64931
|
+
function selectWithFilter(config) {
|
|
64932
|
+
const prompt = createPrompt((promptConfig, done) => {
|
|
64933
|
+
const theme = makeTheme({
|
|
64934
|
+
icon: { cursor: "❯" },
|
|
64935
|
+
style: {
|
|
64936
|
+
disabled: (x) => x,
|
|
64937
|
+
description: (x) => x,
|
|
64938
|
+
help: (x) => x,
|
|
64939
|
+
highlight: (x) => x,
|
|
64940
|
+
message: (x) => x,
|
|
64941
|
+
answer: (x) => x
|
|
64942
|
+
},
|
|
64943
|
+
helpMode: "auto",
|
|
64944
|
+
indexMode: "hidden"
|
|
64945
|
+
}, promptConfig.theme);
|
|
64946
|
+
const prefix = usePrefix({ theme });
|
|
64947
|
+
const pageSize = promptConfig.pageSize ?? 15;
|
|
64948
|
+
const loop = promptConfig.loop ?? false;
|
|
64949
|
+
const enableFilter = promptConfig.enableFilter ?? true;
|
|
64950
|
+
const showHelp = promptConfig.showHelp ?? true;
|
|
64951
|
+
const rawItems = useMemo(() => promptConfig.choices.map((c) => ({
|
|
64952
|
+
...c,
|
|
64953
|
+
name: c.name ?? String(c.value)
|
|
64954
|
+
})), [promptConfig.choices]);
|
|
64955
|
+
const [status, setStatus] = useState("idle");
|
|
64956
|
+
const [filterMode, setFilterMode] = useState(false);
|
|
64957
|
+
const [filter, setFilter] = useState("");
|
|
64958
|
+
const filterRef = useRef("");
|
|
64959
|
+
const searchTimeoutRef = useRef();
|
|
64960
|
+
const filteredItems = useMemo(() => {
|
|
64961
|
+
if (!enableFilter) return rawItems;
|
|
64962
|
+
const q = normalize(filter.trim());
|
|
64963
|
+
if (!q) return rawItems;
|
|
64964
|
+
return rawItems.filter((item) => normalize(item.name).includes(q));
|
|
64965
|
+
}, [
|
|
64966
|
+
enableFilter,
|
|
64967
|
+
filter,
|
|
64968
|
+
rawItems
|
|
64969
|
+
]);
|
|
64970
|
+
const bounds = useMemo(() => {
|
|
64971
|
+
const first = filteredItems.findIndex(isSelectable);
|
|
64972
|
+
let last = -1;
|
|
64973
|
+
for (let i = filteredItems.length - 1; i >= 0; i--) if (isSelectable(filteredItems[i])) {
|
|
64974
|
+
last = i;
|
|
64975
|
+
break;
|
|
64976
|
+
}
|
|
64977
|
+
return {
|
|
64978
|
+
first,
|
|
64979
|
+
last
|
|
64980
|
+
};
|
|
64981
|
+
}, [filteredItems]);
|
|
64982
|
+
const [_, setActive] = useState(0);
|
|
64983
|
+
const activeRef = useRef(0);
|
|
64984
|
+
useEffect(() => {
|
|
64985
|
+
if (filteredItems.length === 0) {
|
|
64986
|
+
setActive(0);
|
|
64987
|
+
activeRef.current = 0;
|
|
64988
|
+
return;
|
|
64989
|
+
}
|
|
64990
|
+
const first = bounds.first === -1 ? 0 : bounds.first;
|
|
64991
|
+
const last = bounds.last === -1 ? Math.max(0, filteredItems.length - 1) : bounds.last;
|
|
64992
|
+
const next = Math.min(last, Math.max(first, activeRef.current));
|
|
64993
|
+
setActive(next);
|
|
64994
|
+
activeRef.current = next;
|
|
64995
|
+
}, [
|
|
64996
|
+
bounds.first,
|
|
64997
|
+
bounds.last,
|
|
64998
|
+
filteredItems.length
|
|
64999
|
+
]);
|
|
65000
|
+
useKeypress((keyEvent, rl) => {
|
|
65001
|
+
clearTimeout(searchTimeoutRef.current);
|
|
65002
|
+
const key = keyEvent;
|
|
65003
|
+
if (isEnterKey(keyEvent)) {
|
|
65004
|
+
const selected = filteredItems[activeRef.current];
|
|
65005
|
+
if (selected && isSelectable(selected)) {
|
|
65006
|
+
setStatus("done");
|
|
65007
|
+
done(selected.value);
|
|
65008
|
+
}
|
|
65009
|
+
return;
|
|
65010
|
+
}
|
|
65011
|
+
const down = isDownKey(keyEvent) || !filterMode && key.name === "j";
|
|
65012
|
+
const up = isUpKey(keyEvent) || !filterMode && key.name === "k";
|
|
65013
|
+
if (up || down) {
|
|
65014
|
+
rl.clearLine(0);
|
|
65015
|
+
if (filteredItems.length === 0 || bounds.first === -1) return;
|
|
65016
|
+
if (loop || up && activeRef.current !== bounds.first || down && activeRef.current !== bounds.last) {
|
|
65017
|
+
const offset = up ? -1 : 1;
|
|
65018
|
+
let next = activeRef.current;
|
|
65019
|
+
do
|
|
65020
|
+
next = (next + offset + filteredItems.length) % filteredItems.length;
|
|
65021
|
+
while (!isSelectable(filteredItems[next]));
|
|
65022
|
+
setActive(next);
|
|
65023
|
+
activeRef.current = next;
|
|
65024
|
+
}
|
|
65025
|
+
return;
|
|
65026
|
+
}
|
|
65027
|
+
if (enableFilter && isSlashKey(key) && !filterMode) {
|
|
65028
|
+
rl.clearLine(0);
|
|
65029
|
+
setFilterMode(true);
|
|
65030
|
+
setFilter("");
|
|
65031
|
+
filterRef.current = "";
|
|
65032
|
+
return;
|
|
65033
|
+
}
|
|
65034
|
+
if (enableFilter && filterMode) {
|
|
65035
|
+
if (isBackspaceKey(keyEvent)) {
|
|
65036
|
+
rl.clearLine(0);
|
|
65037
|
+
filterRef.current = filterRef.current.slice(0, -1);
|
|
65038
|
+
setFilter(filterRef.current);
|
|
65039
|
+
return;
|
|
65040
|
+
}
|
|
65041
|
+
if (isCharKey(key)) {
|
|
65042
|
+
rl.clearLine(0);
|
|
65043
|
+
filterRef.current = filterRef.current + (key.sequence ?? "");
|
|
65044
|
+
setFilter(filterRef.current);
|
|
65045
|
+
return;
|
|
65046
|
+
}
|
|
65047
|
+
}
|
|
65048
|
+
});
|
|
65049
|
+
useEffect(() => () => clearTimeout(searchTimeoutRef.current), []);
|
|
65050
|
+
const message = theme.style.message(promptConfig.message, status);
|
|
65051
|
+
const help = showHelp && status === "idle" ? theme.style.help(enableFilter ? "(↑/↓ or j/k to navigate, / to filter, Enter to select, Esc to cancel)" : "(↑/↓ or j/k to navigate, Enter to select, Esc to cancel)") : "";
|
|
65052
|
+
const filterLine = enableFilter && status === "idle" ? theme.style.help(filterMode || filter.trim() ? `Filter: ${filter || ""}` : "") : "";
|
|
65053
|
+
const page = usePagination({
|
|
65054
|
+
items: filteredItems.length === 0 ? [{
|
|
65055
|
+
name: "(no matches)",
|
|
65056
|
+
value: void 0,
|
|
65057
|
+
disabled: true
|
|
65058
|
+
}] : filteredItems,
|
|
65059
|
+
active: activeRef.current,
|
|
65060
|
+
renderItem({ item, isActive, index }) {
|
|
65061
|
+
const indexLabel = theme.indexMode === "number" ? `${index + 1}. ` : "";
|
|
65062
|
+
if (item.disabled) {
|
|
65063
|
+
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
65064
|
+
return theme.style.disabled(`${indexLabel}${item.name} ${disabledLabel}`);
|
|
65065
|
+
}
|
|
65066
|
+
return (isActive ? theme.style.highlight : (x) => x)(`${isActive ? theme.icon.cursor : ` `} ${indexLabel}${item.name}`);
|
|
65067
|
+
},
|
|
65068
|
+
pageSize: Math.min(pageSize, Math.max(filteredItems.length, 5)),
|
|
65069
|
+
loop
|
|
65070
|
+
});
|
|
65071
|
+
const selectedChoice = filteredItems[activeRef.current];
|
|
65072
|
+
if (status === "done" && selectedChoice) return `${prefix} ${message} ${theme.style.answer(selectedChoice.short ?? selectedChoice.name)}`;
|
|
65073
|
+
const filterBlock = filterLine ? `${filterLine}\n` : "";
|
|
65074
|
+
const helpBlock = help ? `${help}\n` : "";
|
|
65075
|
+
return `${[prefix, message].filter(Boolean).join(" ")}\n${helpBlock}${filterBlock}${page}`;
|
|
65076
|
+
});
|
|
65077
|
+
if (!config.choices.length) throw new ValidationError("[select prompt] No choices provided.");
|
|
65078
|
+
return prompt(config);
|
|
65079
|
+
}
|
|
65080
|
+
//#endregion
|
|
65081
|
+
//#region src/lib/interactive.ts
|
|
65082
|
+
function isExitPromptError(err) {
|
|
65083
|
+
if (!err || typeof err !== "object") return false;
|
|
65084
|
+
const anyErr = err;
|
|
65085
|
+
const name = typeof anyErr.name === "string" ? anyErr.name : "";
|
|
65086
|
+
const message = typeof anyErr.message === "string" ? anyErr.message : "";
|
|
65087
|
+
return name === "ExitPromptError" || /^User force closed the prompt\b/u.test(message);
|
|
65088
|
+
}
|
|
65089
|
+
function isCancelPromptError(err) {
|
|
65090
|
+
if (!err || typeof err !== "object") return false;
|
|
65091
|
+
return err.name === "CancelPromptError";
|
|
65092
|
+
}
|
|
65093
|
+
function exitMessageForPromptCancellation(err) {
|
|
65094
|
+
const msg = err.message ?? "";
|
|
65095
|
+
if (/\bSIGINT\b/u.test(msg)) return {
|
|
65096
|
+
message: "Cancelled (Ctrl+C).",
|
|
65097
|
+
code: 130
|
|
65098
|
+
};
|
|
65099
|
+
return {
|
|
65100
|
+
message: "Cancelled.",
|
|
65101
|
+
code: 0
|
|
65102
|
+
};
|
|
65103
|
+
}
|
|
65104
|
+
async function pickOne(label, choices) {
|
|
65105
|
+
if (!process.stdin.isTTY) {
|
|
65106
|
+
console.error(chalk.red(`${label} requires an interactive terminal.`));
|
|
65107
|
+
process.exit(1);
|
|
65108
|
+
}
|
|
65109
|
+
if (choices.length === 0) {
|
|
65110
|
+
console.error(chalk.red(`No options available for: ${label}`));
|
|
65111
|
+
process.exit(1);
|
|
65112
|
+
}
|
|
65113
|
+
try {
|
|
65114
|
+
const prompt = selectWithFilter({
|
|
65115
|
+
message: label,
|
|
65116
|
+
choices: choices.map((c) => ({
|
|
65117
|
+
name: c.name,
|
|
65118
|
+
value: c.value
|
|
65119
|
+
})),
|
|
65120
|
+
pageSize: Math.min(15, Math.max(choices.length, 5))
|
|
65121
|
+
});
|
|
65122
|
+
const onKeypress = (_, key) => {
|
|
65123
|
+
if (key?.name === "escape") prompt.cancel();
|
|
65124
|
+
};
|
|
65125
|
+
process.stdin.on("keypress", onKeypress);
|
|
65126
|
+
try {
|
|
65127
|
+
return await prompt;
|
|
65128
|
+
} finally {
|
|
65129
|
+
process.stdin.off("keypress", onKeypress);
|
|
65130
|
+
}
|
|
65131
|
+
} catch (err) {
|
|
65132
|
+
if (isCancelPromptError(err)) {
|
|
65133
|
+
console.error(chalk.yellow("Cancelled."));
|
|
65134
|
+
process.exit(0);
|
|
65135
|
+
}
|
|
65136
|
+
if (isExitPromptError(err)) {
|
|
65137
|
+
const { message, code } = exitMessageForPromptCancellation(err);
|
|
65138
|
+
console.error(chalk.yellow(message));
|
|
65139
|
+
process.exit(code);
|
|
65140
|
+
}
|
|
65141
|
+
throw err;
|
|
65142
|
+
}
|
|
65143
|
+
}
|
|
65144
|
+
function extractRequestNamesFromHttp(content) {
|
|
65145
|
+
const names = [];
|
|
65146
|
+
const seen = /* @__PURE__ */ new Set();
|
|
65147
|
+
for (const line of content.split(/\r?\n/u)) {
|
|
65148
|
+
const match = /^###\s*(.*?)\s*$/u.exec(line);
|
|
65149
|
+
if (!match) continue;
|
|
65150
|
+
const name = match[1]?.trim();
|
|
65151
|
+
if (!name) continue;
|
|
65152
|
+
if (seen.has(name)) continue;
|
|
65153
|
+
seen.add(name);
|
|
65154
|
+
names.push(name);
|
|
65155
|
+
}
|
|
65156
|
+
return names;
|
|
65157
|
+
}
|
|
65158
|
+
//#endregion
|
|
63424
65159
|
//#region src/cli.ts
|
|
63425
65160
|
var program = new Command();
|
|
63426
65161
|
program.name("kulala").description("A fully-featured HTTP/GraphQL/gRPC/WebSocket client for your command-line.").version(package_default.version);
|
|
63427
|
-
program.command("run").description("Run .http or .rest files").argument("<path>", "file or directory to run").option("--json", "print raw kulala-core JSON output").option("--report", "print a summary report").option("--no-color", "disable syntax highlighting and colors").option("-q, --quiet", "only print output when errors occur").option("--halt", "stop after the first failing request or file").option("--shuffle", "shuffle files when running a directory").option("--env
|
|
65162
|
+
program.command("run").description("Run .http or .rest files").argument("<path>", "file or directory to run").option("--json", "print raw kulala-core JSON output").option("--report", "print a summary report").option("--no-color", "disable syntax highlighting and colors").option("-q, --quiet", "only print output when errors occur").option("--halt", "stop after the first failing request or file").option("--shuffle", "shuffle files when running a directory").option("--env [name]", "environment name for variable resolution").option("--name [name]", "run a single request by block name").option("--line <line>", "run request at 1-based line number", (value) => Number.parseInt(value, 10)).option("--column <column>", "1-based column for --line (default: 1)", (value) => Number.parseInt(value, 10)).action(async (inputPath, options) => {
|
|
65163
|
+
if (options.name === true) {
|
|
65164
|
+
const relativeFile = resolveSingleHttpFile(inputPath);
|
|
65165
|
+
const absolutePath = node_path.default.resolve(process.cwd(), relativeFile);
|
|
65166
|
+
const requestNames = extractRequestNamesFromHttp(node_fs.default.readFileSync(absolutePath, "utf-8"));
|
|
65167
|
+
if (requestNames.length === 0) {
|
|
65168
|
+
console.error(chalk.red("No request blocks found (expected lines like: ### MyRequest)"));
|
|
65169
|
+
process.exit(1);
|
|
65170
|
+
}
|
|
65171
|
+
options.name = await pickOne("Select request to run", requestNames.map((n) => ({
|
|
65172
|
+
name: n,
|
|
65173
|
+
value: n
|
|
65174
|
+
})));
|
|
65175
|
+
}
|
|
65176
|
+
if (options.env === true) {
|
|
65177
|
+
const startDir = node_fs.default.existsSync(inputPath) ? node_fs.default.statSync(inputPath).isDirectory() ? node_path.default.resolve(process.cwd(), inputPath) : node_path.default.dirname(node_path.default.resolve(process.cwd(), inputPath)) : process.cwd();
|
|
65178
|
+
const absoluteInputPath = node_path.default.resolve(process.cwd(), inputPath);
|
|
65179
|
+
const filepath = node_fs.default.existsSync(absoluteInputPath) && node_fs.default.statSync(absoluteInputPath).isFile() ? absoluteInputPath : void 0;
|
|
65180
|
+
const catalog = await kulalaCore.environments({
|
|
65181
|
+
cwd: startDir,
|
|
65182
|
+
filepath
|
|
65183
|
+
});
|
|
65184
|
+
const envNames = Object.keys(catalog.environments ?? {}).sort((a, b) => a.localeCompare(b));
|
|
65185
|
+
if (envNames.length === 0) {
|
|
65186
|
+
console.error(chalk.red("No environments found."));
|
|
65187
|
+
process.exit(1);
|
|
65188
|
+
}
|
|
65189
|
+
options.env = await pickOne("Select environment", envNames.map((n) => ({
|
|
65190
|
+
name: n,
|
|
65191
|
+
value: n
|
|
65192
|
+
})));
|
|
65193
|
+
}
|
|
63428
65194
|
await run(inputPath, options);
|
|
63429
65195
|
});
|
|
63430
65196
|
program.parse();
|