securewithtrace 0.18.1 → 0.19.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.
Files changed (3) hide show
  1. package/README.md +23 -0
  2. package/dist/index.js +1997 -323
  3. package/package.json +5 -1
package/dist/index.js CHANGED
@@ -1079,35 +1079,35 @@ var require_suggestSimilar = __commonJS({
1079
1079
  function editDistance(a, b) {
1080
1080
  if (Math.abs(a.length - b.length) > maxDistance)
1081
1081
  return Math.max(a.length, b.length);
1082
- const d = [];
1082
+ const d3 = [];
1083
1083
  for (let i = 0; i <= a.length; i++) {
1084
- d[i] = [i];
1084
+ d3[i] = [i];
1085
1085
  }
1086
- for (let j = 0; j <= b.length; j++) {
1087
- d[0][j] = j;
1086
+ for (let j2 = 0; j2 <= b.length; j2++) {
1087
+ d3[0][j2] = j2;
1088
1088
  }
1089
- for (let j = 1; j <= b.length; j++) {
1089
+ for (let j2 = 1; j2 <= b.length; j2++) {
1090
1090
  for (let i = 1; i <= a.length; i++) {
1091
1091
  let cost = 1;
1092
- if (a[i - 1] === b[j - 1]) {
1092
+ if (a[i - 1] === b[j2 - 1]) {
1093
1093
  cost = 0;
1094
1094
  } else {
1095
1095
  cost = 1;
1096
1096
  }
1097
- d[i][j] = Math.min(
1098
- d[i - 1][j] + 1,
1097
+ d3[i][j2] = Math.min(
1098
+ d3[i - 1][j2] + 1,
1099
1099
  // deletion
1100
- d[i][j - 1] + 1,
1100
+ d3[i][j2 - 1] + 1,
1101
1101
  // insertion
1102
- d[i - 1][j - 1] + cost
1102
+ d3[i - 1][j2 - 1] + cost
1103
1103
  // substitution
1104
1104
  );
1105
- if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
1106
- d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
1105
+ if (i > 1 && j2 > 1 && a[i - 1] === b[j2 - 2] && a[i - 2] === b[j2 - 1]) {
1106
+ d3[i][j2] = Math.min(d3[i][j2], d3[i - 2][j2 - 2] + 1);
1107
1107
  }
1108
1108
  }
1109
1109
  }
1110
- return d[a.length][b.length];
1110
+ return d3[a.length][b.length];
1111
1111
  }
1112
1112
  function suggestSimilar(word, candidates) {
1113
1113
  if (!candidates || candidates.length === 0) return "";
@@ -1160,7 +1160,7 @@ var require_command = __commonJS({
1160
1160
  var childProcess = __require("child_process");
1161
1161
  var path = __require("path");
1162
1162
  var fs = __require("fs");
1163
- var process3 = __require("process");
1163
+ var process4 = __require("process");
1164
1164
  var { Argument: Argument2, humanReadableArgName } = require_argument();
1165
1165
  var { CommanderError: CommanderError2 } = require_error();
1166
1166
  var { Help: Help2, stripColor } = require_help();
@@ -1207,13 +1207,13 @@ var require_command = __commonJS({
1207
1207
  this._showSuggestionAfterError = true;
1208
1208
  this._savedState = null;
1209
1209
  this._outputConfiguration = {
1210
- writeOut: (str) => process3.stdout.write(str),
1211
- writeErr: (str) => process3.stderr.write(str),
1210
+ writeOut: (str) => process4.stdout.write(str),
1211
+ writeErr: (str) => process4.stderr.write(str),
1212
1212
  outputError: (str, write) => write(str),
1213
- getOutHelpWidth: () => process3.stdout.isTTY ? process3.stdout.columns : void 0,
1214
- getErrHelpWidth: () => process3.stderr.isTTY ? process3.stderr.columns : void 0,
1215
- getOutHasColors: () => useColor() ?? (process3.stdout.isTTY && process3.stdout.hasColors?.()),
1216
- getErrHasColors: () => useColor() ?? (process3.stderr.isTTY && process3.stderr.hasColors?.()),
1213
+ getOutHelpWidth: () => process4.stdout.isTTY ? process4.stdout.columns : void 0,
1214
+ getErrHelpWidth: () => process4.stderr.isTTY ? process4.stderr.columns : void 0,
1215
+ getOutHasColors: () => useColor() ?? (process4.stdout.isTTY && process4.stdout.hasColors?.()),
1216
+ getErrHasColors: () => useColor() ?? (process4.stderr.isTTY && process4.stderr.hasColors?.()),
1217
1217
  stripColor: (str) => stripColor(str)
1218
1218
  };
1219
1219
  this._hidden = false;
@@ -1596,7 +1596,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1596
1596
  if (this._exitCallback) {
1597
1597
  this._exitCallback(new CommanderError2(exitCode, code, message));
1598
1598
  }
1599
- process3.exit(exitCode);
1599
+ process4.exit(exitCode);
1600
1600
  }
1601
1601
  /**
1602
1602
  * Register callback `fn` for the command.
@@ -1994,16 +1994,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
1994
1994
  }
1995
1995
  parseOptions = parseOptions || {};
1996
1996
  if (argv === void 0 && parseOptions.from === void 0) {
1997
- if (process3.versions?.electron) {
1997
+ if (process4.versions?.electron) {
1998
1998
  parseOptions.from = "electron";
1999
1999
  }
2000
- const execArgv = process3.execArgv ?? [];
2000
+ const execArgv = process4.execArgv ?? [];
2001
2001
  if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
2002
2002
  parseOptions.from = "eval";
2003
2003
  }
2004
2004
  }
2005
2005
  if (argv === void 0) {
2006
- argv = process3.argv;
2006
+ argv = process4.argv;
2007
2007
  }
2008
2008
  this.rawArgs = argv.slice();
2009
2009
  let userArgs;
@@ -2014,7 +2014,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2014
2014
  userArgs = argv.slice(2);
2015
2015
  break;
2016
2016
  case "electron":
2017
- if (process3.defaultApp) {
2017
+ if (process4.defaultApp) {
2018
2018
  this._scriptPath = argv[1];
2019
2019
  userArgs = argv.slice(2);
2020
2020
  } else {
@@ -2201,11 +2201,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
2201
2201
  }
2202
2202
  launchWithNode = sourceExt.includes(path.extname(executableFile));
2203
2203
  let proc;
2204
- if (process3.platform !== "win32") {
2204
+ if (process4.platform !== "win32") {
2205
2205
  if (launchWithNode) {
2206
2206
  args.unshift(executableFile);
2207
- args = incrementNodeInspectorPort(process3.execArgv).concat(args);
2208
- proc = childProcess.spawn(process3.argv[0], args, { stdio: "inherit" });
2207
+ args = incrementNodeInspectorPort(process4.execArgv).concat(args);
2208
+ proc = childProcess.spawn(process4.argv[0], args, { stdio: "inherit" });
2209
2209
  } else {
2210
2210
  proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
2211
2211
  }
@@ -2216,13 +2216,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
2216
2216
  subcommand._name
2217
2217
  );
2218
2218
  args.unshift(executableFile);
2219
- args = incrementNodeInspectorPort(process3.execArgv).concat(args);
2220
- proc = childProcess.spawn(process3.execPath, args, { stdio: "inherit" });
2219
+ args = incrementNodeInspectorPort(process4.execArgv).concat(args);
2220
+ proc = childProcess.spawn(process4.execPath, args, { stdio: "inherit" });
2221
2221
  }
2222
2222
  if (!proc.killed) {
2223
2223
  const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
2224
2224
  signals.forEach((signal) => {
2225
- process3.on(signal, () => {
2225
+ process4.on(signal, () => {
2226
2226
  if (proc.killed === false && proc.exitCode === null) {
2227
2227
  proc.kill(signal);
2228
2228
  }
@@ -2233,7 +2233,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2233
2233
  proc.on("close", (code) => {
2234
2234
  code = code ?? 1;
2235
2235
  if (!exitCallback) {
2236
- process3.exit(code);
2236
+ process4.exit(code);
2237
2237
  } else {
2238
2238
  exitCallback(
2239
2239
  new CommanderError2(
@@ -2255,7 +2255,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2255
2255
  throw new Error(`'${executableFile}' not executable`);
2256
2256
  }
2257
2257
  if (!exitCallback) {
2258
- process3.exit(1);
2258
+ process4.exit(1);
2259
2259
  } else {
2260
2260
  const wrappedError = new CommanderError2(
2261
2261
  1,
@@ -2750,13 +2750,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
2750
2750
  */
2751
2751
  _parseOptionsEnv() {
2752
2752
  this.options.forEach((option) => {
2753
- if (option.envVar && option.envVar in process3.env) {
2753
+ if (option.envVar && option.envVar in process4.env) {
2754
2754
  const optionKey = option.attributeName();
2755
2755
  if (this.getOptionValue(optionKey) === void 0 || ["default", "config", "env"].includes(
2756
2756
  this.getOptionValueSource(optionKey)
2757
2757
  )) {
2758
2758
  if (option.required || option.optional) {
2759
- this.emit(`optionEnv:${option.name()}`, process3.env[option.envVar]);
2759
+ this.emit(`optionEnv:${option.name()}`, process4.env[option.envVar]);
2760
2760
  } else {
2761
2761
  this.emit(`optionEnv:${option.name()}`);
2762
2762
  }
@@ -3211,7 +3211,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3211
3211
  */
3212
3212
  help(contextOptions) {
3213
3213
  this.outputHelp(contextOptions);
3214
- let exitCode = Number(process3.exitCode ?? 0);
3214
+ let exitCode = Number(process4.exitCode ?? 0);
3215
3215
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
3216
3216
  exitCode = 1;
3217
3217
  }
@@ -3301,9 +3301,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3301
3301
  });
3302
3302
  }
3303
3303
  function useColor() {
3304
- if (process3.env.NO_COLOR || process3.env.FORCE_COLOR === "0" || process3.env.FORCE_COLOR === "false")
3304
+ if (process4.env.NO_COLOR || process4.env.FORCE_COLOR === "0" || process4.env.FORCE_COLOR === "false")
3305
3305
  return false;
3306
- if (process3.env.FORCE_COLOR || process3.env.CLICOLOR_FORCE !== void 0)
3306
+ if (process4.env.FORCE_COLOR || process4.env.CLICOLOR_FORCE !== void 0)
3307
3307
  return true;
3308
3308
  return void 0;
3309
3309
  }
@@ -3335,6 +3335,62 @@ var require_commander = __commonJS({
3335
3335
  }
3336
3336
  });
3337
3337
 
3338
+ // ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
3339
+ var require_src = __commonJS({
3340
+ "../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
3341
+ "use strict";
3342
+ var ESC2 = "\x1B";
3343
+ var CSI2 = `${ESC2}[`;
3344
+ var beep = "\x07";
3345
+ var cursor = {
3346
+ to(x, y2) {
3347
+ if (!y2) return `${CSI2}${x + 1}G`;
3348
+ return `${CSI2}${y2 + 1};${x + 1}H`;
3349
+ },
3350
+ move(x, y2) {
3351
+ let ret = "";
3352
+ if (x < 0) ret += `${CSI2}${-x}D`;
3353
+ else if (x > 0) ret += `${CSI2}${x}C`;
3354
+ if (y2 < 0) ret += `${CSI2}${-y2}A`;
3355
+ else if (y2 > 0) ret += `${CSI2}${y2}B`;
3356
+ return ret;
3357
+ },
3358
+ up: (count = 1) => `${CSI2}${count}A`,
3359
+ down: (count = 1) => `${CSI2}${count}B`,
3360
+ forward: (count = 1) => `${CSI2}${count}C`,
3361
+ backward: (count = 1) => `${CSI2}${count}D`,
3362
+ nextLine: (count = 1) => `${CSI2}E`.repeat(count),
3363
+ prevLine: (count = 1) => `${CSI2}F`.repeat(count),
3364
+ left: `${CSI2}G`,
3365
+ hide: `${CSI2}?25l`,
3366
+ show: `${CSI2}?25h`,
3367
+ save: `${ESC2}7`,
3368
+ restore: `${ESC2}8`
3369
+ };
3370
+ var scroll = {
3371
+ up: (count = 1) => `${CSI2}S`.repeat(count),
3372
+ down: (count = 1) => `${CSI2}T`.repeat(count)
3373
+ };
3374
+ var erase = {
3375
+ screen: `${CSI2}2J`,
3376
+ up: (count = 1) => `${CSI2}1J`.repeat(count),
3377
+ down: (count = 1) => `${CSI2}J`.repeat(count),
3378
+ line: `${CSI2}2K`,
3379
+ lineEnd: `${CSI2}K`,
3380
+ lineStart: `${CSI2}1K`,
3381
+ lines(count) {
3382
+ let clear = "";
3383
+ for (let i = 0; i < count; i++)
3384
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
3385
+ if (count)
3386
+ clear += cursor.left;
3387
+ return clear;
3388
+ }
3389
+ };
3390
+ module.exports = { cursor, scroll, erase, beep };
3391
+ }
3392
+ });
3393
+
3338
3394
  // ../../node_modules/.bun/commander@13.1.0/node_modules/commander/esm.mjs
3339
3395
  var import_index = __toESM(require_commander(), 1);
3340
3396
  var {
@@ -3353,7 +3409,725 @@ var {
3353
3409
  } = import_index.default;
3354
3410
 
3355
3411
  // src/auth/commands.ts
3356
- import { createInterface } from "readline/promises";
3412
+ import { createInterface as createInterface2 } from "readline/promises";
3413
+
3414
+ // ../../node_modules/.bun/@clack+core@1.2.0/node_modules/@clack/core/dist/index.mjs
3415
+ import { styleText as y } from "util";
3416
+ import { stdout as S, stdin as $ } from "process";
3417
+ import * as _ from "readline";
3418
+ import P from "readline";
3419
+
3420
+ // ../../node_modules/.bun/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js
3421
+ var isAmbiguous = (x) => {
3422
+ return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
3423
+ };
3424
+ var isFullWidth = (x) => {
3425
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
3426
+ };
3427
+ var isWide = (x) => {
3428
+ return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || 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 >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
3429
+ };
3430
+
3431
+ // ../../node_modules/.bun/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js
3432
+ var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
3433
+ var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
3434
+ var TAB_RE = /\t{1,1000}/y;
3435
+ var EMOJI_RE = /[\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;
3436
+ var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
3437
+ var MODIFIER_RE = /\p{M}+/gu;
3438
+ var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
3439
+ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
3440
+ const LIMIT = truncationOptions.limit ?? Infinity;
3441
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
3442
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
3443
+ const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
3444
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
3445
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
3446
+ const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
3447
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
3448
+ const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
3449
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
3450
+ const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
3451
+ let indexPrev = 0;
3452
+ let index = 0;
3453
+ let length = input.length;
3454
+ let lengthExtra = 0;
3455
+ let truncationEnabled = false;
3456
+ let truncationIndex = length;
3457
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
3458
+ let unmatchedStart = 0;
3459
+ let unmatchedEnd = 0;
3460
+ let width = 0;
3461
+ let widthExtra = 0;
3462
+ outer: while (true) {
3463
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
3464
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
3465
+ lengthExtra = 0;
3466
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
3467
+ const codePoint = char.codePointAt(0) || 0;
3468
+ if (isFullWidth(codePoint)) {
3469
+ widthExtra = FULL_WIDTH_WIDTH;
3470
+ } else if (isWide(codePoint)) {
3471
+ widthExtra = WIDE_WIDTH;
3472
+ } else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
3473
+ widthExtra = AMBIGUOUS_WIDTH;
3474
+ } else {
3475
+ widthExtra = REGULAR_WIDTH;
3476
+ }
3477
+ if (width + widthExtra > truncationLimit) {
3478
+ truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
3479
+ }
3480
+ if (width + widthExtra > LIMIT) {
3481
+ truncationEnabled = true;
3482
+ break outer;
3483
+ }
3484
+ lengthExtra += char.length;
3485
+ width += widthExtra;
3486
+ }
3487
+ unmatchedStart = unmatchedEnd = 0;
3488
+ }
3489
+ if (index >= length)
3490
+ break;
3491
+ LATIN_RE.lastIndex = index;
3492
+ if (LATIN_RE.test(input)) {
3493
+ lengthExtra = LATIN_RE.lastIndex - index;
3494
+ widthExtra = lengthExtra * REGULAR_WIDTH;
3495
+ if (width + widthExtra > truncationLimit) {
3496
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
3497
+ }
3498
+ if (width + widthExtra > LIMIT) {
3499
+ truncationEnabled = true;
3500
+ break;
3501
+ }
3502
+ width += widthExtra;
3503
+ unmatchedStart = indexPrev;
3504
+ unmatchedEnd = index;
3505
+ index = indexPrev = LATIN_RE.lastIndex;
3506
+ continue;
3507
+ }
3508
+ ANSI_RE.lastIndex = index;
3509
+ if (ANSI_RE.test(input)) {
3510
+ if (width + ANSI_WIDTH > truncationLimit) {
3511
+ truncationIndex = Math.min(truncationIndex, index);
3512
+ }
3513
+ if (width + ANSI_WIDTH > LIMIT) {
3514
+ truncationEnabled = true;
3515
+ break;
3516
+ }
3517
+ width += ANSI_WIDTH;
3518
+ unmatchedStart = indexPrev;
3519
+ unmatchedEnd = index;
3520
+ index = indexPrev = ANSI_RE.lastIndex;
3521
+ continue;
3522
+ }
3523
+ CONTROL_RE.lastIndex = index;
3524
+ if (CONTROL_RE.test(input)) {
3525
+ lengthExtra = CONTROL_RE.lastIndex - index;
3526
+ widthExtra = lengthExtra * CONTROL_WIDTH;
3527
+ if (width + widthExtra > truncationLimit) {
3528
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
3529
+ }
3530
+ if (width + widthExtra > LIMIT) {
3531
+ truncationEnabled = true;
3532
+ break;
3533
+ }
3534
+ width += widthExtra;
3535
+ unmatchedStart = indexPrev;
3536
+ unmatchedEnd = index;
3537
+ index = indexPrev = CONTROL_RE.lastIndex;
3538
+ continue;
3539
+ }
3540
+ TAB_RE.lastIndex = index;
3541
+ if (TAB_RE.test(input)) {
3542
+ lengthExtra = TAB_RE.lastIndex - index;
3543
+ widthExtra = lengthExtra * TAB_WIDTH;
3544
+ if (width + widthExtra > truncationLimit) {
3545
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
3546
+ }
3547
+ if (width + widthExtra > LIMIT) {
3548
+ truncationEnabled = true;
3549
+ break;
3550
+ }
3551
+ width += widthExtra;
3552
+ unmatchedStart = indexPrev;
3553
+ unmatchedEnd = index;
3554
+ index = indexPrev = TAB_RE.lastIndex;
3555
+ continue;
3556
+ }
3557
+ EMOJI_RE.lastIndex = index;
3558
+ if (EMOJI_RE.test(input)) {
3559
+ if (width + EMOJI_WIDTH > truncationLimit) {
3560
+ truncationIndex = Math.min(truncationIndex, index);
3561
+ }
3562
+ if (width + EMOJI_WIDTH > LIMIT) {
3563
+ truncationEnabled = true;
3564
+ break;
3565
+ }
3566
+ width += EMOJI_WIDTH;
3567
+ unmatchedStart = indexPrev;
3568
+ unmatchedEnd = index;
3569
+ index = indexPrev = EMOJI_RE.lastIndex;
3570
+ continue;
3571
+ }
3572
+ index += 1;
3573
+ }
3574
+ return {
3575
+ width: truncationEnabled ? truncationLimit : width,
3576
+ index: truncationEnabled ? truncationIndex : length,
3577
+ truncated: truncationEnabled,
3578
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
3579
+ };
3580
+ };
3581
+ var dist_default = getStringTruncatedWidth;
3582
+
3583
+ // ../../node_modules/.bun/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js
3584
+ var NO_TRUNCATION2 = {
3585
+ limit: Infinity,
3586
+ ellipsis: "",
3587
+ ellipsisWidth: 0
3588
+ };
3589
+ var fastStringWidth = (input, options = {}) => {
3590
+ return dist_default(input, NO_TRUNCATION2, options).width;
3591
+ };
3592
+ var dist_default2 = fastStringWidth;
3593
+
3594
+ // ../../node_modules/.bun/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.js
3595
+ var ESC = "\x1B";
3596
+ var CSI = "\x9B";
3597
+ var END_CODE = 39;
3598
+ var ANSI_ESCAPE_BELL = "\x07";
3599
+ var ANSI_CSI = "[";
3600
+ var ANSI_OSC = "]";
3601
+ var ANSI_SGR_TERMINATOR = "m";
3602
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
3603
+ var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
3604
+ var getClosingCode = (openingCode) => {
3605
+ if (openingCode >= 30 && openingCode <= 37)
3606
+ return 39;
3607
+ if (openingCode >= 90 && openingCode <= 97)
3608
+ return 39;
3609
+ if (openingCode >= 40 && openingCode <= 47)
3610
+ return 49;
3611
+ if (openingCode >= 100 && openingCode <= 107)
3612
+ return 49;
3613
+ if (openingCode === 1 || openingCode === 2)
3614
+ return 22;
3615
+ if (openingCode === 3)
3616
+ return 23;
3617
+ if (openingCode === 4)
3618
+ return 24;
3619
+ if (openingCode === 7)
3620
+ return 27;
3621
+ if (openingCode === 8)
3622
+ return 28;
3623
+ if (openingCode === 9)
3624
+ return 29;
3625
+ if (openingCode === 0)
3626
+ return 0;
3627
+ return void 0;
3628
+ };
3629
+ var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
3630
+ var wrapAnsiHyperlink = (url2) => `${ESC}${ANSI_ESCAPE_LINK}${url2}${ANSI_ESCAPE_BELL}`;
3631
+ var wrapWord = (rows, word, columns) => {
3632
+ const characters = word[Symbol.iterator]();
3633
+ let isInsideEscape = false;
3634
+ let isInsideLinkEscape = false;
3635
+ let lastRow = rows.at(-1);
3636
+ let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
3637
+ let currentCharacter = characters.next();
3638
+ let nextCharacter = characters.next();
3639
+ let rawCharacterIndex = 0;
3640
+ while (!currentCharacter.done) {
3641
+ const character = currentCharacter.value;
3642
+ const characterLength = dist_default2(character);
3643
+ if (visible + characterLength <= columns) {
3644
+ rows[rows.length - 1] += character;
3645
+ } else {
3646
+ rows.push(character);
3647
+ visible = 0;
3648
+ }
3649
+ if (character === ESC || character === CSI) {
3650
+ isInsideEscape = true;
3651
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
3652
+ }
3653
+ if (isInsideEscape) {
3654
+ if (isInsideLinkEscape) {
3655
+ if (character === ANSI_ESCAPE_BELL) {
3656
+ isInsideEscape = false;
3657
+ isInsideLinkEscape = false;
3658
+ }
3659
+ } else if (character === ANSI_SGR_TERMINATOR) {
3660
+ isInsideEscape = false;
3661
+ }
3662
+ } else {
3663
+ visible += characterLength;
3664
+ if (visible === columns && !nextCharacter.done) {
3665
+ rows.push("");
3666
+ visible = 0;
3667
+ }
3668
+ }
3669
+ currentCharacter = nextCharacter;
3670
+ nextCharacter = characters.next();
3671
+ rawCharacterIndex += character.length;
3672
+ }
3673
+ lastRow = rows.at(-1);
3674
+ if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
3675
+ rows[rows.length - 2] += rows.pop();
3676
+ }
3677
+ };
3678
+ var stringVisibleTrimSpacesRight = (string4) => {
3679
+ const words = string4.split(" ");
3680
+ let last = words.length;
3681
+ while (last) {
3682
+ if (dist_default2(words[last - 1])) {
3683
+ break;
3684
+ }
3685
+ last--;
3686
+ }
3687
+ if (last === words.length) {
3688
+ return string4;
3689
+ }
3690
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
3691
+ };
3692
+ var exec = (string4, columns, options = {}) => {
3693
+ if (options.trim !== false && string4.trim() === "") {
3694
+ return "";
3695
+ }
3696
+ let returnValue = "";
3697
+ let escapeCode;
3698
+ let escapeUrl;
3699
+ const words = string4.split(" ");
3700
+ let rows = [""];
3701
+ let rowLength = 0;
3702
+ for (let index = 0; index < words.length; index++) {
3703
+ const word = words[index];
3704
+ if (options.trim !== false) {
3705
+ const row = rows.at(-1) ?? "";
3706
+ const trimmed = row.trimStart();
3707
+ if (row.length !== trimmed.length) {
3708
+ rows[rows.length - 1] = trimmed;
3709
+ rowLength = dist_default2(trimmed);
3710
+ }
3711
+ }
3712
+ if (index !== 0) {
3713
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
3714
+ rows.push("");
3715
+ rowLength = 0;
3716
+ }
3717
+ if (rowLength || options.trim === false) {
3718
+ rows[rows.length - 1] += " ";
3719
+ rowLength++;
3720
+ }
3721
+ }
3722
+ const wordLength = dist_default2(word);
3723
+ if (options.hard && wordLength > columns) {
3724
+ const remainingColumns = columns - rowLength;
3725
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
3726
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
3727
+ if (breaksStartingNextLine < breaksStartingThisLine) {
3728
+ rows.push("");
3729
+ }
3730
+ wrapWord(rows, word, columns);
3731
+ rowLength = dist_default2(rows.at(-1) ?? "");
3732
+ continue;
3733
+ }
3734
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
3735
+ if (options.wordWrap === false && rowLength < columns) {
3736
+ wrapWord(rows, word, columns);
3737
+ rowLength = dist_default2(rows.at(-1) ?? "");
3738
+ continue;
3739
+ }
3740
+ rows.push("");
3741
+ rowLength = 0;
3742
+ }
3743
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
3744
+ wrapWord(rows, word, columns);
3745
+ rowLength = dist_default2(rows.at(-1) ?? "");
3746
+ continue;
3747
+ }
3748
+ rows[rows.length - 1] += word;
3749
+ rowLength += wordLength;
3750
+ }
3751
+ if (options.trim !== false) {
3752
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
3753
+ }
3754
+ const preString = rows.join("\n");
3755
+ let inSurrogate = false;
3756
+ for (let i = 0; i < preString.length; i++) {
3757
+ const character = preString[i];
3758
+ returnValue += character;
3759
+ if (!inSurrogate) {
3760
+ inSurrogate = character >= "\uD800" && character <= "\uDBFF";
3761
+ } else {
3762
+ continue;
3763
+ }
3764
+ if (character === ESC || character === CSI) {
3765
+ GROUP_REGEX.lastIndex = i + 1;
3766
+ const groupsResult = GROUP_REGEX.exec(preString);
3767
+ const groups = groupsResult?.groups;
3768
+ if (groups?.code !== void 0) {
3769
+ const code = Number.parseFloat(groups.code);
3770
+ escapeCode = code === END_CODE ? void 0 : code;
3771
+ } else if (groups?.uri !== void 0) {
3772
+ escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
3773
+ }
3774
+ }
3775
+ if (preString[i + 1] === "\n") {
3776
+ if (escapeUrl) {
3777
+ returnValue += wrapAnsiHyperlink("");
3778
+ }
3779
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
3780
+ if (escapeCode && closingCode) {
3781
+ returnValue += wrapAnsiCode(closingCode);
3782
+ }
3783
+ } else if (character === "\n") {
3784
+ if (escapeCode && getClosingCode(escapeCode)) {
3785
+ returnValue += wrapAnsiCode(escapeCode);
3786
+ }
3787
+ if (escapeUrl) {
3788
+ returnValue += wrapAnsiHyperlink(escapeUrl);
3789
+ }
3790
+ }
3791
+ }
3792
+ return returnValue;
3793
+ };
3794
+ var CRLF_OR_LF = /\r?\n/;
3795
+ function wrapAnsi(string4, columns, options) {
3796
+ return String(string4).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
3797
+ }
3798
+
3799
+ // ../../node_modules/.bun/@clack+core@1.2.0/node_modules/@clack/core/dist/index.mjs
3800
+ var import_sisteransi = __toESM(require_src(), 1);
3801
+ import { ReadStream as D } from "tty";
3802
+ function d(r, t2, e) {
3803
+ if (!e.some((o) => !o.disabled)) return r;
3804
+ const s = r + t2, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
3805
+ return e[n].disabled ? d(n, t2 < 0 ? -1 : 1, e) : n;
3806
+ }
3807
+ var E = ["up", "down", "left", "right", "space", "enter", "cancel"];
3808
+ var G = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
3809
+ var u = { actions: new Set(E), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true, date: { monthNames: [...G], messages: { required: "Please enter a valid date", invalidMonth: "There are only 12 months in a year", invalidDay: (r, t2) => `There are only ${r} days in ${t2}`, afterMin: (r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`, beforeMax: (r) => `Date must be on or before ${r.toISOString().slice(0, 10)}` } } };
3810
+ function V(r, t2) {
3811
+ if (typeof r == "string") return u.aliases.get(r) === t2;
3812
+ for (const e of r) if (e !== void 0 && V(e, t2)) return true;
3813
+ return false;
3814
+ }
3815
+ function j(r, t2) {
3816
+ if (r === t2) return;
3817
+ const e = r.split(`
3818
+ `), s = t2.split(`
3819
+ `), i = Math.max(e.length, s.length), n = [];
3820
+ for (let o = 0; o < i; o++) e[o] !== s[o] && n.push(o);
3821
+ return { lines: n, numLinesBefore: e.length, numLinesAfter: s.length, numLines: i };
3822
+ }
3823
+ var Y = globalThis.process.platform.startsWith("win");
3824
+ var C = /* @__PURE__ */ Symbol("clack:cancel");
3825
+ function q(r) {
3826
+ return r === C;
3827
+ }
3828
+ function w(r, t2) {
3829
+ const e = r;
3830
+ e.isTTY && e.setRawMode(t2);
3831
+ }
3832
+ var O = (r) => "columns" in r && typeof r.columns == "number" ? r.columns : 80;
3833
+ var A = (r) => "rows" in r && typeof r.rows == "number" ? r.rows : 20;
3834
+ function R(r, t2, e, s = e) {
3835
+ const i = O(r ?? S);
3836
+ return wrapAnsi(t2, i - e.length, { hard: true, trim: false }).split(`
3837
+ `).map((n, o) => `${o === 0 ? s : e}${n}`).join(`
3838
+ `);
3839
+ }
3840
+ var p = class {
3841
+ input;
3842
+ output;
3843
+ _abortSignal;
3844
+ rl;
3845
+ opts;
3846
+ _render;
3847
+ _track = false;
3848
+ _prevFrame = "";
3849
+ _subscribers = /* @__PURE__ */ new Map();
3850
+ _cursor = 0;
3851
+ state = "initial";
3852
+ error = "";
3853
+ value;
3854
+ userInput = "";
3855
+ constructor(t2, e = true) {
3856
+ const { input: s = $, output: i = S, render: n, signal: o, ...a } = t2;
3857
+ this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = e, this._abortSignal = o, this.input = s, this.output = i;
3858
+ }
3859
+ unsubscribe() {
3860
+ this._subscribers.clear();
3861
+ }
3862
+ setSubscriber(t2, e) {
3863
+ const s = this._subscribers.get(t2) ?? [];
3864
+ s.push(e), this._subscribers.set(t2, s);
3865
+ }
3866
+ on(t2, e) {
3867
+ this.setSubscriber(t2, { cb: e });
3868
+ }
3869
+ once(t2, e) {
3870
+ this.setSubscriber(t2, { cb: e, once: true });
3871
+ }
3872
+ emit(t2, ...e) {
3873
+ const s = this._subscribers.get(t2) ?? [], i = [];
3874
+ for (const n of s) n.cb(...e), n.once && i.push(() => s.splice(s.indexOf(n), 1));
3875
+ for (const n of i) n();
3876
+ }
3877
+ prompt() {
3878
+ return new Promise((t2) => {
3879
+ if (this._abortSignal) {
3880
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t2(C);
3881
+ this._abortSignal.addEventListener("abort", () => {
3882
+ this.state = "cancel", this.close();
3883
+ }, { once: true });
3884
+ }
3885
+ this.rl = P.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), w(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
3886
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t2(this.value);
3887
+ }), this.once("cancel", () => {
3888
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t2(C);
3889
+ });
3890
+ });
3891
+ }
3892
+ _isActionKey(t2, e) {
3893
+ return t2 === " ";
3894
+ }
3895
+ _setValue(t2) {
3896
+ this.value = t2, this.emit("value", this.value);
3897
+ }
3898
+ _setUserInput(t2, e) {
3899
+ this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
3900
+ }
3901
+ _clearUserInput() {
3902
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
3903
+ }
3904
+ onKeypress(t2, e) {
3905
+ 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 && u.aliases.has(e.name) && this.emit("cursor", u.aliases.get(e.name)), u.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?.toLowerCase(), e), e?.name === "return") {
3906
+ if (this.opts.validate) {
3907
+ const s = this.opts.validate(this.value);
3908
+ s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
3909
+ }
3910
+ this.state !== "error" && (this.state = "submit");
3911
+ }
3912
+ V([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();
3913
+ }
3914
+ close() {
3915
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
3916
+ `), w(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
3917
+ }
3918
+ restoreCursor() {
3919
+ const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
3920
+ `).length - 1;
3921
+ this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
3922
+ }
3923
+ render() {
3924
+ const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
3925
+ if (t2 !== this._prevFrame) {
3926
+ if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
3927
+ else {
3928
+ const e = j(this._prevFrame, t2), s = A(this.output);
3929
+ if (this.restoreCursor(), e) {
3930
+ const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
3931
+ let o = e.lines.find((a) => a >= i);
3932
+ if (o === void 0) {
3933
+ this._prevFrame = t2;
3934
+ return;
3935
+ }
3936
+ if (e.lines.length === 1) {
3937
+ this.output.write(import_sisteransi.cursor.move(0, o - n)), this.output.write(import_sisteransi.erase.lines(1));
3938
+ const a = t2.split(`
3939
+ `);
3940
+ this.output.write(a[o]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, a.length - o - 1));
3941
+ return;
3942
+ } else if (e.lines.length > 1) {
3943
+ if (i < n) o = i;
3944
+ else {
3945
+ const h = o - n;
3946
+ h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
3947
+ }
3948
+ this.output.write(import_sisteransi.erase.down());
3949
+ const a = t2.split(`
3950
+ `).slice(o);
3951
+ this.output.write(a.join(`
3952
+ `)), this._prevFrame = t2;
3953
+ return;
3954
+ }
3955
+ }
3956
+ this.output.write(import_sisteransi.erase.down());
3957
+ }
3958
+ this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
3959
+ }
3960
+ }
3961
+ };
3962
+ var nt = class extends p {
3963
+ options;
3964
+ cursor = 0;
3965
+ get _selectedValue() {
3966
+ return this.options[this.cursor];
3967
+ }
3968
+ changeValue() {
3969
+ this.value = this._selectedValue.value;
3970
+ }
3971
+ constructor(t2) {
3972
+ super(t2, false), this.options = t2.options;
3973
+ const e = this.options.findIndex(({ value: i }) => i === t2.initialValue), s = e === -1 ? 0 : e;
3974
+ this.cursor = this.options[s].disabled ? d(s, 1, this.options) : s, this.changeValue(), this.on("cursor", (i) => {
3975
+ switch (i) {
3976
+ case "left":
3977
+ case "up":
3978
+ this.cursor = d(this.cursor, -1, this.options);
3979
+ break;
3980
+ case "down":
3981
+ case "right":
3982
+ this.cursor = d(this.cursor, 1, this.options);
3983
+ break;
3984
+ }
3985
+ this.changeValue();
3986
+ });
3987
+ }
3988
+ };
3989
+
3990
+ // ../../node_modules/.bun/@clack+prompts@1.2.0/node_modules/@clack/prompts/dist/index.mjs
3991
+ import { styleText as t, stripVTControlCharacters as ne } from "util";
3992
+ import P2 from "process";
3993
+ var import_sisteransi2 = __toESM(require_src(), 1);
3994
+ import { existsSync as Xe, lstatSync as we, readdirSync as ze } from "fs";
3995
+ import { dirname as be, join as Qe } from "path";
3996
+ function Ze() {
3997
+ return P2.platform !== "win32" ? P2.env.TERM !== "linux" : !!P2.env.CI || !!P2.env.WT_SESSION || !!P2.env.TERMINUS_SUBLIME || P2.env.ConEmuTask === "{cmd::Cmder}" || P2.env.TERM_PROGRAM === "Terminus-Sublime" || P2.env.TERM_PROGRAM === "vscode" || P2.env.TERM === "xterm-256color" || P2.env.TERM === "alacritty" || P2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
3998
+ }
3999
+ var ee = Ze();
4000
+ var w2 = (e, i) => ee ? e : i;
4001
+ var _e = w2("\u25C6", "*");
4002
+ var oe = w2("\u25A0", "x");
4003
+ var ue = w2("\u25B2", "x");
4004
+ var F = w2("\u25C7", "o");
4005
+ var le = w2("\u250C", "T");
4006
+ var d2 = w2("\u2502", "|");
4007
+ var E2 = w2("\u2514", "\u2014");
4008
+ var Ie = w2("\u2510", "T");
4009
+ var Ee = w2("\u2518", "\u2014");
4010
+ var z2 = w2("\u25CF", ">");
4011
+ var H2 = w2("\u25CB", " ");
4012
+ var te = w2("\u25FB", "[\u2022]");
4013
+ var U = w2("\u25FC", "[+]");
4014
+ var J = w2("\u25FB", "[ ]");
4015
+ var xe = w2("\u25AA", "\u2022");
4016
+ var se = w2("\u2500", "-");
4017
+ var ce = w2("\u256E", "+");
4018
+ var Ge = w2("\u251C", "+");
4019
+ var $e = w2("\u256F", "+");
4020
+ var de = w2("\u2570", "+");
4021
+ var Oe = w2("\u256D", "+");
4022
+ var he = w2("\u25CF", "\u2022");
4023
+ var pe = w2("\u25C6", "*");
4024
+ var me = w2("\u25B2", "!");
4025
+ var ge = w2("\u25A0", "x");
4026
+ var V2 = (e) => {
4027
+ switch (e) {
4028
+ case "initial":
4029
+ case "active":
4030
+ return t("cyan", _e);
4031
+ case "cancel":
4032
+ return t("red", oe);
4033
+ case "error":
4034
+ return t("yellow", ue);
4035
+ case "submit":
4036
+ return t("green", F);
4037
+ }
4038
+ };
4039
+ var ye = (e) => {
4040
+ switch (e) {
4041
+ case "initial":
4042
+ case "active":
4043
+ return t("cyan", d2);
4044
+ case "cancel":
4045
+ return t("red", d2);
4046
+ case "error":
4047
+ return t("yellow", d2);
4048
+ case "submit":
4049
+ return t("green", d2);
4050
+ }
4051
+ };
4052
+ var et2 = (e, i, s, r, u2) => {
4053
+ let n = i, o = 0;
4054
+ for (let c26 = s; c26 < r; c26++) {
4055
+ const a = e[c26];
4056
+ if (n = n - a.length, o++, n <= u2) break;
4057
+ }
4058
+ return { lineCount: n, removals: o };
4059
+ };
4060
+ var Y2 = ({ cursor: e, options: i, style: s, output: r = process.stdout, maxItems: u2 = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: o = 4 }) => {
4061
+ const c26 = O(r) - n, a = A(r), l = t("dim", "..."), $2 = Math.max(a - o, 0), y2 = Math.max(Math.min(u2, $2), 5);
4062
+ let p2 = 0;
4063
+ e >= y2 - 3 && (p2 = Math.max(Math.min(e - y2 + 3, i.length - y2), 0));
4064
+ let m = y2 < i.length && p2 > 0, g = y2 < i.length && p2 + y2 < i.length;
4065
+ const S2 = Math.min(p2 + y2, i.length), h = [];
4066
+ let f = 0;
4067
+ m && f++, g && f++;
4068
+ const v = p2 + (m ? 1 : 0), T = S2 - (g ? 1 : 0);
4069
+ for (let b = v; b < T; b++) {
4070
+ const x = wrapAnsi(s(i[b], b === e), c26, { hard: true, trim: false }).split(`
4071
+ `);
4072
+ h.push(x), f += x.length;
4073
+ }
4074
+ if (f > $2) {
4075
+ let b = 0, x = 0, G2 = f;
4076
+ const M2 = e - v, R2 = (j2, D2) => et2(h, G2, j2, D2, $2);
4077
+ m ? ({ lineCount: G2, removals: b } = R2(0, M2), G2 > $2 && ({ lineCount: G2, removals: x } = R2(M2 + 1, h.length))) : ({ lineCount: G2, removals: x } = R2(M2 + 1, h.length), G2 > $2 && ({ lineCount: G2, removals: b } = R2(0, M2))), b > 0 && (m = true, h.splice(0, b)), x > 0 && (g = true, h.splice(h.length - x, x));
4078
+ }
4079
+ const C2 = [];
4080
+ m && C2.push(l);
4081
+ for (const b of h) for (const x of b) C2.push(x);
4082
+ return g && C2.push(l), C2;
4083
+ };
4084
+ var Ve = { light: w2("\u2500", "-"), heavy: w2("\u2501", "="), block: w2("\u2588", "#") };
4085
+ var re = (e, i) => e.includes(`
4086
+ `) ? e.split(`
4087
+ `).map((s) => i(s)).join(`
4088
+ `) : i(e);
4089
+ var _t = (e) => {
4090
+ const i = (s, r) => {
4091
+ const u2 = s.label ?? String(s.value);
4092
+ switch (r) {
4093
+ case "disabled":
4094
+ return `${t("gray", H2)} ${re(u2, (n) => t("gray", n))}${s.hint ? ` ${t("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
4095
+ case "selected":
4096
+ return `${re(u2, (n) => t("dim", n))}`;
4097
+ case "active":
4098
+ return `${t("green", z2)} ${u2}${s.hint ? ` ${t("dim", `(${s.hint})`)}` : ""}`;
4099
+ case "cancelled":
4100
+ return `${re(u2, (n) => t(["strikethrough", "dim"], n))}`;
4101
+ default:
4102
+ return `${t("dim", H2)} ${re(u2, (n) => t("dim", n))}`;
4103
+ }
4104
+ };
4105
+ return new nt({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue, render() {
4106
+ const s = e.withGuide ?? u.withGuide, r = `${V2(this.state)} `, u2 = `${ye(this.state)} `, n = R(e.output, e.message, u2, r), o = `${s ? `${t("gray", d2)}
4107
+ ` : ""}${n}
4108
+ `;
4109
+ switch (this.state) {
4110
+ case "submit": {
4111
+ const c26 = s ? `${t("gray", d2)} ` : "", a = R(e.output, i(this.options[this.cursor], "selected"), c26);
4112
+ return `${o}${a}`;
4113
+ }
4114
+ case "cancel": {
4115
+ const c26 = s ? `${t("gray", d2)} ` : "", a = R(e.output, i(this.options[this.cursor], "cancelled"), c26);
4116
+ return `${o}${a}${s ? `
4117
+ ${t("gray", d2)}` : ""}`;
4118
+ }
4119
+ default: {
4120
+ const c26 = s ? `${t("cyan", d2)} ` : "", a = s ? t("cyan", E2) : "", l = o.split(`
4121
+ `).length, $2 = s ? 2 : 1;
4122
+ return `${o}${c26}${Y2({ output: e.output, cursor: this.cursor, options: this.options, maxItems: e.maxItems, columnPadding: c26.length, rowPadding: l + $2, style: (y2, p2) => i(y2, y2.disabled ? "disabled" : p2 ? "active" : "inactive") }).join(`
4123
+ ${c26}`)}
4124
+ ${a}
4125
+ `;
4126
+ }
4127
+ }
4128
+ } }).prompt();
4129
+ };
4130
+ var je = `${t("gray", d2)} `;
3357
4131
 
3358
4132
  // ../../node_modules/.bun/@ts-rest+core@3.53.0-rc.1+f9199aabcde8d6a0/node_modules/@ts-rest/core/index.esm.mjs
3359
4133
  var util;
@@ -3407,7 +4181,7 @@ var util;
3407
4181
  return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
3408
4182
  }
3409
4183
  util2.joinValues = joinValues2;
3410
- util2.jsonStringifyReplacer = (_, value) => {
4184
+ util2.jsonStringifyReplacer = (_2, value) => {
3411
4185
  if (typeof value === "bigint") {
3412
4186
  return value.toString();
3413
4187
  }
@@ -3447,8 +4221,8 @@ var ZodParsedType = util.arrayToEnum([
3447
4221
  "set"
3448
4222
  ]);
3449
4223
  var getParsedType = (data) => {
3450
- const t = typeof data;
3451
- switch (t) {
4224
+ const t2 = typeof data;
4225
+ switch (t2) {
3452
4226
  case "undefined":
3453
4227
  return ZodParsedType.undefined;
3454
4228
  case "string":
@@ -6269,29 +7043,29 @@ var ZodFunction = class _ZodFunction extends ZodType {
6269
7043
  const params = { errorMap: ctx.common.contextualErrorMap };
6270
7044
  const fn = ctx.data;
6271
7045
  if (this._def.returns instanceof ZodPromise) {
6272
- const me = this;
7046
+ const me2 = this;
6273
7047
  return OK(async function(...args) {
6274
7048
  const error48 = new ZodError([]);
6275
- const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
7049
+ const parsedArgs = await me2._def.args.parseAsync(args, params).catch((e) => {
6276
7050
  error48.addIssue(makeArgsIssue(args, e));
6277
7051
  throw error48;
6278
7052
  });
6279
7053
  const result = await Reflect.apply(fn, this, parsedArgs);
6280
- const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
7054
+ const parsedReturns = await me2._def.returns._def.type.parseAsync(result, params).catch((e) => {
6281
7055
  error48.addIssue(makeReturnsIssue(result, e));
6282
7056
  throw error48;
6283
7057
  });
6284
7058
  return parsedReturns;
6285
7059
  });
6286
7060
  } else {
6287
- const me = this;
7061
+ const me2 = this;
6288
7062
  return OK(function(...args) {
6289
- const parsedArgs = me._def.args.safeParse(args, params);
7063
+ const parsedArgs = me2._def.args.safeParse(args, params);
6290
7064
  if (!parsedArgs.success) {
6291
7065
  throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
6292
7066
  }
6293
7067
  const result = Reflect.apply(fn, this, parsedArgs.data);
6294
- const parsedReturns = me._def.returns.safeParse(result, params);
7068
+ const parsedReturns = me2._def.returns.safeParse(result, params);
6295
7069
  if (!parsedReturns.success) {
6296
7070
  throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
6297
7071
  }
@@ -6855,10 +7629,10 @@ var custom = (check2, params = {}, fatal) => {
6855
7629
  return ZodAny.create().superRefine((data, ctx) => {
6856
7630
  var _a2, _b;
6857
7631
  if (!check2(data)) {
6858
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
6859
- const _fatal = (_b = (_a2 = p.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b !== void 0 ? _b : true;
6860
- const p2 = typeof p === "string" ? { message: p } : p;
6861
- ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
7632
+ const p2 = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
7633
+ const _fatal = (_b = (_a2 = p2.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b !== void 0 ? _b : true;
7634
+ const p22 = typeof p2 === "string" ? { message: p2 } : p2;
7635
+ ctx.addIssue({ code: "custom", ...p22, fatal: _fatal });
6862
7636
  }
6863
7637
  });
6864
7638
  return ZodAny.create();
@@ -6956,7 +7730,7 @@ var coerce = {
6956
7730
  date: ((arg) => ZodDate.create({ ...arg, coerce: true }))
6957
7731
  };
6958
7732
  var NEVER = INVALID;
6959
- var z = /* @__PURE__ */ Object.freeze({
7733
+ var z3 = /* @__PURE__ */ Object.freeze({
6960
7734
  __proto__: null,
6961
7735
  defaultErrorMap: errorMap,
6962
7736
  setErrorMap,
@@ -7089,17 +7863,17 @@ var zodMerge = (objectA, objectB) => {
7089
7863
  }
7090
7864
  return Object.assign({}, objectA, objectB);
7091
7865
  };
7092
- var ZodErrorSchema = z.object({
7093
- name: z.literal("ZodError"),
7094
- issues: z.array(z.object({
7095
- path: z.array(z.union([z.string(), z.number()])),
7096
- message: z.string().optional(),
7097
- code: z.nativeEnum(z.ZodIssueCode)
7098
- }).catchall(z.any()))
7866
+ var ZodErrorSchema = z3.object({
7867
+ name: z3.literal("ZodError"),
7868
+ issues: z3.array(z3.object({
7869
+ path: z3.array(z3.union([z3.string(), z3.number()])),
7870
+ message: z3.string().optional(),
7871
+ code: z3.nativeEnum(z3.ZodIssueCode)
7872
+ }).catchall(z3.any()))
7099
7873
  });
7100
7874
  var StandardSchemaError = class extends Error {
7101
7875
  constructor(issues) {
7102
- const message = JSON.stringify(issues, (_, value) => typeof value === "bigint" ? value.toString() : value, 2);
7876
+ const message = JSON.stringify(issues, (_2, value) => typeof value === "bigint" ? value.toString() : value, 2);
7103
7877
  super(message);
7104
7878
  this.name = "ValidationError";
7105
7879
  this.issues = issues;
@@ -7112,21 +7886,21 @@ var StandardSchemaError = class extends Error {
7112
7886
  return this.message;
7113
7887
  }
7114
7888
  };
7115
- var RequestValidationErrorSchema = z.object({
7116
- message: z.literal("Request validation failed"),
7889
+ var RequestValidationErrorSchema = z3.object({
7890
+ message: z3.literal("Request validation failed"),
7117
7891
  pathParameterErrors: ZodErrorSchema.nullable(),
7118
7892
  headerErrors: ZodErrorSchema.nullable(),
7119
7893
  queryParameterErrors: ZodErrorSchema.nullable(),
7120
7894
  bodyErrors: ZodErrorSchema.nullable()
7121
7895
  });
7122
- var RequestValidationErrorSchemaWithoutMessage = z.object({
7896
+ var RequestValidationErrorSchemaWithoutMessage = z3.object({
7123
7897
  // No message, express never had this implemented
7124
7898
  pathParameterErrors: ZodErrorSchema.nullable(),
7125
7899
  headerErrors: ZodErrorSchema.nullable(),
7126
7900
  queryParameterErrors: ZodErrorSchema.nullable(),
7127
7901
  bodyErrors: ZodErrorSchema.nullable()
7128
7902
  });
7129
- var RequestValidationErrorSchemaForNest = z.object({
7903
+ var RequestValidationErrorSchemaForNest = z3.object({
7130
7904
  paramsResult: ZodErrorSchema.nullable(),
7131
7905
  headersResult: ZodErrorSchema.nullable(),
7132
7906
  queryResult: ZodErrorSchema.nullable(),
@@ -7263,7 +8037,7 @@ var initContract = () => {
7263
8037
  };
7264
8038
  var insertParamsIntoPath = ({ path, params }) => {
7265
8039
  const pathParams = params;
7266
- return path.replace(/\/?:([^/?]+)\??/g, (matched, p) => pathParams[p] ? `${matched.startsWith("/") ? "/" : ""}${pathParams[p]}` : "");
8040
+ return path.replace(/\/?:([^/?]+)\??/g, (matched, p2) => pathParams[p2] ? `${matched.startsWith("/") ? "/" : ""}${pathParams[p2]}` : "");
7267
8041
  };
7268
8042
  var convertQueryParamsToUrlString = (query, json2 = false) => {
7269
8043
  const queryString = json2 ? encodeQueryParamsJson(query) : encodeQueryParams(query);
@@ -8060,7 +8834,7 @@ function $constructor(name, initializer3, params) {
8060
8834
  Object.defineProperty(inst, "_zod", {
8061
8835
  value: {
8062
8836
  def,
8063
- constr: _,
8837
+ constr: _2,
8064
8838
  traits: /* @__PURE__ */ new Set()
8065
8839
  },
8066
8840
  enumerable: false
@@ -8071,12 +8845,12 @@ function $constructor(name, initializer3, params) {
8071
8845
  }
8072
8846
  inst._zod.traits.add(name);
8073
8847
  initializer3(inst, def);
8074
- const proto = _.prototype;
8075
- const keys = Object.keys(proto);
8848
+ const proto2 = _2.prototype;
8849
+ const keys = Object.keys(proto2);
8076
8850
  for (let i = 0; i < keys.length; i++) {
8077
8851
  const k = keys[i];
8078
8852
  if (!(k in inst)) {
8079
- inst[k] = proto[k].bind(inst);
8853
+ inst[k] = proto2[k].bind(inst);
8080
8854
  }
8081
8855
  }
8082
8856
  }
@@ -8084,7 +8858,7 @@ function $constructor(name, initializer3, params) {
8084
8858
  class Definition extends Parent {
8085
8859
  }
8086
8860
  Object.defineProperty(Definition, "name", { value: name });
8087
- function _(def) {
8861
+ function _2(def) {
8088
8862
  var _a2;
8089
8863
  const inst = params?.Parent ? new Definition() : this;
8090
8864
  init(inst, def);
@@ -8094,16 +8868,16 @@ function $constructor(name, initializer3, params) {
8094
8868
  }
8095
8869
  return inst;
8096
8870
  }
8097
- Object.defineProperty(_, "init", { value: init });
8098
- Object.defineProperty(_, Symbol.hasInstance, {
8871
+ Object.defineProperty(_2, "init", { value: init });
8872
+ Object.defineProperty(_2, Symbol.hasInstance, {
8099
8873
  value: (inst) => {
8100
8874
  if (params?.Parent && inst instanceof params.Parent)
8101
8875
  return true;
8102
8876
  return inst?._zod?.traits?.has(name);
8103
8877
  }
8104
8878
  });
8105
- Object.defineProperty(_, "name", { value: name });
8106
- return _;
8879
+ Object.defineProperty(_2, "name", { value: name });
8880
+ return _2;
8107
8881
  }
8108
8882
  var $brand = /* @__PURE__ */ Symbol("zod_brand");
8109
8883
  var $ZodAsyncError = class extends Error {
@@ -8201,17 +8975,17 @@ function assertIs(_arg) {
8201
8975
  function assertNever(_x) {
8202
8976
  throw new Error("Unexpected value in exhaustive check");
8203
8977
  }
8204
- function assert(_) {
8978
+ function assert(_2) {
8205
8979
  }
8206
8980
  function getEnumValues(entries) {
8207
8981
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
8208
- const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
8982
+ const values = Object.entries(entries).filter(([k, _2]) => numericValues.indexOf(+k) === -1).map(([_2, v]) => v);
8209
8983
  return values;
8210
8984
  }
8211
8985
  function joinValues(array2, separator = "|") {
8212
8986
  return array2.map((val) => stringifyPrimitive(val)).join(separator);
8213
8987
  }
8214
- function jsonStringifyReplacer(_, value) {
8988
+ function jsonStringifyReplacer(_2, value) {
8215
8989
  if (typeof value === "bigint")
8216
8990
  return value.toString();
8217
8991
  return value;
@@ -8337,10 +9111,10 @@ var allowsEval = cached(() => {
8337
9111
  return false;
8338
9112
  }
8339
9113
  try {
8340
- const F = Function;
8341
- new F("");
9114
+ const F2 = Function;
9115
+ new F2("");
8342
9116
  return true;
8343
- } catch (_) {
9117
+ } catch (_2) {
8344
9118
  return false;
8345
9119
  }
8346
9120
  });
@@ -8377,8 +9151,8 @@ function numKeys(data) {
8377
9151
  return keyCount;
8378
9152
  }
8379
9153
  var getParsedType2 = (data) => {
8380
- const t = typeof data;
8381
- switch (t) {
9154
+ const t2 = typeof data;
9155
+ switch (t2) {
8382
9156
  case "undefined":
8383
9157
  return "undefined";
8384
9158
  case "string":
@@ -8417,7 +9191,7 @@ var getParsedType2 = (data) => {
8417
9191
  }
8418
9192
  return "object";
8419
9193
  default:
8420
- throw new Error(`Unknown data type: ${t}`);
9194
+ throw new Error(`Unknown data type: ${t2}`);
8421
9195
  }
8422
9196
  };
8423
9197
  var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
@@ -8450,31 +9224,31 @@ function normalizeParams(_params) {
8450
9224
  function createTransparentProxy(getter) {
8451
9225
  let target;
8452
9226
  return new Proxy({}, {
8453
- get(_, prop, receiver) {
9227
+ get(_2, prop, receiver) {
8454
9228
  target ?? (target = getter());
8455
9229
  return Reflect.get(target, prop, receiver);
8456
9230
  },
8457
- set(_, prop, value, receiver) {
9231
+ set(_2, prop, value, receiver) {
8458
9232
  target ?? (target = getter());
8459
9233
  return Reflect.set(target, prop, value, receiver);
8460
9234
  },
8461
- has(_, prop) {
9235
+ has(_2, prop) {
8462
9236
  target ?? (target = getter());
8463
9237
  return Reflect.has(target, prop);
8464
9238
  },
8465
- deleteProperty(_, prop) {
9239
+ deleteProperty(_2, prop) {
8466
9240
  target ?? (target = getter());
8467
9241
  return Reflect.deleteProperty(target, prop);
8468
9242
  },
8469
- ownKeys(_) {
9243
+ ownKeys(_2) {
8470
9244
  target ?? (target = getter());
8471
9245
  return Reflect.ownKeys(target);
8472
9246
  },
8473
- getOwnPropertyDescriptor(_, prop) {
9247
+ getOwnPropertyDescriptor(_2, prop) {
8474
9248
  target ?? (target = getter());
8475
9249
  return Reflect.getOwnPropertyDescriptor(target, prop);
8476
9250
  },
8477
- defineProperty(_, prop, descriptor) {
9251
+ defineProperty(_2, prop, descriptor) {
8478
9252
  target ?? (target = getter());
8479
9253
  return Reflect.defineProperty(target, prop, descriptor);
8480
9254
  }
@@ -8724,8 +9498,8 @@ function getLengthableOrigin(input) {
8724
9498
  return "unknown";
8725
9499
  }
8726
9500
  function parsedType(data) {
8727
- const t = typeof data;
8728
- switch (t) {
9501
+ const t2 = typeof data;
9502
+ switch (t2) {
8729
9503
  case "number": {
8730
9504
  return Number.isNaN(data) ? "nan" : "number";
8731
9505
  }
@@ -8742,7 +9516,7 @@ function parsedType(data) {
8742
9516
  }
8743
9517
  }
8744
9518
  }
8745
- return t;
9519
+ return t2;
8746
9520
  }
8747
9521
  function issue(...args) {
8748
9522
  const [iss, input, inst] = args;
@@ -8757,7 +9531,7 @@ function issue(...args) {
8757
9531
  return { ...iss };
8758
9532
  }
8759
9533
  function cleanEnum(obj) {
8760
- return Object.entries(obj).filter(([k, _]) => {
9534
+ return Object.entries(obj).filter(([k, _2]) => {
8761
9535
  return Number.isNaN(Number.parseInt(k, 10));
8762
9536
  }).map((el) => el[1]);
8763
9537
  }
@@ -9760,11 +10534,11 @@ var Doc = class {
9760
10534
  }
9761
10535
  }
9762
10536
  compile() {
9763
- const F = Function;
10537
+ const F2 = Function;
9764
10538
  const args = this?.args;
9765
10539
  const content = this?.content ?? [``];
9766
10540
  const lines = [...content.map((x) => ` ${x}`)];
9767
- return new F(...args, lines.join("\n"));
10541
+ return new F2(...args, lines.join("\n"));
9768
10542
  }
9769
10543
  };
9770
10544
 
@@ -9809,13 +10583,13 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
9809
10583
  continue;
9810
10584
  }
9811
10585
  const currLen = payload.issues.length;
9812
- const _ = ch._zod.check(payload);
9813
- if (_ instanceof Promise && ctx?.async === false) {
10586
+ const _2 = ch._zod.check(payload);
10587
+ if (_2 instanceof Promise && ctx?.async === false) {
9814
10588
  throw new $ZodAsyncError();
9815
10589
  }
9816
- if (asyncResult || _ instanceof Promise) {
10590
+ if (asyncResult || _2 instanceof Promise) {
9817
10591
  asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
9818
- await _;
10592
+ await _2;
9819
10593
  const nextLen = payload.issues.length;
9820
10594
  if (nextLen === currLen)
9821
10595
  return;
@@ -9877,7 +10651,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
9877
10651
  try {
9878
10652
  const r = safeParse(inst, value);
9879
10653
  return r.success ? { value: r.data } : { issues: r.error?.issues };
9880
- } catch (_) {
10654
+ } catch (_2) {
9881
10655
  return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
9882
10656
  }
9883
10657
  },
@@ -9888,11 +10662,11 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
9888
10662
  var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
9889
10663
  $ZodType.init(inst, def);
9890
10664
  inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
9891
- inst._zod.parse = (payload, _) => {
10665
+ inst._zod.parse = (payload, _2) => {
9892
10666
  if (def.coerce)
9893
10667
  try {
9894
10668
  payload.value = String(payload.value);
9895
- } catch (_2) {
10669
+ } catch (_3) {
9896
10670
  }
9897
10671
  if (typeof payload.value === "string")
9898
10672
  return payload;
@@ -9977,7 +10751,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
9977
10751
  payload.value = trimmed;
9978
10752
  }
9979
10753
  return;
9980
- } catch (_) {
10754
+ } catch (_2) {
9981
10755
  payload.issues.push({
9982
10756
  code: "invalid_format",
9983
10757
  format: "url",
@@ -10123,7 +10897,7 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
10123
10897
  function isValidBase64URL(data) {
10124
10898
  if (!base64url.test(data))
10125
10899
  return false;
10126
- const base643 = data.replace(/[-_]/g, (c25) => c25 === "-" ? "+" : "/");
10900
+ const base643 = data.replace(/[-_]/g, (c26) => c26 === "-" ? "+" : "/");
10127
10901
  const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
10128
10902
  return isValidBase64(padded);
10129
10903
  }
@@ -10202,7 +10976,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
10202
10976
  if (def.coerce)
10203
10977
  try {
10204
10978
  payload.value = Number(payload.value);
10205
- } catch (_) {
10979
+ } catch (_2) {
10206
10980
  }
10207
10981
  const input = payload.value;
10208
10982
  if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
@@ -10230,7 +11004,7 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
10230
11004
  if (def.coerce)
10231
11005
  try {
10232
11006
  payload.value = Boolean(payload.value);
10233
- } catch (_) {
11007
+ } catch (_2) {
10234
11008
  }
10235
11009
  const input = payload.value;
10236
11010
  if (typeof input === "boolean")
@@ -10251,7 +11025,7 @@ var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
10251
11025
  if (def.coerce)
10252
11026
  try {
10253
11027
  payload.value = BigInt(payload.value);
10254
- } catch (_) {
11028
+ } catch (_2) {
10255
11029
  }
10256
11030
  if (typeof payload.value === "bigint")
10257
11031
  return payload;
@@ -10452,12 +11226,12 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
10452
11226
  const unrecognized = [];
10453
11227
  const keySet = def.keySet;
10454
11228
  const _catchall = def.catchall._zod;
10455
- const t = _catchall.def.type;
11229
+ const t2 = _catchall.def.type;
10456
11230
  const isOptionalOut = _catchall.optout === "optional";
10457
11231
  for (const key in input) {
10458
11232
  if (keySet.has(key))
10459
11233
  continue;
10460
- if (t === "never") {
11234
+ if (t2 === "never") {
10461
11235
  unrecognized.push(key);
10462
11236
  continue;
10463
11237
  }
@@ -10677,7 +11451,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
10677
11451
  defineLazy(inst._zod, "pattern", () => {
10678
11452
  if (def.options.every((o) => o._zod.pattern)) {
10679
11453
  const patterns = def.options.map((o) => o._zod.pattern);
10680
- return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
11454
+ return new RegExp(`^(${patterns.map((p2) => cleanRegex(p2.source)).join("|")})$`);
10681
11455
  }
10682
11456
  return void 0;
10683
11457
  });
@@ -11666,9 +12440,9 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
11666
12440
  return payload;
11667
12441
  };
11668
12442
  inst.input = (...args) => {
11669
- const F = inst.constructor;
12443
+ const F2 = inst.constructor;
11670
12444
  if (Array.isArray(args[0])) {
11671
- return new F({
12445
+ return new F2({
11672
12446
  type: "function",
11673
12447
  input: new $ZodTuple({
11674
12448
  type: "tuple",
@@ -11678,15 +12452,15 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
11678
12452
  output: inst._def.output
11679
12453
  });
11680
12454
  }
11681
- return new F({
12455
+ return new F2({
11682
12456
  type: "function",
11683
12457
  input: args[0],
11684
12458
  output: inst._def.output
11685
12459
  });
11686
12460
  };
11687
12461
  inst.output = (output) => {
11688
- const F = inst.constructor;
11689
- return new F({
12462
+ const F2 = inst.constructor;
12463
+ return new F2({
11690
12464
  type: "function",
11691
12465
  input: inst._def.input,
11692
12466
  output
@@ -11715,7 +12489,7 @@ var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
11715
12489
  var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
11716
12490
  $ZodCheck.init(inst, def);
11717
12491
  $ZodType.init(inst, def);
11718
- inst._zod.parse = (payload, _) => {
12492
+ inst._zod.parse = (payload, _2) => {
11719
12493
  return payload;
11720
12494
  };
11721
12495
  inst._zod.check = (payload) => {
@@ -13564,16 +14338,16 @@ var error16 = () => {
13564
14338
  number: { unit: "", shortLabel: "\u05E7\u05D8\u05DF", longLabel: "\u05D2\u05D3\u05D5\u05DC" }
13565
14339
  // no unit
13566
14340
  };
13567
- const typeEntry = (t) => t ? TypeNames[t] : void 0;
13568
- const typeLabel = (t) => {
13569
- const e = typeEntry(t);
14341
+ const typeEntry = (t2) => t2 ? TypeNames[t2] : void 0;
14342
+ const typeLabel = (t2) => {
14343
+ const e = typeEntry(t2);
13570
14344
  if (e)
13571
14345
  return e.label;
13572
- return t ?? TypeNames.unknown.label;
14346
+ return t2 ?? TypeNames.unknown.label;
13573
14347
  };
13574
- const withDefinite = (t) => `\u05D4${typeLabel(t)}`;
13575
- const verbFor = (t) => {
13576
- const e = typeEntry(t);
14348
+ const withDefinite = (t2) => `\u05D4${typeLabel(t2)}`;
14349
+ const verbFor = (t2) => {
14350
+ const e = typeEntry(t2);
13577
14351
  const gender = e?.gender ?? "m";
13578
14352
  return gender === "f" ? "\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA" : "\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA";
13579
14353
  };
@@ -13657,11 +14431,11 @@ var error16 = () => {
13657
14431
  return `\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${subject} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${comparison}`.trim();
13658
14432
  }
13659
14433
  const adj = issue2.inclusive ? "<=" : "<";
13660
- const be = verbFor(issue2.origin ?? "value");
14434
+ const be2 = verbFor(issue2.origin ?? "value");
13661
14435
  if (sizing?.unit) {
13662
- return `${sizing.longLabel} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.maximum.toString()} ${sizing.unit}`;
14436
+ return `${sizing.longLabel} \u05DE\u05D3\u05D9: ${subject} ${be2} ${adj}${issue2.maximum.toString()} ${sizing.unit}`;
13663
14437
  }
13664
- return `${sizing?.longLabel ?? "\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.maximum.toString()}`;
14438
+ return `${sizing?.longLabel ?? "\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${subject} ${be2} ${adj}${issue2.maximum.toString()}`;
13665
14439
  }
13666
14440
  case "too_small": {
13667
14441
  const sizing = getSizing(issue2.origin);
@@ -13683,11 +14457,11 @@ var error16 = () => {
13683
14457
  return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${comparison}`.trim();
13684
14458
  }
13685
14459
  const adj = issue2.inclusive ? ">=" : ">";
13686
- const be = verbFor(issue2.origin ?? "value");
14460
+ const be2 = verbFor(issue2.origin ?? "value");
13687
14461
  if (sizing?.unit) {
13688
- return `${sizing.shortLabel} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
14462
+ return `${sizing.shortLabel} \u05DE\u05D3\u05D9: ${subject} ${be2} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
13689
14463
  }
13690
- return `${sizing?.shortLabel ?? "\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.minimum.toString()}`;
14464
+ return `${sizing?.shortLabel ?? "\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${subject} ${be2} ${adj}${issue2.minimum.toString()}`;
13691
14465
  }
13692
14466
  case "invalid_format": {
13693
14467
  const _issue = issue2;
@@ -17354,9 +18128,9 @@ var $ZodRegistry = class {
17354
18128
  return this;
17355
18129
  }
17356
18130
  get(schema) {
17357
- const p = schema._zod.parent;
17358
- if (p) {
17359
- const pm = { ...this.get(p) ?? {} };
18131
+ const p2 = schema._zod.parent;
18132
+ if (p2) {
18133
+ const pm = { ...this.get(p2) ?? {} };
17360
18134
  delete pm.id;
17361
18135
  const f = { ...pm, ...this._map.get(schema) };
17362
18136
  return Object.keys(f).length ? f : void 0;
@@ -19286,7 +20060,7 @@ function toJSONSchema(input, params) {
19286
20060
  const ctx2 = initializeContext({ ...params, processors: allProcessors });
19287
20061
  const defs = {};
19288
20062
  for (const entry of registry2._idmap.entries()) {
19289
- const [_, schema] = entry;
20063
+ const [_2, schema] = entry;
19290
20064
  process2(schema, ctx2);
19291
20065
  }
19292
20066
  const schemas = {};
@@ -19385,7 +20159,7 @@ var JSONSchemaGenerator = class {
19385
20159
  }
19386
20160
  extractDefs(this.ctx, schema);
19387
20161
  const result = finalize(this.ctx, schema);
19388
- const { "~standard": _, ...plainResult } = result;
20162
+ const { "~standard": _2, ...plainResult } = result;
19389
20163
  return plainResult;
19390
20164
  }
19391
20165
  };
@@ -20167,9 +20941,9 @@ var ZodDate2 = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
20167
20941
  inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params);
20168
20942
  inst.min = (value, params) => inst.check(_gte(value, params));
20169
20943
  inst.max = (value, params) => inst.check(_lte(value, params));
20170
- const c25 = inst._zod.bag;
20171
- inst.minDate = c25.minimum ? new Date(c25.minimum) : null;
20172
- inst.maxDate = c25.maximum ? new Date(c25.maximum) : null;
20944
+ const c26 = inst._zod.bag;
20945
+ inst.minDate = c26.minimum ? new Date(c26.minimum) : null;
20946
+ inst.maxDate = c26.maximum ? new Date(c26.maximum) : null;
20173
20947
  });
20174
20948
  function date3(params) {
20175
20949
  return _date(ZodDate2, params);
@@ -20797,7 +21571,7 @@ var ZodFirstPartyTypeKind2;
20797
21571
  })(ZodFirstPartyTypeKind2 || (ZodFirstPartyTypeKind2 = {}));
20798
21572
 
20799
21573
  // ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js
20800
- var z2 = {
21574
+ var z4 = {
20801
21575
  ...schemas_exports2,
20802
21576
  ...checks_exports2,
20803
21577
  iso: iso_exports
@@ -20907,7 +21681,7 @@ function resolveRef(ref, ctx) {
20907
21681
  function convertBaseSchema(schema, ctx) {
20908
21682
  if (schema.not !== void 0) {
20909
21683
  if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
20910
- return z2.never();
21684
+ return z4.never();
20911
21685
  }
20912
21686
  throw new Error("not is not supported in Zod (except { not: {} } for never)");
20913
21687
  }
@@ -20929,7 +21703,7 @@ function convertBaseSchema(schema, ctx) {
20929
21703
  return ctx.refs.get(refPath);
20930
21704
  }
20931
21705
  if (ctx.processing.has(refPath)) {
20932
- return z2.lazy(() => {
21706
+ return z4.lazy(() => {
20933
21707
  if (!ctx.refs.has(refPath)) {
20934
21708
  throw new Error(`Circular reference not resolved: ${refPath}`);
20935
21709
  }
@@ -20946,95 +21720,95 @@ function convertBaseSchema(schema, ctx) {
20946
21720
  if (schema.enum !== void 0) {
20947
21721
  const enumValues = schema.enum;
20948
21722
  if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
20949
- return z2.null();
21723
+ return z4.null();
20950
21724
  }
20951
21725
  if (enumValues.length === 0) {
20952
- return z2.never();
21726
+ return z4.never();
20953
21727
  }
20954
21728
  if (enumValues.length === 1) {
20955
- return z2.literal(enumValues[0]);
21729
+ return z4.literal(enumValues[0]);
20956
21730
  }
20957
21731
  if (enumValues.every((v) => typeof v === "string")) {
20958
- return z2.enum(enumValues);
21732
+ return z4.enum(enumValues);
20959
21733
  }
20960
- const literalSchemas = enumValues.map((v) => z2.literal(v));
21734
+ const literalSchemas = enumValues.map((v) => z4.literal(v));
20961
21735
  if (literalSchemas.length < 2) {
20962
21736
  return literalSchemas[0];
20963
21737
  }
20964
- return z2.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
21738
+ return z4.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
20965
21739
  }
20966
21740
  if (schema.const !== void 0) {
20967
- return z2.literal(schema.const);
21741
+ return z4.literal(schema.const);
20968
21742
  }
20969
21743
  const type = schema.type;
20970
21744
  if (Array.isArray(type)) {
20971
- const typeSchemas = type.map((t) => {
20972
- const typeSchema = { ...schema, type: t };
21745
+ const typeSchemas = type.map((t2) => {
21746
+ const typeSchema = { ...schema, type: t2 };
20973
21747
  return convertBaseSchema(typeSchema, ctx);
20974
21748
  });
20975
21749
  if (typeSchemas.length === 0) {
20976
- return z2.never();
21750
+ return z4.never();
20977
21751
  }
20978
21752
  if (typeSchemas.length === 1) {
20979
21753
  return typeSchemas[0];
20980
21754
  }
20981
- return z2.union(typeSchemas);
21755
+ return z4.union(typeSchemas);
20982
21756
  }
20983
21757
  if (!type) {
20984
- return z2.any();
21758
+ return z4.any();
20985
21759
  }
20986
21760
  let zodSchema;
20987
21761
  switch (type) {
20988
21762
  case "string": {
20989
- let stringSchema = z2.string();
21763
+ let stringSchema = z4.string();
20990
21764
  if (schema.format) {
20991
21765
  const format = schema.format;
20992
21766
  if (format === "email") {
20993
- stringSchema = stringSchema.check(z2.email());
21767
+ stringSchema = stringSchema.check(z4.email());
20994
21768
  } else if (format === "uri" || format === "uri-reference") {
20995
- stringSchema = stringSchema.check(z2.url());
21769
+ stringSchema = stringSchema.check(z4.url());
20996
21770
  } else if (format === "uuid" || format === "guid") {
20997
- stringSchema = stringSchema.check(z2.uuid());
21771
+ stringSchema = stringSchema.check(z4.uuid());
20998
21772
  } else if (format === "date-time") {
20999
- stringSchema = stringSchema.check(z2.iso.datetime());
21773
+ stringSchema = stringSchema.check(z4.iso.datetime());
21000
21774
  } else if (format === "date") {
21001
- stringSchema = stringSchema.check(z2.iso.date());
21775
+ stringSchema = stringSchema.check(z4.iso.date());
21002
21776
  } else if (format === "time") {
21003
- stringSchema = stringSchema.check(z2.iso.time());
21777
+ stringSchema = stringSchema.check(z4.iso.time());
21004
21778
  } else if (format === "duration") {
21005
- stringSchema = stringSchema.check(z2.iso.duration());
21779
+ stringSchema = stringSchema.check(z4.iso.duration());
21006
21780
  } else if (format === "ipv4") {
21007
- stringSchema = stringSchema.check(z2.ipv4());
21781
+ stringSchema = stringSchema.check(z4.ipv4());
21008
21782
  } else if (format === "ipv6") {
21009
- stringSchema = stringSchema.check(z2.ipv6());
21783
+ stringSchema = stringSchema.check(z4.ipv6());
21010
21784
  } else if (format === "mac") {
21011
- stringSchema = stringSchema.check(z2.mac());
21785
+ stringSchema = stringSchema.check(z4.mac());
21012
21786
  } else if (format === "cidr") {
21013
- stringSchema = stringSchema.check(z2.cidrv4());
21787
+ stringSchema = stringSchema.check(z4.cidrv4());
21014
21788
  } else if (format === "cidr-v6") {
21015
- stringSchema = stringSchema.check(z2.cidrv6());
21789
+ stringSchema = stringSchema.check(z4.cidrv6());
21016
21790
  } else if (format === "base64") {
21017
- stringSchema = stringSchema.check(z2.base64());
21791
+ stringSchema = stringSchema.check(z4.base64());
21018
21792
  } else if (format === "base64url") {
21019
- stringSchema = stringSchema.check(z2.base64url());
21793
+ stringSchema = stringSchema.check(z4.base64url());
21020
21794
  } else if (format === "e164") {
21021
- stringSchema = stringSchema.check(z2.e164());
21795
+ stringSchema = stringSchema.check(z4.e164());
21022
21796
  } else if (format === "jwt") {
21023
- stringSchema = stringSchema.check(z2.jwt());
21797
+ stringSchema = stringSchema.check(z4.jwt());
21024
21798
  } else if (format === "emoji") {
21025
- stringSchema = stringSchema.check(z2.emoji());
21799
+ stringSchema = stringSchema.check(z4.emoji());
21026
21800
  } else if (format === "nanoid") {
21027
- stringSchema = stringSchema.check(z2.nanoid());
21801
+ stringSchema = stringSchema.check(z4.nanoid());
21028
21802
  } else if (format === "cuid") {
21029
- stringSchema = stringSchema.check(z2.cuid());
21803
+ stringSchema = stringSchema.check(z4.cuid());
21030
21804
  } else if (format === "cuid2") {
21031
- stringSchema = stringSchema.check(z2.cuid2());
21805
+ stringSchema = stringSchema.check(z4.cuid2());
21032
21806
  } else if (format === "ulid") {
21033
- stringSchema = stringSchema.check(z2.ulid());
21807
+ stringSchema = stringSchema.check(z4.ulid());
21034
21808
  } else if (format === "xid") {
21035
- stringSchema = stringSchema.check(z2.xid());
21809
+ stringSchema = stringSchema.check(z4.xid());
21036
21810
  } else if (format === "ksuid") {
21037
- stringSchema = stringSchema.check(z2.ksuid());
21811
+ stringSchema = stringSchema.check(z4.ksuid());
21038
21812
  }
21039
21813
  }
21040
21814
  if (typeof schema.minLength === "number") {
@@ -21051,7 +21825,7 @@ function convertBaseSchema(schema, ctx) {
21051
21825
  }
21052
21826
  case "number":
21053
21827
  case "integer": {
21054
- let numberSchema = type === "integer" ? z2.number().int() : z2.number();
21828
+ let numberSchema = type === "integer" ? z4.number().int() : z4.number();
21055
21829
  if (typeof schema.minimum === "number") {
21056
21830
  numberSchema = numberSchema.min(schema.minimum);
21057
21831
  }
@@ -21075,11 +21849,11 @@ function convertBaseSchema(schema, ctx) {
21075
21849
  break;
21076
21850
  }
21077
21851
  case "boolean": {
21078
- zodSchema = z2.boolean();
21852
+ zodSchema = z4.boolean();
21079
21853
  break;
21080
21854
  }
21081
21855
  case "null": {
21082
- zodSchema = z2.null();
21856
+ zodSchema = z4.null();
21083
21857
  break;
21084
21858
  }
21085
21859
  case "object": {
@@ -21092,14 +21866,14 @@ function convertBaseSchema(schema, ctx) {
21092
21866
  }
21093
21867
  if (schema.propertyNames) {
21094
21868
  const keySchema = convertSchema(schema.propertyNames, ctx);
21095
- const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z2.any();
21869
+ const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z4.any();
21096
21870
  if (Object.keys(shape).length === 0) {
21097
- zodSchema = z2.record(keySchema, valueSchema);
21871
+ zodSchema = z4.record(keySchema, valueSchema);
21098
21872
  break;
21099
21873
  }
21100
- const objectSchema2 = z2.object(shape).passthrough();
21101
- const recordSchema = z2.looseRecord(keySchema, valueSchema);
21102
- zodSchema = z2.intersection(objectSchema2, recordSchema);
21874
+ const objectSchema2 = z4.object(shape).passthrough();
21875
+ const recordSchema = z4.looseRecord(keySchema, valueSchema);
21876
+ zodSchema = z4.intersection(objectSchema2, recordSchema);
21103
21877
  break;
21104
21878
  }
21105
21879
  if (schema.patternProperties) {
@@ -21108,28 +21882,28 @@ function convertBaseSchema(schema, ctx) {
21108
21882
  const looseRecords = [];
21109
21883
  for (const pattern of patternKeys) {
21110
21884
  const patternValue = convertSchema(patternProps[pattern], ctx);
21111
- const keySchema = z2.string().regex(new RegExp(pattern));
21112
- looseRecords.push(z2.looseRecord(keySchema, patternValue));
21885
+ const keySchema = z4.string().regex(new RegExp(pattern));
21886
+ looseRecords.push(z4.looseRecord(keySchema, patternValue));
21113
21887
  }
21114
21888
  const schemasToIntersect = [];
21115
21889
  if (Object.keys(shape).length > 0) {
21116
- schemasToIntersect.push(z2.object(shape).passthrough());
21890
+ schemasToIntersect.push(z4.object(shape).passthrough());
21117
21891
  }
21118
21892
  schemasToIntersect.push(...looseRecords);
21119
21893
  if (schemasToIntersect.length === 0) {
21120
- zodSchema = z2.object({}).passthrough();
21894
+ zodSchema = z4.object({}).passthrough();
21121
21895
  } else if (schemasToIntersect.length === 1) {
21122
21896
  zodSchema = schemasToIntersect[0];
21123
21897
  } else {
21124
- let result = z2.intersection(schemasToIntersect[0], schemasToIntersect[1]);
21898
+ let result = z4.intersection(schemasToIntersect[0], schemasToIntersect[1]);
21125
21899
  for (let i = 2; i < schemasToIntersect.length; i++) {
21126
- result = z2.intersection(result, schemasToIntersect[i]);
21900
+ result = z4.intersection(result, schemasToIntersect[i]);
21127
21901
  }
21128
21902
  zodSchema = result;
21129
21903
  }
21130
21904
  break;
21131
21905
  }
21132
- const objectSchema = z2.object(shape);
21906
+ const objectSchema = z4.object(shape);
21133
21907
  if (schema.additionalProperties === false) {
21134
21908
  zodSchema = objectSchema.strict();
21135
21909
  } else if (typeof schema.additionalProperties === "object") {
@@ -21146,33 +21920,33 @@ function convertBaseSchema(schema, ctx) {
21146
21920
  const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
21147
21921
  const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
21148
21922
  if (rest) {
21149
- zodSchema = z2.tuple(tupleItems).rest(rest);
21923
+ zodSchema = z4.tuple(tupleItems).rest(rest);
21150
21924
  } else {
21151
- zodSchema = z2.tuple(tupleItems);
21925
+ zodSchema = z4.tuple(tupleItems);
21152
21926
  }
21153
21927
  if (typeof schema.minItems === "number") {
21154
- zodSchema = zodSchema.check(z2.minLength(schema.minItems));
21928
+ zodSchema = zodSchema.check(z4.minLength(schema.minItems));
21155
21929
  }
21156
21930
  if (typeof schema.maxItems === "number") {
21157
- zodSchema = zodSchema.check(z2.maxLength(schema.maxItems));
21931
+ zodSchema = zodSchema.check(z4.maxLength(schema.maxItems));
21158
21932
  }
21159
21933
  } else if (Array.isArray(items)) {
21160
21934
  const tupleItems = items.map((item) => convertSchema(item, ctx));
21161
21935
  const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
21162
21936
  if (rest) {
21163
- zodSchema = z2.tuple(tupleItems).rest(rest);
21937
+ zodSchema = z4.tuple(tupleItems).rest(rest);
21164
21938
  } else {
21165
- zodSchema = z2.tuple(tupleItems);
21939
+ zodSchema = z4.tuple(tupleItems);
21166
21940
  }
21167
21941
  if (typeof schema.minItems === "number") {
21168
- zodSchema = zodSchema.check(z2.minLength(schema.minItems));
21942
+ zodSchema = zodSchema.check(z4.minLength(schema.minItems));
21169
21943
  }
21170
21944
  if (typeof schema.maxItems === "number") {
21171
- zodSchema = zodSchema.check(z2.maxLength(schema.maxItems));
21945
+ zodSchema = zodSchema.check(z4.maxLength(schema.maxItems));
21172
21946
  }
21173
21947
  } else if (items !== void 0) {
21174
21948
  const element = convertSchema(items, ctx);
21175
- let arraySchema = z2.array(element);
21949
+ let arraySchema = z4.array(element);
21176
21950
  if (typeof schema.minItems === "number") {
21177
21951
  arraySchema = arraySchema.min(schema.minItems);
21178
21952
  }
@@ -21181,7 +21955,7 @@ function convertBaseSchema(schema, ctx) {
21181
21955
  }
21182
21956
  zodSchema = arraySchema;
21183
21957
  } else {
21184
- zodSchema = z2.array(z2.any());
21958
+ zodSchema = z4.array(z4.any());
21185
21959
  }
21186
21960
  break;
21187
21961
  }
@@ -21198,37 +21972,37 @@ function convertBaseSchema(schema, ctx) {
21198
21972
  }
21199
21973
  function convertSchema(schema, ctx) {
21200
21974
  if (typeof schema === "boolean") {
21201
- return schema ? z2.any() : z2.never();
21975
+ return schema ? z4.any() : z4.never();
21202
21976
  }
21203
21977
  let baseSchema = convertBaseSchema(schema, ctx);
21204
21978
  const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
21205
21979
  if (schema.anyOf && Array.isArray(schema.anyOf)) {
21206
21980
  const options = schema.anyOf.map((s) => convertSchema(s, ctx));
21207
- const anyOfUnion = z2.union(options);
21208
- baseSchema = hasExplicitType ? z2.intersection(baseSchema, anyOfUnion) : anyOfUnion;
21981
+ const anyOfUnion = z4.union(options);
21982
+ baseSchema = hasExplicitType ? z4.intersection(baseSchema, anyOfUnion) : anyOfUnion;
21209
21983
  }
21210
21984
  if (schema.oneOf && Array.isArray(schema.oneOf)) {
21211
21985
  const options = schema.oneOf.map((s) => convertSchema(s, ctx));
21212
- const oneOfUnion = z2.xor(options);
21213
- baseSchema = hasExplicitType ? z2.intersection(baseSchema, oneOfUnion) : oneOfUnion;
21986
+ const oneOfUnion = z4.xor(options);
21987
+ baseSchema = hasExplicitType ? z4.intersection(baseSchema, oneOfUnion) : oneOfUnion;
21214
21988
  }
21215
21989
  if (schema.allOf && Array.isArray(schema.allOf)) {
21216
21990
  if (schema.allOf.length === 0) {
21217
- baseSchema = hasExplicitType ? baseSchema : z2.any();
21991
+ baseSchema = hasExplicitType ? baseSchema : z4.any();
21218
21992
  } else {
21219
21993
  let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
21220
21994
  const startIdx = hasExplicitType ? 0 : 1;
21221
21995
  for (let i = startIdx; i < schema.allOf.length; i++) {
21222
- result = z2.intersection(result, convertSchema(schema.allOf[i], ctx));
21996
+ result = z4.intersection(result, convertSchema(schema.allOf[i], ctx));
21223
21997
  }
21224
21998
  baseSchema = result;
21225
21999
  }
21226
22000
  }
21227
22001
  if (schema.nullable === true && ctx.version === "openapi-3.0") {
21228
- baseSchema = z2.nullable(baseSchema);
22002
+ baseSchema = z4.nullable(baseSchema);
21229
22003
  }
21230
22004
  if (schema.readOnly === true) {
21231
- baseSchema = z2.readonly(baseSchema);
22005
+ baseSchema = z4.readonly(baseSchema);
21232
22006
  }
21233
22007
  const extraMeta = {};
21234
22008
  const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
@@ -21255,7 +22029,7 @@ function convertSchema(schema, ctx) {
21255
22029
  }
21256
22030
  function fromJSONSchema(schema, params) {
21257
22031
  if (typeof schema === "boolean") {
21258
- return schema ? z2.any() : z2.never();
22032
+ return schema ? z4.any() : z4.never();
21259
22033
  }
21260
22034
  const version2 = detectVersion(schema, params?.defaultTarget);
21261
22035
  const defs = schema.$defs || schema.definitions || {};
@@ -21324,8 +22098,8 @@ var DeleteResponseSchema = external_exports.object({
21324
22098
  });
21325
22099
 
21326
22100
  // ../../packages/api-contracts/src/contracts/v1/admin.ts
21327
- var c = initContract();
21328
- var adminContract = c.router({
22101
+ var c2 = initContract();
22102
+ var adminContract = c2.router({
21329
22103
  approveCheckRun: {
21330
22104
  method: "POST",
21331
22105
  path: "/organizations/:organizationId/admin/check-runs/approve",
@@ -21397,8 +22171,8 @@ var ListChatSessionsResponseSchema = external_exports.object({
21397
22171
  });
21398
22172
 
21399
22173
  // ../../packages/api-contracts/src/contracts/v1/chat-session.ts
21400
- var c2 = initContract();
21401
- var chatSessionContract = c2.router({
22174
+ var c3 = initContract();
22175
+ var chatSessionContract = c3.router({
21402
22176
  createSession: {
21403
22177
  method: "POST",
21404
22178
  path: "/organizations/:organizationId/chat/sessions",
@@ -21679,8 +22453,8 @@ var DependencySummaryResponseSchema = external_exports.object({
21679
22453
  });
21680
22454
 
21681
22455
  // ../../packages/api-contracts/src/contracts/v1/dependency.ts
21682
- var c3 = initContract();
21683
- var dependencyContract = c3.router({
22456
+ var c4 = initContract();
22457
+ var dependencyContract = c4.router({
21684
22458
  /** Cross-repo dependency search. Two-phase: pg_trgm on Package, then join repos. */
21685
22459
  searchDependencies: {
21686
22460
  method: "POST",
@@ -21825,8 +22599,8 @@ var DockerScoutIntegrationResponseSchema = external_exports.object({
21825
22599
  });
21826
22600
 
21827
22601
  // ../../packages/api-contracts/src/contracts/v1/docker-scout-integration.ts
21828
- var c4 = initContract();
21829
- var dockerScoutIntegrationContract = c4.router({
22602
+ var c5 = initContract();
22603
+ var dockerScoutIntegrationContract = c5.router({
21830
22604
  createDockerScoutIntegration: {
21831
22605
  method: "POST",
21832
22606
  path: "/organizations/:organizationId/docker-scout-integration",
@@ -21923,8 +22697,8 @@ var GitHubRepoSchema = external_exports.object({
21923
22697
  var ListGitHubInstallationReposResponseSchema = external_exports.array(GitHubRepoSchema);
21924
22698
 
21925
22699
  // ../../packages/api-contracts/src/contracts/v1/github.ts
21926
- var c5 = initContract();
21927
- var githubCallbackContract = c5.router(
22700
+ var c6 = initContract();
22701
+ var githubCallbackContract = c6.router(
21928
22702
  {
21929
22703
  handleCallback: {
21930
22704
  method: "POST",
@@ -21944,7 +22718,7 @@ var githubCallbackContract = c5.router(
21944
22718
  pathPrefix: "/v1/github"
21945
22719
  }
21946
22720
  );
21947
- var githubContract = c5.router({
22721
+ var githubContract = c6.router({
21948
22722
  generateInstallLink: {
21949
22723
  method: "POST",
21950
22724
  path: "/organizations/:organizationId/github/install-link",
@@ -22014,8 +22788,8 @@ var UpdateKnowledgeBaseResponseSchema = external_exports.object({
22014
22788
  });
22015
22789
 
22016
22790
  // ../../packages/api-contracts/src/contracts/v1/knowledge-base.ts
22017
- var c6 = initContract();
22018
- var knowledgeBaseContract = c6.router({
22791
+ var c7 = initContract();
22792
+ var knowledgeBaseContract = c7.router({
22019
22793
  getKnowledgeBase: {
22020
22794
  method: "GET",
22021
22795
  path: "/organizations/:organizationId/knowledge-base",
@@ -22236,8 +23010,8 @@ var UpdateRepoDocumentContentResponseSchema = external_exports.object({
22236
23010
  });
22237
23011
 
22238
23012
  // ../../packages/api-contracts/src/contracts/v1/knowledge-document.ts
22239
- var c7 = initContract();
22240
- var knowledgeDocumentContract = c7.router({
23013
+ var c8 = initContract();
23014
+ var knowledgeDocumentContract = c8.router({
22241
23015
  createDocument: {
22242
23016
  method: "POST",
22243
23017
  path: "/organizations/:organizationId/knowledge-documents",
@@ -22546,8 +23320,8 @@ var LlmProviderKeyResponseSchema = external_exports.object({
22546
23320
  var ListLlmProviderKeysResponseSchema = external_exports.array(LlmProviderKeyResponseSchema);
22547
23321
 
22548
23322
  // ../../packages/api-contracts/src/contracts/v1/llm-provider-key.ts
22549
- var c8 = initContract();
22550
- var llmProviderKeyContract = c8.router({
23323
+ var c9 = initContract();
23324
+ var llmProviderKeyContract = c9.router({
22551
23325
  createLlmProviderKey: {
22552
23326
  method: "POST",
22553
23327
  path: "/organizations/:organizationId/llm-provider-keys",
@@ -22663,8 +23437,8 @@ var LogoDeleteRequestSchema = external_exports.object({
22663
23437
  });
22664
23438
 
22665
23439
  // ../../packages/api-contracts/src/contracts/v1/organization.ts
22666
- var c9 = initContract();
22667
- var organizationContract = c9.router({
23440
+ var c10 = initContract();
23441
+ var organizationContract = c10.router({
22668
23442
  listOrganizations: {
22669
23443
  method: "GET",
22670
23444
  path: "/organizations",
@@ -22826,8 +23600,8 @@ var UpdatePentestRequestSchema = external_exports.object({
22826
23600
  });
22827
23601
 
22828
23602
  // ../../packages/api-contracts/src/contracts/v1/pentest.ts
22829
- var c10 = initContract();
22830
- var pentestContract = c10.router({
23603
+ var c11 = initContract();
23604
+ var pentestContract = c11.router({
22831
23605
  listPentests: {
22832
23606
  method: "GET",
22833
23607
  path: "/organizations/:organizationId/pentests",
@@ -23085,8 +23859,8 @@ var GetParseTaskStatusResponseSchema = external_exports.object({
23085
23859
  });
23086
23860
 
23087
23861
  // ../../packages/api-contracts/src/contracts/v1/pentest-finding.ts
23088
- var c11 = initContract();
23089
- var pentestFindingContract = c11.router({
23862
+ var c12 = initContract();
23863
+ var pentestFindingContract = c12.router({
23090
23864
  // ─── Findings ───
23091
23865
  listFindings: {
23092
23866
  method: "GET",
@@ -23356,8 +24130,8 @@ var CloneTokenResponseSchema = external_exports.object({
23356
24130
  });
23357
24131
 
23358
24132
  // ../../packages/api-contracts/src/contracts/v1/repository.ts
23359
- var c12 = initContract();
23360
- var repositoryContract = c12.router({
24133
+ var c13 = initContract();
24134
+ var repositoryContract = c13.router({
23361
24135
  createRepository: {
23362
24136
  method: "POST",
23363
24137
  path: "/organizations/:organizationId/repositories",
@@ -23555,8 +24329,8 @@ var ListScanLogsResponseSchema = external_exports.object({
23555
24329
  });
23556
24330
 
23557
24331
  // ../../packages/api-contracts/src/contracts/v1/scan.ts
23558
- var c13 = initContract();
23559
- var scanContract = c13.router({
24332
+ var c14 = initContract();
24333
+ var scanContract = c14.router({
23560
24334
  createScan: {
23561
24335
  method: "POST",
23562
24336
  path: "/organizations/:organizationId/scans",
@@ -23661,8 +24435,8 @@ var UserResponseSchema = external_exports.object({
23661
24435
  var ListUsersResponseSchema = external_exports.array(UserResponseSchema);
23662
24436
 
23663
24437
  // ../../packages/api-contracts/src/contracts/v1/user.ts
23664
- var c14 = initContract();
23665
- var userContract = c14.router({
24438
+ var c15 = initContract();
24439
+ var userContract = c15.router({
23666
24440
  listUsers: {
23667
24441
  method: "GET",
23668
24442
  path: "/organizations/:organizationId/users",
@@ -23734,8 +24508,8 @@ var VantaIntegrationResponseSchema = external_exports.object({
23734
24508
  });
23735
24509
 
23736
24510
  // ../../packages/api-contracts/src/contracts/v1/vanta-integration.ts
23737
- var c15 = initContract();
23738
- var vantaIntegrationContract = c15.router({
24511
+ var c16 = initContract();
24512
+ var vantaIntegrationContract = c16.router({
23739
24513
  createVantaIntegration: {
23740
24514
  method: "POST",
23741
24515
  path: "/organizations/:organizationId/vanta-integration",
@@ -23977,8 +24751,8 @@ var BulkUpdateVulnerabilitiesResponseSchema = external_exports.object({
23977
24751
  });
23978
24752
 
23979
24753
  // ../../packages/api-contracts/src/contracts/v1/vulnerability.ts
23980
- var c16 = initContract();
23981
- var vulnerabilityContract = c16.router({
24754
+ var c17 = initContract();
24755
+ var vulnerabilityContract = c17.router({
23982
24756
  filterVulnerabilities: {
23983
24757
  method: "POST",
23984
24758
  path: "/organizations/:organizationId/vulnerabilities/filter",
@@ -24137,8 +24911,8 @@ var UpdateVulnerabilityNoteRequestSchema = external_exports.object({
24137
24911
  });
24138
24912
 
24139
24913
  // ../../packages/api-contracts/src/contracts/v1/vulnerability-note.ts
24140
- var c17 = initContract();
24141
- var vulnerabilityNoteContract = c17.router({
24914
+ var c18 = initContract();
24915
+ var vulnerabilityNoteContract = c18.router({
24142
24916
  listNotes: {
24143
24917
  method: "GET",
24144
24918
  path: "/organizations/:organizationId/vulnerabilities/:vulnerabilityId/notes",
@@ -24210,8 +24984,8 @@ var WebApplicationResponseSchema = external_exports.object({
24210
24984
  var ListWebApplicationsResponseSchema = external_exports.array(WebApplicationResponseSchema);
24211
24985
 
24212
24986
  // ../../packages/api-contracts/src/contracts/v1/web-application.ts
24213
- var c18 = initContract();
24214
- var webApplicationContract = c18.router({
24987
+ var c19 = initContract();
24988
+ var webApplicationContract = c19.router({
24215
24989
  listWebApplications: {
24216
24990
  method: "GET",
24217
24991
  path: "/organizations/:organizationId/web-applications",
@@ -24350,8 +25124,8 @@ var ListWebhookDeliveriesResponseSchema = external_exports.object({
24350
25124
  });
24351
25125
 
24352
25126
  // ../../packages/api-contracts/src/contracts/v1/webhook-settings.ts
24353
- var c19 = initContract();
24354
- var webhookSettingsContract = c19.router({
25127
+ var c20 = initContract();
25128
+ var webhookSettingsContract = c20.router({
24355
25129
  listWebhookEndpoints: {
24356
25130
  method: "GET",
24357
25131
  path: "/organizations/:organizationId/webhook-settings/endpoints",
@@ -24489,8 +25263,8 @@ var webhookSettingsContract = c19.router({
24489
25263
  });
24490
25264
 
24491
25265
  // ../../packages/api-contracts/src/contracts/v1/index.ts
24492
- var c20 = initContract();
24493
- var v1Contract = c20.router(
25266
+ var c21 = initContract();
25267
+ var v1Contract = c21.router(
24494
25268
  {
24495
25269
  admin: adminContract,
24496
25270
  scan: scanContract,
@@ -24518,8 +25292,8 @@ var v1Contract = c20.router(
24518
25292
  );
24519
25293
 
24520
25294
  // ../../packages/api-contracts/src/contracts/index.ts
24521
- var c21 = initContract();
24522
- var contract = c21.router({
25295
+ var c22 = initContract();
25296
+ var contract = c22.router({
24523
25297
  v1: v1Contract
24524
25298
  });
24525
25299
 
@@ -24529,8 +25303,8 @@ var GitHubWebhookResponseSchema = external_exports.object({
24529
25303
  });
24530
25304
 
24531
25305
  // ../../packages/api-contracts/src/contracts/webhooks/github.ts
24532
- var c22 = initContract();
24533
- var githubWebhookContract = c22.router(
25306
+ var c23 = initContract();
25307
+ var githubWebhookContract = c23.router(
24534
25308
  {
24535
25309
  handleWebhook: {
24536
25310
  method: "POST",
@@ -24555,8 +25329,8 @@ var HealthResponseSchema = external_exports.object({
24555
25329
  });
24556
25330
 
24557
25331
  // ../../packages/api-contracts/src/contracts/health.ts
24558
- var c23 = initContract();
24559
- var healthContract = c23.router({
25332
+ var c24 = initContract();
25333
+ var healthContract = c24.router({
24560
25334
  getHealth: {
24561
25335
  method: "GET",
24562
25336
  path: "/health",
@@ -24605,8 +25379,8 @@ var UpdatePrVulnerabilityRequestSchema = external_exports.object({
24605
25379
  });
24606
25380
 
24607
25381
  // ../../packages/api-contracts/src/contracts/v1/pr-vulnerability.ts
24608
- var c24 = initContract();
24609
- var prVulnerabilityContract = c24.router(
25382
+ var c25 = initContract();
25383
+ var prVulnerabilityContract = c25.router(
24610
25384
  {
24611
25385
  listPrVulnerabilities: {
24612
25386
  method: "GET",
@@ -24759,6 +25533,9 @@ function getRefreshTokenPath() {
24759
25533
  function getSelectedOrganizationPath() {
24760
25534
  return join(resolveTraceDir(), SELECTED_ORGANIZATION_FILENAME);
24761
25535
  }
25536
+ function getTraceDir() {
25537
+ return resolveTraceDir();
25538
+ }
24762
25539
  function readToken() {
24763
25540
  const tokenPath = getTokenPath();
24764
25541
  try {
@@ -25108,6 +25885,540 @@ function tsvSafe(value) {
25108
25885
  return (value ?? "").replace(/[\t\r\n]/g, " ");
25109
25886
  }
25110
25887
 
25888
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
25889
+ var ANSI_BACKGROUND_OFFSET = 10;
25890
+ var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
25891
+ var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
25892
+ var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
25893
+ var styles = {
25894
+ modifier: {
25895
+ reset: [0, 0],
25896
+ // 21 isn't widely supported and 22 does the same thing
25897
+ bold: [1, 22],
25898
+ dim: [2, 22],
25899
+ italic: [3, 23],
25900
+ underline: [4, 24],
25901
+ overline: [53, 55],
25902
+ inverse: [7, 27],
25903
+ hidden: [8, 28],
25904
+ strikethrough: [9, 29]
25905
+ },
25906
+ color: {
25907
+ black: [30, 39],
25908
+ red: [31, 39],
25909
+ green: [32, 39],
25910
+ yellow: [33, 39],
25911
+ blue: [34, 39],
25912
+ magenta: [35, 39],
25913
+ cyan: [36, 39],
25914
+ white: [37, 39],
25915
+ // Bright color
25916
+ blackBright: [90, 39],
25917
+ gray: [90, 39],
25918
+ // Alias of `blackBright`
25919
+ grey: [90, 39],
25920
+ // Alias of `blackBright`
25921
+ redBright: [91, 39],
25922
+ greenBright: [92, 39],
25923
+ yellowBright: [93, 39],
25924
+ blueBright: [94, 39],
25925
+ magentaBright: [95, 39],
25926
+ cyanBright: [96, 39],
25927
+ whiteBright: [97, 39]
25928
+ },
25929
+ bgColor: {
25930
+ bgBlack: [40, 49],
25931
+ bgRed: [41, 49],
25932
+ bgGreen: [42, 49],
25933
+ bgYellow: [43, 49],
25934
+ bgBlue: [44, 49],
25935
+ bgMagenta: [45, 49],
25936
+ bgCyan: [46, 49],
25937
+ bgWhite: [47, 49],
25938
+ // Bright color
25939
+ bgBlackBright: [100, 49],
25940
+ bgGray: [100, 49],
25941
+ // Alias of `bgBlackBright`
25942
+ bgGrey: [100, 49],
25943
+ // Alias of `bgBlackBright`
25944
+ bgRedBright: [101, 49],
25945
+ bgGreenBright: [102, 49],
25946
+ bgYellowBright: [103, 49],
25947
+ bgBlueBright: [104, 49],
25948
+ bgMagentaBright: [105, 49],
25949
+ bgCyanBright: [106, 49],
25950
+ bgWhiteBright: [107, 49]
25951
+ }
25952
+ };
25953
+ var modifierNames = Object.keys(styles.modifier);
25954
+ var foregroundColorNames = Object.keys(styles.color);
25955
+ var backgroundColorNames = Object.keys(styles.bgColor);
25956
+ var colorNames = [...foregroundColorNames, ...backgroundColorNames];
25957
+ function assembleStyles() {
25958
+ const codes = /* @__PURE__ */ new Map();
25959
+ for (const [groupName, group] of Object.entries(styles)) {
25960
+ for (const [styleName, style] of Object.entries(group)) {
25961
+ styles[styleName] = {
25962
+ open: `\x1B[${style[0]}m`,
25963
+ close: `\x1B[${style[1]}m`
25964
+ };
25965
+ group[styleName] = styles[styleName];
25966
+ codes.set(style[0], style[1]);
25967
+ }
25968
+ Object.defineProperty(styles, groupName, {
25969
+ value: group,
25970
+ enumerable: false
25971
+ });
25972
+ }
25973
+ Object.defineProperty(styles, "codes", {
25974
+ value: codes,
25975
+ enumerable: false
25976
+ });
25977
+ styles.color.close = "\x1B[39m";
25978
+ styles.bgColor.close = "\x1B[49m";
25979
+ styles.color.ansi = wrapAnsi16();
25980
+ styles.color.ansi256 = wrapAnsi256();
25981
+ styles.color.ansi16m = wrapAnsi16m();
25982
+ styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
25983
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
25984
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
25985
+ Object.defineProperties(styles, {
25986
+ rgbToAnsi256: {
25987
+ value(red, green, blue) {
25988
+ if (red === green && green === blue) {
25989
+ if (red < 8) {
25990
+ return 16;
25991
+ }
25992
+ if (red > 248) {
25993
+ return 231;
25994
+ }
25995
+ return Math.round((red - 8) / 247 * 24) + 232;
25996
+ }
25997
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
25998
+ },
25999
+ enumerable: false
26000
+ },
26001
+ hexToRgb: {
26002
+ value(hex3) {
26003
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex3.toString(16));
26004
+ if (!matches) {
26005
+ return [0, 0, 0];
26006
+ }
26007
+ let [colorString] = matches;
26008
+ if (colorString.length === 3) {
26009
+ colorString = [...colorString].map((character) => character + character).join("");
26010
+ }
26011
+ const integer2 = Number.parseInt(colorString, 16);
26012
+ return [
26013
+ /* eslint-disable no-bitwise */
26014
+ integer2 >> 16 & 255,
26015
+ integer2 >> 8 & 255,
26016
+ integer2 & 255
26017
+ /* eslint-enable no-bitwise */
26018
+ ];
26019
+ },
26020
+ enumerable: false
26021
+ },
26022
+ hexToAnsi256: {
26023
+ value: (hex3) => styles.rgbToAnsi256(...styles.hexToRgb(hex3)),
26024
+ enumerable: false
26025
+ },
26026
+ ansi256ToAnsi: {
26027
+ value(code) {
26028
+ if (code < 8) {
26029
+ return 30 + code;
26030
+ }
26031
+ if (code < 16) {
26032
+ return 90 + (code - 8);
26033
+ }
26034
+ let red;
26035
+ let green;
26036
+ let blue;
26037
+ if (code >= 232) {
26038
+ red = ((code - 232) * 10 + 8) / 255;
26039
+ green = red;
26040
+ blue = red;
26041
+ } else {
26042
+ code -= 16;
26043
+ const remainder = code % 36;
26044
+ red = Math.floor(code / 36) / 5;
26045
+ green = Math.floor(remainder / 6) / 5;
26046
+ blue = remainder % 6 / 5;
26047
+ }
26048
+ const value = Math.max(red, green, blue) * 2;
26049
+ if (value === 0) {
26050
+ return 30;
26051
+ }
26052
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
26053
+ if (value === 2) {
26054
+ result += 60;
26055
+ }
26056
+ return result;
26057
+ },
26058
+ enumerable: false
26059
+ },
26060
+ rgbToAnsi: {
26061
+ value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
26062
+ enumerable: false
26063
+ },
26064
+ hexToAnsi: {
26065
+ value: (hex3) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex3)),
26066
+ enumerable: false
26067
+ }
26068
+ });
26069
+ return styles;
26070
+ }
26071
+ var ansiStyles = assembleStyles();
26072
+ var ansi_styles_default = ansiStyles;
26073
+
26074
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
26075
+ import process3 from "process";
26076
+ import os from "os";
26077
+ import tty from "tty";
26078
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process3.argv) {
26079
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
26080
+ const position = argv.indexOf(prefix + flag);
26081
+ const terminatorPosition = argv.indexOf("--");
26082
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
26083
+ }
26084
+ var { env } = process3;
26085
+ var flagForceColor;
26086
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
26087
+ flagForceColor = 0;
26088
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
26089
+ flagForceColor = 1;
26090
+ }
26091
+ function envForceColor() {
26092
+ if ("FORCE_COLOR" in env) {
26093
+ if (env.FORCE_COLOR === "true") {
26094
+ return 1;
26095
+ }
26096
+ if (env.FORCE_COLOR === "false") {
26097
+ return 0;
26098
+ }
26099
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
26100
+ }
26101
+ }
26102
+ function translateLevel(level) {
26103
+ if (level === 0) {
26104
+ return false;
26105
+ }
26106
+ return {
26107
+ level,
26108
+ hasBasic: true,
26109
+ has256: level >= 2,
26110
+ has16m: level >= 3
26111
+ };
26112
+ }
26113
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
26114
+ const noFlagForceColor = envForceColor();
26115
+ if (noFlagForceColor !== void 0) {
26116
+ flagForceColor = noFlagForceColor;
26117
+ }
26118
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
26119
+ if (forceColor === 0) {
26120
+ return 0;
26121
+ }
26122
+ if (sniffFlags) {
26123
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
26124
+ return 3;
26125
+ }
26126
+ if (hasFlag("color=256")) {
26127
+ return 2;
26128
+ }
26129
+ }
26130
+ if ("TF_BUILD" in env && "AGENT_NAME" in env) {
26131
+ return 1;
26132
+ }
26133
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
26134
+ return 0;
26135
+ }
26136
+ const min = forceColor || 0;
26137
+ if (env.TERM === "dumb") {
26138
+ return min;
26139
+ }
26140
+ if (process3.platform === "win32") {
26141
+ const osRelease = os.release().split(".");
26142
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
26143
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
26144
+ }
26145
+ return 1;
26146
+ }
26147
+ if ("CI" in env) {
26148
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
26149
+ return 3;
26150
+ }
26151
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
26152
+ return 1;
26153
+ }
26154
+ return min;
26155
+ }
26156
+ if ("TEAMCITY_VERSION" in env) {
26157
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
26158
+ }
26159
+ if (env.COLORTERM === "truecolor") {
26160
+ return 3;
26161
+ }
26162
+ if (env.TERM === "xterm-kitty") {
26163
+ return 3;
26164
+ }
26165
+ if (env.TERM === "xterm-ghostty") {
26166
+ return 3;
26167
+ }
26168
+ if (env.TERM === "wezterm") {
26169
+ return 3;
26170
+ }
26171
+ if ("TERM_PROGRAM" in env) {
26172
+ const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
26173
+ switch (env.TERM_PROGRAM) {
26174
+ case "iTerm.app": {
26175
+ return version2 >= 3 ? 3 : 2;
26176
+ }
26177
+ case "Apple_Terminal": {
26178
+ return 2;
26179
+ }
26180
+ }
26181
+ }
26182
+ if (/-256(color)?$/i.test(env.TERM)) {
26183
+ return 2;
26184
+ }
26185
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
26186
+ return 1;
26187
+ }
26188
+ if ("COLORTERM" in env) {
26189
+ return 1;
26190
+ }
26191
+ return min;
26192
+ }
26193
+ function createSupportsColor(stream, options = {}) {
26194
+ const level = _supportsColor(stream, {
26195
+ streamIsTTY: stream && stream.isTTY,
26196
+ ...options
26197
+ });
26198
+ return translateLevel(level);
26199
+ }
26200
+ var supportsColor = {
26201
+ stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
26202
+ stderr: createSupportsColor({ isTTY: tty.isatty(2) })
26203
+ };
26204
+ var supports_color_default = supportsColor;
26205
+
26206
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/utilities.js
26207
+ function stringReplaceAll(string4, substring, replacer) {
26208
+ let index = string4.indexOf(substring);
26209
+ if (index === -1) {
26210
+ return string4;
26211
+ }
26212
+ const substringLength = substring.length;
26213
+ let endIndex = 0;
26214
+ let returnValue = "";
26215
+ do {
26216
+ returnValue += string4.slice(endIndex, index) + substring + replacer;
26217
+ endIndex = index + substringLength;
26218
+ index = string4.indexOf(substring, endIndex);
26219
+ } while (index !== -1);
26220
+ returnValue += string4.slice(endIndex);
26221
+ return returnValue;
26222
+ }
26223
+ function stringEncaseCRLFWithFirstIndex(string4, prefix, postfix, index) {
26224
+ let endIndex = 0;
26225
+ let returnValue = "";
26226
+ do {
26227
+ const gotCR = string4[index - 1] === "\r";
26228
+ returnValue += string4.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
26229
+ endIndex = index + 1;
26230
+ index = string4.indexOf("\n", endIndex);
26231
+ } while (index !== -1);
26232
+ returnValue += string4.slice(endIndex);
26233
+ return returnValue;
26234
+ }
26235
+
26236
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/index.js
26237
+ var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
26238
+ var GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
26239
+ var STYLER = /* @__PURE__ */ Symbol("STYLER");
26240
+ var IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
26241
+ var levelMapping = [
26242
+ "ansi",
26243
+ "ansi",
26244
+ "ansi256",
26245
+ "ansi16m"
26246
+ ];
26247
+ var styles2 = /* @__PURE__ */ Object.create(null);
26248
+ var applyOptions = (object2, options = {}) => {
26249
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
26250
+ throw new Error("The `level` option should be an integer from 0 to 3");
26251
+ }
26252
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
26253
+ object2.level = options.level === void 0 ? colorLevel : options.level;
26254
+ };
26255
+ var chalkFactory = (options) => {
26256
+ const chalk2 = (...strings) => strings.join(" ");
26257
+ applyOptions(chalk2, options);
26258
+ Object.setPrototypeOf(chalk2, createChalk.prototype);
26259
+ return chalk2;
26260
+ };
26261
+ function createChalk(options) {
26262
+ return chalkFactory(options);
26263
+ }
26264
+ Object.setPrototypeOf(createChalk.prototype, Function.prototype);
26265
+ for (const [styleName, style] of Object.entries(ansi_styles_default)) {
26266
+ styles2[styleName] = {
26267
+ get() {
26268
+ const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
26269
+ Object.defineProperty(this, styleName, { value: builder });
26270
+ return builder;
26271
+ }
26272
+ };
26273
+ }
26274
+ styles2.visible = {
26275
+ get() {
26276
+ const builder = createBuilder(this, this[STYLER], true);
26277
+ Object.defineProperty(this, "visible", { value: builder });
26278
+ return builder;
26279
+ }
26280
+ };
26281
+ var getModelAnsi = (model, level, type, ...arguments_) => {
26282
+ if (model === "rgb") {
26283
+ if (level === "ansi16m") {
26284
+ return ansi_styles_default[type].ansi16m(...arguments_);
26285
+ }
26286
+ if (level === "ansi256") {
26287
+ return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
26288
+ }
26289
+ return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
26290
+ }
26291
+ if (model === "hex") {
26292
+ return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
26293
+ }
26294
+ return ansi_styles_default[type][model](...arguments_);
26295
+ };
26296
+ var usedModels = ["rgb", "hex", "ansi256"];
26297
+ for (const model of usedModels) {
26298
+ styles2[model] = {
26299
+ get() {
26300
+ const { level } = this;
26301
+ return function(...arguments_) {
26302
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
26303
+ return createBuilder(this, styler, this[IS_EMPTY]);
26304
+ };
26305
+ }
26306
+ };
26307
+ const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
26308
+ styles2[bgModel] = {
26309
+ get() {
26310
+ const { level } = this;
26311
+ return function(...arguments_) {
26312
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
26313
+ return createBuilder(this, styler, this[IS_EMPTY]);
26314
+ };
26315
+ }
26316
+ };
26317
+ }
26318
+ var proto = Object.defineProperties(() => {
26319
+ }, {
26320
+ ...styles2,
26321
+ level: {
26322
+ enumerable: true,
26323
+ get() {
26324
+ return this[GENERATOR].level;
26325
+ },
26326
+ set(level) {
26327
+ this[GENERATOR].level = level;
26328
+ }
26329
+ }
26330
+ });
26331
+ var createStyler = (open, close, parent) => {
26332
+ let openAll;
26333
+ let closeAll;
26334
+ if (parent === void 0) {
26335
+ openAll = open;
26336
+ closeAll = close;
26337
+ } else {
26338
+ openAll = parent.openAll + open;
26339
+ closeAll = close + parent.closeAll;
26340
+ }
26341
+ return {
26342
+ open,
26343
+ close,
26344
+ openAll,
26345
+ closeAll,
26346
+ parent
26347
+ };
26348
+ };
26349
+ var createBuilder = (self, _styler, _isEmpty) => {
26350
+ const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
26351
+ Object.setPrototypeOf(builder, proto);
26352
+ builder[GENERATOR] = self;
26353
+ builder[STYLER] = _styler;
26354
+ builder[IS_EMPTY] = _isEmpty;
26355
+ return builder;
26356
+ };
26357
+ var applyStyle = (self, string4) => {
26358
+ if (self.level <= 0 || !string4) {
26359
+ return self[IS_EMPTY] ? "" : string4;
26360
+ }
26361
+ let styler = self[STYLER];
26362
+ if (styler === void 0) {
26363
+ return string4;
26364
+ }
26365
+ const { openAll, closeAll } = styler;
26366
+ if (string4.includes("\x1B")) {
26367
+ while (styler !== void 0) {
26368
+ string4 = stringReplaceAll(string4, styler.close, styler.open);
26369
+ styler = styler.parent;
26370
+ }
26371
+ }
26372
+ const lfIndex = string4.indexOf("\n");
26373
+ if (lfIndex !== -1) {
26374
+ string4 = stringEncaseCRLFWithFirstIndex(string4, closeAll, openAll, lfIndex);
26375
+ }
26376
+ return openAll + string4 + closeAll;
26377
+ };
26378
+ Object.defineProperties(createChalk.prototype, styles2);
26379
+ var chalk = createChalk();
26380
+ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
26381
+ var source_default = chalk;
26382
+
26383
+ // src/theme.ts
26384
+ function colorSeverity(severity, text, colorizer = source_default) {
26385
+ switch (severity) {
26386
+ case "CRITICAL":
26387
+ return colorizer.red.bold(text);
26388
+ case "HIGH":
26389
+ return colorizer.hex("#ff6b00").bold(text);
26390
+ case "MEDIUM":
26391
+ return colorizer.yellow(text);
26392
+ case "LOW":
26393
+ return colorizer.cyan(text);
26394
+ case "INFORMATIONAL":
26395
+ return colorizer.gray(text);
26396
+ default:
26397
+ return text;
26398
+ }
26399
+ }
26400
+ function colorBanner(text, colorizer = source_default) {
26401
+ return colorizer.cyan.bold(text);
26402
+ }
26403
+ function colorMuted(text, colorizer = source_default) {
26404
+ return colorizer.dim(text);
26405
+ }
26406
+ function colorSuccess(text, colorizer = source_default) {
26407
+ return colorizer.green(text);
26408
+ }
26409
+ function colorError(text, colorizer = source_default) {
26410
+ return colorizer.red(text);
26411
+ }
26412
+ function colorWarning(text, colorizer = source_default) {
26413
+ return colorizer.yellow(text);
26414
+ }
26415
+ function colorAccentBold(text, colorizer = source_default) {
26416
+ return colorizer.bold.cyan(text);
26417
+ }
26418
+ function colorAccentUnderline(text, colorizer = source_default) {
26419
+ return colorizer.underline.cyan(text);
26420
+ }
26421
+
25111
26422
  // src/auth/commands.ts
25112
26423
  function getClientId() {
25113
26424
  const clientId = "client_01KEZ01W5Q3107GTBY51WQ67HT";
@@ -25285,35 +26596,56 @@ function resolveOrganizationSelectionInput(organizations, input) {
25285
26596
  return findOrganizationByInput(organizations, trimmedInput);
25286
26597
  }
25287
26598
  async function promptForOrganizationSelection(organizations, activeOrganizationId) {
25288
- console.log("Select an organization:");
25289
- for (const [index, organization] of organizations.entries()) {
25290
- const marker = organization.organizationId === activeOrganizationId ? "*" : " ";
25291
- console.log(
25292
- `${marker} ${index + 1}) ${sanitizeForOutput(organization.name)} (${sanitizeForOutput(organization.slug)}) - ${organization.organizationId}`
25293
- );
26599
+ if (organizations.length === 0) {
26600
+ return null;
25294
26601
  }
25295
- console.log("");
25296
- const readline = createInterface({
25297
- input: process.stdin,
25298
- output: process.stdout
25299
- });
25300
- try {
25301
- while (true) {
25302
- const input = await readline.question(
25303
- "Enter number, organization ID, slug, or name (press Enter to cancel): "
25304
- );
25305
- if (input.trim().length === 0) {
25306
- return null;
25307
- }
25308
- const selection = resolveOrganizationSelectionInput(organizations, input);
25309
- if ("organization" in selection) {
25310
- return selection.organization;
26602
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
26603
+ const readline = createInterface2({
26604
+ input: process.stdin,
26605
+ output: process.stdout
26606
+ });
26607
+ try {
26608
+ while (true) {
26609
+ const input = await readline.question(
26610
+ "Enter number, organization ID, slug, or name (press Enter to cancel): "
26611
+ );
26612
+ if (input.trim().length === 0) {
26613
+ return null;
26614
+ }
26615
+ const selection = resolveOrganizationSelectionInput(organizations, input);
26616
+ if ("organization" in selection) {
26617
+ return selection.organization;
26618
+ }
26619
+ console.error(selection.error);
25311
26620
  }
25312
- console.error(selection.error);
26621
+ } finally {
26622
+ readline.close();
25313
26623
  }
25314
- } finally {
25315
- readline.close();
25316
26624
  }
26625
+ const activeIndex = organizations.findIndex(
26626
+ (organization) => organization.organizationId === activeOrganizationId
26627
+ );
26628
+ const choices = organizations.map((organization) => {
26629
+ const isActive = organization.organizationId === activeOrganizationId;
26630
+ const label = `${sanitizeForOutput(organization.name)} (${sanitizeForOutput(organization.slug)})`;
26631
+ return {
26632
+ value: organization.organizationId,
26633
+ label: isActive ? `${label} (current)` : label,
26634
+ hint: organization.organizationId
26635
+ };
26636
+ });
26637
+ const selected = await _t({
26638
+ message: "Switch organization",
26639
+ options: choices,
26640
+ initialValue: activeIndex >= 0 ? organizations[activeIndex]?.organizationId : void 0
26641
+ });
26642
+ if (q(selected)) {
26643
+ return null;
26644
+ }
26645
+ const selectedOrganization = organizations.find(
26646
+ (organization) => organization.organizationId === selected
26647
+ );
26648
+ return selectedOrganization ?? null;
25317
26649
  }
25318
26650
  async function refreshAfterOrganizationSwitch(workosOrganizationId, refreshForOrganization = (organizationId) => refreshStoredAccessTokenForOrganization(organizationId)) {
25319
26651
  if (!workosOrganizationId || workosOrganizationId.trim().length === 0) {
@@ -25331,22 +26663,24 @@ Examples:
25331
26663
  ).action(async () => {
25332
26664
  const existingToken = readToken();
25333
26665
  if (existingToken) {
25334
- console.log("You are already logged in. Run `trace auth logout` first to re-authenticate.");
26666
+ console.log(
26667
+ `${colorWarning("You are already logged in.")} Run \`trace auth logout\` first to re-authenticate.`
26668
+ );
25335
26669
  return;
25336
26670
  }
25337
26671
  const clientId = getClientId();
25338
26672
  console.log("Initiating device authorization...\n");
25339
26673
  const auth = await requestDeviceAuthorization(clientId);
25340
26674
  console.log("Your one-time code is:\n");
25341
- console.log(` ${auth.user_code}
26675
+ console.log(` ${colorAccentBold(auth.user_code)}
25342
26676
  `);
25343
- console.log(`Open this URL in your browser: ${auth.verification_uri}`);
26677
+ console.log(`Open this URL in your browser: ${colorAccentUnderline(auth.verification_uri)}`);
25344
26678
  console.log("");
25345
26679
  const opened = await openBrowser(auth.verification_uri_complete);
25346
26680
  if (opened) {
25347
- console.log("A browser window has been opened for you.");
26681
+ console.log(colorSuccess("A browser window has been opened for you."));
25348
26682
  } else {
25349
- console.log(`Or visit: ${auth.verification_uri_complete}`);
26683
+ console.log(`Or visit: ${colorAccentUnderline(auth.verification_uri_complete)}`);
25350
26684
  }
25351
26685
  console.log("\nWaiting for authorization...");
25352
26686
  const tokenResponse = await pollForToken(clientId, auth.device_code, {
@@ -25356,9 +26690,11 @@ Examples:
25356
26690
  writeTokens(tokenResponse.access_token, tokenResponse.refresh_token);
25357
26691
  const name = [tokenResponse.user.first_name, tokenResponse.user.last_name].filter(Boolean).join(" ");
25358
26692
  const displayName = name || tokenResponse.user.email;
25359
- console.log(`
25360
- Authenticated as ${displayName} (${tokenResponse.user.email})`);
25361
- console.log("Tokens saved to ~/.trace");
26693
+ console.log(
26694
+ `
26695
+ ${colorSuccess(`Authenticated as ${displayName} (${tokenResponse.user.email})`)}`
26696
+ );
26697
+ console.log(colorSuccess("Tokens saved to ~/.trace"));
25362
26698
  });
25363
26699
  }
25364
26700
  function createLogoutCommand() {
@@ -25370,9 +26706,11 @@ Examples:
25370
26706
  ).action(() => {
25371
26707
  const removed = removeToken();
25372
26708
  if (removed) {
25373
- console.log("Logged out successfully. Local session data removed from ~/.trace/");
26709
+ console.log(
26710
+ colorSuccess("Logged out successfully. Local session data removed from ~/.trace/")
26711
+ );
25374
26712
  } else {
25375
- console.log("No active session found.");
26713
+ console.log(colorWarning("No active session found."));
25376
26714
  }
25377
26715
  });
25378
26716
  }
@@ -25437,7 +26775,7 @@ Examples:
25437
26775
  return;
25438
26776
  }
25439
26777
  if (!info.loggedIn) {
25440
- console.log("Not logged in. Run `tracecli auth login` to authenticate.");
26778
+ console.log(colorError("Not logged in. Run `tracecli auth login` to authenticate."));
25441
26779
  return;
25442
26780
  }
25443
26781
  console.log("Logged in to Trace");
@@ -25451,7 +26789,9 @@ Examples:
25451
26789
  console.log(` Active Org (CLI): ${info.activeOrg}`);
25452
26790
  }
25453
26791
  if (info.expires) {
25454
- console.log(` Expires: ${info.expires}${info.expired ? " (EXPIRED)" : ""}`);
26792
+ console.log(
26793
+ info.expired ? ` Expires: ${info.expires} ${colorError("(EXPIRED)")}` : ` Expires: ${info.expires}`
26794
+ );
25455
26795
  }
25456
26796
  console.log(
25457
26797
  ` Refresh: ${info.hasRefreshToken ? "Available (auto-refresh enabled)" : "Not available"}`
@@ -25637,10 +26977,6 @@ function createAuthCommand() {
25637
26977
  }
25638
26978
 
25639
26979
  // src/banner.ts
25640
- var ESC = "\x1B";
25641
- var RESET = `${ESC}[0m`;
25642
- var CYAN_BOLD = `${ESC}[1;36m`;
25643
- var DIM = `${ESC}[2m`;
25644
26980
  var BANNER = `
25645
26981
  \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
25646
26982
  \u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D
@@ -25650,8 +26986,8 @@ var BANNER = `
25650
26986
  \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D
25651
26987
  `;
25652
26988
  function showBanner() {
25653
- console.log(`${CYAN_BOLD}${BANNER}${RESET}`);
25654
- console.log(`${DIM} Continuous security vulnerability intelligence${RESET}
26989
+ console.log(colorBanner(BANNER));
26990
+ console.log(`${colorMuted(" Continuous security vulnerability intelligence")}
25655
26991
  `);
25656
26992
  }
25657
26993
 
@@ -25665,7 +27001,7 @@ function extractCommandTree(cmd) {
25665
27001
  description: o.description,
25666
27002
  takesValue: o.required || o.optional
25667
27003
  }));
25668
- const subcommands = cmd.commands.filter((c25) => !c25._hidden).map((c25) => extractCommandTree(c25));
27004
+ const subcommands = cmd.commands.filter((c26) => !c26._hidden).map((c26) => extractCommandTree(c26));
25669
27005
  return {
25670
27006
  name: cmd.name(),
25671
27007
  description: cmd.description(),
@@ -25731,7 +27067,7 @@ function generateBashCompletion(tree, binName) {
25731
27067
  }
25732
27068
  function collectBashCases(tree, prefix) {
25733
27069
  const cases = /* @__PURE__ */ new Map();
25734
- const subcommandNames = tree.subcommands.map((c25) => c25.name);
27070
+ const subcommandNames = tree.subcommands.map((c26) => c26.name);
25735
27071
  const optionNames = tree.options.flatMap((o) => o.short ? [o.long, o.short] : [o.long]);
25736
27072
  const extraOptions = prefix === "" ? ["--help", "--version"] : ["--help"];
25737
27073
  const allOptions = [.../* @__PURE__ */ new Set([...optionNames, ...extraOptions])];
@@ -25900,7 +27236,7 @@ function buildFishCondition(binName, parentPath) {
25900
27236
  if (parentPath.length === 1) {
25901
27237
  return `-n '__fish_seen_subcommand_from ${parentPath[0]}'`;
25902
27238
  }
25903
- const conditions = parentPath.map((p) => `__fish_seen_subcommand_from ${p}`);
27239
+ const conditions = parentPath.map((p2) => `__fish_seen_subcommand_from ${p2}`);
25904
27240
  return `-n '${conditions.join("; and ")}'`;
25905
27241
  }
25906
27242
  function generateCompletion(program3, shell, binName) {
@@ -25931,14 +27267,14 @@ function completionFileName(shell) {
25931
27267
  return "tracecli-completion.fish";
25932
27268
  }
25933
27269
  }
25934
- function getTraceDir() {
27270
+ function getTraceDir2() {
25935
27271
  return join2(homedir2(), TRACE_DIR);
25936
27272
  }
25937
27273
  function getCompletionFilePath(shell) {
25938
- return join2(getTraceDir(), completionFileName(shell));
27274
+ return join2(getTraceDir2(), completionFileName(shell));
25939
27275
  }
25940
27276
  function writeCompletionFile(shell, script) {
25941
- const dir = getTraceDir();
27277
+ const dir = getTraceDir2();
25942
27278
  if (!existsSync2(dir)) {
25943
27279
  mkdirSync2(dir, { recursive: true });
25944
27280
  }
@@ -26018,6 +27354,33 @@ function createCompletionCommand(program3) {
26018
27354
  });
26019
27355
  }
26020
27356
 
27357
+ // src/metadata.ts
27358
+ import { readFileSync as readFileSync2 } from "fs";
27359
+ import { dirname, join as join3 } from "path";
27360
+ import { fileURLToPath } from "url";
27361
+ var DEFAULT_PACKAGE_NAME = "securewithtrace";
27362
+ var DEFAULT_VERSION = "0.0.1";
27363
+ function readPackageMetadata() {
27364
+ const currentFilePath = fileURLToPath(import.meta.url);
27365
+ const packageJsonPath = join3(dirname(currentFilePath), "..", "package.json");
27366
+ try {
27367
+ const rawPackageJson = readFileSync2(packageJsonPath, "utf-8");
27368
+ const parsed = JSON.parse(rawPackageJson);
27369
+ if (typeof parsed !== "object" || parsed === null) {
27370
+ return { name: DEFAULT_PACKAGE_NAME, version: DEFAULT_VERSION };
27371
+ }
27372
+ const metadata = parsed;
27373
+ const name = typeof metadata.name === "string" && metadata.name.trim().length > 0 ? metadata.name : DEFAULT_PACKAGE_NAME;
27374
+ const version2 = typeof metadata.version === "string" && metadata.version.trim().length > 0 ? metadata.version : DEFAULT_VERSION;
27375
+ return { name, version: version2 };
27376
+ } catch {
27377
+ return { name: DEFAULT_PACKAGE_NAME, version: DEFAULT_VERSION };
27378
+ }
27379
+ }
27380
+ var packageMetadata = readPackageMetadata();
27381
+ var CLI_PACKAGE_NAME = packageMetadata.name;
27382
+ var CLI_VERSION = packageMetadata.version;
27383
+
26021
27384
  // src/pentest/commands.ts
26022
27385
  var DEFAULT_LIMIT = 30;
26023
27386
  var MAX_LIMIT = 100;
@@ -26028,8 +27391,8 @@ function formatDate(date5) {
26028
27391
  if (!date5) {
26029
27392
  return "\u2014";
26030
27393
  }
26031
- const d = typeof date5 === "string" ? new Date(date5) : date5;
26032
- return d.toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
27394
+ const d3 = typeof date5 === "string" ? new Date(date5) : date5;
27395
+ return d3.toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
26033
27396
  }
26034
27397
  function formatFindingSeverity(severity) {
26035
27398
  switch (severity) {
@@ -26073,7 +27436,7 @@ async function resolvePentestId(organizationId, identifier) {
26073
27436
  console.error(`Failed to list pentests (status ${result.status}).`);
26074
27437
  process.exit(1);
26075
27438
  }
26076
- const pentest = result.body.find((p) => p.displayId === displayId);
27439
+ const pentest = result.body.find((p2) => p2.displayId === displayId);
26077
27440
  if (!pentest) {
26078
27441
  console.error(
26079
27442
  `Pentest with display ID ${displayId} not found.
@@ -26236,10 +27599,11 @@ Examples:
26236
27599
  `);
26237
27600
  for (const finding of sorted) {
26238
27601
  const sev = formatFindingSeverity(finding.severity);
27602
+ const severityLabel = colorSeverity(finding.severity, sev);
26239
27603
  const status = formatStatus(finding.status);
26240
27604
  const cwes = finding.cweIds.length > 0 ? ` | ${finding.cweIds.join(", ")}` : "";
26241
27605
  const score = finding.cvssScore != null ? ` | CVSS ${finding.cvssScore.toFixed(1)}` : "";
26242
- console.log(` [${sev}] ${finding.title}`);
27606
+ console.log(` [${severityLabel}] ${finding.title}`);
26243
27607
  console.log(` ${finding.category} \xB7 ${status}${cwes}${score}`);
26244
27608
  if (finding.repositories.length > 0) {
26245
27609
  for (const repo of finding.repositories) {
@@ -26266,12 +27630,12 @@ function createPentestCommand() {
26266
27630
  // src/repo/commands.ts
26267
27631
  import { chmodSync, mkdtempSync, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
26268
27632
  import { tmpdir } from "os";
26269
- import { join as join3 } from "path";
27633
+ import { join as join4 } from "path";
26270
27634
  function stripAnsi(str) {
26271
27635
  const ESC2 = String.fromCharCode(27);
26272
- const CSI = String.fromCharCode(155);
27636
+ const CSI2 = String.fromCharCode(155);
26273
27637
  const BEL = String.fromCharCode(7);
26274
- const csi = `[${ESC2}${CSI}][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]`;
27638
+ const csi = `[${ESC2}${CSI2}][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]`;
26275
27639
  const osc = `${ESC2}\\].*?(?:${BEL}|${ESC2}\\\\)`;
26276
27640
  const pattern = new RegExp(`${osc}|${csi}`, "g");
26277
27641
  return str.replace(pattern, "");
@@ -26838,8 +28202,8 @@ function urlWithUsername(httpsUrl) {
26838
28202
  return url2.toString();
26839
28203
  }
26840
28204
  function createAskPassScript() {
26841
- const dir = mkdtempSync(join3(tmpdir(), "trace-askpass-"));
26842
- const scriptPath = join3(dir, "askpass.sh");
28205
+ const dir = mkdtempSync(join4(tmpdir(), "trace-askpass-"));
28206
+ const scriptPath = join4(dir, "askpass.sh");
26843
28207
  writeFileSync3(
26844
28208
  scriptPath,
26845
28209
  `#!/bin/sh
@@ -27007,6 +28371,311 @@ function createRepoCommand() {
27007
28371
  return repo;
27008
28372
  }
27009
28373
 
28374
+ // src/update/commands.ts
28375
+ import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync4 } from "fs";
28376
+ import { dirname as dirname2, join as join5 } from "path";
28377
+ import { createInterface as createInterface3 } from "readline/promises";
28378
+ var UPDATE_CACHE_FILE = "update-check.json";
28379
+ var UPDATE_CHECK_TTL_MS = 24 * 60 * 60 * 1e3;
28380
+ var UPDATE_CHECK_TIMEOUT_MS = 1500;
28381
+ var DISABLE_UPDATE_NOTIFIER_ENV = "TRACECLI_DISABLE_UPDATE_NOTIFIER";
28382
+ var REGISTRY_URL_ENV = "TRACECLI_NPM_REGISTRY_URL";
28383
+ var noticePrinted = false;
28384
+ function getUpdateCheckCachePath() {
28385
+ return join5(getTraceDir(), UPDATE_CACHE_FILE);
28386
+ }
28387
+ function readUpdateCheckCache() {
28388
+ const cachePath = getUpdateCheckCachePath();
28389
+ if (!existsSync3(cachePath)) {
28390
+ return null;
28391
+ }
28392
+ try {
28393
+ const rawCache = readFileSync3(cachePath, "utf-8");
28394
+ const parsed = JSON.parse(rawCache);
28395
+ if (typeof parsed !== "object" || parsed === null) {
28396
+ return null;
28397
+ }
28398
+ const cache = parsed;
28399
+ if (typeof cache.checkedAt !== "number" || !Number.isFinite(cache.checkedAt)) {
28400
+ return null;
28401
+ }
28402
+ if (typeof cache.latestVersion === "string" && cache.latestVersion.trim().length > 0) {
28403
+ return { checkedAt: cache.checkedAt, latestVersion: cache.latestVersion };
28404
+ }
28405
+ return { checkedAt: cache.checkedAt };
28406
+ } catch {
28407
+ return null;
28408
+ }
28409
+ }
28410
+ function writeUpdateCheckCache(cache) {
28411
+ const cachePath = getUpdateCheckCachePath();
28412
+ mkdirSync3(dirname2(cachePath), { recursive: true, mode: 448 });
28413
+ writeFileSync4(cachePath, `${JSON.stringify(cache, null, 2)}
28414
+ `, {
28415
+ encoding: "utf-8",
28416
+ mode: 384
28417
+ });
28418
+ }
28419
+ function parseSemver(version2) {
28420
+ const normalized = version2.trim();
28421
+ const match = normalized.match(
28422
+ /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-.]+)?$/
28423
+ );
28424
+ if (!match?.[1] || !match[2] || !match[3]) {
28425
+ return null;
28426
+ }
28427
+ const major = Number.parseInt(match[1], 10);
28428
+ const minor = Number.parseInt(match[2], 10);
28429
+ const patch = Number.parseInt(match[3], 10);
28430
+ if (!Number.isFinite(major) || !Number.isFinite(minor) || !Number.isFinite(patch)) {
28431
+ return null;
28432
+ }
28433
+ const prerelease = match[4] ? match[4].split(".") : [];
28434
+ return { major, minor, patch, prerelease };
28435
+ }
28436
+ function comparePrerelease(a, b) {
28437
+ const maxLength = Math.max(a.length, b.length);
28438
+ for (let index = 0; index < maxLength; index += 1) {
28439
+ const aPart = a[index];
28440
+ const bPart = b[index];
28441
+ if (aPart === void 0 && bPart === void 0) {
28442
+ return 0;
28443
+ }
28444
+ if (aPart === void 0) {
28445
+ return -1;
28446
+ }
28447
+ if (bPart === void 0) {
28448
+ return 1;
28449
+ }
28450
+ const aIsNumeric = /^\d+$/.test(aPart);
28451
+ const bIsNumeric = /^\d+$/.test(bPart);
28452
+ if (aIsNumeric && bIsNumeric) {
28453
+ const aValue = Number.parseInt(aPart, 10);
28454
+ const bValue = Number.parseInt(bPart, 10);
28455
+ if (aValue !== bValue) {
28456
+ return aValue > bValue ? 1 : -1;
28457
+ }
28458
+ continue;
28459
+ }
28460
+ if (aIsNumeric) {
28461
+ return -1;
28462
+ }
28463
+ if (bIsNumeric) {
28464
+ return 1;
28465
+ }
28466
+ if (aPart !== bPart) {
28467
+ return aPart > bPart ? 1 : -1;
28468
+ }
28469
+ }
28470
+ return 0;
28471
+ }
28472
+ function compareSemver(a, b) {
28473
+ const aSemver = parseSemver(a);
28474
+ const bSemver = parseSemver(b);
28475
+ if (!aSemver || !bSemver) {
28476
+ return null;
28477
+ }
28478
+ if (aSemver.major !== bSemver.major) {
28479
+ return aSemver.major > bSemver.major ? 1 : -1;
28480
+ }
28481
+ if (aSemver.minor !== bSemver.minor) {
28482
+ return aSemver.minor > bSemver.minor ? 1 : -1;
28483
+ }
28484
+ if (aSemver.patch !== bSemver.patch) {
28485
+ return aSemver.patch > bSemver.patch ? 1 : -1;
28486
+ }
28487
+ if (aSemver.prerelease.length === 0 && bSemver.prerelease.length === 0) {
28488
+ return 0;
28489
+ }
28490
+ if (aSemver.prerelease.length === 0) {
28491
+ return 1;
28492
+ }
28493
+ if (bSemver.prerelease.length === 0) {
28494
+ return -1;
28495
+ }
28496
+ return comparePrerelease(aSemver.prerelease, bSemver.prerelease);
28497
+ }
28498
+ function isVersionNewer(currentVersion, candidateVersion) {
28499
+ const comparison = compareSemver(candidateVersion, currentVersion);
28500
+ return comparison !== null && comparison > 0;
28501
+ }
28502
+ function resolveRegistryUrl() {
28503
+ const override = process.env[REGISTRY_URL_ENV];
28504
+ if (typeof override === "string" && override.trim().length > 0) {
28505
+ return override;
28506
+ }
28507
+ return `https://registry.npmjs.org/${encodeURIComponent(CLI_PACKAGE_NAME)}/latest`;
28508
+ }
28509
+ function extractLatestVersionFromRegistryPayload(payload) {
28510
+ if (typeof payload !== "object" || payload === null) {
28511
+ return null;
28512
+ }
28513
+ if ("version" in payload && typeof payload.version === "string" && payload.version.trim().length > 0) {
28514
+ return payload.version;
28515
+ }
28516
+ return null;
28517
+ }
28518
+ async function fetchLatestVersionFromRegistry() {
28519
+ try {
28520
+ const response = await fetch(resolveRegistryUrl(), {
28521
+ headers: { accept: "application/json" },
28522
+ signal: AbortSignal.timeout(UPDATE_CHECK_TIMEOUT_MS)
28523
+ });
28524
+ if (!response.ok) {
28525
+ return null;
28526
+ }
28527
+ const payload = await response.json();
28528
+ return extractLatestVersionFromRegistryPayload(payload);
28529
+ } catch {
28530
+ return null;
28531
+ }
28532
+ }
28533
+ async function getLatestVersion(forceRefresh) {
28534
+ const now = Date.now();
28535
+ const cached2 = readUpdateCheckCache();
28536
+ if (!forceRefresh && cached2 && now - cached2.checkedAt < UPDATE_CHECK_TTL_MS) {
28537
+ return cached2.latestVersion ?? null;
28538
+ }
28539
+ const latestVersion = await fetchLatestVersionFromRegistry();
28540
+ if (latestVersion) {
28541
+ writeUpdateCheckCache({ checkedAt: now, latestVersion });
28542
+ return latestVersion;
28543
+ }
28544
+ if (cached2?.latestVersion) {
28545
+ writeUpdateCheckCache({ checkedAt: now, latestVersion: cached2.latestVersion });
28546
+ return cached2.latestVersion;
28547
+ }
28548
+ writeUpdateCheckCache({ checkedAt: now });
28549
+ return null;
28550
+ }
28551
+ async function getUpdateAvailability(forceRefresh) {
28552
+ const latestVersion = await getLatestVersion(forceRefresh);
28553
+ return {
28554
+ currentVersion: CLI_VERSION,
28555
+ latestVersion,
28556
+ isUpdateAvailable: latestVersion ? isVersionNewer(CLI_VERSION, latestVersion) : false
28557
+ };
28558
+ }
28559
+ function shouldSkipUpdateNotifier(commandName) {
28560
+ if (process.env[DISABLE_UPDATE_NOTIFIER_ENV] === "1") {
28561
+ return true;
28562
+ }
28563
+ if (process.env["CI"] === "true") {
28564
+ return true;
28565
+ }
28566
+ if (!process.stdout.isTTY) {
28567
+ return true;
28568
+ }
28569
+ if (commandName === "upgrade") {
28570
+ return true;
28571
+ }
28572
+ return false;
28573
+ }
28574
+ async function maybeNotifyUpdateAvailable(commandName) {
28575
+ if (noticePrinted || shouldSkipUpdateNotifier(commandName)) {
28576
+ return;
28577
+ }
28578
+ const availability = await getUpdateAvailability(false);
28579
+ if (!availability.isUpdateAvailable || !availability.latestVersion) {
28580
+ return;
28581
+ }
28582
+ noticePrinted = true;
28583
+ console.error("");
28584
+ console.error(
28585
+ `A new tracecli version is available: ${availability.currentVersion} -> ${availability.latestVersion}`
28586
+ );
28587
+ console.error("Run `tracecli upgrade` to install the latest version.");
28588
+ console.error("");
28589
+ }
28590
+ function resolveUpgradePlan() {
28591
+ const packageSpec = `${CLI_PACKAGE_NAME}@latest`;
28592
+ if (Bun.which("npm")) {
28593
+ return { command: "npm", args: ["install", "-g", packageSpec] };
28594
+ }
28595
+ if (Bun.which("bun")) {
28596
+ return { command: "bun", args: ["add", "-g", packageSpec] };
28597
+ }
28598
+ if (Bun.which("pnpm")) {
28599
+ return { command: "pnpm", args: ["add", "-g", packageSpec] };
28600
+ }
28601
+ return null;
28602
+ }
28603
+ async function promptForUpgradeConfirmation(latestVersion) {
28604
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
28605
+ return true;
28606
+ }
28607
+ const readline = createInterface3({
28608
+ input: process.stdin,
28609
+ output: process.stdout
28610
+ });
28611
+ try {
28612
+ const input = await readline.question(`Install tracecli ${latestVersion} now? [Y/n] `);
28613
+ const normalized = input.trim().toLowerCase();
28614
+ if (normalized === "n" || normalized === "no") {
28615
+ return false;
28616
+ }
28617
+ return true;
28618
+ } finally {
28619
+ readline.close();
28620
+ }
28621
+ }
28622
+ function createUpgradeCommand() {
28623
+ return new Command("upgrade").alias("self-update").description("Upgrade tracecli to the latest version").option("--check", "Check whether an update is available").option("-y, --yes", "Skip upgrade confirmation prompt").addHelpText(
28624
+ "after",
28625
+ `
28626
+ Examples:
28627
+ tracecli upgrade
28628
+ tracecli upgrade --check
28629
+ tracecli self-update`
28630
+ ).action(async (options) => {
28631
+ const availability = await getUpdateAvailability(true);
28632
+ if (availability.latestVersion) {
28633
+ if (availability.isUpdateAvailable) {
28634
+ console.log(
28635
+ `Update available: ${availability.currentVersion} -> ${availability.latestVersion}`
28636
+ );
28637
+ } else {
28638
+ console.log(`tracecli is up to date (${availability.currentVersion}).`);
28639
+ return;
28640
+ }
28641
+ } else {
28642
+ console.warn(
28643
+ "Could not determine the latest published version from npm. Proceeding with best-effort upgrade."
28644
+ );
28645
+ }
28646
+ if (options.check) {
28647
+ return;
28648
+ }
28649
+ const versionLabel = availability.latestVersion ?? "the latest available version";
28650
+ const shouldUpgrade = options.yes ? true : await promptForUpgradeConfirmation(versionLabel);
28651
+ if (!shouldUpgrade) {
28652
+ console.log("Upgrade cancelled.");
28653
+ return;
28654
+ }
28655
+ const plan = resolveUpgradePlan();
28656
+ if (!plan) {
28657
+ console.error(
28658
+ `No supported package manager found (npm, bun, pnpm). Install the latest version manually from https://www.npmjs.com/package/${CLI_PACKAGE_NAME}`
28659
+ );
28660
+ process.exit(1);
28661
+ }
28662
+ console.log(`Running: ${plan.command} ${plan.args.join(" ")}`);
28663
+ const proc = Bun.spawn([plan.command, ...plan.args], {
28664
+ stdout: "inherit",
28665
+ stderr: "inherit"
28666
+ });
28667
+ const exitCode = await proc.exited;
28668
+ if (exitCode !== 0) {
28669
+ console.error(
28670
+ `Upgrade failed while running '${plan.command} ${plan.args.join(" ")}' (exit code ${exitCode}).`
28671
+ );
28672
+ process.exit(1);
28673
+ }
28674
+ console.log("tracecli upgrade completed.");
28675
+ console.log("Run `tracecli --version` to verify the installed version.");
28676
+ });
28677
+ }
28678
+
27010
28679
  // src/vulnerabilities/commands.ts
27011
28680
  var DEFAULT_LIMIT3 = 30;
27012
28681
  var MAX_LIMIT3 = 100;
@@ -27076,11 +28745,12 @@ function printVulnerabilities(vulnerabilities) {
27076
28745
  );
27077
28746
  for (const vuln of sorted) {
27078
28747
  const sev = formatSeverity(vuln.severity);
28748
+ const displaySeverity = colorSeverity(vuln.severity, sev);
27079
28749
  const status = formatStatus(vuln.status);
27080
28750
  const repo = vuln.repositoryName;
27081
28751
  const file2 = vuln.codeSnippet.filePath;
27082
28752
  const line = vuln.codeSnippet.startLine;
27083
- console.log(` [${sev}] ${vuln.title}`);
28753
+ console.log(` [${displaySeverity}] ${vuln.title}`);
27084
28754
  console.log(` ${repo} \xB7 ${file2}:${line} \xB7 ${status}`);
27085
28755
  console.log(` ${vuln.traceId}`);
27086
28756
  console.log("");
@@ -27215,7 +28885,10 @@ function createVulnerabilitiesCommand() {
27215
28885
 
27216
28886
  // src/index.ts
27217
28887
  var program2 = new Command();
27218
- program2.name("tracecli").description("Trace CLI").version("0.0.1");
28888
+ program2.name("tracecli").description("Trace CLI").version(CLI_VERSION);
28889
+ program2.hook("preAction", async (_thisCommand, actionCommand) => {
28890
+ await maybeNotifyUpdateAvailable(actionCommand.name());
28891
+ });
27219
28892
  program2.action(() => {
27220
28893
  showBanner();
27221
28894
  program2.outputHelp();
@@ -27226,4 +28899,5 @@ program2.addCommand(createRepoCommand());
27226
28899
  program2.addCommand(createVulnerabilitiesCommand());
27227
28900
  program2.addCommand(createPentestCommand());
27228
28901
  program2.addCommand(createCompletionCommand(program2));
27229
- program2.parse();
28902
+ program2.addCommand(createUpgradeCommand());
28903
+ await program2.parseAsync();