@acidicsoil/portable-capabilities 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-release/cli.js +1415 -105
- package/dist-release/cli.js.map +4 -4
- package/dist-release/index.js +1418 -108
- package/dist-release/index.js.map +4 -4
- package/package.json +1 -1
package/dist-release/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
8
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
10
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
11
|
-
get: (
|
|
11
|
+
get: (a3, b) => (typeof require !== "undefined" ? require : a3)[b]
|
|
12
12
|
}) : x)(function(x) {
|
|
13
13
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
14
14
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
@@ -231,8 +231,8 @@ var require_help = __commonJS({
|
|
|
231
231
|
visibleCommands.push(helpCommand);
|
|
232
232
|
}
|
|
233
233
|
if (this.sortSubcommands) {
|
|
234
|
-
visibleCommands.sort((
|
|
235
|
-
return
|
|
234
|
+
visibleCommands.sort((a3, b) => {
|
|
235
|
+
return a3.name().localeCompare(b.name());
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
return visibleCommands;
|
|
@@ -244,11 +244,11 @@ var require_help = __commonJS({
|
|
|
244
244
|
* @param {Option} b
|
|
245
245
|
* @returns {number}
|
|
246
246
|
*/
|
|
247
|
-
compareOptions(
|
|
247
|
+
compareOptions(a3, b) {
|
|
248
248
|
const getSortKey = (option) => {
|
|
249
249
|
return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
|
|
250
250
|
};
|
|
251
|
-
return getSortKey(
|
|
251
|
+
return getSortKey(a3).localeCompare(getSortKey(b));
|
|
252
252
|
}
|
|
253
253
|
/**
|
|
254
254
|
* Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one.
|
|
@@ -1113,38 +1113,38 @@ var require_option = __commonJS({
|
|
|
1113
1113
|
var require_suggestSimilar = __commonJS({
|
|
1114
1114
|
"node_modules/.pnpm/commander@14.0.0/node_modules/commander/lib/suggestSimilar.js"(exports) {
|
|
1115
1115
|
var maxDistance = 3;
|
|
1116
|
-
function editDistance(
|
|
1117
|
-
if (Math.abs(
|
|
1118
|
-
return Math.max(
|
|
1116
|
+
function editDistance(a3, b) {
|
|
1117
|
+
if (Math.abs(a3.length - b.length) > maxDistance)
|
|
1118
|
+
return Math.max(a3.length, b.length);
|
|
1119
1119
|
const d = [];
|
|
1120
|
-
for (let
|
|
1121
|
-
d[
|
|
1120
|
+
for (let i3 = 0; i3 <= a3.length; i3++) {
|
|
1121
|
+
d[i3] = [i3];
|
|
1122
1122
|
}
|
|
1123
1123
|
for (let j = 0; j <= b.length; j++) {
|
|
1124
1124
|
d[0][j] = j;
|
|
1125
1125
|
}
|
|
1126
1126
|
for (let j = 1; j <= b.length; j++) {
|
|
1127
|
-
for (let
|
|
1127
|
+
for (let i3 = 1; i3 <= a3.length; i3++) {
|
|
1128
1128
|
let cost = 1;
|
|
1129
|
-
if (
|
|
1129
|
+
if (a3[i3 - 1] === b[j - 1]) {
|
|
1130
1130
|
cost = 0;
|
|
1131
1131
|
} else {
|
|
1132
1132
|
cost = 1;
|
|
1133
1133
|
}
|
|
1134
|
-
d[
|
|
1135
|
-
d[
|
|
1134
|
+
d[i3][j] = Math.min(
|
|
1135
|
+
d[i3 - 1][j] + 1,
|
|
1136
1136
|
// deletion
|
|
1137
|
-
d[
|
|
1137
|
+
d[i3][j - 1] + 1,
|
|
1138
1138
|
// insertion
|
|
1139
|
-
d[
|
|
1139
|
+
d[i3 - 1][j - 1] + cost
|
|
1140
1140
|
// substitution
|
|
1141
1141
|
);
|
|
1142
|
-
if (
|
|
1143
|
-
d[
|
|
1142
|
+
if (i3 > 1 && j > 1 && a3[i3 - 1] === b[j - 2] && a3[i3 - 2] === b[j - 1]) {
|
|
1143
|
+
d[i3][j] = Math.min(d[i3][j], d[i3 - 2][j - 2] + 1);
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
|
-
return d[
|
|
1147
|
+
return d[a3.length][b.length];
|
|
1148
1148
|
}
|
|
1149
1149
|
function suggestSimilar(word, candidates) {
|
|
1150
1150
|
if (!candidates || candidates.length === 0) return "";
|
|
@@ -1171,7 +1171,7 @@ var require_suggestSimilar = __commonJS({
|
|
|
1171
1171
|
}
|
|
1172
1172
|
}
|
|
1173
1173
|
});
|
|
1174
|
-
similar.sort((
|
|
1174
|
+
similar.sort((a3, b) => a3.localeCompare(b));
|
|
1175
1175
|
if (searchingOptions) {
|
|
1176
1176
|
similar = similar.map((candidate) => `--${candidate}`);
|
|
1177
1177
|
}
|
|
@@ -2366,8 +2366,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2366
2366
|
* @private
|
|
2367
2367
|
*/
|
|
2368
2368
|
_checkNumberOfArguments() {
|
|
2369
|
-
this.registeredArguments.forEach((arg,
|
|
2370
|
-
if (arg.required && this.args[
|
|
2369
|
+
this.registeredArguments.forEach((arg, i3) => {
|
|
2370
|
+
if (arg.required && this.args[i3] == null) {
|
|
2371
2371
|
this.missingArgument(arg.name());
|
|
2372
2372
|
}
|
|
2373
2373
|
});
|
|
@@ -2753,8 +2753,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2753
2753
|
if (this._storeOptionsAsProperties) {
|
|
2754
2754
|
const result2 = {};
|
|
2755
2755
|
const len = this.options.length;
|
|
2756
|
-
for (let
|
|
2757
|
-
const key = this.options[
|
|
2756
|
+
for (let i3 = 0; i3 < len; i3++) {
|
|
2757
|
+
const key = this.options[i3].attributeName();
|
|
2758
2758
|
result2[key] = key === this._versionOptionName ? this._version : this[key];
|
|
2759
2759
|
}
|
|
2760
2760
|
return result2;
|
|
@@ -3198,9 +3198,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3198
3198
|
helpWidth: context.helpWidth,
|
|
3199
3199
|
outputHasColors: context.hasColors
|
|
3200
3200
|
});
|
|
3201
|
-
const
|
|
3202
|
-
if (context.hasColors) return
|
|
3203
|
-
return this._outputConfiguration.stripColor(
|
|
3201
|
+
const text2 = helper.formatHelp(this, helper);
|
|
3202
|
+
if (context.hasColors) return text2;
|
|
3203
|
+
return this._outputConfiguration.stripColor(text2);
|
|
3204
3204
|
}
|
|
3205
3205
|
/**
|
|
3206
3206
|
* @typedef HelpContext
|
|
@@ -3360,7 +3360,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3360
3360
|
* @param {(string | Function)} text - string to add, or a function returning a string
|
|
3361
3361
|
* @return {Command} `this` command for chaining
|
|
3362
3362
|
*/
|
|
3363
|
-
addHelpText(position,
|
|
3363
|
+
addHelpText(position, text2) {
|
|
3364
3364
|
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
|
|
3365
3365
|
if (!allowedValues.includes(position)) {
|
|
3366
3366
|
throw new Error(`Unexpected value for position to addHelpText.
|
|
@@ -3369,10 +3369,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3369
3369
|
const helpEvent = `${position}Help`;
|
|
3370
3370
|
this.on(helpEvent, (context) => {
|
|
3371
3371
|
let helpStr;
|
|
3372
|
-
if (typeof
|
|
3373
|
-
helpStr =
|
|
3372
|
+
if (typeof text2 === "function") {
|
|
3373
|
+
helpStr = text2({ error: context.error, command: context.command });
|
|
3374
3374
|
} else {
|
|
3375
|
-
helpStr =
|
|
3375
|
+
helpStr = text2;
|
|
3376
3376
|
}
|
|
3377
3377
|
if (helpStr) {
|
|
3378
3378
|
context.write(`${helpStr}
|
|
@@ -3459,6 +3459,62 @@ var require_commander = __commonJS({
|
|
|
3459
3459
|
}
|
|
3460
3460
|
});
|
|
3461
3461
|
|
|
3462
|
+
// node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
3463
|
+
var require_src = __commonJS({
|
|
3464
|
+
"node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
|
|
3465
|
+
"use strict";
|
|
3466
|
+
var ESC2 = "\x1B";
|
|
3467
|
+
var CSI2 = `${ESC2}[`;
|
|
3468
|
+
var beep = "\x07";
|
|
3469
|
+
var cursor3 = {
|
|
3470
|
+
to(x, y) {
|
|
3471
|
+
if (!y) return `${CSI2}${x + 1}G`;
|
|
3472
|
+
return `${CSI2}${y + 1};${x + 1}H`;
|
|
3473
|
+
},
|
|
3474
|
+
move(x, y) {
|
|
3475
|
+
let ret = "";
|
|
3476
|
+
if (x < 0) ret += `${CSI2}${-x}D`;
|
|
3477
|
+
else if (x > 0) ret += `${CSI2}${x}C`;
|
|
3478
|
+
if (y < 0) ret += `${CSI2}${-y}A`;
|
|
3479
|
+
else if (y > 0) ret += `${CSI2}${y}B`;
|
|
3480
|
+
return ret;
|
|
3481
|
+
},
|
|
3482
|
+
up: (count2 = 1) => `${CSI2}${count2}A`,
|
|
3483
|
+
down: (count2 = 1) => `${CSI2}${count2}B`,
|
|
3484
|
+
forward: (count2 = 1) => `${CSI2}${count2}C`,
|
|
3485
|
+
backward: (count2 = 1) => `${CSI2}${count2}D`,
|
|
3486
|
+
nextLine: (count2 = 1) => `${CSI2}E`.repeat(count2),
|
|
3487
|
+
prevLine: (count2 = 1) => `${CSI2}F`.repeat(count2),
|
|
3488
|
+
left: `${CSI2}G`,
|
|
3489
|
+
hide: `${CSI2}?25l`,
|
|
3490
|
+
show: `${CSI2}?25h`,
|
|
3491
|
+
save: `${ESC2}7`,
|
|
3492
|
+
restore: `${ESC2}8`
|
|
3493
|
+
};
|
|
3494
|
+
var scroll = {
|
|
3495
|
+
up: (count2 = 1) => `${CSI2}S`.repeat(count2),
|
|
3496
|
+
down: (count2 = 1) => `${CSI2}T`.repeat(count2)
|
|
3497
|
+
};
|
|
3498
|
+
var erase3 = {
|
|
3499
|
+
screen: `${CSI2}2J`,
|
|
3500
|
+
up: (count2 = 1) => `${CSI2}1J`.repeat(count2),
|
|
3501
|
+
down: (count2 = 1) => `${CSI2}J`.repeat(count2),
|
|
3502
|
+
line: `${CSI2}2K`,
|
|
3503
|
+
lineEnd: `${CSI2}K`,
|
|
3504
|
+
lineStart: `${CSI2}1K`,
|
|
3505
|
+
lines(count2) {
|
|
3506
|
+
let clear = "";
|
|
3507
|
+
for (let i3 = 0; i3 < count2; i3++)
|
|
3508
|
+
clear += this.line + (i3 < count2 - 1 ? cursor3.up() : "");
|
|
3509
|
+
if (count2)
|
|
3510
|
+
clear += cursor3.left;
|
|
3511
|
+
return clear;
|
|
3512
|
+
}
|
|
3513
|
+
};
|
|
3514
|
+
module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
|
|
3515
|
+
}
|
|
3516
|
+
});
|
|
3517
|
+
|
|
3462
3518
|
// packages/cli/src/program.ts
|
|
3463
3519
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
3464
3520
|
|
|
@@ -3823,7 +3879,7 @@ async function resolveContractLibrary(root = process.cwd()) {
|
|
|
3823
3879
|
return Object.freeze({
|
|
3824
3880
|
operations: Object.freeze([...operations]),
|
|
3825
3881
|
families: Object.freeze([...families]),
|
|
3826
|
-
roles: Object.freeze(roles.sort((
|
|
3882
|
+
roles: Object.freeze(roles.sort((a3, b) => a3.id.localeCompare(b.id)))
|
|
3827
3883
|
});
|
|
3828
3884
|
}
|
|
3829
3885
|
|
|
@@ -3983,11 +4039,11 @@ import { extname, resolve as resolve4 } from "node:path";
|
|
|
3983
4039
|
import { parseDocument } from "yaml";
|
|
3984
4040
|
async function loadDocument(file) {
|
|
3985
4041
|
const absolute = resolve4(file);
|
|
3986
|
-
const
|
|
4042
|
+
const text2 = await readFile2(absolute, "utf8");
|
|
3987
4043
|
if (extname(absolute).toLowerCase() === ".json") {
|
|
3988
|
-
return { file: absolute, data: JSON.parse(
|
|
4044
|
+
return { file: absolute, data: JSON.parse(text2) };
|
|
3989
4045
|
}
|
|
3990
|
-
const document = parseDocument(
|
|
4046
|
+
const document = parseDocument(text2, { prettyErrors: true, strict: true });
|
|
3991
4047
|
if (document.errors.length > 0) throw document.errors[0];
|
|
3992
4048
|
return { file: absolute, data: document.toJS({ maxAliasCount: 0 }) };
|
|
3993
4049
|
}
|
|
@@ -4078,9 +4134,9 @@ async function resolveSystem(file) {
|
|
|
4078
4134
|
return Object.freeze({
|
|
4079
4135
|
id: root.data.id,
|
|
4080
4136
|
sourceFile: root.file,
|
|
4081
|
-
roles: Object.freeze(roles.sort((
|
|
4082
|
-
runtimes: Object.freeze(runtimes.sort((
|
|
4083
|
-
exceptions: Object.freeze(exceptions.sort((
|
|
4137
|
+
roles: Object.freeze(roles.sort((a3, b) => a3.id.localeCompare(b.id))),
|
|
4138
|
+
runtimes: Object.freeze(runtimes.sort((a3, b) => a3.id.localeCompare(b.id))),
|
|
4139
|
+
exceptions: Object.freeze(exceptions.sort((a3, b) => a3.id.localeCompare(b.id)))
|
|
4084
4140
|
});
|
|
4085
4141
|
}
|
|
4086
4142
|
|
|
@@ -4989,17 +5045,17 @@ var parseExpression = (expression) => {
|
|
|
4989
5045
|
}
|
|
4990
5046
|
throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
|
|
4991
5047
|
};
|
|
4992
|
-
var getSubprocessResult = ({ stdout }) => {
|
|
4993
|
-
if (typeof
|
|
4994
|
-
return
|
|
5048
|
+
var getSubprocessResult = ({ stdout: stdout2 }) => {
|
|
5049
|
+
if (typeof stdout2 === "string") {
|
|
5050
|
+
return stdout2;
|
|
4995
5051
|
}
|
|
4996
|
-
if (isUint8Array(
|
|
4997
|
-
return uint8ArrayToString(
|
|
5052
|
+
if (isUint8Array(stdout2)) {
|
|
5053
|
+
return uint8ArrayToString(stdout2);
|
|
4998
5054
|
}
|
|
4999
|
-
if (
|
|
5055
|
+
if (stdout2 === void 0) {
|
|
5000
5056
|
throw new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`);
|
|
5001
5057
|
}
|
|
5002
|
-
throw new TypeError(`Unexpected "${typeof
|
|
5058
|
+
throw new TypeError(`Unexpected "${typeof stdout2}" stdout in template expression`);
|
|
5003
5059
|
};
|
|
5004
5060
|
|
|
5005
5061
|
// node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/methods/main-sync.js
|
|
@@ -6359,8 +6415,8 @@ var disconnect = (anyProcess) => {
|
|
|
6359
6415
|
// node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/utils/deferred.js
|
|
6360
6416
|
var createDeferred = () => {
|
|
6361
6417
|
const methods = {};
|
|
6362
|
-
const promise = new Promise((
|
|
6363
|
-
Object.assign(methods, { resolve:
|
|
6418
|
+
const promise = new Promise((resolve9, reject) => {
|
|
6419
|
+
Object.assign(methods, { resolve: resolve9, reject });
|
|
6364
6420
|
});
|
|
6365
6421
|
return Object.assign(promise, methods);
|
|
6366
6422
|
};
|
|
@@ -7293,16 +7349,16 @@ var c = class {
|
|
|
7293
7349
|
#n;
|
|
7294
7350
|
#r = false;
|
|
7295
7351
|
#e = void 0;
|
|
7296
|
-
constructor(e,
|
|
7297
|
-
this.#t = e, this.#n =
|
|
7352
|
+
constructor(e, t2) {
|
|
7353
|
+
this.#t = e, this.#n = t2;
|
|
7298
7354
|
}
|
|
7299
7355
|
next() {
|
|
7300
7356
|
const e = () => this.#s();
|
|
7301
7357
|
return this.#e = this.#e ? this.#e.then(e, e) : e(), this.#e;
|
|
7302
7358
|
}
|
|
7303
7359
|
return(e) {
|
|
7304
|
-
const
|
|
7305
|
-
return this.#e ? this.#e.then(
|
|
7360
|
+
const t2 = () => this.#i(e);
|
|
7361
|
+
return this.#e ? this.#e.then(t2, t2) : t2();
|
|
7306
7362
|
}
|
|
7307
7363
|
async #s() {
|
|
7308
7364
|
if (this.#r)
|
|
@@ -7313,8 +7369,8 @@ var c = class {
|
|
|
7313
7369
|
let e;
|
|
7314
7370
|
try {
|
|
7315
7371
|
e = await this.#t.read();
|
|
7316
|
-
} catch (
|
|
7317
|
-
throw this.#e = void 0, this.#r = true, this.#t.releaseLock(),
|
|
7372
|
+
} catch (t2) {
|
|
7373
|
+
throw this.#e = void 0, this.#r = true, this.#t.releaseLock(), t2;
|
|
7318
7374
|
}
|
|
7319
7375
|
return e.done && (this.#e = void 0, this.#r = true, this.#t.releaseLock()), e;
|
|
7320
7376
|
}
|
|
@@ -7325,8 +7381,8 @@ var c = class {
|
|
|
7325
7381
|
value: e
|
|
7326
7382
|
};
|
|
7327
7383
|
if (this.#r = true, !this.#n) {
|
|
7328
|
-
const
|
|
7329
|
-
return this.#t.releaseLock(), await
|
|
7384
|
+
const t2 = this.#t.cancel(e);
|
|
7385
|
+
return this.#t.releaseLock(), await t2, {
|
|
7330
7386
|
done: true,
|
|
7331
7387
|
value: e
|
|
7332
7388
|
};
|
|
@@ -7342,8 +7398,8 @@ function i() {
|
|
|
7342
7398
|
return this[n].next();
|
|
7343
7399
|
}
|
|
7344
7400
|
Object.defineProperty(i, "name", { value: "next" });
|
|
7345
|
-
function o(
|
|
7346
|
-
return this[n].return(
|
|
7401
|
+
function o(r2) {
|
|
7402
|
+
return this[n].return(r2);
|
|
7347
7403
|
}
|
|
7348
7404
|
Object.defineProperty(o, "name", { value: "return" });
|
|
7349
7405
|
var u = Object.create(a, {
|
|
@@ -7360,12 +7416,12 @@ var u = Object.create(a, {
|
|
|
7360
7416
|
value: o
|
|
7361
7417
|
}
|
|
7362
7418
|
});
|
|
7363
|
-
function h({ preventCancel:
|
|
7364
|
-
const e = this.getReader(),
|
|
7419
|
+
function h({ preventCancel: r2 = false } = {}) {
|
|
7420
|
+
const e = this.getReader(), t2 = new c(
|
|
7365
7421
|
e,
|
|
7366
|
-
|
|
7422
|
+
r2
|
|
7367
7423
|
), s = Object.create(u);
|
|
7368
|
-
return s[n] =
|
|
7424
|
+
return s[n] = t2, s;
|
|
7369
7425
|
}
|
|
7370
7426
|
|
|
7371
7427
|
// node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/stream.js
|
|
@@ -8576,13 +8632,13 @@ var getInvalidStdioOptionMessage = (fdNumber, fdName, options, isWritable) => {
|
|
|
8576
8632
|
return `The "${optionName}: ${serializeOptionValue(optionValue)}" option is incompatible with using "${getOptionName(isWritable)}: ${serializeOptionValue(fdName)}".
|
|
8577
8633
|
Please set this option with "pipe" instead.`;
|
|
8578
8634
|
};
|
|
8579
|
-
var getInvalidStdioOption = (fdNumber, { stdin, stdout, stderr, stdio }) => {
|
|
8635
|
+
var getInvalidStdioOption = (fdNumber, { stdin: stdin2, stdout: stdout2, stderr, stdio }) => {
|
|
8580
8636
|
const usedDescriptor = getUsedDescriptor(fdNumber);
|
|
8581
|
-
if (usedDescriptor === 0 &&
|
|
8582
|
-
return { optionName: "stdin", optionValue:
|
|
8637
|
+
if (usedDescriptor === 0 && stdin2 !== void 0) {
|
|
8638
|
+
return { optionName: "stdin", optionValue: stdin2 };
|
|
8583
8639
|
}
|
|
8584
|
-
if (usedDescriptor === 1 &&
|
|
8585
|
-
return { optionName: "stdout", optionValue:
|
|
8640
|
+
if (usedDescriptor === 1 && stdout2 !== void 0) {
|
|
8641
|
+
return { optionName: "stdout", optionValue: stdout2 };
|
|
8586
8642
|
}
|
|
8587
8643
|
if (usedDescriptor === 2 && stderr !== void 0) {
|
|
8588
8644
|
return { optionName: "stderr", optionValue: stderr };
|
|
@@ -9472,26 +9528,26 @@ var writeToFiles = (serializedResult, stdioItems, outputFiles) => {
|
|
|
9472
9528
|
};
|
|
9473
9529
|
|
|
9474
9530
|
// node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/resolve/all-sync.js
|
|
9475
|
-
var getAllSync = ([,
|
|
9531
|
+
var getAllSync = ([, stdout2, stderr], options) => {
|
|
9476
9532
|
if (!options.all) {
|
|
9477
9533
|
return;
|
|
9478
9534
|
}
|
|
9479
|
-
if (
|
|
9535
|
+
if (stdout2 === void 0) {
|
|
9480
9536
|
return stderr;
|
|
9481
9537
|
}
|
|
9482
9538
|
if (stderr === void 0) {
|
|
9483
|
-
return
|
|
9539
|
+
return stdout2;
|
|
9484
9540
|
}
|
|
9485
|
-
if (Array.isArray(
|
|
9486
|
-
return Array.isArray(stderr) ? [...
|
|
9541
|
+
if (Array.isArray(stdout2)) {
|
|
9542
|
+
return Array.isArray(stderr) ? [...stdout2, ...stderr] : [...stdout2, stripNewline(stderr, options, "all")];
|
|
9487
9543
|
}
|
|
9488
9544
|
if (Array.isArray(stderr)) {
|
|
9489
|
-
return [stripNewline(
|
|
9545
|
+
return [stripNewline(stdout2, options, "all"), ...stderr];
|
|
9490
9546
|
}
|
|
9491
|
-
if (isUint8Array(
|
|
9492
|
-
return concatUint8Arrays([
|
|
9547
|
+
if (isUint8Array(stdout2) && isUint8Array(stderr)) {
|
|
9548
|
+
return concatUint8Arrays([stdout2, stderr]);
|
|
9493
9549
|
}
|
|
9494
|
-
return `${
|
|
9550
|
+
return `${stdout2}${stderr}`;
|
|
9495
9551
|
};
|
|
9496
9552
|
|
|
9497
9553
|
// node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/resolve/exit-async.js
|
|
@@ -9937,15 +9993,15 @@ var handleEarlyError = ({ error, command, escapedCommand, fileDescriptors, optio
|
|
|
9937
9993
|
};
|
|
9938
9994
|
};
|
|
9939
9995
|
var createDummyStreams = (subprocess, fileDescriptors) => {
|
|
9940
|
-
const
|
|
9941
|
-
const
|
|
9996
|
+
const stdin2 = createDummyStream();
|
|
9997
|
+
const stdout2 = createDummyStream();
|
|
9942
9998
|
const stderr = createDummyStream();
|
|
9943
9999
|
const extraStdio = Array.from({ length: fileDescriptors.length - 3 }, createDummyStream);
|
|
9944
10000
|
const all = createDummyStream();
|
|
9945
|
-
const stdio = [
|
|
10001
|
+
const stdio = [stdin2, stdout2, stderr, ...extraStdio];
|
|
9946
10002
|
Object.assign(subprocess, {
|
|
9947
|
-
stdin,
|
|
9948
|
-
stdout,
|
|
10003
|
+
stdin: stdin2,
|
|
10004
|
+
stdout: stdout2,
|
|
9949
10005
|
stderr,
|
|
9950
10006
|
stdio
|
|
9951
10007
|
});
|
|
@@ -10430,14 +10486,14 @@ var Emitter = class {
|
|
|
10430
10486
|
}
|
|
10431
10487
|
removeListener(ev, fn) {
|
|
10432
10488
|
const list = this.listeners[ev];
|
|
10433
|
-
const
|
|
10434
|
-
if (
|
|
10489
|
+
const i3 = list.indexOf(fn);
|
|
10490
|
+
if (i3 === -1) {
|
|
10435
10491
|
return;
|
|
10436
10492
|
}
|
|
10437
|
-
if (
|
|
10493
|
+
if (i3 === 0 && list.length === 1) {
|
|
10438
10494
|
list.length = 0;
|
|
10439
10495
|
} else {
|
|
10440
|
-
list.splice(
|
|
10496
|
+
list.splice(i3, 1);
|
|
10441
10497
|
}
|
|
10442
10498
|
}
|
|
10443
10499
|
emit(ev, code, signal) {
|
|
@@ -10547,8 +10603,8 @@ var SignalExit = class extends SignalExitBase {
|
|
|
10547
10603
|
} catch (_) {
|
|
10548
10604
|
}
|
|
10549
10605
|
}
|
|
10550
|
-
this.#process.emit = (ev, ...
|
|
10551
|
-
return this.#processEmit(ev, ...
|
|
10606
|
+
this.#process.emit = (ev, ...a3) => {
|
|
10607
|
+
return this.#processEmit(ev, ...a3);
|
|
10552
10608
|
};
|
|
10553
10609
|
this.#process.reallyExit = (code) => {
|
|
10554
10610
|
return this.#processReallyExit(code);
|
|
@@ -10652,11 +10708,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
|
|
|
10652
10708
|
const promises = weakMap.get(stream);
|
|
10653
10709
|
const promise = createDeferred();
|
|
10654
10710
|
promises.push(promise);
|
|
10655
|
-
const
|
|
10656
|
-
return { resolve:
|
|
10711
|
+
const resolve9 = promise.resolve.bind(promise);
|
|
10712
|
+
return { resolve: resolve9, promises };
|
|
10657
10713
|
};
|
|
10658
|
-
var waitForConcurrentStreams = async ({ resolve:
|
|
10659
|
-
|
|
10714
|
+
var waitForConcurrentStreams = async ({ resolve: resolve9, promises }, subprocess) => {
|
|
10715
|
+
resolve9();
|
|
10660
10716
|
const [isSubprocessExit] = await Promise.race([
|
|
10661
10717
|
Promise.allSettled([true, subprocess]),
|
|
10662
10718
|
Promise.all([false, ...promises])
|
|
@@ -11490,7 +11546,7 @@ var waitForSubprocessStream = async ({ stream, fdNumber, encoding, buffer, maxBu
|
|
|
11490
11546
|
};
|
|
11491
11547
|
|
|
11492
11548
|
// node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/resolve/all-async.js
|
|
11493
|
-
var makeAllStream = ({ stdout, stderr }, { all }) => all && (
|
|
11549
|
+
var makeAllStream = ({ stdout: stdout2, stderr }, { all }) => all && (stdout2 || stderr) ? mergeStreams([stdout2, stderr].filter(Boolean)) : void 0;
|
|
11494
11550
|
var waitForAllStream = ({ subprocess, all, encoding, buffer, maxBuffer, lines, stripFinalNewline: stripFinalNewline2, verboseInfo, streamInfo }) => waitForSubprocessStream({
|
|
11495
11551
|
...getAllStream(subprocess, all, buffer),
|
|
11496
11552
|
fdNumber: "all",
|
|
@@ -11502,7 +11558,7 @@ var waitForAllStream = ({ subprocess, all, encoding, buffer, maxBuffer, lines, s
|
|
|
11502
11558
|
verboseInfo,
|
|
11503
11559
|
streamInfo
|
|
11504
11560
|
});
|
|
11505
|
-
var getAllStream = ({ stdout, stderr }, all, [, bufferStdout, bufferStderr]) => {
|
|
11561
|
+
var getAllStream = ({ stdout: stdout2, stderr }, all, [, bufferStdout, bufferStderr]) => {
|
|
11506
11562
|
const buffer = bufferStdout || bufferStderr;
|
|
11507
11563
|
if (!buffer) {
|
|
11508
11564
|
return { stream: all, buffer };
|
|
@@ -11511,11 +11567,11 @@ var getAllStream = ({ stdout, stderr }, all, [, bufferStdout, bufferStderr]) =>
|
|
|
11511
11567
|
return { stream: stderr, buffer };
|
|
11512
11568
|
}
|
|
11513
11569
|
if (!bufferStderr) {
|
|
11514
|
-
return { stream:
|
|
11570
|
+
return { stream: stdout2, buffer };
|
|
11515
11571
|
}
|
|
11516
11572
|
return { stream: all, buffer };
|
|
11517
11573
|
};
|
|
11518
|
-
var getAllMixed = ({ stdout, stderr }, all) => all &&
|
|
11574
|
+
var getAllMixed = ({ stdout: stdout2, stderr }, all) => all && stdout2 && stderr && stdout2.readableObjectMode !== stderr.readableObjectMode;
|
|
11519
11575
|
|
|
11520
11576
|
// node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/resolve/wait-subprocess.js
|
|
11521
11577
|
import { once as once8 } from "node:events";
|
|
@@ -12209,7 +12265,7 @@ function permissionEvidence(request) {
|
|
|
12209
12265
|
}
|
|
12210
12266
|
function redact(value, environment) {
|
|
12211
12267
|
return Object.values(environment).reduce(
|
|
12212
|
-
(
|
|
12268
|
+
(text2, secret) => secret ? text2.replaceAll(secret, "[REDACTED]") : text2,
|
|
12213
12269
|
value
|
|
12214
12270
|
);
|
|
12215
12271
|
}
|
|
@@ -12245,7 +12301,7 @@ function sandboxArguments(request) {
|
|
|
12245
12301
|
"/tmp/home"
|
|
12246
12302
|
];
|
|
12247
12303
|
for (const [key, value] of Object.entries(request.environment).sort(
|
|
12248
|
-
([
|
|
12304
|
+
([a3], [b]) => a3.localeCompare(b)
|
|
12249
12305
|
)) {
|
|
12250
12306
|
args.push("--setenv", key, value);
|
|
12251
12307
|
}
|
|
@@ -12271,7 +12327,7 @@ async function executeInvocation(request) {
|
|
|
12271
12327
|
maxBuffer: 1024 * 1024
|
|
12272
12328
|
});
|
|
12273
12329
|
const durationMs = Math.round(performance.now() - started);
|
|
12274
|
-
const
|
|
12330
|
+
const stdout2 = redact(outcome.stdout, request.environment);
|
|
12275
12331
|
const stderr = redact(outcome.stderr, request.environment);
|
|
12276
12332
|
const after = Object.freeze({
|
|
12277
12333
|
sourceWorkspaceDigest: await sourceWorkspaceDigest(request.sourceWorkspace),
|
|
@@ -12313,7 +12369,7 @@ async function executeInvocation(request) {
|
|
|
12313
12369
|
after,
|
|
12314
12370
|
permissions,
|
|
12315
12371
|
violations,
|
|
12316
|
-
stdout,
|
|
12372
|
+
stdout: stdout2,
|
|
12317
12373
|
stderr,
|
|
12318
12374
|
exitCode: outcome.exitCode,
|
|
12319
12375
|
signal: outcome.signal
|
|
@@ -12326,7 +12382,7 @@ async function executeInvocation(request) {
|
|
|
12326
12382
|
executable: request.executable,
|
|
12327
12383
|
argv: request.argv,
|
|
12328
12384
|
cwd: request.cwd,
|
|
12329
|
-
stdout,
|
|
12385
|
+
stdout: stdout2,
|
|
12330
12386
|
stderr,
|
|
12331
12387
|
exitCode: outcome.exitCode ?? null,
|
|
12332
12388
|
...outcome.signal ? { signal: outcome.signal } : {},
|
|
@@ -12911,17 +12967,17 @@ ${operationalBody}
|
|
|
12911
12967
|
}
|
|
12912
12968
|
}
|
|
12913
12969
|
if (primitiveArtifact) {
|
|
12914
|
-
const
|
|
12970
|
+
const text2 = decoder2.decode(primitiveArtifact.content);
|
|
12915
12971
|
const core = `${ir.runtime.nativeRoot}/${ir.role.id}/SKILL.md`;
|
|
12916
|
-
if (!
|
|
12972
|
+
if (!text2.includes(core) && !text2.includes(`skills:
|
|
12917
12973
|
- ${ir.role.id}`)) {
|
|
12918
12974
|
diagnostics.push("client activation artifact does not delegate to behavioral core");
|
|
12919
12975
|
}
|
|
12920
12976
|
}
|
|
12921
12977
|
if (skill) {
|
|
12922
|
-
const
|
|
12978
|
+
const text2 = decoder2.decode(skill.content);
|
|
12923
12979
|
const availableResources = files.filter((file) => file.path.startsWith(`${prefix}resources/`)).map((file) => file.path.slice(prefix.length));
|
|
12924
|
-
const operationalDiagnostics = validateRenderedOperationalSkill(
|
|
12980
|
+
const operationalDiagnostics = validateRenderedOperationalSkill(text2, availableResources);
|
|
12925
12981
|
diagnostics.push(...operationalDiagnostics);
|
|
12926
12982
|
for (const required of [
|
|
12927
12983
|
"generated: true",
|
|
@@ -12931,7 +12987,7 @@ ${operationalBody}
|
|
|
12931
12987
|
"repositoryWrites: denied",
|
|
12932
12988
|
"Do not edit by hand"
|
|
12933
12989
|
]) {
|
|
12934
|
-
if (!
|
|
12990
|
+
if (!text2.includes(required)) diagnostics.push(`missing skill metadata: ${required}`);
|
|
12935
12991
|
}
|
|
12936
12992
|
}
|
|
12937
12993
|
if (!lock) {
|
|
@@ -13341,6 +13397,1256 @@ async function inspectProduction(system, options) {
|
|
|
13341
13397
|
};
|
|
13342
13398
|
}
|
|
13343
13399
|
|
|
13400
|
+
// node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
|
|
13401
|
+
import { styleText } from "node:util";
|
|
13402
|
+
import { stdout, stdin } from "node:process";
|
|
13403
|
+
import * as l from "node:readline";
|
|
13404
|
+
import l__default from "node:readline";
|
|
13405
|
+
|
|
13406
|
+
// node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
13407
|
+
var getCodePointsLength = /* @__PURE__ */ (() => {
|
|
13408
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
13409
|
+
return (input) => {
|
|
13410
|
+
let surrogatePairsNr = 0;
|
|
13411
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
13412
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
13413
|
+
surrogatePairsNr += 1;
|
|
13414
|
+
}
|
|
13415
|
+
return input.length - surrogatePairsNr;
|
|
13416
|
+
};
|
|
13417
|
+
})();
|
|
13418
|
+
var isFullWidth = (x) => {
|
|
13419
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
13420
|
+
};
|
|
13421
|
+
var isWideNotCJKTNotEmoji = (x) => {
|
|
13422
|
+
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;
|
|
13423
|
+
};
|
|
13424
|
+
|
|
13425
|
+
// node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
13426
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
13427
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
13428
|
+
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;
|
|
13429
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
13430
|
+
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");
|
|
13431
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
13432
|
+
var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
|
|
13433
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
13434
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
13435
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
13436
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
13437
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
13438
|
+
const ANSI_WIDTH = 0;
|
|
13439
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
13440
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
13441
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
13442
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
13443
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
13444
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
13445
|
+
const PARSE_BLOCKS = [
|
|
13446
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
13447
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
13448
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
13449
|
+
[TAB_RE, TAB_WIDTH],
|
|
13450
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
13451
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
13452
|
+
];
|
|
13453
|
+
let indexPrev = 0;
|
|
13454
|
+
let index = 0;
|
|
13455
|
+
let length = input.length;
|
|
13456
|
+
let lengthExtra = 0;
|
|
13457
|
+
let truncationEnabled = false;
|
|
13458
|
+
let truncationIndex = length;
|
|
13459
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
13460
|
+
let unmatchedStart = 0;
|
|
13461
|
+
let unmatchedEnd = 0;
|
|
13462
|
+
let width = 0;
|
|
13463
|
+
let widthExtra = 0;
|
|
13464
|
+
outer: while (true) {
|
|
13465
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
13466
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
13467
|
+
lengthExtra = 0;
|
|
13468
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
13469
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
13470
|
+
if (isFullWidth(codePoint)) {
|
|
13471
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
13472
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
13473
|
+
widthExtra = WIDE_WIDTH;
|
|
13474
|
+
} else {
|
|
13475
|
+
widthExtra = REGULAR_WIDTH;
|
|
13476
|
+
}
|
|
13477
|
+
if (width + widthExtra > truncationLimit) {
|
|
13478
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
13479
|
+
}
|
|
13480
|
+
if (width + widthExtra > LIMIT) {
|
|
13481
|
+
truncationEnabled = true;
|
|
13482
|
+
break outer;
|
|
13483
|
+
}
|
|
13484
|
+
lengthExtra += char.length;
|
|
13485
|
+
width += widthExtra;
|
|
13486
|
+
}
|
|
13487
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
13488
|
+
}
|
|
13489
|
+
if (index >= length) {
|
|
13490
|
+
break outer;
|
|
13491
|
+
}
|
|
13492
|
+
for (let i3 = 0, l2 = PARSE_BLOCKS.length; i3 < l2; i3++) {
|
|
13493
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i3];
|
|
13494
|
+
BLOCK_RE.lastIndex = index;
|
|
13495
|
+
if (BLOCK_RE.test(input)) {
|
|
13496
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
13497
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
13498
|
+
if (width + widthExtra > truncationLimit) {
|
|
13499
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
13500
|
+
}
|
|
13501
|
+
if (width + widthExtra > LIMIT) {
|
|
13502
|
+
truncationEnabled = true;
|
|
13503
|
+
break outer;
|
|
13504
|
+
}
|
|
13505
|
+
width += widthExtra;
|
|
13506
|
+
unmatchedStart = indexPrev;
|
|
13507
|
+
unmatchedEnd = index;
|
|
13508
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
13509
|
+
continue outer;
|
|
13510
|
+
}
|
|
13511
|
+
}
|
|
13512
|
+
index += 1;
|
|
13513
|
+
}
|
|
13514
|
+
return {
|
|
13515
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
13516
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
13517
|
+
truncated: truncationEnabled,
|
|
13518
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
13519
|
+
};
|
|
13520
|
+
};
|
|
13521
|
+
var dist_default = getStringTruncatedWidth;
|
|
13522
|
+
|
|
13523
|
+
// node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
13524
|
+
var NO_TRUNCATION2 = {
|
|
13525
|
+
limit: Infinity,
|
|
13526
|
+
ellipsis: "",
|
|
13527
|
+
ellipsisWidth: 0
|
|
13528
|
+
};
|
|
13529
|
+
var fastStringWidth = (input, options = {}) => {
|
|
13530
|
+
return dist_default(input, NO_TRUNCATION2, options).width;
|
|
13531
|
+
};
|
|
13532
|
+
var dist_default2 = fastStringWidth;
|
|
13533
|
+
|
|
13534
|
+
// node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
13535
|
+
var ESC = "\x1B";
|
|
13536
|
+
var CSI = "\x9B";
|
|
13537
|
+
var END_CODE = 39;
|
|
13538
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
13539
|
+
var ANSI_CSI = "[";
|
|
13540
|
+
var ANSI_OSC = "]";
|
|
13541
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
13542
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
13543
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
13544
|
+
var getClosingCode = (openingCode) => {
|
|
13545
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
13546
|
+
return 39;
|
|
13547
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
13548
|
+
return 39;
|
|
13549
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
13550
|
+
return 49;
|
|
13551
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
13552
|
+
return 49;
|
|
13553
|
+
if (openingCode === 1 || openingCode === 2)
|
|
13554
|
+
return 22;
|
|
13555
|
+
if (openingCode === 3)
|
|
13556
|
+
return 23;
|
|
13557
|
+
if (openingCode === 4)
|
|
13558
|
+
return 24;
|
|
13559
|
+
if (openingCode === 7)
|
|
13560
|
+
return 27;
|
|
13561
|
+
if (openingCode === 8)
|
|
13562
|
+
return 28;
|
|
13563
|
+
if (openingCode === 9)
|
|
13564
|
+
return 29;
|
|
13565
|
+
if (openingCode === 0)
|
|
13566
|
+
return 0;
|
|
13567
|
+
return void 0;
|
|
13568
|
+
};
|
|
13569
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
13570
|
+
var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
13571
|
+
var wrapWord = (rows, word, columns) => {
|
|
13572
|
+
const characters = word[Symbol.iterator]();
|
|
13573
|
+
let isInsideEscape = false;
|
|
13574
|
+
let isInsideLinkEscape = false;
|
|
13575
|
+
let lastRow = rows.at(-1);
|
|
13576
|
+
let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
|
|
13577
|
+
let currentCharacter = characters.next();
|
|
13578
|
+
let nextCharacter = characters.next();
|
|
13579
|
+
let rawCharacterIndex = 0;
|
|
13580
|
+
while (!currentCharacter.done) {
|
|
13581
|
+
const character = currentCharacter.value;
|
|
13582
|
+
const characterLength = dist_default2(character);
|
|
13583
|
+
if (visible + characterLength <= columns) {
|
|
13584
|
+
rows[rows.length - 1] += character;
|
|
13585
|
+
} else {
|
|
13586
|
+
rows.push(character);
|
|
13587
|
+
visible = 0;
|
|
13588
|
+
}
|
|
13589
|
+
if (character === ESC || character === CSI) {
|
|
13590
|
+
isInsideEscape = true;
|
|
13591
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
13592
|
+
}
|
|
13593
|
+
if (isInsideEscape) {
|
|
13594
|
+
if (isInsideLinkEscape) {
|
|
13595
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
13596
|
+
isInsideEscape = false;
|
|
13597
|
+
isInsideLinkEscape = false;
|
|
13598
|
+
}
|
|
13599
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
13600
|
+
isInsideEscape = false;
|
|
13601
|
+
}
|
|
13602
|
+
} else {
|
|
13603
|
+
visible += characterLength;
|
|
13604
|
+
if (visible === columns && !nextCharacter.done) {
|
|
13605
|
+
rows.push("");
|
|
13606
|
+
visible = 0;
|
|
13607
|
+
}
|
|
13608
|
+
}
|
|
13609
|
+
currentCharacter = nextCharacter;
|
|
13610
|
+
nextCharacter = characters.next();
|
|
13611
|
+
rawCharacterIndex += character.length;
|
|
13612
|
+
}
|
|
13613
|
+
lastRow = rows.at(-1);
|
|
13614
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
|
|
13615
|
+
rows[rows.length - 2] += rows.pop();
|
|
13616
|
+
}
|
|
13617
|
+
};
|
|
13618
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
13619
|
+
const words = string.split(" ");
|
|
13620
|
+
let last = words.length;
|
|
13621
|
+
while (last) {
|
|
13622
|
+
if (dist_default2(words[last - 1])) {
|
|
13623
|
+
break;
|
|
13624
|
+
}
|
|
13625
|
+
last--;
|
|
13626
|
+
}
|
|
13627
|
+
if (last === words.length) {
|
|
13628
|
+
return string;
|
|
13629
|
+
}
|
|
13630
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
13631
|
+
};
|
|
13632
|
+
var exec = (string, columns, options = {}) => {
|
|
13633
|
+
if (options.trim !== false && string.trim() === "") {
|
|
13634
|
+
return "";
|
|
13635
|
+
}
|
|
13636
|
+
let returnValue = "";
|
|
13637
|
+
let escapeCode;
|
|
13638
|
+
let escapeUrl;
|
|
13639
|
+
const words = string.split(" ");
|
|
13640
|
+
let rows = [""];
|
|
13641
|
+
let rowLength = 0;
|
|
13642
|
+
for (let index = 0; index < words.length; index++) {
|
|
13643
|
+
const word = words[index];
|
|
13644
|
+
if (options.trim !== false) {
|
|
13645
|
+
const row = rows.at(-1) ?? "";
|
|
13646
|
+
const trimmed = row.trimStart();
|
|
13647
|
+
if (row.length !== trimmed.length) {
|
|
13648
|
+
rows[rows.length - 1] = trimmed;
|
|
13649
|
+
rowLength = dist_default2(trimmed);
|
|
13650
|
+
}
|
|
13651
|
+
}
|
|
13652
|
+
if (index !== 0) {
|
|
13653
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
13654
|
+
rows.push("");
|
|
13655
|
+
rowLength = 0;
|
|
13656
|
+
}
|
|
13657
|
+
if (rowLength || options.trim === false) {
|
|
13658
|
+
rows[rows.length - 1] += " ";
|
|
13659
|
+
rowLength++;
|
|
13660
|
+
}
|
|
13661
|
+
}
|
|
13662
|
+
const wordLength = dist_default2(word);
|
|
13663
|
+
if (options.hard && wordLength > columns) {
|
|
13664
|
+
const remainingColumns = columns - rowLength;
|
|
13665
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
13666
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
13667
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
13668
|
+
rows.push("");
|
|
13669
|
+
}
|
|
13670
|
+
wrapWord(rows, word, columns);
|
|
13671
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
13672
|
+
continue;
|
|
13673
|
+
}
|
|
13674
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
13675
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
13676
|
+
wrapWord(rows, word, columns);
|
|
13677
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
13678
|
+
continue;
|
|
13679
|
+
}
|
|
13680
|
+
rows.push("");
|
|
13681
|
+
rowLength = 0;
|
|
13682
|
+
}
|
|
13683
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
13684
|
+
wrapWord(rows, word, columns);
|
|
13685
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
13686
|
+
continue;
|
|
13687
|
+
}
|
|
13688
|
+
rows[rows.length - 1] += word;
|
|
13689
|
+
rowLength += wordLength;
|
|
13690
|
+
}
|
|
13691
|
+
if (options.trim !== false) {
|
|
13692
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
13693
|
+
}
|
|
13694
|
+
const preString = rows.join("\n");
|
|
13695
|
+
let inSurrogate = false;
|
|
13696
|
+
for (let i3 = 0; i3 < preString.length; i3++) {
|
|
13697
|
+
const character = preString[i3];
|
|
13698
|
+
returnValue += character;
|
|
13699
|
+
if (!inSurrogate) {
|
|
13700
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
13701
|
+
if (inSurrogate) {
|
|
13702
|
+
continue;
|
|
13703
|
+
}
|
|
13704
|
+
} else {
|
|
13705
|
+
inSurrogate = false;
|
|
13706
|
+
}
|
|
13707
|
+
if (character === ESC || character === CSI) {
|
|
13708
|
+
GROUP_REGEX.lastIndex = i3 + 1;
|
|
13709
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
13710
|
+
const groups = groupsResult?.groups;
|
|
13711
|
+
if (groups?.code !== void 0) {
|
|
13712
|
+
const code = Number.parseFloat(groups.code);
|
|
13713
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
13714
|
+
} else if (groups?.uri !== void 0) {
|
|
13715
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
13716
|
+
}
|
|
13717
|
+
}
|
|
13718
|
+
if (preString[i3 + 1] === "\n") {
|
|
13719
|
+
if (escapeUrl) {
|
|
13720
|
+
returnValue += wrapAnsiHyperlink("");
|
|
13721
|
+
}
|
|
13722
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
13723
|
+
if (escapeCode && closingCode) {
|
|
13724
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
13725
|
+
}
|
|
13726
|
+
} else if (character === "\n") {
|
|
13727
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
13728
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
13729
|
+
}
|
|
13730
|
+
if (escapeUrl) {
|
|
13731
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
13732
|
+
}
|
|
13733
|
+
}
|
|
13734
|
+
}
|
|
13735
|
+
return returnValue;
|
|
13736
|
+
};
|
|
13737
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
13738
|
+
function wrapAnsi(string, columns, options) {
|
|
13739
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
13740
|
+
}
|
|
13741
|
+
|
|
13742
|
+
// node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
|
|
13743
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
13744
|
+
import { ReadStream } from "node:tty";
|
|
13745
|
+
function findCursor(s, o2, l2) {
|
|
13746
|
+
if (!l2.some((r2) => !r2.disabled))
|
|
13747
|
+
return s;
|
|
13748
|
+
const t2 = s + o2, n4 = Math.max(l2.length - 1, 0), e = t2 < 0 ? n4 : t2 > n4 ? 0 : t2;
|
|
13749
|
+
return l2[e]?.disabled ? findCursor(e, o2 < 0 ? -1 : 1, l2) : e;
|
|
13750
|
+
}
|
|
13751
|
+
var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
13752
|
+
var t = [
|
|
13753
|
+
"January",
|
|
13754
|
+
"February",
|
|
13755
|
+
"March",
|
|
13756
|
+
"April",
|
|
13757
|
+
"May",
|
|
13758
|
+
"June",
|
|
13759
|
+
"July",
|
|
13760
|
+
"August",
|
|
13761
|
+
"September",
|
|
13762
|
+
"October",
|
|
13763
|
+
"November",
|
|
13764
|
+
"December"
|
|
13765
|
+
];
|
|
13766
|
+
var settings = {
|
|
13767
|
+
actions: new Set(a$1),
|
|
13768
|
+
aliases: /* @__PURE__ */ new Map([
|
|
13769
|
+
// vim support
|
|
13770
|
+
["k", "up"],
|
|
13771
|
+
["j", "down"],
|
|
13772
|
+
["h", "left"],
|
|
13773
|
+
["l", "right"],
|
|
13774
|
+
["", "cancel"],
|
|
13775
|
+
// opinionated defaults!
|
|
13776
|
+
["escape", "cancel"]
|
|
13777
|
+
]),
|
|
13778
|
+
messages: {
|
|
13779
|
+
cancel: "Canceled",
|
|
13780
|
+
error: "Something went wrong"
|
|
13781
|
+
},
|
|
13782
|
+
withGuide: true,
|
|
13783
|
+
date: {
|
|
13784
|
+
monthNames: [...t],
|
|
13785
|
+
messages: {
|
|
13786
|
+
required: "Please enter a valid date",
|
|
13787
|
+
invalidMonth: "There are only 12 months in a year",
|
|
13788
|
+
invalidDay: (n4, e) => `There are only ${n4} days in ${e}`,
|
|
13789
|
+
afterMin: (n4) => `Date must be on or after ${n4.toISOString().slice(0, 10)}`,
|
|
13790
|
+
beforeMax: (n4) => `Date must be on or before ${n4.toISOString().slice(0, 10)}`
|
|
13791
|
+
}
|
|
13792
|
+
}
|
|
13793
|
+
};
|
|
13794
|
+
function isActionKey(n4, e) {
|
|
13795
|
+
if (typeof n4 == "string")
|
|
13796
|
+
return settings.aliases.get(n4) === e;
|
|
13797
|
+
for (const s of n4)
|
|
13798
|
+
if (s !== void 0 && isActionKey(s, e))
|
|
13799
|
+
return true;
|
|
13800
|
+
return false;
|
|
13801
|
+
}
|
|
13802
|
+
function diffLines(i3, s) {
|
|
13803
|
+
if (i3 === s) return;
|
|
13804
|
+
const e = i3.split(`
|
|
13805
|
+
`), t2 = s.split(`
|
|
13806
|
+
`), r2 = Math.max(e.length, t2.length), f = [];
|
|
13807
|
+
for (let n4 = 0; n4 < r2; n4++)
|
|
13808
|
+
e[n4] !== t2[n4] && f.push(n4);
|
|
13809
|
+
return {
|
|
13810
|
+
lines: f,
|
|
13811
|
+
numLinesBefore: e.length,
|
|
13812
|
+
numLinesAfter: t2.length,
|
|
13813
|
+
numLines: r2
|
|
13814
|
+
};
|
|
13815
|
+
}
|
|
13816
|
+
var R = globalThis.process.platform.startsWith("win");
|
|
13817
|
+
var CANCEL_SYMBOL = Symbol("clack:cancel");
|
|
13818
|
+
function isCancel(e) {
|
|
13819
|
+
return e === CANCEL_SYMBOL;
|
|
13820
|
+
}
|
|
13821
|
+
function setRawMode(e, r2) {
|
|
13822
|
+
const o2 = e;
|
|
13823
|
+
o2.isTTY && o2.setRawMode(r2);
|
|
13824
|
+
}
|
|
13825
|
+
function block({
|
|
13826
|
+
input: e = stdin,
|
|
13827
|
+
output: r2 = stdout,
|
|
13828
|
+
overwrite: o2 = true,
|
|
13829
|
+
hideCursor: t2 = true
|
|
13830
|
+
} = {}) {
|
|
13831
|
+
const s = l.createInterface({
|
|
13832
|
+
input: e,
|
|
13833
|
+
output: r2,
|
|
13834
|
+
prompt: "",
|
|
13835
|
+
tabSize: 1
|
|
13836
|
+
});
|
|
13837
|
+
l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
13838
|
+
const n4 = (f, { name: a3, sequence: p }) => {
|
|
13839
|
+
const c4 = String(f);
|
|
13840
|
+
if (isActionKey([c4, a3, p], "cancel")) {
|
|
13841
|
+
t2 && r2.write(import_sisteransi.cursor.show), process.exit(0);
|
|
13842
|
+
return;
|
|
13843
|
+
}
|
|
13844
|
+
if (!o2) return;
|
|
13845
|
+
const i3 = a3 === "return" ? 0 : -1, m = a3 === "return" ? -1 : 0;
|
|
13846
|
+
l.moveCursor(r2, i3, m, () => {
|
|
13847
|
+
l.clearLine(r2, 1, () => {
|
|
13848
|
+
e.once("keypress", n4);
|
|
13849
|
+
});
|
|
13850
|
+
});
|
|
13851
|
+
};
|
|
13852
|
+
return t2 && r2.write(import_sisteransi.cursor.hide), e.once("keypress", n4), () => {
|
|
13853
|
+
e.off("keypress", n4), t2 && r2.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
|
|
13854
|
+
};
|
|
13855
|
+
}
|
|
13856
|
+
var getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
13857
|
+
var getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
13858
|
+
function wrapTextWithPrefix(e, r2, o2, t2 = o2, s = o2, n4) {
|
|
13859
|
+
const f = getColumns(e ?? stdout);
|
|
13860
|
+
return wrapAnsi(r2, f - o2.length, {
|
|
13861
|
+
hard: true,
|
|
13862
|
+
trim: false
|
|
13863
|
+
}).split(`
|
|
13864
|
+
`).map((c4, i3, m) => {
|
|
13865
|
+
const d = n4 ? n4(c4, i3) : c4;
|
|
13866
|
+
return i3 === 0 ? `${t2}${d}` : i3 === m.length - 1 ? `${s}${d}` : `${o2}${d}`;
|
|
13867
|
+
}).join(`
|
|
13868
|
+
`);
|
|
13869
|
+
}
|
|
13870
|
+
function runValidation(e, n4) {
|
|
13871
|
+
if ("~standard" in e) {
|
|
13872
|
+
const a3 = e["~standard"].validate(n4);
|
|
13873
|
+
if (a3 instanceof Promise)
|
|
13874
|
+
throw new TypeError(
|
|
13875
|
+
"Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic."
|
|
13876
|
+
);
|
|
13877
|
+
return a3.issues?.at(0)?.message;
|
|
13878
|
+
}
|
|
13879
|
+
return e(n4);
|
|
13880
|
+
}
|
|
13881
|
+
var V = class {
|
|
13882
|
+
input;
|
|
13883
|
+
output;
|
|
13884
|
+
_abortSignal;
|
|
13885
|
+
rl;
|
|
13886
|
+
opts;
|
|
13887
|
+
_render;
|
|
13888
|
+
_track = false;
|
|
13889
|
+
_prevFrame = "";
|
|
13890
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
13891
|
+
_cursor = 0;
|
|
13892
|
+
state = "initial";
|
|
13893
|
+
error = "";
|
|
13894
|
+
value;
|
|
13895
|
+
userInput = "";
|
|
13896
|
+
constructor(t2, e = true) {
|
|
13897
|
+
const { input: i3 = stdin, output: n4 = stdout, render: s, signal: r2, ...o2 } = t2;
|
|
13898
|
+
this.opts = o2, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r2, this.input = i3, this.output = n4;
|
|
13899
|
+
}
|
|
13900
|
+
/**
|
|
13901
|
+
* Unsubscribe all listeners
|
|
13902
|
+
*/
|
|
13903
|
+
unsubscribe() {
|
|
13904
|
+
this._subscribers.clear();
|
|
13905
|
+
}
|
|
13906
|
+
/**
|
|
13907
|
+
* Set a subscriber with opts
|
|
13908
|
+
* @param event - The event name
|
|
13909
|
+
*/
|
|
13910
|
+
setSubscriber(t2, e) {
|
|
13911
|
+
const i3 = this._subscribers.get(t2) ?? [];
|
|
13912
|
+
i3.push(e), this._subscribers.set(t2, i3);
|
|
13913
|
+
}
|
|
13914
|
+
/**
|
|
13915
|
+
* Subscribe to an event
|
|
13916
|
+
* @param event - The event name
|
|
13917
|
+
* @param cb - The callback
|
|
13918
|
+
*/
|
|
13919
|
+
on(t2, e) {
|
|
13920
|
+
this.setSubscriber(t2, { cb: e });
|
|
13921
|
+
}
|
|
13922
|
+
/**
|
|
13923
|
+
* Subscribe to an event once
|
|
13924
|
+
* @param event - The event name
|
|
13925
|
+
* @param cb - The callback
|
|
13926
|
+
*/
|
|
13927
|
+
once(t2, e) {
|
|
13928
|
+
this.setSubscriber(t2, { cb: e, once: true });
|
|
13929
|
+
}
|
|
13930
|
+
/**
|
|
13931
|
+
* Emit an event with data
|
|
13932
|
+
* @param event - The event name
|
|
13933
|
+
* @param data - The data to pass to the callback
|
|
13934
|
+
*/
|
|
13935
|
+
emit(t2, ...e) {
|
|
13936
|
+
const i3 = this._subscribers.get(t2) ?? [], n4 = [];
|
|
13937
|
+
for (const s of i3)
|
|
13938
|
+
s.cb(...e), s.once && n4.push(() => i3.splice(i3.indexOf(s), 1));
|
|
13939
|
+
for (const s of n4)
|
|
13940
|
+
s();
|
|
13941
|
+
}
|
|
13942
|
+
prompt() {
|
|
13943
|
+
return new Promise((t2) => {
|
|
13944
|
+
if (this._abortSignal) {
|
|
13945
|
+
if (this._abortSignal.aborted)
|
|
13946
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
13947
|
+
this._abortSignal.addEventListener(
|
|
13948
|
+
"abort",
|
|
13949
|
+
() => {
|
|
13950
|
+
this.state = "cancel", this.close();
|
|
13951
|
+
},
|
|
13952
|
+
{ once: true }
|
|
13953
|
+
);
|
|
13954
|
+
}
|
|
13955
|
+
this.rl = l__default.createInterface({
|
|
13956
|
+
input: this.input,
|
|
13957
|
+
tabSize: 2,
|
|
13958
|
+
prompt: "",
|
|
13959
|
+
escapeCodeTimeout: 50,
|
|
13960
|
+
terminal: true
|
|
13961
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
13962
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
13963
|
+
}), this.once("cancel", () => {
|
|
13964
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
13965
|
+
});
|
|
13966
|
+
});
|
|
13967
|
+
}
|
|
13968
|
+
_isActionKey(t2, e) {
|
|
13969
|
+
return t2 === " ";
|
|
13970
|
+
}
|
|
13971
|
+
_shouldSubmit(t2, e) {
|
|
13972
|
+
return true;
|
|
13973
|
+
}
|
|
13974
|
+
_setValue(t2) {
|
|
13975
|
+
this.value = t2, this.emit("value", this.value);
|
|
13976
|
+
}
|
|
13977
|
+
_setUserInput(t2, e) {
|
|
13978
|
+
this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
13979
|
+
}
|
|
13980
|
+
_clearUserInput() {
|
|
13981
|
+
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
13982
|
+
}
|
|
13983
|
+
onKeypress(t2, e) {
|
|
13984
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
|
|
13985
|
+
if (this.opts.validate) {
|
|
13986
|
+
const i3 = runValidation(this.opts.validate, this.value);
|
|
13987
|
+
i3 && (this.error = i3 instanceof Error ? i3.message : i3, this.state = "error", this.rl?.write(this.userInput));
|
|
13988
|
+
}
|
|
13989
|
+
this.state !== "error" && (this.state = "submit");
|
|
13990
|
+
}
|
|
13991
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
13992
|
+
}
|
|
13993
|
+
close() {
|
|
13994
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
13995
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
13996
|
+
}
|
|
13997
|
+
restoreCursor() {
|
|
13998
|
+
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
13999
|
+
`).length - 1;
|
|
14000
|
+
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
14001
|
+
}
|
|
14002
|
+
render() {
|
|
14003
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
14004
|
+
hard: true,
|
|
14005
|
+
trim: false
|
|
14006
|
+
});
|
|
14007
|
+
if (t2 !== this._prevFrame) {
|
|
14008
|
+
if (this.state === "initial")
|
|
14009
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
14010
|
+
else {
|
|
14011
|
+
const e = diffLines(this._prevFrame, t2), i3 = getRows(this.output);
|
|
14012
|
+
if (this.restoreCursor(), e) {
|
|
14013
|
+
const n4 = Math.max(0, e.numLinesAfter - i3), s = Math.max(0, e.numLinesBefore - i3);
|
|
14014
|
+
let r2 = e.lines.find((o2) => o2 >= n4);
|
|
14015
|
+
if (r2 === void 0) {
|
|
14016
|
+
this._prevFrame = t2;
|
|
14017
|
+
return;
|
|
14018
|
+
}
|
|
14019
|
+
if (e.lines.length === 1) {
|
|
14020
|
+
this.output.write(import_sisteransi.cursor.move(0, r2 - s)), this.output.write(import_sisteransi.erase.lines(1));
|
|
14021
|
+
const o2 = t2.split(`
|
|
14022
|
+
`);
|
|
14023
|
+
this.output.write(o2[r2]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o2.length - r2 - 1));
|
|
14024
|
+
return;
|
|
14025
|
+
} else if (e.lines.length > 1) {
|
|
14026
|
+
if (n4 < s)
|
|
14027
|
+
r2 = n4;
|
|
14028
|
+
else {
|
|
14029
|
+
const h3 = r2 - s;
|
|
14030
|
+
h3 > 0 && this.output.write(import_sisteransi.cursor.move(0, h3));
|
|
14031
|
+
}
|
|
14032
|
+
this.output.write(import_sisteransi.erase.down());
|
|
14033
|
+
const f = t2.split(`
|
|
14034
|
+
`).slice(r2);
|
|
14035
|
+
this.output.write(f.join(`
|
|
14036
|
+
`)), this._prevFrame = t2;
|
|
14037
|
+
return;
|
|
14038
|
+
}
|
|
14039
|
+
}
|
|
14040
|
+
this.output.write(import_sisteransi.erase.down());
|
|
14041
|
+
}
|
|
14042
|
+
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
14043
|
+
}
|
|
14044
|
+
}
|
|
14045
|
+
};
|
|
14046
|
+
var r = class extends V {
|
|
14047
|
+
get cursor() {
|
|
14048
|
+
return this.value ? 0 : 1;
|
|
14049
|
+
}
|
|
14050
|
+
get _value() {
|
|
14051
|
+
return this.cursor === 0;
|
|
14052
|
+
}
|
|
14053
|
+
constructor(t2) {
|
|
14054
|
+
super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
|
|
14055
|
+
this.value = this._value;
|
|
14056
|
+
}), this.on("confirm", (i3) => {
|
|
14057
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i3, this.state = "submit", this.close();
|
|
14058
|
+
}), this.on("cursor", () => {
|
|
14059
|
+
this.value = !this.value;
|
|
14060
|
+
});
|
|
14061
|
+
}
|
|
14062
|
+
};
|
|
14063
|
+
var n$1 = class n2 extends V {
|
|
14064
|
+
options;
|
|
14065
|
+
cursor = 0;
|
|
14066
|
+
get _selectedValue() {
|
|
14067
|
+
return this.options[this.cursor];
|
|
14068
|
+
}
|
|
14069
|
+
changeValue() {
|
|
14070
|
+
const e = this._selectedValue;
|
|
14071
|
+
this.value = e === void 0 ? void 0 : e.value;
|
|
14072
|
+
}
|
|
14073
|
+
constructor(e) {
|
|
14074
|
+
super(e, false), this.options = e.options;
|
|
14075
|
+
const o2 = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o2 === -1 ? 0 : o2;
|
|
14076
|
+
this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
|
|
14077
|
+
switch (s) {
|
|
14078
|
+
case "left":
|
|
14079
|
+
case "up":
|
|
14080
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
14081
|
+
break;
|
|
14082
|
+
case "down":
|
|
14083
|
+
case "right":
|
|
14084
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
14085
|
+
break;
|
|
14086
|
+
}
|
|
14087
|
+
this.changeValue();
|
|
14088
|
+
});
|
|
14089
|
+
}
|
|
14090
|
+
};
|
|
14091
|
+
var n3 = class extends V {
|
|
14092
|
+
get userInputWithCursor() {
|
|
14093
|
+
if (this.state === "submit")
|
|
14094
|
+
return this.userInput;
|
|
14095
|
+
const t2 = this.userInput;
|
|
14096
|
+
if (this.cursor >= t2.length)
|
|
14097
|
+
return `${this.userInput}\u2588`;
|
|
14098
|
+
const r2 = t2.slice(0, this.cursor), s = t2.slice(this.cursor, this.cursor + 1), e = t2.slice(this.cursor + 1);
|
|
14099
|
+
return `${r2}${styleText("inverse", s)}${e}`;
|
|
14100
|
+
}
|
|
14101
|
+
get cursor() {
|
|
14102
|
+
return this._cursor;
|
|
14103
|
+
}
|
|
14104
|
+
constructor(t2) {
|
|
14105
|
+
super({
|
|
14106
|
+
...t2,
|
|
14107
|
+
initialUserInput: t2.initialUserInput ?? t2.initialValue
|
|
14108
|
+
}), this.on("userInput", (r2) => {
|
|
14109
|
+
this._setValue(r2);
|
|
14110
|
+
}), this.on("finalize", () => {
|
|
14111
|
+
this.value || (this.value = t2.defaultValue), this.value === void 0 && (this.value = "");
|
|
14112
|
+
});
|
|
14113
|
+
}
|
|
14114
|
+
};
|
|
14115
|
+
|
|
14116
|
+
// node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs
|
|
14117
|
+
import { styleText as styleText2, stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
|
|
14118
|
+
import process$1 from "node:process";
|
|
14119
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
14120
|
+
function isUnicodeSupported2() {
|
|
14121
|
+
if (process$1.platform !== "win32") {
|
|
14122
|
+
return process$1.env.TERM !== "linux";
|
|
14123
|
+
}
|
|
14124
|
+
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
14125
|
+
}
|
|
14126
|
+
var unicode = isUnicodeSupported2();
|
|
14127
|
+
var isCI = () => process.env.CI === "true";
|
|
14128
|
+
var unicodeOr = (o2, e) => unicode ? o2 : e;
|
|
14129
|
+
var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
14130
|
+
var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
14131
|
+
var S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
14132
|
+
var S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
14133
|
+
var S_BAR_START = unicodeOr("\u250C", "T");
|
|
14134
|
+
var S_BAR = unicodeOr("\u2502", "|");
|
|
14135
|
+
var S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
14136
|
+
var S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
14137
|
+
var S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
14138
|
+
var S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
14139
|
+
var S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
14140
|
+
var S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
14141
|
+
var S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
14142
|
+
var S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
14143
|
+
var S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
14144
|
+
var S_BAR_H = unicodeOr("\u2500", "-");
|
|
14145
|
+
var S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
14146
|
+
var S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
14147
|
+
var S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
14148
|
+
var S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
14149
|
+
var S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
14150
|
+
var S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
14151
|
+
var S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
14152
|
+
var S_WARN = unicodeOr("\u25B2", "!");
|
|
14153
|
+
var S_ERROR = unicodeOr("\u25A0", "x");
|
|
14154
|
+
var symbol = (o2) => {
|
|
14155
|
+
switch (o2) {
|
|
14156
|
+
case "initial":
|
|
14157
|
+
case "active":
|
|
14158
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
14159
|
+
case "cancel":
|
|
14160
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
14161
|
+
case "error":
|
|
14162
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
14163
|
+
case "submit":
|
|
14164
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
14165
|
+
}
|
|
14166
|
+
};
|
|
14167
|
+
var symbolBar = (o2) => {
|
|
14168
|
+
switch (o2) {
|
|
14169
|
+
case "initial":
|
|
14170
|
+
case "active":
|
|
14171
|
+
return styleText2("cyan", S_BAR);
|
|
14172
|
+
case "cancel":
|
|
14173
|
+
return styleText2("red", S_BAR);
|
|
14174
|
+
case "error":
|
|
14175
|
+
return styleText2("yellow", S_BAR);
|
|
14176
|
+
case "submit":
|
|
14177
|
+
return styleText2("green", S_BAR);
|
|
14178
|
+
}
|
|
14179
|
+
};
|
|
14180
|
+
function formatInstructionFooter(o2, e) {
|
|
14181
|
+
const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o2.join(" \u2022 ")}`];
|
|
14182
|
+
return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
|
|
14183
|
+
}
|
|
14184
|
+
var I = (l2, e, w, p, b, C = false) => {
|
|
14185
|
+
let r2 = e, O = 0;
|
|
14186
|
+
if (C)
|
|
14187
|
+
for (let i3 = p - 1; i3 >= w; i3--) {
|
|
14188
|
+
const m = l2[i3];
|
|
14189
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
14190
|
+
}
|
|
14191
|
+
else
|
|
14192
|
+
for (let i3 = w; i3 < p; i3++) {
|
|
14193
|
+
const m = l2[i3];
|
|
14194
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
14195
|
+
}
|
|
14196
|
+
return { lineCount: r2, removals: O };
|
|
14197
|
+
};
|
|
14198
|
+
var limitOptions = ({
|
|
14199
|
+
cursor: l2,
|
|
14200
|
+
options: e,
|
|
14201
|
+
style: w,
|
|
14202
|
+
output: p = process.stdout,
|
|
14203
|
+
maxItems: b = Number.POSITIVE_INFINITY,
|
|
14204
|
+
columnPadding: C = 0,
|
|
14205
|
+
rowPadding: r2 = 4
|
|
14206
|
+
}) => {
|
|
14207
|
+
const i3 = getColumns(p) - C, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a3 = Math.max(Math.min(b, v), 5);
|
|
14208
|
+
let f = 0;
|
|
14209
|
+
l2 >= a3 - 3 && (f = Math.max(
|
|
14210
|
+
Math.min(l2 - a3 + 3, e.length - a3),
|
|
14211
|
+
0
|
|
14212
|
+
));
|
|
14213
|
+
let d = a3 < e.length && f > 0, c4 = a3 < e.length && f + a3 < e.length;
|
|
14214
|
+
const W2 = Math.min(
|
|
14215
|
+
f + a3,
|
|
14216
|
+
e.length
|
|
14217
|
+
), s = [];
|
|
14218
|
+
let g = 0;
|
|
14219
|
+
d && g++, c4 && g++;
|
|
14220
|
+
const T = f + (d ? 1 : 0), y = W2 - (c4 ? 1 : 0);
|
|
14221
|
+
for (let t2 = T; t2 < y; t2++) {
|
|
14222
|
+
const n4 = e[t2], o2 = n4 ? w(n4, t2 === l2) : "", h3 = wrapAnsi(o2, i3, {
|
|
14223
|
+
hard: true,
|
|
14224
|
+
trim: false
|
|
14225
|
+
}).split(`
|
|
14226
|
+
`);
|
|
14227
|
+
s.push(h3), g += h3.length;
|
|
14228
|
+
}
|
|
14229
|
+
if (g > v) {
|
|
14230
|
+
let t2 = 0, n4 = 0, o2 = g;
|
|
14231
|
+
const h3 = l2 - T;
|
|
14232
|
+
let u4 = v;
|
|
14233
|
+
const L = () => I(s, o2, 0, h3, u4), E = () => I(
|
|
14234
|
+
s,
|
|
14235
|
+
o2,
|
|
14236
|
+
h3 + 1,
|
|
14237
|
+
s.length,
|
|
14238
|
+
u4,
|
|
14239
|
+
true
|
|
14240
|
+
);
|
|
14241
|
+
d ? ({ lineCount: o2, removals: t2 } = L(), o2 > u4 && (c4 || (u4 -= 1), { lineCount: o2, removals: n4 } = E())) : (c4 || (u4 -= 1), { lineCount: o2, removals: n4 } = E(), o2 > u4 && (u4 -= 1, { lineCount: o2, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n4 > 0 && (c4 = true, s.splice(s.length - n4, n4));
|
|
14242
|
+
}
|
|
14243
|
+
const x = [];
|
|
14244
|
+
d && x.push(M);
|
|
14245
|
+
for (const t2 of s)
|
|
14246
|
+
for (const n4 of t2)
|
|
14247
|
+
x.push(n4);
|
|
14248
|
+
return c4 && x.push(M), x;
|
|
14249
|
+
};
|
|
14250
|
+
var confirm = (i3) => {
|
|
14251
|
+
const a3 = i3.active ?? "Yes", s = i3.inactive ?? "No";
|
|
14252
|
+
return new r({
|
|
14253
|
+
active: a3,
|
|
14254
|
+
inactive: s,
|
|
14255
|
+
signal: i3.signal,
|
|
14256
|
+
input: i3.input,
|
|
14257
|
+
output: i3.output,
|
|
14258
|
+
initialValue: i3.initialValue ?? true,
|
|
14259
|
+
render() {
|
|
14260
|
+
const e = i3.withGuide ?? settings.withGuide, u4 = `${symbol(this.state)} `, l2 = e ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
|
|
14261
|
+
i3.output,
|
|
14262
|
+
i3.message,
|
|
14263
|
+
l2,
|
|
14264
|
+
u4
|
|
14265
|
+
), o2 = `${e ? `${styleText2("gray", S_BAR)}
|
|
14266
|
+
` : ""}${f}
|
|
14267
|
+
`, c4 = this.value ? a3 : s;
|
|
14268
|
+
switch (this.state) {
|
|
14269
|
+
case "submit": {
|
|
14270
|
+
const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
|
|
14271
|
+
return `${o2}${r2}${styleText2("dim", c4)}`;
|
|
14272
|
+
}
|
|
14273
|
+
case "cancel": {
|
|
14274
|
+
const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
|
|
14275
|
+
return `${o2}${r2}${styleText2(["strikethrough", "dim"], c4)}${e ? `
|
|
14276
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
14277
|
+
}
|
|
14278
|
+
default: {
|
|
14279
|
+
const r2 = e ? `${styleText2("cyan", S_BAR)} ` : "", g = e ? styleText2("cyan", S_BAR_END) : "";
|
|
14280
|
+
return `${o2}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a3}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a3)}`}${i3.vertical ? e ? `
|
|
14281
|
+
${styleText2("cyan", S_BAR)} ` : `
|
|
14282
|
+
` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s}`}
|
|
14283
|
+
${g}
|
|
14284
|
+
`;
|
|
14285
|
+
}
|
|
14286
|
+
}
|
|
14287
|
+
}
|
|
14288
|
+
}).prompt();
|
|
14289
|
+
};
|
|
14290
|
+
var MULTISELECT_INSTRUCTIONS = [
|
|
14291
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
14292
|
+
`${styleText2("dim", "Space:")} select`,
|
|
14293
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
14294
|
+
];
|
|
14295
|
+
var log = {
|
|
14296
|
+
message: (s = [], {
|
|
14297
|
+
symbol: e = styleText2("gray", S_BAR),
|
|
14298
|
+
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
14299
|
+
output: m = process.stdout,
|
|
14300
|
+
spacing: l2 = 1,
|
|
14301
|
+
withGuide: c4
|
|
14302
|
+
} = {}) => {
|
|
14303
|
+
const t2 = [], o2 = c4 ?? settings.withGuide, f = o2 ? r2 : "", O = o2 ? `${e} ` : "", u4 = o2 ? `${r2} ` : "";
|
|
14304
|
+
for (let i3 = 0; i3 < l2; i3++)
|
|
14305
|
+
t2.push(f);
|
|
14306
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
14307
|
+
`);
|
|
14308
|
+
if (g.length > 0) {
|
|
14309
|
+
const [i3, ...y] = g;
|
|
14310
|
+
i3.length > 0 ? t2.push(`${O}${i3}`) : t2.push(o2 ? e : "");
|
|
14311
|
+
for (const p of y)
|
|
14312
|
+
p.length > 0 ? t2.push(`${u4}${p}`) : t2.push(o2 ? r2 : "");
|
|
14313
|
+
}
|
|
14314
|
+
m.write(`${t2.join(`
|
|
14315
|
+
`)}
|
|
14316
|
+
`);
|
|
14317
|
+
},
|
|
14318
|
+
info: (s, e) => {
|
|
14319
|
+
log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
|
|
14320
|
+
},
|
|
14321
|
+
success: (s, e) => {
|
|
14322
|
+
log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
|
|
14323
|
+
},
|
|
14324
|
+
step: (s, e) => {
|
|
14325
|
+
log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
14326
|
+
},
|
|
14327
|
+
warn: (s, e) => {
|
|
14328
|
+
log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
|
|
14329
|
+
},
|
|
14330
|
+
/** alias for `log.warn()`. */
|
|
14331
|
+
warning: (s, e) => {
|
|
14332
|
+
log.warn(s, e);
|
|
14333
|
+
},
|
|
14334
|
+
error: (s, e) => {
|
|
14335
|
+
log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
|
|
14336
|
+
}
|
|
14337
|
+
};
|
|
14338
|
+
var cancel = (o2 = "", t2) => {
|
|
14339
|
+
const i3 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
|
|
14340
|
+
i3.write(`${e}${styleText2("red", o2)}
|
|
14341
|
+
|
|
14342
|
+
`);
|
|
14343
|
+
};
|
|
14344
|
+
var intro = (o2 = "", t2) => {
|
|
14345
|
+
const i3 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
|
|
14346
|
+
i3.write(`${e}${o2}
|
|
14347
|
+
`);
|
|
14348
|
+
};
|
|
14349
|
+
var outro = (o2 = "", t2) => {
|
|
14350
|
+
const i3 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
|
|
14351
|
+
${styleText2("gray", S_BAR_END)} ` : "";
|
|
14352
|
+
i3.write(`${e}${o2}
|
|
14353
|
+
|
|
14354
|
+
`);
|
|
14355
|
+
};
|
|
14356
|
+
var W = (l2) => styleText2("magenta", l2);
|
|
14357
|
+
var spinner = ({
|
|
14358
|
+
indicator: l2 = "dots",
|
|
14359
|
+
onCancel: h3,
|
|
14360
|
+
output: n4 = process.stdout,
|
|
14361
|
+
cancelMessage: G,
|
|
14362
|
+
errorMessage: O,
|
|
14363
|
+
frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
|
|
14364
|
+
delay: F = unicode ? 80 : 120,
|
|
14365
|
+
signal: m,
|
|
14366
|
+
...I2
|
|
14367
|
+
} = {}) => {
|
|
14368
|
+
const u4 = isCI();
|
|
14369
|
+
let M, T, d = false, S = false, s = "", p, w = performance.now();
|
|
14370
|
+
const x = getColumns(n4), k = I2?.styleFrame ?? W, g = (e) => {
|
|
14371
|
+
const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
|
|
14372
|
+
S = e === 1, d && (a3(r2, e), S && typeof h3 == "function" && h3());
|
|
14373
|
+
}, f = () => g(2), i3 = () => g(1), A = () => {
|
|
14374
|
+
process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i3), process.on("SIGTERM", i3), process.on("exit", g), m && m.addEventListener("abort", i3);
|
|
14375
|
+
}, H = () => {
|
|
14376
|
+
process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i3), process.removeListener("SIGTERM", i3), process.removeListener("exit", g), m && m.removeEventListener("abort", i3);
|
|
14377
|
+
}, y = () => {
|
|
14378
|
+
if (p === void 0) return;
|
|
14379
|
+
u4 && n4.write(`
|
|
14380
|
+
`);
|
|
14381
|
+
const r2 = wrapAnsi(p, x, {
|
|
14382
|
+
hard: true,
|
|
14383
|
+
trim: false
|
|
14384
|
+
}).split(`
|
|
14385
|
+
`);
|
|
14386
|
+
r2.length > 1 && n4.write(import_sisteransi2.cursor.up(r2.length - 1)), n4.write(import_sisteransi2.cursor.to(0)), n4.write(import_sisteransi2.erase.down());
|
|
14387
|
+
}, C = (e) => e.replace(/\.+$/, ""), _ = (e) => {
|
|
14388
|
+
const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o2 = Math.floor(r2 % 60);
|
|
14389
|
+
return t2 > 0 ? `[${t2}m ${o2}s]` : `[${o2}s]`;
|
|
14390
|
+
}, N = I2.withGuide ?? settings.withGuide, P = (e = "") => {
|
|
14391
|
+
d = true, M = block({ output: n4 }), s = C(e), w = performance.now(), N && n4.write(`${styleText2("gray", S_BAR)}
|
|
14392
|
+
`);
|
|
14393
|
+
let r2 = 0, t2 = 0;
|
|
14394
|
+
A(), T = setInterval(() => {
|
|
14395
|
+
if (u4 && s === p)
|
|
14396
|
+
return;
|
|
14397
|
+
y(), p = s;
|
|
14398
|
+
const o2 = k(E[r2]);
|
|
14399
|
+
let v;
|
|
14400
|
+
if (u4)
|
|
14401
|
+
v = `${o2} ${s}...`;
|
|
14402
|
+
else if (l2 === "timer")
|
|
14403
|
+
v = `${o2} ${s} ${_(w)}`;
|
|
14404
|
+
else {
|
|
14405
|
+
const B = ".".repeat(Math.floor(t2)).slice(0, 3);
|
|
14406
|
+
v = `${o2} ${s}${B}`;
|
|
14407
|
+
}
|
|
14408
|
+
const j = wrapAnsi(v, x, {
|
|
14409
|
+
hard: true,
|
|
14410
|
+
trim: false
|
|
14411
|
+
});
|
|
14412
|
+
n4.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
|
|
14413
|
+
}, F);
|
|
14414
|
+
}, a3 = (e = "", r2 = 0, t2 = false) => {
|
|
14415
|
+
if (!d) return;
|
|
14416
|
+
d = false, clearInterval(T), y();
|
|
14417
|
+
const o2 = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
|
|
14418
|
+
s = e ?? s, t2 || (l2 === "timer" ? n4.write(`${o2} ${s} ${_(w)}
|
|
14419
|
+
`) : n4.write(`${o2} ${s}
|
|
14420
|
+
`)), H(), M();
|
|
14421
|
+
};
|
|
14422
|
+
return {
|
|
14423
|
+
start: P,
|
|
14424
|
+
stop: (e = "") => a3(e, 0),
|
|
14425
|
+
message: (e = "") => {
|
|
14426
|
+
s = C(e ?? s);
|
|
14427
|
+
},
|
|
14428
|
+
cancel: (e = "") => a3(e, 1),
|
|
14429
|
+
error: (e = "") => a3(e, 2),
|
|
14430
|
+
clear: () => a3("", 0, true),
|
|
14431
|
+
get isCancelled() {
|
|
14432
|
+
return S;
|
|
14433
|
+
}
|
|
14434
|
+
};
|
|
14435
|
+
};
|
|
14436
|
+
var u3 = {
|
|
14437
|
+
light: unicodeOr("\u2500", "-"),
|
|
14438
|
+
heavy: unicodeOr("\u2501", "="),
|
|
14439
|
+
block: unicodeOr("\u2588", "#")
|
|
14440
|
+
};
|
|
14441
|
+
var SELECT_INSTRUCTIONS = [
|
|
14442
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
14443
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
14444
|
+
];
|
|
14445
|
+
var c3 = (t2, o2) => t2.includes(`
|
|
14446
|
+
`) ? t2.split(`
|
|
14447
|
+
`).map((d) => o2(d)).join(`
|
|
14448
|
+
`) : o2(t2);
|
|
14449
|
+
var select2 = (t2) => {
|
|
14450
|
+
const o2 = (n4, m) => {
|
|
14451
|
+
if (n4 === void 0)
|
|
14452
|
+
return "";
|
|
14453
|
+
const s = n4.label ?? String(n4.value);
|
|
14454
|
+
switch (m) {
|
|
14455
|
+
case "disabled":
|
|
14456
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c3(s, (i3) => styleText2("gray", i3))}${n4.hint ? ` ${styleText2("dim", `(${n4.hint ?? "disabled"})`)}` : ""}`;
|
|
14457
|
+
case "selected":
|
|
14458
|
+
return `${c3(s, (i3) => styleText2("dim", i3))}`;
|
|
14459
|
+
case "active":
|
|
14460
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n4.hint ? ` ${styleText2("dim", `(${n4.hint})`)}` : ""}`;
|
|
14461
|
+
case "cancelled":
|
|
14462
|
+
return `${c3(s, (i3) => styleText2(["strikethrough", "dim"], i3))}`;
|
|
14463
|
+
default:
|
|
14464
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c3(s, (i3) => styleText2("dim", i3))}`;
|
|
14465
|
+
}
|
|
14466
|
+
}, d = t2.showInstructions ?? true;
|
|
14467
|
+
return new n$1({
|
|
14468
|
+
options: t2.options,
|
|
14469
|
+
signal: t2.signal,
|
|
14470
|
+
input: t2.input,
|
|
14471
|
+
output: t2.output,
|
|
14472
|
+
initialValue: t2.initialValue,
|
|
14473
|
+
render() {
|
|
14474
|
+
const n4 = t2.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i3 = wrapTextWithPrefix(
|
|
14475
|
+
t2.output,
|
|
14476
|
+
t2.message,
|
|
14477
|
+
s,
|
|
14478
|
+
m
|
|
14479
|
+
), u4 = `${n4 ? `${styleText2("gray", S_BAR)}
|
|
14480
|
+
` : ""}${i3}
|
|
14481
|
+
`;
|
|
14482
|
+
switch (this.state) {
|
|
14483
|
+
case "submit": {
|
|
14484
|
+
const r2 = n4 ? `${styleText2("gray", S_BAR)} ` : "", a3 = wrapTextWithPrefix(
|
|
14485
|
+
t2.output,
|
|
14486
|
+
o2(this.options[this.cursor], "selected"),
|
|
14487
|
+
r2
|
|
14488
|
+
);
|
|
14489
|
+
return `${u4}${a3}`;
|
|
14490
|
+
}
|
|
14491
|
+
case "cancel": {
|
|
14492
|
+
const r2 = n4 ? `${styleText2("gray", S_BAR)} ` : "", a3 = wrapTextWithPrefix(
|
|
14493
|
+
t2.output,
|
|
14494
|
+
o2(this.options[this.cursor], "cancelled"),
|
|
14495
|
+
r2
|
|
14496
|
+
);
|
|
14497
|
+
return `${u4}${a3}${n4 ? `
|
|
14498
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
14499
|
+
}
|
|
14500
|
+
default: {
|
|
14501
|
+
const r2 = n4 ? `${styleText2("cyan", S_BAR)} ` : "", a3 = u4.split(`
|
|
14502
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n4) : n4 ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
|
|
14503
|
+
`), f = p.length + 1;
|
|
14504
|
+
return `${u4}${r2}${limitOptions({
|
|
14505
|
+
output: t2.output,
|
|
14506
|
+
cursor: this.cursor,
|
|
14507
|
+
options: this.options,
|
|
14508
|
+
maxItems: t2.maxItems,
|
|
14509
|
+
columnPadding: r2.length,
|
|
14510
|
+
rowPadding: a3 + f,
|
|
14511
|
+
style: (g, x) => o2(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
14512
|
+
}).join(`
|
|
14513
|
+
${r2}`)}
|
|
14514
|
+
${b}
|
|
14515
|
+
`;
|
|
14516
|
+
}
|
|
14517
|
+
}
|
|
14518
|
+
}
|
|
14519
|
+
}).prompt();
|
|
14520
|
+
};
|
|
14521
|
+
var i2 = `${styleText2("gray", S_BAR)} `;
|
|
14522
|
+
var text = (e) => new n3({
|
|
14523
|
+
validate: e.validate,
|
|
14524
|
+
placeholder: e.placeholder,
|
|
14525
|
+
defaultValue: e.defaultValue,
|
|
14526
|
+
initialValue: e.initialValue,
|
|
14527
|
+
output: e.output,
|
|
14528
|
+
signal: e.signal,
|
|
14529
|
+
input: e.input,
|
|
14530
|
+
render() {
|
|
14531
|
+
const i3 = e?.withGuide ?? settings.withGuide, s = `${`${i3 ? `${styleText2("gray", S_BAR)}
|
|
14532
|
+
` : ""}${symbol(this.state)} `}${e.message}
|
|
14533
|
+
`, c4 = e.placeholder && e.placeholder.length > 0 ? (
|
|
14534
|
+
// biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
|
|
14535
|
+
styleText2("inverse", e.placeholder[0]) + styleText2("dim", e.placeholder.slice(1))
|
|
14536
|
+
) : styleText2(["inverse", "hidden"], "_"), o2 = this.userInput ? this.userInputWithCursor : c4, l2 = this.value ?? "";
|
|
14537
|
+
switch (this.state) {
|
|
14538
|
+
case "error": {
|
|
14539
|
+
const n4 = this.error ? ` ${styleText2("yellow", this.error)}` : "", r2 = i3 ? `${styleText2("yellow", S_BAR)} ` : "", d = i3 ? styleText2("yellow", S_BAR_END) : "";
|
|
14540
|
+
return `${s.trim()}
|
|
14541
|
+
${r2}${o2}
|
|
14542
|
+
${d}${n4}
|
|
14543
|
+
`;
|
|
14544
|
+
}
|
|
14545
|
+
case "submit": {
|
|
14546
|
+
const n4 = l2 ? ` ${styleText2("dim", l2)}` : "", r2 = i3 ? styleText2("gray", S_BAR) : "";
|
|
14547
|
+
return `${s}${r2}${n4}`;
|
|
14548
|
+
}
|
|
14549
|
+
case "cancel": {
|
|
14550
|
+
const n4 = l2 ? ` ${styleText2(["strikethrough", "dim"], l2)}` : "", r2 = i3 ? styleText2("gray", S_BAR) : "";
|
|
14551
|
+
return `${s}${r2}${n4}${l2.trim() ? `
|
|
14552
|
+
${r2}` : ""}`;
|
|
14553
|
+
}
|
|
14554
|
+
default: {
|
|
14555
|
+
const n4 = i3 ? `${styleText2("cyan", S_BAR)} ` : "", r2 = i3 ? styleText2("cyan", S_BAR_END) : "";
|
|
14556
|
+
return `${s}${n4}${o2}
|
|
14557
|
+
${r2}
|
|
14558
|
+
`;
|
|
14559
|
+
}
|
|
14560
|
+
}
|
|
14561
|
+
}
|
|
14562
|
+
}).prompt();
|
|
14563
|
+
|
|
14564
|
+
// packages/cli/src/wizard.ts
|
|
14565
|
+
import { resolve as resolve8 } from "node:path";
|
|
14566
|
+
var supportedRuntimes = [
|
|
14567
|
+
"oh-my-pi",
|
|
14568
|
+
"opencode",
|
|
14569
|
+
"pi",
|
|
14570
|
+
"claude-code",
|
|
14571
|
+
"codex",
|
|
14572
|
+
"antigravity",
|
|
14573
|
+
"dcode"
|
|
14574
|
+
];
|
|
14575
|
+
function unwrap(value) {
|
|
14576
|
+
if (isCancel(value)) {
|
|
14577
|
+
cancel("Setup cancelled.");
|
|
14578
|
+
process.exitCode = 130;
|
|
14579
|
+
throw new Error("cancelled");
|
|
14580
|
+
}
|
|
14581
|
+
return value;
|
|
14582
|
+
}
|
|
14583
|
+
async function runInstallWizard() {
|
|
14584
|
+
intro("Portable Capabilities setup");
|
|
14585
|
+
try {
|
|
14586
|
+
const source = String(
|
|
14587
|
+
unwrap(
|
|
14588
|
+
await text({
|
|
14589
|
+
message: "Generated capability bundle directory",
|
|
14590
|
+
placeholder: "/absolute/path/to/generated-bundle",
|
|
14591
|
+
validate: (value) => value?.trim() ? void 0 : "Source directory is required"
|
|
14592
|
+
})
|
|
14593
|
+
)
|
|
14594
|
+
);
|
|
14595
|
+
const target = String(
|
|
14596
|
+
unwrap(
|
|
14597
|
+
await text({
|
|
14598
|
+
message: "Project directory to install into",
|
|
14599
|
+
initialValue: process.cwd(),
|
|
14600
|
+
validate: (value) => value?.trim() ? void 0 : "Target directory is required"
|
|
14601
|
+
})
|
|
14602
|
+
)
|
|
14603
|
+
);
|
|
14604
|
+
const runtime = unwrap(
|
|
14605
|
+
await select2({
|
|
14606
|
+
message: "Choose a runtime",
|
|
14607
|
+
options: supportedRuntimes.map((value) => ({ value, label: value }))
|
|
14608
|
+
})
|
|
14609
|
+
);
|
|
14610
|
+
const capabilityInput = String(
|
|
14611
|
+
unwrap(
|
|
14612
|
+
await text({
|
|
14613
|
+
message: "Capability IDs",
|
|
14614
|
+
placeholder: "Leave blank to install all capabilities"
|
|
14615
|
+
})
|
|
14616
|
+
)
|
|
14617
|
+
);
|
|
14618
|
+
const dryRun = unwrap(
|
|
14619
|
+
await confirm({
|
|
14620
|
+
message: "Preview changes without writing?",
|
|
14621
|
+
initialValue: false
|
|
14622
|
+
})
|
|
14623
|
+
);
|
|
14624
|
+
const capabilityIds = capabilityInput.split(",").map((value) => value.trim()).filter(Boolean);
|
|
14625
|
+
const spinner2 = spinner();
|
|
14626
|
+
spinner2.start(dryRun ? "Planning installation" : "Installing capabilities");
|
|
14627
|
+
const result2 = await installPackage({
|
|
14628
|
+
sourceRoot: resolve8(source),
|
|
14629
|
+
targetRoot: resolve8(target),
|
|
14630
|
+
runtimeId: runtime,
|
|
14631
|
+
packageVersion: cliVersion,
|
|
14632
|
+
...capabilityIds.length ? { capabilityIds } : {},
|
|
14633
|
+
allCapabilities: capabilityIds.length === 0,
|
|
14634
|
+
dryRun
|
|
14635
|
+
});
|
|
14636
|
+
spinner2.stop(result2.ok ? "Installation complete" : "Installation failed");
|
|
14637
|
+
if (!result2.ok) {
|
|
14638
|
+
for (const diagnostic of result2.diagnostics) log.error(diagnostic);
|
|
14639
|
+
process.exitCode = 4;
|
|
14640
|
+
return;
|
|
14641
|
+
}
|
|
14642
|
+
if (result2.installed.length) log.success(`Installed ${result2.installed.length} file(s).`);
|
|
14643
|
+
if (result2.preserved.length) log.info(`Preserved ${result2.preserved.length} file(s).`);
|
|
14644
|
+
outro(dryRun ? "Preview complete." : "Project is ready.");
|
|
14645
|
+
} catch (error) {
|
|
14646
|
+
if (error.message !== "cancelled") throw error;
|
|
14647
|
+
}
|
|
14648
|
+
}
|
|
14649
|
+
|
|
13344
14650
|
// packages/cli/src/program.ts
|
|
13345
14651
|
function formatOf(options) {
|
|
13346
14652
|
return options.format === "json" ? "json" : "human";
|
|
@@ -13365,7 +14671,11 @@ function writeLifecycleResult(command, lifecycle, options) {
|
|
|
13365
14671
|
if (!lifecycle.ok) process.exitCode = 4;
|
|
13366
14672
|
}
|
|
13367
14673
|
function createProgram() {
|
|
13368
|
-
const program2 = new Command().name("portable-capabilities").version(cliVersion).description("Portable analytical capability compiler");
|
|
14674
|
+
const program2 = new Command().name("portable-capabilities").version(cliVersion).description("Portable analytical capability compiler").action(runInstallWizard);
|
|
14675
|
+
program2.command("wizard").description("Guided capability installation").action(runInstallWizard);
|
|
14676
|
+
program2.command("runtimes").description("List supported runtime IDs").action(() => {
|
|
14677
|
+
for (const runtime of supportedRuntimes) console.log(runtime);
|
|
14678
|
+
});
|
|
13369
14679
|
common2(
|
|
13370
14680
|
program2.command("build").argument("<manifest>", "system manifest").option("--output <dir>").option("--target <ids...>").option("--role <ids...>")
|
|
13371
14681
|
).action(async (manifest, options) => {
|