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