soulhubcli 1.0.21 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -21
- package/dist/index.cjs +2785 -310
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -966,8 +966,8 @@ var require_command = __commonJS({
|
|
|
966
966
|
var EventEmitter = require("events").EventEmitter;
|
|
967
967
|
var childProcess = require("child_process");
|
|
968
968
|
var path5 = require("path");
|
|
969
|
-
var
|
|
970
|
-
var
|
|
969
|
+
var fs8 = require("fs");
|
|
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 {
|
|
@@ -1899,10 +1899,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1899
1899
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1900
1900
|
function findFile(baseDir, baseName) {
|
|
1901
1901
|
const localBin = path5.resolve(baseDir, baseName);
|
|
1902
|
-
if (
|
|
1902
|
+
if (fs8.existsSync(localBin)) return localBin;
|
|
1903
1903
|
if (sourceExt.includes(path5.extname(baseName))) return void 0;
|
|
1904
1904
|
const foundExt = sourceExt.find(
|
|
1905
|
-
(ext) =>
|
|
1905
|
+
(ext) => fs8.existsSync(`${localBin}${ext}`)
|
|
1906
1906
|
);
|
|
1907
1907
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1908
1908
|
return void 0;
|
|
@@ -1914,7 +1914,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1914
1914
|
if (this._scriptPath) {
|
|
1915
1915
|
let resolvedScriptPath;
|
|
1916
1916
|
try {
|
|
1917
|
-
resolvedScriptPath =
|
|
1917
|
+
resolvedScriptPath = fs8.realpathSync(this._scriptPath);
|
|
1918
1918
|
} catch (err) {
|
|
1919
1919
|
resolvedScriptPath = this._scriptPath;
|
|
1920
1920
|
}
|
|
@@ -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,2038 @@ 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 isSpaceKey = (key) => key.name === "space";
|
|
13468
|
+
var isBackspaceKey = (key) => key.name === "backspace";
|
|
13469
|
+
var isTabKey = (key) => key.name === "tab";
|
|
13470
|
+
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
13471
|
+
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
13472
|
+
|
|
13473
|
+
// node_modules/@inquirer/core/dist/lib/errors.js
|
|
13474
|
+
var AbortPromptError = class extends Error {
|
|
13475
|
+
name = "AbortPromptError";
|
|
13476
|
+
message = "Prompt was aborted";
|
|
13477
|
+
constructor(options) {
|
|
13478
|
+
super();
|
|
13479
|
+
this.cause = options?.cause;
|
|
13480
|
+
}
|
|
13481
|
+
};
|
|
13482
|
+
var CancelPromptError = class extends Error {
|
|
13483
|
+
name = "CancelPromptError";
|
|
13484
|
+
message = "Prompt was canceled";
|
|
13485
|
+
};
|
|
13486
|
+
var ExitPromptError = class extends Error {
|
|
13487
|
+
name = "ExitPromptError";
|
|
13488
|
+
};
|
|
13489
|
+
var HookError = class extends Error {
|
|
13490
|
+
name = "HookError";
|
|
13491
|
+
};
|
|
13492
|
+
var ValidationError = class extends Error {
|
|
13493
|
+
name = "ValidationError";
|
|
13494
|
+
};
|
|
13495
|
+
|
|
13496
|
+
// node_modules/@inquirer/core/dist/lib/use-state.js
|
|
13497
|
+
var import_node_async_hooks2 = require("async_hooks");
|
|
13498
|
+
|
|
13499
|
+
// node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
13500
|
+
var import_node_async_hooks = require("async_hooks");
|
|
13501
|
+
var hookStorage = new import_node_async_hooks.AsyncLocalStorage();
|
|
13502
|
+
function createStore(rl) {
|
|
13503
|
+
const store = {
|
|
13504
|
+
rl,
|
|
13505
|
+
hooks: [],
|
|
13506
|
+
hooksCleanup: [],
|
|
13507
|
+
hooksEffect: [],
|
|
13508
|
+
index: 0,
|
|
13509
|
+
handleChange() {
|
|
13510
|
+
}
|
|
13511
|
+
};
|
|
13512
|
+
return store;
|
|
13292
13513
|
}
|
|
13293
|
-
function
|
|
13294
|
-
|
|
13514
|
+
function withHooks(rl, cb) {
|
|
13515
|
+
const store = createStore(rl);
|
|
13516
|
+
return hookStorage.run(store, () => {
|
|
13517
|
+
function cycle(render) {
|
|
13518
|
+
store.handleChange = () => {
|
|
13519
|
+
store.index = 0;
|
|
13520
|
+
render();
|
|
13521
|
+
};
|
|
13522
|
+
store.handleChange();
|
|
13523
|
+
}
|
|
13524
|
+
return cb(cycle);
|
|
13525
|
+
});
|
|
13295
13526
|
}
|
|
13296
|
-
function
|
|
13297
|
-
|
|
13298
|
-
|
|
13299
|
-
|
|
13527
|
+
function getStore() {
|
|
13528
|
+
const store = hookStorage.getStore();
|
|
13529
|
+
if (!store) {
|
|
13530
|
+
throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
13531
|
+
}
|
|
13532
|
+
return store;
|
|
13300
13533
|
}
|
|
13301
|
-
function
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13534
|
+
function readline() {
|
|
13535
|
+
return getStore().rl;
|
|
13536
|
+
}
|
|
13537
|
+
function withUpdates(fn2) {
|
|
13538
|
+
const wrapped = (...args) => {
|
|
13539
|
+
const store = getStore();
|
|
13540
|
+
let shouldUpdate = false;
|
|
13541
|
+
const oldHandleChange = store.handleChange;
|
|
13542
|
+
store.handleChange = () => {
|
|
13543
|
+
shouldUpdate = true;
|
|
13544
|
+
};
|
|
13545
|
+
const returnValue = fn2(...args);
|
|
13546
|
+
if (shouldUpdate) {
|
|
13547
|
+
oldHandleChange();
|
|
13308
13548
|
}
|
|
13309
|
-
|
|
13310
|
-
|
|
13549
|
+
store.handleChange = oldHandleChange;
|
|
13550
|
+
return returnValue;
|
|
13551
|
+
};
|
|
13552
|
+
return import_node_async_hooks.AsyncResource.bind(wrapped);
|
|
13311
13553
|
}
|
|
13312
|
-
function
|
|
13313
|
-
|
|
13314
|
-
|
|
13315
|
-
|
|
13554
|
+
function withPointer(cb) {
|
|
13555
|
+
const store = getStore();
|
|
13556
|
+
const { index } = store;
|
|
13557
|
+
const pointer = {
|
|
13558
|
+
get() {
|
|
13559
|
+
return store.hooks[index];
|
|
13560
|
+
},
|
|
13561
|
+
set(value) {
|
|
13562
|
+
store.hooks[index] = value;
|
|
13563
|
+
},
|
|
13564
|
+
initialized: index in store.hooks
|
|
13565
|
+
};
|
|
13566
|
+
const returnValue = cb(pointer);
|
|
13567
|
+
store.index++;
|
|
13568
|
+
return returnValue;
|
|
13569
|
+
}
|
|
13570
|
+
function handleChange() {
|
|
13571
|
+
getStore().handleChange();
|
|
13572
|
+
}
|
|
13573
|
+
var effectScheduler = {
|
|
13574
|
+
queue(cb) {
|
|
13575
|
+
const store = getStore();
|
|
13576
|
+
const { index } = store;
|
|
13577
|
+
store.hooksEffect.push(() => {
|
|
13578
|
+
store.hooksCleanup[index]?.();
|
|
13579
|
+
const cleanFn = cb(readline());
|
|
13580
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
13581
|
+
throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
13582
|
+
}
|
|
13583
|
+
store.hooksCleanup[index] = cleanFn;
|
|
13584
|
+
});
|
|
13585
|
+
},
|
|
13586
|
+
run() {
|
|
13587
|
+
const store = getStore();
|
|
13588
|
+
withUpdates(() => {
|
|
13589
|
+
store.hooksEffect.forEach((effect) => {
|
|
13590
|
+
effect();
|
|
13591
|
+
});
|
|
13592
|
+
store.hooksEffect.length = 0;
|
|
13593
|
+
})();
|
|
13594
|
+
},
|
|
13595
|
+
clearAll() {
|
|
13596
|
+
const store = getStore();
|
|
13597
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
13598
|
+
cleanFn?.();
|
|
13599
|
+
});
|
|
13600
|
+
store.hooksEffect.length = 0;
|
|
13601
|
+
store.hooksCleanup.length = 0;
|
|
13316
13602
|
}
|
|
13317
|
-
|
|
13603
|
+
};
|
|
13604
|
+
|
|
13605
|
+
// node_modules/@inquirer/core/dist/lib/use-state.js
|
|
13606
|
+
function useState(defaultValue) {
|
|
13607
|
+
return withPointer((pointer) => {
|
|
13608
|
+
const setState = import_node_async_hooks2.AsyncResource.bind(function setState2(newValue) {
|
|
13609
|
+
if (pointer.get() !== newValue) {
|
|
13610
|
+
pointer.set(newValue);
|
|
13611
|
+
handleChange();
|
|
13612
|
+
}
|
|
13613
|
+
});
|
|
13614
|
+
if (pointer.initialized) {
|
|
13615
|
+
return [pointer.get(), setState];
|
|
13616
|
+
}
|
|
13617
|
+
const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
13618
|
+
pointer.set(value);
|
|
13619
|
+
return [value, setState];
|
|
13620
|
+
});
|
|
13318
13621
|
}
|
|
13319
|
-
|
|
13320
|
-
|
|
13622
|
+
|
|
13623
|
+
// node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
13624
|
+
function useEffect(cb, depArray) {
|
|
13625
|
+
withPointer((pointer) => {
|
|
13626
|
+
const oldDeps = pointer.get();
|
|
13627
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
13628
|
+
if (hasChanged) {
|
|
13629
|
+
effectScheduler.queue(cb);
|
|
13630
|
+
}
|
|
13631
|
+
pointer.set(depArray);
|
|
13632
|
+
});
|
|
13633
|
+
}
|
|
13634
|
+
|
|
13635
|
+
// node_modules/@inquirer/core/dist/lib/theme.js
|
|
13636
|
+
var import_node_util = require("util");
|
|
13637
|
+
|
|
13638
|
+
// node_modules/@inquirer/figures/dist/index.js
|
|
13639
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
13640
|
+
function isUnicodeSupported() {
|
|
13641
|
+
if (import_node_process2.default.platform !== "win32") {
|
|
13642
|
+
return import_node_process2.default.env["TERM"] !== "linux";
|
|
13643
|
+
}
|
|
13644
|
+
return Boolean(import_node_process2.default.env["WT_SESSION"]) || // Windows Terminal
|
|
13645
|
+
Boolean(import_node_process2.default.env["TERMINUS_SUBLIME"]) || // Terminus (<0.2.27)
|
|
13646
|
+
import_node_process2.default.env["ConEmuTask"] === "{cmd::Cmder}" || // ConEmu and cmder
|
|
13647
|
+
import_node_process2.default.env["TERM_PROGRAM"] === "Terminus-Sublime" || import_node_process2.default.env["TERM_PROGRAM"] === "vscode" || import_node_process2.default.env["TERM"] === "xterm-256color" || import_node_process2.default.env["TERM"] === "alacritty" || import_node_process2.default.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
|
|
13321
13648
|
}
|
|
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
13649
|
var common = {
|
|
13329
|
-
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
|
|
13333
|
-
|
|
13334
|
-
|
|
13650
|
+
circleQuestionMark: "(?)",
|
|
13651
|
+
questionMarkPrefix: "(?)",
|
|
13652
|
+
square: "\u2588",
|
|
13653
|
+
squareDarkShade: "\u2593",
|
|
13654
|
+
squareMediumShade: "\u2592",
|
|
13655
|
+
squareLightShade: "\u2591",
|
|
13656
|
+
squareTop: "\u2580",
|
|
13657
|
+
squareBottom: "\u2584",
|
|
13658
|
+
squareLeft: "\u258C",
|
|
13659
|
+
squareRight: "\u2590",
|
|
13660
|
+
squareCenter: "\u25A0",
|
|
13661
|
+
bullet: "\u25CF",
|
|
13662
|
+
dot: "\u2024",
|
|
13663
|
+
ellipsis: "\u2026",
|
|
13664
|
+
pointerSmall: "\u203A",
|
|
13665
|
+
triangleUp: "\u25B2",
|
|
13666
|
+
triangleUpSmall: "\u25B4",
|
|
13667
|
+
triangleDown: "\u25BC",
|
|
13668
|
+
triangleDownSmall: "\u25BE",
|
|
13669
|
+
triangleLeftSmall: "\u25C2",
|
|
13670
|
+
triangleRightSmall: "\u25B8",
|
|
13671
|
+
home: "\u2302",
|
|
13672
|
+
heart: "\u2665",
|
|
13673
|
+
musicNote: "\u266A",
|
|
13674
|
+
musicNoteBeamed: "\u266B",
|
|
13675
|
+
arrowUp: "\u2191",
|
|
13676
|
+
arrowDown: "\u2193",
|
|
13677
|
+
arrowLeft: "\u2190",
|
|
13678
|
+
arrowRight: "\u2192",
|
|
13679
|
+
arrowLeftRight: "\u2194",
|
|
13680
|
+
arrowUpDown: "\u2195",
|
|
13681
|
+
almostEqual: "\u2248",
|
|
13682
|
+
notEqual: "\u2260",
|
|
13683
|
+
lessOrEqual: "\u2264",
|
|
13684
|
+
greaterOrEqual: "\u2265",
|
|
13685
|
+
identical: "\u2261",
|
|
13686
|
+
infinity: "\u221E",
|
|
13687
|
+
subscriptZero: "\u2080",
|
|
13688
|
+
subscriptOne: "\u2081",
|
|
13689
|
+
subscriptTwo: "\u2082",
|
|
13690
|
+
subscriptThree: "\u2083",
|
|
13691
|
+
subscriptFour: "\u2084",
|
|
13692
|
+
subscriptFive: "\u2085",
|
|
13693
|
+
subscriptSix: "\u2086",
|
|
13694
|
+
subscriptSeven: "\u2087",
|
|
13695
|
+
subscriptEight: "\u2088",
|
|
13696
|
+
subscriptNine: "\u2089",
|
|
13697
|
+
oneHalf: "\xBD",
|
|
13698
|
+
oneThird: "\u2153",
|
|
13699
|
+
oneQuarter: "\xBC",
|
|
13700
|
+
oneFifth: "\u2155",
|
|
13701
|
+
oneSixth: "\u2159",
|
|
13702
|
+
oneEighth: "\u215B",
|
|
13703
|
+
twoThirds: "\u2154",
|
|
13704
|
+
twoFifths: "\u2156",
|
|
13705
|
+
threeQuarters: "\xBE",
|
|
13706
|
+
threeFifths: "\u2157",
|
|
13707
|
+
threeEighths: "\u215C",
|
|
13708
|
+
fourFifths: "\u2158",
|
|
13709
|
+
fiveSixths: "\u215A",
|
|
13710
|
+
fiveEighths: "\u215D",
|
|
13711
|
+
sevenEighths: "\u215E",
|
|
13712
|
+
line: "\u2500",
|
|
13713
|
+
lineBold: "\u2501",
|
|
13714
|
+
lineDouble: "\u2550",
|
|
13715
|
+
lineDashed0: "\u2504",
|
|
13716
|
+
lineDashed1: "\u2505",
|
|
13717
|
+
lineDashed2: "\u2508",
|
|
13718
|
+
lineDashed3: "\u2509",
|
|
13719
|
+
lineDashed4: "\u254C",
|
|
13720
|
+
lineDashed5: "\u254D",
|
|
13721
|
+
lineDashed6: "\u2574",
|
|
13722
|
+
lineDashed7: "\u2576",
|
|
13723
|
+
lineDashed8: "\u2578",
|
|
13724
|
+
lineDashed9: "\u257A",
|
|
13725
|
+
lineDashed10: "\u257C",
|
|
13726
|
+
lineDashed11: "\u257E",
|
|
13727
|
+
lineDashed12: "\u2212",
|
|
13728
|
+
lineDashed13: "\u2013",
|
|
13729
|
+
lineDashed14: "\u2010",
|
|
13730
|
+
lineDashed15: "\u2043",
|
|
13731
|
+
lineVertical: "\u2502",
|
|
13732
|
+
lineVerticalBold: "\u2503",
|
|
13733
|
+
lineVerticalDouble: "\u2551",
|
|
13734
|
+
lineVerticalDashed0: "\u2506",
|
|
13735
|
+
lineVerticalDashed1: "\u2507",
|
|
13736
|
+
lineVerticalDashed2: "\u250A",
|
|
13737
|
+
lineVerticalDashed3: "\u250B",
|
|
13738
|
+
lineVerticalDashed4: "\u254E",
|
|
13739
|
+
lineVerticalDashed5: "\u254F",
|
|
13740
|
+
lineVerticalDashed6: "\u2575",
|
|
13741
|
+
lineVerticalDashed7: "\u2577",
|
|
13742
|
+
lineVerticalDashed8: "\u2579",
|
|
13743
|
+
lineVerticalDashed9: "\u257B",
|
|
13744
|
+
lineVerticalDashed10: "\u257D",
|
|
13745
|
+
lineVerticalDashed11: "\u257F",
|
|
13746
|
+
lineDownLeft: "\u2510",
|
|
13747
|
+
lineDownLeftArc: "\u256E",
|
|
13748
|
+
lineDownBoldLeftBold: "\u2513",
|
|
13749
|
+
lineDownBoldLeft: "\u2512",
|
|
13750
|
+
lineDownLeftBold: "\u2511",
|
|
13751
|
+
lineDownDoubleLeftDouble: "\u2557",
|
|
13752
|
+
lineDownDoubleLeft: "\u2556",
|
|
13753
|
+
lineDownLeftDouble: "\u2555",
|
|
13754
|
+
lineDownRight: "\u250C",
|
|
13755
|
+
lineDownRightArc: "\u256D",
|
|
13756
|
+
lineDownBoldRightBold: "\u250F",
|
|
13757
|
+
lineDownBoldRight: "\u250E",
|
|
13758
|
+
lineDownRightBold: "\u250D",
|
|
13759
|
+
lineDownDoubleRightDouble: "\u2554",
|
|
13760
|
+
lineDownDoubleRight: "\u2553",
|
|
13761
|
+
lineDownRightDouble: "\u2552",
|
|
13762
|
+
lineUpLeft: "\u2518",
|
|
13763
|
+
lineUpLeftArc: "\u256F",
|
|
13764
|
+
lineUpBoldLeftBold: "\u251B",
|
|
13765
|
+
lineUpBoldLeft: "\u251A",
|
|
13766
|
+
lineUpLeftBold: "\u2519",
|
|
13767
|
+
lineUpDoubleLeftDouble: "\u255D",
|
|
13768
|
+
lineUpDoubleLeft: "\u255C",
|
|
13769
|
+
lineUpLeftDouble: "\u255B",
|
|
13770
|
+
lineUpRight: "\u2514",
|
|
13771
|
+
lineUpRightArc: "\u2570",
|
|
13772
|
+
lineUpBoldRightBold: "\u2517",
|
|
13773
|
+
lineUpBoldRight: "\u2516",
|
|
13774
|
+
lineUpRightBold: "\u2515",
|
|
13775
|
+
lineUpDoubleRightDouble: "\u255A",
|
|
13776
|
+
lineUpDoubleRight: "\u2559",
|
|
13777
|
+
lineUpRightDouble: "\u2558",
|
|
13778
|
+
lineUpDownLeft: "\u2524",
|
|
13779
|
+
lineUpBoldDownBoldLeftBold: "\u252B",
|
|
13780
|
+
lineUpBoldDownBoldLeft: "\u2528",
|
|
13781
|
+
lineUpDownLeftBold: "\u2525",
|
|
13782
|
+
lineUpBoldDownLeftBold: "\u2529",
|
|
13783
|
+
lineUpDownBoldLeftBold: "\u252A",
|
|
13784
|
+
lineUpDownBoldLeft: "\u2527",
|
|
13785
|
+
lineUpBoldDownLeft: "\u2526",
|
|
13786
|
+
lineUpDoubleDownDoubleLeftDouble: "\u2563",
|
|
13787
|
+
lineUpDoubleDownDoubleLeft: "\u2562",
|
|
13788
|
+
lineUpDownLeftDouble: "\u2561",
|
|
13789
|
+
lineUpDownRight: "\u251C",
|
|
13790
|
+
lineUpBoldDownBoldRightBold: "\u2523",
|
|
13791
|
+
lineUpBoldDownBoldRight: "\u2520",
|
|
13792
|
+
lineUpDownRightBold: "\u251D",
|
|
13793
|
+
lineUpBoldDownRightBold: "\u2521",
|
|
13794
|
+
lineUpDownBoldRightBold: "\u2522",
|
|
13795
|
+
lineUpDownBoldRight: "\u251F",
|
|
13796
|
+
lineUpBoldDownRight: "\u251E",
|
|
13797
|
+
lineUpDoubleDownDoubleRightDouble: "\u2560",
|
|
13798
|
+
lineUpDoubleDownDoubleRight: "\u255F",
|
|
13799
|
+
lineUpDownRightDouble: "\u255E",
|
|
13800
|
+
lineDownLeftRight: "\u252C",
|
|
13801
|
+
lineDownBoldLeftBoldRightBold: "\u2533",
|
|
13802
|
+
lineDownLeftBoldRightBold: "\u252F",
|
|
13803
|
+
lineDownBoldLeftRight: "\u2530",
|
|
13804
|
+
lineDownBoldLeftBoldRight: "\u2531",
|
|
13805
|
+
lineDownBoldLeftRightBold: "\u2532",
|
|
13806
|
+
lineDownLeftRightBold: "\u252E",
|
|
13807
|
+
lineDownLeftBoldRight: "\u252D",
|
|
13808
|
+
lineDownDoubleLeftDoubleRightDouble: "\u2566",
|
|
13809
|
+
lineDownDoubleLeftRight: "\u2565",
|
|
13810
|
+
lineDownLeftDoubleRightDouble: "\u2564",
|
|
13811
|
+
lineUpLeftRight: "\u2534",
|
|
13812
|
+
lineUpBoldLeftBoldRightBold: "\u253B",
|
|
13813
|
+
lineUpLeftBoldRightBold: "\u2537",
|
|
13814
|
+
lineUpBoldLeftRight: "\u2538",
|
|
13815
|
+
lineUpBoldLeftBoldRight: "\u2539",
|
|
13816
|
+
lineUpBoldLeftRightBold: "\u253A",
|
|
13817
|
+
lineUpLeftRightBold: "\u2536",
|
|
13818
|
+
lineUpLeftBoldRight: "\u2535",
|
|
13819
|
+
lineUpDoubleLeftDoubleRightDouble: "\u2569",
|
|
13820
|
+
lineUpDoubleLeftRight: "\u2568",
|
|
13821
|
+
lineUpLeftDoubleRightDouble: "\u2567",
|
|
13822
|
+
lineUpDownLeftRight: "\u253C",
|
|
13823
|
+
lineUpBoldDownBoldLeftBoldRightBold: "\u254B",
|
|
13824
|
+
lineUpDownBoldLeftBoldRightBold: "\u2548",
|
|
13825
|
+
lineUpBoldDownLeftBoldRightBold: "\u2547",
|
|
13826
|
+
lineUpBoldDownBoldLeftRightBold: "\u254A",
|
|
13827
|
+
lineUpBoldDownBoldLeftBoldRight: "\u2549",
|
|
13828
|
+
lineUpBoldDownLeftRight: "\u2540",
|
|
13829
|
+
lineUpDownBoldLeftRight: "\u2541",
|
|
13830
|
+
lineUpDownLeftBoldRight: "\u253D",
|
|
13831
|
+
lineUpDownLeftRightBold: "\u253E",
|
|
13832
|
+
lineUpBoldDownBoldLeftRight: "\u2542",
|
|
13833
|
+
lineUpDownLeftBoldRightBold: "\u253F",
|
|
13834
|
+
lineUpBoldDownLeftBoldRight: "\u2543",
|
|
13835
|
+
lineUpBoldDownLeftRightBold: "\u2544",
|
|
13836
|
+
lineUpDownBoldLeftBoldRight: "\u2545",
|
|
13837
|
+
lineUpDownBoldLeftRightBold: "\u2546",
|
|
13838
|
+
lineUpDoubleDownDoubleLeftDoubleRightDouble: "\u256C",
|
|
13839
|
+
lineUpDoubleDownDoubleLeftRight: "\u256B",
|
|
13840
|
+
lineUpDownLeftDoubleRightDouble: "\u256A",
|
|
13841
|
+
lineCross: "\u2573",
|
|
13842
|
+
lineBackslash: "\u2572",
|
|
13843
|
+
lineSlash: "\u2571"
|
|
13335
13844
|
};
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
|
|
13845
|
+
var specialMainSymbols = {
|
|
13846
|
+
tick: "\u2714",
|
|
13847
|
+
info: "\u2139",
|
|
13848
|
+
warning: "\u26A0",
|
|
13849
|
+
cross: "\u2718",
|
|
13850
|
+
squareSmall: "\u25FB",
|
|
13851
|
+
squareSmallFilled: "\u25FC",
|
|
13852
|
+
circle: "\u25EF",
|
|
13853
|
+
circleFilled: "\u25C9",
|
|
13854
|
+
circleDotted: "\u25CC",
|
|
13855
|
+
circleDouble: "\u25CE",
|
|
13856
|
+
circleCircle: "\u24DE",
|
|
13857
|
+
circleCross: "\u24E7",
|
|
13858
|
+
circlePipe: "\u24BE",
|
|
13859
|
+
radioOn: "\u25C9",
|
|
13860
|
+
radioOff: "\u25EF",
|
|
13861
|
+
checkboxOn: "\u2612",
|
|
13862
|
+
checkboxOff: "\u2610",
|
|
13863
|
+
checkboxCircleOn: "\u24E7",
|
|
13864
|
+
checkboxCircleOff: "\u24BE",
|
|
13865
|
+
pointer: "\u276F",
|
|
13866
|
+
triangleUpOutline: "\u25B3",
|
|
13867
|
+
triangleLeft: "\u25C0",
|
|
13868
|
+
triangleRight: "\u25B6",
|
|
13869
|
+
lozenge: "\u25C6",
|
|
13870
|
+
lozengeOutline: "\u25C7",
|
|
13871
|
+
hamburger: "\u2630",
|
|
13872
|
+
smiley: "\u32E1",
|
|
13873
|
+
mustache: "\u0DF4",
|
|
13874
|
+
star: "\u2605",
|
|
13875
|
+
play: "\u25B6",
|
|
13876
|
+
nodejs: "\u2B22",
|
|
13877
|
+
oneSeventh: "\u2150",
|
|
13878
|
+
oneNinth: "\u2151",
|
|
13879
|
+
oneTenth: "\u2152"
|
|
13880
|
+
};
|
|
13881
|
+
var specialFallbackSymbols = {
|
|
13882
|
+
tick: "\u221A",
|
|
13883
|
+
info: "i",
|
|
13884
|
+
warning: "\u203C",
|
|
13885
|
+
cross: "\xD7",
|
|
13886
|
+
squareSmall: "\u25A1",
|
|
13887
|
+
squareSmallFilled: "\u25A0",
|
|
13888
|
+
circle: "( )",
|
|
13889
|
+
circleFilled: "(*)",
|
|
13890
|
+
circleDotted: "( )",
|
|
13891
|
+
circleDouble: "( )",
|
|
13892
|
+
circleCircle: "(\u25CB)",
|
|
13893
|
+
circleCross: "(\xD7)",
|
|
13894
|
+
circlePipe: "(\u2502)",
|
|
13895
|
+
radioOn: "(*)",
|
|
13896
|
+
radioOff: "( )",
|
|
13897
|
+
checkboxOn: "[\xD7]",
|
|
13898
|
+
checkboxOff: "[ ]",
|
|
13899
|
+
checkboxCircleOn: "(\xD7)",
|
|
13900
|
+
checkboxCircleOff: "( )",
|
|
13901
|
+
pointer: ">",
|
|
13902
|
+
triangleUpOutline: "\u2206",
|
|
13903
|
+
triangleLeft: "\u25C4",
|
|
13904
|
+
triangleRight: "\u25BA",
|
|
13905
|
+
lozenge: "\u2666",
|
|
13906
|
+
lozengeOutline: "\u25CA",
|
|
13907
|
+
hamburger: "\u2261",
|
|
13908
|
+
smiley: "\u263A",
|
|
13909
|
+
mustache: "\u250C\u2500\u2510",
|
|
13910
|
+
star: "\u2736",
|
|
13911
|
+
play: "\u25BA",
|
|
13912
|
+
nodejs: "\u2666",
|
|
13913
|
+
oneSeventh: "1/7",
|
|
13914
|
+
oneNinth: "1/9",
|
|
13915
|
+
oneTenth: "1/10"
|
|
13916
|
+
};
|
|
13917
|
+
var mainSymbols = {
|
|
13918
|
+
...common,
|
|
13919
|
+
...specialMainSymbols
|
|
13920
|
+
};
|
|
13921
|
+
var fallbackSymbols = {
|
|
13922
|
+
...common,
|
|
13923
|
+
...specialFallbackSymbols
|
|
13924
|
+
};
|
|
13925
|
+
var shouldUseMain = isUnicodeSupported();
|
|
13926
|
+
var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
13927
|
+
var dist_default = figures;
|
|
13928
|
+
var replacements = Object.entries(specialMainSymbols);
|
|
13929
|
+
|
|
13930
|
+
// node_modules/@inquirer/core/dist/lib/theme.js
|
|
13931
|
+
var defaultTheme = {
|
|
13932
|
+
prefix: {
|
|
13933
|
+
idle: (0, import_node_util.styleText)("blue", "?"),
|
|
13934
|
+
done: (0, import_node_util.styleText)("green", dist_default.tick)
|
|
13935
|
+
},
|
|
13936
|
+
spinner: {
|
|
13937
|
+
interval: 80,
|
|
13938
|
+
frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"].map((frame) => (0, import_node_util.styleText)("yellow", frame))
|
|
13939
|
+
},
|
|
13940
|
+
style: {
|
|
13941
|
+
answer: (text) => (0, import_node_util.styleText)("cyan", text),
|
|
13942
|
+
message: (text) => (0, import_node_util.styleText)("bold", text),
|
|
13943
|
+
error: (text) => (0, import_node_util.styleText)("red", `> ${text}`),
|
|
13944
|
+
defaultAnswer: (text) => (0, import_node_util.styleText)("dim", `(${text})`),
|
|
13945
|
+
help: (text) => (0, import_node_util.styleText)("dim", text),
|
|
13946
|
+
highlight: (text) => (0, import_node_util.styleText)("cyan", text),
|
|
13947
|
+
key: (text) => (0, import_node_util.styleText)("cyan", (0, import_node_util.styleText)("bold", `<${text}>`))
|
|
13341
13948
|
}
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
|
|
13949
|
+
};
|
|
13950
|
+
|
|
13951
|
+
// node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
13952
|
+
function isPlainObject(value) {
|
|
13953
|
+
if (typeof value !== "object" || value === null)
|
|
13954
|
+
return false;
|
|
13955
|
+
let proto2 = value;
|
|
13956
|
+
while (Object.getPrototypeOf(proto2) !== null) {
|
|
13957
|
+
proto2 = Object.getPrototypeOf(proto2);
|
|
13345
13958
|
}
|
|
13346
|
-
return
|
|
13959
|
+
return Object.getPrototypeOf(value) === proto2;
|
|
13347
13960
|
}
|
|
13348
|
-
function
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
Error.captureStackTrace(this, this.constructor);
|
|
13356
|
-
} else {
|
|
13357
|
-
this.stack = new Error().stack || "";
|
|
13961
|
+
function deepMerge(...objects) {
|
|
13962
|
+
const output = {};
|
|
13963
|
+
for (const obj of objects) {
|
|
13964
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
13965
|
+
const prevValue = output[key];
|
|
13966
|
+
output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
|
|
13967
|
+
}
|
|
13358
13968
|
}
|
|
13969
|
+
return output;
|
|
13359
13970
|
}
|
|
13360
|
-
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13971
|
+
function makeTheme(...themes) {
|
|
13972
|
+
const themesToMerge = [
|
|
13973
|
+
defaultTheme,
|
|
13974
|
+
...themes.filter((theme) => theme != null)
|
|
13975
|
+
];
|
|
13976
|
+
return deepMerge(...themesToMerge);
|
|
13977
|
+
}
|
|
13978
|
+
|
|
13979
|
+
// node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
13980
|
+
function usePrefix({ status = "idle", theme }) {
|
|
13981
|
+
const [showLoader, setShowLoader] = useState(false);
|
|
13982
|
+
const [tick, setTick] = useState(0);
|
|
13983
|
+
const { prefix, spinner } = makeTheme(theme);
|
|
13984
|
+
useEffect(() => {
|
|
13985
|
+
if (status === "loading") {
|
|
13986
|
+
let tickInterval;
|
|
13987
|
+
let inc = -1;
|
|
13988
|
+
const delayTimeout = setTimeout(() => {
|
|
13989
|
+
setShowLoader(true);
|
|
13990
|
+
tickInterval = setInterval(() => {
|
|
13991
|
+
inc = inc + 1;
|
|
13992
|
+
setTick(inc % spinner.frames.length);
|
|
13993
|
+
}, spinner.interval);
|
|
13994
|
+
}, 300);
|
|
13995
|
+
return () => {
|
|
13996
|
+
clearTimeout(delayTimeout);
|
|
13997
|
+
clearInterval(tickInterval);
|
|
13998
|
+
};
|
|
13999
|
+
} else {
|
|
14000
|
+
setShowLoader(false);
|
|
14001
|
+
}
|
|
14002
|
+
}, [status]);
|
|
14003
|
+
if (showLoader) {
|
|
14004
|
+
return spinner.frames[tick];
|
|
13377
14005
|
}
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
pos: position - lineStart + head.length
|
|
13381
|
-
// relative position
|
|
13382
|
-
};
|
|
14006
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
14007
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
13383
14008
|
}
|
|
13384
|
-
|
|
13385
|
-
|
|
14009
|
+
|
|
14010
|
+
// node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
14011
|
+
function useMemo(fn2, dependencies) {
|
|
14012
|
+
return withPointer((pointer) => {
|
|
14013
|
+
const prev = pointer.get();
|
|
14014
|
+
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
|
|
14015
|
+
const value = fn2();
|
|
14016
|
+
pointer.set({ value, dependencies });
|
|
14017
|
+
return value;
|
|
14018
|
+
}
|
|
14019
|
+
return prev.value;
|
|
14020
|
+
});
|
|
13386
14021
|
}
|
|
13387
|
-
|
|
13388
|
-
|
|
13389
|
-
|
|
13390
|
-
|
|
13391
|
-
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
14022
|
+
|
|
14023
|
+
// node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
14024
|
+
function useRef(val) {
|
|
14025
|
+
return useState({ current: val })[0];
|
|
14026
|
+
}
|
|
14027
|
+
|
|
14028
|
+
// node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
14029
|
+
function useKeypress(userHandler) {
|
|
14030
|
+
const signal = useRef(userHandler);
|
|
14031
|
+
signal.current = userHandler;
|
|
14032
|
+
useEffect((rl) => {
|
|
14033
|
+
let ignore = false;
|
|
14034
|
+
const handler = withUpdates((_input, event) => {
|
|
14035
|
+
if (ignore)
|
|
14036
|
+
return;
|
|
14037
|
+
void signal.current(event, rl);
|
|
14038
|
+
});
|
|
14039
|
+
rl.input.on("keypress", handler);
|
|
14040
|
+
return () => {
|
|
14041
|
+
ignore = true;
|
|
14042
|
+
rl.input.removeListener("keypress", handler);
|
|
14043
|
+
};
|
|
14044
|
+
}, []);
|
|
14045
|
+
}
|
|
14046
|
+
|
|
14047
|
+
// node_modules/@inquirer/core/dist/lib/utils.js
|
|
14048
|
+
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
14049
|
+
|
|
14050
|
+
// node_modules/fast-string-truncated-width/dist/utils.js
|
|
14051
|
+
var getCodePointsLength = /* @__PURE__ */ (() => {
|
|
14052
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
14053
|
+
return (input) => {
|
|
14054
|
+
let surrogatePairsNr = 0;
|
|
14055
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
14056
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
14057
|
+
surrogatePairsNr += 1;
|
|
14058
|
+
}
|
|
14059
|
+
return input.length - surrogatePairsNr;
|
|
14060
|
+
};
|
|
14061
|
+
})();
|
|
14062
|
+
var isFullWidth = (x) => {
|
|
14063
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
14064
|
+
};
|
|
14065
|
+
var isWideNotCJKTNotEmoji = (x) => {
|
|
14066
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
14067
|
+
};
|
|
14068
|
+
|
|
14069
|
+
// node_modules/fast-string-truncated-width/dist/index.js
|
|
14070
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
14071
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
14072
|
+
var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
14073
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
14074
|
+
var EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
14075
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
14076
|
+
var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
|
|
14077
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
14078
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
14079
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
14080
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
14081
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
14082
|
+
const ANSI_WIDTH = 0;
|
|
14083
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
14084
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
14085
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
14086
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
14087
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
14088
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
14089
|
+
const PARSE_BLOCKS = [
|
|
14090
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
14091
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
14092
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
14093
|
+
[TAB_RE, TAB_WIDTH],
|
|
14094
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
14095
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
14096
|
+
];
|
|
14097
|
+
let indexPrev = 0;
|
|
14098
|
+
let index = 0;
|
|
14099
|
+
let length = input.length;
|
|
14100
|
+
let lengthExtra = 0;
|
|
14101
|
+
let truncationEnabled = false;
|
|
14102
|
+
let truncationIndex = length;
|
|
14103
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
14104
|
+
let unmatchedStart = 0;
|
|
14105
|
+
let unmatchedEnd = 0;
|
|
14106
|
+
let width = 0;
|
|
14107
|
+
let widthExtra = 0;
|
|
14108
|
+
outer: while (true) {
|
|
14109
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
14110
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
14111
|
+
lengthExtra = 0;
|
|
14112
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
14113
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
14114
|
+
if (isFullWidth(codePoint)) {
|
|
14115
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
14116
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
14117
|
+
widthExtra = WIDE_WIDTH;
|
|
14118
|
+
} else {
|
|
14119
|
+
widthExtra = REGULAR_WIDTH;
|
|
14120
|
+
}
|
|
14121
|
+
if (width + widthExtra > truncationLimit) {
|
|
14122
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
14123
|
+
}
|
|
14124
|
+
if (width + widthExtra > LIMIT) {
|
|
14125
|
+
truncationEnabled = true;
|
|
14126
|
+
break outer;
|
|
14127
|
+
}
|
|
14128
|
+
lengthExtra += char.length;
|
|
14129
|
+
width += widthExtra;
|
|
14130
|
+
}
|
|
14131
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
14132
|
+
}
|
|
14133
|
+
if (index >= length) {
|
|
14134
|
+
break outer;
|
|
14135
|
+
}
|
|
14136
|
+
for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
|
|
14137
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
|
|
14138
|
+
BLOCK_RE.lastIndex = index;
|
|
14139
|
+
if (BLOCK_RE.test(input)) {
|
|
14140
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
14141
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
14142
|
+
if (width + widthExtra > truncationLimit) {
|
|
14143
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
14144
|
+
}
|
|
14145
|
+
if (width + widthExtra > LIMIT) {
|
|
14146
|
+
truncationEnabled = true;
|
|
14147
|
+
break outer;
|
|
14148
|
+
}
|
|
14149
|
+
width += widthExtra;
|
|
14150
|
+
unmatchedStart = indexPrev;
|
|
14151
|
+
unmatchedEnd = index;
|
|
14152
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
14153
|
+
continue outer;
|
|
14154
|
+
}
|
|
13404
14155
|
}
|
|
14156
|
+
index += 1;
|
|
13405
14157
|
}
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
14158
|
+
return {
|
|
14159
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
14160
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
14161
|
+
truncated: truncationEnabled,
|
|
14162
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
14163
|
+
};
|
|
14164
|
+
};
|
|
14165
|
+
var dist_default2 = getStringTruncatedWidth;
|
|
14166
|
+
|
|
14167
|
+
// node_modules/fast-string-width/dist/index.js
|
|
14168
|
+
var NO_TRUNCATION2 = {
|
|
14169
|
+
limit: Infinity,
|
|
14170
|
+
ellipsis: "",
|
|
14171
|
+
ellipsisWidth: 0
|
|
14172
|
+
};
|
|
14173
|
+
var fastStringWidth = (input, options = {}) => {
|
|
14174
|
+
return dist_default2(input, NO_TRUNCATION2, options).width;
|
|
14175
|
+
};
|
|
14176
|
+
var dist_default3 = fastStringWidth;
|
|
14177
|
+
|
|
14178
|
+
// node_modules/fast-wrap-ansi/lib/main.js
|
|
14179
|
+
var ESC = "\x1B";
|
|
14180
|
+
var CSI = "\x9B";
|
|
14181
|
+
var END_CODE = 39;
|
|
14182
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
14183
|
+
var ANSI_CSI = "[";
|
|
14184
|
+
var ANSI_OSC = "]";
|
|
14185
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
14186
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
14187
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
14188
|
+
var getClosingCode = (openingCode) => {
|
|
14189
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
14190
|
+
return 39;
|
|
14191
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
14192
|
+
return 39;
|
|
14193
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
14194
|
+
return 49;
|
|
14195
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
14196
|
+
return 49;
|
|
14197
|
+
if (openingCode === 1 || openingCode === 2)
|
|
14198
|
+
return 22;
|
|
14199
|
+
if (openingCode === 3)
|
|
14200
|
+
return 23;
|
|
14201
|
+
if (openingCode === 4)
|
|
14202
|
+
return 24;
|
|
14203
|
+
if (openingCode === 7)
|
|
14204
|
+
return 27;
|
|
14205
|
+
if (openingCode === 8)
|
|
14206
|
+
return 28;
|
|
14207
|
+
if (openingCode === 9)
|
|
14208
|
+
return 29;
|
|
14209
|
+
if (openingCode === 0)
|
|
14210
|
+
return 0;
|
|
14211
|
+
return void 0;
|
|
14212
|
+
};
|
|
14213
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
14214
|
+
var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
14215
|
+
var wrapWord = (rows, word, columns) => {
|
|
14216
|
+
const characters = word[Symbol.iterator]();
|
|
14217
|
+
let isInsideEscape = false;
|
|
14218
|
+
let isInsideLinkEscape = false;
|
|
14219
|
+
let lastRow = rows.at(-1);
|
|
14220
|
+
let visible = lastRow === void 0 ? 0 : dist_default3(lastRow);
|
|
14221
|
+
let currentCharacter = characters.next();
|
|
14222
|
+
let nextCharacter = characters.next();
|
|
14223
|
+
let rawCharacterIndex = 0;
|
|
14224
|
+
while (!currentCharacter.done) {
|
|
14225
|
+
const character = currentCharacter.value;
|
|
14226
|
+
const characterLength = dist_default3(character);
|
|
14227
|
+
if (visible + characterLength <= columns) {
|
|
14228
|
+
rows[rows.length - 1] += character;
|
|
14229
|
+
} else {
|
|
14230
|
+
rows.push(character);
|
|
14231
|
+
visible = 0;
|
|
14232
|
+
}
|
|
14233
|
+
if (character === ESC || character === CSI) {
|
|
14234
|
+
isInsideEscape = true;
|
|
14235
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
14236
|
+
}
|
|
14237
|
+
if (isInsideEscape) {
|
|
14238
|
+
if (isInsideLinkEscape) {
|
|
14239
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
14240
|
+
isInsideEscape = false;
|
|
14241
|
+
isInsideLinkEscape = false;
|
|
14242
|
+
}
|
|
14243
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
14244
|
+
isInsideEscape = false;
|
|
14245
|
+
}
|
|
14246
|
+
} else {
|
|
14247
|
+
visible += characterLength;
|
|
14248
|
+
if (visible === columns && !nextCharacter.done) {
|
|
14249
|
+
rows.push("");
|
|
14250
|
+
visible = 0;
|
|
14251
|
+
}
|
|
14252
|
+
}
|
|
14253
|
+
currentCharacter = nextCharacter;
|
|
14254
|
+
nextCharacter = characters.next();
|
|
14255
|
+
rawCharacterIndex += character.length;
|
|
14256
|
+
}
|
|
14257
|
+
lastRow = rows.at(-1);
|
|
14258
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
|
|
14259
|
+
rows[rows.length - 2] += rows.pop();
|
|
14260
|
+
}
|
|
14261
|
+
};
|
|
14262
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
14263
|
+
const words = string.split(" ");
|
|
14264
|
+
let last = words.length;
|
|
14265
|
+
while (last) {
|
|
14266
|
+
if (dist_default3(words[last - 1])) {
|
|
14267
|
+
break;
|
|
14268
|
+
}
|
|
14269
|
+
last--;
|
|
14270
|
+
}
|
|
14271
|
+
if (last === words.length) {
|
|
14272
|
+
return string;
|
|
14273
|
+
}
|
|
14274
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
14275
|
+
};
|
|
14276
|
+
var exec = (string, columns, options = {}) => {
|
|
14277
|
+
if (options.trim !== false && string.trim() === "") {
|
|
14278
|
+
return "";
|
|
14279
|
+
}
|
|
14280
|
+
let returnValue = "";
|
|
14281
|
+
let escapeCode;
|
|
14282
|
+
let escapeUrl;
|
|
14283
|
+
const words = string.split(" ");
|
|
14284
|
+
let rows = [""];
|
|
14285
|
+
let rowLength = 0;
|
|
14286
|
+
for (let index = 0; index < words.length; index++) {
|
|
14287
|
+
const word = words[index];
|
|
14288
|
+
if (options.trim !== false) {
|
|
14289
|
+
const row = rows.at(-1) ?? "";
|
|
14290
|
+
const trimmed = row.trimStart();
|
|
14291
|
+
if (row.length !== trimmed.length) {
|
|
14292
|
+
rows[rows.length - 1] = trimmed;
|
|
14293
|
+
rowLength = dist_default3(trimmed);
|
|
14294
|
+
}
|
|
14295
|
+
}
|
|
14296
|
+
if (index !== 0) {
|
|
14297
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
14298
|
+
rows.push("");
|
|
14299
|
+
rowLength = 0;
|
|
14300
|
+
}
|
|
14301
|
+
if (rowLength || options.trim === false) {
|
|
14302
|
+
rows[rows.length - 1] += " ";
|
|
14303
|
+
rowLength++;
|
|
14304
|
+
}
|
|
14305
|
+
}
|
|
14306
|
+
const wordLength = dist_default3(word);
|
|
14307
|
+
if (options.hard && wordLength > columns) {
|
|
14308
|
+
const remainingColumns = columns - rowLength;
|
|
14309
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
14310
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
14311
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
14312
|
+
rows.push("");
|
|
14313
|
+
}
|
|
14314
|
+
wrapWord(rows, word, columns);
|
|
14315
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
14316
|
+
continue;
|
|
14317
|
+
}
|
|
14318
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
14319
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
14320
|
+
wrapWord(rows, word, columns);
|
|
14321
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
14322
|
+
continue;
|
|
14323
|
+
}
|
|
14324
|
+
rows.push("");
|
|
14325
|
+
rowLength = 0;
|
|
14326
|
+
}
|
|
14327
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
14328
|
+
wrapWord(rows, word, columns);
|
|
14329
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
14330
|
+
continue;
|
|
14331
|
+
}
|
|
14332
|
+
rows[rows.length - 1] += word;
|
|
14333
|
+
rowLength += wordLength;
|
|
14334
|
+
}
|
|
14335
|
+
if (options.trim !== false) {
|
|
14336
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
14337
|
+
}
|
|
14338
|
+
const preString = rows.join("\n");
|
|
14339
|
+
let inSurrogate = false;
|
|
14340
|
+
for (let i = 0; i < preString.length; i++) {
|
|
14341
|
+
const character = preString[i];
|
|
14342
|
+
returnValue += character;
|
|
14343
|
+
if (!inSurrogate) {
|
|
14344
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
14345
|
+
if (inSurrogate) {
|
|
14346
|
+
continue;
|
|
14347
|
+
}
|
|
14348
|
+
} else {
|
|
14349
|
+
inSurrogate = false;
|
|
14350
|
+
}
|
|
14351
|
+
if (character === ESC || character === CSI) {
|
|
14352
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
14353
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
14354
|
+
const groups = groupsResult?.groups;
|
|
14355
|
+
if (groups?.code !== void 0) {
|
|
14356
|
+
const code = Number.parseFloat(groups.code);
|
|
14357
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
14358
|
+
} else if (groups?.uri !== void 0) {
|
|
14359
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
14360
|
+
}
|
|
14361
|
+
}
|
|
14362
|
+
if (preString[i + 1] === "\n") {
|
|
14363
|
+
if (escapeUrl) {
|
|
14364
|
+
returnValue += wrapAnsiHyperlink("");
|
|
14365
|
+
}
|
|
14366
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
14367
|
+
if (escapeCode && closingCode) {
|
|
14368
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
14369
|
+
}
|
|
14370
|
+
} else if (character === "\n") {
|
|
14371
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
14372
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
14373
|
+
}
|
|
14374
|
+
if (escapeUrl) {
|
|
14375
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
14376
|
+
}
|
|
14377
|
+
}
|
|
14378
|
+
}
|
|
14379
|
+
return returnValue;
|
|
14380
|
+
};
|
|
14381
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
14382
|
+
function wrapAnsi(string, columns, options) {
|
|
14383
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
14384
|
+
}
|
|
14385
|
+
|
|
14386
|
+
// node_modules/@inquirer/core/dist/lib/utils.js
|
|
14387
|
+
function breakLines(content, width) {
|
|
14388
|
+
return content.split("\n").flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split("\n").map((str2) => str2.trimEnd())).join("\n");
|
|
14389
|
+
}
|
|
14390
|
+
function readlineWidth() {
|
|
14391
|
+
return (0, import_cli_width.default)({ defaultWidth: 80, output: readline().output });
|
|
14392
|
+
}
|
|
14393
|
+
|
|
14394
|
+
// node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
14395
|
+
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
14396
|
+
const state = useRef({
|
|
14397
|
+
lastPointer: active,
|
|
14398
|
+
lastActive: void 0
|
|
14399
|
+
});
|
|
14400
|
+
const { lastPointer, lastActive } = state.current;
|
|
14401
|
+
const middle = Math.floor(pageSize / 2);
|
|
14402
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
14403
|
+
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
|
14404
|
+
let pointer = defaultPointerPosition;
|
|
14405
|
+
if (renderedLength > pageSize) {
|
|
14406
|
+
if (loop) {
|
|
14407
|
+
pointer = lastPointer;
|
|
14408
|
+
if (
|
|
14409
|
+
// First render, skip this logic.
|
|
14410
|
+
lastActive != null && // Only move the pointer down when the user moves down.
|
|
14411
|
+
lastActive < active && // Check user didn't move up across page boundary.
|
|
14412
|
+
active - lastActive < pageSize
|
|
14413
|
+
) {
|
|
14414
|
+
pointer = Math.min(
|
|
14415
|
+
// Furthest allowed position for the pointer is the middle of the list
|
|
14416
|
+
middle,
|
|
14417
|
+
Math.abs(active - lastActive) === 1 ? Math.min(
|
|
14418
|
+
// Move the pointer at most the height of the last active item.
|
|
14419
|
+
lastPointer + (renderedItems[lastActive]?.length ?? 0),
|
|
14420
|
+
// If the user moved by one item, move the pointer to the natural position of the active item as
|
|
14421
|
+
// long as it doesn't move the cursor up.
|
|
14422
|
+
Math.max(defaultPointerPosition, lastPointer)
|
|
14423
|
+
) : (
|
|
14424
|
+
// Otherwise, move the pointer down by the difference between the active and last active item.
|
|
14425
|
+
lastPointer + active - lastActive
|
|
14426
|
+
)
|
|
14427
|
+
);
|
|
14428
|
+
}
|
|
14429
|
+
} else {
|
|
14430
|
+
const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
|
|
14431
|
+
pointer = spaceUnderActive < pageSize - middle ? (
|
|
14432
|
+
// If the active item is near the end of the list, progressively move the cursor towards the end.
|
|
14433
|
+
pageSize - spaceUnderActive
|
|
14434
|
+
) : (
|
|
14435
|
+
// Otherwise, progressively move the pointer to the middle of the list.
|
|
14436
|
+
Math.min(defaultPointerPosition, middle)
|
|
14437
|
+
);
|
|
14438
|
+
}
|
|
14439
|
+
}
|
|
14440
|
+
state.current.lastPointer = pointer;
|
|
14441
|
+
state.current.lastActive = active;
|
|
14442
|
+
return pointer;
|
|
14443
|
+
}
|
|
14444
|
+
function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
14445
|
+
const width = readlineWidth();
|
|
14446
|
+
const bound = (num) => (num % items.length + items.length) % items.length;
|
|
14447
|
+
const renderedItems = items.map((item, index) => {
|
|
14448
|
+
if (item == null)
|
|
14449
|
+
return [];
|
|
14450
|
+
return breakLines(renderItem({ item, index, isActive: index === active }), width).split("\n");
|
|
14451
|
+
});
|
|
14452
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
14453
|
+
const renderItemAtIndex = (index) => renderedItems[index] ?? [];
|
|
14454
|
+
const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
|
|
14455
|
+
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
|
14456
|
+
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
|
14457
|
+
const pageBuffer = Array.from({ length: pageSize });
|
|
14458
|
+
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
|
14459
|
+
const itemVisited = /* @__PURE__ */ new Set([active]);
|
|
14460
|
+
let bufferPointer = activeItemPosition + activeItem.length;
|
|
14461
|
+
let itemPointer = bound(active + 1);
|
|
14462
|
+
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
|
14463
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
14464
|
+
const linesToAdd = lines.slice(0, pageSize - bufferPointer);
|
|
14465
|
+
pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
|
|
14466
|
+
itemVisited.add(itemPointer);
|
|
14467
|
+
bufferPointer += linesToAdd.length;
|
|
14468
|
+
itemPointer = bound(itemPointer + 1);
|
|
14469
|
+
}
|
|
14470
|
+
bufferPointer = activeItemPosition - 1;
|
|
14471
|
+
itemPointer = bound(active - 1);
|
|
14472
|
+
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
|
14473
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
14474
|
+
const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
|
|
14475
|
+
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
|
14476
|
+
itemVisited.add(itemPointer);
|
|
14477
|
+
bufferPointer -= linesToAdd.length;
|
|
14478
|
+
itemPointer = bound(itemPointer - 1);
|
|
14479
|
+
}
|
|
14480
|
+
return pageBuffer.filter((line) => typeof line === "string").join("\n");
|
|
14481
|
+
}
|
|
14482
|
+
|
|
14483
|
+
// node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
14484
|
+
var readline2 = __toESM(require("readline"), 1);
|
|
14485
|
+
var import_node_async_hooks3 = require("async_hooks");
|
|
14486
|
+
var import_mute_stream = __toESM(require_lib(), 1);
|
|
14487
|
+
|
|
14488
|
+
// node_modules/signal-exit/dist/mjs/signals.js
|
|
14489
|
+
var signals = [];
|
|
14490
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
14491
|
+
if (process.platform !== "win32") {
|
|
14492
|
+
signals.push(
|
|
14493
|
+
"SIGALRM",
|
|
14494
|
+
"SIGABRT",
|
|
14495
|
+
"SIGVTALRM",
|
|
14496
|
+
"SIGXCPU",
|
|
14497
|
+
"SIGXFSZ",
|
|
14498
|
+
"SIGUSR2",
|
|
14499
|
+
"SIGTRAP",
|
|
14500
|
+
"SIGSYS",
|
|
14501
|
+
"SIGQUIT",
|
|
14502
|
+
"SIGIOT"
|
|
14503
|
+
// should detect profiler and enable/disable accordingly.
|
|
14504
|
+
// see #21
|
|
14505
|
+
// 'SIGPROF'
|
|
14506
|
+
);
|
|
14507
|
+
}
|
|
14508
|
+
if (process.platform === "linux") {
|
|
14509
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
14510
|
+
}
|
|
14511
|
+
|
|
14512
|
+
// node_modules/signal-exit/dist/mjs/index.js
|
|
14513
|
+
var processOk = (process5) => !!process5 && typeof process5 === "object" && typeof process5.removeListener === "function" && typeof process5.emit === "function" && typeof process5.reallyExit === "function" && typeof process5.listeners === "function" && typeof process5.kill === "function" && typeof process5.pid === "number" && typeof process5.on === "function";
|
|
14514
|
+
var kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
|
|
14515
|
+
var global2 = globalThis;
|
|
14516
|
+
var ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
14517
|
+
var Emitter = class {
|
|
14518
|
+
emitted = {
|
|
14519
|
+
afterExit: false,
|
|
14520
|
+
exit: false
|
|
14521
|
+
};
|
|
14522
|
+
listeners = {
|
|
14523
|
+
afterExit: [],
|
|
14524
|
+
exit: []
|
|
14525
|
+
};
|
|
14526
|
+
count = 0;
|
|
14527
|
+
id = Math.random();
|
|
14528
|
+
constructor() {
|
|
14529
|
+
if (global2[kExitEmitter]) {
|
|
14530
|
+
return global2[kExitEmitter];
|
|
14531
|
+
}
|
|
14532
|
+
ObjectDefineProperty(global2, kExitEmitter, {
|
|
14533
|
+
value: this,
|
|
14534
|
+
writable: false,
|
|
14535
|
+
enumerable: false,
|
|
14536
|
+
configurable: false
|
|
14537
|
+
});
|
|
14538
|
+
}
|
|
14539
|
+
on(ev, fn2) {
|
|
14540
|
+
this.listeners[ev].push(fn2);
|
|
14541
|
+
}
|
|
14542
|
+
removeListener(ev, fn2) {
|
|
14543
|
+
const list = this.listeners[ev];
|
|
14544
|
+
const i = list.indexOf(fn2);
|
|
14545
|
+
if (i === -1) {
|
|
14546
|
+
return;
|
|
14547
|
+
}
|
|
14548
|
+
if (i === 0 && list.length === 1) {
|
|
14549
|
+
list.length = 0;
|
|
14550
|
+
} else {
|
|
14551
|
+
list.splice(i, 1);
|
|
14552
|
+
}
|
|
14553
|
+
}
|
|
14554
|
+
emit(ev, code, signal) {
|
|
14555
|
+
if (this.emitted[ev]) {
|
|
14556
|
+
return false;
|
|
14557
|
+
}
|
|
14558
|
+
this.emitted[ev] = true;
|
|
14559
|
+
let ret = false;
|
|
14560
|
+
for (const fn2 of this.listeners[ev]) {
|
|
14561
|
+
ret = fn2(code, signal) === true || ret;
|
|
14562
|
+
}
|
|
14563
|
+
if (ev === "exit") {
|
|
14564
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
14565
|
+
}
|
|
14566
|
+
return ret;
|
|
14567
|
+
}
|
|
14568
|
+
};
|
|
14569
|
+
var SignalExitBase = class {
|
|
14570
|
+
};
|
|
14571
|
+
var signalExitWrap = (handler) => {
|
|
14572
|
+
return {
|
|
14573
|
+
onExit(cb, opts) {
|
|
14574
|
+
return handler.onExit(cb, opts);
|
|
14575
|
+
},
|
|
14576
|
+
load() {
|
|
14577
|
+
return handler.load();
|
|
14578
|
+
},
|
|
14579
|
+
unload() {
|
|
14580
|
+
return handler.unload();
|
|
14581
|
+
}
|
|
14582
|
+
};
|
|
14583
|
+
};
|
|
14584
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
14585
|
+
onExit() {
|
|
14586
|
+
return () => {
|
|
14587
|
+
};
|
|
14588
|
+
}
|
|
14589
|
+
load() {
|
|
14590
|
+
}
|
|
14591
|
+
unload() {
|
|
14592
|
+
}
|
|
14593
|
+
};
|
|
14594
|
+
var SignalExit = class extends SignalExitBase {
|
|
14595
|
+
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
14596
|
+
// so use a supported signal instead
|
|
14597
|
+
/* c8 ignore start */
|
|
14598
|
+
#hupSig = process4.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
14599
|
+
/* c8 ignore stop */
|
|
14600
|
+
#emitter = new Emitter();
|
|
14601
|
+
#process;
|
|
14602
|
+
#originalProcessEmit;
|
|
14603
|
+
#originalProcessReallyExit;
|
|
14604
|
+
#sigListeners = {};
|
|
14605
|
+
#loaded = false;
|
|
14606
|
+
constructor(process5) {
|
|
14607
|
+
super();
|
|
14608
|
+
this.#process = process5;
|
|
14609
|
+
this.#sigListeners = {};
|
|
14610
|
+
for (const sig of signals) {
|
|
14611
|
+
this.#sigListeners[sig] = () => {
|
|
14612
|
+
const listeners = this.#process.listeners(sig);
|
|
14613
|
+
let { count } = this.#emitter;
|
|
14614
|
+
const p2 = process5;
|
|
14615
|
+
if (typeof p2.__signal_exit_emitter__ === "object" && typeof p2.__signal_exit_emitter__.count === "number") {
|
|
14616
|
+
count += p2.__signal_exit_emitter__.count;
|
|
14617
|
+
}
|
|
14618
|
+
if (listeners.length === count) {
|
|
14619
|
+
this.unload();
|
|
14620
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
14621
|
+
const s3 = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
14622
|
+
if (!ret)
|
|
14623
|
+
process5.kill(process5.pid, s3);
|
|
14624
|
+
}
|
|
14625
|
+
};
|
|
14626
|
+
}
|
|
14627
|
+
this.#originalProcessReallyExit = process5.reallyExit;
|
|
14628
|
+
this.#originalProcessEmit = process5.emit;
|
|
14629
|
+
}
|
|
14630
|
+
onExit(cb, opts) {
|
|
14631
|
+
if (!processOk(this.#process)) {
|
|
14632
|
+
return () => {
|
|
14633
|
+
};
|
|
14634
|
+
}
|
|
14635
|
+
if (this.#loaded === false) {
|
|
14636
|
+
this.load();
|
|
14637
|
+
}
|
|
14638
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
14639
|
+
this.#emitter.on(ev, cb);
|
|
14640
|
+
return () => {
|
|
14641
|
+
this.#emitter.removeListener(ev, cb);
|
|
14642
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
14643
|
+
this.unload();
|
|
14644
|
+
}
|
|
14645
|
+
};
|
|
14646
|
+
}
|
|
14647
|
+
load() {
|
|
14648
|
+
if (this.#loaded) {
|
|
14649
|
+
return;
|
|
14650
|
+
}
|
|
14651
|
+
this.#loaded = true;
|
|
14652
|
+
this.#emitter.count += 1;
|
|
14653
|
+
for (const sig of signals) {
|
|
14654
|
+
try {
|
|
14655
|
+
const fn2 = this.#sigListeners[sig];
|
|
14656
|
+
if (fn2)
|
|
14657
|
+
this.#process.on(sig, fn2);
|
|
14658
|
+
} catch (_2) {
|
|
14659
|
+
}
|
|
14660
|
+
}
|
|
14661
|
+
this.#process.emit = (ev, ...a) => {
|
|
14662
|
+
return this.#processEmit(ev, ...a);
|
|
14663
|
+
};
|
|
14664
|
+
this.#process.reallyExit = (code) => {
|
|
14665
|
+
return this.#processReallyExit(code);
|
|
14666
|
+
};
|
|
14667
|
+
}
|
|
14668
|
+
unload() {
|
|
14669
|
+
if (!this.#loaded) {
|
|
14670
|
+
return;
|
|
14671
|
+
}
|
|
14672
|
+
this.#loaded = false;
|
|
14673
|
+
signals.forEach((sig) => {
|
|
14674
|
+
const listener = this.#sigListeners[sig];
|
|
14675
|
+
if (!listener) {
|
|
14676
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
14677
|
+
}
|
|
14678
|
+
try {
|
|
14679
|
+
this.#process.removeListener(sig, listener);
|
|
14680
|
+
} catch (_2) {
|
|
14681
|
+
}
|
|
14682
|
+
});
|
|
14683
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
14684
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
14685
|
+
this.#emitter.count -= 1;
|
|
14686
|
+
}
|
|
14687
|
+
#processReallyExit(code) {
|
|
14688
|
+
if (!processOk(this.#process)) {
|
|
14689
|
+
return 0;
|
|
14690
|
+
}
|
|
14691
|
+
this.#process.exitCode = code || 0;
|
|
14692
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
14693
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
14694
|
+
}
|
|
14695
|
+
#processEmit(ev, ...args) {
|
|
14696
|
+
const og = this.#originalProcessEmit;
|
|
14697
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
14698
|
+
if (typeof args[0] === "number") {
|
|
14699
|
+
this.#process.exitCode = args[0];
|
|
14700
|
+
}
|
|
14701
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
14702
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
14703
|
+
return ret;
|
|
14704
|
+
} else {
|
|
14705
|
+
return og.call(this.#process, ev, ...args);
|
|
14706
|
+
}
|
|
14707
|
+
}
|
|
14708
|
+
};
|
|
14709
|
+
var process4 = globalThis.process;
|
|
14710
|
+
var {
|
|
14711
|
+
/**
|
|
14712
|
+
* Called when the process is exiting, whether via signal, explicit
|
|
14713
|
+
* exit, or running out of stuff to do.
|
|
14714
|
+
*
|
|
14715
|
+
* If the global process object is not suitable for instrumentation,
|
|
14716
|
+
* then this will be a no-op.
|
|
14717
|
+
*
|
|
14718
|
+
* Returns a function that may be used to unload signal-exit.
|
|
14719
|
+
*/
|
|
14720
|
+
onExit,
|
|
14721
|
+
/**
|
|
14722
|
+
* Load the listeners. Likely you never need to call this, unless
|
|
14723
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
14724
|
+
* Mostly exposed for the benefit of testing.
|
|
14725
|
+
*
|
|
14726
|
+
* @internal
|
|
14727
|
+
*/
|
|
14728
|
+
load,
|
|
14729
|
+
/**
|
|
14730
|
+
* Unload the listeners. Likely you never need to call this, unless
|
|
14731
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
14732
|
+
* Mostly exposed for the benefit of testing.
|
|
14733
|
+
*
|
|
14734
|
+
* @internal
|
|
14735
|
+
*/
|
|
14736
|
+
unload
|
|
14737
|
+
} = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback());
|
|
14738
|
+
|
|
14739
|
+
// node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
14740
|
+
var import_node_util2 = require("util");
|
|
14741
|
+
|
|
14742
|
+
// node_modules/@inquirer/ansi/dist/index.js
|
|
14743
|
+
var ESC2 = "\x1B[";
|
|
14744
|
+
var cursorLeft = ESC2 + "G";
|
|
14745
|
+
var cursorHide = ESC2 + "?25l";
|
|
14746
|
+
var cursorShow = ESC2 + "?25h";
|
|
14747
|
+
var cursorUp = (rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "";
|
|
14748
|
+
var cursorDown = (rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "";
|
|
14749
|
+
var cursorTo = (x, y2) => {
|
|
14750
|
+
if (typeof y2 === "number" && !Number.isNaN(y2)) {
|
|
14751
|
+
return `${ESC2}${y2 + 1};${x + 1}H`;
|
|
14752
|
+
}
|
|
14753
|
+
return `${ESC2}${x + 1}G`;
|
|
14754
|
+
};
|
|
14755
|
+
var eraseLine = ESC2 + "2K";
|
|
14756
|
+
var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
14757
|
+
|
|
14758
|
+
// node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
14759
|
+
var height = (content) => content.split("\n").length;
|
|
14760
|
+
var lastLine = (content) => content.split("\n").pop() ?? "";
|
|
14761
|
+
var ScreenManager = class {
|
|
14762
|
+
// These variables are keeping information to allow correct prompt re-rendering
|
|
14763
|
+
height = 0;
|
|
14764
|
+
extraLinesUnderPrompt = 0;
|
|
14765
|
+
cursorPos;
|
|
14766
|
+
rl;
|
|
14767
|
+
constructor(rl) {
|
|
14768
|
+
this.rl = rl;
|
|
14769
|
+
this.cursorPos = rl.getCursorPos();
|
|
14770
|
+
}
|
|
14771
|
+
write(content) {
|
|
14772
|
+
this.rl.output.unmute();
|
|
14773
|
+
this.rl.output.write(content);
|
|
14774
|
+
this.rl.output.mute();
|
|
14775
|
+
}
|
|
14776
|
+
render(content, bottomContent = "") {
|
|
14777
|
+
const promptLine = lastLine(content);
|
|
14778
|
+
const rawPromptLine = (0, import_node_util2.stripVTControlCharacters)(promptLine);
|
|
14779
|
+
let prompt = rawPromptLine;
|
|
14780
|
+
if (this.rl.line.length > 0) {
|
|
14781
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
14782
|
+
}
|
|
14783
|
+
this.rl.setPrompt(prompt);
|
|
14784
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
14785
|
+
const width = readlineWidth();
|
|
14786
|
+
content = breakLines(content, width);
|
|
14787
|
+
bottomContent = breakLines(bottomContent, width);
|
|
14788
|
+
if (rawPromptLine.length % width === 0) {
|
|
14789
|
+
content += "\n";
|
|
14790
|
+
}
|
|
14791
|
+
let output = content + (bottomContent ? "\n" + bottomContent : "");
|
|
14792
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
14793
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
|
|
14794
|
+
if (bottomContentHeight > 0)
|
|
14795
|
+
output += cursorUp(bottomContentHeight);
|
|
14796
|
+
output += cursorTo(this.cursorPos.cols);
|
|
14797
|
+
this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
|
|
14798
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
14799
|
+
this.height = height(output);
|
|
14800
|
+
}
|
|
14801
|
+
checkCursorPos() {
|
|
14802
|
+
const cursorPos = this.rl.getCursorPos();
|
|
14803
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
14804
|
+
this.write(cursorTo(cursorPos.cols));
|
|
14805
|
+
this.cursorPos = cursorPos;
|
|
14806
|
+
}
|
|
14807
|
+
}
|
|
14808
|
+
done({ clearContent }) {
|
|
14809
|
+
this.rl.setPrompt("");
|
|
14810
|
+
let output = cursorDown(this.extraLinesUnderPrompt);
|
|
14811
|
+
output += clearContent ? eraseLines(this.height) : "\n";
|
|
14812
|
+
output += cursorShow;
|
|
14813
|
+
this.write(output);
|
|
14814
|
+
this.rl.close();
|
|
14815
|
+
}
|
|
14816
|
+
};
|
|
14817
|
+
|
|
14818
|
+
// node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
14819
|
+
var PromisePolyfill = class extends Promise {
|
|
14820
|
+
// Available starting from Node 22
|
|
14821
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
|
|
14822
|
+
static withResolver() {
|
|
14823
|
+
let resolve;
|
|
14824
|
+
let reject;
|
|
14825
|
+
const promise = new Promise((res, rej) => {
|
|
14826
|
+
resolve = res;
|
|
14827
|
+
reject = rej;
|
|
14828
|
+
});
|
|
14829
|
+
return { promise, resolve, reject };
|
|
14830
|
+
}
|
|
14831
|
+
};
|
|
14832
|
+
|
|
14833
|
+
// node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
14834
|
+
var nativeSetImmediate = globalThis.setImmediate;
|
|
14835
|
+
function getCallSites() {
|
|
14836
|
+
const _prepareStackTrace = Error.prepareStackTrace;
|
|
14837
|
+
let result = [];
|
|
14838
|
+
try {
|
|
14839
|
+
Error.prepareStackTrace = (_2, callSites) => {
|
|
14840
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
14841
|
+
result = callSitesWithoutCurrent;
|
|
14842
|
+
return callSitesWithoutCurrent;
|
|
14843
|
+
};
|
|
14844
|
+
new Error().stack;
|
|
14845
|
+
} catch {
|
|
14846
|
+
return result;
|
|
14847
|
+
}
|
|
14848
|
+
Error.prepareStackTrace = _prepareStackTrace;
|
|
14849
|
+
return result;
|
|
14850
|
+
}
|
|
14851
|
+
function createPrompt(view) {
|
|
14852
|
+
const callSites = getCallSites();
|
|
14853
|
+
const prompt = (config, context = {}) => {
|
|
14854
|
+
const { input = process.stdin, signal } = context;
|
|
14855
|
+
const cleanups = /* @__PURE__ */ new Set();
|
|
14856
|
+
const output = new import_mute_stream.default();
|
|
14857
|
+
output.pipe(context.output ?? process.stdout);
|
|
14858
|
+
output.mute();
|
|
14859
|
+
const rl = readline2.createInterface({
|
|
14860
|
+
terminal: true,
|
|
14861
|
+
input,
|
|
14862
|
+
output
|
|
14863
|
+
});
|
|
14864
|
+
const screen = new ScreenManager(rl);
|
|
14865
|
+
const { promise, resolve, reject } = PromisePolyfill.withResolver();
|
|
14866
|
+
const cancel = () => reject(new CancelPromptError());
|
|
14867
|
+
if (signal) {
|
|
14868
|
+
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
14869
|
+
if (signal.aborted) {
|
|
14870
|
+
abort();
|
|
14871
|
+
return Object.assign(promise, { cancel });
|
|
14872
|
+
}
|
|
14873
|
+
signal.addEventListener("abort", abort);
|
|
14874
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
14875
|
+
}
|
|
14876
|
+
cleanups.add(onExit((code, signal2) => {
|
|
14877
|
+
reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
|
|
14878
|
+
}));
|
|
14879
|
+
const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
|
|
14880
|
+
rl.on("SIGINT", sigint);
|
|
14881
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
14882
|
+
return withHooks(rl, (cycle) => {
|
|
14883
|
+
const hooksCleanup = import_node_async_hooks3.AsyncResource.bind(() => effectScheduler.clearAll());
|
|
14884
|
+
rl.on("close", hooksCleanup);
|
|
14885
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
14886
|
+
const startCycle = () => {
|
|
14887
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
14888
|
+
rl.input.on("keypress", checkCursorPos);
|
|
14889
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
14890
|
+
cycle(() => {
|
|
14891
|
+
try {
|
|
14892
|
+
const nextView = view(config, (value) => {
|
|
14893
|
+
setImmediate(() => resolve(value));
|
|
14894
|
+
});
|
|
14895
|
+
if (nextView === void 0) {
|
|
14896
|
+
const callerFilename = callSites[1]?.getFileName();
|
|
14897
|
+
throw new Error(`Prompt functions must return a string.
|
|
14898
|
+
at ${callerFilename}`);
|
|
14899
|
+
}
|
|
14900
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
14901
|
+
screen.render(content, bottomContent);
|
|
14902
|
+
effectScheduler.run();
|
|
14903
|
+
} catch (error) {
|
|
14904
|
+
reject(error);
|
|
14905
|
+
}
|
|
14906
|
+
});
|
|
14907
|
+
};
|
|
14908
|
+
if ("readableFlowing" in input) {
|
|
14909
|
+
nativeSetImmediate(startCycle);
|
|
14910
|
+
} else {
|
|
14911
|
+
startCycle();
|
|
14912
|
+
}
|
|
14913
|
+
return Object.assign(promise.then((answer) => {
|
|
14914
|
+
effectScheduler.clearAll();
|
|
14915
|
+
return answer;
|
|
14916
|
+
}, (error) => {
|
|
14917
|
+
effectScheduler.clearAll();
|
|
14918
|
+
throw error;
|
|
14919
|
+
}).finally(() => {
|
|
14920
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
14921
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
14922
|
+
output.end();
|
|
14923
|
+
}).then(() => promise), { cancel });
|
|
14924
|
+
});
|
|
14925
|
+
};
|
|
14926
|
+
return prompt;
|
|
14927
|
+
}
|
|
14928
|
+
|
|
14929
|
+
// node_modules/@inquirer/core/dist/lib/Separator.js
|
|
14930
|
+
var import_node_util3 = require("util");
|
|
14931
|
+
var Separator = class {
|
|
14932
|
+
separator = (0, import_node_util3.styleText)("dim", Array.from({ length: 15 }).join(dist_default.line));
|
|
14933
|
+
type = "separator";
|
|
14934
|
+
constructor(separator) {
|
|
14935
|
+
if (separator) {
|
|
14936
|
+
this.separator = separator;
|
|
14937
|
+
}
|
|
14938
|
+
}
|
|
14939
|
+
static isSeparator(choice) {
|
|
14940
|
+
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
14941
|
+
}
|
|
14942
|
+
};
|
|
14943
|
+
|
|
14944
|
+
// node_modules/@inquirer/checkbox/dist/index.js
|
|
14945
|
+
var import_node_util4 = require("util");
|
|
14946
|
+
var checkboxTheme = {
|
|
14947
|
+
icon: {
|
|
14948
|
+
checked: (0, import_node_util4.styleText)("green", dist_default.circleFilled),
|
|
14949
|
+
unchecked: dist_default.circle,
|
|
14950
|
+
cursor: dist_default.pointer,
|
|
14951
|
+
disabledChecked: (0, import_node_util4.styleText)("green", dist_default.circleDouble),
|
|
14952
|
+
disabledUnchecked: "-"
|
|
14953
|
+
},
|
|
14954
|
+
style: {
|
|
14955
|
+
disabled: (text) => (0, import_node_util4.styleText)("dim", text),
|
|
14956
|
+
renderSelectedChoices: (selectedChoices) => selectedChoices.map((choice) => choice.short).join(", "),
|
|
14957
|
+
description: (text) => (0, import_node_util4.styleText)("cyan", text),
|
|
14958
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${(0, import_node_util4.styleText)("bold", key)} ${(0, import_node_util4.styleText)("dim", action)}`).join((0, import_node_util4.styleText)("dim", " \u2022 "))
|
|
14959
|
+
},
|
|
14960
|
+
i18n: { disabledError: "This option is disabled and cannot be toggled." },
|
|
14961
|
+
keybindings: []
|
|
14962
|
+
};
|
|
14963
|
+
function isSelectable(item) {
|
|
14964
|
+
return !Separator.isSeparator(item) && !item.disabled;
|
|
14965
|
+
}
|
|
14966
|
+
function isNavigable(item) {
|
|
14967
|
+
return !Separator.isSeparator(item);
|
|
14968
|
+
}
|
|
14969
|
+
function isChecked(item) {
|
|
14970
|
+
return !Separator.isSeparator(item) && item.checked;
|
|
14971
|
+
}
|
|
14972
|
+
function toggle(item) {
|
|
14973
|
+
return isSelectable(item) ? { ...item, checked: !item.checked } : item;
|
|
14974
|
+
}
|
|
14975
|
+
function check(checked) {
|
|
14976
|
+
return function(item) {
|
|
14977
|
+
return isSelectable(item) ? { ...item, checked } : item;
|
|
14978
|
+
};
|
|
14979
|
+
}
|
|
14980
|
+
function normalizeChoices(choices) {
|
|
14981
|
+
return choices.map((choice) => {
|
|
14982
|
+
if (Separator.isSeparator(choice))
|
|
14983
|
+
return choice;
|
|
14984
|
+
if (typeof choice === "string") {
|
|
14985
|
+
return {
|
|
14986
|
+
value: choice,
|
|
14987
|
+
name: choice,
|
|
14988
|
+
short: choice,
|
|
14989
|
+
checkedName: choice,
|
|
14990
|
+
disabled: false,
|
|
14991
|
+
checked: false
|
|
14992
|
+
};
|
|
14993
|
+
}
|
|
14994
|
+
const name = choice.name ?? String(choice.value);
|
|
14995
|
+
const normalizedChoice = {
|
|
14996
|
+
value: choice.value,
|
|
14997
|
+
name,
|
|
14998
|
+
short: choice.short ?? name,
|
|
14999
|
+
checkedName: choice.checkedName ?? name,
|
|
15000
|
+
disabled: choice.disabled ?? false,
|
|
15001
|
+
checked: choice.checked ?? false
|
|
15002
|
+
};
|
|
15003
|
+
if (choice.description) {
|
|
15004
|
+
normalizedChoice.description = choice.description;
|
|
15005
|
+
}
|
|
15006
|
+
return normalizedChoice;
|
|
15007
|
+
});
|
|
15008
|
+
}
|
|
15009
|
+
var dist_default4 = createPrompt((config, done) => {
|
|
15010
|
+
const { pageSize = 7, loop = true, required, validate = () => true } = config;
|
|
15011
|
+
const shortcuts = { all: "a", invert: "i", ...config.shortcuts };
|
|
15012
|
+
const theme = makeTheme(checkboxTheme, config.theme);
|
|
15013
|
+
const { keybindings } = theme;
|
|
15014
|
+
const [status, setStatus] = useState("idle");
|
|
15015
|
+
const prefix = usePrefix({ status, theme });
|
|
15016
|
+
const [items, setItems] = useState(normalizeChoices(config.choices));
|
|
15017
|
+
const bounds = useMemo(() => {
|
|
15018
|
+
const first = items.findIndex(isNavigable);
|
|
15019
|
+
const last = items.findLastIndex(isNavigable);
|
|
15020
|
+
if (first === -1) {
|
|
15021
|
+
throw new ValidationError("[checkbox prompt] No selectable choices. All choices are disabled.");
|
|
15022
|
+
}
|
|
15023
|
+
return { first, last };
|
|
15024
|
+
}, [items]);
|
|
15025
|
+
const [active, setActive] = useState(bounds.first);
|
|
15026
|
+
const [errorMsg, setError] = useState();
|
|
15027
|
+
useKeypress(async (key) => {
|
|
15028
|
+
if (isEnterKey(key)) {
|
|
15029
|
+
const selection = items.filter(isChecked);
|
|
15030
|
+
const isValid = await validate([...selection]);
|
|
15031
|
+
if (required && !selection.length) {
|
|
15032
|
+
setError("At least one choice must be selected");
|
|
15033
|
+
} else if (isValid === true) {
|
|
15034
|
+
setStatus("done");
|
|
15035
|
+
done(selection.map((choice) => choice.value));
|
|
15036
|
+
} else {
|
|
15037
|
+
setError(isValid || "You must select a valid value");
|
|
15038
|
+
}
|
|
15039
|
+
} else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {
|
|
15040
|
+
if (errorMsg) {
|
|
15041
|
+
setError(void 0);
|
|
15042
|
+
}
|
|
15043
|
+
if (loop || isUpKey(key, keybindings) && active !== bounds.first || isDownKey(key, keybindings) && active !== bounds.last) {
|
|
15044
|
+
const offset = isUpKey(key, keybindings) ? -1 : 1;
|
|
15045
|
+
let next = active;
|
|
15046
|
+
do {
|
|
15047
|
+
next = (next + offset + items.length) % items.length;
|
|
15048
|
+
} while (!isNavigable(items[next]));
|
|
15049
|
+
setActive(next);
|
|
15050
|
+
}
|
|
15051
|
+
} else if (isSpaceKey(key)) {
|
|
15052
|
+
const activeItem = items[active];
|
|
15053
|
+
if (activeItem && !Separator.isSeparator(activeItem)) {
|
|
15054
|
+
if (activeItem.disabled) {
|
|
15055
|
+
setError(theme.i18n.disabledError);
|
|
15056
|
+
} else {
|
|
15057
|
+
setError(void 0);
|
|
15058
|
+
setItems(items.map((choice, i) => i === active ? toggle(choice) : choice));
|
|
15059
|
+
}
|
|
15060
|
+
}
|
|
15061
|
+
} else if (key.name === shortcuts.all) {
|
|
15062
|
+
const selectAll = items.some((choice) => isSelectable(choice) && !choice.checked);
|
|
15063
|
+
setItems(items.map(check(selectAll)));
|
|
15064
|
+
} else if (key.name === shortcuts.invert) {
|
|
15065
|
+
setItems(items.map(toggle));
|
|
15066
|
+
} else if (isNumberKey(key)) {
|
|
15067
|
+
const selectedIndex = Number(key.name) - 1;
|
|
15068
|
+
let selectableIndex = -1;
|
|
15069
|
+
const position = items.findIndex((item) => {
|
|
15070
|
+
if (Separator.isSeparator(item))
|
|
15071
|
+
return false;
|
|
15072
|
+
selectableIndex++;
|
|
15073
|
+
return selectableIndex === selectedIndex;
|
|
15074
|
+
});
|
|
15075
|
+
const selectedItem = items[position];
|
|
15076
|
+
if (selectedItem && isSelectable(selectedItem)) {
|
|
15077
|
+
setActive(position);
|
|
15078
|
+
setItems(items.map((choice, i) => i === position ? toggle(choice) : choice));
|
|
15079
|
+
}
|
|
15080
|
+
}
|
|
15081
|
+
});
|
|
15082
|
+
const message = theme.style.message(config.message, status);
|
|
15083
|
+
let description;
|
|
15084
|
+
const page = usePagination({
|
|
15085
|
+
items,
|
|
15086
|
+
active,
|
|
15087
|
+
renderItem({ item, isActive }) {
|
|
15088
|
+
if (Separator.isSeparator(item)) {
|
|
15089
|
+
return ` ${item.separator}`;
|
|
15090
|
+
}
|
|
15091
|
+
const cursor = isActive ? theme.icon.cursor : " ";
|
|
15092
|
+
if (item.disabled) {
|
|
15093
|
+
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
15094
|
+
const checkbox2 = item.checked ? theme.icon.disabledChecked : theme.icon.disabledUnchecked;
|
|
15095
|
+
return theme.style.disabled(`${cursor}${checkbox2} ${item.name} ${disabledLabel}`);
|
|
15096
|
+
}
|
|
15097
|
+
if (isActive) {
|
|
15098
|
+
description = item.description;
|
|
15099
|
+
}
|
|
15100
|
+
const checkbox = item.checked ? theme.icon.checked : theme.icon.unchecked;
|
|
15101
|
+
const name = item.checked ? item.checkedName : item.name;
|
|
15102
|
+
const color = isActive ? theme.style.highlight : (x) => x;
|
|
15103
|
+
return color(`${cursor}${checkbox} ${name}`);
|
|
15104
|
+
},
|
|
15105
|
+
pageSize,
|
|
15106
|
+
loop
|
|
15107
|
+
});
|
|
15108
|
+
if (status === "done") {
|
|
15109
|
+
const selection = items.filter(isChecked);
|
|
15110
|
+
const answer = theme.style.answer(theme.style.renderSelectedChoices(selection, items));
|
|
15111
|
+
return [prefix, message, answer].filter(Boolean).join(" ");
|
|
15112
|
+
}
|
|
15113
|
+
const keys = [
|
|
15114
|
+
["\u2191\u2193", "navigate"],
|
|
15115
|
+
["space", "select"]
|
|
15116
|
+
];
|
|
15117
|
+
if (shortcuts.all)
|
|
15118
|
+
keys.push([shortcuts.all, "all"]);
|
|
15119
|
+
if (shortcuts.invert)
|
|
15120
|
+
keys.push([shortcuts.invert, "invert"]);
|
|
15121
|
+
keys.push(["\u23CE", "submit"]);
|
|
15122
|
+
const helpLine = theme.style.keysHelpTip(keys);
|
|
15123
|
+
const lines = [
|
|
15124
|
+
[prefix, message].filter(Boolean).join(" "),
|
|
15125
|
+
page,
|
|
15126
|
+
" ",
|
|
15127
|
+
description ? theme.style.description(description) : "",
|
|
15128
|
+
errorMsg ? theme.style.error(errorMsg) : "",
|
|
15129
|
+
helpLine
|
|
15130
|
+
].filter(Boolean).join("\n").trimEnd();
|
|
15131
|
+
return `${lines}${cursorHide}`;
|
|
15132
|
+
});
|
|
15133
|
+
|
|
15134
|
+
// node_modules/@inquirer/confirm/dist/index.js
|
|
15135
|
+
function getBooleanValue(value, defaultValue) {
|
|
15136
|
+
let answer = defaultValue !== false;
|
|
15137
|
+
if (/^(y|yes)/i.test(value))
|
|
15138
|
+
answer = true;
|
|
15139
|
+
else if (/^(n|no)/i.test(value))
|
|
15140
|
+
answer = false;
|
|
15141
|
+
return answer;
|
|
15142
|
+
}
|
|
15143
|
+
function boolToString(value) {
|
|
15144
|
+
return value ? "Yes" : "No";
|
|
15145
|
+
}
|
|
15146
|
+
var dist_default5 = createPrompt((config, done) => {
|
|
15147
|
+
const { transformer = boolToString } = config;
|
|
15148
|
+
const [status, setStatus] = useState("idle");
|
|
15149
|
+
const [value, setValue] = useState("");
|
|
15150
|
+
const theme = makeTheme(config.theme);
|
|
15151
|
+
const prefix = usePrefix({ status, theme });
|
|
15152
|
+
useKeypress((key, rl) => {
|
|
15153
|
+
if (status !== "idle")
|
|
15154
|
+
return;
|
|
15155
|
+
if (isEnterKey(key)) {
|
|
15156
|
+
const answer = getBooleanValue(value, config.default);
|
|
15157
|
+
setValue(transformer(answer));
|
|
15158
|
+
setStatus("done");
|
|
15159
|
+
done(answer);
|
|
15160
|
+
} else if (isTabKey(key)) {
|
|
15161
|
+
const answer = boolToString(!getBooleanValue(value, config.default));
|
|
15162
|
+
rl.clearLine(0);
|
|
15163
|
+
rl.write(answer);
|
|
15164
|
+
setValue(answer);
|
|
15165
|
+
} else {
|
|
15166
|
+
setValue(rl.line);
|
|
15167
|
+
}
|
|
15168
|
+
});
|
|
15169
|
+
let formattedValue = value;
|
|
15170
|
+
let defaultValue = "";
|
|
15171
|
+
if (status === "done") {
|
|
15172
|
+
formattedValue = theme.style.answer(value);
|
|
15173
|
+
} else {
|
|
15174
|
+
defaultValue = ` ${theme.style.defaultAnswer(config.default === false ? "y/N" : "Y/n")}`;
|
|
15175
|
+
}
|
|
15176
|
+
const message = theme.style.message(config.message, status);
|
|
15177
|
+
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
15178
|
+
});
|
|
15179
|
+
|
|
15180
|
+
// node_modules/@inquirer/select/dist/index.js
|
|
15181
|
+
var import_node_util5 = require("util");
|
|
15182
|
+
var selectTheme = {
|
|
15183
|
+
icon: { cursor: dist_default.pointer },
|
|
15184
|
+
style: {
|
|
15185
|
+
disabled: (text) => (0, import_node_util5.styleText)("dim", text),
|
|
15186
|
+
description: (text) => (0, import_node_util5.styleText)("cyan", text),
|
|
15187
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${(0, import_node_util5.styleText)("bold", key)} ${(0, import_node_util5.styleText)("dim", action)}`).join((0, import_node_util5.styleText)("dim", " \u2022 "))
|
|
15188
|
+
},
|
|
15189
|
+
i18n: { disabledError: "This option is disabled and cannot be selected." },
|
|
15190
|
+
indexMode: "hidden",
|
|
15191
|
+
keybindings: []
|
|
15192
|
+
};
|
|
15193
|
+
function isSelectable2(item) {
|
|
15194
|
+
return !Separator.isSeparator(item) && !item.disabled;
|
|
15195
|
+
}
|
|
15196
|
+
function isNavigable2(item) {
|
|
15197
|
+
return !Separator.isSeparator(item);
|
|
15198
|
+
}
|
|
15199
|
+
function normalizeChoices2(choices) {
|
|
15200
|
+
return choices.map((choice) => {
|
|
15201
|
+
if (Separator.isSeparator(choice))
|
|
15202
|
+
return choice;
|
|
15203
|
+
if (typeof choice !== "object" || choice === null || !("value" in choice)) {
|
|
15204
|
+
const name2 = String(choice);
|
|
15205
|
+
return {
|
|
15206
|
+
value: choice,
|
|
15207
|
+
name: name2,
|
|
15208
|
+
short: name2,
|
|
15209
|
+
disabled: false
|
|
15210
|
+
};
|
|
15211
|
+
}
|
|
15212
|
+
const name = choice.name ?? String(choice.value);
|
|
15213
|
+
const normalizedChoice = {
|
|
15214
|
+
value: choice.value,
|
|
15215
|
+
name,
|
|
15216
|
+
short: choice.short ?? name,
|
|
15217
|
+
disabled: choice.disabled ?? false
|
|
15218
|
+
};
|
|
15219
|
+
if (choice.description) {
|
|
15220
|
+
normalizedChoice.description = choice.description;
|
|
15221
|
+
}
|
|
15222
|
+
return normalizedChoice;
|
|
15223
|
+
});
|
|
15224
|
+
}
|
|
15225
|
+
var dist_default6 = createPrompt((config, done) => {
|
|
15226
|
+
const { loop = true, pageSize = 7 } = config;
|
|
15227
|
+
const theme = makeTheme(selectTheme, config.theme);
|
|
15228
|
+
const { keybindings } = theme;
|
|
15229
|
+
const [status, setStatus] = useState("idle");
|
|
15230
|
+
const prefix = usePrefix({ status, theme });
|
|
15231
|
+
const searchTimeoutRef = useRef();
|
|
15232
|
+
const searchEnabled = !keybindings.includes("vim");
|
|
15233
|
+
const items = useMemo(() => normalizeChoices2(config.choices), [config.choices]);
|
|
15234
|
+
const bounds = useMemo(() => {
|
|
15235
|
+
const first = items.findIndex(isNavigable2);
|
|
15236
|
+
const last = items.findLastIndex(isNavigable2);
|
|
15237
|
+
if (first === -1) {
|
|
15238
|
+
throw new ValidationError("[select prompt] No selectable choices. All choices are disabled.");
|
|
15239
|
+
}
|
|
15240
|
+
return { first, last };
|
|
15241
|
+
}, [items]);
|
|
15242
|
+
const defaultItemIndex = useMemo(() => {
|
|
15243
|
+
if (!("default" in config))
|
|
15244
|
+
return -1;
|
|
15245
|
+
return items.findIndex((item) => isSelectable2(item) && item.value === config.default);
|
|
15246
|
+
}, [config.default, items]);
|
|
15247
|
+
const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
|
|
15248
|
+
const selectedChoice = items[active];
|
|
15249
|
+
const [errorMsg, setError] = useState();
|
|
15250
|
+
useKeypress((key, rl) => {
|
|
15251
|
+
clearTimeout(searchTimeoutRef.current);
|
|
15252
|
+
if (errorMsg) {
|
|
15253
|
+
setError(void 0);
|
|
15254
|
+
}
|
|
15255
|
+
if (isEnterKey(key)) {
|
|
15256
|
+
if (selectedChoice.disabled) {
|
|
15257
|
+
setError(theme.i18n.disabledError);
|
|
15258
|
+
} else {
|
|
15259
|
+
setStatus("done");
|
|
15260
|
+
done(selectedChoice.value);
|
|
15261
|
+
}
|
|
15262
|
+
} else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {
|
|
15263
|
+
rl.clearLine(0);
|
|
15264
|
+
if (loop || isUpKey(key, keybindings) && active !== bounds.first || isDownKey(key, keybindings) && active !== bounds.last) {
|
|
15265
|
+
const offset = isUpKey(key, keybindings) ? -1 : 1;
|
|
15266
|
+
let next = active;
|
|
15267
|
+
do {
|
|
15268
|
+
next = (next + offset + items.length) % items.length;
|
|
15269
|
+
} while (!isNavigable2(items[next]));
|
|
15270
|
+
setActive(next);
|
|
15271
|
+
}
|
|
15272
|
+
} else if (isNumberKey(key) && !Number.isNaN(Number(rl.line))) {
|
|
15273
|
+
const selectedIndex = Number(rl.line) - 1;
|
|
15274
|
+
let selectableIndex = -1;
|
|
15275
|
+
const position = items.findIndex((item2) => {
|
|
15276
|
+
if (Separator.isSeparator(item2))
|
|
15277
|
+
return false;
|
|
15278
|
+
selectableIndex++;
|
|
15279
|
+
return selectableIndex === selectedIndex;
|
|
15280
|
+
});
|
|
15281
|
+
const item = items[position];
|
|
15282
|
+
if (item != null && isSelectable2(item)) {
|
|
15283
|
+
setActive(position);
|
|
15284
|
+
}
|
|
15285
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
15286
|
+
rl.clearLine(0);
|
|
15287
|
+
}, 700);
|
|
15288
|
+
} else if (isBackspaceKey(key)) {
|
|
15289
|
+
rl.clearLine(0);
|
|
15290
|
+
} else if (searchEnabled) {
|
|
15291
|
+
const searchTerm = rl.line.toLowerCase();
|
|
15292
|
+
const matchIndex = items.findIndex((item) => {
|
|
15293
|
+
if (Separator.isSeparator(item) || !isSelectable2(item))
|
|
15294
|
+
return false;
|
|
15295
|
+
return item.name.toLowerCase().startsWith(searchTerm);
|
|
15296
|
+
});
|
|
15297
|
+
if (matchIndex !== -1) {
|
|
15298
|
+
setActive(matchIndex);
|
|
15299
|
+
}
|
|
15300
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
15301
|
+
rl.clearLine(0);
|
|
15302
|
+
}, 700);
|
|
15303
|
+
}
|
|
15304
|
+
});
|
|
15305
|
+
useEffect(() => () => {
|
|
15306
|
+
clearTimeout(searchTimeoutRef.current);
|
|
15307
|
+
}, []);
|
|
15308
|
+
const message = theme.style.message(config.message, status);
|
|
15309
|
+
const helpLine = theme.style.keysHelpTip([
|
|
15310
|
+
["\u2191\u2193", "navigate"],
|
|
15311
|
+
["\u23CE", "select"]
|
|
15312
|
+
]);
|
|
15313
|
+
let separatorCount = 0;
|
|
15314
|
+
const page = usePagination({
|
|
15315
|
+
items,
|
|
15316
|
+
active,
|
|
15317
|
+
renderItem({ item, isActive, index }) {
|
|
15318
|
+
if (Separator.isSeparator(item)) {
|
|
15319
|
+
separatorCount++;
|
|
15320
|
+
return ` ${item.separator}`;
|
|
15321
|
+
}
|
|
15322
|
+
const cursor = isActive ? theme.icon.cursor : " ";
|
|
15323
|
+
const indexLabel = theme.indexMode === "number" ? `${index + 1 - separatorCount}. ` : "";
|
|
15324
|
+
if (item.disabled) {
|
|
15325
|
+
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
15326
|
+
const disabledCursor = isActive ? theme.icon.cursor : "-";
|
|
15327
|
+
return theme.style.disabled(`${disabledCursor} ${indexLabel}${item.name} ${disabledLabel}`);
|
|
15328
|
+
}
|
|
15329
|
+
const color = isActive ? theme.style.highlight : (x) => x;
|
|
15330
|
+
return color(`${cursor} ${indexLabel}${item.name}`);
|
|
15331
|
+
},
|
|
15332
|
+
pageSize,
|
|
15333
|
+
loop
|
|
15334
|
+
});
|
|
15335
|
+
if (status === "done") {
|
|
15336
|
+
return [prefix, message, theme.style.answer(selectedChoice.short)].filter(Boolean).join(" ");
|
|
15337
|
+
}
|
|
15338
|
+
const { description } = selectedChoice;
|
|
15339
|
+
const lines = [
|
|
15340
|
+
[prefix, message].filter(Boolean).join(" "),
|
|
15341
|
+
page,
|
|
15342
|
+
" ",
|
|
15343
|
+
description ? theme.style.description(description) : "",
|
|
15344
|
+
errorMsg ? theme.style.error(errorMsg) : "",
|
|
15345
|
+
helpLine
|
|
15346
|
+
].filter(Boolean).join("\n").trimEnd();
|
|
15347
|
+
return `${lines}${cursorHide}`;
|
|
15348
|
+
});
|
|
15349
|
+
|
|
15350
|
+
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
15351
|
+
function isNothing(subject) {
|
|
15352
|
+
return typeof subject === "undefined" || subject === null;
|
|
15353
|
+
}
|
|
15354
|
+
function isObject(subject) {
|
|
15355
|
+
return typeof subject === "object" && subject !== null;
|
|
15356
|
+
}
|
|
15357
|
+
function toArray(sequence) {
|
|
15358
|
+
if (Array.isArray(sequence)) return sequence;
|
|
15359
|
+
else if (isNothing(sequence)) return [];
|
|
15360
|
+
return [sequence];
|
|
15361
|
+
}
|
|
15362
|
+
function extend(target, source) {
|
|
15363
|
+
var index, length, key, sourceKeys;
|
|
15364
|
+
if (source) {
|
|
15365
|
+
sourceKeys = Object.keys(source);
|
|
15366
|
+
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
15367
|
+
key = sourceKeys[index];
|
|
15368
|
+
target[key] = source[key];
|
|
15369
|
+
}
|
|
15370
|
+
}
|
|
15371
|
+
return target;
|
|
15372
|
+
}
|
|
15373
|
+
function repeat(string, count) {
|
|
15374
|
+
var result = "", cycle;
|
|
15375
|
+
for (cycle = 0; cycle < count; cycle += 1) {
|
|
15376
|
+
result += string;
|
|
15377
|
+
}
|
|
15378
|
+
return result;
|
|
15379
|
+
}
|
|
15380
|
+
function isNegativeZero(number) {
|
|
15381
|
+
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
15382
|
+
}
|
|
15383
|
+
var isNothing_1 = isNothing;
|
|
15384
|
+
var isObject_1 = isObject;
|
|
15385
|
+
var toArray_1 = toArray;
|
|
15386
|
+
var repeat_1 = repeat;
|
|
15387
|
+
var isNegativeZero_1 = isNegativeZero;
|
|
15388
|
+
var extend_1 = extend;
|
|
15389
|
+
var common2 = {
|
|
15390
|
+
isNothing: isNothing_1,
|
|
15391
|
+
isObject: isObject_1,
|
|
15392
|
+
toArray: toArray_1,
|
|
15393
|
+
repeat: repeat_1,
|
|
15394
|
+
isNegativeZero: isNegativeZero_1,
|
|
15395
|
+
extend: extend_1
|
|
15396
|
+
};
|
|
15397
|
+
function formatError(exception2, compact) {
|
|
15398
|
+
var where = "", message = exception2.reason || "(unknown reason)";
|
|
15399
|
+
if (!exception2.mark) return message;
|
|
15400
|
+
if (exception2.mark.name) {
|
|
15401
|
+
where += 'in "' + exception2.mark.name + '" ';
|
|
15402
|
+
}
|
|
15403
|
+
where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
|
|
15404
|
+
if (!compact && exception2.mark.snippet) {
|
|
15405
|
+
where += "\n\n" + exception2.mark.snippet;
|
|
15406
|
+
}
|
|
15407
|
+
return message + " " + where;
|
|
15408
|
+
}
|
|
15409
|
+
function YAMLException$1(reason, mark) {
|
|
15410
|
+
Error.call(this);
|
|
15411
|
+
this.name = "YAMLException";
|
|
15412
|
+
this.reason = reason;
|
|
15413
|
+
this.mark = mark;
|
|
15414
|
+
this.message = formatError(this, false);
|
|
15415
|
+
if (Error.captureStackTrace) {
|
|
15416
|
+
Error.captureStackTrace(this, this.constructor);
|
|
15417
|
+
} else {
|
|
15418
|
+
this.stack = new Error().stack || "";
|
|
15419
|
+
}
|
|
15420
|
+
}
|
|
15421
|
+
YAMLException$1.prototype = Object.create(Error.prototype);
|
|
15422
|
+
YAMLException$1.prototype.constructor = YAMLException$1;
|
|
15423
|
+
YAMLException$1.prototype.toString = function toString(compact) {
|
|
15424
|
+
return this.name + ": " + formatError(this, compact);
|
|
15425
|
+
};
|
|
15426
|
+
var exception = YAMLException$1;
|
|
15427
|
+
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
15428
|
+
var head = "";
|
|
15429
|
+
var tail = "";
|
|
15430
|
+
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
15431
|
+
if (position - lineStart > maxHalfLength) {
|
|
15432
|
+
head = " ... ";
|
|
15433
|
+
lineStart = position - maxHalfLength + head.length;
|
|
15434
|
+
}
|
|
15435
|
+
if (lineEnd - position > maxHalfLength) {
|
|
15436
|
+
tail = " ...";
|
|
15437
|
+
lineEnd = position + maxHalfLength - tail.length;
|
|
15438
|
+
}
|
|
15439
|
+
return {
|
|
15440
|
+
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
|
|
15441
|
+
pos: position - lineStart + head.length
|
|
15442
|
+
// relative position
|
|
15443
|
+
};
|
|
15444
|
+
}
|
|
15445
|
+
function padStart(string, max) {
|
|
15446
|
+
return common2.repeat(" ", max - string.length) + string;
|
|
15447
|
+
}
|
|
15448
|
+
function makeSnippet(mark, options) {
|
|
15449
|
+
options = Object.create(options || null);
|
|
15450
|
+
if (!mark.buffer) return null;
|
|
15451
|
+
if (!options.maxLength) options.maxLength = 79;
|
|
15452
|
+
if (typeof options.indent !== "number") options.indent = 1;
|
|
15453
|
+
if (typeof options.linesBefore !== "number") options.linesBefore = 3;
|
|
15454
|
+
if (typeof options.linesAfter !== "number") options.linesAfter = 2;
|
|
15455
|
+
var re2 = /\r?\n|\r|\0/g;
|
|
15456
|
+
var lineStarts = [0];
|
|
15457
|
+
var lineEnds = [];
|
|
15458
|
+
var match;
|
|
15459
|
+
var foundLineNo = -1;
|
|
15460
|
+
while (match = re2.exec(mark.buffer)) {
|
|
15461
|
+
lineEnds.push(match.index);
|
|
15462
|
+
lineStarts.push(match.index + match[0].length);
|
|
15463
|
+
if (mark.position <= match.index && foundLineNo < 0) {
|
|
15464
|
+
foundLineNo = lineStarts.length - 2;
|
|
15465
|
+
}
|
|
15466
|
+
}
|
|
15467
|
+
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
|
15468
|
+
var result = "", i, line;
|
|
15469
|
+
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
|
15470
|
+
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
|
15471
|
+
for (i = 1; i <= options.linesBefore; i++) {
|
|
15472
|
+
if (foundLineNo - i < 0) break;
|
|
15473
|
+
line = getLine(
|
|
15474
|
+
mark.buffer,
|
|
15475
|
+
lineStarts[foundLineNo - i],
|
|
15476
|
+
lineEnds[foundLineNo - i],
|
|
13416
15477
|
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
|
|
13417
15478
|
maxLineLength
|
|
13418
15479
|
);
|
|
13419
|
-
result =
|
|
15480
|
+
result = common2.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
|
|
13420
15481
|
}
|
|
13421
15482
|
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
13422
|
-
result +=
|
|
13423
|
-
result +=
|
|
15483
|
+
result += common2.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
15484
|
+
result += common2.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
|
|
13424
15485
|
for (i = 1; i <= options.linesAfter; i++) {
|
|
13425
15486
|
if (foundLineNo + i >= lineEnds.length) break;
|
|
13426
15487
|
line = getLine(
|
|
@@ -13430,7 +15491,7 @@ function makeSnippet(mark, options) {
|
|
|
13430
15491
|
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
|
|
13431
15492
|
maxLineLength
|
|
13432
15493
|
);
|
|
13433
|
-
result +=
|
|
15494
|
+
result += common2.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
13434
15495
|
}
|
|
13435
15496
|
return result.replace(/\n$/, "");
|
|
13436
15497
|
}
|
|
@@ -13743,7 +15804,7 @@ function constructYamlInteger(data) {
|
|
|
13743
15804
|
return sign * parseInt(value, 10);
|
|
13744
15805
|
}
|
|
13745
15806
|
function isInteger(object) {
|
|
13746
|
-
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !
|
|
15807
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common2.isNegativeZero(object));
|
|
13747
15808
|
}
|
|
13748
15809
|
var int = new type("tag:yaml.org,2002:int", {
|
|
13749
15810
|
kind: "scalar",
|
|
@@ -13830,14 +15891,14 @@ function representYamlFloat(object, style) {
|
|
|
13830
15891
|
case "camelcase":
|
|
13831
15892
|
return "-.Inf";
|
|
13832
15893
|
}
|
|
13833
|
-
} else if (
|
|
15894
|
+
} else if (common2.isNegativeZero(object)) {
|
|
13834
15895
|
return "-0.0";
|
|
13835
15896
|
}
|
|
13836
15897
|
res = object.toString(10);
|
|
13837
15898
|
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
13838
15899
|
}
|
|
13839
15900
|
function isFloat(object) {
|
|
13840
|
-
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 ||
|
|
15901
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common2.isNegativeZero(object));
|
|
13841
15902
|
}
|
|
13842
15903
|
var float = new type("tag:yaml.org,2002:float", {
|
|
13843
15904
|
kind: "scalar",
|
|
@@ -14274,7 +16335,7 @@ function captureSegment(state, start, end, checkJson) {
|
|
|
14274
16335
|
}
|
|
14275
16336
|
function mergeMappings(state, destination, source, overridableKeys) {
|
|
14276
16337
|
var sourceKeys, key, index, quantity;
|
|
14277
|
-
if (!
|
|
16338
|
+
if (!common2.isObject(source)) {
|
|
14278
16339
|
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
14279
16340
|
}
|
|
14280
16341
|
sourceKeys = Object.keys(source);
|
|
@@ -14391,7 +16452,7 @@ function writeFoldedLines(state, count) {
|
|
|
14391
16452
|
if (count === 1) {
|
|
14392
16453
|
state.result += " ";
|
|
14393
16454
|
} else if (count > 1) {
|
|
14394
|
-
state.result +=
|
|
16455
|
+
state.result += common2.repeat("\n", count - 1);
|
|
14395
16456
|
}
|
|
14396
16457
|
}
|
|
14397
16458
|
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
@@ -14682,7 +16743,7 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
14682
16743
|
}
|
|
14683
16744
|
if (state.lineIndent < textIndent) {
|
|
14684
16745
|
if (chomping === CHOMPING_KEEP) {
|
|
14685
|
-
state.result +=
|
|
16746
|
+
state.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
14686
16747
|
} else if (chomping === CHOMPING_CLIP) {
|
|
14687
16748
|
if (didReadContent) {
|
|
14688
16749
|
state.result += "\n";
|
|
@@ -14693,19 +16754,19 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
14693
16754
|
if (folding) {
|
|
14694
16755
|
if (is_WHITE_SPACE(ch)) {
|
|
14695
16756
|
atMoreIndented = true;
|
|
14696
|
-
state.result +=
|
|
16757
|
+
state.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
14697
16758
|
} else if (atMoreIndented) {
|
|
14698
16759
|
atMoreIndented = false;
|
|
14699
|
-
state.result +=
|
|
16760
|
+
state.result += common2.repeat("\n", emptyLines + 1);
|
|
14700
16761
|
} else if (emptyLines === 0) {
|
|
14701
16762
|
if (didReadContent) {
|
|
14702
16763
|
state.result += " ";
|
|
14703
16764
|
}
|
|
14704
16765
|
} else {
|
|
14705
|
-
state.result +=
|
|
16766
|
+
state.result += common2.repeat("\n", emptyLines);
|
|
14706
16767
|
}
|
|
14707
16768
|
} else {
|
|
14708
|
-
state.result +=
|
|
16769
|
+
state.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
14709
16770
|
}
|
|
14710
16771
|
didReadContent = true;
|
|
14711
16772
|
detectedIndent = true;
|
|
@@ -15334,7 +17395,7 @@ function encodeHex(character) {
|
|
|
15334
17395
|
} else {
|
|
15335
17396
|
throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
|
|
15336
17397
|
}
|
|
15337
|
-
return "\\" + handle +
|
|
17398
|
+
return "\\" + handle + common2.repeat("0", length - string.length) + string;
|
|
15338
17399
|
}
|
|
15339
17400
|
var QUOTING_TYPE_SINGLE = 1;
|
|
15340
17401
|
var QUOTING_TYPE_DOUBLE = 2;
|
|
@@ -15343,7 +17404,7 @@ function State(options) {
|
|
|
15343
17404
|
this.indent = Math.max(1, options["indent"] || 2);
|
|
15344
17405
|
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
15345
17406
|
this.skipInvalid = options["skipInvalid"] || false;
|
|
15346
|
-
this.flowLevel =
|
|
17407
|
+
this.flowLevel = common2.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
15347
17408
|
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
15348
17409
|
this.sortKeys = options["sortKeys"] || false;
|
|
15349
17410
|
this.lineWidth = options["lineWidth"] || 80;
|
|
@@ -15361,7 +17422,7 @@ function State(options) {
|
|
|
15361
17422
|
this.usedDuplicates = null;
|
|
15362
17423
|
}
|
|
15363
17424
|
function indentString(string, spaces) {
|
|
15364
|
-
var ind =
|
|
17425
|
+
var ind = common2.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
|
|
15365
17426
|
while (position < length) {
|
|
15366
17427
|
next = string.indexOf("\n", position);
|
|
15367
17428
|
if (next === -1) {
|
|
@@ -15377,7 +17438,7 @@ function indentString(string, spaces) {
|
|
|
15377
17438
|
return result;
|
|
15378
17439
|
}
|
|
15379
17440
|
function generateNextLine(state, level) {
|
|
15380
|
-
return "\n" +
|
|
17441
|
+
return "\n" + common2.repeat(" ", state.indent * level);
|
|
15381
17442
|
}
|
|
15382
17443
|
function testImplicitResolving(state, str2) {
|
|
15383
17444
|
var index, length, type2;
|
|
@@ -15871,7 +17932,7 @@ var FAILSAFE_SCHEMA = failsafe;
|
|
|
15871
17932
|
var JSON_SCHEMA = json;
|
|
15872
17933
|
var CORE_SCHEMA = core;
|
|
15873
17934
|
var DEFAULT_SCHEMA = _default;
|
|
15874
|
-
var
|
|
17935
|
+
var load2 = loader.load;
|
|
15875
17936
|
var loadAll = loader.loadAll;
|
|
15876
17937
|
var dump = dumper.dump;
|
|
15877
17938
|
var YAMLException = exception;
|
|
@@ -15900,7 +17961,7 @@ var jsYaml = {
|
|
|
15900
17961
|
JSON_SCHEMA,
|
|
15901
17962
|
CORE_SCHEMA,
|
|
15902
17963
|
DEFAULT_SCHEMA,
|
|
15903
|
-
load,
|
|
17964
|
+
load: load2,
|
|
15904
17965
|
loadAll,
|
|
15905
17966
|
dump,
|
|
15906
17967
|
YAMLException,
|
|
@@ -19054,9 +21115,7 @@ function findOpenClawDir(customDir) {
|
|
|
19054
21115
|
const home = process.env.HOME || "~";
|
|
19055
21116
|
const candidates = [
|
|
19056
21117
|
import_node_path11.default.join(home, ".openclaw"),
|
|
19057
|
-
import_node_path11.default.join(home, ".lightclaw")
|
|
19058
|
-
import_node_path11.default.join(process.cwd(), ".openclaw"),
|
|
19059
|
-
import_node_path11.default.join(process.cwd(), ".lightclaw")
|
|
21118
|
+
import_node_path11.default.join(home, ".lightclaw")
|
|
19060
21119
|
];
|
|
19061
21120
|
for (const candidate of candidates) {
|
|
19062
21121
|
if (import_node_fs8.default.existsSync(candidate)) {
|
|
@@ -19085,18 +21144,9 @@ function findAllClawDirs(customDir) {
|
|
|
19085
21144
|
const home = process.env.HOME || "~";
|
|
19086
21145
|
const candidates = [
|
|
19087
21146
|
import_node_path11.default.join(home, ".openclaw"),
|
|
19088
|
-
import_node_path11.default.join(home, ".lightclaw")
|
|
19089
|
-
import_node_path11.default.join(process.cwd(), ".openclaw"),
|
|
19090
|
-
import_node_path11.default.join(process.cwd(), ".lightclaw")
|
|
21147
|
+
import_node_path11.default.join(home, ".lightclaw")
|
|
19091
21148
|
];
|
|
19092
|
-
|
|
19093
|
-
const seen = /* @__PURE__ */ new Set();
|
|
19094
|
-
return existing.filter((c) => {
|
|
19095
|
-
const real = import_node_fs8.default.realpathSync(c);
|
|
19096
|
-
if (seen.has(real)) return false;
|
|
19097
|
-
seen.add(real);
|
|
19098
|
-
return true;
|
|
19099
|
-
});
|
|
21149
|
+
return candidates.filter((c) => import_node_fs8.default.existsSync(c));
|
|
19100
21150
|
}
|
|
19101
21151
|
async function promptSelectClawDir(customDir) {
|
|
19102
21152
|
const dirs = findAllClawDirs(customDir);
|
|
@@ -19106,30 +21156,18 @@ async function promptSelectClawDir(customDir) {
|
|
|
19106
21156
|
if (dirs.length === 1) {
|
|
19107
21157
|
return dirs[0];
|
|
19108
21158
|
}
|
|
19109
|
-
|
|
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
|
-
}
|
|
21159
|
+
try {
|
|
21160
|
+
const selected = await dist_default6({
|
|
21161
|
+
message: "Select target Claw installation:",
|
|
21162
|
+
choices: dirs.map((dir) => {
|
|
21163
|
+
const brand = detectClawBrand(dir);
|
|
21164
|
+
return { name: `${brand} ${dir}`, value: dir };
|
|
21165
|
+
})
|
|
19131
21166
|
});
|
|
19132
|
-
|
|
21167
|
+
return selected;
|
|
21168
|
+
} catch {
|
|
21169
|
+
return null;
|
|
21170
|
+
}
|
|
19133
21171
|
}
|
|
19134
21172
|
function getConfigPath() {
|
|
19135
21173
|
const home = process.env.HOME || "~";
|
|
@@ -19165,6 +21203,11 @@ function recordInstall(name, version, workspace) {
|
|
|
19165
21203
|
saveConfig(config);
|
|
19166
21204
|
logger.debug(`Recorded install`, { name, version, workspace });
|
|
19167
21205
|
}
|
|
21206
|
+
function removeInstallRecord(name) {
|
|
21207
|
+
const config = loadConfig();
|
|
21208
|
+
config.installed = config.installed.filter((a) => a.name !== name);
|
|
21209
|
+
saveConfig(config);
|
|
21210
|
+
}
|
|
19168
21211
|
function getWorkspaceDir(clawDir, agentName) {
|
|
19169
21212
|
return import_node_path11.default.join(clawDir, `workspace-${agentName}`);
|
|
19170
21213
|
}
|
|
@@ -19301,6 +21344,11 @@ function detectPackageKind(dir) {
|
|
|
19301
21344
|
}
|
|
19302
21345
|
return "unknown";
|
|
19303
21346
|
}
|
|
21347
|
+
function getBackupBaseDir(clawDir) {
|
|
21348
|
+
const home = process.env.HOME || "~";
|
|
21349
|
+
const brand = detectClawBrand(clawDir).toLowerCase();
|
|
21350
|
+
return import_node_path11.default.join(home, ".soulhub", "backups", brand);
|
|
21351
|
+
}
|
|
19304
21352
|
function backupAgentWorkspace(workspaceDir) {
|
|
19305
21353
|
if (!import_node_fs8.default.existsSync(workspaceDir)) {
|
|
19306
21354
|
return null;
|
|
@@ -19310,7 +21358,7 @@ function backupAgentWorkspace(workspaceDir) {
|
|
|
19310
21358
|
return null;
|
|
19311
21359
|
}
|
|
19312
21360
|
const clawDir = import_node_path11.default.dirname(workspaceDir);
|
|
19313
|
-
const backupBaseDir =
|
|
21361
|
+
const backupBaseDir = getBackupBaseDir(clawDir);
|
|
19314
21362
|
if (!import_node_fs8.default.existsSync(backupBaseDir)) {
|
|
19315
21363
|
import_node_fs8.default.mkdirSync(backupBaseDir, { recursive: true });
|
|
19316
21364
|
}
|
|
@@ -19333,7 +21381,7 @@ function moveBackupAgentWorkspace(workspaceDir) {
|
|
|
19333
21381
|
return null;
|
|
19334
21382
|
}
|
|
19335
21383
|
const clawDir = import_node_path11.default.dirname(workspaceDir);
|
|
19336
|
-
const backupBaseDir =
|
|
21384
|
+
const backupBaseDir = getBackupBaseDir(clawDir);
|
|
19337
21385
|
if (!import_node_fs8.default.existsSync(backupBaseDir)) {
|
|
19338
21386
|
import_node_fs8.default.mkdirSync(backupBaseDir, { recursive: true });
|
|
19339
21387
|
}
|
|
@@ -19343,7 +21391,12 @@ function moveBackupAgentWorkspace(workspaceDir) {
|
|
|
19343
21391
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
19344
21392
|
backupDir = import_node_path11.default.join(backupBaseDir, `${dirName}-${timestamp2}`);
|
|
19345
21393
|
}
|
|
19346
|
-
|
|
21394
|
+
try {
|
|
21395
|
+
import_node_fs8.default.renameSync(workspaceDir, backupDir);
|
|
21396
|
+
} catch {
|
|
21397
|
+
import_node_fs8.default.cpSync(workspaceDir, backupDir, { recursive: true });
|
|
21398
|
+
import_node_fs8.default.rmSync(workspaceDir, { recursive: true, force: true });
|
|
21399
|
+
}
|
|
19347
21400
|
logger.info(`Workspace moved to backup`, { from: workspaceDir, to: backupDir });
|
|
19348
21401
|
return backupDir;
|
|
19349
21402
|
}
|
|
@@ -19432,6 +21485,58 @@ function commitBackupRecord(record) {
|
|
|
19432
21485
|
saveBackupManifest(manifest);
|
|
19433
21486
|
logger.info(`Backup record saved`, { id: record.id, items: record.items.length, workers: record.installedWorkerIds.length });
|
|
19434
21487
|
}
|
|
21488
|
+
async function promptSelectRole() {
|
|
21489
|
+
try {
|
|
21490
|
+
const selected = await dist_default6({
|
|
21491
|
+
message: "Install as:",
|
|
21492
|
+
choices: [
|
|
21493
|
+
{ name: "\u{1F477} Worker agent (\u5B50Agent\uFF0C\u5B89\u88C5\u5230 workspace-<name>/ \u76EE\u5F55)", value: "worker" },
|
|
21494
|
+
{ name: "\u{1F451} Main agent (\u4E3BAgent\uFF0C\u5B89\u88C5\u5230 workspace/ \u76EE\u5F55)", value: "main" }
|
|
21495
|
+
],
|
|
21496
|
+
default: "worker"
|
|
21497
|
+
});
|
|
21498
|
+
return selected;
|
|
21499
|
+
} catch {
|
|
21500
|
+
return null;
|
|
21501
|
+
}
|
|
21502
|
+
}
|
|
21503
|
+
async function promptMultiSelectClawDirs() {
|
|
21504
|
+
const dirs = findAllClawDirs();
|
|
21505
|
+
if (dirs.length === 0) {
|
|
21506
|
+
return [];
|
|
21507
|
+
}
|
|
21508
|
+
if (dirs.length === 1) {
|
|
21509
|
+
const brand = detectClawBrand(dirs[0]);
|
|
21510
|
+
console.log();
|
|
21511
|
+
console.log(` \u2714 Detected ${brand}: ${dirs[0]}`);
|
|
21512
|
+
return dirs;
|
|
21513
|
+
}
|
|
21514
|
+
try {
|
|
21515
|
+
const selected = await dist_default4({
|
|
21516
|
+
message: "Select target Claw installations (space to toggle, enter to confirm):",
|
|
21517
|
+
choices: dirs.map((dir) => {
|
|
21518
|
+
const brand = detectClawBrand(dir);
|
|
21519
|
+
return { name: `${brand} ${dir}`, value: dir, checked: true };
|
|
21520
|
+
})
|
|
21521
|
+
});
|
|
21522
|
+
if (selected.length === 0) {
|
|
21523
|
+
console.log(" No claw selected, operation cancelled.");
|
|
21524
|
+
}
|
|
21525
|
+
return selected;
|
|
21526
|
+
} catch {
|
|
21527
|
+
return [];
|
|
21528
|
+
}
|
|
21529
|
+
}
|
|
21530
|
+
async function promptConfirm(message, defaultYes = true) {
|
|
21531
|
+
try {
|
|
21532
|
+
return await dist_default5({
|
|
21533
|
+
message,
|
|
21534
|
+
default: defaultYes
|
|
21535
|
+
});
|
|
21536
|
+
} catch {
|
|
21537
|
+
return false;
|
|
21538
|
+
}
|
|
21539
|
+
}
|
|
19435
21540
|
var CATEGORY_LABELS = {
|
|
19436
21541
|
"self-media": "Self Media",
|
|
19437
21542
|
development: "Development",
|
|
@@ -19538,7 +21643,7 @@ function restartOpenClawGateway(clawDir) {
|
|
|
19538
21643
|
}
|
|
19539
21644
|
|
|
19540
21645
|
// src/commands/search.ts
|
|
19541
|
-
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("-
|
|
21646
|
+
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) => {
|
|
19542
21647
|
try {
|
|
19543
21648
|
const index = await fetchIndex();
|
|
19544
21649
|
let agents = index.agents;
|
|
@@ -19556,14 +21661,30 @@ var searchCommand = new Command("search").description("Search for agents in the
|
|
|
19556
21661
|
const limit = parseInt(options.limit, 10);
|
|
19557
21662
|
const shown = agents.slice(0, limit);
|
|
19558
21663
|
if (shown.length === 0) {
|
|
19559
|
-
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
19563
|
-
)
|
|
21664
|
+
if (options.json) {
|
|
21665
|
+
console.log(JSON.stringify([], null, 2));
|
|
21666
|
+
} else {
|
|
21667
|
+
console.log(source_default.yellow("No agents found matching your query."));
|
|
21668
|
+
if (query) {
|
|
21669
|
+
console.log(
|
|
21670
|
+
source_default.dim(` Try: soulhub search (without query to list all)`)
|
|
21671
|
+
);
|
|
21672
|
+
}
|
|
19564
21673
|
}
|
|
19565
21674
|
return;
|
|
19566
21675
|
}
|
|
21676
|
+
if (options.json) {
|
|
21677
|
+
const jsonOutput = shown.map((a) => ({
|
|
21678
|
+
name: a.name,
|
|
21679
|
+
displayName: a.displayName,
|
|
21680
|
+
version: a.version,
|
|
21681
|
+
description: a.description,
|
|
21682
|
+
category: a.category,
|
|
21683
|
+
tags: a.tags
|
|
21684
|
+
}));
|
|
21685
|
+
console.log(JSON.stringify(jsonOutput, null, 2));
|
|
21686
|
+
return;
|
|
21687
|
+
}
|
|
19567
21688
|
console.log(
|
|
19568
21689
|
source_default.bold(`
|
|
19569
21690
|
Found ${agents.length} agent(s):
|
|
@@ -19604,7 +21725,7 @@ var searchCommand = new Command("search").description("Search for agents in the
|
|
|
19604
21725
|
});
|
|
19605
21726
|
|
|
19606
21727
|
// src/commands/info.ts
|
|
19607
|
-
var infoCommand = new Command("info").description("Show details of an agent (identity, soul, skills, etc.)").argument("<name>", "Agent name").option("--identity", "Show IDENTITY.md content").option("--soul", "Show SOUL.md content").action(async (name, options) => {
|
|
21728
|
+
var infoCommand = new Command("info").description("Show details of an agent (identity, soul, skills, etc.)").argument("<name>", "Agent name").option("--identity", "Show IDENTITY.md content").option("--soul", "Show SOUL.md content").option("--json", "Output results in JSON format").action(async (name, options) => {
|
|
19608
21729
|
try {
|
|
19609
21730
|
const index = await fetchIndex();
|
|
19610
21731
|
const agent = index.agents.find((a) => a.name === name);
|
|
@@ -19616,6 +21737,22 @@ var infoCommand = new Command("info").description("Show details of an agent (ide
|
|
|
19616
21737
|
process.exit(1);
|
|
19617
21738
|
}
|
|
19618
21739
|
const category = CATEGORY_LABELS[agent.category] || agent.category;
|
|
21740
|
+
if (options.json) {
|
|
21741
|
+
const jsonOutput = {
|
|
21742
|
+
name: agent.name,
|
|
21743
|
+
displayName: agent.displayName,
|
|
21744
|
+
version: agent.version,
|
|
21745
|
+
description: agent.description,
|
|
21746
|
+
category: agent.category,
|
|
21747
|
+
author: agent.author,
|
|
21748
|
+
tags: agent.tags,
|
|
21749
|
+
minClawVersion: agent.minClawVersion,
|
|
21750
|
+
downloads: agent.downloads,
|
|
21751
|
+
files: agent.files
|
|
21752
|
+
};
|
|
21753
|
+
console.log(JSON.stringify(jsonOutput, null, 2));
|
|
21754
|
+
return;
|
|
21755
|
+
}
|
|
19619
21756
|
console.log();
|
|
19620
21757
|
console.log(source_default.bold.cyan(` ${agent.displayName}`));
|
|
19621
21758
|
console.log(source_default.dim(` ${agent.name} v${agent.version}`));
|
|
@@ -19644,7 +21781,7 @@ var infoCommand = new Command("info").description("Show details of an agent (ide
|
|
|
19644
21781
|
console.log(` ${fileName} ${source_default.dim(`(${sizeStr})`)}`);
|
|
19645
21782
|
}
|
|
19646
21783
|
if (options.identity || options.soul) {
|
|
19647
|
-
const
|
|
21784
|
+
const fs8 = await import("fs");
|
|
19648
21785
|
const pkgDir = await downloadAgentPackage(name, agent.version);
|
|
19649
21786
|
try {
|
|
19650
21787
|
if (options.identity) {
|
|
@@ -19652,8 +21789,8 @@ var infoCommand = new Command("info").description("Show details of an agent (ide
|
|
|
19652
21789
|
console.log(source_default.bold(" \u2500\u2500 IDENTITY.md \u2500\u2500"));
|
|
19653
21790
|
console.log();
|
|
19654
21791
|
const identityPath = (await import("path")).default.join(pkgDir, "IDENTITY.md");
|
|
19655
|
-
if (
|
|
19656
|
-
const content =
|
|
21792
|
+
if (fs8.default.existsSync(identityPath)) {
|
|
21793
|
+
const content = fs8.default.readFileSync(identityPath, "utf-8");
|
|
19657
21794
|
console.log(
|
|
19658
21795
|
content.split("\n").map((l) => ` ${l}`).join("\n")
|
|
19659
21796
|
);
|
|
@@ -19666,8 +21803,8 @@ var infoCommand = new Command("info").description("Show details of an agent (ide
|
|
|
19666
21803
|
console.log(source_default.bold(" \u2500\u2500 SOUL.md \u2500\u2500"));
|
|
19667
21804
|
console.log();
|
|
19668
21805
|
const soulPath = (await import("path")).default.join(pkgDir, "SOUL.md");
|
|
19669
|
-
if (
|
|
19670
|
-
const content =
|
|
21806
|
+
if (fs8.default.existsSync(soulPath)) {
|
|
21807
|
+
const content = fs8.default.readFileSync(soulPath, "utf-8");
|
|
19671
21808
|
console.log(
|
|
19672
21809
|
content.split("\n").map((l) => ` ${l}`).join("\n")
|
|
19673
21810
|
);
|
|
@@ -19676,7 +21813,7 @@ var infoCommand = new Command("info").description("Show details of an agent (ide
|
|
|
19676
21813
|
}
|
|
19677
21814
|
}
|
|
19678
21815
|
} finally {
|
|
19679
|
-
|
|
21816
|
+
fs8.default.rmSync(pkgDir, { recursive: true, force: true });
|
|
19680
21817
|
}
|
|
19681
21818
|
}
|
|
19682
21819
|
console.log();
|
|
@@ -19778,27 +21915,39 @@ function resolveAllClawDirs(clawDir) {
|
|
|
19778
21915
|
}
|
|
19779
21916
|
return findAllClawDirs();
|
|
19780
21917
|
}
|
|
19781
|
-
var installCommand = new Command("install").description("Install an agent or team from the SoulHub registry
|
|
21918
|
+
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(
|
|
19782
21919
|
"--dir <path>",
|
|
19783
21920
|
"Target directory (defaults to OpenClaw/LightClaw workspace)"
|
|
19784
21921
|
).option(
|
|
19785
|
-
"--
|
|
21922
|
+
"--claw-type <type>",
|
|
19786
21923
|
"Specify claw type: OpenClaw or LightClaw (case-insensitive)"
|
|
19787
|
-
).action(async (name, options) => {
|
|
21924
|
+
).option("-y, --yes", "Skip all confirmation prompts (auto-confirm)").action(async (name, options) => {
|
|
19788
21925
|
try {
|
|
19789
|
-
const
|
|
21926
|
+
const roleExplicit = !!options.role;
|
|
21927
|
+
const clawExplicit = !!options.clawType || !!options.dir;
|
|
21928
|
+
const skipConfirm = !!options.yes;
|
|
21929
|
+
if (options.role && !["main", "worker"].includes(options.role.toLowerCase())) {
|
|
21930
|
+
console.error(source_default.red(`Invalid role: "${options.role}". Must be "main" or "worker".`));
|
|
21931
|
+
process.exit(1);
|
|
21932
|
+
}
|
|
19790
21933
|
if (options.from) {
|
|
19791
|
-
await
|
|
21934
|
+
const asMain = await resolveRole(roleExplicit ? options.role.toLowerCase() === "main" : void 0);
|
|
21935
|
+
if (asMain === null) return;
|
|
21936
|
+
await installFromSource(options.from, options.dir, options.clawType, asMain, clawExplicit, skipConfirm);
|
|
19792
21937
|
} else if (name) {
|
|
19793
|
-
|
|
21938
|
+
const resolvedRole = roleExplicit ? options.role.toLowerCase() === "main" : void 0;
|
|
21939
|
+
await installFromRegistry(name, options.dir, options.clawType, resolvedRole, clawExplicit, skipConfirm);
|
|
19794
21940
|
} else {
|
|
19795
21941
|
console.error(source_default.red("Please specify an agent or team name, or use --from to install from a local source."));
|
|
19796
|
-
console.log(
|
|
19797
|
-
console.log(source_default.dim("
|
|
19798
|
-
console.log(source_default.dim(" soulhub install
|
|
19799
|
-
console.log(source_default.dim(" soulhub install
|
|
19800
|
-
console.log(source_default.dim(" soulhub install --
|
|
19801
|
-
console.log(source_default.dim(" soulhub install
|
|
21942
|
+
console.log();
|
|
21943
|
+
console.log(source_default.dim(" Usage:"));
|
|
21944
|
+
console.log(source_default.dim(" soulhub install <name> # Interactive: select role & claw"));
|
|
21945
|
+
console.log(source_default.dim(" soulhub install <name> --role main # As main agent, interactive claw selection"));
|
|
21946
|
+
console.log(source_default.dim(" soulhub install <name> --role worker # As worker agent, interactive claw selection"));
|
|
21947
|
+
console.log(source_default.dim(" soulhub install <name> --claw-type LightClaw # Interactive role, install to specific claw"));
|
|
21948
|
+
console.log(source_default.dim(" soulhub install <name> --role worker --claw-type OpenClaw # Fully non-interactive"));
|
|
21949
|
+
console.log(source_default.dim(" soulhub install <name> --role main --claw-type OpenClaw -y # Non-interactive, skip confirmation"));
|
|
21950
|
+
console.log(source_default.dim(" soulhub install --from ./agent-dir/ # Install from local directory"));
|
|
19802
21951
|
process.exit(1);
|
|
19803
21952
|
}
|
|
19804
21953
|
} catch (error) {
|
|
@@ -19810,15 +21959,60 @@ var installCommand = new Command("install").description("Install an agent or tea
|
|
|
19810
21959
|
process.exit(1);
|
|
19811
21960
|
}
|
|
19812
21961
|
});
|
|
19813
|
-
async function
|
|
21962
|
+
async function resolveRole(explicitMain) {
|
|
21963
|
+
if (explicitMain !== void 0) {
|
|
21964
|
+
return explicitMain;
|
|
21965
|
+
}
|
|
21966
|
+
const role = await promptSelectRole();
|
|
21967
|
+
if (role === null) return null;
|
|
21968
|
+
return role === "main";
|
|
21969
|
+
}
|
|
21970
|
+
async function resolveClawDirsInteractive(clawDir, clawExplicit) {
|
|
21971
|
+
if (clawDir) {
|
|
21972
|
+
return resolveAllClawDirs(clawDir);
|
|
21973
|
+
}
|
|
21974
|
+
if (clawExplicit) {
|
|
21975
|
+
return [];
|
|
21976
|
+
}
|
|
21977
|
+
return promptMultiSelectClawDirs();
|
|
21978
|
+
}
|
|
21979
|
+
async function installFromRegistry(name, targetDir, clawDir, asMain, clawExplicit, skipConfirm = false) {
|
|
19814
21980
|
const spinner = createSpinner(`Checking registry for ${source_default.cyan(name)}...`).start();
|
|
19815
21981
|
const index = await fetchIndex();
|
|
19816
21982
|
const agent = index.agents.find((a) => a.name === name);
|
|
19817
21983
|
const recipe = index.recipes.find((r) => r.name === name);
|
|
19818
21984
|
if (agent && !recipe) {
|
|
19819
21985
|
spinner.stop();
|
|
19820
|
-
|
|
19821
|
-
|
|
21986
|
+
printAgentInfo(agent);
|
|
21987
|
+
const resolvedMain = await resolveRole(asMain);
|
|
21988
|
+
if (resolvedMain === null) return;
|
|
21989
|
+
if (resolvedMain) {
|
|
21990
|
+
console.log();
|
|
21991
|
+
console.log(source_default.yellow(" \u26A0 Installing as main agent will overwrite the current workspace/ content."));
|
|
21992
|
+
console.log(source_default.yellow(" The existing persona (IDENTITY.md, SOUL.md, etc.) will be replaced."));
|
|
21993
|
+
console.log(source_default.yellow(" Memory and conversation history will NOT be affected."));
|
|
21994
|
+
console.log();
|
|
21995
|
+
if (!skipConfirm) {
|
|
21996
|
+
const confirmed = await promptConfirm("Continue?", true);
|
|
21997
|
+
if (!confirmed) {
|
|
21998
|
+
console.log(source_default.dim(" Installation cancelled."));
|
|
21999
|
+
return;
|
|
22000
|
+
}
|
|
22001
|
+
} else {
|
|
22002
|
+
console.log(source_default.dim(" Auto-confirmed with --yes flag."));
|
|
22003
|
+
}
|
|
22004
|
+
}
|
|
22005
|
+
let resolvedClawDirs;
|
|
22006
|
+
if (!targetDir) {
|
|
22007
|
+
resolvedClawDirs = await resolveClawDirsInteractive(clawDir, clawExplicit);
|
|
22008
|
+
if (resolvedClawDirs.length === 0) {
|
|
22009
|
+
console.log(source_default.red("\n OpenClaw/LightClaw workspace directory not found."));
|
|
22010
|
+
printOpenClawInstallHelp();
|
|
22011
|
+
return;
|
|
22012
|
+
}
|
|
22013
|
+
}
|
|
22014
|
+
logger.info(`Installing single agent from registry: ${name}, asMain=${resolvedMain}`);
|
|
22015
|
+
await installSingleAgent(name, targetDir, clawDir, resolvedMain, resolvedClawDirs);
|
|
19822
22016
|
} else if (recipe) {
|
|
19823
22017
|
spinner.stop();
|
|
19824
22018
|
logger.info(`Installing team recipe from registry: ${name}`);
|
|
@@ -19829,12 +22023,25 @@ async function installFromRegistry(name, targetDir, clawDir, asMain) {
|
|
|
19829
22023
|
console.log(source_default.dim(" Use 'soulhub search' to find available agents and teams."));
|
|
19830
22024
|
}
|
|
19831
22025
|
}
|
|
19832
|
-
|
|
22026
|
+
function printAgentInfo(agent) {
|
|
22027
|
+
console.log();
|
|
22028
|
+
console.log(source_default.bold(` \u{1F4E6} ${agent.displayName}`), source_default.dim(`v${agent.version}`));
|
|
22029
|
+
if (agent.description) {
|
|
22030
|
+
console.log(source_default.dim(` ${agent.description}`));
|
|
22031
|
+
}
|
|
22032
|
+
if (agent.category) {
|
|
22033
|
+
console.log(source_default.dim(` Category: ${agent.category}`));
|
|
22034
|
+
}
|
|
22035
|
+
if (agent.tags && agent.tags.length > 0) {
|
|
22036
|
+
console.log(source_default.dim(` Tags: ${agent.tags.join(", ")}`));
|
|
22037
|
+
}
|
|
22038
|
+
}
|
|
22039
|
+
async function installSingleAgent(name, targetDir, clawDir, asMain = false, preResolvedClawDirs) {
|
|
19833
22040
|
if (targetDir) {
|
|
19834
22041
|
await installSingleAgentToClaw(name, null, targetDir, asMain);
|
|
19835
22042
|
return;
|
|
19836
22043
|
}
|
|
19837
|
-
const allClawDirs = resolveAllClawDirs(clawDir);
|
|
22044
|
+
const allClawDirs = preResolvedClawDirs || resolveAllClawDirs(clawDir);
|
|
19838
22045
|
if (allClawDirs.length === 0) {
|
|
19839
22046
|
console.log(source_default.red("OpenClaw/LightClaw workspace directory not found."));
|
|
19840
22047
|
printOpenClawInstallHelp();
|
|
@@ -20064,7 +22271,8 @@ async function installRecipeFromRegistry(name, recipe, targetDir, clawDir) {
|
|
|
20064
22271
|
await tryRestartGateway(resolvedClawDir);
|
|
20065
22272
|
}
|
|
20066
22273
|
}
|
|
20067
|
-
async function installFromSource(source, targetDir, clawDir, asMain) {
|
|
22274
|
+
async function installFromSource(source, targetDir, clawDir, asMain, clawExplicit, skipConfirm = false) {
|
|
22275
|
+
if (asMain === null) return;
|
|
20068
22276
|
const spinner = createSpinner("Analyzing package...").start();
|
|
20069
22277
|
let packageDir;
|
|
20070
22278
|
let tempDir = null;
|
|
@@ -20085,7 +22293,7 @@ async function installFromSource(source, targetDir, clawDir, asMain) {
|
|
|
20085
22293
|
const contentType = response.headers.get("content-type") || "";
|
|
20086
22294
|
logger.debug(`Response content-type: ${contentType}`);
|
|
20087
22295
|
if (contentType.includes("zip") || source.endsWith(".zip")) {
|
|
20088
|
-
const JSZip = (await Promise.resolve().then(() => __toESM(
|
|
22296
|
+
const JSZip = (await Promise.resolve().then(() => __toESM(require_lib4(), 1))).default;
|
|
20089
22297
|
const arrayBuffer = await response.arrayBuffer();
|
|
20090
22298
|
const zip = await JSZip.loadAsync(arrayBuffer);
|
|
20091
22299
|
tempDir = import_node_path12.default.join(process.env.HOME || "/tmp", ".soulhub", "tmp", `pkg-${Date.now()}`);
|
|
@@ -20099,7 +22307,7 @@ async function installFromSource(source, targetDir, clawDir, asMain) {
|
|
|
20099
22307
|
}
|
|
20100
22308
|
} else if (source.endsWith(".zip")) {
|
|
20101
22309
|
spinner.text = "Extracting ZIP file...";
|
|
20102
|
-
const JSZip = (await Promise.resolve().then(() => __toESM(
|
|
22310
|
+
const JSZip = (await Promise.resolve().then(() => __toESM(require_lib4(), 1))).default;
|
|
20103
22311
|
const zipData = import_node_fs9.default.readFileSync(import_node_path12.default.resolve(source));
|
|
20104
22312
|
const zip = await JSZip.loadAsync(zipData);
|
|
20105
22313
|
tempDir = import_node_path12.default.join(process.env.HOME || "/tmp", ".soulhub", "tmp", `pkg-${Date.now()}`);
|
|
@@ -20118,7 +22326,7 @@ async function installFromSource(source, targetDir, clawDir, asMain) {
|
|
|
20118
22326
|
spinner.text = `Detected package type: ${source_default.blue(kind)}`;
|
|
20119
22327
|
if (kind === "agent") {
|
|
20120
22328
|
spinner.stop();
|
|
20121
|
-
await installSingleAgentFromDir(packageDir, targetDir, clawDir, asMain);
|
|
22329
|
+
await installSingleAgentFromDir(packageDir, targetDir, clawDir, asMain, clawExplicit, skipConfirm);
|
|
20122
22330
|
} else if (kind === "team") {
|
|
20123
22331
|
spinner.stop();
|
|
20124
22332
|
await installTeamFromDir(packageDir, targetDir, clawDir);
|
|
@@ -20130,14 +22338,30 @@ async function installFromSource(source, targetDir, clawDir, asMain) {
|
|
|
20130
22338
|
import_node_fs9.default.rmSync(tempDir, { recursive: true, force: true });
|
|
20131
22339
|
}
|
|
20132
22340
|
}
|
|
20133
|
-
async function installSingleAgentFromDir(packageDir, targetDir, clawDir, asMain = false) {
|
|
22341
|
+
async function installSingleAgentFromDir(packageDir, targetDir, clawDir, asMain = false, clawExplicit, skipConfirm = false) {
|
|
20134
22342
|
const pkg = readSoulHubPackage(packageDir);
|
|
20135
22343
|
const agentName = pkg?.name || import_node_path12.default.basename(packageDir);
|
|
22344
|
+
if (asMain) {
|
|
22345
|
+
console.log();
|
|
22346
|
+
console.log(source_default.yellow(" \u26A0 Installing as main agent will overwrite the current workspace/ content."));
|
|
22347
|
+
console.log(source_default.yellow(" The existing persona (IDENTITY.md, SOUL.md, etc.) will be replaced."));
|
|
22348
|
+
console.log(source_default.yellow(" Memory and conversation history will NOT be affected."));
|
|
22349
|
+
console.log();
|
|
22350
|
+
if (!skipConfirm) {
|
|
22351
|
+
const confirmed = await promptConfirm("Continue?", true);
|
|
22352
|
+
if (!confirmed) {
|
|
22353
|
+
console.log(source_default.dim(" Installation cancelled."));
|
|
22354
|
+
return;
|
|
22355
|
+
}
|
|
22356
|
+
} else {
|
|
22357
|
+
console.log(source_default.dim(" Auto-confirmed with --yes flag."));
|
|
22358
|
+
}
|
|
22359
|
+
}
|
|
20136
22360
|
if (targetDir) {
|
|
20137
22361
|
await installSingleAgentFromDirToClaw(packageDir, agentName, pkg, null, targetDir, asMain);
|
|
20138
22362
|
return;
|
|
20139
22363
|
}
|
|
20140
|
-
const allClawDirs =
|
|
22364
|
+
const allClawDirs = await resolveClawDirsInteractive(clawDir, clawExplicit);
|
|
20141
22365
|
if (allClawDirs.length === 0) {
|
|
20142
22366
|
console.log(source_default.red("OpenClaw/LightClaw workspace directory not found."));
|
|
20143
22367
|
printOpenClawInstallHelp();
|
|
@@ -20418,7 +22642,7 @@ async function extractZipToDir(zip, targetDir) {
|
|
|
20418
22642
|
}
|
|
20419
22643
|
function printOpenClawInstallHelp() {
|
|
20420
22644
|
console.log(source_default.dim(" Please install OpenClaw or LightClaw first, or use one of the following options:"));
|
|
20421
|
-
console.log(source_default.dim(" --
|
|
22645
|
+
console.log(source_default.dim(" --claw-type <type> Specify claw type: OpenClaw or LightClaw"));
|
|
20422
22646
|
console.log(source_default.dim(" --dir <path> Specify agent target directory directly"));
|
|
20423
22647
|
console.log(source_default.dim(" OPENCLAW_HOME=<path> Set environment variable (for OpenClaw)"));
|
|
20424
22648
|
console.log(source_default.dim(" LIGHTCLAW_HOME=<path> Set environment variable (for LightClaw)"));
|
|
@@ -20451,17 +22675,31 @@ async function tryRestartGateway(clawDir) {
|
|
|
20451
22675
|
}
|
|
20452
22676
|
|
|
20453
22677
|
// src/commands/list.ts
|
|
20454
|
-
var listCommand = new Command("list").description("List installed agents").alias("ls").action(async () => {
|
|
22678
|
+
var listCommand = new Command("list").description("List installed agents").alias("ls").option("--json", "Output results in JSON format").action(async (options) => {
|
|
20455
22679
|
try {
|
|
20456
22680
|
const config = loadConfig();
|
|
20457
22681
|
if (config.installed.length === 0) {
|
|
20458
|
-
|
|
20459
|
-
|
|
20460
|
-
|
|
20461
|
-
|
|
20462
|
-
|
|
20463
|
-
|
|
20464
|
-
|
|
22682
|
+
if (options.json) {
|
|
22683
|
+
console.log(JSON.stringify([], null, 2));
|
|
22684
|
+
} else {
|
|
22685
|
+
console.log(source_default.yellow("\n No agents installed yet.\n"));
|
|
22686
|
+
console.log(
|
|
22687
|
+
source_default.dim(" Install one: soulhub install <name>")
|
|
22688
|
+
);
|
|
22689
|
+
console.log(
|
|
22690
|
+
source_default.dim(" Browse all: soulhub search\n")
|
|
22691
|
+
);
|
|
22692
|
+
}
|
|
22693
|
+
return;
|
|
22694
|
+
}
|
|
22695
|
+
if (options.json) {
|
|
22696
|
+
const jsonOutput = config.installed.map((a) => ({
|
|
22697
|
+
name: a.name,
|
|
22698
|
+
version: a.version,
|
|
22699
|
+
installedAt: a.installedAt,
|
|
22700
|
+
workspace: a.workspace
|
|
22701
|
+
}));
|
|
22702
|
+
console.log(JSON.stringify(jsonOutput, null, 2));
|
|
20465
22703
|
return;
|
|
20466
22704
|
}
|
|
20467
22705
|
console.log(
|
|
@@ -20519,6 +22757,19 @@ var updateCommand = new Command("update").description("Update installed agents t
|
|
|
20519
22757
|
}
|
|
20520
22758
|
spinner.text = `Updating ${source_default.cyan(installed.name)} (${installed.version} \u2192 ${remote.version})...`;
|
|
20521
22759
|
const workspaceDir = installed.workspace;
|
|
22760
|
+
const backupDir = backupAgentWorkspace(workspaceDir);
|
|
22761
|
+
if (backupDir) {
|
|
22762
|
+
const backupRecord = createBackupRecord("single-agent", installed.name, workspaceDir);
|
|
22763
|
+
addBackupItem(backupRecord, {
|
|
22764
|
+
originalPath: workspaceDir,
|
|
22765
|
+
backupPath: backupDir,
|
|
22766
|
+
method: "cp",
|
|
22767
|
+
role: "worker",
|
|
22768
|
+
agentId: installed.name
|
|
22769
|
+
});
|
|
22770
|
+
commitBackupRecord(backupRecord);
|
|
22771
|
+
logger.info(`Update backup created for ${installed.name}`, { backupDir });
|
|
22772
|
+
}
|
|
20522
22773
|
if (!import_node_fs10.default.existsSync(workspaceDir)) {
|
|
20523
22774
|
import_node_fs10.default.mkdirSync(workspaceDir, { recursive: true });
|
|
20524
22775
|
}
|
|
@@ -20547,20 +22798,108 @@ var updateCommand = new Command("update").description("Update installed agents t
|
|
|
20547
22798
|
}
|
|
20548
22799
|
});
|
|
20549
22800
|
|
|
20550
|
-
// src/commands/
|
|
22801
|
+
// src/commands/uninstall.ts
|
|
20551
22802
|
var import_node_fs11 = __toESM(require("fs"), 1);
|
|
22803
|
+
var uninstallCommand = new Command("uninstall").description("Uninstall an agent template").alias("rm").argument("<name>", "Agent name to uninstall").option("--keep-files", "Remove from registry but keep workspace files").option("-y, --yes", "Skip all confirmation prompts (auto-confirm)").action(async (name, options) => {
|
|
22804
|
+
try {
|
|
22805
|
+
const config = loadConfig();
|
|
22806
|
+
const installed = config.installed.find((a) => a.name === name);
|
|
22807
|
+
if (!installed) {
|
|
22808
|
+
console.error(
|
|
22809
|
+
source_default.red(`
|
|
22810
|
+
Agent "${name}" is not installed.
|
|
22811
|
+
`)
|
|
22812
|
+
);
|
|
22813
|
+
console.log(
|
|
22814
|
+
source_default.dim(" Use 'soulhub list' to see installed agents.")
|
|
22815
|
+
);
|
|
22816
|
+
process.exit(1);
|
|
22817
|
+
}
|
|
22818
|
+
const spinner = createSpinner(
|
|
22819
|
+
`Uninstalling ${source_default.cyan(name)}...`
|
|
22820
|
+
).start();
|
|
22821
|
+
const manifest = loadBackupManifest();
|
|
22822
|
+
const relatedRecords = manifest.records.filter((r) => r.packageName === name);
|
|
22823
|
+
if (relatedRecords.length > 0) {
|
|
22824
|
+
spinner.stop();
|
|
22825
|
+
console.log(
|
|
22826
|
+
source_default.yellow(`
|
|
22827
|
+
\u26A0 Found ${relatedRecords.length} backup record(s) for "${name}".`)
|
|
22828
|
+
);
|
|
22829
|
+
console.log(
|
|
22830
|
+
source_default.yellow(` Uninstalling will also delete all related backup files.`)
|
|
22831
|
+
);
|
|
22832
|
+
console.log(
|
|
22833
|
+
source_default.yellow(` After deletion, you will NOT be able to rollback this agent.
|
|
22834
|
+
`)
|
|
22835
|
+
);
|
|
22836
|
+
if (!options.yes) {
|
|
22837
|
+
const confirmed = await promptConfirm("Proceed with uninstall?");
|
|
22838
|
+
if (!confirmed) {
|
|
22839
|
+
console.log(source_default.dim("\n Uninstall cancelled.\n"));
|
|
22840
|
+
return;
|
|
22841
|
+
}
|
|
22842
|
+
} else {
|
|
22843
|
+
console.log(source_default.dim(" Auto-confirmed with --yes flag."));
|
|
22844
|
+
}
|
|
22845
|
+
spinner.start(`Uninstalling ${source_default.cyan(name)}...`);
|
|
22846
|
+
}
|
|
22847
|
+
if (!options.keepFiles && import_node_fs11.default.existsSync(installed.workspace)) {
|
|
22848
|
+
import_node_fs11.default.rmSync(installed.workspace, { recursive: true, force: true });
|
|
22849
|
+
spinner.text = `Removed workspace: ${installed.workspace}`;
|
|
22850
|
+
}
|
|
22851
|
+
removeInstallRecord(name);
|
|
22852
|
+
if (relatedRecords.length > 0) {
|
|
22853
|
+
for (const record of relatedRecords) {
|
|
22854
|
+
for (const item of record.items) {
|
|
22855
|
+
if (import_node_fs11.default.existsSync(item.backupPath)) {
|
|
22856
|
+
import_node_fs11.default.rmSync(item.backupPath, { recursive: true, force: true });
|
|
22857
|
+
logger.info(`Cleaned backup file for uninstalled agent`, { backupPath: item.backupPath });
|
|
22858
|
+
}
|
|
22859
|
+
}
|
|
22860
|
+
}
|
|
22861
|
+
manifest.records = manifest.records.filter((r) => r.packageName !== name);
|
|
22862
|
+
saveBackupManifest(manifest);
|
|
22863
|
+
spinner.text = `Cleaned ${relatedRecords.length} backup record(s)`;
|
|
22864
|
+
logger.info(`Cleaned ${relatedRecords.length} backup record(s) for ${name}`);
|
|
22865
|
+
}
|
|
22866
|
+
logger.info(`Agent uninstalled: ${name}`, { workspace: installed.workspace, keepFiles: !!options.keepFiles });
|
|
22867
|
+
spinner.succeed(
|
|
22868
|
+
`${source_default.cyan.bold(name)} uninstalled.`
|
|
22869
|
+
);
|
|
22870
|
+
if (options.keepFiles) {
|
|
22871
|
+
console.log(
|
|
22872
|
+
source_default.dim(` Files kept at: ${installed.workspace}`)
|
|
22873
|
+
);
|
|
22874
|
+
}
|
|
22875
|
+
console.log();
|
|
22876
|
+
} catch (error) {
|
|
22877
|
+
logger.errorObj("Uninstall command failed", error);
|
|
22878
|
+
console.error(
|
|
22879
|
+
source_default.red(`Error: ${error instanceof Error ? error.message : error}`)
|
|
22880
|
+
);
|
|
22881
|
+
console.error(source_default.dim(` See logs: ${logger.getTodayLogFile()}`));
|
|
22882
|
+
process.exit(1);
|
|
22883
|
+
}
|
|
22884
|
+
});
|
|
22885
|
+
|
|
22886
|
+
// src/commands/rollback.ts
|
|
22887
|
+
var import_node_fs12 = __toESM(require("fs"), 1);
|
|
20552
22888
|
var import_node_path13 = __toESM(require("path"), 1);
|
|
20553
|
-
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(
|
|
20554
|
-
"--
|
|
22889
|
+
var rollbackCommand = new Command("rollback").description("Rollback to a previous agent installation state").option("--list", "List available rollback records").option("--id <id>", "Rollback to a specific backup record by ID").option("--last <n>", "Rollback the Nth most recent installation (1 = latest, 2 = second latest, etc.)", parseInt).option(
|
|
22890
|
+
"--claw-type <type>",
|
|
20555
22891
|
"Specify claw type: OpenClaw or LightClaw (case-insensitive)"
|
|
20556
|
-
).action(async (options) => {
|
|
22892
|
+
).option("-y, --yes", "Skip all confirmation prompts (auto-confirm)").action(async (options) => {
|
|
20557
22893
|
try {
|
|
22894
|
+
const skipConfirm = !!options.yes;
|
|
20558
22895
|
if (options.list) {
|
|
20559
22896
|
listBackupRecords();
|
|
20560
22897
|
} else if (options.id) {
|
|
20561
|
-
await performRollback(options.id, options.
|
|
22898
|
+
await performRollback(options.id, options.clawType, skipConfirm);
|
|
22899
|
+
} else if (options.last) {
|
|
22900
|
+
await performRollbackByIndex(options.last, options.clawType, skipConfirm);
|
|
20562
22901
|
} else {
|
|
20563
|
-
await
|
|
22902
|
+
await interactiveRollback(options.clawType);
|
|
20564
22903
|
}
|
|
20565
22904
|
} catch (error) {
|
|
20566
22905
|
logger.errorObj("Rollback command failed", error);
|
|
@@ -20579,53 +22918,175 @@ function listBackupRecords() {
|
|
|
20579
22918
|
return;
|
|
20580
22919
|
}
|
|
20581
22920
|
console.log(source_default.bold("\nAvailable rollback records:\n"));
|
|
22921
|
+
printRecordTable(manifest.records);
|
|
22922
|
+
console.log();
|
|
22923
|
+
console.log(source_default.dim(" Usage:"));
|
|
22924
|
+
console.log(source_default.dim(" soulhub rollback # Interactive: select a record to rollback"));
|
|
22925
|
+
console.log(source_default.dim(" soulhub rollback --last 1 # Rollback the latest installation"));
|
|
22926
|
+
console.log(source_default.dim(" soulhub rollback --last 2 # Rollback the 2nd latest installation"));
|
|
22927
|
+
console.log(source_default.dim(" soulhub rollback --id <id> # Rollback to a specific record by ID"));
|
|
22928
|
+
console.log();
|
|
22929
|
+
}
|
|
22930
|
+
function printRecordTable(records) {
|
|
20582
22931
|
console.log(
|
|
20583
22932
|
source_default.dim(
|
|
20584
|
-
` ${"ID".padEnd(20)} ${"Type".padEnd(20)} ${"Package".padEnd(20)} ${"Date".padEnd(22)} Items`
|
|
22933
|
+
` ${"#".padEnd(4)} ${"ID".padEnd(20)} ${"Type".padEnd(20)} ${"Package".padEnd(20)} ${"Claw".padEnd(14)} ${"Date".padEnd(22)} Items`
|
|
20585
22934
|
)
|
|
20586
22935
|
);
|
|
20587
|
-
console.log(source_default.dim(" " + "\u2500".repeat(
|
|
20588
|
-
|
|
22936
|
+
console.log(source_default.dim(" " + "\u2500".repeat(108)));
|
|
22937
|
+
records.forEach((record, index) => {
|
|
20589
22938
|
const date = new Date(record.createdAt).toLocaleString();
|
|
20590
22939
|
const typeLabel = formatInstallType(record.installType);
|
|
20591
22940
|
const itemCount = record.items.length;
|
|
22941
|
+
const clawBrand = detectClawBrandFromDir(record.clawDir);
|
|
20592
22942
|
console.log(
|
|
20593
|
-
` ${source_default.cyan(record.id.padEnd(20))} ${typeLabel.padEnd(20)} ${source_default.white(record.packageName.padEnd(20))} ${source_default.dim(date.padEnd(22))} ${itemCount} backup(s)`
|
|
22943
|
+
` ${source_default.yellow(String(index + 1).padEnd(4))} ${source_default.cyan(record.id.padEnd(20))} ${typeLabel.padEnd(20)} ${source_default.white(record.packageName.padEnd(20))} ${source_default.dim(clawBrand.padEnd(14))} ${source_default.dim(date.padEnd(22))} ${itemCount} backup(s)`
|
|
20594
22944
|
);
|
|
22945
|
+
});
|
|
22946
|
+
}
|
|
22947
|
+
async function interactiveRollback(clawDir) {
|
|
22948
|
+
const manifest = loadBackupManifest();
|
|
22949
|
+
if (manifest.records.length === 0) {
|
|
22950
|
+
console.log(source_default.yellow("No backup records found. Nothing to rollback."));
|
|
22951
|
+
console.log(source_default.dim(" Backup records are created automatically when you install agents."));
|
|
22952
|
+
return;
|
|
20595
22953
|
}
|
|
22954
|
+
console.log(source_default.bold("\n Available rollback records:\n"));
|
|
22955
|
+
printRecordTable(manifest.records);
|
|
20596
22956
|
console.log();
|
|
20597
|
-
|
|
20598
|
-
|
|
20599
|
-
|
|
22957
|
+
let selected;
|
|
22958
|
+
try {
|
|
22959
|
+
selected = await dist_default6({
|
|
22960
|
+
message: "Select a record to rollback:",
|
|
22961
|
+
choices: manifest.records.map((record, index) => {
|
|
22962
|
+
const date = new Date(record.createdAt).toLocaleString();
|
|
22963
|
+
const clawBrand = detectClawBrandFromDir(record.clawDir);
|
|
22964
|
+
return {
|
|
22965
|
+
name: `#${index + 1} ${record.id} ${record.packageName} (${clawBrand}, ${date})`,
|
|
22966
|
+
value: record
|
|
22967
|
+
};
|
|
22968
|
+
})
|
|
22969
|
+
});
|
|
22970
|
+
} catch {
|
|
22971
|
+
console.log(source_default.dim(" Rollback cancelled."));
|
|
22972
|
+
return;
|
|
22973
|
+
}
|
|
20600
22974
|
console.log();
|
|
22975
|
+
console.log(source_default.dim(` Selected: ${source_default.cyan(selected.id)} (${selected.packageName})`));
|
|
22976
|
+
printRollbackDetails(selected);
|
|
22977
|
+
const confirmed = await promptConfirmRollback();
|
|
22978
|
+
if (!confirmed) {
|
|
22979
|
+
console.log(source_default.dim(" Rollback cancelled."));
|
|
22980
|
+
return;
|
|
22981
|
+
}
|
|
22982
|
+
await executeRollback(selected, clawDir);
|
|
20601
22983
|
}
|
|
20602
|
-
async function
|
|
22984
|
+
async function performRollbackByIndex(n, clawDir, skipConfirm = false) {
|
|
20603
22985
|
const manifest = loadBackupManifest();
|
|
20604
22986
|
if (manifest.records.length === 0) {
|
|
20605
22987
|
console.log(source_default.yellow("No backup records found. Nothing to rollback."));
|
|
20606
22988
|
return;
|
|
20607
22989
|
}
|
|
20608
|
-
|
|
20609
|
-
|
|
20610
|
-
|
|
20611
|
-
|
|
20612
|
-
|
|
20613
|
-
|
|
22990
|
+
if (n < 1 || n > manifest.records.length) {
|
|
22991
|
+
console.error(source_default.red(`Invalid index: ${n}. Available range: 1-${manifest.records.length}`));
|
|
22992
|
+
console.log(source_default.dim(" Use 'soulhub rollback --list' to see all available records."));
|
|
22993
|
+
return;
|
|
22994
|
+
}
|
|
22995
|
+
const record = manifest.records[n - 1];
|
|
22996
|
+
console.log(
|
|
22997
|
+
source_default.dim(
|
|
22998
|
+
`
|
|
22999
|
+
Rolling back #${n}: ${source_default.cyan(record.id)} (${record.packageName})`
|
|
23000
|
+
)
|
|
23001
|
+
);
|
|
23002
|
+
printRollbackDetails(record);
|
|
23003
|
+
if (!skipConfirm) {
|
|
23004
|
+
let confirmed;
|
|
23005
|
+
try {
|
|
23006
|
+
confirmed = await dist_default5({
|
|
23007
|
+
message: `${source_default.yellow("\u26A0")} Proceed with rollback?`,
|
|
23008
|
+
default: true
|
|
23009
|
+
});
|
|
23010
|
+
} catch {
|
|
23011
|
+
confirmed = false;
|
|
23012
|
+
}
|
|
23013
|
+
if (!confirmed) {
|
|
23014
|
+
console.log(source_default.dim(" Rollback cancelled."));
|
|
20614
23015
|
return;
|
|
20615
23016
|
}
|
|
20616
23017
|
} else {
|
|
20617
|
-
|
|
20618
|
-
|
|
20619
|
-
|
|
20620
|
-
|
|
20621
|
-
|
|
20622
|
-
|
|
23018
|
+
console.log(source_default.dim(" Auto-confirmed with --yes flag."));
|
|
23019
|
+
}
|
|
23020
|
+
await executeRollback(record, clawDir);
|
|
23021
|
+
}
|
|
23022
|
+
async function performRollback(recordId, clawDir, skipConfirm = false) {
|
|
23023
|
+
const manifest = loadBackupManifest();
|
|
23024
|
+
if (manifest.records.length === 0) {
|
|
23025
|
+
console.log(source_default.yellow("No backup records found. Nothing to rollback."));
|
|
23026
|
+
return;
|
|
23027
|
+
}
|
|
23028
|
+
const record = manifest.records.find((r) => r.id === recordId);
|
|
23029
|
+
if (!record) {
|
|
23030
|
+
console.error(source_default.red(`Backup record "${recordId}" not found.`));
|
|
23031
|
+
console.log(source_default.dim(" Use 'soulhub rollback --list' to see available records."));
|
|
23032
|
+
return;
|
|
23033
|
+
}
|
|
23034
|
+
console.log(
|
|
23035
|
+
source_default.dim(
|
|
23036
|
+
`
|
|
23037
|
+
Rolling back: ${source_default.cyan(record.id)} (${record.packageName})`
|
|
23038
|
+
)
|
|
23039
|
+
);
|
|
23040
|
+
printRollbackDetails(record);
|
|
23041
|
+
if (!skipConfirm) {
|
|
23042
|
+
const confirmed = await promptConfirmRollback();
|
|
23043
|
+
if (!confirmed) {
|
|
23044
|
+
console.log(source_default.dim(" Rollback cancelled."));
|
|
23045
|
+
return;
|
|
23046
|
+
}
|
|
23047
|
+
} else {
|
|
23048
|
+
console.log(source_default.dim(" Auto-confirmed with --yes flag."));
|
|
23049
|
+
}
|
|
23050
|
+
await executeRollback(record, clawDir);
|
|
23051
|
+
}
|
|
23052
|
+
function printRollbackDetails(record) {
|
|
23053
|
+
console.log();
|
|
23054
|
+
console.log(source_default.dim(" Rollback details:"));
|
|
23055
|
+
console.log(source_default.dim(` Package: ${record.packageName}`));
|
|
23056
|
+
console.log(source_default.dim(` Type: ${formatInstallType(record.installType)}`));
|
|
23057
|
+
console.log(source_default.dim(` Claw dir: ${record.clawDir}`));
|
|
23058
|
+
console.log(source_default.dim(` Date: ${new Date(record.createdAt).toLocaleString()}`));
|
|
23059
|
+
if (record.items.length > 0) {
|
|
23060
|
+
console.log(source_default.dim(` Backups to restore:`));
|
|
23061
|
+
for (const item of record.items) {
|
|
23062
|
+
const methodLabel = item.method === "mv" ? "move back" : "copy back";
|
|
23063
|
+
console.log(source_default.dim(` - ${item.agentId} (${item.role}, ${methodLabel})`));
|
|
23064
|
+
}
|
|
23065
|
+
}
|
|
23066
|
+
if (record.installedWorkerIds.length > 0) {
|
|
23067
|
+
console.log(source_default.dim(` Workers to remove: ${record.installedWorkerIds.join(", ")}`));
|
|
23068
|
+
}
|
|
23069
|
+
if (record.installedMainAgent) {
|
|
23070
|
+
console.log(source_default.dim(` Main agent to revert: ${record.installedMainAgent}`));
|
|
23071
|
+
}
|
|
23072
|
+
console.log();
|
|
23073
|
+
}
|
|
23074
|
+
async function promptConfirmRollback() {
|
|
23075
|
+
try {
|
|
23076
|
+
return await dist_default5({
|
|
23077
|
+
message: `${source_default.yellow("\u26A0")} Proceed with rollback?`,
|
|
23078
|
+
default: true
|
|
23079
|
+
});
|
|
23080
|
+
} catch {
|
|
23081
|
+
return false;
|
|
20623
23082
|
}
|
|
23083
|
+
}
|
|
23084
|
+
async function executeRollback(record, clawDir) {
|
|
20624
23085
|
const spinner = createSpinner(
|
|
20625
23086
|
`Rolling back ${source_default.cyan(record.packageName)}...`
|
|
20626
23087
|
).start();
|
|
20627
|
-
const resolvedClawDir = clawDir ? findOpenClawDir(clawDir) || record.clawDir :
|
|
20628
|
-
if (!resolvedClawDir || !
|
|
23088
|
+
const resolvedClawDir = clawDir ? findOpenClawDir(clawDir) || record.clawDir : record.clawDir;
|
|
23089
|
+
if (!resolvedClawDir || !import_node_fs12.default.existsSync(resolvedClawDir)) {
|
|
20629
23090
|
spinner.fail(`OpenClaw/LightClaw directory not found: ${record.clawDir}`);
|
|
20630
23091
|
return;
|
|
20631
23092
|
}
|
|
@@ -20645,57 +23106,63 @@ async function performRollback(recordId, clawDir) {
|
|
|
20645
23106
|
spinner.text = "Removing installed workers...";
|
|
20646
23107
|
for (const workerId of record.installedWorkerIds) {
|
|
20647
23108
|
const workerDir = getWorkspaceDir(resolvedClawDir, workerId);
|
|
20648
|
-
if (
|
|
20649
|
-
|
|
23109
|
+
if (import_node_fs12.default.existsSync(workerDir)) {
|
|
23110
|
+
import_node_fs12.default.rmSync(workerDir, { recursive: true, force: true });
|
|
20650
23111
|
logger.info(`Removed installed worker directory`, { workerId, dir: workerDir });
|
|
20651
23112
|
}
|
|
20652
23113
|
const agentConfigDir = import_node_path13.default.join(resolvedClawDir, "agents", workerId);
|
|
20653
|
-
if (
|
|
20654
|
-
|
|
23114
|
+
if (import_node_fs12.default.existsSync(agentConfigDir)) {
|
|
23115
|
+
import_node_fs12.default.rmSync(agentConfigDir, { recursive: true, force: true });
|
|
20655
23116
|
}
|
|
20656
23117
|
}
|
|
20657
23118
|
}
|
|
20658
23119
|
if (record.installedMainAgent) {
|
|
20659
23120
|
const mainWorkspace = getMainWorkspaceDir(resolvedClawDir);
|
|
20660
23121
|
const hasMainBackup = record.items.some((item) => item.role === "main");
|
|
20661
|
-
if (hasMainBackup &&
|
|
23122
|
+
if (hasMainBackup && import_node_fs12.default.existsSync(mainWorkspace)) {
|
|
20662
23123
|
spinner.text = "Cleaning current main workspace...";
|
|
20663
|
-
const entries =
|
|
23124
|
+
const entries = import_node_fs12.default.readdirSync(mainWorkspace);
|
|
20664
23125
|
for (const entry of entries) {
|
|
20665
|
-
|
|
23126
|
+
import_node_fs12.default.rmSync(import_node_path13.default.join(mainWorkspace, entry), { recursive: true, force: true });
|
|
20666
23127
|
}
|
|
20667
23128
|
}
|
|
20668
23129
|
}
|
|
20669
23130
|
let restoredCount = 0;
|
|
20670
23131
|
for (const item of record.items) {
|
|
20671
|
-
if (!
|
|
23132
|
+
if (!import_node_fs12.default.existsSync(item.backupPath)) {
|
|
20672
23133
|
logger.warn(`Backup path not found, skipping`, { backupPath: item.backupPath });
|
|
20673
23134
|
console.log(source_default.yellow(` \u26A0 Backup not found: ${item.backupPath}, skipping...`));
|
|
20674
23135
|
continue;
|
|
20675
23136
|
}
|
|
20676
23137
|
spinner.text = `Restoring ${source_default.cyan(item.agentId)} (${item.role})...`;
|
|
20677
23138
|
if (item.method === "mv") {
|
|
20678
|
-
if (
|
|
20679
|
-
|
|
23139
|
+
if (import_node_fs12.default.existsSync(item.originalPath)) {
|
|
23140
|
+
import_node_fs12.default.rmSync(item.originalPath, { recursive: true, force: true });
|
|
23141
|
+
}
|
|
23142
|
+
import_node_fs12.default.mkdirSync(import_node_path13.default.dirname(item.originalPath), { recursive: true });
|
|
23143
|
+
try {
|
|
23144
|
+
import_node_fs12.default.renameSync(item.backupPath, item.originalPath);
|
|
23145
|
+
} catch {
|
|
23146
|
+
import_node_fs12.default.cpSync(item.backupPath, item.originalPath, { recursive: true });
|
|
23147
|
+
import_node_fs12.default.rmSync(item.backupPath, { recursive: true, force: true });
|
|
20680
23148
|
}
|
|
20681
|
-
import_node_fs11.default.mkdirSync(import_node_path13.default.dirname(item.originalPath), { recursive: true });
|
|
20682
|
-
import_node_fs11.default.renameSync(item.backupPath, item.originalPath);
|
|
20683
23149
|
logger.info(`Restored (mv back)`, { from: item.backupPath, to: item.originalPath });
|
|
20684
23150
|
} else {
|
|
20685
|
-
if (
|
|
20686
|
-
const entries =
|
|
23151
|
+
if (import_node_fs12.default.existsSync(item.originalPath)) {
|
|
23152
|
+
const entries = import_node_fs12.default.readdirSync(item.originalPath);
|
|
20687
23153
|
for (const entry of entries) {
|
|
20688
|
-
|
|
23154
|
+
import_node_fs12.default.rmSync(import_node_path13.default.join(item.originalPath, entry), { recursive: true, force: true });
|
|
20689
23155
|
}
|
|
20690
23156
|
} else {
|
|
20691
|
-
|
|
23157
|
+
import_node_fs12.default.mkdirSync(item.originalPath, { recursive: true });
|
|
20692
23158
|
}
|
|
20693
|
-
|
|
20694
|
-
|
|
23159
|
+
import_node_fs12.default.cpSync(item.backupPath, item.originalPath, { recursive: true });
|
|
23160
|
+
import_node_fs12.default.rmSync(item.backupPath, { recursive: true, force: true });
|
|
20695
23161
|
logger.info(`Restored (cp back)`, { from: item.backupPath, to: item.originalPath });
|
|
20696
23162
|
}
|
|
20697
23163
|
restoredCount++;
|
|
20698
23164
|
}
|
|
23165
|
+
const manifest = loadBackupManifest();
|
|
20699
23166
|
manifest.records = manifest.records.filter((r) => r.id !== record.id);
|
|
20700
23167
|
saveBackupManifest(manifest);
|
|
20701
23168
|
spinner.succeed(
|
|
@@ -20729,16 +23196,23 @@ function formatInstallType(type2) {
|
|
|
20729
23196
|
return type2;
|
|
20730
23197
|
}
|
|
20731
23198
|
}
|
|
23199
|
+
function detectClawBrandFromDir(clawDir) {
|
|
23200
|
+
const dirName = import_node_path13.default.basename(clawDir).toLowerCase();
|
|
23201
|
+
if (dirName.includes("lightclaw")) {
|
|
23202
|
+
return "LightClaw";
|
|
23203
|
+
}
|
|
23204
|
+
return "OpenClaw";
|
|
23205
|
+
}
|
|
20732
23206
|
|
|
20733
23207
|
// src/index.ts
|
|
20734
23208
|
var program2 = new Command();
|
|
20735
|
-
program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.
|
|
23209
|
+
program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.23").option("--verbose", "Enable verbose debug logging").hook("preAction", () => {
|
|
20736
23210
|
const opts = program2.opts();
|
|
20737
23211
|
const verbose = opts.verbose || process.env.SOULHUB_DEBUG === "1";
|
|
20738
23212
|
logger.init(verbose);
|
|
20739
23213
|
logger.info("CLI started", {
|
|
20740
23214
|
args: process.argv.slice(2),
|
|
20741
|
-
version: "1.0.
|
|
23215
|
+
version: "1.0.23",
|
|
20742
23216
|
node: process.version
|
|
20743
23217
|
});
|
|
20744
23218
|
});
|
|
@@ -20747,6 +23221,7 @@ program2.addCommand(infoCommand);
|
|
|
20747
23221
|
program2.addCommand(installCommand);
|
|
20748
23222
|
program2.addCommand(listCommand);
|
|
20749
23223
|
program2.addCommand(updateCommand);
|
|
23224
|
+
program2.addCommand(uninstallCommand);
|
|
20750
23225
|
program2.addCommand(rollbackCommand);
|
|
20751
23226
|
program2.parse();
|
|
20752
23227
|
/*! Bundled license information:
|