@acidicsoil/portable-capabilities 0.1.2 → 0.1.4

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.
@@ -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: (a2, b) => (typeof require !== "undefined" ? require : a2)[b]
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((a2, b) => {
235
- return a2.name().localeCompare(b.name());
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(a2, b) {
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(a2).localeCompare(getSortKey(b));
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(a2, b) {
1117
- if (Math.abs(a2.length - b.length) > maxDistance)
1118
- return Math.max(a2.length, b.length);
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 i2 = 0; i2 <= a2.length; i2++) {
1121
- d[i2] = [i2];
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 i2 = 1; i2 <= a2.length; i2++) {
1127
+ for (let i3 = 1; i3 <= a3.length; i3++) {
1128
1128
  let cost = 1;
1129
- if (a2[i2 - 1] === b[j - 1]) {
1129
+ if (a3[i3 - 1] === b[j - 1]) {
1130
1130
  cost = 0;
1131
1131
  } else {
1132
1132
  cost = 1;
1133
1133
  }
1134
- d[i2][j] = Math.min(
1135
- d[i2 - 1][j] + 1,
1134
+ d[i3][j] = Math.min(
1135
+ d[i3 - 1][j] + 1,
1136
1136
  // deletion
1137
- d[i2][j - 1] + 1,
1137
+ d[i3][j - 1] + 1,
1138
1138
  // insertion
1139
- d[i2 - 1][j - 1] + cost
1139
+ d[i3 - 1][j - 1] + cost
1140
1140
  // substitution
1141
1141
  );
1142
- if (i2 > 1 && j > 1 && a2[i2 - 1] === b[j - 2] && a2[i2 - 2] === b[j - 1]) {
1143
- d[i2][j] = Math.min(d[i2][j], d[i2 - 2][j - 2] + 1);
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[a2.length][b.length];
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((a2, b) => a2.localeCompare(b));
1174
+ similar.sort((a3, b) => a3.localeCompare(b));
1175
1175
  if (searchingOptions) {
1176
1176
  similar = similar.map((candidate) => `--${candidate}`);
1177
1177
  }
@@ -1823,8 +1823,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
1823
1823
  } else if (fn instanceof RegExp) {
1824
1824
  const regex = fn;
1825
1825
  fn = (val, def) => {
1826
- const m = regex.exec(val);
1827
- return m ? m[0] : def;
1826
+ const m2 = regex.exec(val);
1827
+ return m2 ? m2[0] : def;
1828
1828
  };
1829
1829
  option.default(defaultValue).argParser(fn);
1830
1830
  } else {
@@ -2366,8 +2366,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
2366
2366
  * @private
2367
2367
  */
2368
2368
  _checkNumberOfArguments() {
2369
- this.registeredArguments.forEach((arg, i2) => {
2370
- if (arg.required && this.args[i2] == null) {
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 i2 = 0; i2 < len; i2++) {
2757
- const key = this.options[i2].attributeName();
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 text = helper.formatHelp(this, helper);
3202
- if (context.hasColors) return text;
3203
- return this._outputConfiguration.stripColor(text);
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, text) {
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 text === "function") {
3373
- helpStr = text({ error: context.error, command: context.command });
3372
+ if (typeof text2 === "function") {
3373
+ helpStr = text2({ error: context.error, command: context.command });
3374
3374
  } else {
3375
- helpStr = text;
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((a2, b) => a2.id.localeCompare(b.id)))
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 text = await readFile2(absolute, "utf8");
4042
+ const text2 = await readFile2(absolute, "utf8");
3987
4043
  if (extname(absolute).toLowerCase() === ".json") {
3988
- return { file: absolute, data: JSON.parse(text) };
4044
+ return { file: absolute, data: JSON.parse(text2) };
3989
4045
  }
3990
- const document = parseDocument(text, { prettyErrors: true, strict: true });
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((a2, b) => a2.id.localeCompare(b.id))),
4082
- runtimes: Object.freeze(runtimes.sort((a2, b) => a2.id.localeCompare(b.id))),
4083
- exceptions: Object.freeze(exceptions.sort((a2, b) => a2.id.localeCompare(b.id)))
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 stdout === "string") {
4994
- return stdout;
5048
+ var getSubprocessResult = ({ stdout: stdout2 }) => {
5049
+ if (typeof stdout2 === "string") {
5050
+ return stdout2;
4995
5051
  }
4996
- if (isUint8Array(stdout)) {
4997
- return uint8ArrayToString(stdout);
5052
+ if (isUint8Array(stdout2)) {
5053
+ return uint8ArrayToString(stdout2);
4998
5054
  }
4999
- if (stdout === void 0) {
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 stdout}" stdout in template expression`);
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((resolve8, reject) => {
6363
- Object.assign(methods, { resolve: resolve8, reject });
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, t) {
7297
- this.#t = e, this.#n = t;
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 t = () => this.#i(e);
7305
- return this.#e ? this.#e.then(t, t) : t();
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 (t) {
7317
- throw this.#e = void 0, this.#r = true, this.#t.releaseLock(), t;
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 t = this.#t.cancel(e);
7329
- return this.#t.releaseLock(), await t, {
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(r) {
7346
- return this[n].return(r);
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: r = false } = {}) {
7364
- const e = this.getReader(), t = new c(
7419
+ function h({ preventCancel: r2 = false } = {}) {
7420
+ const e = this.getReader(), t2 = new c(
7365
7421
  e,
7366
- r
7422
+ r2
7367
7423
  ), s = Object.create(u);
7368
- return s[n] = t, s;
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 && stdin !== void 0) {
8582
- return { optionName: "stdin", optionValue: stdin };
8637
+ if (usedDescriptor === 0 && stdin2 !== void 0) {
8638
+ return { optionName: "stdin", optionValue: stdin2 };
8583
8639
  }
8584
- if (usedDescriptor === 1 && stdout !== void 0) {
8585
- return { optionName: "stdout", optionValue: stdout };
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 = ([, stdout, stderr], options) => {
9531
+ var getAllSync = ([, stdout2, stderr], options) => {
9476
9532
  if (!options.all) {
9477
9533
  return;
9478
9534
  }
9479
- if (stdout === void 0) {
9535
+ if (stdout2 === void 0) {
9480
9536
  return stderr;
9481
9537
  }
9482
9538
  if (stderr === void 0) {
9483
- return stdout;
9539
+ return stdout2;
9484
9540
  }
9485
- if (Array.isArray(stdout)) {
9486
- return Array.isArray(stderr) ? [...stdout, ...stderr] : [...stdout, stripNewline(stderr, options, "all")];
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(stdout, options, "all"), ...stderr];
9545
+ return [stripNewline(stdout2, options, "all"), ...stderr];
9490
9546
  }
9491
- if (isUint8Array(stdout) && isUint8Array(stderr)) {
9492
- return concatUint8Arrays([stdout, stderr]);
9547
+ if (isUint8Array(stdout2) && isUint8Array(stderr)) {
9548
+ return concatUint8Arrays([stdout2, stderr]);
9493
9549
  }
9494
- return `${stdout}${stderr}`;
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 stdin = createDummyStream();
9941
- const stdout = createDummyStream();
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 = [stdin, stdout, stderr, ...extraStdio];
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 i2 = list.indexOf(fn);
10434
- if (i2 === -1) {
10489
+ const i3 = list.indexOf(fn);
10490
+ if (i3 === -1) {
10435
10491
  return;
10436
10492
  }
10437
- if (i2 === 0 && list.length === 1) {
10493
+ if (i3 === 0 && list.length === 1) {
10438
10494
  list.length = 0;
10439
10495
  } else {
10440
- list.splice(i2, 1);
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, ...a2) => {
10551
- return this.#processEmit(ev, ...a2);
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 resolve8 = promise.resolve.bind(promise);
10656
- return { resolve: resolve8, promises };
10711
+ const resolve9 = promise.resolve.bind(promise);
10712
+ return { resolve: resolve9, promises };
10657
10713
  };
10658
- var waitForConcurrentStreams = async ({ resolve: resolve8, promises }, subprocess) => {
10659
- resolve8();
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 && (stdout || stderr) ? mergeStreams([stdout, stderr].filter(Boolean)) : void 0;
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: stdout, buffer };
11570
+ return { stream: stdout2, buffer };
11515
11571
  }
11516
11572
  return { stream: all, buffer };
11517
11573
  };
11518
- var getAllMixed = ({ stdout, stderr }, all) => all && stdout && stderr && stdout.readableObjectMode !== stderr.readableObjectMode;
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
- (text, secret) => secret ? text.replaceAll(secret, "[REDACTED]") : text,
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
- ([a2], [b]) => a2.localeCompare(b)
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 stdout = redact(outcome.stdout, request.environment);
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 text = decoder2.decode(primitiveArtifact.content);
12970
+ const text2 = decoder2.decode(primitiveArtifact.content);
12915
12971
  const core = `${ir.runtime.nativeRoot}/${ir.role.id}/SKILL.md`;
12916
- if (!text.includes(core) && !text.includes(`skills:
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 text = decoder2.decode(skill.content);
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(text, availableResources);
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 (!text.includes(required)) diagnostics.push(`missing skill metadata: ${required}`);
12990
+ if (!text2.includes(required)) diagnostics.push(`missing skill metadata: ${required}`);
12935
12991
  }
12936
12992
  }
12937
12993
  if (!lock) {
@@ -13341,6 +13397,1430 @@ 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, m2 = a3 === "return" ? -1 : 0;
13846
+ l.moveCursor(r2, i3, m2, () => {
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, m2) => {
13865
+ const d = n4 ? n4(c4, i3) : c4;
13866
+ return i3 === 0 ? `${t2}${d}` : i3 === m2.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 a2 = class extends V {
14064
+ options;
14065
+ cursor = 0;
14066
+ get _value() {
14067
+ return this.options[this.cursor]?.value;
14068
+ }
14069
+ get _enabledOptions() {
14070
+ return this.options.filter((e) => e.disabled !== true);
14071
+ }
14072
+ toggleAll() {
14073
+ const e = this._enabledOptions, i3 = this.value !== void 0 && this.value.length === e.length;
14074
+ this.value = i3 ? [] : e.map((t2) => t2.value);
14075
+ }
14076
+ toggleInvert() {
14077
+ const e = this.value;
14078
+ if (!e)
14079
+ return;
14080
+ const i3 = this._enabledOptions.filter((t2) => !e.includes(t2.value));
14081
+ this.value = i3.map((t2) => t2.value);
14082
+ }
14083
+ toggleValue() {
14084
+ this.value === void 0 && (this.value = []);
14085
+ const e = this.value.includes(this._value);
14086
+ this.value = e ? this.value.filter((i3) => i3 !== this._value) : [...this.value, this._value];
14087
+ }
14088
+ constructor(e) {
14089
+ super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
14090
+ const i3 = Math.max(
14091
+ this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
14092
+ 0
14093
+ );
14094
+ this.cursor = this.options[i3]?.disabled ? findCursor(i3, 1, this.options) : i3, this.on("key", (t2, l2) => {
14095
+ l2.name === "a" && this.toggleAll(), l2.name === "i" && this.toggleInvert();
14096
+ }), this.on("cursor", (t2) => {
14097
+ switch (t2) {
14098
+ case "left":
14099
+ case "up":
14100
+ this.cursor = findCursor(this.cursor, -1, this.options);
14101
+ break;
14102
+ case "down":
14103
+ case "right":
14104
+ this.cursor = findCursor(this.cursor, 1, this.options);
14105
+ break;
14106
+ case "space":
14107
+ this.toggleValue();
14108
+ break;
14109
+ }
14110
+ });
14111
+ }
14112
+ };
14113
+ var n$1 = class n2 extends V {
14114
+ options;
14115
+ cursor = 0;
14116
+ get _selectedValue() {
14117
+ return this.options[this.cursor];
14118
+ }
14119
+ changeValue() {
14120
+ const e = this._selectedValue;
14121
+ this.value = e === void 0 ? void 0 : e.value;
14122
+ }
14123
+ constructor(e) {
14124
+ super(e, false), this.options = e.options;
14125
+ const o2 = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o2 === -1 ? 0 : o2;
14126
+ this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
14127
+ switch (s) {
14128
+ case "left":
14129
+ case "up":
14130
+ this.cursor = findCursor(this.cursor, -1, this.options);
14131
+ break;
14132
+ case "down":
14133
+ case "right":
14134
+ this.cursor = findCursor(this.cursor, 1, this.options);
14135
+ break;
14136
+ }
14137
+ this.changeValue();
14138
+ });
14139
+ }
14140
+ };
14141
+ var n3 = class extends V {
14142
+ get userInputWithCursor() {
14143
+ if (this.state === "submit")
14144
+ return this.userInput;
14145
+ const t2 = this.userInput;
14146
+ if (this.cursor >= t2.length)
14147
+ return `${this.userInput}\u2588`;
14148
+ const r2 = t2.slice(0, this.cursor), s = t2.slice(this.cursor, this.cursor + 1), e = t2.slice(this.cursor + 1);
14149
+ return `${r2}${styleText("inverse", s)}${e}`;
14150
+ }
14151
+ get cursor() {
14152
+ return this._cursor;
14153
+ }
14154
+ constructor(t2) {
14155
+ super({
14156
+ ...t2,
14157
+ initialUserInput: t2.initialUserInput ?? t2.initialValue
14158
+ }), this.on("userInput", (r2) => {
14159
+ this._setValue(r2);
14160
+ }), this.on("finalize", () => {
14161
+ this.value || (this.value = t2.defaultValue), this.value === void 0 && (this.value = "");
14162
+ });
14163
+ }
14164
+ };
14165
+
14166
+ // node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs
14167
+ import { styleText as styleText2, stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
14168
+ import process$1 from "node:process";
14169
+ var import_sisteransi2 = __toESM(require_src(), 1);
14170
+ function isUnicodeSupported2() {
14171
+ if (process$1.platform !== "win32") {
14172
+ return process$1.env.TERM !== "linux";
14173
+ }
14174
+ 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";
14175
+ }
14176
+ var unicode = isUnicodeSupported2();
14177
+ var isCI = () => process.env.CI === "true";
14178
+ var unicodeOr = (o2, e) => unicode ? o2 : e;
14179
+ var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
14180
+ var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
14181
+ var S_STEP_ERROR = unicodeOr("\u25B2", "x");
14182
+ var S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
14183
+ var S_BAR_START = unicodeOr("\u250C", "T");
14184
+ var S_BAR = unicodeOr("\u2502", "|");
14185
+ var S_BAR_END = unicodeOr("\u2514", "\u2014");
14186
+ var S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
14187
+ var S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
14188
+ var S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
14189
+ var S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
14190
+ var S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
14191
+ var S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
14192
+ var S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
14193
+ var S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
14194
+ var S_BAR_H = unicodeOr("\u2500", "-");
14195
+ var S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
14196
+ var S_CONNECT_LEFT = unicodeOr("\u251C", "+");
14197
+ var S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
14198
+ var S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
14199
+ var S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
14200
+ var S_INFO = unicodeOr("\u25CF", "\u2022");
14201
+ var S_SUCCESS = unicodeOr("\u25C6", "*");
14202
+ var S_WARN = unicodeOr("\u25B2", "!");
14203
+ var S_ERROR = unicodeOr("\u25A0", "x");
14204
+ var symbol = (o2) => {
14205
+ switch (o2) {
14206
+ case "initial":
14207
+ case "active":
14208
+ return styleText2("cyan", S_STEP_ACTIVE);
14209
+ case "cancel":
14210
+ return styleText2("red", S_STEP_CANCEL);
14211
+ case "error":
14212
+ return styleText2("yellow", S_STEP_ERROR);
14213
+ case "submit":
14214
+ return styleText2("green", S_STEP_SUBMIT);
14215
+ }
14216
+ };
14217
+ var symbolBar = (o2) => {
14218
+ switch (o2) {
14219
+ case "initial":
14220
+ case "active":
14221
+ return styleText2("cyan", S_BAR);
14222
+ case "cancel":
14223
+ return styleText2("red", S_BAR);
14224
+ case "error":
14225
+ return styleText2("yellow", S_BAR);
14226
+ case "submit":
14227
+ return styleText2("green", S_BAR);
14228
+ }
14229
+ };
14230
+ function formatInstructionFooter(o2, e) {
14231
+ const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o2.join(" \u2022 ")}`];
14232
+ return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
14233
+ }
14234
+ var I = (l2, e, w, p, b, C = false) => {
14235
+ let r2 = e, O = 0;
14236
+ if (C)
14237
+ for (let i3 = p - 1; i3 >= w; i3--) {
14238
+ const m2 = l2[i3];
14239
+ if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
14240
+ }
14241
+ else
14242
+ for (let i3 = w; i3 < p; i3++) {
14243
+ const m2 = l2[i3];
14244
+ if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
14245
+ }
14246
+ return { lineCount: r2, removals: O };
14247
+ };
14248
+ var limitOptions = ({
14249
+ cursor: l2,
14250
+ options: e,
14251
+ style: w,
14252
+ output: p = process.stdout,
14253
+ maxItems: b = Number.POSITIVE_INFINITY,
14254
+ columnPadding: C = 0,
14255
+ rowPadding: r2 = 4
14256
+ }) => {
14257
+ const i3 = getColumns(p) - C, m2 = getRows(p), M = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a3 = Math.max(Math.min(b, v), 5);
14258
+ let f = 0;
14259
+ l2 >= a3 - 3 && (f = Math.max(
14260
+ Math.min(l2 - a3 + 3, e.length - a3),
14261
+ 0
14262
+ ));
14263
+ let d = a3 < e.length && f > 0, c4 = a3 < e.length && f + a3 < e.length;
14264
+ const W2 = Math.min(
14265
+ f + a3,
14266
+ e.length
14267
+ ), s = [];
14268
+ let g = 0;
14269
+ d && g++, c4 && g++;
14270
+ const T = f + (d ? 1 : 0), y = W2 - (c4 ? 1 : 0);
14271
+ for (let t2 = T; t2 < y; t2++) {
14272
+ const n4 = e[t2], o2 = n4 ? w(n4, t2 === l2) : "", h3 = wrapAnsi(o2, i3, {
14273
+ hard: true,
14274
+ trim: false
14275
+ }).split(`
14276
+ `);
14277
+ s.push(h3), g += h3.length;
14278
+ }
14279
+ if (g > v) {
14280
+ let t2 = 0, n4 = 0, o2 = g;
14281
+ const h3 = l2 - T;
14282
+ let u4 = v;
14283
+ const L = () => I(s, o2, 0, h3, u4), E = () => I(
14284
+ s,
14285
+ o2,
14286
+ h3 + 1,
14287
+ s.length,
14288
+ u4,
14289
+ true
14290
+ );
14291
+ 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));
14292
+ }
14293
+ const x = [];
14294
+ d && x.push(M);
14295
+ for (const t2 of s)
14296
+ for (const n4 of t2)
14297
+ x.push(n4);
14298
+ return c4 && x.push(M), x;
14299
+ };
14300
+ var confirm = (i3) => {
14301
+ const a3 = i3.active ?? "Yes", s = i3.inactive ?? "No";
14302
+ return new r({
14303
+ active: a3,
14304
+ inactive: s,
14305
+ signal: i3.signal,
14306
+ input: i3.input,
14307
+ output: i3.output,
14308
+ initialValue: i3.initialValue ?? true,
14309
+ render() {
14310
+ const e = i3.withGuide ?? settings.withGuide, u4 = `${symbol(this.state)} `, l2 = e ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
14311
+ i3.output,
14312
+ i3.message,
14313
+ l2,
14314
+ u4
14315
+ ), o2 = `${e ? `${styleText2("gray", S_BAR)}
14316
+ ` : ""}${f}
14317
+ `, c4 = this.value ? a3 : s;
14318
+ switch (this.state) {
14319
+ case "submit": {
14320
+ const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
14321
+ return `${o2}${r2}${styleText2("dim", c4)}`;
14322
+ }
14323
+ case "cancel": {
14324
+ const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
14325
+ return `${o2}${r2}${styleText2(["strikethrough", "dim"], c4)}${e ? `
14326
+ ${styleText2("gray", S_BAR)}` : ""}`;
14327
+ }
14328
+ default: {
14329
+ const r2 = e ? `${styleText2("cyan", S_BAR)} ` : "", g = e ? styleText2("cyan", S_BAR_END) : "";
14330
+ return `${o2}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a3}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a3)}`}${i3.vertical ? e ? `
14331
+ ${styleText2("cyan", S_BAR)} ` : `
14332
+ ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s}`}
14333
+ ${g}
14334
+ `;
14335
+ }
14336
+ }
14337
+ }
14338
+ }).prompt();
14339
+ };
14340
+ var MULTISELECT_INSTRUCTIONS = [
14341
+ `${styleText2("dim", "\u2191/\u2193")} to navigate`,
14342
+ `${styleText2("dim", "Space:")} select`,
14343
+ `${styleText2("dim", "Enter:")} confirm`
14344
+ ];
14345
+ var m = (i3, u4) => i3.split(`
14346
+ `).map((d) => u4(d)).join(`
14347
+ `);
14348
+ var multiselect = (i3) => {
14349
+ const u4 = (t2, a3) => {
14350
+ const r2 = t2.label ?? String(t2.value);
14351
+ return a3 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m(r2, (o2) => styleText2(["strikethrough", "gray"], o2))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a3 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a3 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m(r2, (o2) => styleText2("dim", o2))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a3 === "cancelled" ? `${m(r2, (o2) => styleText2(["strikethrough", "dim"], o2))}` : a3 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a3 === "submitted" ? `${m(r2, (o2) => styleText2("dim", o2))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m(r2, (o2) => styleText2("dim", o2))}`;
14352
+ }, d = i3.required ?? true, v = i3.showInstructions ?? true;
14353
+ return new a2({
14354
+ options: i3.options,
14355
+ signal: i3.signal,
14356
+ input: i3.input,
14357
+ output: i3.output,
14358
+ initialValues: i3.initialValues,
14359
+ required: d,
14360
+ cursorAt: i3.cursorAt,
14361
+ validate(t2) {
14362
+ if (d && (t2 === void 0 || t2.length === 0))
14363
+ return `Please select at least one option.
14364
+ ${styleText2(
14365
+ "reset",
14366
+ styleText2(
14367
+ "dim",
14368
+ `Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2(
14369
+ "gray",
14370
+ styleText2("bgWhite", styleText2("inverse", " enter "))
14371
+ )} to submit`
14372
+ )
14373
+ )}`;
14374
+ },
14375
+ render() {
14376
+ const t2 = i3.withGuide ?? settings.withGuide, a3 = wrapTextWithPrefix(
14377
+ i3.output,
14378
+ i3.message,
14379
+ t2 ? `${symbolBar(this.state)} ` : "",
14380
+ `${symbol(this.state)} `
14381
+ ), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
14382
+ ` : ""}${a3}
14383
+ `, o2 = this.value ?? [], p = (n4, l2) => {
14384
+ if (n4.disabled)
14385
+ return u4(n4, "disabled");
14386
+ const s = o2.includes(n4.value);
14387
+ return l2 && s ? u4(n4, "active-selected") : s ? u4(n4, "selected") : u4(n4, l2 ? "active" : "inactive");
14388
+ };
14389
+ switch (this.state) {
14390
+ case "submit": {
14391
+ const n4 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u4(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l2 = wrapTextWithPrefix(
14392
+ i3.output,
14393
+ n4,
14394
+ t2 ? `${styleText2("gray", S_BAR)} ` : ""
14395
+ );
14396
+ return `${r2}${l2}`;
14397
+ }
14398
+ case "cancel": {
14399
+ const n4 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u4(s, "cancelled")).join(styleText2("dim", ", "));
14400
+ if (n4.trim() === "")
14401
+ return `${r2}${styleText2("gray", S_BAR)}`;
14402
+ const l2 = wrapTextWithPrefix(
14403
+ i3.output,
14404
+ n4,
14405
+ t2 ? `${styleText2("gray", S_BAR)} ` : ""
14406
+ );
14407
+ return `${r2}${l2}${t2 ? `
14408
+ ${styleText2("gray", S_BAR)}` : ""}`;
14409
+ }
14410
+ case "error": {
14411
+ const n4 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l2 = this.error.split(`
14412
+ `).map(
14413
+ ($2, C) => C === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $2)}` : ` ${$2}`
14414
+ ).join(`
14415
+ `), s = r2.split(`
14416
+ `).length, h3 = l2.split(`
14417
+ `).length + 1;
14418
+ return `${r2}${n4}${limitOptions({
14419
+ output: i3.output,
14420
+ options: this.options,
14421
+ cursor: this.cursor,
14422
+ maxItems: i3.maxItems,
14423
+ columnPadding: n4.length,
14424
+ rowPadding: s + h3,
14425
+ style: p
14426
+ }).join(`
14427
+ ${n4}`)}
14428
+ ${l2}
14429
+ `;
14430
+ }
14431
+ default: {
14432
+ const n4 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l2 = r2.split(`
14433
+ `).length, s = v ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h3 = s.join(`
14434
+ `), $2 = s.length + 1;
14435
+ return `${r2}${n4}${limitOptions({
14436
+ output: i3.output,
14437
+ options: this.options,
14438
+ cursor: this.cursor,
14439
+ maxItems: i3.maxItems,
14440
+ columnPadding: n4.length,
14441
+ rowPadding: l2 + $2,
14442
+ style: p
14443
+ }).join(`
14444
+ ${n4}`)}
14445
+ ${h3}
14446
+ `;
14447
+ }
14448
+ }
14449
+ }
14450
+ }).prompt();
14451
+ };
14452
+ var log = {
14453
+ message: (s = [], {
14454
+ symbol: e = styleText2("gray", S_BAR),
14455
+ secondarySymbol: r2 = styleText2("gray", S_BAR),
14456
+ output: m2 = process.stdout,
14457
+ spacing: l2 = 1,
14458
+ withGuide: c4
14459
+ } = {}) => {
14460
+ const t2 = [], o2 = c4 ?? settings.withGuide, f = o2 ? r2 : "", O = o2 ? `${e} ` : "", u4 = o2 ? `${r2} ` : "";
14461
+ for (let i3 = 0; i3 < l2; i3++)
14462
+ t2.push(f);
14463
+ const g = Array.isArray(s) ? s : s.split(`
14464
+ `);
14465
+ if (g.length > 0) {
14466
+ const [i3, ...y] = g;
14467
+ i3.length > 0 ? t2.push(`${O}${i3}`) : t2.push(o2 ? e : "");
14468
+ for (const p of y)
14469
+ p.length > 0 ? t2.push(`${u4}${p}`) : t2.push(o2 ? r2 : "");
14470
+ }
14471
+ m2.write(`${t2.join(`
14472
+ `)}
14473
+ `);
14474
+ },
14475
+ info: (s, e) => {
14476
+ log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
14477
+ },
14478
+ success: (s, e) => {
14479
+ log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
14480
+ },
14481
+ step: (s, e) => {
14482
+ log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
14483
+ },
14484
+ warn: (s, e) => {
14485
+ log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
14486
+ },
14487
+ /** alias for `log.warn()`. */
14488
+ warning: (s, e) => {
14489
+ log.warn(s, e);
14490
+ },
14491
+ error: (s, e) => {
14492
+ log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
14493
+ }
14494
+ };
14495
+ var cancel = (o2 = "", t2) => {
14496
+ const i3 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
14497
+ i3.write(`${e}${styleText2("red", o2)}
14498
+
14499
+ `);
14500
+ };
14501
+ var intro = (o2 = "", t2) => {
14502
+ const i3 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
14503
+ i3.write(`${e}${o2}
14504
+ `);
14505
+ };
14506
+ var outro = (o2 = "", t2) => {
14507
+ const i3 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
14508
+ ${styleText2("gray", S_BAR_END)} ` : "";
14509
+ i3.write(`${e}${o2}
14510
+
14511
+ `);
14512
+ };
14513
+ var W = (l2) => styleText2("magenta", l2);
14514
+ var spinner = ({
14515
+ indicator: l2 = "dots",
14516
+ onCancel: h3,
14517
+ output: n4 = process.stdout,
14518
+ cancelMessage: G,
14519
+ errorMessage: O,
14520
+ frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
14521
+ delay: F = unicode ? 80 : 120,
14522
+ signal: m2,
14523
+ ...I2
14524
+ } = {}) => {
14525
+ const u4 = isCI();
14526
+ let M, T, d = false, S = false, s = "", p, w = performance.now();
14527
+ const x = getColumns(n4), k = I2?.styleFrame ?? W, g = (e) => {
14528
+ const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
14529
+ S = e === 1, d && (a3(r2, e), S && typeof h3 == "function" && h3());
14530
+ }, f = () => g(2), i3 = () => g(1), A = () => {
14531
+ process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i3), process.on("SIGTERM", i3), process.on("exit", g), m2 && m2.addEventListener("abort", i3);
14532
+ }, H = () => {
14533
+ process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i3), process.removeListener("SIGTERM", i3), process.removeListener("exit", g), m2 && m2.removeEventListener("abort", i3);
14534
+ }, y = () => {
14535
+ if (p === void 0) return;
14536
+ u4 && n4.write(`
14537
+ `);
14538
+ const r2 = wrapAnsi(p, x, {
14539
+ hard: true,
14540
+ trim: false
14541
+ }).split(`
14542
+ `);
14543
+ 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());
14544
+ }, C = (e) => e.replace(/\.+$/, ""), _ = (e) => {
14545
+ const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o2 = Math.floor(r2 % 60);
14546
+ return t2 > 0 ? `[${t2}m ${o2}s]` : `[${o2}s]`;
14547
+ }, N = I2.withGuide ?? settings.withGuide, P = (e = "") => {
14548
+ d = true, M = block({ output: n4 }), s = C(e), w = performance.now(), N && n4.write(`${styleText2("gray", S_BAR)}
14549
+ `);
14550
+ let r2 = 0, t2 = 0;
14551
+ A(), T = setInterval(() => {
14552
+ if (u4 && s === p)
14553
+ return;
14554
+ y(), p = s;
14555
+ const o2 = k(E[r2]);
14556
+ let v;
14557
+ if (u4)
14558
+ v = `${o2} ${s}...`;
14559
+ else if (l2 === "timer")
14560
+ v = `${o2} ${s} ${_(w)}`;
14561
+ else {
14562
+ const B = ".".repeat(Math.floor(t2)).slice(0, 3);
14563
+ v = `${o2} ${s}${B}`;
14564
+ }
14565
+ const j = wrapAnsi(v, x, {
14566
+ hard: true,
14567
+ trim: false
14568
+ });
14569
+ n4.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
14570
+ }, F);
14571
+ }, a3 = (e = "", r2 = 0, t2 = false) => {
14572
+ if (!d) return;
14573
+ d = false, clearInterval(T), y();
14574
+ const o2 = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
14575
+ s = e ?? s, t2 || (l2 === "timer" ? n4.write(`${o2} ${s} ${_(w)}
14576
+ `) : n4.write(`${o2} ${s}
14577
+ `)), H(), M();
14578
+ };
14579
+ return {
14580
+ start: P,
14581
+ stop: (e = "") => a3(e, 0),
14582
+ message: (e = "") => {
14583
+ s = C(e ?? s);
14584
+ },
14585
+ cancel: (e = "") => a3(e, 1),
14586
+ error: (e = "") => a3(e, 2),
14587
+ clear: () => a3("", 0, true),
14588
+ get isCancelled() {
14589
+ return S;
14590
+ }
14591
+ };
14592
+ };
14593
+ var u3 = {
14594
+ light: unicodeOr("\u2500", "-"),
14595
+ heavy: unicodeOr("\u2501", "="),
14596
+ block: unicodeOr("\u2588", "#")
14597
+ };
14598
+ var SELECT_INSTRUCTIONS = [
14599
+ `${styleText2("dim", "\u2191/\u2193")} to navigate`,
14600
+ `${styleText2("dim", "Enter:")} confirm`
14601
+ ];
14602
+ var c3 = (t2, o2) => t2.includes(`
14603
+ `) ? t2.split(`
14604
+ `).map((d) => o2(d)).join(`
14605
+ `) : o2(t2);
14606
+ var select2 = (t2) => {
14607
+ const o2 = (n4, m2) => {
14608
+ if (n4 === void 0)
14609
+ return "";
14610
+ const s = n4.label ?? String(n4.value);
14611
+ switch (m2) {
14612
+ case "disabled":
14613
+ return `${styleText2("gray", S_RADIO_INACTIVE)} ${c3(s, (i3) => styleText2("gray", i3))}${n4.hint ? ` ${styleText2("dim", `(${n4.hint ?? "disabled"})`)}` : ""}`;
14614
+ case "selected":
14615
+ return `${c3(s, (i3) => styleText2("dim", i3))}`;
14616
+ case "active":
14617
+ return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n4.hint ? ` ${styleText2("dim", `(${n4.hint})`)}` : ""}`;
14618
+ case "cancelled":
14619
+ return `${c3(s, (i3) => styleText2(["strikethrough", "dim"], i3))}`;
14620
+ default:
14621
+ return `${styleText2("dim", S_RADIO_INACTIVE)} ${c3(s, (i3) => styleText2("dim", i3))}`;
14622
+ }
14623
+ }, d = t2.showInstructions ?? true;
14624
+ return new n$1({
14625
+ options: t2.options,
14626
+ signal: t2.signal,
14627
+ input: t2.input,
14628
+ output: t2.output,
14629
+ initialValue: t2.initialValue,
14630
+ render() {
14631
+ const n4 = t2.withGuide ?? settings.withGuide, m2 = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i3 = wrapTextWithPrefix(
14632
+ t2.output,
14633
+ t2.message,
14634
+ s,
14635
+ m2
14636
+ ), u4 = `${n4 ? `${styleText2("gray", S_BAR)}
14637
+ ` : ""}${i3}
14638
+ `;
14639
+ switch (this.state) {
14640
+ case "submit": {
14641
+ const r2 = n4 ? `${styleText2("gray", S_BAR)} ` : "", a3 = wrapTextWithPrefix(
14642
+ t2.output,
14643
+ o2(this.options[this.cursor], "selected"),
14644
+ r2
14645
+ );
14646
+ return `${u4}${a3}`;
14647
+ }
14648
+ case "cancel": {
14649
+ const r2 = n4 ? `${styleText2("gray", S_BAR)} ` : "", a3 = wrapTextWithPrefix(
14650
+ t2.output,
14651
+ o2(this.options[this.cursor], "cancelled"),
14652
+ r2
14653
+ );
14654
+ return `${u4}${a3}${n4 ? `
14655
+ ${styleText2("gray", S_BAR)}` : ""}`;
14656
+ }
14657
+ default: {
14658
+ const r2 = n4 ? `${styleText2("cyan", S_BAR)} ` : "", a3 = u4.split(`
14659
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n4) : n4 ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
14660
+ `), f = p.length + 1;
14661
+ return `${u4}${r2}${limitOptions({
14662
+ output: t2.output,
14663
+ cursor: this.cursor,
14664
+ options: this.options,
14665
+ maxItems: t2.maxItems,
14666
+ columnPadding: r2.length,
14667
+ rowPadding: a3 + f,
14668
+ style: (g, x) => o2(g, g.disabled ? "disabled" : x ? "active" : "inactive")
14669
+ }).join(`
14670
+ ${r2}`)}
14671
+ ${b}
14672
+ `;
14673
+ }
14674
+ }
14675
+ }
14676
+ }).prompt();
14677
+ };
14678
+ var i2 = `${styleText2("gray", S_BAR)} `;
14679
+ var text = (e) => new n3({
14680
+ validate: e.validate,
14681
+ placeholder: e.placeholder,
14682
+ defaultValue: e.defaultValue,
14683
+ initialValue: e.initialValue,
14684
+ output: e.output,
14685
+ signal: e.signal,
14686
+ input: e.input,
14687
+ render() {
14688
+ const i3 = e?.withGuide ?? settings.withGuide, s = `${`${i3 ? `${styleText2("gray", S_BAR)}
14689
+ ` : ""}${symbol(this.state)} `}${e.message}
14690
+ `, c4 = e.placeholder && e.placeholder.length > 0 ? (
14691
+ // biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
14692
+ styleText2("inverse", e.placeholder[0]) + styleText2("dim", e.placeholder.slice(1))
14693
+ ) : styleText2(["inverse", "hidden"], "_"), o2 = this.userInput ? this.userInputWithCursor : c4, l2 = this.value ?? "";
14694
+ switch (this.state) {
14695
+ case "error": {
14696
+ const n4 = this.error ? ` ${styleText2("yellow", this.error)}` : "", r2 = i3 ? `${styleText2("yellow", S_BAR)} ` : "", d = i3 ? styleText2("yellow", S_BAR_END) : "";
14697
+ return `${s.trim()}
14698
+ ${r2}${o2}
14699
+ ${d}${n4}
14700
+ `;
14701
+ }
14702
+ case "submit": {
14703
+ const n4 = l2 ? ` ${styleText2("dim", l2)}` : "", r2 = i3 ? styleText2("gray", S_BAR) : "";
14704
+ return `${s}${r2}${n4}`;
14705
+ }
14706
+ case "cancel": {
14707
+ const n4 = l2 ? ` ${styleText2(["strikethrough", "dim"], l2)}` : "", r2 = i3 ? styleText2("gray", S_BAR) : "";
14708
+ return `${s}${r2}${n4}${l2.trim() ? `
14709
+ ${r2}` : ""}`;
14710
+ }
14711
+ default: {
14712
+ const n4 = i3 ? `${styleText2("cyan", S_BAR)} ` : "", r2 = i3 ? styleText2("cyan", S_BAR_END) : "";
14713
+ return `${s}${n4}${o2}
14714
+ ${r2}
14715
+ `;
14716
+ }
14717
+ }
14718
+ }
14719
+ }).prompt();
14720
+
14721
+ // packages/cli/src/wizard.ts
14722
+ import { mkdtemp as mkdtemp2, rm as rm3 } from "node:fs/promises";
14723
+ import { tmpdir } from "node:os";
14724
+ import { join as join6, resolve as resolve8 } from "node:path";
14725
+ var supportedRuntimes = [
14726
+ "oh-my-pi",
14727
+ "opencode",
14728
+ "pi",
14729
+ "claude-code",
14730
+ "codex",
14731
+ "antigravity",
14732
+ "dcode"
14733
+ ];
14734
+ function unwrap(value) {
14735
+ if (isCancel(value)) {
14736
+ cancel("Setup cancelled.");
14737
+ process.exitCode = 130;
14738
+ throw new Error("cancelled");
14739
+ }
14740
+ return value;
14741
+ }
14742
+ async function runInstallWizard() {
14743
+ intro("Portable Capabilities setup");
14744
+ let temporaryRoot = "";
14745
+ try {
14746
+ const manifest = String(
14747
+ unwrap(
14748
+ await text({
14749
+ message: "Canonical system manifest",
14750
+ placeholder: "/absolute/path/to/system.yaml",
14751
+ validate: (value) => value?.trim() ? void 0 : "System manifest is required"
14752
+ })
14753
+ )
14754
+ );
14755
+ const target = String(
14756
+ unwrap(
14757
+ await text({
14758
+ message: "Project directory to install into",
14759
+ initialValue: process.cwd(),
14760
+ validate: (value) => value?.trim() ? void 0 : "Target directory is required"
14761
+ })
14762
+ )
14763
+ );
14764
+ const runtime = unwrap(
14765
+ await select2({
14766
+ message: "Choose a runtime",
14767
+ options: supportedRuntimes.map((value) => ({ value, label: value }))
14768
+ })
14769
+ );
14770
+ const spinner2 = spinner();
14771
+ spinner2.start("Reading available capabilities");
14772
+ const system = await resolveSystem(resolve8(manifest));
14773
+ const availableCapabilities = system.roles.map((role) => role.id);
14774
+ spinner2.stop(
14775
+ `Found ${availableCapabilities.length} capability${availableCapabilities.length === 1 ? "" : "ies"}`
14776
+ );
14777
+ const capabilityIds = unwrap(
14778
+ await multiselect({
14779
+ message: "Choose capabilities to install",
14780
+ options: availableCapabilities.map((value) => ({ value, label: value })),
14781
+ required: true
14782
+ })
14783
+ );
14784
+ const dryRun = unwrap(
14785
+ await confirm({
14786
+ message: "Preview changes without writing?",
14787
+ initialValue: false
14788
+ })
14789
+ );
14790
+ temporaryRoot = await mkdtemp2(join6(tmpdir(), "portable-capabilities-wizard-"));
14791
+ const bundleRoot = join6(temporaryRoot, `${runtime}-bundle`);
14792
+ spinner2.start("Building runtime bundle");
14793
+ const build = await buildProduction(system, {
14794
+ targets: [runtime],
14795
+ roles: capabilityIds
14796
+ });
14797
+ await writeFileSetAtomically(bundleRoot, build.files);
14798
+ spinner2.stop("Runtime bundle built");
14799
+ spinner2.start(dryRun ? "Planning installation" : "Installing capabilities");
14800
+ const result2 = await installPackage({
14801
+ sourceRoot: bundleRoot,
14802
+ targetRoot: resolve8(target),
14803
+ runtimeId: runtime,
14804
+ packageVersion: cliVersion,
14805
+ capabilityIds,
14806
+ dryRun
14807
+ });
14808
+ spinner2.stop(result2.ok ? "Installation complete" : "Installation failed");
14809
+ if (!result2.ok) {
14810
+ for (const diagnostic of result2.diagnostics) log.error(diagnostic);
14811
+ process.exitCode = 4;
14812
+ return;
14813
+ }
14814
+ if (result2.installed.length) log.success(`Installed ${result2.installed.length} file(s).`);
14815
+ if (result2.preserved.length) log.info(`Preserved ${result2.preserved.length} file(s).`);
14816
+ outro(dryRun ? "Preview complete." : "Project is ready.");
14817
+ } catch (error) {
14818
+ if (error.message !== "cancelled") throw error;
14819
+ } finally {
14820
+ if (temporaryRoot) await rm3(temporaryRoot, { recursive: true, force: true });
14821
+ }
14822
+ }
14823
+
13344
14824
  // packages/cli/src/program.ts
13345
14825
  function formatOf(options) {
13346
14826
  return options.format === "json" ? "json" : "human";
@@ -13365,7 +14845,11 @@ function writeLifecycleResult(command, lifecycle, options) {
13365
14845
  if (!lifecycle.ok) process.exitCode = 4;
13366
14846
  }
13367
14847
  function createProgram() {
13368
- const program2 = new Command().name("portable-capabilities").version(cliVersion).description("Portable analytical capability compiler");
14848
+ const program2 = new Command().name("portable-capabilities").version(cliVersion).description("Portable analytical capability compiler").action(runInstallWizard);
14849
+ program2.command("wizard").description("Guided capability installation").action(runInstallWizard);
14850
+ program2.command("runtimes").description("List supported runtime IDs").action(() => {
14851
+ for (const runtime of supportedRuntimes) console.log(runtime);
14852
+ });
13369
14853
  common2(
13370
14854
  program2.command("build").argument("<manifest>", "system manifest").option("--output <dir>").option("--target <ids...>").option("--role <ids...>")
13371
14855
  ).action(async (manifest, options) => {