sandbox 2.2.0 → 2.4.0

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.
@@ -7,7 +7,7 @@ import process$1 from "node:process";
7
7
  import os, { tmpdir } from "node:os";
8
8
  import tty, { isatty } from "node:tty";
9
9
  import createDebugger from "debug";
10
- import { promisify } from "node:util";
10
+ import { promisify, stripVTControlCharacters } from "node:util";
11
11
  import { Buffer as Buffer$1 } from "node:buffer";
12
12
  import path from "node:path";
13
13
  import { fileURLToPath } from "node:url";
@@ -542,8 +542,8 @@ var require_didYouMean_1_2_1 = /* @__PURE__ */ __commonJS$1({ "../../node_module
542
542
  }) });
543
543
 
544
544
  //#endregion
545
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/Result.js
546
- var require_Result = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/Result.js": ((exports) => {
545
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/Result.js
546
+ var require_Result = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/Result.js": ((exports) => {
547
547
  Object.defineProperty(exports, "__esModule", { value: true });
548
548
  exports.ok = ok;
549
549
  exports.err = err;
@@ -590,8 +590,8 @@ var require_Result = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cm
590
590
  }) });
591
591
 
592
592
  //#endregion
593
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/effects.js
594
- var require_effects = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/effects.js": ((exports) => {
593
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/effects.js
594
+ var require_effects = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/effects.js": ((exports) => {
595
595
  /**
596
596
  * "Effects" are custom exceptions that can do stuff.
597
597
  * The concept comes from React, where they throw a `Promise` to provide the ability to write
@@ -642,8 +642,8 @@ var require_effects = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/c
642
642
  }) });
643
643
 
644
644
  //#endregion
645
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/newparser/findOption.js
646
- var require_findOption = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/newparser/findOption.js": ((exports) => {
645
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/newparser/findOption.js
646
+ var require_findOption = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/newparser/findOption.js": ((exports) => {
647
647
  Object.defineProperty(exports, "__esModule", { value: true });
648
648
  exports.findOption = findOption;
649
649
  /**
@@ -668,8 +668,8 @@ var require_findOption = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
668
668
  }) });
669
669
 
670
670
  //#endregion
671
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/from.js
672
- var require_from = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/from.js": ((exports) => {
671
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/from.js
672
+ var require_from = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/from.js": ((exports) => {
673
673
  Object.defineProperty(exports, "__esModule", { value: true });
674
674
  exports.identity = identity;
675
675
  /**
@@ -683,8 +683,8 @@ var require_from = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
683
683
  }) });
684
684
 
685
685
  //#endregion
686
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/type.js
687
- var require_type = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/type.js": ((exports) => {
686
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/type.js
687
+ var require_type = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/type.js": ((exports) => {
688
688
  Object.defineProperty(exports, "__esModule", { value: true });
689
689
  exports.identity = void 0;
690
690
  exports.typeDef = typeDef;
@@ -736,8 +736,8 @@ var require_type = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
736
736
  }) });
737
737
 
738
738
  //#endregion
739
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/types.js
740
- var require_types = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/types.js": ((exports) => {
739
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/types.js
740
+ var require_types = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/types.js": ((exports) => {
741
741
  Object.defineProperty(exports, "__esModule", { value: true });
742
742
  exports.boolean = exports.string = exports.number = void 0;
743
743
  exports.optional = optional;
@@ -799,8 +799,8 @@ var require_types = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd
799
799
  }) });
800
800
 
801
801
  //#endregion
802
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/flag.js
803
- var require_flag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/flag.js": ((exports) => {
802
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/flag.js
803
+ var require_flag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/flag.js": ((exports) => {
804
804
  var __createBinding$11 = exports && exports.__createBinding || (Object.create ? (function(o, m$1, k, k2) {
805
805
  if (k2 === void 0) k2 = k;
806
806
  var desc = Object.getOwnPropertyDescriptor(m$1, k);
@@ -974,8 +974,8 @@ var require_flag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
974
974
  }) });
975
975
 
976
976
  //#endregion
977
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/circuitbreaker.js
978
- var require_circuitbreaker = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/circuitbreaker.js": ((exports) => {
977
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/circuitbreaker.js
978
+ var require_circuitbreaker = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/circuitbreaker.js": ((exports) => {
979
979
  var __createBinding$10 = exports && exports.__createBinding || (Object.create ? (function(o, m$1, k, k2) {
980
980
  if (k2 === void 0) k2 = k;
981
981
  var desc = Object.getOwnPropertyDescriptor(m$1, k);
@@ -1095,8 +1095,208 @@ var require_circuitbreaker = /* @__PURE__ */ __commonJS$1({ "../../node_modules/
1095
1095
  }) });
1096
1096
 
1097
1097
  //#endregion
1098
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/positional.js
1099
- var require_positional = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/positional.js": ((exports) => {
1098
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/utils.js
1099
+ var require_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/utils.js": ((exports) => {
1100
+ var __importDefault$8 = exports && exports.__importDefault || function(mod) {
1101
+ return mod && mod.__esModule ? mod : { "default": mod };
1102
+ };
1103
+ Object.defineProperty(exports, "__esModule", { value: true });
1104
+ exports.padNoAnsi = padNoAnsi;
1105
+ exports.groupBy = groupBy;
1106
+ exports.entries = entries;
1107
+ exports.enumerate = enumerate;
1108
+ exports.flatMap = flatMap$1;
1109
+ exports.flatten = flatten;
1110
+ const strip_ansi_1$1 = __importDefault$8((init_strip_ansi(), __toCommonJS$3(strip_ansi_exports)));
1111
+ /**
1112
+ * @ignore
1113
+ */
1114
+ function padNoAnsi(str, length, place) {
1115
+ const noAnsiStr = (0, strip_ansi_1$1.default)(str);
1116
+ if (length < noAnsiStr.length) return str;
1117
+ const pad = Array(length - noAnsiStr.length + 1).join(" ");
1118
+ if (place === "end") return str + pad;
1119
+ return pad + str;
1120
+ }
1121
+ /**
1122
+ * Group an array by a function that returns the key
1123
+ *
1124
+ * @ignore
1125
+ */
1126
+ function groupBy(objs, f) {
1127
+ var _a;
1128
+ const result = {};
1129
+ for (const obj of objs) {
1130
+ const key = f(obj);
1131
+ result[key] = (_a = result[key]) !== null && _a !== void 0 ? _a : [];
1132
+ result[key].push(obj);
1133
+ }
1134
+ return result;
1135
+ }
1136
+ /**
1137
+ * A better typed version of `Object.entries`
1138
+ *
1139
+ * @ignore
1140
+ */
1141
+ function entries(obj) {
1142
+ return Object.entries(obj);
1143
+ }
1144
+ /**
1145
+ * Enumerate over a list, to get a pair of [index, value]
1146
+ *
1147
+ * @ignore
1148
+ */
1149
+ function* enumerate(arr) {
1150
+ for (let i = 0; i < arr.length; i++) yield [i, arr[i]];
1151
+ }
1152
+ /**
1153
+ * Array#flatMap polyfill
1154
+ *
1155
+ * @ignore
1156
+ */
1157
+ function flatMap$1(xs, fn) {
1158
+ const results = [];
1159
+ for (const x of xs) results.push(...fn(x));
1160
+ return results;
1161
+ }
1162
+ /**
1163
+ * Flatten an array
1164
+ *
1165
+ * @ignore
1166
+ */
1167
+ function flatten(xs) {
1168
+ const results = [];
1169
+ for (const x of xs) results.push(...x);
1170
+ return results;
1171
+ }
1172
+ }) });
1173
+
1174
+ //#endregion
1175
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/helpFormatter.js
1176
+ var require_helpFormatter = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/helpFormatter.js": ((exports) => {
1177
+ var __importDefault$7 = exports && exports.__importDefault || function(mod) {
1178
+ return mod && mod.__esModule ? mod : { "default": mod };
1179
+ };
1180
+ Object.defineProperty(exports, "__esModule", { value: true });
1181
+ exports.defaultHelpFormatter = void 0;
1182
+ exports.setDefaultHelpFormatter = setDefaultHelpFormatter;
1183
+ exports.resetHelpFormatter = resetHelpFormatter;
1184
+ exports.getHelpFormatter = getHelpFormatter;
1185
+ const chalk_1$5 = __importDefault$7((init_source(), __toCommonJS$3(source_exports)));
1186
+ const utils_1$3 = require_utils();
1187
+ let currentFormatter = null;
1188
+ /**
1189
+ * Set a custom help formatter to be used for all commands.
1190
+ *
1191
+ * @example
1192
+ * ```ts
1193
+ * import { setDefaultHelpFormatter } from "cmd-ts";
1194
+ *
1195
+ * setDefaultHelpFormatter({
1196
+ * formatCommand(data, context) {
1197
+ * return `My CLI ${data.version}\n${data.description}`;
1198
+ * },
1199
+ * formatSubcommands(data, context) {
1200
+ * return `Commands: ${data.commands.map(c => c.name).join(", ")}`;
1201
+ * },
1202
+ * });
1203
+ * ```
1204
+ */
1205
+ function setDefaultHelpFormatter(formatter) {
1206
+ currentFormatter = formatter;
1207
+ }
1208
+ /**
1209
+ * Reset the help formatter to the default.
1210
+ * Useful for testing.
1211
+ */
1212
+ function resetHelpFormatter() {
1213
+ currentFormatter = null;
1214
+ }
1215
+ /**
1216
+ * Get the current help formatter (custom or default).
1217
+ * @internal
1218
+ */
1219
+ function getHelpFormatter() {
1220
+ return currentFormatter !== null && currentFormatter !== void 0 ? currentFormatter : exports.defaultHelpFormatter;
1221
+ }
1222
+ /**
1223
+ * The default help formatter that matches cmd-ts's original output style.
1224
+ */
1225
+ exports.defaultHelpFormatter = {
1226
+ formatCommand(data, _context) {
1227
+ const lines = [];
1228
+ let name = data.path.length > 0 ? data.path.join(" ") : data.name;
1229
+ name = chalk_1$5.default.bold(name);
1230
+ if (data.version) name += ` ${chalk_1$5.default.dim(data.version)}`;
1231
+ lines.push(name);
1232
+ if (data.description) lines.push(chalk_1$5.default.dim("> ") + data.description);
1233
+ const usageBreakdown = (0, utils_1$3.groupBy)(data.helpTopics, (x) => x.category);
1234
+ for (const [category, helpTopics] of (0, utils_1$3.entries)(usageBreakdown)) {
1235
+ lines.push("");
1236
+ lines.push(`${category.toUpperCase()}:`);
1237
+ const widestUsage = helpTopics.reduce((len, curr) => {
1238
+ return Math.max(len, curr.usage.length);
1239
+ }, 0);
1240
+ for (const helpTopic of helpTopics) {
1241
+ let line = "";
1242
+ line += ` ${(0, utils_1$3.padNoAnsi)(helpTopic.usage, widestUsage, "end")}`;
1243
+ line += " - ";
1244
+ line += helpTopic.description;
1245
+ for (const defaultValue of helpTopic.defaults) line += chalk_1$5.default.dim(` [${defaultValue}]`);
1246
+ lines.push(line);
1247
+ }
1248
+ }
1249
+ if (data.examples && data.examples.length > 0) {
1250
+ lines.push("");
1251
+ lines.push("EXAMPLES:");
1252
+ for (const example of data.examples) {
1253
+ lines.push("");
1254
+ lines.push(` ${example.description}`);
1255
+ lines.push(chalk_1$5.default.dim(` $ ${example.command}`));
1256
+ }
1257
+ }
1258
+ return lines.join("\n");
1259
+ },
1260
+ formatSubcommands(data, _context) {
1261
+ var _a, _b;
1262
+ const lines = [];
1263
+ const argsSoFar = data.path.length > 0 ? data.path.join(" ") : data.name;
1264
+ lines.push(chalk_1$5.default.bold(argsSoFar + chalk_1$5.default.italic(" <subcommand>")));
1265
+ if (data.description) lines.push(chalk_1$5.default.dim("> ") + data.description);
1266
+ lines.push("");
1267
+ lines.push(`where ${chalk_1$5.default.italic("<subcommand>")} can be one of:`);
1268
+ lines.push("");
1269
+ for (const cmd of data.commands) {
1270
+ let description = (_a = cmd.description) !== null && _a !== void 0 ? _a : "";
1271
+ description = description && ` - ${description} `;
1272
+ if ((_b = cmd.aliases) === null || _b === void 0 ? void 0 : _b.length) {
1273
+ const aliasTxt = cmd.aliases.length === 1 ? "alias" : "aliases";
1274
+ const aliases = cmd.aliases.join(", ");
1275
+ description += chalk_1$5.default.dim(`[${aliasTxt}: ${aliases}]`);
1276
+ }
1277
+ const row = chalk_1$5.default.dim("- ") + cmd.name + description;
1278
+ lines.push(row.trim());
1279
+ }
1280
+ const helpCommand = chalk_1$5.default.yellow(`${argsSoFar} <subcommand> --help`);
1281
+ lines.push("");
1282
+ lines.push(chalk_1$5.default.dim(`For more help, try running \`${helpCommand}\``));
1283
+ if (data.examples && data.examples.length > 0) {
1284
+ lines.push("");
1285
+ lines.push("EXAMPLES:");
1286
+ for (const example of data.examples) {
1287
+ lines.push("");
1288
+ lines.push(` ${example.description}`);
1289
+ lines.push(chalk_1$5.default.dim(` $ ${example.command}`));
1290
+ }
1291
+ }
1292
+ return lines.join("\n");
1293
+ }
1294
+ };
1295
+ }) });
1296
+
1297
+ //#endregion
1298
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/positional.js
1299
+ var require_positional = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/positional.js": ((exports) => {
1100
1300
  var __createBinding$9 = exports && exports.__createBinding || (Object.create ? (function(o, m$1, k, k2) {
1101
1301
  if (k2 === void 0) k2 = k;
1102
1302
  var desc = Object.getOwnPropertyDescriptor(m$1, k);
@@ -1138,12 +1338,12 @@ var require_positional = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
1138
1338
  return result;
1139
1339
  };
1140
1340
  })();
1141
- var __importDefault$8 = exports && exports.__importDefault || function(mod) {
1341
+ var __importDefault$6 = exports && exports.__importDefault || function(mod) {
1142
1342
  return mod && mod.__esModule ? mod : { "default": mod };
1143
1343
  };
1144
1344
  Object.defineProperty(exports, "__esModule", { value: true });
1145
1345
  exports.positional = positional;
1146
- const chalk_1$5 = __importDefault$8((init_source(), __toCommonJS$3(source_exports)));
1346
+ const chalk_1$4 = __importDefault$6((init_source(), __toCommonJS$3(source_exports)));
1147
1347
  const Result$8 = __importStar$8(require_Result());
1148
1348
  const types_1$2 = require_types();
1149
1349
  function fullPositional(config$1) {
@@ -1157,7 +1357,7 @@ var require_positional = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
1157
1357
  const defaultValueFn = (_a$1 = config$1.defaultValue) !== null && _a$1 !== void 0 ? _a$1 : config$1.type.defaultValue;
1158
1358
  if (defaultValueFn) try {
1159
1359
  const defaultValue = defaultValueFn();
1160
- if ((_b$1 = config$1.defaultValueIsSerializable) !== null && _b$1 !== void 0 ? _b$1 : config$1.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$5.default.italic(defaultValue)}`);
1360
+ if ((_b$1 = config$1.defaultValueIsSerializable) !== null && _b$1 !== void 0 ? _b$1 : config$1.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$4.default.italic(defaultValue)}`);
1161
1361
  else defaults.push("optional");
1162
1362
  } catch (e) {}
1163
1363
  return [{
@@ -1199,8 +1399,8 @@ var require_positional = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
1199
1399
  }) });
1200
1400
 
1201
1401
  //#endregion
1202
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/subcommands.js
1203
- var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/subcommands.js": ((exports) => {
1402
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/subcommands.js
1403
+ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/subcommands.js": ((exports) => {
1204
1404
  var __createBinding$8 = exports && exports.__createBinding || (Object.create ? (function(o, m$1, k, k2) {
1205
1405
  if (k2 === void 0) k2 = k;
1206
1406
  var desc = Object.getOwnPropertyDescriptor(m$1, k);
@@ -1242,15 +1442,16 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
1242
1442
  return result;
1243
1443
  };
1244
1444
  })();
1245
- var __importDefault$7 = exports && exports.__importDefault || function(mod) {
1445
+ var __importDefault$5 = exports && exports.__importDefault || function(mod) {
1246
1446
  return mod && mod.__esModule ? mod : { "default": mod };
1247
1447
  };
1248
1448
  Object.defineProperty(exports, "__esModule", { value: true });
1249
1449
  exports.subcommands = subcommands$2;
1250
- const chalk_1$4 = __importDefault$7((init_source(), __toCommonJS$3(source_exports)));
1251
- const didyoumean_1 = __importDefault$7(require_didYouMean_1_2_1());
1450
+ const chalk_1$3 = __importDefault$5((init_source(), __toCommonJS$3(source_exports)));
1451
+ const didyoumean_1 = __importDefault$5(require_didYouMean_1_2_1());
1252
1452
  const Result$7 = __importStar$7(require_Result());
1253
1453
  const circuitbreaker_1$1 = require_circuitbreaker();
1454
+ const helpFormatter_1$2 = require_helpFormatter();
1254
1455
  const positional_1$1 = require_positional();
1255
1456
  /**
1256
1457
  * Combine multiple `command`s into one
@@ -1271,10 +1472,10 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
1271
1472
  const cmd = commands.find((x) => x.names.includes(str));
1272
1473
  if (cmd) return cmd.cmdName;
1273
1474
  let errorMessage = "Not a valid subcommand name";
1274
- const closeOptions = (0, didyoumean_1.default)(str, flatMap$1(commands, (x) => x.names));
1475
+ const closeOptions = (0, didyoumean_1.default)(str, flatMap(commands, (x) => x.names));
1275
1476
  if (closeOptions) {
1276
1477
  const option$1 = Array.isArray(closeOptions) ? closeOptions[0] : closeOptions;
1277
- errorMessage += `\nDid you mean ${chalk_1$4.default.italic(option$1)}?`;
1478
+ errorMessage += `\nDid you mean ${chalk_1$3.default.italic(option$1)}?`;
1278
1479
  }
1279
1480
  throw new Error(errorMessage);
1280
1481
  } }
@@ -1301,30 +1502,24 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
1301
1502
  circuitbreaker.register(opts);
1302
1503
  },
1303
1504
  printHelp(context) {
1304
- var _a, _b, _c, _d;
1305
- const lines = [];
1306
- const argsSoFar = (_b = (_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : "cli";
1307
- lines.push(chalk_1$4.default.bold(argsSoFar + chalk_1$4.default.italic(" <subcommand>")));
1308
- if (config$1.description) lines.push(chalk_1$4.default.dim("> ") + config$1.description);
1309
- lines.push("");
1310
- lines.push(`where ${chalk_1$4.default.italic("<subcommand>")} can be one of:`);
1311
- lines.push("");
1312
- for (const key of Object.keys(config$1.cmds)) {
1313
- const cmd = config$1.cmds[key];
1314
- let description = (_c = cmd.description) !== null && _c !== void 0 ? _c : "";
1315
- description = description && ` - ${description} `;
1316
- if ((_d = cmd.aliases) === null || _d === void 0 ? void 0 : _d.length) {
1317
- const aliasTxt = cmd.aliases.length === 1 ? "alias" : "aliases";
1318
- const aliases = cmd.aliases.join(", ");
1319
- description += chalk_1$4.default.dim(`[${aliasTxt}: ${aliases}]`);
1320
- }
1321
- const row = chalk_1$4.default.dim("- ") + key + description;
1322
- lines.push(row.trim());
1323
- }
1324
- const helpCommand = chalk_1$4.default.yellow(`${argsSoFar} <subcommand> --help`);
1325
- lines.push("");
1326
- lines.push(chalk_1$4.default.dim(`For more help, try running \`${helpCommand}\``));
1327
- return lines.join("\n");
1505
+ var _a;
1506
+ const data = {
1507
+ name: config$1.name,
1508
+ path: (_a = context.hotPath) !== null && _a !== void 0 ? _a : [config$1.name],
1509
+ version: config$1.version,
1510
+ description: config$1.description,
1511
+ commands: Object.entries(config$1.cmds).map(([name, cmd]) => {
1512
+ var _a$1, _b;
1513
+ return {
1514
+ name,
1515
+ description: cmd.description,
1516
+ aliases: cmd.aliases,
1517
+ helpTopics: (_b = (_a$1 = cmd.helpTopics) === null || _a$1 === void 0 ? void 0 : _a$1.call(cmd)) !== null && _b !== void 0 ? _b : []
1518
+ };
1519
+ }),
1520
+ examples: config$1.examples
1521
+ };
1522
+ return (0, helpFormatter_1$2.getHelpFormatter)().formatSubcommands(data, context);
1328
1523
  },
1329
1524
  async parse(context) {
1330
1525
  var _a;
@@ -1376,7 +1571,7 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
1376
1571
  }
1377
1572
  };
1378
1573
  }
1379
- function flatMap$1(array$1, f) {
1574
+ function flatMap(array$1, f) {
1380
1575
  const rs = [];
1381
1576
  for (const item of array$1) rs.push(...f(item));
1382
1577
  return rs;
@@ -1384,8 +1579,8 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
1384
1579
  }) });
1385
1580
 
1386
1581
  //#endregion
1387
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/binary.js
1388
- var require_binary = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/binary.js": ((exports) => {
1582
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/binary.js
1583
+ var require_binary = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/binary.js": ((exports) => {
1389
1584
  Object.defineProperty(exports, "__esModule", { value: true });
1390
1585
  exports.binary = binary;
1391
1586
  /**
@@ -1410,85 +1605,8 @@ var require_binary = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cm
1410
1605
  }) });
1411
1606
 
1412
1607
  //#endregion
1413
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/utils.js
1414
- var require_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/utils.js": ((exports) => {
1415
- var __importDefault$6 = exports && exports.__importDefault || function(mod) {
1416
- return mod && mod.__esModule ? mod : { "default": mod };
1417
- };
1418
- Object.defineProperty(exports, "__esModule", { value: true });
1419
- exports.padNoAnsi = padNoAnsi;
1420
- exports.groupBy = groupBy;
1421
- exports.entries = entries;
1422
- exports.enumerate = enumerate;
1423
- exports.flatMap = flatMap;
1424
- exports.flatten = flatten;
1425
- const strip_ansi_1$1 = __importDefault$6((init_strip_ansi(), __toCommonJS$3(strip_ansi_exports)));
1426
- /**
1427
- * @ignore
1428
- */
1429
- function padNoAnsi(str, length, place) {
1430
- const noAnsiStr = (0, strip_ansi_1$1.default)(str);
1431
- if (length < noAnsiStr.length) return str;
1432
- const pad = Array(length - noAnsiStr.length + 1).join(" ");
1433
- if (place === "end") return str + pad;
1434
- return pad + str;
1435
- }
1436
- /**
1437
- * Group an array by a function that returns the key
1438
- *
1439
- * @ignore
1440
- */
1441
- function groupBy(objs, f) {
1442
- var _a;
1443
- const result = {};
1444
- for (const obj of objs) {
1445
- const key = f(obj);
1446
- result[key] = (_a = result[key]) !== null && _a !== void 0 ? _a : [];
1447
- result[key].push(obj);
1448
- }
1449
- return result;
1450
- }
1451
- /**
1452
- * A better typed version of `Object.entries`
1453
- *
1454
- * @ignore
1455
- */
1456
- function entries(obj) {
1457
- return Object.entries(obj);
1458
- }
1459
- /**
1460
- * Enumerate over a list, to get a pair of [index, value]
1461
- *
1462
- * @ignore
1463
- */
1464
- function* enumerate(arr) {
1465
- for (let i = 0; i < arr.length; i++) yield [i, arr[i]];
1466
- }
1467
- /**
1468
- * Array#flatMap polyfill
1469
- *
1470
- * @ignore
1471
- */
1472
- function flatMap(xs, fn) {
1473
- const results = [];
1474
- for (const x of xs) results.push(...fn(x));
1475
- return results;
1476
- }
1477
- /**
1478
- * Flatten an array
1479
- *
1480
- * @ignore
1481
- */
1482
- function flatten(xs) {
1483
- const results = [];
1484
- for (const x of xs) results.push(...x);
1485
- return results;
1486
- }
1487
- }) });
1488
-
1489
- //#endregion
1490
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/command.js
1491
- var require_command = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/command.js": ((exports) => {
1608
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/command.js
1609
+ var require_command = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/command.js": ((exports) => {
1492
1610
  var __createBinding$7 = exports && exports.__createBinding || (Object.create ? (function(o, m$1, k, k2) {
1493
1611
  if (k2 === void 0) k2 = k;
1494
1612
  var desc = Object.getOwnPropertyDescriptor(m$1, k);
@@ -1530,14 +1648,11 @@ var require_command = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/c
1530
1648
  return result;
1531
1649
  };
1532
1650
  })();
1533
- var __importDefault$5 = exports && exports.__importDefault || function(mod) {
1534
- return mod && mod.__esModule ? mod : { "default": mod };
1535
- };
1536
1651
  Object.defineProperty(exports, "__esModule", { value: true });
1537
1652
  exports.command = command;
1538
- const chalk_1$3 = __importDefault$5((init_source(), __toCommonJS$3(source_exports)));
1539
1653
  const Result$6 = __importStar$6(require_Result());
1540
1654
  const circuitbreaker_1 = require_circuitbreaker();
1655
+ const helpFormatter_1$1 = require_helpFormatter();
1541
1656
  const utils_1$2 = require_utils();
1542
1657
  /**
1543
1658
  * A command line utility.
@@ -1561,31 +1676,17 @@ var require_command = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/c
1561
1676
  });
1562
1677
  },
1563
1678
  printHelp(context) {
1564
- var _a, _b;
1565
- const lines = [];
1566
- let name = (_b = (_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : "";
1567
- if (!name) name = config$1.name;
1568
- name = chalk_1$3.default.bold(name);
1569
- if (config$1.version) name += ` ${chalk_1$3.default.dim(config$1.version)}`;
1570
- lines.push(name);
1571
- if (config$1.description) lines.push(chalk_1$3.default.dim("> ") + config$1.description);
1572
- const usageBreakdown = (0, utils_1$2.groupBy)(this.helpTopics(), (x) => x.category);
1573
- for (const [category, helpTopics] of (0, utils_1$2.entries)(usageBreakdown)) {
1574
- lines.push("");
1575
- lines.push(`${category.toUpperCase()}:`);
1576
- const widestUsage = helpTopics.reduce((len, curr) => {
1577
- return Math.max(len, curr.usage.length);
1578
- }, 0);
1579
- for (const helpTopic of helpTopics) {
1580
- let line = "";
1581
- line += ` ${(0, utils_1$2.padNoAnsi)(helpTopic.usage, widestUsage, "end")}`;
1582
- line += " - ";
1583
- line += helpTopic.description;
1584
- for (const defaultValue of helpTopic.defaults) line += chalk_1$3.default.dim(` [${defaultValue}]`);
1585
- lines.push(line);
1586
- }
1587
- }
1588
- return lines.join("\n");
1679
+ var _a;
1680
+ const data = {
1681
+ name: config$1.name,
1682
+ path: (_a = context.hotPath) !== null && _a !== void 0 ? _a : [config$1.name],
1683
+ version: config$1.version,
1684
+ description: config$1.description,
1685
+ aliases: config$1.aliases,
1686
+ helpTopics: this.helpTopics(),
1687
+ examples: config$1.examples
1688
+ };
1689
+ return (0, helpFormatter_1$1.getHelpFormatter)().formatCommand(data, context);
1589
1690
  },
1590
1691
  register(opts) {
1591
1692
  var _a;
@@ -1632,8 +1733,8 @@ var require_command = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/c
1632
1733
  }) });
1633
1734
 
1634
1735
  //#endregion
1635
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/option.js
1636
- var require_option = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/option.js": ((exports) => {
1736
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/option.js
1737
+ var require_option = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/option.js": ((exports) => {
1637
1738
  var __createBinding$6 = exports && exports.__createBinding || (Object.create ? (function(o, m$1, k, k2) {
1638
1739
  if (k2 === void 0) k2 = k;
1639
1740
  var desc = Object.getOwnPropertyDescriptor(m$1, k);
@@ -1789,8 +1890,8 @@ var require_option = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cm
1789
1890
  }) });
1790
1891
 
1791
1892
  //#endregion
1792
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/errorBox.js
1793
- var require_errorBox = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/errorBox.js": ((exports) => {
1893
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/errorBox.js
1894
+ var require_errorBox = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/errorBox.js": ((exports) => {
1794
1895
  var __importDefault$3 = exports && exports.__importDefault || function(mod) {
1795
1896
  return mod && mod.__esModule ? mod : { "default": mod };
1796
1897
  };
@@ -1874,8 +1975,11 @@ var require_errorBox = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
1874
1975
  else if (withNoHighlight.length > 1) errorMessages.push("Along with the following errors:");
1875
1976
  }
1876
1977
  withNoHighlight.forEach(({ message }) => {
1978
+ var _a;
1877
1979
  const num = chalk_1$1.default.red.bold(`${(0, utils_1$1.padNoAnsi)(number.toString(), maxNumberWidth, "start")}.`);
1878
- errorMessages.push(` ${num} ${chalk_1$1.default.red(message)}`);
1980
+ const lines = message.split("\n");
1981
+ errorMessages.push(` ${num} ${chalk_1$1.default.red((_a = lines[0]) !== null && _a !== void 0 ? _a : "")}`);
1982
+ for (const line of lines.slice(1)) errorMessages.push(` ${"".padStart(maxNumberWidth + 1)} ${chalk_1$1.default.red(line)}`);
1879
1983
  number++;
1880
1984
  });
1881
1985
  const helpCmd = chalk_1$1.default.yellow(`${breadcrumbs.join(" ")} --help`);
@@ -1886,8 +1990,8 @@ var require_errorBox = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
1886
1990
  }) });
1887
1991
 
1888
1992
  //#endregion
1889
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/newparser/parser.js
1890
- var require_parser$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/newparser/parser.js": ((exports) => {
1993
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/newparser/parser.js
1994
+ var require_parser$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/newparser/parser.js": ((exports) => {
1891
1995
  var __importDefault$2 = exports && exports.__importDefault || function(mod) {
1892
1996
  return mod && mod.__esModule ? mod : { "default": mod };
1893
1997
  };
@@ -2079,8 +2183,8 @@ var require_parser$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
2079
2183
  }) });
2080
2184
 
2081
2185
  //#endregion
2082
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/newparser/tokenizer.js
2083
- var require_tokenizer = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/newparser/tokenizer.js": ((exports) => {
2186
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/newparser/tokenizer.js
2187
+ var require_tokenizer = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/newparser/tokenizer.js": ((exports) => {
2084
2188
  Object.defineProperty(exports, "__esModule", { value: true });
2085
2189
  exports.tokenize = tokenize;
2086
2190
  const utils_1 = require_utils();
@@ -2126,8 +2230,8 @@ var require_tokenizer = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
2126
2230
  }) });
2127
2231
 
2128
2232
  //#endregion
2129
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/runner.js
2130
- var require_runner = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/runner.js": ((exports) => {
2233
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/runner.js
2234
+ var require_runner = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/runner.js": ((exports) => {
2131
2235
  Object.defineProperty(exports, "__esModule", { value: true });
2132
2236
  exports.run = run$1;
2133
2237
  exports.runSafely = runSafely;
@@ -2203,8 +2307,8 @@ var require_runner = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cm
2203
2307
  }) });
2204
2308
 
2205
2309
  //#endregion
2206
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/restPositionals.js
2207
- var require_restPositionals = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/restPositionals.js": ((exports) => {
2310
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/restPositionals.js
2311
+ var require_restPositionals = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/restPositionals.js": ((exports) => {
2208
2312
  var __createBinding$5 = exports && exports.__createBinding || (Object.create ? (function(o, m$1, k, k2) {
2209
2313
  if (k2 === void 0) k2 = k;
2210
2314
  var desc = Object.getOwnPropertyDescriptor(m$1, k);
@@ -2294,8 +2398,8 @@ var require_restPositionals = /* @__PURE__ */ __commonJS$1({ "../../node_modules
2294
2398
  }) });
2295
2399
 
2296
2400
  //#endregion
2297
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/multiflag.js
2298
- var require_multiflag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/multiflag.js": ((exports) => {
2401
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/multiflag.js
2402
+ var require_multiflag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/multiflag.js": ((exports) => {
2299
2403
  var __createBinding$4 = exports && exports.__createBinding || (Object.create ? (function(o, m$1, k, k2) {
2300
2404
  if (k2 === void 0) k2 = k;
2301
2405
  var desc = Object.getOwnPropertyDescriptor(m$1, k);
@@ -2393,8 +2497,8 @@ var require_multiflag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
2393
2497
  }) });
2394
2498
 
2395
2499
  //#endregion
2396
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/multioption.js
2397
- var require_multioption = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/multioption.js": ((exports) => {
2500
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/multioption.js
2501
+ var require_multioption = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/multioption.js": ((exports) => {
2398
2502
  var __createBinding$3 = exports && exports.__createBinding || (Object.create ? (function(o, m$1, k, k2) {
2399
2503
  if (k2 === void 0) k2 = k;
2400
2504
  var desc = Object.getOwnPropertyDescriptor(m$1, k);
@@ -2535,8 +2639,8 @@ var require_multioption = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
2535
2639
  }) });
2536
2640
 
2537
2641
  //#endregion
2538
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/union.js
2539
- var require_union = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/union.js": ((exports) => {
2642
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/union.js
2643
+ var require_union = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/union.js": ((exports) => {
2540
2644
  var __createBinding$2 = exports && exports.__createBinding || (Object.create ? (function(o, m$1, k, k2) {
2541
2645
  if (k2 === void 0) k2 = k;
2542
2646
  var desc = Object.getOwnPropertyDescriptor(m$1, k);
@@ -2603,8 +2707,8 @@ var require_union = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd
2603
2707
  }) });
2604
2708
 
2605
2709
  //#endregion
2606
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/oneOf.js
2607
- var require_oneOf = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/oneOf.js": ((exports) => {
2710
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/oneOf.js
2711
+ var require_oneOf = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/oneOf.js": ((exports) => {
2608
2712
  Object.defineProperty(exports, "__esModule", { value: true });
2609
2713
  exports.oneOf = oneOf;
2610
2714
  const node_util_1 = __require$1("node:util");
@@ -2625,8 +2729,8 @@ var require_oneOf = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd
2625
2729
  }) });
2626
2730
 
2627
2731
  //#endregion
2628
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/rest.js
2629
- var require_rest = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/rest.js": ((exports) => {
2732
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/rest.js
2733
+ var require_rest = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/rest.js": ((exports) => {
2630
2734
  var __createBinding$1 = exports && exports.__createBinding || (Object.create ? (function(o, m$1, k, k2) {
2631
2735
  if (k2 === void 0) k2 = k;
2632
2736
  var desc = Object.getOwnPropertyDescriptor(m$1, k);
@@ -2727,8 +2831,8 @@ var require_rest = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
2727
2831
  }) });
2728
2832
 
2729
2833
  //#endregion
2730
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/index.js
2731
- var require_cjs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/index.js": ((exports) => {
2834
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/index.js
2835
+ var require_cjs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/index.js": ((exports) => {
2732
2836
  /**
2733
2837
  * The index module: the entrance to the world of cmd-ts 😎
2734
2838
  *
@@ -2752,7 +2856,7 @@ var require_cjs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-t
2752
2856
  for (var p in m$1) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m$1, p);
2753
2857
  };
2754
2858
  Object.defineProperty(exports, "__esModule", { value: true });
2755
- exports.rest = exports.oneOf = exports.union = exports.multioption = exports.multiflag = exports.restPositionals = exports.parse = exports.run = exports.runSafely = exports.dryRun = exports.positional = exports.option = exports.flag = exports.command = exports.binary = exports.extendType = exports.subcommands = void 0;
2859
+ exports.rest = exports.oneOf = exports.union = exports.multioption = exports.multiflag = exports.restPositionals = exports.parse = exports.run = exports.runSafely = exports.dryRun = exports.positional = exports.option = exports.defaultHelpFormatter = exports.resetHelpFormatter = exports.setDefaultHelpFormatter = exports.flag = exports.command = exports.binary = exports.extendType = exports.subcommands = void 0;
2756
2860
  var subcommands_1 = require_subcommands();
2757
2861
  Object.defineProperty(exports, "subcommands", {
2758
2862
  enumerable: true,
@@ -2789,6 +2893,25 @@ var require_cjs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-t
2789
2893
  return flag_1.flag;
2790
2894
  }
2791
2895
  });
2896
+ var helpFormatter_1 = require_helpFormatter();
2897
+ Object.defineProperty(exports, "setDefaultHelpFormatter", {
2898
+ enumerable: true,
2899
+ get: function() {
2900
+ return helpFormatter_1.setDefaultHelpFormatter;
2901
+ }
2902
+ });
2903
+ Object.defineProperty(exports, "resetHelpFormatter", {
2904
+ enumerable: true,
2905
+ get: function() {
2906
+ return helpFormatter_1.resetHelpFormatter;
2907
+ }
2908
+ });
2909
+ Object.defineProperty(exports, "defaultHelpFormatter", {
2910
+ enumerable: true,
2911
+ get: function() {
2912
+ return helpFormatter_1.defaultHelpFormatter;
2913
+ }
2914
+ });
2792
2915
  var option_1 = require_option();
2793
2916
  Object.defineProperty(exports, "option", {
2794
2917
  enumerable: true,
@@ -2976,13 +3099,13 @@ var require_ms = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ms@2.1
2976
3099
  * @return {String}
2977
3100
  * @api private
2978
3101
  */
2979
- function fmtShort(ms$2) {
2980
- var msAbs = Math.abs(ms$2);
2981
- if (msAbs >= d) return Math.round(ms$2 / d) + "d";
2982
- if (msAbs >= h) return Math.round(ms$2 / h) + "h";
2983
- if (msAbs >= m) return Math.round(ms$2 / m) + "m";
2984
- if (msAbs >= s) return Math.round(ms$2 / s) + "s";
2985
- return ms$2 + "ms";
3102
+ function fmtShort(ms$3) {
3103
+ var msAbs = Math.abs(ms$3);
3104
+ if (msAbs >= d) return Math.round(ms$3 / d) + "d";
3105
+ if (msAbs >= h) return Math.round(ms$3 / h) + "h";
3106
+ if (msAbs >= m) return Math.round(ms$3 / m) + "m";
3107
+ if (msAbs >= s) return Math.round(ms$3 / s) + "s";
3108
+ return ms$3 + "ms";
2986
3109
  }
2987
3110
  /**
2988
3111
  * Long format for `ms`.
@@ -2991,20 +3114,20 @@ var require_ms = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ms@2.1
2991
3114
  * @return {String}
2992
3115
  * @api private
2993
3116
  */
2994
- function fmtLong(ms$2) {
2995
- var msAbs = Math.abs(ms$2);
2996
- if (msAbs >= d) return plural(ms$2, msAbs, d, "day");
2997
- if (msAbs >= h) return plural(ms$2, msAbs, h, "hour");
2998
- if (msAbs >= m) return plural(ms$2, msAbs, m, "minute");
2999
- if (msAbs >= s) return plural(ms$2, msAbs, s, "second");
3000
- return ms$2 + " ms";
3117
+ function fmtLong(ms$3) {
3118
+ var msAbs = Math.abs(ms$3);
3119
+ if (msAbs >= d) return plural(ms$3, msAbs, d, "day");
3120
+ if (msAbs >= h) return plural(ms$3, msAbs, h, "hour");
3121
+ if (msAbs >= m) return plural(ms$3, msAbs, m, "minute");
3122
+ if (msAbs >= s) return plural(ms$3, msAbs, s, "second");
3123
+ return ms$3 + " ms";
3001
3124
  }
3002
3125
  /**
3003
3126
  * Pluralization helper.
3004
3127
  */
3005
- function plural(ms$2, msAbs, n, name) {
3128
+ function plural(ms$3, msAbs, n, name) {
3006
3129
  var isPlural = msAbs >= n * 1.5;
3007
- return Math.round(ms$2 / n) + " " + name + (isPlural ? "s" : "");
3130
+ return Math.round(ms$3 / n) + " " + name + (isPlural ? "s" : "");
3008
3131
  }
3009
3132
  }) });
3010
3133
 
@@ -4280,20 +4403,26 @@ function formatBytes(bytes) {
4280
4403
  return `${new Intl.NumberFormat(void 0, { maximumFractionDigits: value < 10 && unitIndex > 0 ? 1 : 0 }).format(value)} ${units[unitIndex]}`;
4281
4404
  }
4282
4405
  function timeAgo(date) {
4406
+ if (date === void 0) return "-";
4283
4407
  return formatDistance(date, /* @__PURE__ */ new Date(), { addSuffix: true }).replace("about ", "").replace("less than ", "");
4284
4408
  }
4285
4409
  function table(opts) {
4286
4410
  const titles = Object.keys(opts.columns);
4287
- const maxWidths = titles.map((title) => title.length);
4411
+ const visibleLength = (value) => stripVTControlCharacters(value).length;
4412
+ const maxWidths = titles.map((title) => visibleLength(title));
4288
4413
  const data = opts.rows.map((row) => {
4289
4414
  return titles.map((title, i) => {
4290
4415
  let value = String(opts.columns[title].value(row));
4291
- if (value.length > maxWidths[i]) maxWidths[i] = value.length;
4416
+ const width = visibleLength(value);
4417
+ if (width > maxWidths[i]) maxWidths[i] = width;
4292
4418
  if (opts.columns[title].color) value = opts.columns[title].color(row)(value);
4293
4419
  return value;
4294
4420
  });
4295
4421
  });
4296
- const padded = (t, i) => t.padEnd(maxWidths[i], " ");
4422
+ const padded = (value, i) => {
4423
+ const padding = maxWidths[i] - visibleLength(value);
4424
+ return padding > 0 ? `${value}${" ".repeat(padding)}` : value;
4425
+ };
4297
4426
  const space = " ";
4298
4427
  return [source_default.bold(titles.map(padded).join(space)), ...data.map((row) => row.map(padded).join(space))].join("\n");
4299
4428
  }
@@ -7286,13 +7415,16 @@ const scope = {
7286
7415
  ...token.helpTopics(),
7287
7416
  ...project.helpTopics(),
7288
7417
  ...team.helpTopics()
7289
- ];
7418
+ ].map((x) => ({
7419
+ ...x,
7420
+ category: "Auth & Scope"
7421
+ }));
7290
7422
  }
7291
7423
  };
7292
7424
 
7293
7425
  //#endregion
7294
7426
  //#region package.json
7295
- var version = "2.2.0";
7427
+ var version = "2.4.0";
7296
7428
 
7297
7429
  //#endregion
7298
7430
  //#region src/error.ts
@@ -11111,9 +11243,9 @@ function printCommand(command$1, args$4) {
11111
11243
 
11112
11244
  //#endregion
11113
11245
  //#region src/interactive-shell/extend-sandbox-timeout.ts
11114
- var import_ms$1 = /* @__PURE__ */ __toESM(require_ms());
11246
+ var import_ms$2 = /* @__PURE__ */ __toESM(require_ms());
11115
11247
  const debug$2 = createDebugger("sandbox:timeout");
11116
- const BUFFER = (0, import_ms$1.default)("10 seconds");
11248
+ const BUFFER = (0, import_ms$2.default)("10 seconds");
11117
11249
  async function extendSandboxTimeoutPeriodically(sandbox, signal) {
11118
11250
  const nextTick = sandbox.createdAt.getTime() + sandbox.timeout;
11119
11251
  debug$2(`next tick: ${new Date(nextTick).toISOString()}`);
@@ -11123,7 +11255,7 @@ async function extendSandboxTimeoutPeriodically(sandbox, signal) {
11123
11255
  debug$2(`sleeping for ${timeout$1}ms until next timeout extension`);
11124
11256
  await setTimeout$1(timeout$1, null, { signal });
11125
11257
  }
11126
- await sandbox.extendTimeout((0, import_ms$1.default)("5 minutes"));
11258
+ await sandbox.extendTimeout((0, import_ms$2.default)("5 minutes"));
11127
11259
  const nextTick$1 = sandbox.createdAt.getTime() + sandbox.timeout;
11128
11260
  debug$2(`extended sandbox timeout by 5 minutes. next tick: ${new Date(nextTick$1).toISOString()}`);
11129
11261
  }
@@ -11422,12 +11554,7 @@ const ObjectFromKeyValue = import_cjs$14.extendType(import_cjs$14.array(KeyValue
11422
11554
  var import_cjs$13 = /* @__PURE__ */ __toESM(require_cjs());
11423
11555
  init_source();
11424
11556
  const args$3 = {
11425
- scope,
11426
11557
  sandbox: import_cjs$13.positional({ type: sandboxId }),
11427
- asSudo: import_cjs$13.flag({
11428
- long: "sudo",
11429
- description: "Give extended privileges to the command."
11430
- }),
11431
11558
  command: import_cjs$13.positional({
11432
11559
  displayName: "command",
11433
11560
  description: "The executable to invoke"
@@ -11436,11 +11563,9 @@ const args$3 = {
11436
11563
  displayName: "args",
11437
11564
  description: "arguments to pass to the command"
11438
11565
  }),
11439
- cwd: import_cjs$13.option({
11440
- long: "workdir",
11441
- short: "w",
11442
- description: "The working directory to run the command in",
11443
- type: import_cjs$13.optional(import_cjs$13.string)
11566
+ asSudo: import_cjs$13.flag({
11567
+ long: "sudo",
11568
+ description: "Give extended privileges to the command."
11444
11569
  }),
11445
11570
  interactive: import_cjs$13.flag({
11446
11571
  long: "interactive",
@@ -11460,17 +11585,24 @@ const args$3 = {
11460
11585
  long: "no-extend-timeout",
11461
11586
  description: "Do not extend the sandbox timeout while running an interactive command. Only affects interactive executions."
11462
11587
  }),
11588
+ tty: import_cjs$13.flag({
11589
+ long: "tty",
11590
+ short: "t",
11591
+ description: "Allocate a tty for an interactive command. This is a no-op."
11592
+ }),
11593
+ cwd: import_cjs$13.option({
11594
+ long: "workdir",
11595
+ short: "w",
11596
+ description: "The working directory to run the command in",
11597
+ type: import_cjs$13.optional(import_cjs$13.string)
11598
+ }),
11463
11599
  envVars: import_cjs$13.multioption({
11464
11600
  long: "env",
11465
11601
  short: "e",
11466
11602
  type: ObjectFromKeyValue,
11467
11603
  description: "Environment variables to set for the command"
11468
11604
  }),
11469
- tty: import_cjs$13.flag({
11470
- long: "tty",
11471
- short: "t",
11472
- description: "Allocate a tty for an interactive command. This is a no-op."
11473
- })
11605
+ scope
11474
11606
  };
11475
11607
  const exec = import_cjs$13.command({
11476
11608
  name: "exec",
@@ -11524,45 +11656,32 @@ init_source();
11524
11656
  const networkPolicyMode = import_cjs$12.extendType(import_cjs$12.string, {
11525
11657
  displayName: "MODE",
11526
11658
  async from(value) {
11527
- const validModes = [
11528
- "internet-access",
11529
- "no-access",
11530
- "restricted"
11531
- ];
11659
+ const validModes = ["allow-all", "deny-all"];
11532
11660
  if (!validModes.includes(value)) throw new Error([`Invalid network policy mode: ${value}.`, `${source_default.bold("hint:")} Valid modes are: ${validModes.join(", ")}`].join("\n"));
11533
11661
  return value;
11534
11662
  }
11535
11663
  });
11536
11664
  const networkPolicy = import_cjs$12.option({
11537
11665
  long: "network-policy",
11538
- description: `Network policy mode: "internet-access", "no-access", or "restricted"
11539
-
11540
- internet-access: sandbox can access any website/domain
11541
- no-access: sandbox has no network access
11542
- restricted: sandbox can only access websites and domains explicitly allowed`,
11666
+ description: `Network policy mode: "allow-all" or "deny-all"
11667
+ - allow-all: sandbox can access any website/domain
11668
+ - deny-all: sandbox has no network access
11669
+ Omit this option and use --allowed-domain / --allowed-cidr / --denied-cidr for custom policies.`,
11543
11670
  type: import_cjs$12.optional(networkPolicyMode)
11544
11671
  });
11545
11672
  const allowedDomains = import_cjs$12.multioption({
11546
11673
  long: "allowed-domain",
11547
- description: `Domain to allow traffic to (requires --network-policy=restricted)
11548
-
11549
- Supports "*" for wildcards for a segment (e.g. '*.vercel.com', 'www.*.com')
11550
- If used as the first segment, will match any subdomain.`,
11674
+ description: `Domain to allow traffic to (creates a custom network policy). Supports "*" for wildcards for a segment (e.g. '*.vercel.com', 'www.*.com'). If used as the first segment, will match any subdomain.`,
11551
11675
  type: import_cjs$12.array(import_cjs$12.string)
11552
11676
  });
11553
11677
  const allowedCIDRs = import_cjs$12.multioption({
11554
11678
  long: "allowed-cidr",
11555
- description: `CIDR to allow traffic to (requires --network-policy=restricted)
11556
-
11557
- Takes precedence over 'allowed-domain'.
11558
- `,
11679
+ description: `CIDR to allow traffic to (creates a custom network policy). Takes precedence over 'allowed-domain'.`,
11559
11680
  type: import_cjs$12.array(import_cjs$12.string)
11560
11681
  });
11561
11682
  const deniedCIDRs = import_cjs$12.multioption({
11562
11683
  long: "denied-cidr",
11563
- description: `CIDR to deny traffic to (requires --network-policy=restricted)
11564
-
11565
- Takes precedence over allowed domains/CIDRs.`,
11684
+ description: `CIDR to deny traffic to (creates a custom network policy). Takes precedence over allowed domains/CIDRs.`,
11566
11685
  type: import_cjs$12.array(import_cjs$12.string)
11567
11686
  });
11568
11687
  const networkPolicyArgs = {
@@ -11576,33 +11695,36 @@ const networkPolicyArgs = {
11576
11695
  //#region src/util/network-policy.ts
11577
11696
  init_source();
11578
11697
  /**
11579
- * Builds a NetworkPolicy from CLI arguments (optional mode for create).
11698
+ * Resolves the network policy mode from --network-policy and --mode flags.
11699
+ * Errors if both are provided with conflicting values.
11700
+ */
11701
+ function resolveMode(networkPolicy$1, mode) {
11702
+ if (networkPolicy$1 && mode && networkPolicy$1 !== mode) throw new Error([`Conflicting network policy modes: --network-policy=${networkPolicy$1} and --mode=${mode}.`, `${source_default.bold("hint:")} Use only one of --network-policy or --mode.`].join("\n"));
11703
+ return networkPolicy$1 ?? mode;
11704
+ }
11705
+ /**
11706
+ * Builds a NetworkPolicy from CLI arguments.
11580
11707
  */
11581
11708
  function buildNetworkPolicy(args$4) {
11582
11709
  const { networkPolicy: networkPolicy$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 } = args$4;
11583
- if (!networkPolicy$1 || networkPolicy$1 !== "restricted") {
11584
- if (allowedDomains$1.length > 0 || allowedCIDRs$1.length > 0 || deniedCIDRs$1.length > 0) throw new Error(["Network policy options require --network-policy to be set to restricted.", `${source_default.bold("hint:")} Use --network-policy=restricted to allow/deny specific domains or CIDRs.`].join("\n"));
11585
- }
11586
- switch (networkPolicy$1) {
11587
- case void 0:
11588
- case "internet-access": return { type: "internet-access" };
11589
- case "no-access": return { type: "no-access" };
11590
- case "restricted": return {
11591
- type: "restricted",
11592
- allowedDomains: allowedDomains$1.length > 0 ? allowedDomains$1 : void 0,
11593
- allowedCIDRs: allowedCIDRs$1.length > 0 ? allowedCIDRs$1 : void 0,
11594
- deniedCIDRs: deniedCIDRs$1.length > 0 ? deniedCIDRs$1 : void 0
11595
- };
11596
- }
11710
+ const hasListOptions = allowedDomains$1.length > 0 || allowedCIDRs$1.length > 0 || deniedCIDRs$1.length > 0;
11711
+ if (networkPolicy$1 && hasListOptions) throw new Error([`Cannot combine --network-policy=${networkPolicy$1} with --allowed-domain, --allowed-cidr, or --denied-cidr.`, `${source_default.bold("hint:")} Use --allowed-domain / --allowed-cidr / --denied-cidr without --network-policy for custom policies.`].join("\n"));
11712
+ if (hasListOptions) return {
11713
+ ...allowedDomains$1.length > 0 && { allow: allowedDomains$1 },
11714
+ ...(allowedCIDRs$1.length > 0 || deniedCIDRs$1.length > 0) && { subnets: {
11715
+ ...allowedCIDRs$1.length > 0 && { allow: allowedCIDRs$1 },
11716
+ ...deniedCIDRs$1.length > 0 && { deny: deniedCIDRs$1 }
11717
+ } }
11718
+ };
11719
+ return networkPolicy$1 ?? "allow-all";
11597
11720
  }
11598
11721
 
11599
11722
  //#endregion
11600
11723
  //#region src/commands/create.ts
11601
11724
  var import_cjs$11 = /* @__PURE__ */ __toESM(require_cjs());
11602
- var import_ms = /* @__PURE__ */ __toESM(require_ms());
11725
+ var import_ms$1 = /* @__PURE__ */ __toESM(require_ms());
11603
11726
  init_source();
11604
11727
  const args$2 = {
11605
- scope,
11606
11728
  runtime,
11607
11729
  timeout,
11608
11730
  ports: import_cjs$11.multioption({
@@ -11635,12 +11757,17 @@ const args$2 = {
11635
11757
  long: "connect",
11636
11758
  description: "Start an interactive shell session after creating the sandbox"
11637
11759
  }),
11638
- ...networkPolicyArgs
11760
+ ...networkPolicyArgs,
11761
+ scope
11639
11762
  };
11640
11763
  const create = import_cjs$11.command({
11641
11764
  name: "create",
11642
11765
  description: "Create a sandbox in the specified account and project.",
11643
11766
  args: args$2,
11767
+ examples: [{
11768
+ description: "Create and connect to a sandbox without a network access",
11769
+ command: `sandbox run --network-policy=none --connect`
11770
+ }],
11644
11771
  async handler({ ports, scope: scope$1, runtime: runtime$1, timeout: timeout$1, silent, snapshot: snapshot$1, connect: connect$2, networkPolicy: networkPolicyMode$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 }) {
11645
11772
  const networkPolicy$1 = buildNetworkPolicy({
11646
11773
  networkPolicy: networkPolicyMode$1,
@@ -11658,7 +11785,7 @@ const create = import_cjs$11.command({
11658
11785
  projectId: scope$1.project,
11659
11786
  token: scope$1.token,
11660
11787
  ports,
11661
- timeout: (0, import_ms.default)(timeout$1),
11788
+ timeout: (0, import_ms$1.default)(timeout$1),
11662
11789
  networkPolicy: networkPolicy$1,
11663
11790
  __interactive: true
11664
11791
  }) : await sandboxClient.create({
@@ -11667,7 +11794,7 @@ const create = import_cjs$11.command({
11667
11794
  token: scope$1.token,
11668
11795
  ports,
11669
11796
  runtime: runtime$1,
11670
- timeout: (0, import_ms.default)(timeout$1),
11797
+ timeout: (0, import_ms$1.default)(timeout$1),
11671
11798
  networkPolicy: networkPolicy$1,
11672
11799
  __interactive: true
11673
11800
  });
@@ -11757,12 +11884,12 @@ const list = import_cjs$9.command({
11757
11884
  aliases: ["ls"],
11758
11885
  description: "List all sandboxes for the specified account and project.",
11759
11886
  args: {
11760
- scope,
11761
11887
  all: import_cjs$9.flag({
11762
11888
  long: "all",
11763
11889
  short: "a",
11764
11890
  description: "Show all sandboxes (default shows just running)"
11765
- })
11891
+ }),
11892
+ scope
11766
11893
  },
11767
11894
  async handler({ scope: { token: token$1, team: team$1, project: project$1 }, all }) {
11768
11895
  const sandboxes = await (async () => {
@@ -11794,7 +11921,7 @@ const list = import_cjs$9.command({
11794
11921
  ID: { value: (s$1) => s$1.id },
11795
11922
  STATUS: {
11796
11923
  value: (s$1) => s$1.status,
11797
- color: (s$1) => SandboxStatusColor.get(s$1.status) ?? source_default.reset
11924
+ color: (s$1) => SandboxStatusColor[s$1.status] ?? source_default.reset
11798
11925
  },
11799
11926
  CREATED: { value: (s$1) => timeAgo(s$1.createdAt) },
11800
11927
  MEMORY: { value: (s$1) => memoryFormatter.format(s$1.memory) },
@@ -11806,13 +11933,15 @@ const list = import_cjs$9.command({
11806
11933
  }));
11807
11934
  }
11808
11935
  });
11809
- const SandboxStatusColor = new Map([
11810
- ["running", source_default.cyan],
11811
- ["failed", source_default.red],
11812
- ["stopped", source_default.gray.dim],
11813
- ["stopping", source_default.gray],
11814
- ["pending", source_default.magenta]
11815
- ]);
11936
+ const SandboxStatusColor = {
11937
+ running: source_default.cyan,
11938
+ failed: source_default.red,
11939
+ stopped: source_default.gray.dim,
11940
+ stopping: source_default.gray,
11941
+ pending: source_default.magenta,
11942
+ snapshotting: source_default.blue,
11943
+ aborted: source_default.gray.dim
11944
+ };
11816
11945
 
11817
11946
  //#endregion
11818
11947
  //#region src/commands/connect.ts
@@ -14124,7 +14253,6 @@ const stop = import_cjs$7.command({
14124
14253
  aliases: ["rm", "remove"],
14125
14254
  description: "Stop one or more running sandboxes",
14126
14255
  args: {
14127
- scope,
14128
14256
  sandboxId: import_cjs$7.positional({
14129
14257
  type: sandboxId,
14130
14258
  description: "a sandbox ID to stop"
@@ -14132,7 +14260,8 @@ const stop = import_cjs$7.command({
14132
14260
  sandboxIds: import_cjs$7.restPositionals({
14133
14261
  type: sandboxId,
14134
14262
  description: "more sandboxes to stop"
14135
- })
14263
+ }),
14264
+ scope
14136
14265
  },
14137
14266
  async handler({ scope: { token: token$1, team: team$1, project: project$1 }, sandboxId: sandboxId$1, sandboxIds }) {
14138
14267
  await new Listr(Array.from(new Set([sandboxId$1, ...sandboxIds]), (sandboxId$2) => {
@@ -14152,8 +14281,8 @@ const stop = import_cjs$7.command({
14152
14281
  });
14153
14282
 
14154
14283
  //#endregion
14155
- //#region ../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/batteries/fs.js
14156
- var require_fs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.14.3/node_modules/cmd-ts/dist/cjs/batteries/fs.js": ((exports) => {
14284
+ //#region ../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/batteries/fs.js
14285
+ var require_fs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts@0.15.0/node_modules/cmd-ts/dist/cjs/batteries/fs.js": ((exports) => {
14157
14286
  var __importDefault = exports && exports.__importDefault || function(mod) {
14158
14287
  return mod && mod.__esModule ? mod : { "default": mod };
14159
14288
  };
@@ -14230,17 +14359,17 @@ const cp = import_cjs$6.command({
14230
14359
  description: "Copy files between your local filesystem and a remote sandbox",
14231
14360
  aliases: ["cp"],
14232
14361
  args: {
14233
- scope,
14234
14362
  source: import_cjs$6.positional({
14235
- displayName: `SANDBOX_ID:PATH`,
14363
+ displayName: `src`,
14236
14364
  description: `The source file to copy from local file system, or or a sandbox_id:path from a remote sandbox`,
14237
14365
  type: localOrRemote
14238
14366
  }),
14239
14367
  dest: import_cjs$6.positional({
14240
- displayName: `SANDBOX_ID:PATH`,
14368
+ displayName: `dst`,
14241
14369
  description: `The destination file to copy to local file system, or or a sandbox_id:path to a remote sandbox`,
14242
14370
  type: localOrRemote
14243
- })
14371
+ }),
14372
+ scope
14244
14373
  },
14245
14374
  async handler({ scope: scope$1, source, dest }) {
14246
14375
  const spinner = ora({ text: "reading file..." }).start();
@@ -14302,8 +14431,8 @@ const logout = import_cjs$5.command({
14302
14431
  //#region src/commands/snapshot.ts
14303
14432
  var import_cjs$4 = /* @__PURE__ */ __toESM(require_cjs());
14304
14433
  init_source();
14434
+ var import_ms = /* @__PURE__ */ __toESM(require_ms());
14305
14435
  const args = {
14306
- scope,
14307
14436
  stop: import_cjs$4.flag({
14308
14437
  long: "stop",
14309
14438
  description: "Confirm that the sandbox will be stopped when snapshotting"
@@ -14312,13 +14441,19 @@ const args = {
14312
14441
  long: "silent",
14313
14442
  description: "Don't write snapshot ID to stdout"
14314
14443
  }),
14315
- sandbox: import_cjs$4.positional({ type: sandboxId })
14444
+ expiration: import_cjs$4.option({
14445
+ long: "expiration",
14446
+ type: import_cjs$4.optional(Duration),
14447
+ description: "The expiration time of the snapshot. Use 0 for no expiration."
14448
+ }),
14449
+ sandbox: import_cjs$4.positional({ type: sandboxId }),
14450
+ scope
14316
14451
  };
14317
14452
  const snapshot = import_cjs$4.command({
14318
14453
  name: "snapshot",
14319
14454
  description: "Take a snapshot of the filesystem of a sandbox",
14320
14455
  args,
14321
- async handler({ sandbox: sandboxId$1, stop: stop$1, scope: { token: token$1, team: team$1, project: project$1 }, silent }) {
14456
+ async handler({ sandbox: sandboxId$1, stop: stop$1, scope: { token: token$1, team: team$1, project: project$1 }, silent, expiration }) {
14322
14457
  if (!stop$1) {
14323
14458
  console.error(["Snapshotting a sandbox will automatically stop it.", `${source_default.bold("hint:")} Confirm with --stop to continue.`].join("\n"));
14324
14459
  process.exitCode = 1;
@@ -14341,7 +14476,7 @@ const snapshot = import_cjs$4.command({
14341
14476
  return;
14342
14477
  }
14343
14478
  const spinner = silent ? void 0 : ora("Creating snapshot...").start();
14344
- const snapshot$1 = await sandbox.snapshot();
14479
+ const snapshot$1 = await sandbox.snapshot({ expiration: expiration === void 0 ? void 0 : (0, import_ms.default)(expiration) });
14345
14480
  spinner?.succeed(`Snapshot ${snapshot$1.snapshotId} created.`);
14346
14481
  }
14347
14482
  });
@@ -14390,12 +14525,54 @@ const list$1 = import_cjs$2.command({
14390
14525
  }));
14391
14526
  }
14392
14527
  });
14528
+ const get = import_cjs$2.command({
14529
+ name: "get",
14530
+ description: "Get details of a snapshot.",
14531
+ args: {
14532
+ scope,
14533
+ snapshotId: import_cjs$2.positional({
14534
+ type: snapshotId,
14535
+ description: "snapshot ID to retrieve"
14536
+ })
14537
+ },
14538
+ async handler({ scope: { token: token$1, team: team$1, project: project$1 }, snapshotId: id }) {
14539
+ const snapshot$1 = await (async () => {
14540
+ try {
14541
+ var _usingCtx3 = _usingCtx();
14542
+ const _spinner$1 = _usingCtx3.u(acquireRelease(() => ora("Fetching snapshot...").start(), (s$1) => s$1.stop()));
14543
+ return snapshotClient.get({
14544
+ token: token$1,
14545
+ teamId: team$1,
14546
+ projectId: project$1,
14547
+ snapshotId: id
14548
+ });
14549
+ } catch (_) {
14550
+ _usingCtx3.e = _;
14551
+ } finally {
14552
+ _usingCtx3.d();
14553
+ }
14554
+ })();
14555
+ console.log(table({
14556
+ rows: [snapshot$1],
14557
+ columns: {
14558
+ ID: { value: (s$1) => s$1.snapshotId },
14559
+ STATUS: {
14560
+ value: (s$1) => s$1.status,
14561
+ color: (s$1) => SnapshotStatusColor.get(s$1.status) ?? source_default.reset
14562
+ },
14563
+ CREATED: { value: (s$1) => timeAgo(s$1.createdAt) },
14564
+ EXPIRATION: { value: (s$1) => s$1.status === "deleted" ? source_default.gray.dim("deleted") : timeAgo(s$1.expiresAt) },
14565
+ SIZE: { value: (s$1) => formatBytes(s$1.sizeBytes) },
14566
+ ["SOURCE SANDBOX"]: { value: (s$1) => s$1.sourceSandboxId }
14567
+ }
14568
+ }));
14569
+ }
14570
+ });
14393
14571
  const remove = import_cjs$2.command({
14394
14572
  name: "delete",
14395
14573
  aliases: ["rm", "remove"],
14396
14574
  description: "Delete one or more snapshots.",
14397
14575
  args: {
14398
- scope,
14399
14576
  snapshotId: import_cjs$2.positional({
14400
14577
  type: snapshotId,
14401
14578
  description: "snapshot ID to delete"
@@ -14403,7 +14580,8 @@ const remove = import_cjs$2.command({
14403
14580
  snapshotIds: import_cjs$2.restPositionals({
14404
14581
  type: snapshotId,
14405
14582
  description: "More snapshots IDs to delete"
14406
- })
14583
+ }),
14584
+ scope
14407
14585
  },
14408
14586
  async handler({ scope: { team: team$1, token: token$1, project: project$1 }, snapshotId: snapshotId$1, snapshotIds }) {
14409
14587
  await new Listr(Array.from(new Set([snapshotId$1, ...snapshotIds]), (snapshotId$2) => {
@@ -14428,6 +14606,7 @@ const snapshots = (0, import_cjs$3.subcommands)({
14428
14606
  description: "Manage sandbox snapshots",
14429
14607
  cmds: {
14430
14608
  list: list$1,
14609
+ get,
14431
14610
  delete: remove
14432
14611
  }
14433
14612
  });
@@ -14443,16 +14622,21 @@ var import_cjs$1 = /* @__PURE__ */ __toESM(require_cjs());
14443
14622
  init_source();
14444
14623
  const networkPolicyCommand = import_cjs$1.command({
14445
14624
  name: "network-policy",
14446
- description: `Update the network policy of a sandbox
14447
-
14448
- This is a full update, fully overriding the pre-existing configuration.`,
14625
+ description: `Update the network policy of a sandbox.
14626
+ This will fully override the previous configuration.`,
14449
14627
  args: {
14450
- scope,
14451
14628
  sandbox: import_cjs$1.positional({ type: sandboxId }),
14452
- ...networkPolicyArgs
14629
+ ...networkPolicyArgs,
14630
+ mode: import_cjs$1.option({
14631
+ long: "mode",
14632
+ description: `Alias for --network-policy.`,
14633
+ type: import_cjs$1.optional(networkPolicyMode)
14634
+ }),
14635
+ scope
14453
14636
  },
14454
- async handler({ scope: { token: token$1, team: team$1, project: project$1 }, sandbox: sandboxId$1, networkPolicy: networkPolicyMode$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 }) {
14455
- if (networkPolicyMode$1 === void 0) throw new Error(`Network policy mode must be set.`);
14637
+ async handler({ scope: { token: token$1, team: team$1, project: project$1 }, sandbox: sandboxId$1, networkPolicy: networkPolicyFlag, mode: modeFlag, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 }) {
14638
+ const networkPolicyMode$1 = resolveMode(networkPolicyFlag, modeFlag);
14639
+ if (networkPolicyMode$1 === void 0 && allowedDomains$1.length === 0 && allowedCIDRs$1.length === 0 && deniedCIDRs$1.length === 0) throw new Error(`Network policy mode or custom rules must be set.`);
14456
14640
  const networkPolicy$1 = buildNetworkPolicy({
14457
14641
  networkPolicy: networkPolicyMode$1,
14458
14642
  allowedDomains: allowedDomains$1,
@@ -14477,10 +14661,11 @@ This is a full update, fully overriding the pre-existing configuration.`,
14477
14661
  }
14478
14662
  const spinner = ora("Updating network policy...").start();
14479
14663
  try {
14480
- await sandbox.updateNetworkPolicy(networkPolicy$1);
14664
+ const response = await sandbox.updateNetworkPolicy(networkPolicy$1);
14481
14665
  spinner.stop();
14482
14666
  process.stderr.write("✅ Network policy updated for sandbox " + source_default.cyan(sandbox.sandboxId) + "\n");
14483
- process.stderr.write(source_default.dim(" ╰ ") + "mode: " + source_default.cyan(networkPolicy$1.type) + "\n");
14667
+ const mode = typeof response === "string" ? response : "restricted";
14668
+ process.stderr.write(source_default.dim(" ╰ ") + "mode: " + source_default.cyan(mode) + "\n");
14484
14669
  } catch (error) {
14485
14670
  spinner.stop();
14486
14671
  throw error;
@@ -14515,9 +14700,23 @@ const app = (opts) => (0, import_cjs.subcommands)({
14515
14700
  login,
14516
14701
  logout
14517
14702
  }
14518
- }
14703
+ },
14704
+ examples: [
14705
+ {
14706
+ description: "Create a sandbox and start a shell",
14707
+ command: "sandbox create --connect"
14708
+ },
14709
+ {
14710
+ description: "Run a command in a new sandbox",
14711
+ command: `sandbox run -- node -e "console.log('hello')"`
14712
+ },
14713
+ {
14714
+ description: "Execute command in an existing sandbox",
14715
+ command: `sandbox exec <sandbox-id> -- npm test`
14716
+ }
14717
+ ]
14519
14718
  });
14520
14719
 
14521
14720
  //#endregion
14522
- export { StyledError as n, require_cjs as r, app as t };
14523
- //# sourceMappingURL=app-BNIol84k.mjs.map
14721
+ export { source_exports as a, init_source as i, StyledError as n, require_cjs as r, app as t };
14722
+ //# sourceMappingURL=app-uOMbKaBL.mjs.map