soulhubcli 1.0.22 → 1.0.23

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 (2) hide show
  1. package/dist/index.cjs +2212 -240
  2. package/package.json +2 -1
package/dist/index.cjs CHANGED
@@ -967,7 +967,7 @@ var require_command = __commonJS({
967
967
  var childProcess = require("child_process");
968
968
  var path5 = require("path");
969
969
  var fs8 = require("fs");
970
- var process3 = require("process");
970
+ var process5 = require("process");
971
971
  var { Argument: Argument2, humanReadableArgName } = require_argument();
972
972
  var { CommanderError: CommanderError2 } = require_error();
973
973
  var { Help: Help2 } = require_help();
@@ -1013,10 +1013,10 @@ var require_command = __commonJS({
1013
1013
  this._showHelpAfterError = false;
1014
1014
  this._showSuggestionAfterError = true;
1015
1015
  this._outputConfiguration = {
1016
- writeOut: (str2) => process3.stdout.write(str2),
1017
- writeErr: (str2) => process3.stderr.write(str2),
1018
- getOutHelpWidth: () => process3.stdout.isTTY ? process3.stdout.columns : void 0,
1019
- getErrHelpWidth: () => process3.stderr.isTTY ? process3.stderr.columns : void 0,
1016
+ writeOut: (str2) => process5.stdout.write(str2),
1017
+ writeErr: (str2) => process5.stderr.write(str2),
1018
+ getOutHelpWidth: () => process5.stdout.isTTY ? process5.stdout.columns : void 0,
1019
+ getErrHelpWidth: () => process5.stderr.isTTY ? process5.stderr.columns : void 0,
1020
1020
  outputError: (str2, write) => write(str2)
1021
1021
  };
1022
1022
  this._hidden = false;
@@ -1395,7 +1395,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1395
1395
  if (this._exitCallback) {
1396
1396
  this._exitCallback(new CommanderError2(exitCode, code, message));
1397
1397
  }
1398
- process3.exit(exitCode);
1398
+ process5.exit(exitCode);
1399
1399
  }
1400
1400
  /**
1401
1401
  * Register callback `fn` for the command.
@@ -1793,16 +1793,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
1793
1793
  }
1794
1794
  parseOptions = parseOptions || {};
1795
1795
  if (argv === void 0 && parseOptions.from === void 0) {
1796
- if (process3.versions?.electron) {
1796
+ if (process5.versions?.electron) {
1797
1797
  parseOptions.from = "electron";
1798
1798
  }
1799
- const execArgv = process3.execArgv ?? [];
1799
+ const execArgv = process5.execArgv ?? [];
1800
1800
  if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
1801
1801
  parseOptions.from = "eval";
1802
1802
  }
1803
1803
  }
1804
1804
  if (argv === void 0) {
1805
- argv = process3.argv;
1805
+ argv = process5.argv;
1806
1806
  }
1807
1807
  this.rawArgs = argv.slice();
1808
1808
  let userArgs;
@@ -1813,7 +1813,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1813
1813
  userArgs = argv.slice(2);
1814
1814
  break;
1815
1815
  case "electron":
1816
- if (process3.defaultApp) {
1816
+ if (process5.defaultApp) {
1817
1817
  this._scriptPath = argv[1];
1818
1818
  userArgs = argv.slice(2);
1819
1819
  } else {
@@ -1941,23 +1941,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
1941
1941
  }
1942
1942
  launchWithNode = sourceExt.includes(path5.extname(executableFile));
1943
1943
  let proc;
1944
- if (process3.platform !== "win32") {
1944
+ if (process5.platform !== "win32") {
1945
1945
  if (launchWithNode) {
1946
1946
  args.unshift(executableFile);
1947
- args = incrementNodeInspectorPort(process3.execArgv).concat(args);
1948
- proc = childProcess.spawn(process3.argv[0], args, { stdio: "inherit" });
1947
+ args = incrementNodeInspectorPort(process5.execArgv).concat(args);
1948
+ proc = childProcess.spawn(process5.argv[0], args, { stdio: "inherit" });
1949
1949
  } else {
1950
1950
  proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
1951
1951
  }
1952
1952
  } else {
1953
1953
  args.unshift(executableFile);
1954
- args = incrementNodeInspectorPort(process3.execArgv).concat(args);
1955
- proc = childProcess.spawn(process3.execPath, args, { stdio: "inherit" });
1954
+ args = incrementNodeInspectorPort(process5.execArgv).concat(args);
1955
+ proc = childProcess.spawn(process5.execPath, args, { stdio: "inherit" });
1956
1956
  }
1957
1957
  if (!proc.killed) {
1958
- const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
1959
- signals.forEach((signal) => {
1960
- process3.on(signal, () => {
1958
+ const signals2 = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
1959
+ signals2.forEach((signal) => {
1960
+ process5.on(signal, () => {
1961
1961
  if (proc.killed === false && proc.exitCode === null) {
1962
1962
  proc.kill(signal);
1963
1963
  }
@@ -1968,7 +1968,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1968
1968
  proc.on("close", (code) => {
1969
1969
  code = code ?? 1;
1970
1970
  if (!exitCallback) {
1971
- process3.exit(code);
1971
+ process5.exit(code);
1972
1972
  } else {
1973
1973
  exitCallback(
1974
1974
  new CommanderError2(
@@ -1991,7 +1991,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1991
1991
  throw new Error(`'${executableFile}' not executable`);
1992
1992
  }
1993
1993
  if (!exitCallback) {
1994
- process3.exit(1);
1994
+ process5.exit(1);
1995
1995
  } else {
1996
1996
  const wrappedError = new CommanderError2(
1997
1997
  1,
@@ -2483,13 +2483,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
2483
2483
  */
2484
2484
  _parseOptionsEnv() {
2485
2485
  this.options.forEach((option) => {
2486
- if (option.envVar && option.envVar in process3.env) {
2486
+ if (option.envVar && option.envVar in process5.env) {
2487
2487
  const optionKey = option.attributeName();
2488
2488
  if (this.getOptionValue(optionKey) === void 0 || ["default", "config", "env"].includes(
2489
2489
  this.getOptionValueSource(optionKey)
2490
2490
  )) {
2491
2491
  if (option.required || option.optional) {
2492
- this.emit(`optionEnv:${option.name()}`, process3.env[option.envVar]);
2492
+ this.emit(`optionEnv:${option.name()}`, process5.env[option.envVar]);
2493
2493
  } else {
2494
2494
  this.emit(`optionEnv:${option.name()}`);
2495
2495
  }
@@ -2918,7 +2918,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2918
2918
  */
2919
2919
  help(contextOptions) {
2920
2920
  this.outputHelp(contextOptions);
2921
- let exitCode = process3.exitCode || 0;
2921
+ let exitCode = process5.exitCode || 0;
2922
2922
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
2923
2923
  exitCode = 1;
2924
2924
  }
@@ -3026,6 +3026,172 @@ var require_commander = __commonJS({
3026
3026
  }
3027
3027
  });
3028
3028
 
3029
+ // node_modules/cli-width/index.js
3030
+ var require_cli_width = __commonJS({
3031
+ "node_modules/cli-width/index.js"(exports2, module2) {
3032
+ "use strict";
3033
+ module2.exports = cliWidth2;
3034
+ function normalizeOpts(options) {
3035
+ const defaultOpts = {
3036
+ defaultWidth: 0,
3037
+ output: process.stdout,
3038
+ tty: require("tty")
3039
+ };
3040
+ if (!options) {
3041
+ return defaultOpts;
3042
+ }
3043
+ Object.keys(defaultOpts).forEach(function(key) {
3044
+ if (!options[key]) {
3045
+ options[key] = defaultOpts[key];
3046
+ }
3047
+ });
3048
+ return options;
3049
+ }
3050
+ function cliWidth2(options) {
3051
+ const opts = normalizeOpts(options);
3052
+ if (opts.output.getWindowSize) {
3053
+ return opts.output.getWindowSize()[0] || opts.defaultWidth;
3054
+ }
3055
+ if (opts.tty.getWindowSize) {
3056
+ return opts.tty.getWindowSize()[1] || opts.defaultWidth;
3057
+ }
3058
+ if (opts.output.columns) {
3059
+ return opts.output.columns;
3060
+ }
3061
+ if (process.env.CLI_WIDTH) {
3062
+ const width = parseInt(process.env.CLI_WIDTH, 10);
3063
+ if (!isNaN(width) && width !== 0) {
3064
+ return width;
3065
+ }
3066
+ }
3067
+ return opts.defaultWidth;
3068
+ }
3069
+ }
3070
+ });
3071
+
3072
+ // node_modules/mute-stream/lib/index.js
3073
+ var require_lib = __commonJS({
3074
+ "node_modules/mute-stream/lib/index.js"(exports2, module2) {
3075
+ "use strict";
3076
+ var Stream = require("stream");
3077
+ var MuteStream2 = class extends Stream {
3078
+ #isTTY = null;
3079
+ constructor(opts = {}) {
3080
+ super(opts);
3081
+ this.writable = this.readable = true;
3082
+ this.muted = false;
3083
+ this.on("pipe", this._onpipe);
3084
+ this.replace = opts.replace;
3085
+ this._prompt = opts.prompt || null;
3086
+ this._hadControl = false;
3087
+ }
3088
+ #destSrc(key, def) {
3089
+ if (this._dest) {
3090
+ return this._dest[key];
3091
+ }
3092
+ if (this._src) {
3093
+ return this._src[key];
3094
+ }
3095
+ return def;
3096
+ }
3097
+ #proxy(method, ...args) {
3098
+ if (typeof this._dest?.[method] === "function") {
3099
+ this._dest[method](...args);
3100
+ }
3101
+ if (typeof this._src?.[method] === "function") {
3102
+ this._src[method](...args);
3103
+ }
3104
+ }
3105
+ get isTTY() {
3106
+ if (this.#isTTY !== null) {
3107
+ return this.#isTTY;
3108
+ }
3109
+ return this.#destSrc("isTTY", false);
3110
+ }
3111
+ // basically just get replace the getter/setter with a regular value
3112
+ set isTTY(val) {
3113
+ this.#isTTY = val;
3114
+ }
3115
+ get rows() {
3116
+ return this.#destSrc("rows");
3117
+ }
3118
+ get columns() {
3119
+ return this.#destSrc("columns");
3120
+ }
3121
+ mute() {
3122
+ this.muted = true;
3123
+ }
3124
+ unmute() {
3125
+ this.muted = false;
3126
+ }
3127
+ _onpipe(src) {
3128
+ this._src = src;
3129
+ }
3130
+ pipe(dest, options) {
3131
+ this._dest = dest;
3132
+ return super.pipe(dest, options);
3133
+ }
3134
+ pause() {
3135
+ if (this._src) {
3136
+ return this._src.pause();
3137
+ }
3138
+ }
3139
+ resume() {
3140
+ if (this._src) {
3141
+ return this._src.resume();
3142
+ }
3143
+ }
3144
+ write(c) {
3145
+ if (this.muted) {
3146
+ if (!this.replace) {
3147
+ return true;
3148
+ }
3149
+ if (c.match(/^\u001b/)) {
3150
+ if (c.indexOf(this._prompt) === 0) {
3151
+ c = c.slice(this._prompt.length);
3152
+ c = c.replace(/./g, this.replace);
3153
+ c = this._prompt + c;
3154
+ }
3155
+ this._hadControl = true;
3156
+ return this.emit("data", c);
3157
+ } else {
3158
+ if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
3159
+ this._hadControl = false;
3160
+ this.emit("data", this._prompt);
3161
+ c = c.slice(this._prompt.length);
3162
+ }
3163
+ c = c.toString().replace(/./g, this.replace);
3164
+ }
3165
+ }
3166
+ this.emit("data", c);
3167
+ }
3168
+ end(c) {
3169
+ if (this.muted) {
3170
+ if (c && this.replace) {
3171
+ c = c.toString().replace(/./g, this.replace);
3172
+ } else {
3173
+ c = null;
3174
+ }
3175
+ }
3176
+ if (c) {
3177
+ this.emit("data", c);
3178
+ }
3179
+ this.emit("end");
3180
+ }
3181
+ destroy(...args) {
3182
+ return this.#proxy("destroy", ...args);
3183
+ }
3184
+ destroySoon(...args) {
3185
+ return this.#proxy("destroySoon", ...args);
3186
+ }
3187
+ close(...args) {
3188
+ return this.#proxy("close", ...args);
3189
+ }
3190
+ };
3191
+ module2.exports = MuteStream2;
3192
+ }
3193
+ });
3194
+
3029
3195
  // node_modules/process-nextick-args/index.js
3030
3196
  var require_process_nextick_args = __commonJS({
3031
3197
  "node_modules/process-nextick-args/index.js"(exports2, module2) {
@@ -5182,7 +5348,7 @@ var require_nodejsUtils = __commonJS({
5182
5348
  });
5183
5349
 
5184
5350
  // node_modules/immediate/lib/index.js
5185
- var require_lib = __commonJS({
5351
+ var require_lib2 = __commonJS({
5186
5352
  "node_modules/immediate/lib/index.js"(exports2, module2) {
5187
5353
  "use strict";
5188
5354
  var Mutation = global.MutationObserver || global.WebKitMutationObserver;
@@ -5256,10 +5422,10 @@ var require_lib = __commonJS({
5256
5422
  });
5257
5423
 
5258
5424
  // node_modules/lie/lib/index.js
5259
- var require_lib2 = __commonJS({
5425
+ var require_lib3 = __commonJS({
5260
5426
  "node_modules/lie/lib/index.js"(exports2, module2) {
5261
5427
  "use strict";
5262
- var immediate = require_lib();
5428
+ var immediate = require_lib2();
5263
5429
  function INTERNAL() {
5264
5430
  }
5265
5431
  var handlers = {};
@@ -5533,7 +5699,7 @@ var require_external = __commonJS({
5533
5699
  if (typeof Promise !== "undefined") {
5534
5700
  ES6Promise = Promise;
5535
5701
  } else {
5536
- ES6Promise = require_lib2();
5702
+ ES6Promise = require_lib3();
5537
5703
  }
5538
5704
  module2.exports = {
5539
5705
  Promise: ES6Promise
@@ -5545,15 +5711,15 @@ var require_external = __commonJS({
5545
5711
  var require_setImmediate = __commonJS({
5546
5712
  "node_modules/setimmediate/setImmediate.js"(exports2) {
5547
5713
  "use strict";
5548
- (function(global2, undefined2) {
5714
+ (function(global3, undefined2) {
5549
5715
  "use strict";
5550
- if (global2.setImmediate) {
5716
+ if (global3.setImmediate) {
5551
5717
  return;
5552
5718
  }
5553
5719
  var nextHandle = 1;
5554
5720
  var tasksByHandle = {};
5555
5721
  var currentlyRunningATask = false;
5556
- var doc = global2.document;
5722
+ var doc = global3.document;
5557
5723
  var registerImmediate;
5558
5724
  function setImmediate2(callback) {
5559
5725
  if (typeof callback !== "function") {
@@ -5616,31 +5782,31 @@ var require_setImmediate = __commonJS({
5616
5782
  };
5617
5783
  }
5618
5784
  function canUsePostMessage() {
5619
- if (global2.postMessage && !global2.importScripts) {
5785
+ if (global3.postMessage && !global3.importScripts) {
5620
5786
  var postMessageIsAsynchronous = true;
5621
- var oldOnMessage = global2.onmessage;
5622
- global2.onmessage = function() {
5787
+ var oldOnMessage = global3.onmessage;
5788
+ global3.onmessage = function() {
5623
5789
  postMessageIsAsynchronous = false;
5624
5790
  };
5625
- global2.postMessage("", "*");
5626
- global2.onmessage = oldOnMessage;
5791
+ global3.postMessage("", "*");
5792
+ global3.onmessage = oldOnMessage;
5627
5793
  return postMessageIsAsynchronous;
5628
5794
  }
5629
5795
  }
5630
5796
  function installPostMessageImplementation() {
5631
5797
  var messagePrefix = "setImmediate$" + Math.random() + "$";
5632
5798
  var onGlobalMessage = function(event) {
5633
- if (event.source === global2 && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) {
5799
+ if (event.source === global3 && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) {
5634
5800
  runIfPresent(+event.data.slice(messagePrefix.length));
5635
5801
  }
5636
5802
  };
5637
- if (global2.addEventListener) {
5638
- global2.addEventListener("message", onGlobalMessage, false);
5803
+ if (global3.addEventListener) {
5804
+ global3.addEventListener("message", onGlobalMessage, false);
5639
5805
  } else {
5640
- global2.attachEvent("onmessage", onGlobalMessage);
5806
+ global3.attachEvent("onmessage", onGlobalMessage);
5641
5807
  }
5642
5808
  registerImmediate = function(handle) {
5643
- global2.postMessage(messagePrefix + handle, "*");
5809
+ global3.postMessage(messagePrefix + handle, "*");
5644
5810
  };
5645
5811
  }
5646
5812
  function installMessageChannelImplementation() {
@@ -5671,13 +5837,13 @@ var require_setImmediate = __commonJS({
5671
5837
  setTimeout(runIfPresent, 0, handle);
5672
5838
  };
5673
5839
  }
5674
- var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global2);
5675
- attachTo = attachTo && attachTo.setTimeout ? attachTo : global2;
5676
- if ({}.toString.call(global2.process) === "[object process]") {
5840
+ var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global3);
5841
+ attachTo = attachTo && attachTo.setTimeout ? attachTo : global3;
5842
+ if ({}.toString.call(global3.process) === "[object process]") {
5677
5843
  installNextTickImplementation();
5678
5844
  } else if (canUsePostMessage()) {
5679
5845
  installPostMessageImplementation();
5680
- } else if (global2.MessageChannel) {
5846
+ } else if (global3.MessageChannel) {
5681
5847
  installMessageChannelImplementation();
5682
5848
  } else if (doc && "onreadystatechange" in doc.createElement("script")) {
5683
5849
  installReadyStateChangeImplementation();
@@ -12731,7 +12897,7 @@ var require_load = __commonJS({
12731
12897
  });
12732
12898
 
12733
12899
  // node_modules/jszip/lib/index.js
12734
- var require_lib3 = __commonJS({
12900
+ var require_lib4 = __commonJS({
12735
12901
  "node_modules/jszip/lib/index.js"(exports2, module2) {
12736
12902
  "use strict";
12737
12903
  function JSZip() {
@@ -13284,7 +13450,1902 @@ var import_node_fs8 = __toESM(require("fs"), 1);
13284
13450
  var import_node_path11 = __toESM(require("path"), 1);
13285
13451
  var import_node_os2 = __toESM(require("os"), 1);
13286
13452
  var import_node_child_process = require("child_process");
13287
- var import_node_readline = __toESM(require("readline"), 1);
13453
+
13454
+ // node_modules/@inquirer/core/dist/lib/key.js
13455
+ var isUpKey = (key, keybindings = []) => (
13456
+ // The up key
13457
+ key.name === "up" || // Vim keybinding: hjkl keys map to left/down/up/right
13458
+ keybindings.includes("vim") && key.name === "k" || // Emacs keybinding: Ctrl+P means "previous" in Emacs navigation conventions
13459
+ keybindings.includes("emacs") && key.ctrl && key.name === "p"
13460
+ );
13461
+ var isDownKey = (key, keybindings = []) => (
13462
+ // The down key
13463
+ key.name === "down" || // Vim keybinding: hjkl keys map to left/down/up/right
13464
+ keybindings.includes("vim") && key.name === "j" || // Emacs keybinding: Ctrl+N means "next" in Emacs navigation conventions
13465
+ keybindings.includes("emacs") && key.ctrl && key.name === "n"
13466
+ );
13467
+ var isSpaceKey = (key) => key.name === "space";
13468
+ var isBackspaceKey = (key) => key.name === "backspace";
13469
+ var isTabKey = (key) => key.name === "tab";
13470
+ var isNumberKey = (key) => "1234567890".includes(key.name);
13471
+ var isEnterKey = (key) => key.name === "enter" || key.name === "return";
13472
+
13473
+ // node_modules/@inquirer/core/dist/lib/errors.js
13474
+ var AbortPromptError = class extends Error {
13475
+ name = "AbortPromptError";
13476
+ message = "Prompt was aborted";
13477
+ constructor(options) {
13478
+ super();
13479
+ this.cause = options?.cause;
13480
+ }
13481
+ };
13482
+ var CancelPromptError = class extends Error {
13483
+ name = "CancelPromptError";
13484
+ message = "Prompt was canceled";
13485
+ };
13486
+ var ExitPromptError = class extends Error {
13487
+ name = "ExitPromptError";
13488
+ };
13489
+ var HookError = class extends Error {
13490
+ name = "HookError";
13491
+ };
13492
+ var ValidationError = class extends Error {
13493
+ name = "ValidationError";
13494
+ };
13495
+
13496
+ // node_modules/@inquirer/core/dist/lib/use-state.js
13497
+ var import_node_async_hooks2 = require("async_hooks");
13498
+
13499
+ // node_modules/@inquirer/core/dist/lib/hook-engine.js
13500
+ var import_node_async_hooks = require("async_hooks");
13501
+ var hookStorage = new import_node_async_hooks.AsyncLocalStorage();
13502
+ function createStore(rl) {
13503
+ const store = {
13504
+ rl,
13505
+ hooks: [],
13506
+ hooksCleanup: [],
13507
+ hooksEffect: [],
13508
+ index: 0,
13509
+ handleChange() {
13510
+ }
13511
+ };
13512
+ return store;
13513
+ }
13514
+ function withHooks(rl, cb) {
13515
+ const store = createStore(rl);
13516
+ return hookStorage.run(store, () => {
13517
+ function cycle(render) {
13518
+ store.handleChange = () => {
13519
+ store.index = 0;
13520
+ render();
13521
+ };
13522
+ store.handleChange();
13523
+ }
13524
+ return cb(cycle);
13525
+ });
13526
+ }
13527
+ function getStore() {
13528
+ const store = hookStorage.getStore();
13529
+ if (!store) {
13530
+ throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
13531
+ }
13532
+ return store;
13533
+ }
13534
+ function readline() {
13535
+ return getStore().rl;
13536
+ }
13537
+ function withUpdates(fn2) {
13538
+ const wrapped = (...args) => {
13539
+ const store = getStore();
13540
+ let shouldUpdate = false;
13541
+ const oldHandleChange = store.handleChange;
13542
+ store.handleChange = () => {
13543
+ shouldUpdate = true;
13544
+ };
13545
+ const returnValue = fn2(...args);
13546
+ if (shouldUpdate) {
13547
+ oldHandleChange();
13548
+ }
13549
+ store.handleChange = oldHandleChange;
13550
+ return returnValue;
13551
+ };
13552
+ return import_node_async_hooks.AsyncResource.bind(wrapped);
13553
+ }
13554
+ function withPointer(cb) {
13555
+ const store = getStore();
13556
+ const { index } = store;
13557
+ const pointer = {
13558
+ get() {
13559
+ return store.hooks[index];
13560
+ },
13561
+ set(value) {
13562
+ store.hooks[index] = value;
13563
+ },
13564
+ initialized: index in store.hooks
13565
+ };
13566
+ const returnValue = cb(pointer);
13567
+ store.index++;
13568
+ return returnValue;
13569
+ }
13570
+ function handleChange() {
13571
+ getStore().handleChange();
13572
+ }
13573
+ var effectScheduler = {
13574
+ queue(cb) {
13575
+ const store = getStore();
13576
+ const { index } = store;
13577
+ store.hooksEffect.push(() => {
13578
+ store.hooksCleanup[index]?.();
13579
+ const cleanFn = cb(readline());
13580
+ if (cleanFn != null && typeof cleanFn !== "function") {
13581
+ throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
13582
+ }
13583
+ store.hooksCleanup[index] = cleanFn;
13584
+ });
13585
+ },
13586
+ run() {
13587
+ const store = getStore();
13588
+ withUpdates(() => {
13589
+ store.hooksEffect.forEach((effect) => {
13590
+ effect();
13591
+ });
13592
+ store.hooksEffect.length = 0;
13593
+ })();
13594
+ },
13595
+ clearAll() {
13596
+ const store = getStore();
13597
+ store.hooksCleanup.forEach((cleanFn) => {
13598
+ cleanFn?.();
13599
+ });
13600
+ store.hooksEffect.length = 0;
13601
+ store.hooksCleanup.length = 0;
13602
+ }
13603
+ };
13604
+
13605
+ // node_modules/@inquirer/core/dist/lib/use-state.js
13606
+ function useState(defaultValue) {
13607
+ return withPointer((pointer) => {
13608
+ const setState = import_node_async_hooks2.AsyncResource.bind(function setState2(newValue) {
13609
+ if (pointer.get() !== newValue) {
13610
+ pointer.set(newValue);
13611
+ handleChange();
13612
+ }
13613
+ });
13614
+ if (pointer.initialized) {
13615
+ return [pointer.get(), setState];
13616
+ }
13617
+ const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
13618
+ pointer.set(value);
13619
+ return [value, setState];
13620
+ });
13621
+ }
13622
+
13623
+ // node_modules/@inquirer/core/dist/lib/use-effect.js
13624
+ function useEffect(cb, depArray) {
13625
+ withPointer((pointer) => {
13626
+ const oldDeps = pointer.get();
13627
+ const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
13628
+ if (hasChanged) {
13629
+ effectScheduler.queue(cb);
13630
+ }
13631
+ pointer.set(depArray);
13632
+ });
13633
+ }
13634
+
13635
+ // node_modules/@inquirer/core/dist/lib/theme.js
13636
+ var import_node_util = require("util");
13637
+
13638
+ // node_modules/@inquirer/figures/dist/index.js
13639
+ var import_node_process2 = __toESM(require("process"), 1);
13640
+ function isUnicodeSupported() {
13641
+ if (import_node_process2.default.platform !== "win32") {
13642
+ return import_node_process2.default.env["TERM"] !== "linux";
13643
+ }
13644
+ return Boolean(import_node_process2.default.env["WT_SESSION"]) || // Windows Terminal
13645
+ Boolean(import_node_process2.default.env["TERMINUS_SUBLIME"]) || // Terminus (<0.2.27)
13646
+ import_node_process2.default.env["ConEmuTask"] === "{cmd::Cmder}" || // ConEmu and cmder
13647
+ import_node_process2.default.env["TERM_PROGRAM"] === "Terminus-Sublime" || import_node_process2.default.env["TERM_PROGRAM"] === "vscode" || import_node_process2.default.env["TERM"] === "xterm-256color" || import_node_process2.default.env["TERM"] === "alacritty" || import_node_process2.default.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
13648
+ }
13649
+ var common = {
13650
+ circleQuestionMark: "(?)",
13651
+ questionMarkPrefix: "(?)",
13652
+ square: "\u2588",
13653
+ squareDarkShade: "\u2593",
13654
+ squareMediumShade: "\u2592",
13655
+ squareLightShade: "\u2591",
13656
+ squareTop: "\u2580",
13657
+ squareBottom: "\u2584",
13658
+ squareLeft: "\u258C",
13659
+ squareRight: "\u2590",
13660
+ squareCenter: "\u25A0",
13661
+ bullet: "\u25CF",
13662
+ dot: "\u2024",
13663
+ ellipsis: "\u2026",
13664
+ pointerSmall: "\u203A",
13665
+ triangleUp: "\u25B2",
13666
+ triangleUpSmall: "\u25B4",
13667
+ triangleDown: "\u25BC",
13668
+ triangleDownSmall: "\u25BE",
13669
+ triangleLeftSmall: "\u25C2",
13670
+ triangleRightSmall: "\u25B8",
13671
+ home: "\u2302",
13672
+ heart: "\u2665",
13673
+ musicNote: "\u266A",
13674
+ musicNoteBeamed: "\u266B",
13675
+ arrowUp: "\u2191",
13676
+ arrowDown: "\u2193",
13677
+ arrowLeft: "\u2190",
13678
+ arrowRight: "\u2192",
13679
+ arrowLeftRight: "\u2194",
13680
+ arrowUpDown: "\u2195",
13681
+ almostEqual: "\u2248",
13682
+ notEqual: "\u2260",
13683
+ lessOrEqual: "\u2264",
13684
+ greaterOrEqual: "\u2265",
13685
+ identical: "\u2261",
13686
+ infinity: "\u221E",
13687
+ subscriptZero: "\u2080",
13688
+ subscriptOne: "\u2081",
13689
+ subscriptTwo: "\u2082",
13690
+ subscriptThree: "\u2083",
13691
+ subscriptFour: "\u2084",
13692
+ subscriptFive: "\u2085",
13693
+ subscriptSix: "\u2086",
13694
+ subscriptSeven: "\u2087",
13695
+ subscriptEight: "\u2088",
13696
+ subscriptNine: "\u2089",
13697
+ oneHalf: "\xBD",
13698
+ oneThird: "\u2153",
13699
+ oneQuarter: "\xBC",
13700
+ oneFifth: "\u2155",
13701
+ oneSixth: "\u2159",
13702
+ oneEighth: "\u215B",
13703
+ twoThirds: "\u2154",
13704
+ twoFifths: "\u2156",
13705
+ threeQuarters: "\xBE",
13706
+ threeFifths: "\u2157",
13707
+ threeEighths: "\u215C",
13708
+ fourFifths: "\u2158",
13709
+ fiveSixths: "\u215A",
13710
+ fiveEighths: "\u215D",
13711
+ sevenEighths: "\u215E",
13712
+ line: "\u2500",
13713
+ lineBold: "\u2501",
13714
+ lineDouble: "\u2550",
13715
+ lineDashed0: "\u2504",
13716
+ lineDashed1: "\u2505",
13717
+ lineDashed2: "\u2508",
13718
+ lineDashed3: "\u2509",
13719
+ lineDashed4: "\u254C",
13720
+ lineDashed5: "\u254D",
13721
+ lineDashed6: "\u2574",
13722
+ lineDashed7: "\u2576",
13723
+ lineDashed8: "\u2578",
13724
+ lineDashed9: "\u257A",
13725
+ lineDashed10: "\u257C",
13726
+ lineDashed11: "\u257E",
13727
+ lineDashed12: "\u2212",
13728
+ lineDashed13: "\u2013",
13729
+ lineDashed14: "\u2010",
13730
+ lineDashed15: "\u2043",
13731
+ lineVertical: "\u2502",
13732
+ lineVerticalBold: "\u2503",
13733
+ lineVerticalDouble: "\u2551",
13734
+ lineVerticalDashed0: "\u2506",
13735
+ lineVerticalDashed1: "\u2507",
13736
+ lineVerticalDashed2: "\u250A",
13737
+ lineVerticalDashed3: "\u250B",
13738
+ lineVerticalDashed4: "\u254E",
13739
+ lineVerticalDashed5: "\u254F",
13740
+ lineVerticalDashed6: "\u2575",
13741
+ lineVerticalDashed7: "\u2577",
13742
+ lineVerticalDashed8: "\u2579",
13743
+ lineVerticalDashed9: "\u257B",
13744
+ lineVerticalDashed10: "\u257D",
13745
+ lineVerticalDashed11: "\u257F",
13746
+ lineDownLeft: "\u2510",
13747
+ lineDownLeftArc: "\u256E",
13748
+ lineDownBoldLeftBold: "\u2513",
13749
+ lineDownBoldLeft: "\u2512",
13750
+ lineDownLeftBold: "\u2511",
13751
+ lineDownDoubleLeftDouble: "\u2557",
13752
+ lineDownDoubleLeft: "\u2556",
13753
+ lineDownLeftDouble: "\u2555",
13754
+ lineDownRight: "\u250C",
13755
+ lineDownRightArc: "\u256D",
13756
+ lineDownBoldRightBold: "\u250F",
13757
+ lineDownBoldRight: "\u250E",
13758
+ lineDownRightBold: "\u250D",
13759
+ lineDownDoubleRightDouble: "\u2554",
13760
+ lineDownDoubleRight: "\u2553",
13761
+ lineDownRightDouble: "\u2552",
13762
+ lineUpLeft: "\u2518",
13763
+ lineUpLeftArc: "\u256F",
13764
+ lineUpBoldLeftBold: "\u251B",
13765
+ lineUpBoldLeft: "\u251A",
13766
+ lineUpLeftBold: "\u2519",
13767
+ lineUpDoubleLeftDouble: "\u255D",
13768
+ lineUpDoubleLeft: "\u255C",
13769
+ lineUpLeftDouble: "\u255B",
13770
+ lineUpRight: "\u2514",
13771
+ lineUpRightArc: "\u2570",
13772
+ lineUpBoldRightBold: "\u2517",
13773
+ lineUpBoldRight: "\u2516",
13774
+ lineUpRightBold: "\u2515",
13775
+ lineUpDoubleRightDouble: "\u255A",
13776
+ lineUpDoubleRight: "\u2559",
13777
+ lineUpRightDouble: "\u2558",
13778
+ lineUpDownLeft: "\u2524",
13779
+ lineUpBoldDownBoldLeftBold: "\u252B",
13780
+ lineUpBoldDownBoldLeft: "\u2528",
13781
+ lineUpDownLeftBold: "\u2525",
13782
+ lineUpBoldDownLeftBold: "\u2529",
13783
+ lineUpDownBoldLeftBold: "\u252A",
13784
+ lineUpDownBoldLeft: "\u2527",
13785
+ lineUpBoldDownLeft: "\u2526",
13786
+ lineUpDoubleDownDoubleLeftDouble: "\u2563",
13787
+ lineUpDoubleDownDoubleLeft: "\u2562",
13788
+ lineUpDownLeftDouble: "\u2561",
13789
+ lineUpDownRight: "\u251C",
13790
+ lineUpBoldDownBoldRightBold: "\u2523",
13791
+ lineUpBoldDownBoldRight: "\u2520",
13792
+ lineUpDownRightBold: "\u251D",
13793
+ lineUpBoldDownRightBold: "\u2521",
13794
+ lineUpDownBoldRightBold: "\u2522",
13795
+ lineUpDownBoldRight: "\u251F",
13796
+ lineUpBoldDownRight: "\u251E",
13797
+ lineUpDoubleDownDoubleRightDouble: "\u2560",
13798
+ lineUpDoubleDownDoubleRight: "\u255F",
13799
+ lineUpDownRightDouble: "\u255E",
13800
+ lineDownLeftRight: "\u252C",
13801
+ lineDownBoldLeftBoldRightBold: "\u2533",
13802
+ lineDownLeftBoldRightBold: "\u252F",
13803
+ lineDownBoldLeftRight: "\u2530",
13804
+ lineDownBoldLeftBoldRight: "\u2531",
13805
+ lineDownBoldLeftRightBold: "\u2532",
13806
+ lineDownLeftRightBold: "\u252E",
13807
+ lineDownLeftBoldRight: "\u252D",
13808
+ lineDownDoubleLeftDoubleRightDouble: "\u2566",
13809
+ lineDownDoubleLeftRight: "\u2565",
13810
+ lineDownLeftDoubleRightDouble: "\u2564",
13811
+ lineUpLeftRight: "\u2534",
13812
+ lineUpBoldLeftBoldRightBold: "\u253B",
13813
+ lineUpLeftBoldRightBold: "\u2537",
13814
+ lineUpBoldLeftRight: "\u2538",
13815
+ lineUpBoldLeftBoldRight: "\u2539",
13816
+ lineUpBoldLeftRightBold: "\u253A",
13817
+ lineUpLeftRightBold: "\u2536",
13818
+ lineUpLeftBoldRight: "\u2535",
13819
+ lineUpDoubleLeftDoubleRightDouble: "\u2569",
13820
+ lineUpDoubleLeftRight: "\u2568",
13821
+ lineUpLeftDoubleRightDouble: "\u2567",
13822
+ lineUpDownLeftRight: "\u253C",
13823
+ lineUpBoldDownBoldLeftBoldRightBold: "\u254B",
13824
+ lineUpDownBoldLeftBoldRightBold: "\u2548",
13825
+ lineUpBoldDownLeftBoldRightBold: "\u2547",
13826
+ lineUpBoldDownBoldLeftRightBold: "\u254A",
13827
+ lineUpBoldDownBoldLeftBoldRight: "\u2549",
13828
+ lineUpBoldDownLeftRight: "\u2540",
13829
+ lineUpDownBoldLeftRight: "\u2541",
13830
+ lineUpDownLeftBoldRight: "\u253D",
13831
+ lineUpDownLeftRightBold: "\u253E",
13832
+ lineUpBoldDownBoldLeftRight: "\u2542",
13833
+ lineUpDownLeftBoldRightBold: "\u253F",
13834
+ lineUpBoldDownLeftBoldRight: "\u2543",
13835
+ lineUpBoldDownLeftRightBold: "\u2544",
13836
+ lineUpDownBoldLeftBoldRight: "\u2545",
13837
+ lineUpDownBoldLeftRightBold: "\u2546",
13838
+ lineUpDoubleDownDoubleLeftDoubleRightDouble: "\u256C",
13839
+ lineUpDoubleDownDoubleLeftRight: "\u256B",
13840
+ lineUpDownLeftDoubleRightDouble: "\u256A",
13841
+ lineCross: "\u2573",
13842
+ lineBackslash: "\u2572",
13843
+ lineSlash: "\u2571"
13844
+ };
13845
+ var specialMainSymbols = {
13846
+ tick: "\u2714",
13847
+ info: "\u2139",
13848
+ warning: "\u26A0",
13849
+ cross: "\u2718",
13850
+ squareSmall: "\u25FB",
13851
+ squareSmallFilled: "\u25FC",
13852
+ circle: "\u25EF",
13853
+ circleFilled: "\u25C9",
13854
+ circleDotted: "\u25CC",
13855
+ circleDouble: "\u25CE",
13856
+ circleCircle: "\u24DE",
13857
+ circleCross: "\u24E7",
13858
+ circlePipe: "\u24BE",
13859
+ radioOn: "\u25C9",
13860
+ radioOff: "\u25EF",
13861
+ checkboxOn: "\u2612",
13862
+ checkboxOff: "\u2610",
13863
+ checkboxCircleOn: "\u24E7",
13864
+ checkboxCircleOff: "\u24BE",
13865
+ pointer: "\u276F",
13866
+ triangleUpOutline: "\u25B3",
13867
+ triangleLeft: "\u25C0",
13868
+ triangleRight: "\u25B6",
13869
+ lozenge: "\u25C6",
13870
+ lozengeOutline: "\u25C7",
13871
+ hamburger: "\u2630",
13872
+ smiley: "\u32E1",
13873
+ mustache: "\u0DF4",
13874
+ star: "\u2605",
13875
+ play: "\u25B6",
13876
+ nodejs: "\u2B22",
13877
+ oneSeventh: "\u2150",
13878
+ oneNinth: "\u2151",
13879
+ oneTenth: "\u2152"
13880
+ };
13881
+ var specialFallbackSymbols = {
13882
+ tick: "\u221A",
13883
+ info: "i",
13884
+ warning: "\u203C",
13885
+ cross: "\xD7",
13886
+ squareSmall: "\u25A1",
13887
+ squareSmallFilled: "\u25A0",
13888
+ circle: "( )",
13889
+ circleFilled: "(*)",
13890
+ circleDotted: "( )",
13891
+ circleDouble: "( )",
13892
+ circleCircle: "(\u25CB)",
13893
+ circleCross: "(\xD7)",
13894
+ circlePipe: "(\u2502)",
13895
+ radioOn: "(*)",
13896
+ radioOff: "( )",
13897
+ checkboxOn: "[\xD7]",
13898
+ checkboxOff: "[ ]",
13899
+ checkboxCircleOn: "(\xD7)",
13900
+ checkboxCircleOff: "( )",
13901
+ pointer: ">",
13902
+ triangleUpOutline: "\u2206",
13903
+ triangleLeft: "\u25C4",
13904
+ triangleRight: "\u25BA",
13905
+ lozenge: "\u2666",
13906
+ lozengeOutline: "\u25CA",
13907
+ hamburger: "\u2261",
13908
+ smiley: "\u263A",
13909
+ mustache: "\u250C\u2500\u2510",
13910
+ star: "\u2736",
13911
+ play: "\u25BA",
13912
+ nodejs: "\u2666",
13913
+ oneSeventh: "1/7",
13914
+ oneNinth: "1/9",
13915
+ oneTenth: "1/10"
13916
+ };
13917
+ var mainSymbols = {
13918
+ ...common,
13919
+ ...specialMainSymbols
13920
+ };
13921
+ var fallbackSymbols = {
13922
+ ...common,
13923
+ ...specialFallbackSymbols
13924
+ };
13925
+ var shouldUseMain = isUnicodeSupported();
13926
+ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
13927
+ var dist_default = figures;
13928
+ var replacements = Object.entries(specialMainSymbols);
13929
+
13930
+ // node_modules/@inquirer/core/dist/lib/theme.js
13931
+ var defaultTheme = {
13932
+ prefix: {
13933
+ idle: (0, import_node_util.styleText)("blue", "?"),
13934
+ done: (0, import_node_util.styleText)("green", dist_default.tick)
13935
+ },
13936
+ spinner: {
13937
+ interval: 80,
13938
+ frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"].map((frame) => (0, import_node_util.styleText)("yellow", frame))
13939
+ },
13940
+ style: {
13941
+ answer: (text) => (0, import_node_util.styleText)("cyan", text),
13942
+ message: (text) => (0, import_node_util.styleText)("bold", text),
13943
+ error: (text) => (0, import_node_util.styleText)("red", `> ${text}`),
13944
+ defaultAnswer: (text) => (0, import_node_util.styleText)("dim", `(${text})`),
13945
+ help: (text) => (0, import_node_util.styleText)("dim", text),
13946
+ highlight: (text) => (0, import_node_util.styleText)("cyan", text),
13947
+ key: (text) => (0, import_node_util.styleText)("cyan", (0, import_node_util.styleText)("bold", `<${text}>`))
13948
+ }
13949
+ };
13950
+
13951
+ // node_modules/@inquirer/core/dist/lib/make-theme.js
13952
+ function isPlainObject(value) {
13953
+ if (typeof value !== "object" || value === null)
13954
+ return false;
13955
+ let proto2 = value;
13956
+ while (Object.getPrototypeOf(proto2) !== null) {
13957
+ proto2 = Object.getPrototypeOf(proto2);
13958
+ }
13959
+ return Object.getPrototypeOf(value) === proto2;
13960
+ }
13961
+ function deepMerge(...objects) {
13962
+ const output = {};
13963
+ for (const obj of objects) {
13964
+ for (const [key, value] of Object.entries(obj)) {
13965
+ const prevValue = output[key];
13966
+ output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
13967
+ }
13968
+ }
13969
+ return output;
13970
+ }
13971
+ function makeTheme(...themes) {
13972
+ const themesToMerge = [
13973
+ defaultTheme,
13974
+ ...themes.filter((theme) => theme != null)
13975
+ ];
13976
+ return deepMerge(...themesToMerge);
13977
+ }
13978
+
13979
+ // node_modules/@inquirer/core/dist/lib/use-prefix.js
13980
+ function usePrefix({ status = "idle", theme }) {
13981
+ const [showLoader, setShowLoader] = useState(false);
13982
+ const [tick, setTick] = useState(0);
13983
+ const { prefix, spinner } = makeTheme(theme);
13984
+ useEffect(() => {
13985
+ if (status === "loading") {
13986
+ let tickInterval;
13987
+ let inc = -1;
13988
+ const delayTimeout = setTimeout(() => {
13989
+ setShowLoader(true);
13990
+ tickInterval = setInterval(() => {
13991
+ inc = inc + 1;
13992
+ setTick(inc % spinner.frames.length);
13993
+ }, spinner.interval);
13994
+ }, 300);
13995
+ return () => {
13996
+ clearTimeout(delayTimeout);
13997
+ clearInterval(tickInterval);
13998
+ };
13999
+ } else {
14000
+ setShowLoader(false);
14001
+ }
14002
+ }, [status]);
14003
+ if (showLoader) {
14004
+ return spinner.frames[tick];
14005
+ }
14006
+ const iconName = status === "loading" ? "idle" : status;
14007
+ return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
14008
+ }
14009
+
14010
+ // node_modules/@inquirer/core/dist/lib/use-memo.js
14011
+ function useMemo(fn2, dependencies) {
14012
+ return withPointer((pointer) => {
14013
+ const prev = pointer.get();
14014
+ if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
14015
+ const value = fn2();
14016
+ pointer.set({ value, dependencies });
14017
+ return value;
14018
+ }
14019
+ return prev.value;
14020
+ });
14021
+ }
14022
+
14023
+ // node_modules/@inquirer/core/dist/lib/use-ref.js
14024
+ function useRef(val) {
14025
+ return useState({ current: val })[0];
14026
+ }
14027
+
14028
+ // node_modules/@inquirer/core/dist/lib/use-keypress.js
14029
+ function useKeypress(userHandler) {
14030
+ const signal = useRef(userHandler);
14031
+ signal.current = userHandler;
14032
+ useEffect((rl) => {
14033
+ let ignore = false;
14034
+ const handler = withUpdates((_input, event) => {
14035
+ if (ignore)
14036
+ return;
14037
+ void signal.current(event, rl);
14038
+ });
14039
+ rl.input.on("keypress", handler);
14040
+ return () => {
14041
+ ignore = true;
14042
+ rl.input.removeListener("keypress", handler);
14043
+ };
14044
+ }, []);
14045
+ }
14046
+
14047
+ // node_modules/@inquirer/core/dist/lib/utils.js
14048
+ var import_cli_width = __toESM(require_cli_width(), 1);
14049
+
14050
+ // node_modules/fast-string-truncated-width/dist/utils.js
14051
+ var getCodePointsLength = /* @__PURE__ */ (() => {
14052
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
14053
+ return (input) => {
14054
+ let surrogatePairsNr = 0;
14055
+ SURROGATE_PAIR_RE.lastIndex = 0;
14056
+ while (SURROGATE_PAIR_RE.test(input)) {
14057
+ surrogatePairsNr += 1;
14058
+ }
14059
+ return input.length - surrogatePairsNr;
14060
+ };
14061
+ })();
14062
+ var isFullWidth = (x) => {
14063
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
14064
+ };
14065
+ var isWideNotCJKTNotEmoji = (x) => {
14066
+ 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;
14067
+ };
14068
+
14069
+ // node_modules/fast-string-truncated-width/dist/index.js
14070
+ var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
14071
+ var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
14072
+ var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
14073
+ var TAB_RE = /\t{1,1000}/y;
14074
+ var EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
14075
+ var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
14076
+ var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
14077
+ var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
14078
+ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
14079
+ const LIMIT = truncationOptions.limit ?? Infinity;
14080
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
14081
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
14082
+ const ANSI_WIDTH = 0;
14083
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
14084
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
14085
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
14086
+ const FULL_WIDTH_WIDTH = 2;
14087
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
14088
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
14089
+ const PARSE_BLOCKS = [
14090
+ [LATIN_RE, REGULAR_WIDTH],
14091
+ [ANSI_RE, ANSI_WIDTH],
14092
+ [CONTROL_RE, CONTROL_WIDTH],
14093
+ [TAB_RE, TAB_WIDTH],
14094
+ [EMOJI_RE, EMOJI_WIDTH],
14095
+ [CJKT_WIDE_RE, WIDE_WIDTH]
14096
+ ];
14097
+ let indexPrev = 0;
14098
+ let index = 0;
14099
+ let length = input.length;
14100
+ let lengthExtra = 0;
14101
+ let truncationEnabled = false;
14102
+ let truncationIndex = length;
14103
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
14104
+ let unmatchedStart = 0;
14105
+ let unmatchedEnd = 0;
14106
+ let width = 0;
14107
+ let widthExtra = 0;
14108
+ outer: while (true) {
14109
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
14110
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
14111
+ lengthExtra = 0;
14112
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
14113
+ const codePoint = char.codePointAt(0) || 0;
14114
+ if (isFullWidth(codePoint)) {
14115
+ widthExtra = FULL_WIDTH_WIDTH;
14116
+ } else if (isWideNotCJKTNotEmoji(codePoint)) {
14117
+ widthExtra = WIDE_WIDTH;
14118
+ } else {
14119
+ widthExtra = REGULAR_WIDTH;
14120
+ }
14121
+ if (width + widthExtra > truncationLimit) {
14122
+ truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
14123
+ }
14124
+ if (width + widthExtra > LIMIT) {
14125
+ truncationEnabled = true;
14126
+ break outer;
14127
+ }
14128
+ lengthExtra += char.length;
14129
+ width += widthExtra;
14130
+ }
14131
+ unmatchedStart = unmatchedEnd = 0;
14132
+ }
14133
+ if (index >= length) {
14134
+ break outer;
14135
+ }
14136
+ for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
14137
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
14138
+ BLOCK_RE.lastIndex = index;
14139
+ if (BLOCK_RE.test(input)) {
14140
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
14141
+ widthExtra = lengthExtra * BLOCK_WIDTH;
14142
+ if (width + widthExtra > truncationLimit) {
14143
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
14144
+ }
14145
+ if (width + widthExtra > LIMIT) {
14146
+ truncationEnabled = true;
14147
+ break outer;
14148
+ }
14149
+ width += widthExtra;
14150
+ unmatchedStart = indexPrev;
14151
+ unmatchedEnd = index;
14152
+ index = indexPrev = BLOCK_RE.lastIndex;
14153
+ continue outer;
14154
+ }
14155
+ }
14156
+ index += 1;
14157
+ }
14158
+ return {
14159
+ width: truncationEnabled ? truncationLimit : width,
14160
+ index: truncationEnabled ? truncationIndex : length,
14161
+ truncated: truncationEnabled,
14162
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
14163
+ };
14164
+ };
14165
+ var dist_default2 = getStringTruncatedWidth;
14166
+
14167
+ // node_modules/fast-string-width/dist/index.js
14168
+ var NO_TRUNCATION2 = {
14169
+ limit: Infinity,
14170
+ ellipsis: "",
14171
+ ellipsisWidth: 0
14172
+ };
14173
+ var fastStringWidth = (input, options = {}) => {
14174
+ return dist_default2(input, NO_TRUNCATION2, options).width;
14175
+ };
14176
+ var dist_default3 = fastStringWidth;
14177
+
14178
+ // node_modules/fast-wrap-ansi/lib/main.js
14179
+ var ESC = "\x1B";
14180
+ var CSI = "\x9B";
14181
+ var END_CODE = 39;
14182
+ var ANSI_ESCAPE_BELL = "\x07";
14183
+ var ANSI_CSI = "[";
14184
+ var ANSI_OSC = "]";
14185
+ var ANSI_SGR_TERMINATOR = "m";
14186
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
14187
+ var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
14188
+ var getClosingCode = (openingCode) => {
14189
+ if (openingCode >= 30 && openingCode <= 37)
14190
+ return 39;
14191
+ if (openingCode >= 90 && openingCode <= 97)
14192
+ return 39;
14193
+ if (openingCode >= 40 && openingCode <= 47)
14194
+ return 49;
14195
+ if (openingCode >= 100 && openingCode <= 107)
14196
+ return 49;
14197
+ if (openingCode === 1 || openingCode === 2)
14198
+ return 22;
14199
+ if (openingCode === 3)
14200
+ return 23;
14201
+ if (openingCode === 4)
14202
+ return 24;
14203
+ if (openingCode === 7)
14204
+ return 27;
14205
+ if (openingCode === 8)
14206
+ return 28;
14207
+ if (openingCode === 9)
14208
+ return 29;
14209
+ if (openingCode === 0)
14210
+ return 0;
14211
+ return void 0;
14212
+ };
14213
+ var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
14214
+ var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
14215
+ var wrapWord = (rows, word, columns) => {
14216
+ const characters = word[Symbol.iterator]();
14217
+ let isInsideEscape = false;
14218
+ let isInsideLinkEscape = false;
14219
+ let lastRow = rows.at(-1);
14220
+ let visible = lastRow === void 0 ? 0 : dist_default3(lastRow);
14221
+ let currentCharacter = characters.next();
14222
+ let nextCharacter = characters.next();
14223
+ let rawCharacterIndex = 0;
14224
+ while (!currentCharacter.done) {
14225
+ const character = currentCharacter.value;
14226
+ const characterLength = dist_default3(character);
14227
+ if (visible + characterLength <= columns) {
14228
+ rows[rows.length - 1] += character;
14229
+ } else {
14230
+ rows.push(character);
14231
+ visible = 0;
14232
+ }
14233
+ if (character === ESC || character === CSI) {
14234
+ isInsideEscape = true;
14235
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
14236
+ }
14237
+ if (isInsideEscape) {
14238
+ if (isInsideLinkEscape) {
14239
+ if (character === ANSI_ESCAPE_BELL) {
14240
+ isInsideEscape = false;
14241
+ isInsideLinkEscape = false;
14242
+ }
14243
+ } else if (character === ANSI_SGR_TERMINATOR) {
14244
+ isInsideEscape = false;
14245
+ }
14246
+ } else {
14247
+ visible += characterLength;
14248
+ if (visible === columns && !nextCharacter.done) {
14249
+ rows.push("");
14250
+ visible = 0;
14251
+ }
14252
+ }
14253
+ currentCharacter = nextCharacter;
14254
+ nextCharacter = characters.next();
14255
+ rawCharacterIndex += character.length;
14256
+ }
14257
+ lastRow = rows.at(-1);
14258
+ if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
14259
+ rows[rows.length - 2] += rows.pop();
14260
+ }
14261
+ };
14262
+ var stringVisibleTrimSpacesRight = (string) => {
14263
+ const words = string.split(" ");
14264
+ let last = words.length;
14265
+ while (last) {
14266
+ if (dist_default3(words[last - 1])) {
14267
+ break;
14268
+ }
14269
+ last--;
14270
+ }
14271
+ if (last === words.length) {
14272
+ return string;
14273
+ }
14274
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
14275
+ };
14276
+ var exec = (string, columns, options = {}) => {
14277
+ if (options.trim !== false && string.trim() === "") {
14278
+ return "";
14279
+ }
14280
+ let returnValue = "";
14281
+ let escapeCode;
14282
+ let escapeUrl;
14283
+ const words = string.split(" ");
14284
+ let rows = [""];
14285
+ let rowLength = 0;
14286
+ for (let index = 0; index < words.length; index++) {
14287
+ const word = words[index];
14288
+ if (options.trim !== false) {
14289
+ const row = rows.at(-1) ?? "";
14290
+ const trimmed = row.trimStart();
14291
+ if (row.length !== trimmed.length) {
14292
+ rows[rows.length - 1] = trimmed;
14293
+ rowLength = dist_default3(trimmed);
14294
+ }
14295
+ }
14296
+ if (index !== 0) {
14297
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
14298
+ rows.push("");
14299
+ rowLength = 0;
14300
+ }
14301
+ if (rowLength || options.trim === false) {
14302
+ rows[rows.length - 1] += " ";
14303
+ rowLength++;
14304
+ }
14305
+ }
14306
+ const wordLength = dist_default3(word);
14307
+ if (options.hard && wordLength > columns) {
14308
+ const remainingColumns = columns - rowLength;
14309
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
14310
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
14311
+ if (breaksStartingNextLine < breaksStartingThisLine) {
14312
+ rows.push("");
14313
+ }
14314
+ wrapWord(rows, word, columns);
14315
+ rowLength = dist_default3(rows.at(-1) ?? "");
14316
+ continue;
14317
+ }
14318
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
14319
+ if (options.wordWrap === false && rowLength < columns) {
14320
+ wrapWord(rows, word, columns);
14321
+ rowLength = dist_default3(rows.at(-1) ?? "");
14322
+ continue;
14323
+ }
14324
+ rows.push("");
14325
+ rowLength = 0;
14326
+ }
14327
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
14328
+ wrapWord(rows, word, columns);
14329
+ rowLength = dist_default3(rows.at(-1) ?? "");
14330
+ continue;
14331
+ }
14332
+ rows[rows.length - 1] += word;
14333
+ rowLength += wordLength;
14334
+ }
14335
+ if (options.trim !== false) {
14336
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
14337
+ }
14338
+ const preString = rows.join("\n");
14339
+ let inSurrogate = false;
14340
+ for (let i = 0; i < preString.length; i++) {
14341
+ const character = preString[i];
14342
+ returnValue += character;
14343
+ if (!inSurrogate) {
14344
+ inSurrogate = character >= "\uD800" && character <= "\uDBFF";
14345
+ if (inSurrogate) {
14346
+ continue;
14347
+ }
14348
+ } else {
14349
+ inSurrogate = false;
14350
+ }
14351
+ if (character === ESC || character === CSI) {
14352
+ GROUP_REGEX.lastIndex = i + 1;
14353
+ const groupsResult = GROUP_REGEX.exec(preString);
14354
+ const groups = groupsResult?.groups;
14355
+ if (groups?.code !== void 0) {
14356
+ const code = Number.parseFloat(groups.code);
14357
+ escapeCode = code === END_CODE ? void 0 : code;
14358
+ } else if (groups?.uri !== void 0) {
14359
+ escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
14360
+ }
14361
+ }
14362
+ if (preString[i + 1] === "\n") {
14363
+ if (escapeUrl) {
14364
+ returnValue += wrapAnsiHyperlink("");
14365
+ }
14366
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
14367
+ if (escapeCode && closingCode) {
14368
+ returnValue += wrapAnsiCode(closingCode);
14369
+ }
14370
+ } else if (character === "\n") {
14371
+ if (escapeCode && getClosingCode(escapeCode)) {
14372
+ returnValue += wrapAnsiCode(escapeCode);
14373
+ }
14374
+ if (escapeUrl) {
14375
+ returnValue += wrapAnsiHyperlink(escapeUrl);
14376
+ }
14377
+ }
14378
+ }
14379
+ return returnValue;
14380
+ };
14381
+ var CRLF_OR_LF = /\r?\n/;
14382
+ function wrapAnsi(string, columns, options) {
14383
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
14384
+ }
14385
+
14386
+ // node_modules/@inquirer/core/dist/lib/utils.js
14387
+ function breakLines(content, width) {
14388
+ return content.split("\n").flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split("\n").map((str2) => str2.trimEnd())).join("\n");
14389
+ }
14390
+ function readlineWidth() {
14391
+ return (0, import_cli_width.default)({ defaultWidth: 80, output: readline().output });
14392
+ }
14393
+
14394
+ // node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
14395
+ function usePointerPosition({ active, renderedItems, pageSize, loop }) {
14396
+ const state = useRef({
14397
+ lastPointer: active,
14398
+ lastActive: void 0
14399
+ });
14400
+ const { lastPointer, lastActive } = state.current;
14401
+ const middle = Math.floor(pageSize / 2);
14402
+ const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
14403
+ const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
14404
+ let pointer = defaultPointerPosition;
14405
+ if (renderedLength > pageSize) {
14406
+ if (loop) {
14407
+ pointer = lastPointer;
14408
+ if (
14409
+ // First render, skip this logic.
14410
+ lastActive != null && // Only move the pointer down when the user moves down.
14411
+ lastActive < active && // Check user didn't move up across page boundary.
14412
+ active - lastActive < pageSize
14413
+ ) {
14414
+ pointer = Math.min(
14415
+ // Furthest allowed position for the pointer is the middle of the list
14416
+ middle,
14417
+ Math.abs(active - lastActive) === 1 ? Math.min(
14418
+ // Move the pointer at most the height of the last active item.
14419
+ lastPointer + (renderedItems[lastActive]?.length ?? 0),
14420
+ // If the user moved by one item, move the pointer to the natural position of the active item as
14421
+ // long as it doesn't move the cursor up.
14422
+ Math.max(defaultPointerPosition, lastPointer)
14423
+ ) : (
14424
+ // Otherwise, move the pointer down by the difference between the active and last active item.
14425
+ lastPointer + active - lastActive
14426
+ )
14427
+ );
14428
+ }
14429
+ } else {
14430
+ const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
14431
+ pointer = spaceUnderActive < pageSize - middle ? (
14432
+ // If the active item is near the end of the list, progressively move the cursor towards the end.
14433
+ pageSize - spaceUnderActive
14434
+ ) : (
14435
+ // Otherwise, progressively move the pointer to the middle of the list.
14436
+ Math.min(defaultPointerPosition, middle)
14437
+ );
14438
+ }
14439
+ }
14440
+ state.current.lastPointer = pointer;
14441
+ state.current.lastActive = active;
14442
+ return pointer;
14443
+ }
14444
+ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
14445
+ const width = readlineWidth();
14446
+ const bound = (num) => (num % items.length + items.length) % items.length;
14447
+ const renderedItems = items.map((item, index) => {
14448
+ if (item == null)
14449
+ return [];
14450
+ return breakLines(renderItem({ item, index, isActive: index === active }), width).split("\n");
14451
+ });
14452
+ const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
14453
+ const renderItemAtIndex = (index) => renderedItems[index] ?? [];
14454
+ const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
14455
+ const activeItem = renderItemAtIndex(active).slice(0, pageSize);
14456
+ const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
14457
+ const pageBuffer = Array.from({ length: pageSize });
14458
+ pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
14459
+ const itemVisited = /* @__PURE__ */ new Set([active]);
14460
+ let bufferPointer = activeItemPosition + activeItem.length;
14461
+ let itemPointer = bound(active + 1);
14462
+ while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
14463
+ const lines = renderItemAtIndex(itemPointer);
14464
+ const linesToAdd = lines.slice(0, pageSize - bufferPointer);
14465
+ pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
14466
+ itemVisited.add(itemPointer);
14467
+ bufferPointer += linesToAdd.length;
14468
+ itemPointer = bound(itemPointer + 1);
14469
+ }
14470
+ bufferPointer = activeItemPosition - 1;
14471
+ itemPointer = bound(active - 1);
14472
+ while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
14473
+ const lines = renderItemAtIndex(itemPointer);
14474
+ const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
14475
+ pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
14476
+ itemVisited.add(itemPointer);
14477
+ bufferPointer -= linesToAdd.length;
14478
+ itemPointer = bound(itemPointer - 1);
14479
+ }
14480
+ return pageBuffer.filter((line) => typeof line === "string").join("\n");
14481
+ }
14482
+
14483
+ // node_modules/@inquirer/core/dist/lib/create-prompt.js
14484
+ var readline2 = __toESM(require("readline"), 1);
14485
+ var import_node_async_hooks3 = require("async_hooks");
14486
+ var import_mute_stream = __toESM(require_lib(), 1);
14487
+
14488
+ // node_modules/signal-exit/dist/mjs/signals.js
14489
+ var signals = [];
14490
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
14491
+ if (process.platform !== "win32") {
14492
+ signals.push(
14493
+ "SIGALRM",
14494
+ "SIGABRT",
14495
+ "SIGVTALRM",
14496
+ "SIGXCPU",
14497
+ "SIGXFSZ",
14498
+ "SIGUSR2",
14499
+ "SIGTRAP",
14500
+ "SIGSYS",
14501
+ "SIGQUIT",
14502
+ "SIGIOT"
14503
+ // should detect profiler and enable/disable accordingly.
14504
+ // see #21
14505
+ // 'SIGPROF'
14506
+ );
14507
+ }
14508
+ if (process.platform === "linux") {
14509
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
14510
+ }
14511
+
14512
+ // node_modules/signal-exit/dist/mjs/index.js
14513
+ var processOk = (process5) => !!process5 && typeof process5 === "object" && typeof process5.removeListener === "function" && typeof process5.emit === "function" && typeof process5.reallyExit === "function" && typeof process5.listeners === "function" && typeof process5.kill === "function" && typeof process5.pid === "number" && typeof process5.on === "function";
14514
+ var kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
14515
+ var global2 = globalThis;
14516
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
14517
+ var Emitter = class {
14518
+ emitted = {
14519
+ afterExit: false,
14520
+ exit: false
14521
+ };
14522
+ listeners = {
14523
+ afterExit: [],
14524
+ exit: []
14525
+ };
14526
+ count = 0;
14527
+ id = Math.random();
14528
+ constructor() {
14529
+ if (global2[kExitEmitter]) {
14530
+ return global2[kExitEmitter];
14531
+ }
14532
+ ObjectDefineProperty(global2, kExitEmitter, {
14533
+ value: this,
14534
+ writable: false,
14535
+ enumerable: false,
14536
+ configurable: false
14537
+ });
14538
+ }
14539
+ on(ev, fn2) {
14540
+ this.listeners[ev].push(fn2);
14541
+ }
14542
+ removeListener(ev, fn2) {
14543
+ const list = this.listeners[ev];
14544
+ const i = list.indexOf(fn2);
14545
+ if (i === -1) {
14546
+ return;
14547
+ }
14548
+ if (i === 0 && list.length === 1) {
14549
+ list.length = 0;
14550
+ } else {
14551
+ list.splice(i, 1);
14552
+ }
14553
+ }
14554
+ emit(ev, code, signal) {
14555
+ if (this.emitted[ev]) {
14556
+ return false;
14557
+ }
14558
+ this.emitted[ev] = true;
14559
+ let ret = false;
14560
+ for (const fn2 of this.listeners[ev]) {
14561
+ ret = fn2(code, signal) === true || ret;
14562
+ }
14563
+ if (ev === "exit") {
14564
+ ret = this.emit("afterExit", code, signal) || ret;
14565
+ }
14566
+ return ret;
14567
+ }
14568
+ };
14569
+ var SignalExitBase = class {
14570
+ };
14571
+ var signalExitWrap = (handler) => {
14572
+ return {
14573
+ onExit(cb, opts) {
14574
+ return handler.onExit(cb, opts);
14575
+ },
14576
+ load() {
14577
+ return handler.load();
14578
+ },
14579
+ unload() {
14580
+ return handler.unload();
14581
+ }
14582
+ };
14583
+ };
14584
+ var SignalExitFallback = class extends SignalExitBase {
14585
+ onExit() {
14586
+ return () => {
14587
+ };
14588
+ }
14589
+ load() {
14590
+ }
14591
+ unload() {
14592
+ }
14593
+ };
14594
+ var SignalExit = class extends SignalExitBase {
14595
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
14596
+ // so use a supported signal instead
14597
+ /* c8 ignore start */
14598
+ #hupSig = process4.platform === "win32" ? "SIGINT" : "SIGHUP";
14599
+ /* c8 ignore stop */
14600
+ #emitter = new Emitter();
14601
+ #process;
14602
+ #originalProcessEmit;
14603
+ #originalProcessReallyExit;
14604
+ #sigListeners = {};
14605
+ #loaded = false;
14606
+ constructor(process5) {
14607
+ super();
14608
+ this.#process = process5;
14609
+ this.#sigListeners = {};
14610
+ for (const sig of signals) {
14611
+ this.#sigListeners[sig] = () => {
14612
+ const listeners = this.#process.listeners(sig);
14613
+ let { count } = this.#emitter;
14614
+ const p2 = process5;
14615
+ if (typeof p2.__signal_exit_emitter__ === "object" && typeof p2.__signal_exit_emitter__.count === "number") {
14616
+ count += p2.__signal_exit_emitter__.count;
14617
+ }
14618
+ if (listeners.length === count) {
14619
+ this.unload();
14620
+ const ret = this.#emitter.emit("exit", null, sig);
14621
+ const s3 = sig === "SIGHUP" ? this.#hupSig : sig;
14622
+ if (!ret)
14623
+ process5.kill(process5.pid, s3);
14624
+ }
14625
+ };
14626
+ }
14627
+ this.#originalProcessReallyExit = process5.reallyExit;
14628
+ this.#originalProcessEmit = process5.emit;
14629
+ }
14630
+ onExit(cb, opts) {
14631
+ if (!processOk(this.#process)) {
14632
+ return () => {
14633
+ };
14634
+ }
14635
+ if (this.#loaded === false) {
14636
+ this.load();
14637
+ }
14638
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
14639
+ this.#emitter.on(ev, cb);
14640
+ return () => {
14641
+ this.#emitter.removeListener(ev, cb);
14642
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
14643
+ this.unload();
14644
+ }
14645
+ };
14646
+ }
14647
+ load() {
14648
+ if (this.#loaded) {
14649
+ return;
14650
+ }
14651
+ this.#loaded = true;
14652
+ this.#emitter.count += 1;
14653
+ for (const sig of signals) {
14654
+ try {
14655
+ const fn2 = this.#sigListeners[sig];
14656
+ if (fn2)
14657
+ this.#process.on(sig, fn2);
14658
+ } catch (_2) {
14659
+ }
14660
+ }
14661
+ this.#process.emit = (ev, ...a) => {
14662
+ return this.#processEmit(ev, ...a);
14663
+ };
14664
+ this.#process.reallyExit = (code) => {
14665
+ return this.#processReallyExit(code);
14666
+ };
14667
+ }
14668
+ unload() {
14669
+ if (!this.#loaded) {
14670
+ return;
14671
+ }
14672
+ this.#loaded = false;
14673
+ signals.forEach((sig) => {
14674
+ const listener = this.#sigListeners[sig];
14675
+ if (!listener) {
14676
+ throw new Error("Listener not defined for signal: " + sig);
14677
+ }
14678
+ try {
14679
+ this.#process.removeListener(sig, listener);
14680
+ } catch (_2) {
14681
+ }
14682
+ });
14683
+ this.#process.emit = this.#originalProcessEmit;
14684
+ this.#process.reallyExit = this.#originalProcessReallyExit;
14685
+ this.#emitter.count -= 1;
14686
+ }
14687
+ #processReallyExit(code) {
14688
+ if (!processOk(this.#process)) {
14689
+ return 0;
14690
+ }
14691
+ this.#process.exitCode = code || 0;
14692
+ this.#emitter.emit("exit", this.#process.exitCode, null);
14693
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
14694
+ }
14695
+ #processEmit(ev, ...args) {
14696
+ const og = this.#originalProcessEmit;
14697
+ if (ev === "exit" && processOk(this.#process)) {
14698
+ if (typeof args[0] === "number") {
14699
+ this.#process.exitCode = args[0];
14700
+ }
14701
+ const ret = og.call(this.#process, ev, ...args);
14702
+ this.#emitter.emit("exit", this.#process.exitCode, null);
14703
+ return ret;
14704
+ } else {
14705
+ return og.call(this.#process, ev, ...args);
14706
+ }
14707
+ }
14708
+ };
14709
+ var process4 = globalThis.process;
14710
+ var {
14711
+ /**
14712
+ * Called when the process is exiting, whether via signal, explicit
14713
+ * exit, or running out of stuff to do.
14714
+ *
14715
+ * If the global process object is not suitable for instrumentation,
14716
+ * then this will be a no-op.
14717
+ *
14718
+ * Returns a function that may be used to unload signal-exit.
14719
+ */
14720
+ onExit,
14721
+ /**
14722
+ * Load the listeners. Likely you never need to call this, unless
14723
+ * doing a rather deep integration with signal-exit functionality.
14724
+ * Mostly exposed for the benefit of testing.
14725
+ *
14726
+ * @internal
14727
+ */
14728
+ load,
14729
+ /**
14730
+ * Unload the listeners. Likely you never need to call this, unless
14731
+ * doing a rather deep integration with signal-exit functionality.
14732
+ * Mostly exposed for the benefit of testing.
14733
+ *
14734
+ * @internal
14735
+ */
14736
+ unload
14737
+ } = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback());
14738
+
14739
+ // node_modules/@inquirer/core/dist/lib/screen-manager.js
14740
+ var import_node_util2 = require("util");
14741
+
14742
+ // node_modules/@inquirer/ansi/dist/index.js
14743
+ var ESC2 = "\x1B[";
14744
+ var cursorLeft = ESC2 + "G";
14745
+ var cursorHide = ESC2 + "?25l";
14746
+ var cursorShow = ESC2 + "?25h";
14747
+ var cursorUp = (rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "";
14748
+ var cursorDown = (rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "";
14749
+ var cursorTo = (x, y2) => {
14750
+ if (typeof y2 === "number" && !Number.isNaN(y2)) {
14751
+ return `${ESC2}${y2 + 1};${x + 1}H`;
14752
+ }
14753
+ return `${ESC2}${x + 1}G`;
14754
+ };
14755
+ var eraseLine = ESC2 + "2K";
14756
+ var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
14757
+
14758
+ // node_modules/@inquirer/core/dist/lib/screen-manager.js
14759
+ var height = (content) => content.split("\n").length;
14760
+ var lastLine = (content) => content.split("\n").pop() ?? "";
14761
+ var ScreenManager = class {
14762
+ // These variables are keeping information to allow correct prompt re-rendering
14763
+ height = 0;
14764
+ extraLinesUnderPrompt = 0;
14765
+ cursorPos;
14766
+ rl;
14767
+ constructor(rl) {
14768
+ this.rl = rl;
14769
+ this.cursorPos = rl.getCursorPos();
14770
+ }
14771
+ write(content) {
14772
+ this.rl.output.unmute();
14773
+ this.rl.output.write(content);
14774
+ this.rl.output.mute();
14775
+ }
14776
+ render(content, bottomContent = "") {
14777
+ const promptLine = lastLine(content);
14778
+ const rawPromptLine = (0, import_node_util2.stripVTControlCharacters)(promptLine);
14779
+ let prompt = rawPromptLine;
14780
+ if (this.rl.line.length > 0) {
14781
+ prompt = prompt.slice(0, -this.rl.line.length);
14782
+ }
14783
+ this.rl.setPrompt(prompt);
14784
+ this.cursorPos = this.rl.getCursorPos();
14785
+ const width = readlineWidth();
14786
+ content = breakLines(content, width);
14787
+ bottomContent = breakLines(bottomContent, width);
14788
+ if (rawPromptLine.length % width === 0) {
14789
+ content += "\n";
14790
+ }
14791
+ let output = content + (bottomContent ? "\n" + bottomContent : "");
14792
+ const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
14793
+ const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
14794
+ if (bottomContentHeight > 0)
14795
+ output += cursorUp(bottomContentHeight);
14796
+ output += cursorTo(this.cursorPos.cols);
14797
+ this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
14798
+ this.extraLinesUnderPrompt = bottomContentHeight;
14799
+ this.height = height(output);
14800
+ }
14801
+ checkCursorPos() {
14802
+ const cursorPos = this.rl.getCursorPos();
14803
+ if (cursorPos.cols !== this.cursorPos.cols) {
14804
+ this.write(cursorTo(cursorPos.cols));
14805
+ this.cursorPos = cursorPos;
14806
+ }
14807
+ }
14808
+ done({ clearContent }) {
14809
+ this.rl.setPrompt("");
14810
+ let output = cursorDown(this.extraLinesUnderPrompt);
14811
+ output += clearContent ? eraseLines(this.height) : "\n";
14812
+ output += cursorShow;
14813
+ this.write(output);
14814
+ this.rl.close();
14815
+ }
14816
+ };
14817
+
14818
+ // node_modules/@inquirer/core/dist/lib/promise-polyfill.js
14819
+ var PromisePolyfill = class extends Promise {
14820
+ // Available starting from Node 22
14821
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
14822
+ static withResolver() {
14823
+ let resolve;
14824
+ let reject;
14825
+ const promise = new Promise((res, rej) => {
14826
+ resolve = res;
14827
+ reject = rej;
14828
+ });
14829
+ return { promise, resolve, reject };
14830
+ }
14831
+ };
14832
+
14833
+ // node_modules/@inquirer/core/dist/lib/create-prompt.js
14834
+ var nativeSetImmediate = globalThis.setImmediate;
14835
+ function getCallSites() {
14836
+ const _prepareStackTrace = Error.prepareStackTrace;
14837
+ let result = [];
14838
+ try {
14839
+ Error.prepareStackTrace = (_2, callSites) => {
14840
+ const callSitesWithoutCurrent = callSites.slice(1);
14841
+ result = callSitesWithoutCurrent;
14842
+ return callSitesWithoutCurrent;
14843
+ };
14844
+ new Error().stack;
14845
+ } catch {
14846
+ return result;
14847
+ }
14848
+ Error.prepareStackTrace = _prepareStackTrace;
14849
+ return result;
14850
+ }
14851
+ function createPrompt(view) {
14852
+ const callSites = getCallSites();
14853
+ const prompt = (config, context = {}) => {
14854
+ const { input = process.stdin, signal } = context;
14855
+ const cleanups = /* @__PURE__ */ new Set();
14856
+ const output = new import_mute_stream.default();
14857
+ output.pipe(context.output ?? process.stdout);
14858
+ output.mute();
14859
+ const rl = readline2.createInterface({
14860
+ terminal: true,
14861
+ input,
14862
+ output
14863
+ });
14864
+ const screen = new ScreenManager(rl);
14865
+ const { promise, resolve, reject } = PromisePolyfill.withResolver();
14866
+ const cancel = () => reject(new CancelPromptError());
14867
+ if (signal) {
14868
+ const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
14869
+ if (signal.aborted) {
14870
+ abort();
14871
+ return Object.assign(promise, { cancel });
14872
+ }
14873
+ signal.addEventListener("abort", abort);
14874
+ cleanups.add(() => signal.removeEventListener("abort", abort));
14875
+ }
14876
+ cleanups.add(onExit((code, signal2) => {
14877
+ reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
14878
+ }));
14879
+ const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
14880
+ rl.on("SIGINT", sigint);
14881
+ cleanups.add(() => rl.removeListener("SIGINT", sigint));
14882
+ return withHooks(rl, (cycle) => {
14883
+ const hooksCleanup = import_node_async_hooks3.AsyncResource.bind(() => effectScheduler.clearAll());
14884
+ rl.on("close", hooksCleanup);
14885
+ cleanups.add(() => rl.removeListener("close", hooksCleanup));
14886
+ const startCycle = () => {
14887
+ const checkCursorPos = () => screen.checkCursorPos();
14888
+ rl.input.on("keypress", checkCursorPos);
14889
+ cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
14890
+ cycle(() => {
14891
+ try {
14892
+ const nextView = view(config, (value) => {
14893
+ setImmediate(() => resolve(value));
14894
+ });
14895
+ if (nextView === void 0) {
14896
+ const callerFilename = callSites[1]?.getFileName();
14897
+ throw new Error(`Prompt functions must return a string.
14898
+ at ${callerFilename}`);
14899
+ }
14900
+ const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
14901
+ screen.render(content, bottomContent);
14902
+ effectScheduler.run();
14903
+ } catch (error) {
14904
+ reject(error);
14905
+ }
14906
+ });
14907
+ };
14908
+ if ("readableFlowing" in input) {
14909
+ nativeSetImmediate(startCycle);
14910
+ } else {
14911
+ startCycle();
14912
+ }
14913
+ return Object.assign(promise.then((answer) => {
14914
+ effectScheduler.clearAll();
14915
+ return answer;
14916
+ }, (error) => {
14917
+ effectScheduler.clearAll();
14918
+ throw error;
14919
+ }).finally(() => {
14920
+ cleanups.forEach((cleanup) => cleanup());
14921
+ screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
14922
+ output.end();
14923
+ }).then(() => promise), { cancel });
14924
+ });
14925
+ };
14926
+ return prompt;
14927
+ }
14928
+
14929
+ // node_modules/@inquirer/core/dist/lib/Separator.js
14930
+ var import_node_util3 = require("util");
14931
+ var Separator = class {
14932
+ separator = (0, import_node_util3.styleText)("dim", Array.from({ length: 15 }).join(dist_default.line));
14933
+ type = "separator";
14934
+ constructor(separator) {
14935
+ if (separator) {
14936
+ this.separator = separator;
14937
+ }
14938
+ }
14939
+ static isSeparator(choice) {
14940
+ return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
14941
+ }
14942
+ };
14943
+
14944
+ // node_modules/@inquirer/checkbox/dist/index.js
14945
+ var import_node_util4 = require("util");
14946
+ var checkboxTheme = {
14947
+ icon: {
14948
+ checked: (0, import_node_util4.styleText)("green", dist_default.circleFilled),
14949
+ unchecked: dist_default.circle,
14950
+ cursor: dist_default.pointer,
14951
+ disabledChecked: (0, import_node_util4.styleText)("green", dist_default.circleDouble),
14952
+ disabledUnchecked: "-"
14953
+ },
14954
+ style: {
14955
+ disabled: (text) => (0, import_node_util4.styleText)("dim", text),
14956
+ renderSelectedChoices: (selectedChoices) => selectedChoices.map((choice) => choice.short).join(", "),
14957
+ description: (text) => (0, import_node_util4.styleText)("cyan", text),
14958
+ keysHelpTip: (keys) => keys.map(([key, action]) => `${(0, import_node_util4.styleText)("bold", key)} ${(0, import_node_util4.styleText)("dim", action)}`).join((0, import_node_util4.styleText)("dim", " \u2022 "))
14959
+ },
14960
+ i18n: { disabledError: "This option is disabled and cannot be toggled." },
14961
+ keybindings: []
14962
+ };
14963
+ function isSelectable(item) {
14964
+ return !Separator.isSeparator(item) && !item.disabled;
14965
+ }
14966
+ function isNavigable(item) {
14967
+ return !Separator.isSeparator(item);
14968
+ }
14969
+ function isChecked(item) {
14970
+ return !Separator.isSeparator(item) && item.checked;
14971
+ }
14972
+ function toggle(item) {
14973
+ return isSelectable(item) ? { ...item, checked: !item.checked } : item;
14974
+ }
14975
+ function check(checked) {
14976
+ return function(item) {
14977
+ return isSelectable(item) ? { ...item, checked } : item;
14978
+ };
14979
+ }
14980
+ function normalizeChoices(choices) {
14981
+ return choices.map((choice) => {
14982
+ if (Separator.isSeparator(choice))
14983
+ return choice;
14984
+ if (typeof choice === "string") {
14985
+ return {
14986
+ value: choice,
14987
+ name: choice,
14988
+ short: choice,
14989
+ checkedName: choice,
14990
+ disabled: false,
14991
+ checked: false
14992
+ };
14993
+ }
14994
+ const name = choice.name ?? String(choice.value);
14995
+ const normalizedChoice = {
14996
+ value: choice.value,
14997
+ name,
14998
+ short: choice.short ?? name,
14999
+ checkedName: choice.checkedName ?? name,
15000
+ disabled: choice.disabled ?? false,
15001
+ checked: choice.checked ?? false
15002
+ };
15003
+ if (choice.description) {
15004
+ normalizedChoice.description = choice.description;
15005
+ }
15006
+ return normalizedChoice;
15007
+ });
15008
+ }
15009
+ var dist_default4 = createPrompt((config, done) => {
15010
+ const { pageSize = 7, loop = true, required, validate = () => true } = config;
15011
+ const shortcuts = { all: "a", invert: "i", ...config.shortcuts };
15012
+ const theme = makeTheme(checkboxTheme, config.theme);
15013
+ const { keybindings } = theme;
15014
+ const [status, setStatus] = useState("idle");
15015
+ const prefix = usePrefix({ status, theme });
15016
+ const [items, setItems] = useState(normalizeChoices(config.choices));
15017
+ const bounds = useMemo(() => {
15018
+ const first = items.findIndex(isNavigable);
15019
+ const last = items.findLastIndex(isNavigable);
15020
+ if (first === -1) {
15021
+ throw new ValidationError("[checkbox prompt] No selectable choices. All choices are disabled.");
15022
+ }
15023
+ return { first, last };
15024
+ }, [items]);
15025
+ const [active, setActive] = useState(bounds.first);
15026
+ const [errorMsg, setError] = useState();
15027
+ useKeypress(async (key) => {
15028
+ if (isEnterKey(key)) {
15029
+ const selection = items.filter(isChecked);
15030
+ const isValid = await validate([...selection]);
15031
+ if (required && !selection.length) {
15032
+ setError("At least one choice must be selected");
15033
+ } else if (isValid === true) {
15034
+ setStatus("done");
15035
+ done(selection.map((choice) => choice.value));
15036
+ } else {
15037
+ setError(isValid || "You must select a valid value");
15038
+ }
15039
+ } else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {
15040
+ if (errorMsg) {
15041
+ setError(void 0);
15042
+ }
15043
+ if (loop || isUpKey(key, keybindings) && active !== bounds.first || isDownKey(key, keybindings) && active !== bounds.last) {
15044
+ const offset = isUpKey(key, keybindings) ? -1 : 1;
15045
+ let next = active;
15046
+ do {
15047
+ next = (next + offset + items.length) % items.length;
15048
+ } while (!isNavigable(items[next]));
15049
+ setActive(next);
15050
+ }
15051
+ } else if (isSpaceKey(key)) {
15052
+ const activeItem = items[active];
15053
+ if (activeItem && !Separator.isSeparator(activeItem)) {
15054
+ if (activeItem.disabled) {
15055
+ setError(theme.i18n.disabledError);
15056
+ } else {
15057
+ setError(void 0);
15058
+ setItems(items.map((choice, i) => i === active ? toggle(choice) : choice));
15059
+ }
15060
+ }
15061
+ } else if (key.name === shortcuts.all) {
15062
+ const selectAll = items.some((choice) => isSelectable(choice) && !choice.checked);
15063
+ setItems(items.map(check(selectAll)));
15064
+ } else if (key.name === shortcuts.invert) {
15065
+ setItems(items.map(toggle));
15066
+ } else if (isNumberKey(key)) {
15067
+ const selectedIndex = Number(key.name) - 1;
15068
+ let selectableIndex = -1;
15069
+ const position = items.findIndex((item) => {
15070
+ if (Separator.isSeparator(item))
15071
+ return false;
15072
+ selectableIndex++;
15073
+ return selectableIndex === selectedIndex;
15074
+ });
15075
+ const selectedItem = items[position];
15076
+ if (selectedItem && isSelectable(selectedItem)) {
15077
+ setActive(position);
15078
+ setItems(items.map((choice, i) => i === position ? toggle(choice) : choice));
15079
+ }
15080
+ }
15081
+ });
15082
+ const message = theme.style.message(config.message, status);
15083
+ let description;
15084
+ const page = usePagination({
15085
+ items,
15086
+ active,
15087
+ renderItem({ item, isActive }) {
15088
+ if (Separator.isSeparator(item)) {
15089
+ return ` ${item.separator}`;
15090
+ }
15091
+ const cursor = isActive ? theme.icon.cursor : " ";
15092
+ if (item.disabled) {
15093
+ const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
15094
+ const checkbox2 = item.checked ? theme.icon.disabledChecked : theme.icon.disabledUnchecked;
15095
+ return theme.style.disabled(`${cursor}${checkbox2} ${item.name} ${disabledLabel}`);
15096
+ }
15097
+ if (isActive) {
15098
+ description = item.description;
15099
+ }
15100
+ const checkbox = item.checked ? theme.icon.checked : theme.icon.unchecked;
15101
+ const name = item.checked ? item.checkedName : item.name;
15102
+ const color = isActive ? theme.style.highlight : (x) => x;
15103
+ return color(`${cursor}${checkbox} ${name}`);
15104
+ },
15105
+ pageSize,
15106
+ loop
15107
+ });
15108
+ if (status === "done") {
15109
+ const selection = items.filter(isChecked);
15110
+ const answer = theme.style.answer(theme.style.renderSelectedChoices(selection, items));
15111
+ return [prefix, message, answer].filter(Boolean).join(" ");
15112
+ }
15113
+ const keys = [
15114
+ ["\u2191\u2193", "navigate"],
15115
+ ["space", "select"]
15116
+ ];
15117
+ if (shortcuts.all)
15118
+ keys.push([shortcuts.all, "all"]);
15119
+ if (shortcuts.invert)
15120
+ keys.push([shortcuts.invert, "invert"]);
15121
+ keys.push(["\u23CE", "submit"]);
15122
+ const helpLine = theme.style.keysHelpTip(keys);
15123
+ const lines = [
15124
+ [prefix, message].filter(Boolean).join(" "),
15125
+ page,
15126
+ " ",
15127
+ description ? theme.style.description(description) : "",
15128
+ errorMsg ? theme.style.error(errorMsg) : "",
15129
+ helpLine
15130
+ ].filter(Boolean).join("\n").trimEnd();
15131
+ return `${lines}${cursorHide}`;
15132
+ });
15133
+
15134
+ // node_modules/@inquirer/confirm/dist/index.js
15135
+ function getBooleanValue(value, defaultValue) {
15136
+ let answer = defaultValue !== false;
15137
+ if (/^(y|yes)/i.test(value))
15138
+ answer = true;
15139
+ else if (/^(n|no)/i.test(value))
15140
+ answer = false;
15141
+ return answer;
15142
+ }
15143
+ function boolToString(value) {
15144
+ return value ? "Yes" : "No";
15145
+ }
15146
+ var dist_default5 = createPrompt((config, done) => {
15147
+ const { transformer = boolToString } = config;
15148
+ const [status, setStatus] = useState("idle");
15149
+ const [value, setValue] = useState("");
15150
+ const theme = makeTheme(config.theme);
15151
+ const prefix = usePrefix({ status, theme });
15152
+ useKeypress((key, rl) => {
15153
+ if (status !== "idle")
15154
+ return;
15155
+ if (isEnterKey(key)) {
15156
+ const answer = getBooleanValue(value, config.default);
15157
+ setValue(transformer(answer));
15158
+ setStatus("done");
15159
+ done(answer);
15160
+ } else if (isTabKey(key)) {
15161
+ const answer = boolToString(!getBooleanValue(value, config.default));
15162
+ rl.clearLine(0);
15163
+ rl.write(answer);
15164
+ setValue(answer);
15165
+ } else {
15166
+ setValue(rl.line);
15167
+ }
15168
+ });
15169
+ let formattedValue = value;
15170
+ let defaultValue = "";
15171
+ if (status === "done") {
15172
+ formattedValue = theme.style.answer(value);
15173
+ } else {
15174
+ defaultValue = ` ${theme.style.defaultAnswer(config.default === false ? "y/N" : "Y/n")}`;
15175
+ }
15176
+ const message = theme.style.message(config.message, status);
15177
+ return `${prefix} ${message}${defaultValue} ${formattedValue}`;
15178
+ });
15179
+
15180
+ // node_modules/@inquirer/select/dist/index.js
15181
+ var import_node_util5 = require("util");
15182
+ var selectTheme = {
15183
+ icon: { cursor: dist_default.pointer },
15184
+ style: {
15185
+ disabled: (text) => (0, import_node_util5.styleText)("dim", text),
15186
+ description: (text) => (0, import_node_util5.styleText)("cyan", text),
15187
+ keysHelpTip: (keys) => keys.map(([key, action]) => `${(0, import_node_util5.styleText)("bold", key)} ${(0, import_node_util5.styleText)("dim", action)}`).join((0, import_node_util5.styleText)("dim", " \u2022 "))
15188
+ },
15189
+ i18n: { disabledError: "This option is disabled and cannot be selected." },
15190
+ indexMode: "hidden",
15191
+ keybindings: []
15192
+ };
15193
+ function isSelectable2(item) {
15194
+ return !Separator.isSeparator(item) && !item.disabled;
15195
+ }
15196
+ function isNavigable2(item) {
15197
+ return !Separator.isSeparator(item);
15198
+ }
15199
+ function normalizeChoices2(choices) {
15200
+ return choices.map((choice) => {
15201
+ if (Separator.isSeparator(choice))
15202
+ return choice;
15203
+ if (typeof choice !== "object" || choice === null || !("value" in choice)) {
15204
+ const name2 = String(choice);
15205
+ return {
15206
+ value: choice,
15207
+ name: name2,
15208
+ short: name2,
15209
+ disabled: false
15210
+ };
15211
+ }
15212
+ const name = choice.name ?? String(choice.value);
15213
+ const normalizedChoice = {
15214
+ value: choice.value,
15215
+ name,
15216
+ short: choice.short ?? name,
15217
+ disabled: choice.disabled ?? false
15218
+ };
15219
+ if (choice.description) {
15220
+ normalizedChoice.description = choice.description;
15221
+ }
15222
+ return normalizedChoice;
15223
+ });
15224
+ }
15225
+ var dist_default6 = createPrompt((config, done) => {
15226
+ const { loop = true, pageSize = 7 } = config;
15227
+ const theme = makeTheme(selectTheme, config.theme);
15228
+ const { keybindings } = theme;
15229
+ const [status, setStatus] = useState("idle");
15230
+ const prefix = usePrefix({ status, theme });
15231
+ const searchTimeoutRef = useRef();
15232
+ const searchEnabled = !keybindings.includes("vim");
15233
+ const items = useMemo(() => normalizeChoices2(config.choices), [config.choices]);
15234
+ const bounds = useMemo(() => {
15235
+ const first = items.findIndex(isNavigable2);
15236
+ const last = items.findLastIndex(isNavigable2);
15237
+ if (first === -1) {
15238
+ throw new ValidationError("[select prompt] No selectable choices. All choices are disabled.");
15239
+ }
15240
+ return { first, last };
15241
+ }, [items]);
15242
+ const defaultItemIndex = useMemo(() => {
15243
+ if (!("default" in config))
15244
+ return -1;
15245
+ return items.findIndex((item) => isSelectable2(item) && item.value === config.default);
15246
+ }, [config.default, items]);
15247
+ const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
15248
+ const selectedChoice = items[active];
15249
+ const [errorMsg, setError] = useState();
15250
+ useKeypress((key, rl) => {
15251
+ clearTimeout(searchTimeoutRef.current);
15252
+ if (errorMsg) {
15253
+ setError(void 0);
15254
+ }
15255
+ if (isEnterKey(key)) {
15256
+ if (selectedChoice.disabled) {
15257
+ setError(theme.i18n.disabledError);
15258
+ } else {
15259
+ setStatus("done");
15260
+ done(selectedChoice.value);
15261
+ }
15262
+ } else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {
15263
+ rl.clearLine(0);
15264
+ if (loop || isUpKey(key, keybindings) && active !== bounds.first || isDownKey(key, keybindings) && active !== bounds.last) {
15265
+ const offset = isUpKey(key, keybindings) ? -1 : 1;
15266
+ let next = active;
15267
+ do {
15268
+ next = (next + offset + items.length) % items.length;
15269
+ } while (!isNavigable2(items[next]));
15270
+ setActive(next);
15271
+ }
15272
+ } else if (isNumberKey(key) && !Number.isNaN(Number(rl.line))) {
15273
+ const selectedIndex = Number(rl.line) - 1;
15274
+ let selectableIndex = -1;
15275
+ const position = items.findIndex((item2) => {
15276
+ if (Separator.isSeparator(item2))
15277
+ return false;
15278
+ selectableIndex++;
15279
+ return selectableIndex === selectedIndex;
15280
+ });
15281
+ const item = items[position];
15282
+ if (item != null && isSelectable2(item)) {
15283
+ setActive(position);
15284
+ }
15285
+ searchTimeoutRef.current = setTimeout(() => {
15286
+ rl.clearLine(0);
15287
+ }, 700);
15288
+ } else if (isBackspaceKey(key)) {
15289
+ rl.clearLine(0);
15290
+ } else if (searchEnabled) {
15291
+ const searchTerm = rl.line.toLowerCase();
15292
+ const matchIndex = items.findIndex((item) => {
15293
+ if (Separator.isSeparator(item) || !isSelectable2(item))
15294
+ return false;
15295
+ return item.name.toLowerCase().startsWith(searchTerm);
15296
+ });
15297
+ if (matchIndex !== -1) {
15298
+ setActive(matchIndex);
15299
+ }
15300
+ searchTimeoutRef.current = setTimeout(() => {
15301
+ rl.clearLine(0);
15302
+ }, 700);
15303
+ }
15304
+ });
15305
+ useEffect(() => () => {
15306
+ clearTimeout(searchTimeoutRef.current);
15307
+ }, []);
15308
+ const message = theme.style.message(config.message, status);
15309
+ const helpLine = theme.style.keysHelpTip([
15310
+ ["\u2191\u2193", "navigate"],
15311
+ ["\u23CE", "select"]
15312
+ ]);
15313
+ let separatorCount = 0;
15314
+ const page = usePagination({
15315
+ items,
15316
+ active,
15317
+ renderItem({ item, isActive, index }) {
15318
+ if (Separator.isSeparator(item)) {
15319
+ separatorCount++;
15320
+ return ` ${item.separator}`;
15321
+ }
15322
+ const cursor = isActive ? theme.icon.cursor : " ";
15323
+ const indexLabel = theme.indexMode === "number" ? `${index + 1 - separatorCount}. ` : "";
15324
+ if (item.disabled) {
15325
+ const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
15326
+ const disabledCursor = isActive ? theme.icon.cursor : "-";
15327
+ return theme.style.disabled(`${disabledCursor} ${indexLabel}${item.name} ${disabledLabel}`);
15328
+ }
15329
+ const color = isActive ? theme.style.highlight : (x) => x;
15330
+ return color(`${cursor} ${indexLabel}${item.name}`);
15331
+ },
15332
+ pageSize,
15333
+ loop
15334
+ });
15335
+ if (status === "done") {
15336
+ return [prefix, message, theme.style.answer(selectedChoice.short)].filter(Boolean).join(" ");
15337
+ }
15338
+ const { description } = selectedChoice;
15339
+ const lines = [
15340
+ [prefix, message].filter(Boolean).join(" "),
15341
+ page,
15342
+ " ",
15343
+ description ? theme.style.description(description) : "",
15344
+ errorMsg ? theme.style.error(errorMsg) : "",
15345
+ helpLine
15346
+ ].filter(Boolean).join("\n").trimEnd();
15347
+ return `${lines}${cursorHide}`;
15348
+ });
13288
15349
 
13289
15350
  // node_modules/js-yaml/dist/js-yaml.mjs
13290
15351
  function isNothing(subject) {
@@ -13325,7 +15386,7 @@ var toArray_1 = toArray;
13325
15386
  var repeat_1 = repeat;
13326
15387
  var isNegativeZero_1 = isNegativeZero;
13327
15388
  var extend_1 = extend;
13328
- var common = {
15389
+ var common2 = {
13329
15390
  isNothing: isNothing_1,
13330
15391
  isObject: isObject_1,
13331
15392
  toArray: toArray_1,
@@ -13382,7 +15443,7 @@ function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
13382
15443
  };
13383
15444
  }
13384
15445
  function padStart(string, max) {
13385
- return common.repeat(" ", max - string.length) + string;
15446
+ return common2.repeat(" ", max - string.length) + string;
13386
15447
  }
13387
15448
  function makeSnippet(mark, options) {
13388
15449
  options = Object.create(options || null);
@@ -13416,11 +15477,11 @@ function makeSnippet(mark, options) {
13416
15477
  mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
13417
15478
  maxLineLength
13418
15479
  );
13419
- result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
15480
+ result = common2.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
13420
15481
  }
13421
15482
  line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
13422
- result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
13423
- result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
15483
+ result += common2.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
15484
+ result += common2.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
13424
15485
  for (i = 1; i <= options.linesAfter; i++) {
13425
15486
  if (foundLineNo + i >= lineEnds.length) break;
13426
15487
  line = getLine(
@@ -13430,7 +15491,7 @@ function makeSnippet(mark, options) {
13430
15491
  mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
13431
15492
  maxLineLength
13432
15493
  );
13433
- result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
15494
+ result += common2.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
13434
15495
  }
13435
15496
  return result.replace(/\n$/, "");
13436
15497
  }
@@ -13743,7 +15804,7 @@ function constructYamlInteger(data) {
13743
15804
  return sign * parseInt(value, 10);
13744
15805
  }
13745
15806
  function isInteger(object) {
13746
- return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
15807
+ return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common2.isNegativeZero(object));
13747
15808
  }
13748
15809
  var int = new type("tag:yaml.org,2002:int", {
13749
15810
  kind: "scalar",
@@ -13830,14 +15891,14 @@ function representYamlFloat(object, style) {
13830
15891
  case "camelcase":
13831
15892
  return "-.Inf";
13832
15893
  }
13833
- } else if (common.isNegativeZero(object)) {
15894
+ } else if (common2.isNegativeZero(object)) {
13834
15895
  return "-0.0";
13835
15896
  }
13836
15897
  res = object.toString(10);
13837
15898
  return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
13838
15899
  }
13839
15900
  function isFloat(object) {
13840
- return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
15901
+ return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common2.isNegativeZero(object));
13841
15902
  }
13842
15903
  var float = new type("tag:yaml.org,2002:float", {
13843
15904
  kind: "scalar",
@@ -14274,7 +16335,7 @@ function captureSegment(state, start, end, checkJson) {
14274
16335
  }
14275
16336
  function mergeMappings(state, destination, source, overridableKeys) {
14276
16337
  var sourceKeys, key, index, quantity;
14277
- if (!common.isObject(source)) {
16338
+ if (!common2.isObject(source)) {
14278
16339
  throwError(state, "cannot merge mappings; the provided source object is unacceptable");
14279
16340
  }
14280
16341
  sourceKeys = Object.keys(source);
@@ -14391,7 +16452,7 @@ function writeFoldedLines(state, count) {
14391
16452
  if (count === 1) {
14392
16453
  state.result += " ";
14393
16454
  } else if (count > 1) {
14394
- state.result += common.repeat("\n", count - 1);
16455
+ state.result += common2.repeat("\n", count - 1);
14395
16456
  }
14396
16457
  }
14397
16458
  function readPlainScalar(state, nodeIndent, withinFlowCollection) {
@@ -14682,7 +16743,7 @@ function readBlockScalar(state, nodeIndent) {
14682
16743
  }
14683
16744
  if (state.lineIndent < textIndent) {
14684
16745
  if (chomping === CHOMPING_KEEP) {
14685
- state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
16746
+ state.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
14686
16747
  } else if (chomping === CHOMPING_CLIP) {
14687
16748
  if (didReadContent) {
14688
16749
  state.result += "\n";
@@ -14693,19 +16754,19 @@ function readBlockScalar(state, nodeIndent) {
14693
16754
  if (folding) {
14694
16755
  if (is_WHITE_SPACE(ch)) {
14695
16756
  atMoreIndented = true;
14696
- state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
16757
+ state.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
14697
16758
  } else if (atMoreIndented) {
14698
16759
  atMoreIndented = false;
14699
- state.result += common.repeat("\n", emptyLines + 1);
16760
+ state.result += common2.repeat("\n", emptyLines + 1);
14700
16761
  } else if (emptyLines === 0) {
14701
16762
  if (didReadContent) {
14702
16763
  state.result += " ";
14703
16764
  }
14704
16765
  } else {
14705
- state.result += common.repeat("\n", emptyLines);
16766
+ state.result += common2.repeat("\n", emptyLines);
14706
16767
  }
14707
16768
  } else {
14708
- state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
16769
+ state.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
14709
16770
  }
14710
16771
  didReadContent = true;
14711
16772
  detectedIndent = true;
@@ -15334,7 +17395,7 @@ function encodeHex(character) {
15334
17395
  } else {
15335
17396
  throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
15336
17397
  }
15337
- return "\\" + handle + common.repeat("0", length - string.length) + string;
17398
+ return "\\" + handle + common2.repeat("0", length - string.length) + string;
15338
17399
  }
15339
17400
  var QUOTING_TYPE_SINGLE = 1;
15340
17401
  var QUOTING_TYPE_DOUBLE = 2;
@@ -15343,7 +17404,7 @@ function State(options) {
15343
17404
  this.indent = Math.max(1, options["indent"] || 2);
15344
17405
  this.noArrayIndent = options["noArrayIndent"] || false;
15345
17406
  this.skipInvalid = options["skipInvalid"] || false;
15346
- this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
17407
+ this.flowLevel = common2.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
15347
17408
  this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
15348
17409
  this.sortKeys = options["sortKeys"] || false;
15349
17410
  this.lineWidth = options["lineWidth"] || 80;
@@ -15361,7 +17422,7 @@ function State(options) {
15361
17422
  this.usedDuplicates = null;
15362
17423
  }
15363
17424
  function indentString(string, spaces) {
15364
- var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
17425
+ var ind = common2.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
15365
17426
  while (position < length) {
15366
17427
  next = string.indexOf("\n", position);
15367
17428
  if (next === -1) {
@@ -15377,7 +17438,7 @@ function indentString(string, spaces) {
15377
17438
  return result;
15378
17439
  }
15379
17440
  function generateNextLine(state, level) {
15380
- return "\n" + common.repeat(" ", state.indent * level);
17441
+ return "\n" + common2.repeat(" ", state.indent * level);
15381
17442
  }
15382
17443
  function testImplicitResolving(state, str2) {
15383
17444
  var index, length, type2;
@@ -15871,7 +17932,7 @@ var FAILSAFE_SCHEMA = failsafe;
15871
17932
  var JSON_SCHEMA = json;
15872
17933
  var CORE_SCHEMA = core;
15873
17934
  var DEFAULT_SCHEMA = _default;
15874
- var load = loader.load;
17935
+ var load2 = loader.load;
15875
17936
  var loadAll = loader.loadAll;
15876
17937
  var dump = dumper.dump;
15877
17938
  var YAMLException = exception;
@@ -15900,7 +17961,7 @@ var jsYaml = {
15900
17961
  JSON_SCHEMA,
15901
17962
  CORE_SCHEMA,
15902
17963
  DEFAULT_SCHEMA,
15903
- load,
17964
+ load: load2,
15904
17965
  loadAll,
15905
17966
  dump,
15906
17967
  YAMLException,
@@ -19054,9 +21115,7 @@ function findOpenClawDir(customDir) {
19054
21115
  const home = process.env.HOME || "~";
19055
21116
  const candidates = [
19056
21117
  import_node_path11.default.join(home, ".openclaw"),
19057
- import_node_path11.default.join(home, ".lightclaw"),
19058
- import_node_path11.default.join(process.cwd(), ".openclaw"),
19059
- import_node_path11.default.join(process.cwd(), ".lightclaw")
21118
+ import_node_path11.default.join(home, ".lightclaw")
19060
21119
  ];
19061
21120
  for (const candidate of candidates) {
19062
21121
  if (import_node_fs8.default.existsSync(candidate)) {
@@ -19085,18 +21144,9 @@ function findAllClawDirs(customDir) {
19085
21144
  const home = process.env.HOME || "~";
19086
21145
  const candidates = [
19087
21146
  import_node_path11.default.join(home, ".openclaw"),
19088
- import_node_path11.default.join(home, ".lightclaw"),
19089
- import_node_path11.default.join(process.cwd(), ".openclaw"),
19090
- import_node_path11.default.join(process.cwd(), ".lightclaw")
21147
+ import_node_path11.default.join(home, ".lightclaw")
19091
21148
  ];
19092
- const existing = candidates.filter((c) => import_node_fs8.default.existsSync(c));
19093
- const seen = /* @__PURE__ */ new Set();
19094
- return existing.filter((c) => {
19095
- const real = import_node_fs8.default.realpathSync(c);
19096
- if (seen.has(real)) return false;
19097
- seen.add(real);
19098
- return true;
19099
- });
21149
+ return candidates.filter((c) => import_node_fs8.default.existsSync(c));
19100
21150
  }
19101
21151
  async function promptSelectClawDir(customDir) {
19102
21152
  const dirs = findAllClawDirs(customDir);
@@ -19106,30 +21156,18 @@ async function promptSelectClawDir(customDir) {
19106
21156
  if (dirs.length === 1) {
19107
21157
  return dirs[0];
19108
21158
  }
19109
- console.log();
19110
- console.log(" Detected multiple Claw installations:");
19111
- console.log();
19112
- dirs.forEach((dir, index) => {
19113
- const brand = detectClawBrand(dir);
19114
- console.log(` ${index + 1}) ${brand} ${dir}`);
19115
- });
19116
- console.log();
19117
- const rl = import_node_readline.default.createInterface({
19118
- input: process.stdin,
19119
- output: process.stdout
19120
- });
19121
- return new Promise((resolve) => {
19122
- rl.question(` Please select target (1-${dirs.length}): `, (answer) => {
19123
- rl.close();
19124
- const idx = parseInt(answer.trim(), 10);
19125
- if (idx >= 1 && idx <= dirs.length) {
19126
- resolve(dirs[idx - 1]);
19127
- } else {
19128
- console.log(" Invalid selection, operation cancelled.");
19129
- resolve(null);
19130
- }
21159
+ try {
21160
+ const selected = await dist_default6({
21161
+ message: "Select target Claw installation:",
21162
+ choices: dirs.map((dir) => {
21163
+ const brand = detectClawBrand(dir);
21164
+ return { name: `${brand} ${dir}`, value: dir };
21165
+ })
19131
21166
  });
19132
- });
21167
+ return selected;
21168
+ } catch {
21169
+ return null;
21170
+ }
19133
21171
  }
19134
21172
  function getConfigPath() {
19135
21173
  const home = process.env.HOME || "~";
@@ -19448,30 +21486,19 @@ function commitBackupRecord(record) {
19448
21486
  logger.info(`Backup record saved`, { id: record.id, items: record.items.length, workers: record.installedWorkerIds.length });
19449
21487
  }
19450
21488
  async function promptSelectRole() {
19451
- console.log();
19452
- console.log(" ? Install as:");
19453
- console.log();
19454
- console.log(" 1) \u{1F477} Worker agent (\u5B50Agent\uFF0C\u5B89\u88C5\u5230 workspace-<name>/ \u76EE\u5F55)");
19455
- console.log(" 2) \u{1F451} Main agent (\u4E3BAgent\uFF0C\u5B89\u88C5\u5230 workspace/ \u76EE\u5F55)");
19456
- console.log();
19457
- const rl = import_node_readline.default.createInterface({
19458
- input: process.stdin,
19459
- output: process.stdout
19460
- });
19461
- return new Promise((resolve) => {
19462
- rl.question(" Please select (1-2) [1]: ", (answer) => {
19463
- rl.close();
19464
- const trimmed = answer.trim();
19465
- if (trimmed === "" || trimmed === "1") {
19466
- resolve("worker");
19467
- } else if (trimmed === "2") {
19468
- resolve("main");
19469
- } else {
19470
- console.log(" Invalid selection, operation cancelled.");
19471
- resolve(null);
19472
- }
21489
+ try {
21490
+ const selected = await dist_default6({
21491
+ message: "Install as:",
21492
+ choices: [
21493
+ { name: "\u{1F477} Worker agent (\u5B50Agent\uFF0C\u5B89\u88C5\u5230 workspace-<name>/ \u76EE\u5F55)", value: "worker" },
21494
+ { name: "\u{1F451} Main agent (\u4E3BAgent\uFF0C\u5B89\u88C5\u5230 workspace/ \u76EE\u5F55)", value: "main" }
21495
+ ],
21496
+ default: "worker"
19473
21497
  });
19474
- });
21498
+ return selected;
21499
+ } catch {
21500
+ return null;
21501
+ }
19475
21502
  }
19476
21503
  async function promptMultiSelectClawDirs() {
19477
21504
  const dirs = findAllClawDirs();
@@ -19484,68 +21511,31 @@ async function promptMultiSelectClawDirs() {
19484
21511
  console.log(` \u2714 Detected ${brand}: ${dirs[0]}`);
19485
21512
  return dirs;
19486
21513
  }
19487
- console.log();
19488
- console.log(" ? Select target Claw installations (multiple allowed):");
19489
- console.log();
19490
- dirs.forEach((dir, index) => {
19491
- const brand = detectClawBrand(dir);
19492
- console.log(` ${index + 1}) ${brand} ${dir}`);
19493
- });
19494
- console.log();
19495
- const rl = import_node_readline.default.createInterface({
19496
- input: process.stdin,
19497
- output: process.stdout
19498
- });
19499
- return new Promise((resolve) => {
19500
- const allNums = dirs.map((_2, i) => String(i + 1)).join(",");
19501
- rl.question(` Enter numbers separated by comma (e.g. 1,2) [${allNums}]: `, (answer) => {
19502
- rl.close();
19503
- const trimmed = answer.trim();
19504
- if (trimmed === "") {
19505
- resolve(dirs);
19506
- return;
19507
- }
19508
- const parts = trimmed.split(",").map((s3) => s3.trim());
19509
- const selected = [];
19510
- for (const part of parts) {
19511
- const idx = parseInt(part, 10);
19512
- if (idx >= 1 && idx <= dirs.length) {
19513
- const dir = dirs[idx - 1];
19514
- if (!selected.includes(dir)) {
19515
- selected.push(dir);
19516
- }
19517
- } else {
19518
- console.log(` Invalid selection: ${part}, operation cancelled.`);
19519
- resolve([]);
19520
- return;
19521
- }
19522
- }
19523
- if (selected.length === 0) {
19524
- console.log(" No claw selected, operation cancelled.");
19525
- }
19526
- resolve(selected);
21514
+ try {
21515
+ const selected = await dist_default4({
21516
+ message: "Select target Claw installations (space to toggle, enter to confirm):",
21517
+ choices: dirs.map((dir) => {
21518
+ const brand = detectClawBrand(dir);
21519
+ return { name: `${brand} ${dir}`, value: dir, checked: true };
21520
+ })
19527
21521
  });
19528
- });
21522
+ if (selected.length === 0) {
21523
+ console.log(" No claw selected, operation cancelled.");
21524
+ }
21525
+ return selected;
21526
+ } catch {
21527
+ return [];
21528
+ }
19529
21529
  }
19530
21530
  async function promptConfirm(message, defaultYes = true) {
19531
- const rl = import_node_readline.default.createInterface({
19532
- input: process.stdin,
19533
- output: process.stdout
19534
- });
19535
- const hint = defaultYes ? "Y/n" : "y/N";
19536
- return new Promise((resolve) => {
19537
- rl.question(` ${message} (${hint}) `, (answer) => {
19538
- rl.close();
19539
- const trimmed = answer.trim().toLowerCase();
19540
- if (trimmed === "") {
19541
- resolve(defaultYes);
19542
- } else if (trimmed === "y" || trimmed === "yes") {
19543
- resolve(true);
19544
- } else {
19545
- resolve(false);
19546
- }
21531
+ try {
21532
+ return await dist_default5({
21533
+ message,
21534
+ default: defaultYes
19547
21535
  });
19548
- });
21536
+ } catch {
21537
+ return false;
21538
+ }
19549
21539
  }
19550
21540
  var CATEGORY_LABELS = {
19551
21541
  "self-media": "Self Media",
@@ -20303,7 +22293,7 @@ async function installFromSource(source, targetDir, clawDir, asMain, clawExplici
20303
22293
  const contentType = response.headers.get("content-type") || "";
20304
22294
  logger.debug(`Response content-type: ${contentType}`);
20305
22295
  if (contentType.includes("zip") || source.endsWith(".zip")) {
20306
- const JSZip = (await Promise.resolve().then(() => __toESM(require_lib3(), 1))).default;
22296
+ const JSZip = (await Promise.resolve().then(() => __toESM(require_lib4(), 1))).default;
20307
22297
  const arrayBuffer = await response.arrayBuffer();
20308
22298
  const zip = await JSZip.loadAsync(arrayBuffer);
20309
22299
  tempDir = import_node_path12.default.join(process.env.HOME || "/tmp", ".soulhub", "tmp", `pkg-${Date.now()}`);
@@ -20317,7 +22307,7 @@ async function installFromSource(source, targetDir, clawDir, asMain, clawExplici
20317
22307
  }
20318
22308
  } else if (source.endsWith(".zip")) {
20319
22309
  spinner.text = "Extracting ZIP file...";
20320
- const JSZip = (await Promise.resolve().then(() => __toESM(require_lib3(), 1))).default;
22310
+ const JSZip = (await Promise.resolve().then(() => __toESM(require_lib4(), 1))).default;
20321
22311
  const zipData = import_node_fs9.default.readFileSync(import_node_path12.default.resolve(source));
20322
22312
  const zip = await JSZip.loadAsync(zipData);
20323
22313
  tempDir = import_node_path12.default.join(process.env.HOME || "/tmp", ".soulhub", "tmp", `pkg-${Date.now()}`);
@@ -20896,7 +22886,6 @@ var uninstallCommand = new Command("uninstall").description("Uninstall an agent
20896
22886
  // src/commands/rollback.ts
20897
22887
  var import_node_fs12 = __toESM(require("fs"), 1);
20898
22888
  var import_node_path13 = __toESM(require("path"), 1);
20899
- var import_node_readline2 = __toESM(require("readline"), 1);
20900
22889
  var rollbackCommand = new Command("rollback").description("Rollback to a previous agent installation state").option("--list", "List available rollback records").option("--id <id>", "Rollback to a specific backup record by ID").option("--last <n>", "Rollback the Nth most recent installation (1 = latest, 2 = second latest, etc.)", parseInt).option(
20901
22890
  "--claw-type <type>",
20902
22891
  "Specify claw type: OpenClaw or LightClaw (case-insensitive)"
@@ -20962,43 +22951,35 @@ async function interactiveRollback(clawDir) {
20962
22951
  console.log(source_default.dim(" Backup records are created automatically when you install agents."));
20963
22952
  return;
20964
22953
  }
20965
- console.log(source_default.bold("\n Select a record to rollback:\n"));
22954
+ console.log(source_default.bold("\n Available rollback records:\n"));
20966
22955
  printRecordTable(manifest.records);
20967
22956
  console.log();
20968
- const rl = import_node_readline2.default.createInterface({
20969
- input: process.stdin,
20970
- output: process.stdout
20971
- });
20972
- const selected = await new Promise((resolve) => {
20973
- rl.question(` Enter number to rollback (1-${manifest.records.length}), or 'q' to cancel: `, (answer) => {
20974
- rl.close();
20975
- const trimmed = answer.trim().toLowerCase();
20976
- if (trimmed === "q" || trimmed === "quit" || trimmed === "") {
20977
- resolve(null);
20978
- return;
20979
- }
20980
- const idx = parseInt(trimmed, 10);
20981
- if (idx >= 1 && idx <= manifest.records.length) {
20982
- resolve(idx);
20983
- } else {
20984
- resolve(null);
20985
- }
22957
+ let selected;
22958
+ try {
22959
+ selected = await dist_default6({
22960
+ message: "Select a record to rollback:",
22961
+ choices: manifest.records.map((record, index) => {
22962
+ const date = new Date(record.createdAt).toLocaleString();
22963
+ const clawBrand = detectClawBrandFromDir(record.clawDir);
22964
+ return {
22965
+ name: `#${index + 1} ${record.id} ${record.packageName} (${clawBrand}, ${date})`,
22966
+ value: record
22967
+ };
22968
+ })
20986
22969
  });
20987
- });
20988
- if (selected === null) {
22970
+ } catch {
20989
22971
  console.log(source_default.dim(" Rollback cancelled."));
20990
22972
  return;
20991
22973
  }
20992
- const record = manifest.records[selected - 1];
20993
22974
  console.log();
20994
- console.log(source_default.dim(` Selected: ${source_default.cyan(record.id)} (${record.packageName})`));
20995
- printRollbackDetails(record);
22975
+ console.log(source_default.dim(` Selected: ${source_default.cyan(selected.id)} (${selected.packageName})`));
22976
+ printRollbackDetails(selected);
20996
22977
  const confirmed = await promptConfirmRollback();
20997
22978
  if (!confirmed) {
20998
22979
  console.log(source_default.dim(" Rollback cancelled."));
20999
22980
  return;
21000
22981
  }
21001
- await executeRollback(record, clawDir);
22982
+ await executeRollback(selected, clawDir);
21002
22983
  }
21003
22984
  async function performRollbackByIndex(n, clawDir, skipConfirm = false) {
21004
22985
  const manifest = loadBackupManifest();
@@ -21020,17 +23001,15 @@ async function performRollbackByIndex(n, clawDir, skipConfirm = false) {
21020
23001
  );
21021
23002
  printRollbackDetails(record);
21022
23003
  if (!skipConfirm) {
21023
- const rl2 = import_node_readline2.default.createInterface({
21024
- input: process.stdin,
21025
- output: process.stdout
21026
- });
21027
- const confirmed = await new Promise((resolve) => {
21028
- rl2.question(` ${source_default.yellow("\u26A0")} Proceed with rollback? (Y/n) `, (answer) => {
21029
- rl2.close();
21030
- const trimmed = answer.trim().toLowerCase();
21031
- resolve(trimmed === "" || trimmed === "y" || trimmed === "yes");
23004
+ let confirmed;
23005
+ try {
23006
+ confirmed = await dist_default5({
23007
+ message: `${source_default.yellow("\u26A0")} Proceed with rollback?`,
23008
+ default: true
21032
23009
  });
21033
- });
23010
+ } catch {
23011
+ confirmed = false;
23012
+ }
21034
23013
  if (!confirmed) {
21035
23014
  console.log(source_default.dim(" Rollback cancelled."));
21036
23015
  return;
@@ -21093,21 +23072,14 @@ function printRollbackDetails(record) {
21093
23072
  console.log();
21094
23073
  }
21095
23074
  async function promptConfirmRollback() {
21096
- const rl = import_node_readline2.default.createInterface({
21097
- input: process.stdin,
21098
- output: process.stdout
21099
- });
21100
- return new Promise((resolve) => {
21101
- rl.question(` ${source_default.yellow("\u26A0")} Proceed with rollback? (Y/n) `, (answer) => {
21102
- rl.close();
21103
- const trimmed = answer.trim().toLowerCase();
21104
- if (trimmed === "" || trimmed === "y" || trimmed === "yes") {
21105
- resolve(true);
21106
- } else {
21107
- resolve(false);
21108
- }
23075
+ try {
23076
+ return await dist_default5({
23077
+ message: `${source_default.yellow("\u26A0")} Proceed with rollback?`,
23078
+ default: true
21109
23079
  });
21110
- });
23080
+ } catch {
23081
+ return false;
23082
+ }
21111
23083
  }
21112
23084
  async function executeRollback(record, clawDir) {
21113
23085
  const spinner = createSpinner(
@@ -21234,13 +23206,13 @@ function detectClawBrandFromDir(clawDir) {
21234
23206
 
21235
23207
  // src/index.ts
21236
23208
  var program2 = new Command();
21237
- program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.22").option("--verbose", "Enable verbose debug logging").hook("preAction", () => {
23209
+ program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.23").option("--verbose", "Enable verbose debug logging").hook("preAction", () => {
21238
23210
  const opts = program2.opts();
21239
23211
  const verbose = opts.verbose || process.env.SOULHUB_DEBUG === "1";
21240
23212
  logger.init(verbose);
21241
23213
  logger.info("CLI started", {
21242
23214
  args: process.argv.slice(2),
21243
- version: "1.0.22",
23215
+ version: "1.0.23",
21244
23216
  node: process.version
21245
23217
  });
21246
23218
  });