soulhubcli 1.0.22 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/index.cjs +2185 -429
- 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
|
|
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) =>
|
|
1017
|
-
writeErr: (str2) =>
|
|
1018
|
-
getOutHelpWidth: () =>
|
|
1019
|
-
getErrHelpWidth: () =>
|
|
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
|
-
|
|
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 (
|
|
1796
|
+
if (process5.versions?.electron) {
|
|
1797
1797
|
parseOptions.from = "electron";
|
|
1798
1798
|
}
|
|
1799
|
-
const 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 =
|
|
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 (
|
|
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 (
|
|
1944
|
+
if (process5.platform !== "win32") {
|
|
1945
1945
|
if (launchWithNode) {
|
|
1946
1946
|
args.unshift(executableFile);
|
|
1947
|
-
args = incrementNodeInspectorPort(
|
|
1948
|
-
proc = childProcess.spawn(
|
|
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(
|
|
1955
|
-
proc = childProcess.spawn(
|
|
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
|
|
1959
|
-
|
|
1960
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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()}`,
|
|
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 =
|
|
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
|
|
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
|
|
5425
|
+
var require_lib3 = __commonJS({
|
|
5260
5426
|
"node_modules/lie/lib/index.js"(exports2, module2) {
|
|
5261
5427
|
"use strict";
|
|
5262
|
-
var immediate =
|
|
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 =
|
|
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(
|
|
5714
|
+
(function(global3, undefined2) {
|
|
5549
5715
|
"use strict";
|
|
5550
|
-
if (
|
|
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 =
|
|
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 (
|
|
5785
|
+
if (global3.postMessage && !global3.importScripts) {
|
|
5620
5786
|
var postMessageIsAsynchronous = true;
|
|
5621
|
-
var oldOnMessage =
|
|
5622
|
-
|
|
5787
|
+
var oldOnMessage = global3.onmessage;
|
|
5788
|
+
global3.onmessage = function() {
|
|
5623
5789
|
postMessageIsAsynchronous = false;
|
|
5624
5790
|
};
|
|
5625
|
-
|
|
5626
|
-
|
|
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 ===
|
|
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 (
|
|
5638
|
-
|
|
5803
|
+
if (global3.addEventListener) {
|
|
5804
|
+
global3.addEventListener("message", onGlobalMessage, false);
|
|
5639
5805
|
} else {
|
|
5640
|
-
|
|
5806
|
+
global3.attachEvent("onmessage", onGlobalMessage);
|
|
5641
5807
|
}
|
|
5642
5808
|
registerImmediate = function(handle) {
|
|
5643
|
-
|
|
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(
|
|
5675
|
-
attachTo = attachTo && attachTo.setTimeout ? attachTo :
|
|
5676
|
-
if ({}.toString.call(
|
|
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 (
|
|
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
|
|
12900
|
+
var require_lib4 = __commonJS({
|
|
12735
12901
|
"node_modules/jszip/lib/index.js"(exports2, module2) {
|
|
12736
12902
|
"use strict";
|
|
12737
12903
|
function JSZip() {
|
|
@@ -13284,143 +13450,1847 @@ 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);
|
|
13288
13453
|
|
|
13289
|
-
// node_modules/
|
|
13290
|
-
|
|
13291
|
-
|
|
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 isBackspaceKey = (key) => key.name === "backspace";
|
|
13468
|
+
var isTabKey = (key) => key.name === "tab";
|
|
13469
|
+
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
13470
|
+
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
13471
|
+
|
|
13472
|
+
// node_modules/@inquirer/core/dist/lib/errors.js
|
|
13473
|
+
var AbortPromptError = class extends Error {
|
|
13474
|
+
name = "AbortPromptError";
|
|
13475
|
+
message = "Prompt was aborted";
|
|
13476
|
+
constructor(options) {
|
|
13477
|
+
super();
|
|
13478
|
+
this.cause = options?.cause;
|
|
13479
|
+
}
|
|
13480
|
+
};
|
|
13481
|
+
var CancelPromptError = class extends Error {
|
|
13482
|
+
name = "CancelPromptError";
|
|
13483
|
+
message = "Prompt was canceled";
|
|
13484
|
+
};
|
|
13485
|
+
var ExitPromptError = class extends Error {
|
|
13486
|
+
name = "ExitPromptError";
|
|
13487
|
+
};
|
|
13488
|
+
var HookError = class extends Error {
|
|
13489
|
+
name = "HookError";
|
|
13490
|
+
};
|
|
13491
|
+
var ValidationError = class extends Error {
|
|
13492
|
+
name = "ValidationError";
|
|
13493
|
+
};
|
|
13494
|
+
|
|
13495
|
+
// node_modules/@inquirer/core/dist/lib/use-state.js
|
|
13496
|
+
var import_node_async_hooks2 = require("async_hooks");
|
|
13497
|
+
|
|
13498
|
+
// node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
13499
|
+
var import_node_async_hooks = require("async_hooks");
|
|
13500
|
+
var hookStorage = new import_node_async_hooks.AsyncLocalStorage();
|
|
13501
|
+
function createStore(rl) {
|
|
13502
|
+
const store = {
|
|
13503
|
+
rl,
|
|
13504
|
+
hooks: [],
|
|
13505
|
+
hooksCleanup: [],
|
|
13506
|
+
hooksEffect: [],
|
|
13507
|
+
index: 0,
|
|
13508
|
+
handleChange() {
|
|
13509
|
+
}
|
|
13510
|
+
};
|
|
13511
|
+
return store;
|
|
13292
13512
|
}
|
|
13293
|
-
function
|
|
13294
|
-
|
|
13513
|
+
function withHooks(rl, cb) {
|
|
13514
|
+
const store = createStore(rl);
|
|
13515
|
+
return hookStorage.run(store, () => {
|
|
13516
|
+
function cycle(render) {
|
|
13517
|
+
store.handleChange = () => {
|
|
13518
|
+
store.index = 0;
|
|
13519
|
+
render();
|
|
13520
|
+
};
|
|
13521
|
+
store.handleChange();
|
|
13522
|
+
}
|
|
13523
|
+
return cb(cycle);
|
|
13524
|
+
});
|
|
13295
13525
|
}
|
|
13296
|
-
function
|
|
13297
|
-
|
|
13298
|
-
|
|
13299
|
-
|
|
13526
|
+
function getStore() {
|
|
13527
|
+
const store = hookStorage.getStore();
|
|
13528
|
+
if (!store) {
|
|
13529
|
+
throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
13530
|
+
}
|
|
13531
|
+
return store;
|
|
13300
13532
|
}
|
|
13301
|
-
function
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13533
|
+
function readline() {
|
|
13534
|
+
return getStore().rl;
|
|
13535
|
+
}
|
|
13536
|
+
function withUpdates(fn2) {
|
|
13537
|
+
const wrapped = (...args) => {
|
|
13538
|
+
const store = getStore();
|
|
13539
|
+
let shouldUpdate = false;
|
|
13540
|
+
const oldHandleChange = store.handleChange;
|
|
13541
|
+
store.handleChange = () => {
|
|
13542
|
+
shouldUpdate = true;
|
|
13543
|
+
};
|
|
13544
|
+
const returnValue = fn2(...args);
|
|
13545
|
+
if (shouldUpdate) {
|
|
13546
|
+
oldHandleChange();
|
|
13308
13547
|
}
|
|
13309
|
-
|
|
13310
|
-
|
|
13548
|
+
store.handleChange = oldHandleChange;
|
|
13549
|
+
return returnValue;
|
|
13550
|
+
};
|
|
13551
|
+
return import_node_async_hooks.AsyncResource.bind(wrapped);
|
|
13311
13552
|
}
|
|
13312
|
-
function
|
|
13313
|
-
|
|
13314
|
-
|
|
13315
|
-
|
|
13553
|
+
function withPointer(cb) {
|
|
13554
|
+
const store = getStore();
|
|
13555
|
+
const { index } = store;
|
|
13556
|
+
const pointer = {
|
|
13557
|
+
get() {
|
|
13558
|
+
return store.hooks[index];
|
|
13559
|
+
},
|
|
13560
|
+
set(value) {
|
|
13561
|
+
store.hooks[index] = value;
|
|
13562
|
+
},
|
|
13563
|
+
initialized: index in store.hooks
|
|
13564
|
+
};
|
|
13565
|
+
const returnValue = cb(pointer);
|
|
13566
|
+
store.index++;
|
|
13567
|
+
return returnValue;
|
|
13568
|
+
}
|
|
13569
|
+
function handleChange() {
|
|
13570
|
+
getStore().handleChange();
|
|
13571
|
+
}
|
|
13572
|
+
var effectScheduler = {
|
|
13573
|
+
queue(cb) {
|
|
13574
|
+
const store = getStore();
|
|
13575
|
+
const { index } = store;
|
|
13576
|
+
store.hooksEffect.push(() => {
|
|
13577
|
+
store.hooksCleanup[index]?.();
|
|
13578
|
+
const cleanFn = cb(readline());
|
|
13579
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
13580
|
+
throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
13581
|
+
}
|
|
13582
|
+
store.hooksCleanup[index] = cleanFn;
|
|
13583
|
+
});
|
|
13584
|
+
},
|
|
13585
|
+
run() {
|
|
13586
|
+
const store = getStore();
|
|
13587
|
+
withUpdates(() => {
|
|
13588
|
+
store.hooksEffect.forEach((effect) => {
|
|
13589
|
+
effect();
|
|
13590
|
+
});
|
|
13591
|
+
store.hooksEffect.length = 0;
|
|
13592
|
+
})();
|
|
13593
|
+
},
|
|
13594
|
+
clearAll() {
|
|
13595
|
+
const store = getStore();
|
|
13596
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
13597
|
+
cleanFn?.();
|
|
13598
|
+
});
|
|
13599
|
+
store.hooksEffect.length = 0;
|
|
13600
|
+
store.hooksCleanup.length = 0;
|
|
13316
13601
|
}
|
|
13317
|
-
|
|
13602
|
+
};
|
|
13603
|
+
|
|
13604
|
+
// node_modules/@inquirer/core/dist/lib/use-state.js
|
|
13605
|
+
function useState(defaultValue) {
|
|
13606
|
+
return withPointer((pointer) => {
|
|
13607
|
+
const setState = import_node_async_hooks2.AsyncResource.bind(function setState2(newValue) {
|
|
13608
|
+
if (pointer.get() !== newValue) {
|
|
13609
|
+
pointer.set(newValue);
|
|
13610
|
+
handleChange();
|
|
13611
|
+
}
|
|
13612
|
+
});
|
|
13613
|
+
if (pointer.initialized) {
|
|
13614
|
+
return [pointer.get(), setState];
|
|
13615
|
+
}
|
|
13616
|
+
const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
13617
|
+
pointer.set(value);
|
|
13618
|
+
return [value, setState];
|
|
13619
|
+
});
|
|
13318
13620
|
}
|
|
13319
|
-
|
|
13320
|
-
|
|
13621
|
+
|
|
13622
|
+
// node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
13623
|
+
function useEffect(cb, depArray) {
|
|
13624
|
+
withPointer((pointer) => {
|
|
13625
|
+
const oldDeps = pointer.get();
|
|
13626
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
13627
|
+
if (hasChanged) {
|
|
13628
|
+
effectScheduler.queue(cb);
|
|
13629
|
+
}
|
|
13630
|
+
pointer.set(depArray);
|
|
13631
|
+
});
|
|
13632
|
+
}
|
|
13633
|
+
|
|
13634
|
+
// node_modules/@inquirer/core/dist/lib/theme.js
|
|
13635
|
+
var import_node_util = require("util");
|
|
13636
|
+
|
|
13637
|
+
// node_modules/@inquirer/figures/dist/index.js
|
|
13638
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
13639
|
+
function isUnicodeSupported() {
|
|
13640
|
+
if (import_node_process2.default.platform !== "win32") {
|
|
13641
|
+
return import_node_process2.default.env["TERM"] !== "linux";
|
|
13642
|
+
}
|
|
13643
|
+
return Boolean(import_node_process2.default.env["WT_SESSION"]) || // Windows Terminal
|
|
13644
|
+
Boolean(import_node_process2.default.env["TERMINUS_SUBLIME"]) || // Terminus (<0.2.27)
|
|
13645
|
+
import_node_process2.default.env["ConEmuTask"] === "{cmd::Cmder}" || // ConEmu and cmder
|
|
13646
|
+
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";
|
|
13321
13647
|
}
|
|
13322
|
-
var isNothing_1 = isNothing;
|
|
13323
|
-
var isObject_1 = isObject;
|
|
13324
|
-
var toArray_1 = toArray;
|
|
13325
|
-
var repeat_1 = repeat;
|
|
13326
|
-
var isNegativeZero_1 = isNegativeZero;
|
|
13327
|
-
var extend_1 = extend;
|
|
13328
13648
|
var common = {
|
|
13329
|
-
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
|
|
13333
|
-
|
|
13334
|
-
|
|
13649
|
+
circleQuestionMark: "(?)",
|
|
13650
|
+
questionMarkPrefix: "(?)",
|
|
13651
|
+
square: "\u2588",
|
|
13652
|
+
squareDarkShade: "\u2593",
|
|
13653
|
+
squareMediumShade: "\u2592",
|
|
13654
|
+
squareLightShade: "\u2591",
|
|
13655
|
+
squareTop: "\u2580",
|
|
13656
|
+
squareBottom: "\u2584",
|
|
13657
|
+
squareLeft: "\u258C",
|
|
13658
|
+
squareRight: "\u2590",
|
|
13659
|
+
squareCenter: "\u25A0",
|
|
13660
|
+
bullet: "\u25CF",
|
|
13661
|
+
dot: "\u2024",
|
|
13662
|
+
ellipsis: "\u2026",
|
|
13663
|
+
pointerSmall: "\u203A",
|
|
13664
|
+
triangleUp: "\u25B2",
|
|
13665
|
+
triangleUpSmall: "\u25B4",
|
|
13666
|
+
triangleDown: "\u25BC",
|
|
13667
|
+
triangleDownSmall: "\u25BE",
|
|
13668
|
+
triangleLeftSmall: "\u25C2",
|
|
13669
|
+
triangleRightSmall: "\u25B8",
|
|
13670
|
+
home: "\u2302",
|
|
13671
|
+
heart: "\u2665",
|
|
13672
|
+
musicNote: "\u266A",
|
|
13673
|
+
musicNoteBeamed: "\u266B",
|
|
13674
|
+
arrowUp: "\u2191",
|
|
13675
|
+
arrowDown: "\u2193",
|
|
13676
|
+
arrowLeft: "\u2190",
|
|
13677
|
+
arrowRight: "\u2192",
|
|
13678
|
+
arrowLeftRight: "\u2194",
|
|
13679
|
+
arrowUpDown: "\u2195",
|
|
13680
|
+
almostEqual: "\u2248",
|
|
13681
|
+
notEqual: "\u2260",
|
|
13682
|
+
lessOrEqual: "\u2264",
|
|
13683
|
+
greaterOrEqual: "\u2265",
|
|
13684
|
+
identical: "\u2261",
|
|
13685
|
+
infinity: "\u221E",
|
|
13686
|
+
subscriptZero: "\u2080",
|
|
13687
|
+
subscriptOne: "\u2081",
|
|
13688
|
+
subscriptTwo: "\u2082",
|
|
13689
|
+
subscriptThree: "\u2083",
|
|
13690
|
+
subscriptFour: "\u2084",
|
|
13691
|
+
subscriptFive: "\u2085",
|
|
13692
|
+
subscriptSix: "\u2086",
|
|
13693
|
+
subscriptSeven: "\u2087",
|
|
13694
|
+
subscriptEight: "\u2088",
|
|
13695
|
+
subscriptNine: "\u2089",
|
|
13696
|
+
oneHalf: "\xBD",
|
|
13697
|
+
oneThird: "\u2153",
|
|
13698
|
+
oneQuarter: "\xBC",
|
|
13699
|
+
oneFifth: "\u2155",
|
|
13700
|
+
oneSixth: "\u2159",
|
|
13701
|
+
oneEighth: "\u215B",
|
|
13702
|
+
twoThirds: "\u2154",
|
|
13703
|
+
twoFifths: "\u2156",
|
|
13704
|
+
threeQuarters: "\xBE",
|
|
13705
|
+
threeFifths: "\u2157",
|
|
13706
|
+
threeEighths: "\u215C",
|
|
13707
|
+
fourFifths: "\u2158",
|
|
13708
|
+
fiveSixths: "\u215A",
|
|
13709
|
+
fiveEighths: "\u215D",
|
|
13710
|
+
sevenEighths: "\u215E",
|
|
13711
|
+
line: "\u2500",
|
|
13712
|
+
lineBold: "\u2501",
|
|
13713
|
+
lineDouble: "\u2550",
|
|
13714
|
+
lineDashed0: "\u2504",
|
|
13715
|
+
lineDashed1: "\u2505",
|
|
13716
|
+
lineDashed2: "\u2508",
|
|
13717
|
+
lineDashed3: "\u2509",
|
|
13718
|
+
lineDashed4: "\u254C",
|
|
13719
|
+
lineDashed5: "\u254D",
|
|
13720
|
+
lineDashed6: "\u2574",
|
|
13721
|
+
lineDashed7: "\u2576",
|
|
13722
|
+
lineDashed8: "\u2578",
|
|
13723
|
+
lineDashed9: "\u257A",
|
|
13724
|
+
lineDashed10: "\u257C",
|
|
13725
|
+
lineDashed11: "\u257E",
|
|
13726
|
+
lineDashed12: "\u2212",
|
|
13727
|
+
lineDashed13: "\u2013",
|
|
13728
|
+
lineDashed14: "\u2010",
|
|
13729
|
+
lineDashed15: "\u2043",
|
|
13730
|
+
lineVertical: "\u2502",
|
|
13731
|
+
lineVerticalBold: "\u2503",
|
|
13732
|
+
lineVerticalDouble: "\u2551",
|
|
13733
|
+
lineVerticalDashed0: "\u2506",
|
|
13734
|
+
lineVerticalDashed1: "\u2507",
|
|
13735
|
+
lineVerticalDashed2: "\u250A",
|
|
13736
|
+
lineVerticalDashed3: "\u250B",
|
|
13737
|
+
lineVerticalDashed4: "\u254E",
|
|
13738
|
+
lineVerticalDashed5: "\u254F",
|
|
13739
|
+
lineVerticalDashed6: "\u2575",
|
|
13740
|
+
lineVerticalDashed7: "\u2577",
|
|
13741
|
+
lineVerticalDashed8: "\u2579",
|
|
13742
|
+
lineVerticalDashed9: "\u257B",
|
|
13743
|
+
lineVerticalDashed10: "\u257D",
|
|
13744
|
+
lineVerticalDashed11: "\u257F",
|
|
13745
|
+
lineDownLeft: "\u2510",
|
|
13746
|
+
lineDownLeftArc: "\u256E",
|
|
13747
|
+
lineDownBoldLeftBold: "\u2513",
|
|
13748
|
+
lineDownBoldLeft: "\u2512",
|
|
13749
|
+
lineDownLeftBold: "\u2511",
|
|
13750
|
+
lineDownDoubleLeftDouble: "\u2557",
|
|
13751
|
+
lineDownDoubleLeft: "\u2556",
|
|
13752
|
+
lineDownLeftDouble: "\u2555",
|
|
13753
|
+
lineDownRight: "\u250C",
|
|
13754
|
+
lineDownRightArc: "\u256D",
|
|
13755
|
+
lineDownBoldRightBold: "\u250F",
|
|
13756
|
+
lineDownBoldRight: "\u250E",
|
|
13757
|
+
lineDownRightBold: "\u250D",
|
|
13758
|
+
lineDownDoubleRightDouble: "\u2554",
|
|
13759
|
+
lineDownDoubleRight: "\u2553",
|
|
13760
|
+
lineDownRightDouble: "\u2552",
|
|
13761
|
+
lineUpLeft: "\u2518",
|
|
13762
|
+
lineUpLeftArc: "\u256F",
|
|
13763
|
+
lineUpBoldLeftBold: "\u251B",
|
|
13764
|
+
lineUpBoldLeft: "\u251A",
|
|
13765
|
+
lineUpLeftBold: "\u2519",
|
|
13766
|
+
lineUpDoubleLeftDouble: "\u255D",
|
|
13767
|
+
lineUpDoubleLeft: "\u255C",
|
|
13768
|
+
lineUpLeftDouble: "\u255B",
|
|
13769
|
+
lineUpRight: "\u2514",
|
|
13770
|
+
lineUpRightArc: "\u2570",
|
|
13771
|
+
lineUpBoldRightBold: "\u2517",
|
|
13772
|
+
lineUpBoldRight: "\u2516",
|
|
13773
|
+
lineUpRightBold: "\u2515",
|
|
13774
|
+
lineUpDoubleRightDouble: "\u255A",
|
|
13775
|
+
lineUpDoubleRight: "\u2559",
|
|
13776
|
+
lineUpRightDouble: "\u2558",
|
|
13777
|
+
lineUpDownLeft: "\u2524",
|
|
13778
|
+
lineUpBoldDownBoldLeftBold: "\u252B",
|
|
13779
|
+
lineUpBoldDownBoldLeft: "\u2528",
|
|
13780
|
+
lineUpDownLeftBold: "\u2525",
|
|
13781
|
+
lineUpBoldDownLeftBold: "\u2529",
|
|
13782
|
+
lineUpDownBoldLeftBold: "\u252A",
|
|
13783
|
+
lineUpDownBoldLeft: "\u2527",
|
|
13784
|
+
lineUpBoldDownLeft: "\u2526",
|
|
13785
|
+
lineUpDoubleDownDoubleLeftDouble: "\u2563",
|
|
13786
|
+
lineUpDoubleDownDoubleLeft: "\u2562",
|
|
13787
|
+
lineUpDownLeftDouble: "\u2561",
|
|
13788
|
+
lineUpDownRight: "\u251C",
|
|
13789
|
+
lineUpBoldDownBoldRightBold: "\u2523",
|
|
13790
|
+
lineUpBoldDownBoldRight: "\u2520",
|
|
13791
|
+
lineUpDownRightBold: "\u251D",
|
|
13792
|
+
lineUpBoldDownRightBold: "\u2521",
|
|
13793
|
+
lineUpDownBoldRightBold: "\u2522",
|
|
13794
|
+
lineUpDownBoldRight: "\u251F",
|
|
13795
|
+
lineUpBoldDownRight: "\u251E",
|
|
13796
|
+
lineUpDoubleDownDoubleRightDouble: "\u2560",
|
|
13797
|
+
lineUpDoubleDownDoubleRight: "\u255F",
|
|
13798
|
+
lineUpDownRightDouble: "\u255E",
|
|
13799
|
+
lineDownLeftRight: "\u252C",
|
|
13800
|
+
lineDownBoldLeftBoldRightBold: "\u2533",
|
|
13801
|
+
lineDownLeftBoldRightBold: "\u252F",
|
|
13802
|
+
lineDownBoldLeftRight: "\u2530",
|
|
13803
|
+
lineDownBoldLeftBoldRight: "\u2531",
|
|
13804
|
+
lineDownBoldLeftRightBold: "\u2532",
|
|
13805
|
+
lineDownLeftRightBold: "\u252E",
|
|
13806
|
+
lineDownLeftBoldRight: "\u252D",
|
|
13807
|
+
lineDownDoubleLeftDoubleRightDouble: "\u2566",
|
|
13808
|
+
lineDownDoubleLeftRight: "\u2565",
|
|
13809
|
+
lineDownLeftDoubleRightDouble: "\u2564",
|
|
13810
|
+
lineUpLeftRight: "\u2534",
|
|
13811
|
+
lineUpBoldLeftBoldRightBold: "\u253B",
|
|
13812
|
+
lineUpLeftBoldRightBold: "\u2537",
|
|
13813
|
+
lineUpBoldLeftRight: "\u2538",
|
|
13814
|
+
lineUpBoldLeftBoldRight: "\u2539",
|
|
13815
|
+
lineUpBoldLeftRightBold: "\u253A",
|
|
13816
|
+
lineUpLeftRightBold: "\u2536",
|
|
13817
|
+
lineUpLeftBoldRight: "\u2535",
|
|
13818
|
+
lineUpDoubleLeftDoubleRightDouble: "\u2569",
|
|
13819
|
+
lineUpDoubleLeftRight: "\u2568",
|
|
13820
|
+
lineUpLeftDoubleRightDouble: "\u2567",
|
|
13821
|
+
lineUpDownLeftRight: "\u253C",
|
|
13822
|
+
lineUpBoldDownBoldLeftBoldRightBold: "\u254B",
|
|
13823
|
+
lineUpDownBoldLeftBoldRightBold: "\u2548",
|
|
13824
|
+
lineUpBoldDownLeftBoldRightBold: "\u2547",
|
|
13825
|
+
lineUpBoldDownBoldLeftRightBold: "\u254A",
|
|
13826
|
+
lineUpBoldDownBoldLeftBoldRight: "\u2549",
|
|
13827
|
+
lineUpBoldDownLeftRight: "\u2540",
|
|
13828
|
+
lineUpDownBoldLeftRight: "\u2541",
|
|
13829
|
+
lineUpDownLeftBoldRight: "\u253D",
|
|
13830
|
+
lineUpDownLeftRightBold: "\u253E",
|
|
13831
|
+
lineUpBoldDownBoldLeftRight: "\u2542",
|
|
13832
|
+
lineUpDownLeftBoldRightBold: "\u253F",
|
|
13833
|
+
lineUpBoldDownLeftBoldRight: "\u2543",
|
|
13834
|
+
lineUpBoldDownLeftRightBold: "\u2544",
|
|
13835
|
+
lineUpDownBoldLeftBoldRight: "\u2545",
|
|
13836
|
+
lineUpDownBoldLeftRightBold: "\u2546",
|
|
13837
|
+
lineUpDoubleDownDoubleLeftDoubleRightDouble: "\u256C",
|
|
13838
|
+
lineUpDoubleDownDoubleLeftRight: "\u256B",
|
|
13839
|
+
lineUpDownLeftDoubleRightDouble: "\u256A",
|
|
13840
|
+
lineCross: "\u2573",
|
|
13841
|
+
lineBackslash: "\u2572",
|
|
13842
|
+
lineSlash: "\u2571"
|
|
13335
13843
|
};
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
|
|
13844
|
+
var specialMainSymbols = {
|
|
13845
|
+
tick: "\u2714",
|
|
13846
|
+
info: "\u2139",
|
|
13847
|
+
warning: "\u26A0",
|
|
13848
|
+
cross: "\u2718",
|
|
13849
|
+
squareSmall: "\u25FB",
|
|
13850
|
+
squareSmallFilled: "\u25FC",
|
|
13851
|
+
circle: "\u25EF",
|
|
13852
|
+
circleFilled: "\u25C9",
|
|
13853
|
+
circleDotted: "\u25CC",
|
|
13854
|
+
circleDouble: "\u25CE",
|
|
13855
|
+
circleCircle: "\u24DE",
|
|
13856
|
+
circleCross: "\u24E7",
|
|
13857
|
+
circlePipe: "\u24BE",
|
|
13858
|
+
radioOn: "\u25C9",
|
|
13859
|
+
radioOff: "\u25EF",
|
|
13860
|
+
checkboxOn: "\u2612",
|
|
13861
|
+
checkboxOff: "\u2610",
|
|
13862
|
+
checkboxCircleOn: "\u24E7",
|
|
13863
|
+
checkboxCircleOff: "\u24BE",
|
|
13864
|
+
pointer: "\u276F",
|
|
13865
|
+
triangleUpOutline: "\u25B3",
|
|
13866
|
+
triangleLeft: "\u25C0",
|
|
13867
|
+
triangleRight: "\u25B6",
|
|
13868
|
+
lozenge: "\u25C6",
|
|
13869
|
+
lozengeOutline: "\u25C7",
|
|
13870
|
+
hamburger: "\u2630",
|
|
13871
|
+
smiley: "\u32E1",
|
|
13872
|
+
mustache: "\u0DF4",
|
|
13873
|
+
star: "\u2605",
|
|
13874
|
+
play: "\u25B6",
|
|
13875
|
+
nodejs: "\u2B22",
|
|
13876
|
+
oneSeventh: "\u2150",
|
|
13877
|
+
oneNinth: "\u2151",
|
|
13878
|
+
oneTenth: "\u2152"
|
|
13879
|
+
};
|
|
13880
|
+
var specialFallbackSymbols = {
|
|
13881
|
+
tick: "\u221A",
|
|
13882
|
+
info: "i",
|
|
13883
|
+
warning: "\u203C",
|
|
13884
|
+
cross: "\xD7",
|
|
13885
|
+
squareSmall: "\u25A1",
|
|
13886
|
+
squareSmallFilled: "\u25A0",
|
|
13887
|
+
circle: "( )",
|
|
13888
|
+
circleFilled: "(*)",
|
|
13889
|
+
circleDotted: "( )",
|
|
13890
|
+
circleDouble: "( )",
|
|
13891
|
+
circleCircle: "(\u25CB)",
|
|
13892
|
+
circleCross: "(\xD7)",
|
|
13893
|
+
circlePipe: "(\u2502)",
|
|
13894
|
+
radioOn: "(*)",
|
|
13895
|
+
radioOff: "( )",
|
|
13896
|
+
checkboxOn: "[\xD7]",
|
|
13897
|
+
checkboxOff: "[ ]",
|
|
13898
|
+
checkboxCircleOn: "(\xD7)",
|
|
13899
|
+
checkboxCircleOff: "( )",
|
|
13900
|
+
pointer: ">",
|
|
13901
|
+
triangleUpOutline: "\u2206",
|
|
13902
|
+
triangleLeft: "\u25C4",
|
|
13903
|
+
triangleRight: "\u25BA",
|
|
13904
|
+
lozenge: "\u2666",
|
|
13905
|
+
lozengeOutline: "\u25CA",
|
|
13906
|
+
hamburger: "\u2261",
|
|
13907
|
+
smiley: "\u263A",
|
|
13908
|
+
mustache: "\u250C\u2500\u2510",
|
|
13909
|
+
star: "\u2736",
|
|
13910
|
+
play: "\u25BA",
|
|
13911
|
+
nodejs: "\u2666",
|
|
13912
|
+
oneSeventh: "1/7",
|
|
13913
|
+
oneNinth: "1/9",
|
|
13914
|
+
oneTenth: "1/10"
|
|
13915
|
+
};
|
|
13916
|
+
var mainSymbols = {
|
|
13917
|
+
...common,
|
|
13918
|
+
...specialMainSymbols
|
|
13919
|
+
};
|
|
13920
|
+
var fallbackSymbols = {
|
|
13921
|
+
...common,
|
|
13922
|
+
...specialFallbackSymbols
|
|
13923
|
+
};
|
|
13924
|
+
var shouldUseMain = isUnicodeSupported();
|
|
13925
|
+
var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
13926
|
+
var dist_default = figures;
|
|
13927
|
+
var replacements = Object.entries(specialMainSymbols);
|
|
13928
|
+
|
|
13929
|
+
// node_modules/@inquirer/core/dist/lib/theme.js
|
|
13930
|
+
var defaultTheme = {
|
|
13931
|
+
prefix: {
|
|
13932
|
+
idle: (0, import_node_util.styleText)("blue", "?"),
|
|
13933
|
+
done: (0, import_node_util.styleText)("green", dist_default.tick)
|
|
13934
|
+
},
|
|
13935
|
+
spinner: {
|
|
13936
|
+
interval: 80,
|
|
13937
|
+
frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"].map((frame) => (0, import_node_util.styleText)("yellow", frame))
|
|
13938
|
+
},
|
|
13939
|
+
style: {
|
|
13940
|
+
answer: (text) => (0, import_node_util.styleText)("cyan", text),
|
|
13941
|
+
message: (text) => (0, import_node_util.styleText)("bold", text),
|
|
13942
|
+
error: (text) => (0, import_node_util.styleText)("red", `> ${text}`),
|
|
13943
|
+
defaultAnswer: (text) => (0, import_node_util.styleText)("dim", `(${text})`),
|
|
13944
|
+
help: (text) => (0, import_node_util.styleText)("dim", text),
|
|
13945
|
+
highlight: (text) => (0, import_node_util.styleText)("cyan", text),
|
|
13946
|
+
key: (text) => (0, import_node_util.styleText)("cyan", (0, import_node_util.styleText)("bold", `<${text}>`))
|
|
13341
13947
|
}
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
|
|
13948
|
+
};
|
|
13949
|
+
|
|
13950
|
+
// node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
13951
|
+
function isPlainObject(value) {
|
|
13952
|
+
if (typeof value !== "object" || value === null)
|
|
13953
|
+
return false;
|
|
13954
|
+
let proto2 = value;
|
|
13955
|
+
while (Object.getPrototypeOf(proto2) !== null) {
|
|
13956
|
+
proto2 = Object.getPrototypeOf(proto2);
|
|
13345
13957
|
}
|
|
13346
|
-
return
|
|
13958
|
+
return Object.getPrototypeOf(value) === proto2;
|
|
13347
13959
|
}
|
|
13348
|
-
function
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
Error.captureStackTrace(this, this.constructor);
|
|
13356
|
-
} else {
|
|
13357
|
-
this.stack = new Error().stack || "";
|
|
13960
|
+
function deepMerge(...objects) {
|
|
13961
|
+
const output = {};
|
|
13962
|
+
for (const obj of objects) {
|
|
13963
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
13964
|
+
const prevValue = output[key];
|
|
13965
|
+
output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
|
|
13966
|
+
}
|
|
13358
13967
|
}
|
|
13968
|
+
return output;
|
|
13359
13969
|
}
|
|
13360
|
-
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13970
|
+
function makeTheme(...themes) {
|
|
13971
|
+
const themesToMerge = [
|
|
13972
|
+
defaultTheme,
|
|
13973
|
+
...themes.filter((theme) => theme != null)
|
|
13974
|
+
];
|
|
13975
|
+
return deepMerge(...themesToMerge);
|
|
13976
|
+
}
|
|
13977
|
+
|
|
13978
|
+
// node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
13979
|
+
function usePrefix({ status = "idle", theme }) {
|
|
13980
|
+
const [showLoader, setShowLoader] = useState(false);
|
|
13981
|
+
const [tick, setTick] = useState(0);
|
|
13982
|
+
const { prefix, spinner } = makeTheme(theme);
|
|
13983
|
+
useEffect(() => {
|
|
13984
|
+
if (status === "loading") {
|
|
13985
|
+
let tickInterval;
|
|
13986
|
+
let inc = -1;
|
|
13987
|
+
const delayTimeout = setTimeout(() => {
|
|
13988
|
+
setShowLoader(true);
|
|
13989
|
+
tickInterval = setInterval(() => {
|
|
13990
|
+
inc = inc + 1;
|
|
13991
|
+
setTick(inc % spinner.frames.length);
|
|
13992
|
+
}, spinner.interval);
|
|
13993
|
+
}, 300);
|
|
13994
|
+
return () => {
|
|
13995
|
+
clearTimeout(delayTimeout);
|
|
13996
|
+
clearInterval(tickInterval);
|
|
13997
|
+
};
|
|
13998
|
+
} else {
|
|
13999
|
+
setShowLoader(false);
|
|
14000
|
+
}
|
|
14001
|
+
}, [status]);
|
|
14002
|
+
if (showLoader) {
|
|
14003
|
+
return spinner.frames[tick];
|
|
13377
14004
|
}
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
pos: position - lineStart + head.length
|
|
13381
|
-
// relative position
|
|
13382
|
-
};
|
|
14005
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
14006
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
13383
14007
|
}
|
|
13384
|
-
|
|
13385
|
-
|
|
14008
|
+
|
|
14009
|
+
// node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
14010
|
+
function useMemo(fn2, dependencies) {
|
|
14011
|
+
return withPointer((pointer) => {
|
|
14012
|
+
const prev = pointer.get();
|
|
14013
|
+
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
|
|
14014
|
+
const value = fn2();
|
|
14015
|
+
pointer.set({ value, dependencies });
|
|
14016
|
+
return value;
|
|
14017
|
+
}
|
|
14018
|
+
return prev.value;
|
|
14019
|
+
});
|
|
13386
14020
|
}
|
|
13387
|
-
|
|
13388
|
-
|
|
13389
|
-
|
|
13390
|
-
|
|
13391
|
-
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
14021
|
+
|
|
14022
|
+
// node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
14023
|
+
function useRef(val) {
|
|
14024
|
+
return useState({ current: val })[0];
|
|
14025
|
+
}
|
|
14026
|
+
|
|
14027
|
+
// node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
14028
|
+
function useKeypress(userHandler) {
|
|
14029
|
+
const signal = useRef(userHandler);
|
|
14030
|
+
signal.current = userHandler;
|
|
14031
|
+
useEffect((rl) => {
|
|
14032
|
+
let ignore = false;
|
|
14033
|
+
const handler = withUpdates((_input, event) => {
|
|
14034
|
+
if (ignore)
|
|
14035
|
+
return;
|
|
14036
|
+
void signal.current(event, rl);
|
|
14037
|
+
});
|
|
14038
|
+
rl.input.on("keypress", handler);
|
|
14039
|
+
return () => {
|
|
14040
|
+
ignore = true;
|
|
14041
|
+
rl.input.removeListener("keypress", handler);
|
|
14042
|
+
};
|
|
14043
|
+
}, []);
|
|
14044
|
+
}
|
|
14045
|
+
|
|
14046
|
+
// node_modules/@inquirer/core/dist/lib/utils.js
|
|
14047
|
+
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
14048
|
+
|
|
14049
|
+
// node_modules/fast-string-truncated-width/dist/utils.js
|
|
14050
|
+
var getCodePointsLength = /* @__PURE__ */ (() => {
|
|
14051
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
14052
|
+
return (input) => {
|
|
14053
|
+
let surrogatePairsNr = 0;
|
|
14054
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
14055
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
14056
|
+
surrogatePairsNr += 1;
|
|
14057
|
+
}
|
|
14058
|
+
return input.length - surrogatePairsNr;
|
|
14059
|
+
};
|
|
14060
|
+
})();
|
|
14061
|
+
var isFullWidth = (x) => {
|
|
14062
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
14063
|
+
};
|
|
14064
|
+
var isWideNotCJKTNotEmoji = (x) => {
|
|
14065
|
+
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;
|
|
14066
|
+
};
|
|
14067
|
+
|
|
14068
|
+
// node_modules/fast-string-truncated-width/dist/index.js
|
|
14069
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
14070
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
14071
|
+
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;
|
|
14072
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
14073
|
+
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");
|
|
14074
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
14075
|
+
var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
|
|
14076
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
14077
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
14078
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
14079
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
14080
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
14081
|
+
const ANSI_WIDTH = 0;
|
|
14082
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
14083
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
14084
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
14085
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
14086
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
14087
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
14088
|
+
const PARSE_BLOCKS = [
|
|
14089
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
14090
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
14091
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
14092
|
+
[TAB_RE, TAB_WIDTH],
|
|
14093
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
14094
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
14095
|
+
];
|
|
14096
|
+
let indexPrev = 0;
|
|
14097
|
+
let index = 0;
|
|
14098
|
+
let length = input.length;
|
|
14099
|
+
let lengthExtra = 0;
|
|
14100
|
+
let truncationEnabled = false;
|
|
14101
|
+
let truncationIndex = length;
|
|
14102
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
14103
|
+
let unmatchedStart = 0;
|
|
14104
|
+
let unmatchedEnd = 0;
|
|
14105
|
+
let width = 0;
|
|
14106
|
+
let widthExtra = 0;
|
|
14107
|
+
outer: while (true) {
|
|
14108
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
14109
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
14110
|
+
lengthExtra = 0;
|
|
14111
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
14112
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
14113
|
+
if (isFullWidth(codePoint)) {
|
|
14114
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
14115
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
14116
|
+
widthExtra = WIDE_WIDTH;
|
|
14117
|
+
} else {
|
|
14118
|
+
widthExtra = REGULAR_WIDTH;
|
|
14119
|
+
}
|
|
14120
|
+
if (width + widthExtra > truncationLimit) {
|
|
14121
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
14122
|
+
}
|
|
14123
|
+
if (width + widthExtra > LIMIT) {
|
|
14124
|
+
truncationEnabled = true;
|
|
14125
|
+
break outer;
|
|
14126
|
+
}
|
|
14127
|
+
lengthExtra += char.length;
|
|
14128
|
+
width += widthExtra;
|
|
14129
|
+
}
|
|
14130
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
14131
|
+
}
|
|
14132
|
+
if (index >= length) {
|
|
14133
|
+
break outer;
|
|
14134
|
+
}
|
|
14135
|
+
for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
|
|
14136
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
|
|
14137
|
+
BLOCK_RE.lastIndex = index;
|
|
14138
|
+
if (BLOCK_RE.test(input)) {
|
|
14139
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
14140
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
14141
|
+
if (width + widthExtra > truncationLimit) {
|
|
14142
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
14143
|
+
}
|
|
14144
|
+
if (width + widthExtra > LIMIT) {
|
|
14145
|
+
truncationEnabled = true;
|
|
14146
|
+
break outer;
|
|
14147
|
+
}
|
|
14148
|
+
width += widthExtra;
|
|
14149
|
+
unmatchedStart = indexPrev;
|
|
14150
|
+
unmatchedEnd = index;
|
|
14151
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
14152
|
+
continue outer;
|
|
14153
|
+
}
|
|
13404
14154
|
}
|
|
14155
|
+
index += 1;
|
|
13405
14156
|
}
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
14157
|
+
return {
|
|
14158
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
14159
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
14160
|
+
truncated: truncationEnabled,
|
|
14161
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
14162
|
+
};
|
|
14163
|
+
};
|
|
14164
|
+
var dist_default2 = getStringTruncatedWidth;
|
|
14165
|
+
|
|
14166
|
+
// node_modules/fast-string-width/dist/index.js
|
|
14167
|
+
var NO_TRUNCATION2 = {
|
|
14168
|
+
limit: Infinity,
|
|
14169
|
+
ellipsis: "",
|
|
14170
|
+
ellipsisWidth: 0
|
|
14171
|
+
};
|
|
14172
|
+
var fastStringWidth = (input, options = {}) => {
|
|
14173
|
+
return dist_default2(input, NO_TRUNCATION2, options).width;
|
|
14174
|
+
};
|
|
14175
|
+
var dist_default3 = fastStringWidth;
|
|
14176
|
+
|
|
14177
|
+
// node_modules/fast-wrap-ansi/lib/main.js
|
|
14178
|
+
var ESC = "\x1B";
|
|
14179
|
+
var CSI = "\x9B";
|
|
14180
|
+
var END_CODE = 39;
|
|
14181
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
14182
|
+
var ANSI_CSI = "[";
|
|
14183
|
+
var ANSI_OSC = "]";
|
|
14184
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
14185
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
14186
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
14187
|
+
var getClosingCode = (openingCode) => {
|
|
14188
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
14189
|
+
return 39;
|
|
14190
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
14191
|
+
return 39;
|
|
14192
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
14193
|
+
return 49;
|
|
14194
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
14195
|
+
return 49;
|
|
14196
|
+
if (openingCode === 1 || openingCode === 2)
|
|
14197
|
+
return 22;
|
|
14198
|
+
if (openingCode === 3)
|
|
14199
|
+
return 23;
|
|
14200
|
+
if (openingCode === 4)
|
|
14201
|
+
return 24;
|
|
14202
|
+
if (openingCode === 7)
|
|
14203
|
+
return 27;
|
|
14204
|
+
if (openingCode === 8)
|
|
14205
|
+
return 28;
|
|
14206
|
+
if (openingCode === 9)
|
|
14207
|
+
return 29;
|
|
14208
|
+
if (openingCode === 0)
|
|
14209
|
+
return 0;
|
|
14210
|
+
return void 0;
|
|
14211
|
+
};
|
|
14212
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
14213
|
+
var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
14214
|
+
var wrapWord = (rows, word, columns) => {
|
|
14215
|
+
const characters = word[Symbol.iterator]();
|
|
14216
|
+
let isInsideEscape = false;
|
|
14217
|
+
let isInsideLinkEscape = false;
|
|
14218
|
+
let lastRow = rows.at(-1);
|
|
14219
|
+
let visible = lastRow === void 0 ? 0 : dist_default3(lastRow);
|
|
14220
|
+
let currentCharacter = characters.next();
|
|
14221
|
+
let nextCharacter = characters.next();
|
|
14222
|
+
let rawCharacterIndex = 0;
|
|
14223
|
+
while (!currentCharacter.done) {
|
|
14224
|
+
const character = currentCharacter.value;
|
|
14225
|
+
const characterLength = dist_default3(character);
|
|
14226
|
+
if (visible + characterLength <= columns) {
|
|
14227
|
+
rows[rows.length - 1] += character;
|
|
14228
|
+
} else {
|
|
14229
|
+
rows.push(character);
|
|
14230
|
+
visible = 0;
|
|
14231
|
+
}
|
|
14232
|
+
if (character === ESC || character === CSI) {
|
|
14233
|
+
isInsideEscape = true;
|
|
14234
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
14235
|
+
}
|
|
14236
|
+
if (isInsideEscape) {
|
|
14237
|
+
if (isInsideLinkEscape) {
|
|
14238
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
14239
|
+
isInsideEscape = false;
|
|
14240
|
+
isInsideLinkEscape = false;
|
|
14241
|
+
}
|
|
14242
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
14243
|
+
isInsideEscape = false;
|
|
14244
|
+
}
|
|
14245
|
+
} else {
|
|
14246
|
+
visible += characterLength;
|
|
14247
|
+
if (visible === columns && !nextCharacter.done) {
|
|
14248
|
+
rows.push("");
|
|
14249
|
+
visible = 0;
|
|
14250
|
+
}
|
|
14251
|
+
}
|
|
14252
|
+
currentCharacter = nextCharacter;
|
|
14253
|
+
nextCharacter = characters.next();
|
|
14254
|
+
rawCharacterIndex += character.length;
|
|
14255
|
+
}
|
|
14256
|
+
lastRow = rows.at(-1);
|
|
14257
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
|
|
14258
|
+
rows[rows.length - 2] += rows.pop();
|
|
14259
|
+
}
|
|
14260
|
+
};
|
|
14261
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
14262
|
+
const words = string.split(" ");
|
|
14263
|
+
let last = words.length;
|
|
14264
|
+
while (last) {
|
|
14265
|
+
if (dist_default3(words[last - 1])) {
|
|
14266
|
+
break;
|
|
14267
|
+
}
|
|
14268
|
+
last--;
|
|
14269
|
+
}
|
|
14270
|
+
if (last === words.length) {
|
|
14271
|
+
return string;
|
|
14272
|
+
}
|
|
14273
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
14274
|
+
};
|
|
14275
|
+
var exec = (string, columns, options = {}) => {
|
|
14276
|
+
if (options.trim !== false && string.trim() === "") {
|
|
14277
|
+
return "";
|
|
14278
|
+
}
|
|
14279
|
+
let returnValue = "";
|
|
14280
|
+
let escapeCode;
|
|
14281
|
+
let escapeUrl;
|
|
14282
|
+
const words = string.split(" ");
|
|
14283
|
+
let rows = [""];
|
|
14284
|
+
let rowLength = 0;
|
|
14285
|
+
for (let index = 0; index < words.length; index++) {
|
|
14286
|
+
const word = words[index];
|
|
14287
|
+
if (options.trim !== false) {
|
|
14288
|
+
const row = rows.at(-1) ?? "";
|
|
14289
|
+
const trimmed = row.trimStart();
|
|
14290
|
+
if (row.length !== trimmed.length) {
|
|
14291
|
+
rows[rows.length - 1] = trimmed;
|
|
14292
|
+
rowLength = dist_default3(trimmed);
|
|
14293
|
+
}
|
|
14294
|
+
}
|
|
14295
|
+
if (index !== 0) {
|
|
14296
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
14297
|
+
rows.push("");
|
|
14298
|
+
rowLength = 0;
|
|
14299
|
+
}
|
|
14300
|
+
if (rowLength || options.trim === false) {
|
|
14301
|
+
rows[rows.length - 1] += " ";
|
|
14302
|
+
rowLength++;
|
|
14303
|
+
}
|
|
14304
|
+
}
|
|
14305
|
+
const wordLength = dist_default3(word);
|
|
14306
|
+
if (options.hard && wordLength > columns) {
|
|
14307
|
+
const remainingColumns = columns - rowLength;
|
|
14308
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
14309
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
14310
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
14311
|
+
rows.push("");
|
|
14312
|
+
}
|
|
14313
|
+
wrapWord(rows, word, columns);
|
|
14314
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
14315
|
+
continue;
|
|
14316
|
+
}
|
|
14317
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
14318
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
14319
|
+
wrapWord(rows, word, columns);
|
|
14320
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
14321
|
+
continue;
|
|
14322
|
+
}
|
|
14323
|
+
rows.push("");
|
|
14324
|
+
rowLength = 0;
|
|
14325
|
+
}
|
|
14326
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
14327
|
+
wrapWord(rows, word, columns);
|
|
14328
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
14329
|
+
continue;
|
|
14330
|
+
}
|
|
14331
|
+
rows[rows.length - 1] += word;
|
|
14332
|
+
rowLength += wordLength;
|
|
14333
|
+
}
|
|
14334
|
+
if (options.trim !== false) {
|
|
14335
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
14336
|
+
}
|
|
14337
|
+
const preString = rows.join("\n");
|
|
14338
|
+
let inSurrogate = false;
|
|
14339
|
+
for (let i = 0; i < preString.length; i++) {
|
|
14340
|
+
const character = preString[i];
|
|
14341
|
+
returnValue += character;
|
|
14342
|
+
if (!inSurrogate) {
|
|
14343
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
14344
|
+
if (inSurrogate) {
|
|
14345
|
+
continue;
|
|
14346
|
+
}
|
|
14347
|
+
} else {
|
|
14348
|
+
inSurrogate = false;
|
|
14349
|
+
}
|
|
14350
|
+
if (character === ESC || character === CSI) {
|
|
14351
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
14352
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
14353
|
+
const groups = groupsResult?.groups;
|
|
14354
|
+
if (groups?.code !== void 0) {
|
|
14355
|
+
const code = Number.parseFloat(groups.code);
|
|
14356
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
14357
|
+
} else if (groups?.uri !== void 0) {
|
|
14358
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
14359
|
+
}
|
|
14360
|
+
}
|
|
14361
|
+
if (preString[i + 1] === "\n") {
|
|
14362
|
+
if (escapeUrl) {
|
|
14363
|
+
returnValue += wrapAnsiHyperlink("");
|
|
14364
|
+
}
|
|
14365
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
14366
|
+
if (escapeCode && closingCode) {
|
|
14367
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
14368
|
+
}
|
|
14369
|
+
} else if (character === "\n") {
|
|
14370
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
14371
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
14372
|
+
}
|
|
14373
|
+
if (escapeUrl) {
|
|
14374
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
14375
|
+
}
|
|
14376
|
+
}
|
|
14377
|
+
}
|
|
14378
|
+
return returnValue;
|
|
14379
|
+
};
|
|
14380
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
14381
|
+
function wrapAnsi(string, columns, options) {
|
|
14382
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
14383
|
+
}
|
|
14384
|
+
|
|
14385
|
+
// node_modules/@inquirer/core/dist/lib/utils.js
|
|
14386
|
+
function breakLines(content, width) {
|
|
14387
|
+
return content.split("\n").flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split("\n").map((str2) => str2.trimEnd())).join("\n");
|
|
14388
|
+
}
|
|
14389
|
+
function readlineWidth() {
|
|
14390
|
+
return (0, import_cli_width.default)({ defaultWidth: 80, output: readline().output });
|
|
14391
|
+
}
|
|
14392
|
+
|
|
14393
|
+
// node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
14394
|
+
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
14395
|
+
const state = useRef({
|
|
14396
|
+
lastPointer: active,
|
|
14397
|
+
lastActive: void 0
|
|
14398
|
+
});
|
|
14399
|
+
const { lastPointer, lastActive } = state.current;
|
|
14400
|
+
const middle = Math.floor(pageSize / 2);
|
|
14401
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
14402
|
+
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
|
14403
|
+
let pointer = defaultPointerPosition;
|
|
14404
|
+
if (renderedLength > pageSize) {
|
|
14405
|
+
if (loop) {
|
|
14406
|
+
pointer = lastPointer;
|
|
14407
|
+
if (
|
|
14408
|
+
// First render, skip this logic.
|
|
14409
|
+
lastActive != null && // Only move the pointer down when the user moves down.
|
|
14410
|
+
lastActive < active && // Check user didn't move up across page boundary.
|
|
14411
|
+
active - lastActive < pageSize
|
|
14412
|
+
) {
|
|
14413
|
+
pointer = Math.min(
|
|
14414
|
+
// Furthest allowed position for the pointer is the middle of the list
|
|
14415
|
+
middle,
|
|
14416
|
+
Math.abs(active - lastActive) === 1 ? Math.min(
|
|
14417
|
+
// Move the pointer at most the height of the last active item.
|
|
14418
|
+
lastPointer + (renderedItems[lastActive]?.length ?? 0),
|
|
14419
|
+
// If the user moved by one item, move the pointer to the natural position of the active item as
|
|
14420
|
+
// long as it doesn't move the cursor up.
|
|
14421
|
+
Math.max(defaultPointerPosition, lastPointer)
|
|
14422
|
+
) : (
|
|
14423
|
+
// Otherwise, move the pointer down by the difference between the active and last active item.
|
|
14424
|
+
lastPointer + active - lastActive
|
|
14425
|
+
)
|
|
14426
|
+
);
|
|
14427
|
+
}
|
|
14428
|
+
} else {
|
|
14429
|
+
const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
|
|
14430
|
+
pointer = spaceUnderActive < pageSize - middle ? (
|
|
14431
|
+
// If the active item is near the end of the list, progressively move the cursor towards the end.
|
|
14432
|
+
pageSize - spaceUnderActive
|
|
14433
|
+
) : (
|
|
14434
|
+
// Otherwise, progressively move the pointer to the middle of the list.
|
|
14435
|
+
Math.min(defaultPointerPosition, middle)
|
|
14436
|
+
);
|
|
14437
|
+
}
|
|
14438
|
+
}
|
|
14439
|
+
state.current.lastPointer = pointer;
|
|
14440
|
+
state.current.lastActive = active;
|
|
14441
|
+
return pointer;
|
|
14442
|
+
}
|
|
14443
|
+
function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
14444
|
+
const width = readlineWidth();
|
|
14445
|
+
const bound = (num) => (num % items.length + items.length) % items.length;
|
|
14446
|
+
const renderedItems = items.map((item, index) => {
|
|
14447
|
+
if (item == null)
|
|
14448
|
+
return [];
|
|
14449
|
+
return breakLines(renderItem({ item, index, isActive: index === active }), width).split("\n");
|
|
14450
|
+
});
|
|
14451
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
14452
|
+
const renderItemAtIndex = (index) => renderedItems[index] ?? [];
|
|
14453
|
+
const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
|
|
14454
|
+
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
|
14455
|
+
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
|
14456
|
+
const pageBuffer = Array.from({ length: pageSize });
|
|
14457
|
+
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
|
14458
|
+
const itemVisited = /* @__PURE__ */ new Set([active]);
|
|
14459
|
+
let bufferPointer = activeItemPosition + activeItem.length;
|
|
14460
|
+
let itemPointer = bound(active + 1);
|
|
14461
|
+
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
|
14462
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
14463
|
+
const linesToAdd = lines.slice(0, pageSize - bufferPointer);
|
|
14464
|
+
pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
|
|
14465
|
+
itemVisited.add(itemPointer);
|
|
14466
|
+
bufferPointer += linesToAdd.length;
|
|
14467
|
+
itemPointer = bound(itemPointer + 1);
|
|
14468
|
+
}
|
|
14469
|
+
bufferPointer = activeItemPosition - 1;
|
|
14470
|
+
itemPointer = bound(active - 1);
|
|
14471
|
+
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
|
14472
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
14473
|
+
const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
|
|
14474
|
+
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
|
14475
|
+
itemVisited.add(itemPointer);
|
|
14476
|
+
bufferPointer -= linesToAdd.length;
|
|
14477
|
+
itemPointer = bound(itemPointer - 1);
|
|
14478
|
+
}
|
|
14479
|
+
return pageBuffer.filter((line) => typeof line === "string").join("\n");
|
|
14480
|
+
}
|
|
14481
|
+
|
|
14482
|
+
// node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
14483
|
+
var readline2 = __toESM(require("readline"), 1);
|
|
14484
|
+
var import_node_async_hooks3 = require("async_hooks");
|
|
14485
|
+
var import_mute_stream = __toESM(require_lib(), 1);
|
|
14486
|
+
|
|
14487
|
+
// node_modules/signal-exit/dist/mjs/signals.js
|
|
14488
|
+
var signals = [];
|
|
14489
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
14490
|
+
if (process.platform !== "win32") {
|
|
14491
|
+
signals.push(
|
|
14492
|
+
"SIGALRM",
|
|
14493
|
+
"SIGABRT",
|
|
14494
|
+
"SIGVTALRM",
|
|
14495
|
+
"SIGXCPU",
|
|
14496
|
+
"SIGXFSZ",
|
|
14497
|
+
"SIGUSR2",
|
|
14498
|
+
"SIGTRAP",
|
|
14499
|
+
"SIGSYS",
|
|
14500
|
+
"SIGQUIT",
|
|
14501
|
+
"SIGIOT"
|
|
14502
|
+
// should detect profiler and enable/disable accordingly.
|
|
14503
|
+
// see #21
|
|
14504
|
+
// 'SIGPROF'
|
|
14505
|
+
);
|
|
14506
|
+
}
|
|
14507
|
+
if (process.platform === "linux") {
|
|
14508
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
14509
|
+
}
|
|
14510
|
+
|
|
14511
|
+
// node_modules/signal-exit/dist/mjs/index.js
|
|
14512
|
+
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";
|
|
14513
|
+
var kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
|
|
14514
|
+
var global2 = globalThis;
|
|
14515
|
+
var ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
14516
|
+
var Emitter = class {
|
|
14517
|
+
emitted = {
|
|
14518
|
+
afterExit: false,
|
|
14519
|
+
exit: false
|
|
14520
|
+
};
|
|
14521
|
+
listeners = {
|
|
14522
|
+
afterExit: [],
|
|
14523
|
+
exit: []
|
|
14524
|
+
};
|
|
14525
|
+
count = 0;
|
|
14526
|
+
id = Math.random();
|
|
14527
|
+
constructor() {
|
|
14528
|
+
if (global2[kExitEmitter]) {
|
|
14529
|
+
return global2[kExitEmitter];
|
|
14530
|
+
}
|
|
14531
|
+
ObjectDefineProperty(global2, kExitEmitter, {
|
|
14532
|
+
value: this,
|
|
14533
|
+
writable: false,
|
|
14534
|
+
enumerable: false,
|
|
14535
|
+
configurable: false
|
|
14536
|
+
});
|
|
14537
|
+
}
|
|
14538
|
+
on(ev, fn2) {
|
|
14539
|
+
this.listeners[ev].push(fn2);
|
|
14540
|
+
}
|
|
14541
|
+
removeListener(ev, fn2) {
|
|
14542
|
+
const list = this.listeners[ev];
|
|
14543
|
+
const i = list.indexOf(fn2);
|
|
14544
|
+
if (i === -1) {
|
|
14545
|
+
return;
|
|
14546
|
+
}
|
|
14547
|
+
if (i === 0 && list.length === 1) {
|
|
14548
|
+
list.length = 0;
|
|
14549
|
+
} else {
|
|
14550
|
+
list.splice(i, 1);
|
|
14551
|
+
}
|
|
14552
|
+
}
|
|
14553
|
+
emit(ev, code, signal) {
|
|
14554
|
+
if (this.emitted[ev]) {
|
|
14555
|
+
return false;
|
|
14556
|
+
}
|
|
14557
|
+
this.emitted[ev] = true;
|
|
14558
|
+
let ret = false;
|
|
14559
|
+
for (const fn2 of this.listeners[ev]) {
|
|
14560
|
+
ret = fn2(code, signal) === true || ret;
|
|
14561
|
+
}
|
|
14562
|
+
if (ev === "exit") {
|
|
14563
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
14564
|
+
}
|
|
14565
|
+
return ret;
|
|
14566
|
+
}
|
|
14567
|
+
};
|
|
14568
|
+
var SignalExitBase = class {
|
|
14569
|
+
};
|
|
14570
|
+
var signalExitWrap = (handler) => {
|
|
14571
|
+
return {
|
|
14572
|
+
onExit(cb, opts) {
|
|
14573
|
+
return handler.onExit(cb, opts);
|
|
14574
|
+
},
|
|
14575
|
+
load() {
|
|
14576
|
+
return handler.load();
|
|
14577
|
+
},
|
|
14578
|
+
unload() {
|
|
14579
|
+
return handler.unload();
|
|
14580
|
+
}
|
|
14581
|
+
};
|
|
14582
|
+
};
|
|
14583
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
14584
|
+
onExit() {
|
|
14585
|
+
return () => {
|
|
14586
|
+
};
|
|
14587
|
+
}
|
|
14588
|
+
load() {
|
|
14589
|
+
}
|
|
14590
|
+
unload() {
|
|
14591
|
+
}
|
|
14592
|
+
};
|
|
14593
|
+
var SignalExit = class extends SignalExitBase {
|
|
14594
|
+
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
14595
|
+
// so use a supported signal instead
|
|
14596
|
+
/* c8 ignore start */
|
|
14597
|
+
#hupSig = process4.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
14598
|
+
/* c8 ignore stop */
|
|
14599
|
+
#emitter = new Emitter();
|
|
14600
|
+
#process;
|
|
14601
|
+
#originalProcessEmit;
|
|
14602
|
+
#originalProcessReallyExit;
|
|
14603
|
+
#sigListeners = {};
|
|
14604
|
+
#loaded = false;
|
|
14605
|
+
constructor(process5) {
|
|
14606
|
+
super();
|
|
14607
|
+
this.#process = process5;
|
|
14608
|
+
this.#sigListeners = {};
|
|
14609
|
+
for (const sig of signals) {
|
|
14610
|
+
this.#sigListeners[sig] = () => {
|
|
14611
|
+
const listeners = this.#process.listeners(sig);
|
|
14612
|
+
let { count } = this.#emitter;
|
|
14613
|
+
const p2 = process5;
|
|
14614
|
+
if (typeof p2.__signal_exit_emitter__ === "object" && typeof p2.__signal_exit_emitter__.count === "number") {
|
|
14615
|
+
count += p2.__signal_exit_emitter__.count;
|
|
14616
|
+
}
|
|
14617
|
+
if (listeners.length === count) {
|
|
14618
|
+
this.unload();
|
|
14619
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
14620
|
+
const s3 = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
14621
|
+
if (!ret)
|
|
14622
|
+
process5.kill(process5.pid, s3);
|
|
14623
|
+
}
|
|
14624
|
+
};
|
|
14625
|
+
}
|
|
14626
|
+
this.#originalProcessReallyExit = process5.reallyExit;
|
|
14627
|
+
this.#originalProcessEmit = process5.emit;
|
|
14628
|
+
}
|
|
14629
|
+
onExit(cb, opts) {
|
|
14630
|
+
if (!processOk(this.#process)) {
|
|
14631
|
+
return () => {
|
|
14632
|
+
};
|
|
14633
|
+
}
|
|
14634
|
+
if (this.#loaded === false) {
|
|
14635
|
+
this.load();
|
|
14636
|
+
}
|
|
14637
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
14638
|
+
this.#emitter.on(ev, cb);
|
|
14639
|
+
return () => {
|
|
14640
|
+
this.#emitter.removeListener(ev, cb);
|
|
14641
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
14642
|
+
this.unload();
|
|
14643
|
+
}
|
|
14644
|
+
};
|
|
14645
|
+
}
|
|
14646
|
+
load() {
|
|
14647
|
+
if (this.#loaded) {
|
|
14648
|
+
return;
|
|
14649
|
+
}
|
|
14650
|
+
this.#loaded = true;
|
|
14651
|
+
this.#emitter.count += 1;
|
|
14652
|
+
for (const sig of signals) {
|
|
14653
|
+
try {
|
|
14654
|
+
const fn2 = this.#sigListeners[sig];
|
|
14655
|
+
if (fn2)
|
|
14656
|
+
this.#process.on(sig, fn2);
|
|
14657
|
+
} catch (_2) {
|
|
14658
|
+
}
|
|
14659
|
+
}
|
|
14660
|
+
this.#process.emit = (ev, ...a) => {
|
|
14661
|
+
return this.#processEmit(ev, ...a);
|
|
14662
|
+
};
|
|
14663
|
+
this.#process.reallyExit = (code) => {
|
|
14664
|
+
return this.#processReallyExit(code);
|
|
14665
|
+
};
|
|
14666
|
+
}
|
|
14667
|
+
unload() {
|
|
14668
|
+
if (!this.#loaded) {
|
|
14669
|
+
return;
|
|
14670
|
+
}
|
|
14671
|
+
this.#loaded = false;
|
|
14672
|
+
signals.forEach((sig) => {
|
|
14673
|
+
const listener = this.#sigListeners[sig];
|
|
14674
|
+
if (!listener) {
|
|
14675
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
14676
|
+
}
|
|
14677
|
+
try {
|
|
14678
|
+
this.#process.removeListener(sig, listener);
|
|
14679
|
+
} catch (_2) {
|
|
14680
|
+
}
|
|
14681
|
+
});
|
|
14682
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
14683
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
14684
|
+
this.#emitter.count -= 1;
|
|
14685
|
+
}
|
|
14686
|
+
#processReallyExit(code) {
|
|
14687
|
+
if (!processOk(this.#process)) {
|
|
14688
|
+
return 0;
|
|
14689
|
+
}
|
|
14690
|
+
this.#process.exitCode = code || 0;
|
|
14691
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
14692
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
14693
|
+
}
|
|
14694
|
+
#processEmit(ev, ...args) {
|
|
14695
|
+
const og = this.#originalProcessEmit;
|
|
14696
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
14697
|
+
if (typeof args[0] === "number") {
|
|
14698
|
+
this.#process.exitCode = args[0];
|
|
14699
|
+
}
|
|
14700
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
14701
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
14702
|
+
return ret;
|
|
14703
|
+
} else {
|
|
14704
|
+
return og.call(this.#process, ev, ...args);
|
|
14705
|
+
}
|
|
14706
|
+
}
|
|
14707
|
+
};
|
|
14708
|
+
var process4 = globalThis.process;
|
|
14709
|
+
var {
|
|
14710
|
+
/**
|
|
14711
|
+
* Called when the process is exiting, whether via signal, explicit
|
|
14712
|
+
* exit, or running out of stuff to do.
|
|
14713
|
+
*
|
|
14714
|
+
* If the global process object is not suitable for instrumentation,
|
|
14715
|
+
* then this will be a no-op.
|
|
14716
|
+
*
|
|
14717
|
+
* Returns a function that may be used to unload signal-exit.
|
|
14718
|
+
*/
|
|
14719
|
+
onExit,
|
|
14720
|
+
/**
|
|
14721
|
+
* Load the listeners. Likely you never need to call this, unless
|
|
14722
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
14723
|
+
* Mostly exposed for the benefit of testing.
|
|
14724
|
+
*
|
|
14725
|
+
* @internal
|
|
14726
|
+
*/
|
|
14727
|
+
load,
|
|
14728
|
+
/**
|
|
14729
|
+
* Unload the listeners. Likely you never need to call this, unless
|
|
14730
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
14731
|
+
* Mostly exposed for the benefit of testing.
|
|
14732
|
+
*
|
|
14733
|
+
* @internal
|
|
14734
|
+
*/
|
|
14735
|
+
unload
|
|
14736
|
+
} = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback());
|
|
14737
|
+
|
|
14738
|
+
// node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
14739
|
+
var import_node_util2 = require("util");
|
|
14740
|
+
|
|
14741
|
+
// node_modules/@inquirer/ansi/dist/index.js
|
|
14742
|
+
var ESC2 = "\x1B[";
|
|
14743
|
+
var cursorLeft = ESC2 + "G";
|
|
14744
|
+
var cursorHide = ESC2 + "?25l";
|
|
14745
|
+
var cursorShow = ESC2 + "?25h";
|
|
14746
|
+
var cursorUp = (rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "";
|
|
14747
|
+
var cursorDown = (rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "";
|
|
14748
|
+
var cursorTo = (x, y2) => {
|
|
14749
|
+
if (typeof y2 === "number" && !Number.isNaN(y2)) {
|
|
14750
|
+
return `${ESC2}${y2 + 1};${x + 1}H`;
|
|
14751
|
+
}
|
|
14752
|
+
return `${ESC2}${x + 1}G`;
|
|
14753
|
+
};
|
|
14754
|
+
var eraseLine = ESC2 + "2K";
|
|
14755
|
+
var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
14756
|
+
|
|
14757
|
+
// node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
14758
|
+
var height = (content) => content.split("\n").length;
|
|
14759
|
+
var lastLine = (content) => content.split("\n").pop() ?? "";
|
|
14760
|
+
var ScreenManager = class {
|
|
14761
|
+
// These variables are keeping information to allow correct prompt re-rendering
|
|
14762
|
+
height = 0;
|
|
14763
|
+
extraLinesUnderPrompt = 0;
|
|
14764
|
+
cursorPos;
|
|
14765
|
+
rl;
|
|
14766
|
+
constructor(rl) {
|
|
14767
|
+
this.rl = rl;
|
|
14768
|
+
this.cursorPos = rl.getCursorPos();
|
|
14769
|
+
}
|
|
14770
|
+
write(content) {
|
|
14771
|
+
this.rl.output.unmute();
|
|
14772
|
+
this.rl.output.write(content);
|
|
14773
|
+
this.rl.output.mute();
|
|
14774
|
+
}
|
|
14775
|
+
render(content, bottomContent = "") {
|
|
14776
|
+
const promptLine = lastLine(content);
|
|
14777
|
+
const rawPromptLine = (0, import_node_util2.stripVTControlCharacters)(promptLine);
|
|
14778
|
+
let prompt = rawPromptLine;
|
|
14779
|
+
if (this.rl.line.length > 0) {
|
|
14780
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
14781
|
+
}
|
|
14782
|
+
this.rl.setPrompt(prompt);
|
|
14783
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
14784
|
+
const width = readlineWidth();
|
|
14785
|
+
content = breakLines(content, width);
|
|
14786
|
+
bottomContent = breakLines(bottomContent, width);
|
|
14787
|
+
if (rawPromptLine.length % width === 0) {
|
|
14788
|
+
content += "\n";
|
|
14789
|
+
}
|
|
14790
|
+
let output = content + (bottomContent ? "\n" + bottomContent : "");
|
|
14791
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
14792
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
|
|
14793
|
+
if (bottomContentHeight > 0)
|
|
14794
|
+
output += cursorUp(bottomContentHeight);
|
|
14795
|
+
output += cursorTo(this.cursorPos.cols);
|
|
14796
|
+
this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
|
|
14797
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
14798
|
+
this.height = height(output);
|
|
14799
|
+
}
|
|
14800
|
+
checkCursorPos() {
|
|
14801
|
+
const cursorPos = this.rl.getCursorPos();
|
|
14802
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
14803
|
+
this.write(cursorTo(cursorPos.cols));
|
|
14804
|
+
this.cursorPos = cursorPos;
|
|
14805
|
+
}
|
|
14806
|
+
}
|
|
14807
|
+
done({ clearContent }) {
|
|
14808
|
+
this.rl.setPrompt("");
|
|
14809
|
+
let output = cursorDown(this.extraLinesUnderPrompt);
|
|
14810
|
+
output += clearContent ? eraseLines(this.height) : "\n";
|
|
14811
|
+
output += cursorShow;
|
|
14812
|
+
this.write(output);
|
|
14813
|
+
this.rl.close();
|
|
14814
|
+
}
|
|
14815
|
+
};
|
|
14816
|
+
|
|
14817
|
+
// node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
14818
|
+
var PromisePolyfill = class extends Promise {
|
|
14819
|
+
// Available starting from Node 22
|
|
14820
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
|
|
14821
|
+
static withResolver() {
|
|
14822
|
+
let resolve;
|
|
14823
|
+
let reject;
|
|
14824
|
+
const promise = new Promise((res, rej) => {
|
|
14825
|
+
resolve = res;
|
|
14826
|
+
reject = rej;
|
|
14827
|
+
});
|
|
14828
|
+
return { promise, resolve, reject };
|
|
14829
|
+
}
|
|
14830
|
+
};
|
|
14831
|
+
|
|
14832
|
+
// node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
14833
|
+
var nativeSetImmediate = globalThis.setImmediate;
|
|
14834
|
+
function getCallSites() {
|
|
14835
|
+
const _prepareStackTrace = Error.prepareStackTrace;
|
|
14836
|
+
let result = [];
|
|
14837
|
+
try {
|
|
14838
|
+
Error.prepareStackTrace = (_2, callSites) => {
|
|
14839
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
14840
|
+
result = callSitesWithoutCurrent;
|
|
14841
|
+
return callSitesWithoutCurrent;
|
|
14842
|
+
};
|
|
14843
|
+
new Error().stack;
|
|
14844
|
+
} catch {
|
|
14845
|
+
return result;
|
|
14846
|
+
}
|
|
14847
|
+
Error.prepareStackTrace = _prepareStackTrace;
|
|
14848
|
+
return result;
|
|
14849
|
+
}
|
|
14850
|
+
function createPrompt(view) {
|
|
14851
|
+
const callSites = getCallSites();
|
|
14852
|
+
const prompt = (config, context = {}) => {
|
|
14853
|
+
const { input = process.stdin, signal } = context;
|
|
14854
|
+
const cleanups = /* @__PURE__ */ new Set();
|
|
14855
|
+
const output = new import_mute_stream.default();
|
|
14856
|
+
output.pipe(context.output ?? process.stdout);
|
|
14857
|
+
output.mute();
|
|
14858
|
+
const rl = readline2.createInterface({
|
|
14859
|
+
terminal: true,
|
|
14860
|
+
input,
|
|
14861
|
+
output
|
|
14862
|
+
});
|
|
14863
|
+
const screen = new ScreenManager(rl);
|
|
14864
|
+
const { promise, resolve, reject } = PromisePolyfill.withResolver();
|
|
14865
|
+
const cancel = () => reject(new CancelPromptError());
|
|
14866
|
+
if (signal) {
|
|
14867
|
+
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
14868
|
+
if (signal.aborted) {
|
|
14869
|
+
abort();
|
|
14870
|
+
return Object.assign(promise, { cancel });
|
|
14871
|
+
}
|
|
14872
|
+
signal.addEventListener("abort", abort);
|
|
14873
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
14874
|
+
}
|
|
14875
|
+
cleanups.add(onExit((code, signal2) => {
|
|
14876
|
+
reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
|
|
14877
|
+
}));
|
|
14878
|
+
const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
|
|
14879
|
+
rl.on("SIGINT", sigint);
|
|
14880
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
14881
|
+
return withHooks(rl, (cycle) => {
|
|
14882
|
+
const hooksCleanup = import_node_async_hooks3.AsyncResource.bind(() => effectScheduler.clearAll());
|
|
14883
|
+
rl.on("close", hooksCleanup);
|
|
14884
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
14885
|
+
const startCycle = () => {
|
|
14886
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
14887
|
+
rl.input.on("keypress", checkCursorPos);
|
|
14888
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
14889
|
+
cycle(() => {
|
|
14890
|
+
try {
|
|
14891
|
+
const nextView = view(config, (value) => {
|
|
14892
|
+
setImmediate(() => resolve(value));
|
|
14893
|
+
});
|
|
14894
|
+
if (nextView === void 0) {
|
|
14895
|
+
const callerFilename = callSites[1]?.getFileName();
|
|
14896
|
+
throw new Error(`Prompt functions must return a string.
|
|
14897
|
+
at ${callerFilename}`);
|
|
14898
|
+
}
|
|
14899
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
14900
|
+
screen.render(content, bottomContent);
|
|
14901
|
+
effectScheduler.run();
|
|
14902
|
+
} catch (error) {
|
|
14903
|
+
reject(error);
|
|
14904
|
+
}
|
|
14905
|
+
});
|
|
14906
|
+
};
|
|
14907
|
+
if ("readableFlowing" in input) {
|
|
14908
|
+
nativeSetImmediate(startCycle);
|
|
14909
|
+
} else {
|
|
14910
|
+
startCycle();
|
|
14911
|
+
}
|
|
14912
|
+
return Object.assign(promise.then((answer) => {
|
|
14913
|
+
effectScheduler.clearAll();
|
|
14914
|
+
return answer;
|
|
14915
|
+
}, (error) => {
|
|
14916
|
+
effectScheduler.clearAll();
|
|
14917
|
+
throw error;
|
|
14918
|
+
}).finally(() => {
|
|
14919
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
14920
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
14921
|
+
output.end();
|
|
14922
|
+
}).then(() => promise), { cancel });
|
|
14923
|
+
});
|
|
14924
|
+
};
|
|
14925
|
+
return prompt;
|
|
14926
|
+
}
|
|
14927
|
+
|
|
14928
|
+
// node_modules/@inquirer/core/dist/lib/Separator.js
|
|
14929
|
+
var import_node_util3 = require("util");
|
|
14930
|
+
var Separator = class {
|
|
14931
|
+
separator = (0, import_node_util3.styleText)("dim", Array.from({ length: 15 }).join(dist_default.line));
|
|
14932
|
+
type = "separator";
|
|
14933
|
+
constructor(separator) {
|
|
14934
|
+
if (separator) {
|
|
14935
|
+
this.separator = separator;
|
|
14936
|
+
}
|
|
14937
|
+
}
|
|
14938
|
+
static isSeparator(choice) {
|
|
14939
|
+
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
14940
|
+
}
|
|
14941
|
+
};
|
|
14942
|
+
|
|
14943
|
+
// node_modules/@inquirer/confirm/dist/index.js
|
|
14944
|
+
function getBooleanValue(value, defaultValue) {
|
|
14945
|
+
let answer = defaultValue !== false;
|
|
14946
|
+
if (/^(y|yes)/i.test(value))
|
|
14947
|
+
answer = true;
|
|
14948
|
+
else if (/^(n|no)/i.test(value))
|
|
14949
|
+
answer = false;
|
|
14950
|
+
return answer;
|
|
14951
|
+
}
|
|
14952
|
+
function boolToString(value) {
|
|
14953
|
+
return value ? "Yes" : "No";
|
|
14954
|
+
}
|
|
14955
|
+
var dist_default4 = createPrompt((config, done) => {
|
|
14956
|
+
const { transformer = boolToString } = config;
|
|
14957
|
+
const [status, setStatus] = useState("idle");
|
|
14958
|
+
const [value, setValue] = useState("");
|
|
14959
|
+
const theme = makeTheme(config.theme);
|
|
14960
|
+
const prefix = usePrefix({ status, theme });
|
|
14961
|
+
useKeypress((key, rl) => {
|
|
14962
|
+
if (status !== "idle")
|
|
14963
|
+
return;
|
|
14964
|
+
if (isEnterKey(key)) {
|
|
14965
|
+
const answer = getBooleanValue(value, config.default);
|
|
14966
|
+
setValue(transformer(answer));
|
|
14967
|
+
setStatus("done");
|
|
14968
|
+
done(answer);
|
|
14969
|
+
} else if (isTabKey(key)) {
|
|
14970
|
+
const answer = boolToString(!getBooleanValue(value, config.default));
|
|
14971
|
+
rl.clearLine(0);
|
|
14972
|
+
rl.write(answer);
|
|
14973
|
+
setValue(answer);
|
|
14974
|
+
} else {
|
|
14975
|
+
setValue(rl.line);
|
|
14976
|
+
}
|
|
14977
|
+
});
|
|
14978
|
+
let formattedValue = value;
|
|
14979
|
+
let defaultValue = "";
|
|
14980
|
+
if (status === "done") {
|
|
14981
|
+
formattedValue = theme.style.answer(value);
|
|
14982
|
+
} else {
|
|
14983
|
+
defaultValue = ` ${theme.style.defaultAnswer(config.default === false ? "y/N" : "Y/n")}`;
|
|
14984
|
+
}
|
|
14985
|
+
const message = theme.style.message(config.message, status);
|
|
14986
|
+
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
14987
|
+
});
|
|
14988
|
+
|
|
14989
|
+
// node_modules/@inquirer/select/dist/index.js
|
|
14990
|
+
var import_node_util4 = require("util");
|
|
14991
|
+
var selectTheme = {
|
|
14992
|
+
icon: { cursor: dist_default.pointer },
|
|
14993
|
+
style: {
|
|
14994
|
+
disabled: (text) => (0, import_node_util4.styleText)("dim", text),
|
|
14995
|
+
description: (text) => (0, import_node_util4.styleText)("cyan", text),
|
|
14996
|
+
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 "))
|
|
14997
|
+
},
|
|
14998
|
+
i18n: { disabledError: "This option is disabled and cannot be selected." },
|
|
14999
|
+
indexMode: "hidden",
|
|
15000
|
+
keybindings: []
|
|
15001
|
+
};
|
|
15002
|
+
function isSelectable(item) {
|
|
15003
|
+
return !Separator.isSeparator(item) && !item.disabled;
|
|
15004
|
+
}
|
|
15005
|
+
function isNavigable(item) {
|
|
15006
|
+
return !Separator.isSeparator(item);
|
|
15007
|
+
}
|
|
15008
|
+
function normalizeChoices(choices) {
|
|
15009
|
+
return choices.map((choice) => {
|
|
15010
|
+
if (Separator.isSeparator(choice))
|
|
15011
|
+
return choice;
|
|
15012
|
+
if (typeof choice !== "object" || choice === null || !("value" in choice)) {
|
|
15013
|
+
const name2 = String(choice);
|
|
15014
|
+
return {
|
|
15015
|
+
value: choice,
|
|
15016
|
+
name: name2,
|
|
15017
|
+
short: name2,
|
|
15018
|
+
disabled: false
|
|
15019
|
+
};
|
|
15020
|
+
}
|
|
15021
|
+
const name = choice.name ?? String(choice.value);
|
|
15022
|
+
const normalizedChoice = {
|
|
15023
|
+
value: choice.value,
|
|
15024
|
+
name,
|
|
15025
|
+
short: choice.short ?? name,
|
|
15026
|
+
disabled: choice.disabled ?? false
|
|
15027
|
+
};
|
|
15028
|
+
if (choice.description) {
|
|
15029
|
+
normalizedChoice.description = choice.description;
|
|
15030
|
+
}
|
|
15031
|
+
return normalizedChoice;
|
|
15032
|
+
});
|
|
15033
|
+
}
|
|
15034
|
+
var dist_default5 = createPrompt((config, done) => {
|
|
15035
|
+
const { loop = true, pageSize = 7 } = config;
|
|
15036
|
+
const theme = makeTheme(selectTheme, config.theme);
|
|
15037
|
+
const { keybindings } = theme;
|
|
15038
|
+
const [status, setStatus] = useState("idle");
|
|
15039
|
+
const prefix = usePrefix({ status, theme });
|
|
15040
|
+
const searchTimeoutRef = useRef();
|
|
15041
|
+
const searchEnabled = !keybindings.includes("vim");
|
|
15042
|
+
const items = useMemo(() => normalizeChoices(config.choices), [config.choices]);
|
|
15043
|
+
const bounds = useMemo(() => {
|
|
15044
|
+
const first = items.findIndex(isNavigable);
|
|
15045
|
+
const last = items.findLastIndex(isNavigable);
|
|
15046
|
+
if (first === -1) {
|
|
15047
|
+
throw new ValidationError("[select prompt] No selectable choices. All choices are disabled.");
|
|
15048
|
+
}
|
|
15049
|
+
return { first, last };
|
|
15050
|
+
}, [items]);
|
|
15051
|
+
const defaultItemIndex = useMemo(() => {
|
|
15052
|
+
if (!("default" in config))
|
|
15053
|
+
return -1;
|
|
15054
|
+
return items.findIndex((item) => isSelectable(item) && item.value === config.default);
|
|
15055
|
+
}, [config.default, items]);
|
|
15056
|
+
const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
|
|
15057
|
+
const selectedChoice = items[active];
|
|
15058
|
+
const [errorMsg, setError] = useState();
|
|
15059
|
+
useKeypress((key, rl) => {
|
|
15060
|
+
clearTimeout(searchTimeoutRef.current);
|
|
15061
|
+
if (errorMsg) {
|
|
15062
|
+
setError(void 0);
|
|
15063
|
+
}
|
|
15064
|
+
if (isEnterKey(key)) {
|
|
15065
|
+
if (selectedChoice.disabled) {
|
|
15066
|
+
setError(theme.i18n.disabledError);
|
|
15067
|
+
} else {
|
|
15068
|
+
setStatus("done");
|
|
15069
|
+
done(selectedChoice.value);
|
|
15070
|
+
}
|
|
15071
|
+
} else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {
|
|
15072
|
+
rl.clearLine(0);
|
|
15073
|
+
if (loop || isUpKey(key, keybindings) && active !== bounds.first || isDownKey(key, keybindings) && active !== bounds.last) {
|
|
15074
|
+
const offset = isUpKey(key, keybindings) ? -1 : 1;
|
|
15075
|
+
let next = active;
|
|
15076
|
+
do {
|
|
15077
|
+
next = (next + offset + items.length) % items.length;
|
|
15078
|
+
} while (!isNavigable(items[next]));
|
|
15079
|
+
setActive(next);
|
|
15080
|
+
}
|
|
15081
|
+
} else if (isNumberKey(key) && !Number.isNaN(Number(rl.line))) {
|
|
15082
|
+
const selectedIndex = Number(rl.line) - 1;
|
|
15083
|
+
let selectableIndex = -1;
|
|
15084
|
+
const position = items.findIndex((item2) => {
|
|
15085
|
+
if (Separator.isSeparator(item2))
|
|
15086
|
+
return false;
|
|
15087
|
+
selectableIndex++;
|
|
15088
|
+
return selectableIndex === selectedIndex;
|
|
15089
|
+
});
|
|
15090
|
+
const item = items[position];
|
|
15091
|
+
if (item != null && isSelectable(item)) {
|
|
15092
|
+
setActive(position);
|
|
15093
|
+
}
|
|
15094
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
15095
|
+
rl.clearLine(0);
|
|
15096
|
+
}, 700);
|
|
15097
|
+
} else if (isBackspaceKey(key)) {
|
|
15098
|
+
rl.clearLine(0);
|
|
15099
|
+
} else if (searchEnabled) {
|
|
15100
|
+
const searchTerm = rl.line.toLowerCase();
|
|
15101
|
+
const matchIndex = items.findIndex((item) => {
|
|
15102
|
+
if (Separator.isSeparator(item) || !isSelectable(item))
|
|
15103
|
+
return false;
|
|
15104
|
+
return item.name.toLowerCase().startsWith(searchTerm);
|
|
15105
|
+
});
|
|
15106
|
+
if (matchIndex !== -1) {
|
|
15107
|
+
setActive(matchIndex);
|
|
15108
|
+
}
|
|
15109
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
15110
|
+
rl.clearLine(0);
|
|
15111
|
+
}, 700);
|
|
15112
|
+
}
|
|
15113
|
+
});
|
|
15114
|
+
useEffect(() => () => {
|
|
15115
|
+
clearTimeout(searchTimeoutRef.current);
|
|
15116
|
+
}, []);
|
|
15117
|
+
const message = theme.style.message(config.message, status);
|
|
15118
|
+
const helpLine = theme.style.keysHelpTip([
|
|
15119
|
+
["\u2191\u2193", "navigate"],
|
|
15120
|
+
["\u23CE", "select"]
|
|
15121
|
+
]);
|
|
15122
|
+
let separatorCount = 0;
|
|
15123
|
+
const page = usePagination({
|
|
15124
|
+
items,
|
|
15125
|
+
active,
|
|
15126
|
+
renderItem({ item, isActive, index }) {
|
|
15127
|
+
if (Separator.isSeparator(item)) {
|
|
15128
|
+
separatorCount++;
|
|
15129
|
+
return ` ${item.separator}`;
|
|
15130
|
+
}
|
|
15131
|
+
const cursor = isActive ? theme.icon.cursor : " ";
|
|
15132
|
+
const indexLabel = theme.indexMode === "number" ? `${index + 1 - separatorCount}. ` : "";
|
|
15133
|
+
if (item.disabled) {
|
|
15134
|
+
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
15135
|
+
const disabledCursor = isActive ? theme.icon.cursor : "-";
|
|
15136
|
+
return theme.style.disabled(`${disabledCursor} ${indexLabel}${item.name} ${disabledLabel}`);
|
|
15137
|
+
}
|
|
15138
|
+
const color = isActive ? theme.style.highlight : (x) => x;
|
|
15139
|
+
return color(`${cursor} ${indexLabel}${item.name}`);
|
|
15140
|
+
},
|
|
15141
|
+
pageSize,
|
|
15142
|
+
loop
|
|
15143
|
+
});
|
|
15144
|
+
if (status === "done") {
|
|
15145
|
+
return [prefix, message, theme.style.answer(selectedChoice.short)].filter(Boolean).join(" ");
|
|
15146
|
+
}
|
|
15147
|
+
const { description } = selectedChoice;
|
|
15148
|
+
const lines = [
|
|
15149
|
+
[prefix, message].filter(Boolean).join(" "),
|
|
15150
|
+
page,
|
|
15151
|
+
" ",
|
|
15152
|
+
description ? theme.style.description(description) : "",
|
|
15153
|
+
errorMsg ? theme.style.error(errorMsg) : "",
|
|
15154
|
+
helpLine
|
|
15155
|
+
].filter(Boolean).join("\n").trimEnd();
|
|
15156
|
+
return `${lines}${cursorHide}`;
|
|
15157
|
+
});
|
|
15158
|
+
|
|
15159
|
+
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
15160
|
+
function isNothing(subject) {
|
|
15161
|
+
return typeof subject === "undefined" || subject === null;
|
|
15162
|
+
}
|
|
15163
|
+
function isObject(subject) {
|
|
15164
|
+
return typeof subject === "object" && subject !== null;
|
|
15165
|
+
}
|
|
15166
|
+
function toArray(sequence) {
|
|
15167
|
+
if (Array.isArray(sequence)) return sequence;
|
|
15168
|
+
else if (isNothing(sequence)) return [];
|
|
15169
|
+
return [sequence];
|
|
15170
|
+
}
|
|
15171
|
+
function extend(target, source) {
|
|
15172
|
+
var index, length, key, sourceKeys;
|
|
15173
|
+
if (source) {
|
|
15174
|
+
sourceKeys = Object.keys(source);
|
|
15175
|
+
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
15176
|
+
key = sourceKeys[index];
|
|
15177
|
+
target[key] = source[key];
|
|
15178
|
+
}
|
|
15179
|
+
}
|
|
15180
|
+
return target;
|
|
15181
|
+
}
|
|
15182
|
+
function repeat(string, count) {
|
|
15183
|
+
var result = "", cycle;
|
|
15184
|
+
for (cycle = 0; cycle < count; cycle += 1) {
|
|
15185
|
+
result += string;
|
|
15186
|
+
}
|
|
15187
|
+
return result;
|
|
15188
|
+
}
|
|
15189
|
+
function isNegativeZero(number) {
|
|
15190
|
+
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
15191
|
+
}
|
|
15192
|
+
var isNothing_1 = isNothing;
|
|
15193
|
+
var isObject_1 = isObject;
|
|
15194
|
+
var toArray_1 = toArray;
|
|
15195
|
+
var repeat_1 = repeat;
|
|
15196
|
+
var isNegativeZero_1 = isNegativeZero;
|
|
15197
|
+
var extend_1 = extend;
|
|
15198
|
+
var common2 = {
|
|
15199
|
+
isNothing: isNothing_1,
|
|
15200
|
+
isObject: isObject_1,
|
|
15201
|
+
toArray: toArray_1,
|
|
15202
|
+
repeat: repeat_1,
|
|
15203
|
+
isNegativeZero: isNegativeZero_1,
|
|
15204
|
+
extend: extend_1
|
|
15205
|
+
};
|
|
15206
|
+
function formatError(exception2, compact) {
|
|
15207
|
+
var where = "", message = exception2.reason || "(unknown reason)";
|
|
15208
|
+
if (!exception2.mark) return message;
|
|
15209
|
+
if (exception2.mark.name) {
|
|
15210
|
+
where += 'in "' + exception2.mark.name + '" ';
|
|
15211
|
+
}
|
|
15212
|
+
where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
|
|
15213
|
+
if (!compact && exception2.mark.snippet) {
|
|
15214
|
+
where += "\n\n" + exception2.mark.snippet;
|
|
15215
|
+
}
|
|
15216
|
+
return message + " " + where;
|
|
15217
|
+
}
|
|
15218
|
+
function YAMLException$1(reason, mark) {
|
|
15219
|
+
Error.call(this);
|
|
15220
|
+
this.name = "YAMLException";
|
|
15221
|
+
this.reason = reason;
|
|
15222
|
+
this.mark = mark;
|
|
15223
|
+
this.message = formatError(this, false);
|
|
15224
|
+
if (Error.captureStackTrace) {
|
|
15225
|
+
Error.captureStackTrace(this, this.constructor);
|
|
15226
|
+
} else {
|
|
15227
|
+
this.stack = new Error().stack || "";
|
|
15228
|
+
}
|
|
15229
|
+
}
|
|
15230
|
+
YAMLException$1.prototype = Object.create(Error.prototype);
|
|
15231
|
+
YAMLException$1.prototype.constructor = YAMLException$1;
|
|
15232
|
+
YAMLException$1.prototype.toString = function toString(compact) {
|
|
15233
|
+
return this.name + ": " + formatError(this, compact);
|
|
15234
|
+
};
|
|
15235
|
+
var exception = YAMLException$1;
|
|
15236
|
+
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
15237
|
+
var head = "";
|
|
15238
|
+
var tail = "";
|
|
15239
|
+
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
15240
|
+
if (position - lineStart > maxHalfLength) {
|
|
15241
|
+
head = " ... ";
|
|
15242
|
+
lineStart = position - maxHalfLength + head.length;
|
|
15243
|
+
}
|
|
15244
|
+
if (lineEnd - position > maxHalfLength) {
|
|
15245
|
+
tail = " ...";
|
|
15246
|
+
lineEnd = position + maxHalfLength - tail.length;
|
|
15247
|
+
}
|
|
15248
|
+
return {
|
|
15249
|
+
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
|
|
15250
|
+
pos: position - lineStart + head.length
|
|
15251
|
+
// relative position
|
|
15252
|
+
};
|
|
15253
|
+
}
|
|
15254
|
+
function padStart(string, max) {
|
|
15255
|
+
return common2.repeat(" ", max - string.length) + string;
|
|
15256
|
+
}
|
|
15257
|
+
function makeSnippet(mark, options) {
|
|
15258
|
+
options = Object.create(options || null);
|
|
15259
|
+
if (!mark.buffer) return null;
|
|
15260
|
+
if (!options.maxLength) options.maxLength = 79;
|
|
15261
|
+
if (typeof options.indent !== "number") options.indent = 1;
|
|
15262
|
+
if (typeof options.linesBefore !== "number") options.linesBefore = 3;
|
|
15263
|
+
if (typeof options.linesAfter !== "number") options.linesAfter = 2;
|
|
15264
|
+
var re2 = /\r?\n|\r|\0/g;
|
|
15265
|
+
var lineStarts = [0];
|
|
15266
|
+
var lineEnds = [];
|
|
15267
|
+
var match;
|
|
15268
|
+
var foundLineNo = -1;
|
|
15269
|
+
while (match = re2.exec(mark.buffer)) {
|
|
15270
|
+
lineEnds.push(match.index);
|
|
15271
|
+
lineStarts.push(match.index + match[0].length);
|
|
15272
|
+
if (mark.position <= match.index && foundLineNo < 0) {
|
|
15273
|
+
foundLineNo = lineStarts.length - 2;
|
|
15274
|
+
}
|
|
15275
|
+
}
|
|
15276
|
+
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
|
15277
|
+
var result = "", i, line;
|
|
15278
|
+
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
|
15279
|
+
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
|
15280
|
+
for (i = 1; i <= options.linesBefore; i++) {
|
|
15281
|
+
if (foundLineNo - i < 0) break;
|
|
15282
|
+
line = getLine(
|
|
15283
|
+
mark.buffer,
|
|
15284
|
+
lineStarts[foundLineNo - i],
|
|
15285
|
+
lineEnds[foundLineNo - i],
|
|
13416
15286
|
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
|
|
13417
15287
|
maxLineLength
|
|
13418
15288
|
);
|
|
13419
|
-
result =
|
|
15289
|
+
result = common2.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
|
|
13420
15290
|
}
|
|
13421
15291
|
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
13422
|
-
result +=
|
|
13423
|
-
result +=
|
|
15292
|
+
result += common2.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
15293
|
+
result += common2.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
|
|
13424
15294
|
for (i = 1; i <= options.linesAfter; i++) {
|
|
13425
15295
|
if (foundLineNo + i >= lineEnds.length) break;
|
|
13426
15296
|
line = getLine(
|
|
@@ -13430,7 +15300,7 @@ function makeSnippet(mark, options) {
|
|
|
13430
15300
|
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
|
|
13431
15301
|
maxLineLength
|
|
13432
15302
|
);
|
|
13433
|
-
result +=
|
|
15303
|
+
result += common2.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
13434
15304
|
}
|
|
13435
15305
|
return result.replace(/\n$/, "");
|
|
13436
15306
|
}
|
|
@@ -13743,7 +15613,7 @@ function constructYamlInteger(data) {
|
|
|
13743
15613
|
return sign * parseInt(value, 10);
|
|
13744
15614
|
}
|
|
13745
15615
|
function isInteger(object) {
|
|
13746
|
-
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !
|
|
15616
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common2.isNegativeZero(object));
|
|
13747
15617
|
}
|
|
13748
15618
|
var int = new type("tag:yaml.org,2002:int", {
|
|
13749
15619
|
kind: "scalar",
|
|
@@ -13830,14 +15700,14 @@ function representYamlFloat(object, style) {
|
|
|
13830
15700
|
case "camelcase":
|
|
13831
15701
|
return "-.Inf";
|
|
13832
15702
|
}
|
|
13833
|
-
} else if (
|
|
15703
|
+
} else if (common2.isNegativeZero(object)) {
|
|
13834
15704
|
return "-0.0";
|
|
13835
15705
|
}
|
|
13836
15706
|
res = object.toString(10);
|
|
13837
15707
|
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
13838
15708
|
}
|
|
13839
15709
|
function isFloat(object) {
|
|
13840
|
-
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 ||
|
|
15710
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common2.isNegativeZero(object));
|
|
13841
15711
|
}
|
|
13842
15712
|
var float = new type("tag:yaml.org,2002:float", {
|
|
13843
15713
|
kind: "scalar",
|
|
@@ -14274,7 +16144,7 @@ function captureSegment(state, start, end, checkJson) {
|
|
|
14274
16144
|
}
|
|
14275
16145
|
function mergeMappings(state, destination, source, overridableKeys) {
|
|
14276
16146
|
var sourceKeys, key, index, quantity;
|
|
14277
|
-
if (!
|
|
16147
|
+
if (!common2.isObject(source)) {
|
|
14278
16148
|
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
14279
16149
|
}
|
|
14280
16150
|
sourceKeys = Object.keys(source);
|
|
@@ -14391,7 +16261,7 @@ function writeFoldedLines(state, count) {
|
|
|
14391
16261
|
if (count === 1) {
|
|
14392
16262
|
state.result += " ";
|
|
14393
16263
|
} else if (count > 1) {
|
|
14394
|
-
state.result +=
|
|
16264
|
+
state.result += common2.repeat("\n", count - 1);
|
|
14395
16265
|
}
|
|
14396
16266
|
}
|
|
14397
16267
|
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
@@ -14682,7 +16552,7 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
14682
16552
|
}
|
|
14683
16553
|
if (state.lineIndent < textIndent) {
|
|
14684
16554
|
if (chomping === CHOMPING_KEEP) {
|
|
14685
|
-
state.result +=
|
|
16555
|
+
state.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
14686
16556
|
} else if (chomping === CHOMPING_CLIP) {
|
|
14687
16557
|
if (didReadContent) {
|
|
14688
16558
|
state.result += "\n";
|
|
@@ -14693,19 +16563,19 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
14693
16563
|
if (folding) {
|
|
14694
16564
|
if (is_WHITE_SPACE(ch)) {
|
|
14695
16565
|
atMoreIndented = true;
|
|
14696
|
-
state.result +=
|
|
16566
|
+
state.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
14697
16567
|
} else if (atMoreIndented) {
|
|
14698
16568
|
atMoreIndented = false;
|
|
14699
|
-
state.result +=
|
|
16569
|
+
state.result += common2.repeat("\n", emptyLines + 1);
|
|
14700
16570
|
} else if (emptyLines === 0) {
|
|
14701
16571
|
if (didReadContent) {
|
|
14702
16572
|
state.result += " ";
|
|
14703
16573
|
}
|
|
14704
16574
|
} else {
|
|
14705
|
-
state.result +=
|
|
16575
|
+
state.result += common2.repeat("\n", emptyLines);
|
|
14706
16576
|
}
|
|
14707
16577
|
} else {
|
|
14708
|
-
state.result +=
|
|
16578
|
+
state.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
14709
16579
|
}
|
|
14710
16580
|
didReadContent = true;
|
|
14711
16581
|
detectedIndent = true;
|
|
@@ -15334,7 +17204,7 @@ function encodeHex(character) {
|
|
|
15334
17204
|
} else {
|
|
15335
17205
|
throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
|
|
15336
17206
|
}
|
|
15337
|
-
return "\\" + handle +
|
|
17207
|
+
return "\\" + handle + common2.repeat("0", length - string.length) + string;
|
|
15338
17208
|
}
|
|
15339
17209
|
var QUOTING_TYPE_SINGLE = 1;
|
|
15340
17210
|
var QUOTING_TYPE_DOUBLE = 2;
|
|
@@ -15343,7 +17213,7 @@ function State(options) {
|
|
|
15343
17213
|
this.indent = Math.max(1, options["indent"] || 2);
|
|
15344
17214
|
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
15345
17215
|
this.skipInvalid = options["skipInvalid"] || false;
|
|
15346
|
-
this.flowLevel =
|
|
17216
|
+
this.flowLevel = common2.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
15347
17217
|
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
15348
17218
|
this.sortKeys = options["sortKeys"] || false;
|
|
15349
17219
|
this.lineWidth = options["lineWidth"] || 80;
|
|
@@ -15361,7 +17231,7 @@ function State(options) {
|
|
|
15361
17231
|
this.usedDuplicates = null;
|
|
15362
17232
|
}
|
|
15363
17233
|
function indentString(string, spaces) {
|
|
15364
|
-
var ind =
|
|
17234
|
+
var ind = common2.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
|
|
15365
17235
|
while (position < length) {
|
|
15366
17236
|
next = string.indexOf("\n", position);
|
|
15367
17237
|
if (next === -1) {
|
|
@@ -15377,7 +17247,7 @@ function indentString(string, spaces) {
|
|
|
15377
17247
|
return result;
|
|
15378
17248
|
}
|
|
15379
17249
|
function generateNextLine(state, level) {
|
|
15380
|
-
return "\n" +
|
|
17250
|
+
return "\n" + common2.repeat(" ", state.indent * level);
|
|
15381
17251
|
}
|
|
15382
17252
|
function testImplicitResolving(state, str2) {
|
|
15383
17253
|
var index, length, type2;
|
|
@@ -15871,7 +17741,7 @@ var FAILSAFE_SCHEMA = failsafe;
|
|
|
15871
17741
|
var JSON_SCHEMA = json;
|
|
15872
17742
|
var CORE_SCHEMA = core;
|
|
15873
17743
|
var DEFAULT_SCHEMA = _default;
|
|
15874
|
-
var
|
|
17744
|
+
var load2 = loader.load;
|
|
15875
17745
|
var loadAll = loader.loadAll;
|
|
15876
17746
|
var dump = dumper.dump;
|
|
15877
17747
|
var YAMLException = exception;
|
|
@@ -15900,7 +17770,7 @@ var jsYaml = {
|
|
|
15900
17770
|
JSON_SCHEMA,
|
|
15901
17771
|
CORE_SCHEMA,
|
|
15902
17772
|
DEFAULT_SCHEMA,
|
|
15903
|
-
load,
|
|
17773
|
+
load: load2,
|
|
15904
17774
|
loadAll,
|
|
15905
17775
|
dump,
|
|
15906
17776
|
YAMLException,
|
|
@@ -19054,9 +20924,7 @@ function findOpenClawDir(customDir) {
|
|
|
19054
20924
|
const home = process.env.HOME || "~";
|
|
19055
20925
|
const candidates = [
|
|
19056
20926
|
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")
|
|
20927
|
+
import_node_path11.default.join(home, ".lightclaw")
|
|
19060
20928
|
];
|
|
19061
20929
|
for (const candidate of candidates) {
|
|
19062
20930
|
if (import_node_fs8.default.existsSync(candidate)) {
|
|
@@ -19085,18 +20953,9 @@ function findAllClawDirs(customDir) {
|
|
|
19085
20953
|
const home = process.env.HOME || "~";
|
|
19086
20954
|
const candidates = [
|
|
19087
20955
|
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")
|
|
20956
|
+
import_node_path11.default.join(home, ".lightclaw")
|
|
19091
20957
|
];
|
|
19092
|
-
|
|
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
|
-
});
|
|
20958
|
+
return candidates.filter((c) => import_node_fs8.default.existsSync(c));
|
|
19100
20959
|
}
|
|
19101
20960
|
async function promptSelectClawDir(customDir) {
|
|
19102
20961
|
const dirs = findAllClawDirs(customDir);
|
|
@@ -19106,30 +20965,18 @@ async function promptSelectClawDir(customDir) {
|
|
|
19106
20965
|
if (dirs.length === 1) {
|
|
19107
20966
|
return dirs[0];
|
|
19108
20967
|
}
|
|
19109
|
-
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
|
|
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
|
-
}
|
|
20968
|
+
try {
|
|
20969
|
+
const selected = await dist_default5({
|
|
20970
|
+
message: "Select target Claw installation:",
|
|
20971
|
+
choices: dirs.map((dir) => {
|
|
20972
|
+
const brand = detectClawBrand(dir);
|
|
20973
|
+
return { name: `${brand} ${dir}`, value: dir };
|
|
20974
|
+
})
|
|
19131
20975
|
});
|
|
19132
|
-
|
|
20976
|
+
return selected;
|
|
20977
|
+
} catch {
|
|
20978
|
+
return null;
|
|
20979
|
+
}
|
|
19133
20980
|
}
|
|
19134
20981
|
function getConfigPath() {
|
|
19135
20982
|
const home = process.env.HOME || "~";
|
|
@@ -19448,30 +21295,19 @@ function commitBackupRecord(record) {
|
|
|
19448
21295
|
logger.info(`Backup record saved`, { id: record.id, items: record.items.length, workers: record.installedWorkerIds.length });
|
|
19449
21296
|
}
|
|
19450
21297
|
async function promptSelectRole() {
|
|
19451
|
-
|
|
19452
|
-
|
|
19453
|
-
|
|
19454
|
-
|
|
19455
|
-
|
|
19456
|
-
|
|
19457
|
-
|
|
19458
|
-
|
|
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
|
-
}
|
|
21298
|
+
try {
|
|
21299
|
+
const selected = await dist_default5({
|
|
21300
|
+
message: "Install as:",
|
|
21301
|
+
choices: [
|
|
21302
|
+
{ name: "\u{1F477} Worker agent (\u5B50Agent\uFF0C\u5B89\u88C5\u5230 workspace-<name>/ \u76EE\u5F55)", value: "worker" },
|
|
21303
|
+
{ name: "\u{1F451} Main agent (\u4E3BAgent\uFF0C\u5B89\u88C5\u5230 workspace/ \u76EE\u5F55)", value: "main" }
|
|
21304
|
+
],
|
|
21305
|
+
default: "worker"
|
|
19473
21306
|
});
|
|
19474
|
-
|
|
21307
|
+
return selected;
|
|
21308
|
+
} catch {
|
|
21309
|
+
return null;
|
|
21310
|
+
}
|
|
19475
21311
|
}
|
|
19476
21312
|
async function promptMultiSelectClawDirs() {
|
|
19477
21313
|
const dirs = findAllClawDirs();
|
|
@@ -19484,68 +21320,28 @@ async function promptMultiSelectClawDirs() {
|
|
|
19484
21320
|
console.log(` \u2714 Detected ${brand}: ${dirs[0]}`);
|
|
19485
21321
|
return dirs;
|
|
19486
21322
|
}
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
|
|
19491
|
-
|
|
19492
|
-
|
|
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);
|
|
21323
|
+
try {
|
|
21324
|
+
const selected = await dist_default5({
|
|
21325
|
+
message: "Select target Claw installation:",
|
|
21326
|
+
choices: dirs.map((dir) => {
|
|
21327
|
+
const brand = detectClawBrand(dir);
|
|
21328
|
+
return { name: `${brand} ${dir}`, value: dir };
|
|
21329
|
+
})
|
|
19527
21330
|
});
|
|
19528
|
-
|
|
21331
|
+
return [selected];
|
|
21332
|
+
} catch {
|
|
21333
|
+
return [];
|
|
21334
|
+
}
|
|
19529
21335
|
}
|
|
19530
21336
|
async function promptConfirm(message, defaultYes = true) {
|
|
19531
|
-
|
|
19532
|
-
|
|
19533
|
-
|
|
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
|
-
}
|
|
21337
|
+
try {
|
|
21338
|
+
return await dist_default4({
|
|
21339
|
+
message,
|
|
21340
|
+
default: defaultYes
|
|
19547
21341
|
});
|
|
19548
|
-
}
|
|
21342
|
+
} catch {
|
|
21343
|
+
return false;
|
|
21344
|
+
}
|
|
19549
21345
|
}
|
|
19550
21346
|
var CATEGORY_LABELS = {
|
|
19551
21347
|
"self-media": "Self Media",
|
|
@@ -19629,28 +21425,6 @@ function detectClawCommand(clawDir) {
|
|
|
19629
21425
|
}
|
|
19630
21426
|
return "openclaw";
|
|
19631
21427
|
}
|
|
19632
|
-
function restartOpenClawGateway(clawDir) {
|
|
19633
|
-
const clawCmd = detectClawCommand(clawDir);
|
|
19634
|
-
logger.debug(`Restarting ${clawCmd} Gateway`);
|
|
19635
|
-
try {
|
|
19636
|
-
(0, import_node_child_process.execSync)(`${clawCmd} gateway restart`, {
|
|
19637
|
-
stdio: "pipe",
|
|
19638
|
-
timeout: 3e4
|
|
19639
|
-
// 30 秒超时
|
|
19640
|
-
});
|
|
19641
|
-
return {
|
|
19642
|
-
success: true,
|
|
19643
|
-
message: `${clawCmd} Gateway restarted successfully.`
|
|
19644
|
-
};
|
|
19645
|
-
} catch (error) {
|
|
19646
|
-
const stderr = error && typeof error === "object" && "stderr" in error ? String(error.stderr).trim() : "";
|
|
19647
|
-
const errMsg = stderr || (error instanceof Error ? error.message : String(error));
|
|
19648
|
-
return {
|
|
19649
|
-
success: false,
|
|
19650
|
-
message: errMsg
|
|
19651
|
-
};
|
|
19652
|
-
}
|
|
19653
|
-
}
|
|
19654
21428
|
|
|
19655
21429
|
// src/commands/search.ts
|
|
19656
21430
|
var searchCommand = new Command("search").description("Search for agents in the SoulHub registry").argument("[query]", "Search query (matches name, description, tags)").option("-c, --category <category>", "Filter by category").option("-n, --limit <number>", "Max results to show", "20").option("--json", "Output results in JSON format").action(async (query, options) => {
|
|
@@ -19923,7 +21697,8 @@ function resolveAllClawDirs(clawDir) {
|
|
|
19923
21697
|
const resolved = findOpenClawDir(clawDir);
|
|
19924
21698
|
return resolved ? [resolved] : [];
|
|
19925
21699
|
}
|
|
19926
|
-
|
|
21700
|
+
const all = findAllClawDirs();
|
|
21701
|
+
return all.length > 0 ? [all[0]] : [];
|
|
19927
21702
|
}
|
|
19928
21703
|
var installCommand = new Command("install").description("Install an agent or team from the SoulHub registry").argument("[name]", "Agent or team name to install").option("--from <source>", "Install from a local directory, ZIP file, or URL").option("-r, --role <role>", "Install role: main or worker (skip role selection prompt)").option(
|
|
19929
21704
|
"--dir <path>",
|
|
@@ -20068,14 +21843,13 @@ async function installSingleAgent(name, targetDir, clawDir, asMain = false, preR
|
|
|
20068
21843
|
spinner.text = `Downloading ${source_default.cyan(agent.displayName)} package...`;
|
|
20069
21844
|
const pkgDir = await downloadAgentPackage(name, agent.version);
|
|
20070
21845
|
spinner.succeed(`Package ${source_default.cyan(agent.displayName)} downloaded.`);
|
|
20071
|
-
const
|
|
20072
|
-
|
|
20073
|
-
if (showClawHeader) {
|
|
20074
|
-
const brand = detectClawBrand(selectedClawDir);
|
|
20075
|
-
console.log();
|
|
20076
|
-
console.log(source_default.bold(`\u2500\u2500 ${brand} (${selectedClawDir}) \u2500\u2500`));
|
|
20077
|
-
}
|
|
21846
|
+
const selectedClawDir = allClawDirs[0];
|
|
21847
|
+
try {
|
|
20078
21848
|
await installSingleAgentToClaw(name, selectedClawDir, void 0, asMain, pkgDir, agent);
|
|
21849
|
+
} catch (err) {
|
|
21850
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
21851
|
+
logger.error(`Failed to install to ${selectedClawDir}`, { error: errMsg });
|
|
21852
|
+
console.error(source_default.red(` \u2717 Installation failed for ${selectedClawDir}: ${errMsg}`));
|
|
20079
21853
|
}
|
|
20080
21854
|
import_node_fs9.default.rmSync(pkgDir, { recursive: true, force: true });
|
|
20081
21855
|
}
|
|
@@ -20244,23 +22018,29 @@ async function installRecipeFromRegistry(name, recipe, targetDir, clawDir) {
|
|
|
20244
22018
|
spinner.text = `Installing worker ${source_default.cyan(worker.name)}...`;
|
|
20245
22019
|
const agentName = worker.dir || worker.name;
|
|
20246
22020
|
const agentId = worker.name;
|
|
20247
|
-
|
|
20248
|
-
|
|
20249
|
-
|
|
20250
|
-
|
|
20251
|
-
|
|
20252
|
-
|
|
20253
|
-
|
|
20254
|
-
|
|
20255
|
-
|
|
22021
|
+
try {
|
|
22022
|
+
const workerDir = targetDir ? import_node_path12.default.join(resolvedClawDir, `workspace-${agentId}`) : getWorkspaceDir(resolvedClawDir, agentId);
|
|
22023
|
+
if (!targetDir) {
|
|
22024
|
+
const regResult = registerAgentToOpenClaw(agentId, workerDir, resolvedClawDir);
|
|
22025
|
+
if (!regResult.success) {
|
|
22026
|
+
console.log(source_default.yellow(` \u26A0 Failed to register ${agentId}: ${regResult.message}`));
|
|
22027
|
+
continue;
|
|
22028
|
+
}
|
|
22029
|
+
} else {
|
|
22030
|
+
import_node_fs9.default.mkdirSync(workerDir, { recursive: true });
|
|
22031
|
+
}
|
|
22032
|
+
const agentInfo = index.agents.find((a) => a.name === agentName);
|
|
22033
|
+
const agentVersion = agentInfo?.version || "latest";
|
|
22034
|
+
const pkgDir = await downloadAgentPackage(agentName, agentVersion);
|
|
22035
|
+
copyAgentFilesFromPackage(pkgDir, workerDir);
|
|
22036
|
+
import_node_fs9.default.rmSync(pkgDir, { recursive: true, force: true });
|
|
22037
|
+
recordInstall(agentId, recipe.version || "1.0.0", workerDir);
|
|
22038
|
+
workerIds.push(agentId);
|
|
22039
|
+
} catch (err) {
|
|
22040
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
22041
|
+
logger.error(`Failed to install worker ${agentId}`, { error: errMsg });
|
|
22042
|
+
console.log(source_default.red(` \u2717 Failed to install worker ${agentId}: ${errMsg}`));
|
|
20256
22043
|
}
|
|
20257
|
-
const agentInfo = index.agents.find((a) => a.name === agentName);
|
|
20258
|
-
const agentVersion = agentInfo?.version || "latest";
|
|
20259
|
-
const pkgDir = await downloadAgentPackage(agentName, agentVersion);
|
|
20260
|
-
copyAgentFilesFromPackage(pkgDir, workerDir);
|
|
20261
|
-
import_node_fs9.default.rmSync(pkgDir, { recursive: true, force: true });
|
|
20262
|
-
recordInstall(agentId, recipe.version || "1.0.0", workerDir);
|
|
20263
|
-
workerIds.push(agentId);
|
|
20264
22044
|
}
|
|
20265
22045
|
if (!targetDir) {
|
|
20266
22046
|
spinner.text = "Configuring multi-agent communication...";
|
|
@@ -20303,7 +22083,7 @@ async function installFromSource(source, targetDir, clawDir, asMain, clawExplici
|
|
|
20303
22083
|
const contentType = response.headers.get("content-type") || "";
|
|
20304
22084
|
logger.debug(`Response content-type: ${contentType}`);
|
|
20305
22085
|
if (contentType.includes("zip") || source.endsWith(".zip")) {
|
|
20306
|
-
const JSZip = (await Promise.resolve().then(() => __toESM(
|
|
22086
|
+
const JSZip = (await Promise.resolve().then(() => __toESM(require_lib4(), 1))).default;
|
|
20307
22087
|
const arrayBuffer = await response.arrayBuffer();
|
|
20308
22088
|
const zip = await JSZip.loadAsync(arrayBuffer);
|
|
20309
22089
|
tempDir = import_node_path12.default.join(process.env.HOME || "/tmp", ".soulhub", "tmp", `pkg-${Date.now()}`);
|
|
@@ -20317,7 +22097,7 @@ async function installFromSource(source, targetDir, clawDir, asMain, clawExplici
|
|
|
20317
22097
|
}
|
|
20318
22098
|
} else if (source.endsWith(".zip")) {
|
|
20319
22099
|
spinner.text = "Extracting ZIP file...";
|
|
20320
|
-
const JSZip = (await Promise.resolve().then(() => __toESM(
|
|
22100
|
+
const JSZip = (await Promise.resolve().then(() => __toESM(require_lib4(), 1))).default;
|
|
20321
22101
|
const zipData = import_node_fs9.default.readFileSync(import_node_path12.default.resolve(source));
|
|
20322
22102
|
const zip = await JSZip.loadAsync(zipData);
|
|
20323
22103
|
tempDir = import_node_path12.default.join(process.env.HOME || "/tmp", ".soulhub", "tmp", `pkg-${Date.now()}`);
|
|
@@ -20377,14 +22157,13 @@ async function installSingleAgentFromDir(packageDir, targetDir, clawDir, asMain
|
|
|
20377
22157
|
printOpenClawInstallHelp();
|
|
20378
22158
|
return;
|
|
20379
22159
|
}
|
|
20380
|
-
const
|
|
20381
|
-
|
|
20382
|
-
if (showClawHeader) {
|
|
20383
|
-
const brand = detectClawBrand(selectedClawDir);
|
|
20384
|
-
console.log();
|
|
20385
|
-
console.log(source_default.bold(`\u2500\u2500 ${brand} (${selectedClawDir}) \u2500\u2500`));
|
|
20386
|
-
}
|
|
22160
|
+
const selectedClawDir = allClawDirs[0];
|
|
22161
|
+
try {
|
|
20387
22162
|
await installSingleAgentFromDirToClaw(packageDir, agentName, pkg, selectedClawDir, void 0, asMain);
|
|
22163
|
+
} catch (err) {
|
|
22164
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
22165
|
+
logger.error(`Failed to install to ${selectedClawDir}`, { error: errMsg });
|
|
22166
|
+
console.error(source_default.red(` \u2717 Installation failed for ${selectedClawDir}: ${errMsg}`));
|
|
20388
22167
|
}
|
|
20389
22168
|
}
|
|
20390
22169
|
async function installSingleAgentFromDirToClaw(packageDir, agentName, pkg, selectedClawDir, targetDir, asMain = false) {
|
|
@@ -20552,22 +22331,28 @@ async function installTeamFromDir(packageDir, targetDir, clawDir) {
|
|
|
20552
22331
|
const agentId = worker.name;
|
|
20553
22332
|
const agentDir = worker.dir || worker.name;
|
|
20554
22333
|
spinner.text = `Installing worker ${source_default.cyan(agentId)}...`;
|
|
20555
|
-
|
|
20556
|
-
|
|
20557
|
-
|
|
20558
|
-
|
|
20559
|
-
|
|
20560
|
-
|
|
22334
|
+
try {
|
|
22335
|
+
const workerWorkspace = targetDir ? import_node_path12.default.join(resolvedClawDir, `workspace-${agentId}`) : getWorkspaceDir(resolvedClawDir, agentId);
|
|
22336
|
+
if (!targetDir) {
|
|
22337
|
+
const regResult = registerAgentToOpenClaw(agentId, workerWorkspace, resolvedClawDir);
|
|
22338
|
+
if (!regResult.success) {
|
|
22339
|
+
console.log(source_default.yellow(` \u26A0 Failed to register ${agentId}: ${regResult.message}`));
|
|
22340
|
+
continue;
|
|
22341
|
+
}
|
|
22342
|
+
} else {
|
|
22343
|
+
import_node_fs9.default.mkdirSync(workerWorkspace, { recursive: true });
|
|
20561
22344
|
}
|
|
20562
|
-
|
|
20563
|
-
import_node_fs9.default.
|
|
20564
|
-
|
|
20565
|
-
|
|
20566
|
-
|
|
20567
|
-
|
|
22345
|
+
const workerSourceDir = import_node_path12.default.join(packageDir, agentDir);
|
|
22346
|
+
if (import_node_fs9.default.existsSync(workerSourceDir)) {
|
|
22347
|
+
copyAgentFilesFromDir(workerSourceDir, workerWorkspace);
|
|
22348
|
+
}
|
|
22349
|
+
recordInstall(agentId, pkg.version || "local", workerWorkspace);
|
|
22350
|
+
workerIds.push(agentId);
|
|
22351
|
+
} catch (err) {
|
|
22352
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
22353
|
+
logger.error(`Failed to install worker ${agentId}`, { error: errMsg });
|
|
22354
|
+
console.log(source_default.red(` \u2717 Failed to install worker ${agentId}: ${errMsg}`));
|
|
20568
22355
|
}
|
|
20569
|
-
recordInstall(agentId, pkg.version || "local", workerWorkspace);
|
|
20570
|
-
workerIds.push(agentId);
|
|
20571
22356
|
}
|
|
20572
22357
|
if (!targetDir && workerIds.length > 0) {
|
|
20573
22358
|
spinner.text = "Configuring multi-agent communication...";
|
|
@@ -20675,13 +22460,9 @@ function printTeamSummary(pkg, workerIds) {
|
|
|
20675
22460
|
async function tryRestartGateway(clawDir) {
|
|
20676
22461
|
const clawCmd = detectClawCommand(clawDir);
|
|
20677
22462
|
const brandName = clawCmd === "lightclaw" ? "LightClaw" : "OpenClaw";
|
|
20678
|
-
|
|
20679
|
-
|
|
20680
|
-
|
|
20681
|
-
restartSpinner.succeed(`${brandName} Gateway restarted successfully.`);
|
|
20682
|
-
} else {
|
|
20683
|
-
restartSpinner.warn(`Failed to restart ${brandName} Gateway. Please restart it manually.`);
|
|
20684
|
-
}
|
|
22463
|
+
console.log();
|
|
22464
|
+
console.log(source_default.yellow(` \u26A0 Please restart ${brandName} Gateway to apply changes:`));
|
|
22465
|
+
console.log(source_default.cyan(` ${clawCmd} gateway restart`));
|
|
20685
22466
|
}
|
|
20686
22467
|
|
|
20687
22468
|
// src/commands/list.ts
|
|
@@ -20896,7 +22677,6 @@ var uninstallCommand = new Command("uninstall").description("Uninstall an agent
|
|
|
20896
22677
|
// src/commands/rollback.ts
|
|
20897
22678
|
var import_node_fs12 = __toESM(require("fs"), 1);
|
|
20898
22679
|
var import_node_path13 = __toESM(require("path"), 1);
|
|
20899
|
-
var import_node_readline2 = __toESM(require("readline"), 1);
|
|
20900
22680
|
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
22681
|
"--claw-type <type>",
|
|
20902
22682
|
"Specify claw type: OpenClaw or LightClaw (case-insensitive)"
|
|
@@ -20962,43 +22742,35 @@ async function interactiveRollback(clawDir) {
|
|
|
20962
22742
|
console.log(source_default.dim(" Backup records are created automatically when you install agents."));
|
|
20963
22743
|
return;
|
|
20964
22744
|
}
|
|
20965
|
-
console.log(source_default.bold("\n
|
|
22745
|
+
console.log(source_default.bold("\n Available rollback records:\n"));
|
|
20966
22746
|
printRecordTable(manifest.records);
|
|
20967
22747
|
console.log();
|
|
20968
|
-
|
|
20969
|
-
|
|
20970
|
-
|
|
20971
|
-
|
|
20972
|
-
|
|
20973
|
-
|
|
20974
|
-
|
|
20975
|
-
|
|
20976
|
-
|
|
20977
|
-
|
|
20978
|
-
|
|
20979
|
-
}
|
|
20980
|
-
const idx = parseInt(trimmed, 10);
|
|
20981
|
-
if (idx >= 1 && idx <= manifest.records.length) {
|
|
20982
|
-
resolve(idx);
|
|
20983
|
-
} else {
|
|
20984
|
-
resolve(null);
|
|
20985
|
-
}
|
|
22748
|
+
let selected;
|
|
22749
|
+
try {
|
|
22750
|
+
selected = await dist_default5({
|
|
22751
|
+
message: "Select a record to rollback:",
|
|
22752
|
+
choices: manifest.records.map((record, index) => {
|
|
22753
|
+
const date = new Date(record.createdAt).toLocaleString();
|
|
22754
|
+
const clawBrand = detectClawBrandFromDir(record.clawDir);
|
|
22755
|
+
return {
|
|
22756
|
+
name: `#${index + 1} ${record.id} ${record.packageName} (${clawBrand}, ${date})`,
|
|
22757
|
+
value: record
|
|
22758
|
+
};
|
|
22759
|
+
})
|
|
20986
22760
|
});
|
|
20987
|
-
}
|
|
20988
|
-
if (selected === null) {
|
|
22761
|
+
} catch {
|
|
20989
22762
|
console.log(source_default.dim(" Rollback cancelled."));
|
|
20990
22763
|
return;
|
|
20991
22764
|
}
|
|
20992
|
-
const record = manifest.records[selected - 1];
|
|
20993
22765
|
console.log();
|
|
20994
|
-
console.log(source_default.dim(` Selected: ${source_default.cyan(
|
|
20995
|
-
printRollbackDetails(
|
|
22766
|
+
console.log(source_default.dim(` Selected: ${source_default.cyan(selected.id)} (${selected.packageName})`));
|
|
22767
|
+
printRollbackDetails(selected);
|
|
20996
22768
|
const confirmed = await promptConfirmRollback();
|
|
20997
22769
|
if (!confirmed) {
|
|
20998
22770
|
console.log(source_default.dim(" Rollback cancelled."));
|
|
20999
22771
|
return;
|
|
21000
22772
|
}
|
|
21001
|
-
await executeRollback(
|
|
22773
|
+
await executeRollback(selected, clawDir);
|
|
21002
22774
|
}
|
|
21003
22775
|
async function performRollbackByIndex(n, clawDir, skipConfirm = false) {
|
|
21004
22776
|
const manifest = loadBackupManifest();
|
|
@@ -21020,17 +22792,15 @@ async function performRollbackByIndex(n, clawDir, skipConfirm = false) {
|
|
|
21020
22792
|
);
|
|
21021
22793
|
printRollbackDetails(record);
|
|
21022
22794
|
if (!skipConfirm) {
|
|
21023
|
-
|
|
21024
|
-
|
|
21025
|
-
|
|
21026
|
-
|
|
21027
|
-
|
|
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");
|
|
22795
|
+
let confirmed;
|
|
22796
|
+
try {
|
|
22797
|
+
confirmed = await dist_default4({
|
|
22798
|
+
message: `${source_default.yellow("\u26A0")} Proceed with rollback?`,
|
|
22799
|
+
default: true
|
|
21032
22800
|
});
|
|
21033
|
-
}
|
|
22801
|
+
} catch {
|
|
22802
|
+
confirmed = false;
|
|
22803
|
+
}
|
|
21034
22804
|
if (!confirmed) {
|
|
21035
22805
|
console.log(source_default.dim(" Rollback cancelled."));
|
|
21036
22806
|
return;
|
|
@@ -21093,21 +22863,14 @@ function printRollbackDetails(record) {
|
|
|
21093
22863
|
console.log();
|
|
21094
22864
|
}
|
|
21095
22865
|
async function promptConfirmRollback() {
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
-
|
|
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
|
-
}
|
|
22866
|
+
try {
|
|
22867
|
+
return await dist_default4({
|
|
22868
|
+
message: `${source_default.yellow("\u26A0")} Proceed with rollback?`,
|
|
22869
|
+
default: true
|
|
21109
22870
|
});
|
|
21110
|
-
}
|
|
22871
|
+
} catch {
|
|
22872
|
+
return false;
|
|
22873
|
+
}
|
|
21111
22874
|
}
|
|
21112
22875
|
async function executeRollback(record, clawDir) {
|
|
21113
22876
|
const spinner = createSpinner(
|
|
@@ -21198,16 +22961,9 @@ async function executeRollback(record, clawDir) {
|
|
|
21198
22961
|
);
|
|
21199
22962
|
const clawCmd = detectClawCommand(resolvedClawDir);
|
|
21200
22963
|
const brandName = clawCmd === "lightclaw" ? "LightClaw" : "OpenClaw";
|
|
21201
|
-
|
|
21202
|
-
|
|
21203
|
-
|
|
21204
|
-
restartSpinner.succeed(`${brandName} Gateway restarted successfully.`);
|
|
21205
|
-
} else {
|
|
21206
|
-
restartSpinner.warn(`Failed to restart ${brandName} Gateway.`);
|
|
21207
|
-
console.log(source_default.yellow(` Reason: ${result.message}`));
|
|
21208
|
-
console.log(source_default.dim(" Please restart manually:"));
|
|
21209
|
-
console.log(source_default.dim(` ${clawCmd} gateway restart`));
|
|
21210
|
-
}
|
|
22964
|
+
console.log();
|
|
22965
|
+
console.log(source_default.yellow(` \u26A0 Please restart ${brandName} Gateway to apply changes:`));
|
|
22966
|
+
console.log(source_default.cyan(` ${clawCmd} gateway restart`));
|
|
21211
22967
|
console.log();
|
|
21212
22968
|
}
|
|
21213
22969
|
function formatInstallType(type2) {
|
|
@@ -21234,13 +22990,13 @@ function detectClawBrandFromDir(clawDir) {
|
|
|
21234
22990
|
|
|
21235
22991
|
// src/index.ts
|
|
21236
22992
|
var program2 = new Command();
|
|
21237
|
-
program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.
|
|
22993
|
+
program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.24").option("--verbose", "Enable verbose debug logging").hook("preAction", () => {
|
|
21238
22994
|
const opts = program2.opts();
|
|
21239
22995
|
const verbose = opts.verbose || process.env.SOULHUB_DEBUG === "1";
|
|
21240
22996
|
logger.init(verbose);
|
|
21241
22997
|
logger.info("CLI started", {
|
|
21242
22998
|
args: process.argv.slice(2),
|
|
21243
|
-
version: "1.0.
|
|
22999
|
+
version: "1.0.24",
|
|
21244
23000
|
node: process.version
|
|
21245
23001
|
});
|
|
21246
23002
|
});
|