securewithtrace 0.18.2 → 0.20.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 +1688 -634
  3. package/package.json +2 -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 "";
@@ -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,7 +8845,7 @@ function $constructor(name, initializer3, params) {
8071
8845
  }
8072
8846
  inst._zod.traits.add(name);
8073
8847
  initializer3(inst, def);
8074
- const proto2 = _.prototype;
8848
+ const proto2 = _2.prototype;
8075
8849
  const keys = Object.keys(proto2);
8076
8850
  for (let i = 0; i < keys.length; i++) {
8077
8851
  const k = keys[i];
@@ -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 {
@@ -24847,267 +25624,6 @@ function removeToken() {
24847
25624
  return removed;
24848
25625
  }
24849
25626
 
24850
- // src/api-client.ts
24851
- var readTokenSafe = readToken;
24852
- var PRODUCTION_API_URL = "https://api.securewithtrace.com";
24853
- var UNAUTHORIZED_STATUS = 401;
24854
- function getApiBaseUrl() {
24855
- const raw = process.env["TRACE_API_URL"];
24856
- if (!raw) {
24857
- return PRODUCTION_API_URL;
24858
- }
24859
- let parsed;
24860
- try {
24861
- parsed = new URL(raw);
24862
- } catch {
24863
- console.error(`Invalid TRACE_API_URL: '${raw}' is not a valid URL. Using default.`);
24864
- return PRODUCTION_API_URL;
24865
- }
24866
- if (parsed.protocol !== "https:") {
24867
- console.error("Invalid TRACE_API_URL: only https:// is allowed. Using default.");
24868
- return PRODUCTION_API_URL;
24869
- }
24870
- const hostname3 = parsed.hostname;
24871
- if (hostname3 === "localhost" || hostname3 === "127.0.0.1" || hostname3 === "0.0.0.0" || hostname3 === "::1" || hostname3.startsWith("10.") || hostname3.startsWith("192.168.") || /^172\.(1[6-9]|2[0-9]|3[01])\./.test(hostname3)) {
24872
- console.error(
24873
- "Invalid TRACE_API_URL: private/reserved hostnames are not allowed. Using default."
24874
- );
24875
- return PRODUCTION_API_URL;
24876
- }
24877
- return raw.replace(/\/+$/, "");
24878
- }
24879
- function createClient(token) {
24880
- return initClient(v1Contract, {
24881
- baseUrl: getApiBaseUrl(),
24882
- baseHeaders: {
24883
- Authorization: `Bearer ${token}`
24884
- }
24885
- });
24886
- }
24887
- function getWorkosClientId() {
24888
- const clientId = "client_01KEZ01W5Q3107GTBY51WQ67HT";
24889
- if (!clientId || clientId.trim().length === 0) {
24890
- return null;
24891
- }
24892
- return clientId;
24893
- }
24894
- async function refreshStoredAccessToken() {
24895
- const clientId = getWorkosClientId();
24896
- const refreshToken = readRefreshToken();
24897
- if (!clientId || !refreshToken) {
24898
- return null;
24899
- }
24900
- try {
24901
- const tokenResponse = await refreshAccessToken(clientId, refreshToken);
24902
- const nextRefreshToken = tokenResponse.refresh_token ?? refreshToken;
24903
- writeTokens(tokenResponse.access_token, nextRefreshToken);
24904
- return tokenResponse.access_token;
24905
- } catch (error48) {
24906
- if (error48 instanceof Error && (error48.message.includes(" 400 ") || error48.message.includes(" 401 "))) {
24907
- removeToken();
24908
- }
24909
- return null;
24910
- }
24911
- }
24912
- async function refreshStoredAccessTokenForOrganization(workosOrganizationId) {
24913
- const clientId = getWorkosClientId();
24914
- const refreshToken = readRefreshToken();
24915
- if (!clientId || !refreshToken) {
24916
- return false;
24917
- }
24918
- try {
24919
- const tokenResponse = await refreshAccessToken(clientId, refreshToken, workosOrganizationId);
24920
- const nextRefreshToken = tokenResponse.refresh_token ?? refreshToken;
24921
- writeTokens(tokenResponse.access_token, nextRefreshToken);
24922
- return true;
24923
- } catch (error48) {
24924
- if (error48 instanceof Error && (error48.message.includes(" 400 ") || error48.message.includes(" 401 "))) {
24925
- removeToken();
24926
- }
24927
- return false;
24928
- }
24929
- }
24930
- async function authenticatedRequest(request) {
24931
- const token = readToken();
24932
- if (!token) {
24933
- console.error("Not logged in. Run `tracecli auth login` first.");
24934
- process.exit(1);
24935
- }
24936
- const firstResult = await request(createClient(token));
24937
- if (firstResult.status !== UNAUTHORIZED_STATUS) {
24938
- return firstResult;
24939
- }
24940
- const refreshedToken = await refreshStoredAccessToken();
24941
- if (!refreshedToken) {
24942
- return firstResult;
24943
- }
24944
- return request(createClient(refreshedToken));
24945
- }
24946
- async function authenticatedRequestSafe(request) {
24947
- const token = readTokenSafe();
24948
- if (!token) {
24949
- return null;
24950
- }
24951
- try {
24952
- const firstResult = await request(createClient(token));
24953
- if (firstResult.status !== UNAUTHORIZED_STATUS) {
24954
- return firstResult;
24955
- }
24956
- const refreshedToken = await refreshStoredAccessToken();
24957
- if (!refreshedToken) {
24958
- return firstResult;
24959
- }
24960
- return await request(createClient(refreshedToken));
24961
- } catch {
24962
- return null;
24963
- }
24964
- }
24965
- function extractOrganizationIdFromToken(token) {
24966
- if (!token || token.trim().length === 0) {
24967
- return null;
24968
- }
24969
- const parts = token.split(".");
24970
- const payload = parts[1];
24971
- if (!payload) {
24972
- return null;
24973
- }
24974
- try {
24975
- const decoded = JSON.parse(Buffer.from(payload, "base64url").toString("utf-8"));
24976
- return typeof decoded.org_id === "string" && decoded.org_id.trim().length > 0 ? decoded.org_id : null;
24977
- } catch {
24978
- return null;
24979
- }
24980
- }
24981
- var SAFE_ID_PATTERN = /^[a-zA-Z0-9_-]+$/;
24982
- function determineActiveOrganization(organizations, selectedOrganizationId, tokenOrganizationId) {
24983
- if (organizations.length === 0) {
24984
- return null;
24985
- }
24986
- if (selectedOrganizationId && SAFE_ID_PATTERN.test(selectedOrganizationId)) {
24987
- const selectedOrganization = organizations.find(
24988
- (organization) => organization.organizationId === selectedOrganizationId
24989
- );
24990
- if (selectedOrganization) {
24991
- return {
24992
- organization: selectedOrganization,
24993
- source: "selected",
24994
- staleSelectionDetected: false
24995
- };
24996
- }
24997
- }
24998
- if (tokenOrganizationId && SAFE_ID_PATTERN.test(tokenOrganizationId)) {
24999
- const tokenOrganization = organizations.find(
25000
- (organization) => organization.organizationId === tokenOrganizationId
25001
- );
25002
- if (tokenOrganization) {
25003
- return {
25004
- organization: tokenOrganization,
25005
- source: "default",
25006
- staleSelectionDetected: selectedOrganizationId != null
25007
- };
25008
- }
25009
- }
25010
- const [fallbackOrganization] = organizations;
25011
- if (!fallbackOrganization) {
25012
- return null;
25013
- }
25014
- return {
25015
- organization: fallbackOrganization,
25016
- source: "default",
25017
- staleSelectionDetected: selectedOrganizationId != null
25018
- };
25019
- }
25020
- async function resolveOrganizationId(client) {
25021
- const result = client ? await client.organization.listMyOrganizations() : await authenticatedRequest(
25022
- (authenticatedClient) => authenticatedClient.organization.listMyOrganizations()
25023
- );
25024
- if (result.status !== 200) {
25025
- console.error(`Failed to resolve organization (status ${result.status}).`);
25026
- process.exit(1);
25027
- }
25028
- const organizations = result.body;
25029
- const selectedOrganizationId = readSelectedOrganizationId();
25030
- const tokenOrganizationId = extractOrganizationIdFromToken(readToken());
25031
- const activeOrganization = determineActiveOrganization(
25032
- organizations,
25033
- selectedOrganizationId,
25034
- tokenOrganizationId
25035
- );
25036
- if (!activeOrganization) {
25037
- console.error("No organization found for your account.");
25038
- process.exit(1);
25039
- }
25040
- const id = activeOrganization.organization.organizationId;
25041
- if (!SAFE_ID_PATTERN.test(id)) {
25042
- console.error("Invalid organization ID received from API.");
25043
- process.exit(1);
25044
- }
25045
- if (activeOrganization.staleSelectionDetected) {
25046
- removeSelectedOrganizationId();
25047
- writeSelectedOrganizationId(id);
25048
- if (selectedOrganizationId) {
25049
- console.warn(
25050
- `Stored organization '${selectedOrganizationId}' is unavailable. Using '${activeOrganization.organization.name}' (${id}) instead.`
25051
- );
25052
- }
25053
- } else if (activeOrganization.source === "default") {
25054
- writeSelectedOrganizationId(id);
25055
- }
25056
- return id;
25057
- }
25058
- async function resolveOrganizationIdSafe(client) {
25059
- try {
25060
- const result = client ? await client.organization.listMyOrganizations() : await authenticatedRequestSafe(
25061
- (authenticatedClient) => authenticatedClient.organization.listMyOrganizations()
25062
- );
25063
- if (!result) {
25064
- return null;
25065
- }
25066
- if (result.status !== 200) {
25067
- return null;
25068
- }
25069
- const organizations = result.body;
25070
- const selectedOrganizationId = readSelectedOrganizationId();
25071
- const tokenOrganizationId = extractOrganizationIdFromToken(readToken());
25072
- const activeOrganization = determineActiveOrganization(
25073
- organizations,
25074
- selectedOrganizationId,
25075
- tokenOrganizationId
25076
- );
25077
- if (!activeOrganization) {
25078
- return null;
25079
- }
25080
- const id = activeOrganization.organization.organizationId;
25081
- if (!SAFE_ID_PATTERN.test(id)) {
25082
- return null;
25083
- }
25084
- if (activeOrganization.staleSelectionDetected) {
25085
- removeSelectedOrganizationId();
25086
- writeSelectedOrganizationId(id);
25087
- } else if (activeOrganization.source === "default") {
25088
- writeSelectedOrganizationId(id);
25089
- }
25090
- return id;
25091
- } catch {
25092
- return null;
25093
- }
25094
- }
25095
-
25096
- // src/format.ts
25097
- var SEVERITY_ORDER = {
25098
- CRITICAL: 0,
25099
- HIGH: 1,
25100
- MEDIUM: 2,
25101
- LOW: 3,
25102
- INFORMATIONAL: 4
25103
- };
25104
- function formatStatus(status) {
25105
- return status.toLowerCase().replace("_", " ");
25106
- }
25107
- function tsvSafe(value) {
25108
- return (value ?? "").replace(/[\t\r\n]/g, " ");
25109
- }
25110
-
25111
25627
  // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
25112
25628
  var ANSI_BACKGROUND_OFFSET = 10;
25113
25629
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
@@ -25620,26 +26136,296 @@ function colorSeverity(severity, text, colorizer = source_default) {
25620
26136
  return text;
25621
26137
  }
25622
26138
  }
25623
- function colorBanner(text, colorizer = source_default) {
25624
- return colorizer.cyan.bold(text);
25625
- }
25626
- function colorMuted(text, colorizer = source_default) {
25627
- return colorizer.dim(text);
25628
- }
25629
- function colorSuccess(text, colorizer = source_default) {
25630
- return colorizer.green(text);
25631
- }
25632
- function colorError(text, colorizer = source_default) {
25633
- return colorizer.red(text);
25634
- }
25635
- function colorWarning(text, colorizer = source_default) {
25636
- return colorizer.yellow(text);
26139
+ function colorBanner(text, colorizer = source_default) {
26140
+ return colorizer.cyan.bold(text);
26141
+ }
26142
+ function colorMuted(text, colorizer = source_default) {
26143
+ return colorizer.dim(text);
26144
+ }
26145
+ function colorSuccess(text, colorizer = source_default) {
26146
+ return colorizer.green(text);
26147
+ }
26148
+ function colorError(text, colorizer = source_default) {
26149
+ return colorizer.red(text);
26150
+ }
26151
+ function colorWarningPrefix(text, colorizer = source_default) {
26152
+ return `${colorizer.yellow.bold("Warning:")} ${text}`;
26153
+ }
26154
+ function colorWarning(text, colorizer = source_default) {
26155
+ return colorizer.yellow(text);
26156
+ }
26157
+ function colorAccentBold(text, colorizer = source_default) {
26158
+ return colorizer.bold.cyan(text);
26159
+ }
26160
+ function colorAccentUnderline(text, colorizer = source_default) {
26161
+ return colorizer.underline.cyan(text);
26162
+ }
26163
+
26164
+ // src/api-client.ts
26165
+ var readTokenSafe = readToken;
26166
+ var PRODUCTION_API_URL = "https://api.securewithtrace.com";
26167
+ var UNAUTHORIZED_STATUS = 401;
26168
+ function getApiBaseUrl() {
26169
+ const raw = process.env["TRACE_API_URL"];
26170
+ if (!raw) {
26171
+ return PRODUCTION_API_URL;
26172
+ }
26173
+ let parsed;
26174
+ try {
26175
+ parsed = new URL(raw);
26176
+ } catch {
26177
+ console.error(
26178
+ colorWarning(`Invalid TRACE_API_URL: '${raw}' is not a valid URL. Using default.`)
26179
+ );
26180
+ return PRODUCTION_API_URL;
26181
+ }
26182
+ if (parsed.protocol !== "https:") {
26183
+ console.error(colorWarning("Invalid TRACE_API_URL: only https:// is allowed. Using default."));
26184
+ return PRODUCTION_API_URL;
26185
+ }
26186
+ const hostname3 = parsed.hostname;
26187
+ if (hostname3 === "localhost" || hostname3 === "127.0.0.1" || hostname3 === "0.0.0.0" || hostname3 === "::1" || hostname3.startsWith("10.") || hostname3.startsWith("192.168.") || /^172\.(1[6-9]|2[0-9]|3[01])\./.test(hostname3)) {
26188
+ console.error(
26189
+ colorWarning(
26190
+ "Invalid TRACE_API_URL: private/reserved hostnames are not allowed. Using default."
26191
+ )
26192
+ );
26193
+ return PRODUCTION_API_URL;
26194
+ }
26195
+ return raw.replace(/\/+$/, "");
26196
+ }
26197
+ function createClient(token) {
26198
+ return initClient(v1Contract, {
26199
+ baseUrl: getApiBaseUrl(),
26200
+ baseHeaders: {
26201
+ Authorization: `Bearer ${token}`
26202
+ }
26203
+ });
26204
+ }
26205
+ function getWorkosClientId() {
26206
+ const clientId = "client_01KEZ01W5Q3107GTBY51WQ67HT";
26207
+ if (!clientId || clientId.trim().length === 0) {
26208
+ return null;
26209
+ }
26210
+ return clientId;
26211
+ }
26212
+ async function refreshStoredAccessToken() {
26213
+ const clientId = getWorkosClientId();
26214
+ const refreshToken = readRefreshToken();
26215
+ if (!clientId || !refreshToken) {
26216
+ return null;
26217
+ }
26218
+ try {
26219
+ const tokenResponse = await refreshAccessToken(clientId, refreshToken);
26220
+ const nextRefreshToken = tokenResponse.refresh_token ?? refreshToken;
26221
+ writeTokens(tokenResponse.access_token, nextRefreshToken);
26222
+ return tokenResponse.access_token;
26223
+ } catch (error48) {
26224
+ if (error48 instanceof Error && (error48.message.includes(" 400 ") || error48.message.includes(" 401 "))) {
26225
+ removeToken();
26226
+ }
26227
+ return null;
26228
+ }
26229
+ }
26230
+ async function refreshStoredAccessTokenForOrganization(workosOrganizationId) {
26231
+ const clientId = getWorkosClientId();
26232
+ const refreshToken = readRefreshToken();
26233
+ if (!clientId || !refreshToken) {
26234
+ return false;
26235
+ }
26236
+ try {
26237
+ const tokenResponse = await refreshAccessToken(clientId, refreshToken, workosOrganizationId);
26238
+ const nextRefreshToken = tokenResponse.refresh_token ?? refreshToken;
26239
+ writeTokens(tokenResponse.access_token, nextRefreshToken);
26240
+ return true;
26241
+ } catch (error48) {
26242
+ if (error48 instanceof Error && (error48.message.includes(" 400 ") || error48.message.includes(" 401 "))) {
26243
+ removeToken();
26244
+ }
26245
+ return false;
26246
+ }
26247
+ }
26248
+ async function authenticatedRequest(request) {
26249
+ const token = readToken();
26250
+ if (!token) {
26251
+ console.error(colorError("Not logged in. Run `tracecli auth login` first."));
26252
+ process.exit(1);
26253
+ }
26254
+ const firstResult = await request(createClient(token));
26255
+ if (firstResult.status !== UNAUTHORIZED_STATUS) {
26256
+ return firstResult;
26257
+ }
26258
+ const refreshedToken = await refreshStoredAccessToken();
26259
+ if (!refreshedToken) {
26260
+ return firstResult;
26261
+ }
26262
+ return request(createClient(refreshedToken));
26263
+ }
26264
+ async function authenticatedRequestSafe(request) {
26265
+ const token = readTokenSafe();
26266
+ if (!token) {
26267
+ return null;
26268
+ }
26269
+ try {
26270
+ const firstResult = await request(createClient(token));
26271
+ if (firstResult.status !== UNAUTHORIZED_STATUS) {
26272
+ return firstResult;
26273
+ }
26274
+ const refreshedToken = await refreshStoredAccessToken();
26275
+ if (!refreshedToken) {
26276
+ return firstResult;
26277
+ }
26278
+ return await request(createClient(refreshedToken));
26279
+ } catch {
26280
+ return null;
26281
+ }
26282
+ }
26283
+ function extractOrganizationIdFromToken(token) {
26284
+ if (!token || token.trim().length === 0) {
26285
+ return null;
26286
+ }
26287
+ const parts = token.split(".");
26288
+ const payload = parts[1];
26289
+ if (!payload) {
26290
+ return null;
26291
+ }
26292
+ try {
26293
+ const decoded = JSON.parse(Buffer.from(payload, "base64url").toString("utf-8"));
26294
+ return typeof decoded.org_id === "string" && decoded.org_id.trim().length > 0 ? decoded.org_id : null;
26295
+ } catch {
26296
+ return null;
26297
+ }
26298
+ }
26299
+ var SAFE_ID_PATTERN = /^[a-zA-Z0-9_-]+$/;
26300
+ function determineActiveOrganization(organizations, selectedOrganizationId, tokenOrganizationId) {
26301
+ if (organizations.length === 0) {
26302
+ return null;
26303
+ }
26304
+ if (selectedOrganizationId && SAFE_ID_PATTERN.test(selectedOrganizationId)) {
26305
+ const selectedOrganization = organizations.find(
26306
+ (organization) => organization.organizationId === selectedOrganizationId
26307
+ );
26308
+ if (selectedOrganization) {
26309
+ return {
26310
+ organization: selectedOrganization,
26311
+ source: "selected",
26312
+ staleSelectionDetected: false
26313
+ };
26314
+ }
26315
+ }
26316
+ if (tokenOrganizationId && SAFE_ID_PATTERN.test(tokenOrganizationId)) {
26317
+ const tokenOrganization = organizations.find(
26318
+ (organization) => organization.organizationId === tokenOrganizationId
26319
+ );
26320
+ if (tokenOrganization) {
26321
+ return {
26322
+ organization: tokenOrganization,
26323
+ source: "default",
26324
+ staleSelectionDetected: selectedOrganizationId != null
26325
+ };
26326
+ }
26327
+ }
26328
+ const [fallbackOrganization] = organizations;
26329
+ if (!fallbackOrganization) {
26330
+ return null;
26331
+ }
26332
+ return {
26333
+ organization: fallbackOrganization,
26334
+ source: "default",
26335
+ staleSelectionDetected: selectedOrganizationId != null
26336
+ };
26337
+ }
26338
+ async function resolveOrganizationId(client) {
26339
+ const result = client ? await client.organization.listMyOrganizations() : await authenticatedRequest(
26340
+ (authenticatedClient) => authenticatedClient.organization.listMyOrganizations()
26341
+ );
26342
+ if (result.status !== 200) {
26343
+ console.error(colorError(`Failed to resolve organization (status ${result.status}).`));
26344
+ process.exit(1);
26345
+ }
26346
+ const organizations = result.body;
26347
+ const selectedOrganizationId = readSelectedOrganizationId();
26348
+ const tokenOrganizationId = extractOrganizationIdFromToken(readToken());
26349
+ const activeOrganization = determineActiveOrganization(
26350
+ organizations,
26351
+ selectedOrganizationId,
26352
+ tokenOrganizationId
26353
+ );
26354
+ if (!activeOrganization) {
26355
+ console.error(colorError("No organization found for your account."));
26356
+ process.exit(1);
26357
+ }
26358
+ const id = activeOrganization.organization.organizationId;
26359
+ if (!SAFE_ID_PATTERN.test(id)) {
26360
+ console.error(colorError("Invalid organization ID received from API."));
26361
+ process.exit(1);
26362
+ }
26363
+ if (activeOrganization.staleSelectionDetected) {
26364
+ removeSelectedOrganizationId();
26365
+ writeSelectedOrganizationId(id);
26366
+ if (selectedOrganizationId) {
26367
+ console.warn(
26368
+ colorWarning(
26369
+ `Stored organization '${selectedOrganizationId}' is unavailable. Using '${activeOrganization.organization.name}' (${id}) instead.`
26370
+ )
26371
+ );
26372
+ }
26373
+ } else if (activeOrganization.source === "default") {
26374
+ writeSelectedOrganizationId(id);
26375
+ }
26376
+ return id;
26377
+ }
26378
+ async function resolveOrganizationIdSafe(client) {
26379
+ try {
26380
+ const result = client ? await client.organization.listMyOrganizations() : await authenticatedRequestSafe(
26381
+ (authenticatedClient) => authenticatedClient.organization.listMyOrganizations()
26382
+ );
26383
+ if (!result) {
26384
+ return null;
26385
+ }
26386
+ if (result.status !== 200) {
26387
+ return null;
26388
+ }
26389
+ const organizations = result.body;
26390
+ const selectedOrganizationId = readSelectedOrganizationId();
26391
+ const tokenOrganizationId = extractOrganizationIdFromToken(readToken());
26392
+ const activeOrganization = determineActiveOrganization(
26393
+ organizations,
26394
+ selectedOrganizationId,
26395
+ tokenOrganizationId
26396
+ );
26397
+ if (!activeOrganization) {
26398
+ return null;
26399
+ }
26400
+ const id = activeOrganization.organization.organizationId;
26401
+ if (!SAFE_ID_PATTERN.test(id)) {
26402
+ return null;
26403
+ }
26404
+ if (activeOrganization.staleSelectionDetected) {
26405
+ removeSelectedOrganizationId();
26406
+ writeSelectedOrganizationId(id);
26407
+ } else if (activeOrganization.source === "default") {
26408
+ writeSelectedOrganizationId(id);
26409
+ }
26410
+ return id;
26411
+ } catch {
26412
+ return null;
26413
+ }
25637
26414
  }
25638
- function colorAccentBold(text, colorizer = source_default) {
25639
- return colorizer.bold.cyan(text);
26415
+
26416
+ // src/format.ts
26417
+ var SEVERITY_ORDER = {
26418
+ CRITICAL: 0,
26419
+ HIGH: 1,
26420
+ MEDIUM: 2,
26421
+ LOW: 3,
26422
+ INFORMATIONAL: 4
26423
+ };
26424
+ function formatStatus(status) {
26425
+ return status.toLowerCase().replace("_", " ");
25640
26426
  }
25641
- function colorAccentUnderline(text, colorizer = source_default) {
25642
- return colorizer.underline.cyan(text);
26427
+ function tsvSafe(value) {
26428
+ return (value ?? "").replace(/[\t\r\n]/g, " ");
25643
26429
  }
25644
26430
 
25645
26431
  // src/auth/commands.ts
@@ -25706,34 +26492,6 @@ function planOrganizationSelectionPersistence(args) {
25706
26492
  function isSafeOrganizationId(organizationId) {
25707
26493
  return SAFE_ORGANIZATION_ID_PATTERN.test(organizationId);
25708
26494
  }
25709
- function parseOrganizationSelectorInputKey(input) {
25710
- const rawInput = typeof input === "string" ? input : input.toString("utf8");
25711
- if (rawInput === "\x1B[A" || rawInput === "\x1BOA") {
25712
- return "up";
25713
- }
25714
- if (rawInput === "\x1B[B" || rawInput === "\x1BOB") {
25715
- return "down";
25716
- }
25717
- if (rawInput === "\r" || rawInput === "\n") {
25718
- return "enter";
25719
- }
25720
- if (rawInput === "\x1B") {
25721
- return "escape";
25722
- }
25723
- if (rawInput === "") {
25724
- return "interrupt";
25725
- }
25726
- return "other";
25727
- }
25728
- function getNextOrganizationSelectionIndex(currentIndex, direction, organizationCount) {
25729
- if (organizationCount <= 0) {
25730
- return 0;
25731
- }
25732
- if (direction === "up") {
25733
- return (currentIndex - 1 + organizationCount) % organizationCount;
25734
- }
25735
- return (currentIndex + 1) % organizationCount;
25736
- }
25737
26495
  async function fetchOrganizationContext() {
25738
26496
  const result = await authenticatedRequest((client) => client.organization.listMyOrganizations());
25739
26497
  if (result.status !== 200) {
@@ -25850,8 +26608,8 @@ async function promptForOrganizationSelection(organizations, activeOrganizationI
25850
26608
  if (organizations.length === 0) {
25851
26609
  return null;
25852
26610
  }
25853
- if (!process.stdin.setRawMode) {
25854
- const readline = createInterface({
26611
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
26612
+ const readline = createInterface2({
25855
26613
  input: process.stdin,
25856
26614
  output: process.stdout
25857
26615
  });
@@ -25873,76 +26631,30 @@ async function promptForOrganizationSelection(organizations, activeOrganizationI
25873
26631
  readline.close();
25874
26632
  }
25875
26633
  }
25876
- const stdin = process.stdin;
25877
- const stdout = process.stdout;
25878
- const activeOrganizationIndex = organizations.findIndex(
26634
+ const activeIndex = organizations.findIndex(
25879
26635
  (organization) => organization.organizationId === activeOrganizationId
25880
26636
  );
25881
- let selectedOrganizationIndex = activeOrganizationIndex >= 0 ? activeOrganizationIndex : 0;
25882
- let renderedLineCount = 0;
25883
- const wasRawModeEnabled = Boolean(stdin.isRaw);
25884
- const renderSelector = () => {
25885
- const lines = ["Select an organization (use Up/Down arrows and Enter):", ""];
25886
- for (const [index, organization] of organizations.entries()) {
25887
- const isSelected = index === selectedOrganizationIndex;
25888
- const isActive = organization.organizationId === activeOrganizationId;
25889
- const selectionMarker = isSelected ? ">" : " ";
25890
- const activeMarker = isActive ? "*" : " ";
25891
- lines.push(
25892
- `${selectionMarker} ${activeMarker} ${sanitizeForOutput(organization.name)} (${sanitizeForOutput(organization.slug)}) - ${organization.organizationId}`
25893
- );
25894
- }
25895
- lines.push("", "Press Esc to cancel.");
25896
- if (renderedLineCount > 0) {
25897
- stdout.write(`\x1B[${renderedLineCount}A`);
25898
- }
25899
- for (const line of lines) {
25900
- stdout.write(`\x1B[2K${line}
25901
- `);
25902
- }
25903
- renderedLineCount = lines.length;
25904
- };
25905
- return await new Promise((resolve) => {
25906
- const finishSelection = (result) => {
25907
- stdin.off("data", handleInput);
25908
- stdin.setRawMode(wasRawModeEnabled);
25909
- stdout.write("\x1B[2K");
25910
- resolve(result);
25911
- };
25912
- const handleInput = (chunk) => {
25913
- const inputKey = parseOrganizationSelectorInputKey(chunk);
25914
- if (inputKey === "up") {
25915
- selectedOrganizationIndex = getNextOrganizationSelectionIndex(
25916
- selectedOrganizationIndex,
25917
- "up",
25918
- organizations.length
25919
- );
25920
- renderSelector();
25921
- return;
25922
- }
25923
- if (inputKey === "down") {
25924
- selectedOrganizationIndex = getNextOrganizationSelectionIndex(
25925
- selectedOrganizationIndex,
25926
- "down",
25927
- organizations.length
25928
- );
25929
- renderSelector();
25930
- return;
25931
- }
25932
- if (inputKey === "enter") {
25933
- const selectedOrganization = organizations[selectedOrganizationIndex];
25934
- finishSelection(selectedOrganization ?? null);
25935
- return;
25936
- }
25937
- if (inputKey === "escape" || inputKey === "interrupt") {
25938
- finishSelection(null);
25939
- }
26637
+ const choices = organizations.map((organization) => {
26638
+ const isActive = organization.organizationId === activeOrganizationId;
26639
+ const label = `${sanitizeForOutput(organization.name)} (${sanitizeForOutput(organization.slug)})`;
26640
+ return {
26641
+ value: organization.organizationId,
26642
+ label: isActive ? `${label} (current)` : label,
26643
+ hint: organization.organizationId
25940
26644
  };
25941
- stdin.setRawMode(true);
25942
- stdin.resume();
25943
- stdin.on("data", handleInput);
25944
- renderSelector();
25945
26645
  });
26646
+ const selected = await _t({
26647
+ message: "Switch organization",
26648
+ options: choices,
26649
+ initialValue: activeIndex >= 0 ? organizations[activeIndex]?.organizationId : void 0
26650
+ });
26651
+ if (q(selected)) {
26652
+ return null;
26653
+ }
26654
+ const selectedOrganization = organizations.find(
26655
+ (organization) => organization.organizationId === selected
26656
+ );
26657
+ return selectedOrganization ?? null;
25946
26658
  }
25947
26659
  async function refreshAfterOrganizationSwitch(workosOrganizationId, refreshForOrganization = (organizationId) => refreshStoredAccessTokenForOrganization(organizationId)) {
25948
26660
  if (!workosOrganizationId || workosOrganizationId.trim().length === 0) {
@@ -25987,8 +26699,10 @@ Examples:
25987
26699
  writeTokens(tokenResponse.access_token, tokenResponse.refresh_token);
25988
26700
  const name = [tokenResponse.user.first_name, tokenResponse.user.last_name].filter(Boolean).join(" ");
25989
26701
  const displayName = name || tokenResponse.user.email;
25990
- console.log(`
25991
- ${colorSuccess(`Authenticated as ${displayName} (${tokenResponse.user.email})`)}`);
26702
+ console.log(
26703
+ `
26704
+ ${colorSuccess(`Authenticated as ${displayName} (${tokenResponse.user.email})`)}`
26705
+ );
25992
26706
  console.log(colorSuccess("Tokens saved to ~/.trace"));
25993
26707
  });
25994
26708
  }
@@ -26296,7 +27010,7 @@ function extractCommandTree(cmd) {
26296
27010
  description: o.description,
26297
27011
  takesValue: o.required || o.optional
26298
27012
  }));
26299
- const subcommands = cmd.commands.filter((c25) => !c25._hidden).map((c25) => extractCommandTree(c25));
27013
+ const subcommands = cmd.commands.filter((c26) => !c26._hidden).map((c26) => extractCommandTree(c26));
26300
27014
  return {
26301
27015
  name: cmd.name(),
26302
27016
  description: cmd.description(),
@@ -26362,7 +27076,7 @@ function generateBashCompletion(tree, binName) {
26362
27076
  }
26363
27077
  function collectBashCases(tree, prefix) {
26364
27078
  const cases = /* @__PURE__ */ new Map();
26365
- const subcommandNames = tree.subcommands.map((c25) => c25.name);
27079
+ const subcommandNames = tree.subcommands.map((c26) => c26.name);
26366
27080
  const optionNames = tree.options.flatMap((o) => o.short ? [o.long, o.short] : [o.long]);
26367
27081
  const extraOptions = prefix === "" ? ["--help", "--version"] : ["--help"];
26368
27082
  const allOptions = [.../* @__PURE__ */ new Set([...optionNames, ...extraOptions])];
@@ -26531,7 +27245,7 @@ function buildFishCondition(binName, parentPath) {
26531
27245
  if (parentPath.length === 1) {
26532
27246
  return `-n '__fish_seen_subcommand_from ${parentPath[0]}'`;
26533
27247
  }
26534
- const conditions = parentPath.map((p) => `__fish_seen_subcommand_from ${p}`);
27248
+ const conditions = parentPath.map((p2) => `__fish_seen_subcommand_from ${p2}`);
26535
27249
  return `-n '${conditions.join("; and ")}'`;
26536
27250
  }
26537
27251
  function generateCompletion(program3, shell, binName) {
@@ -26562,14 +27276,14 @@ function completionFileName(shell) {
26562
27276
  return "tracecli-completion.fish";
26563
27277
  }
26564
27278
  }
26565
- function getTraceDir() {
27279
+ function getTraceDir2() {
26566
27280
  return join2(homedir2(), TRACE_DIR);
26567
27281
  }
26568
27282
  function getCompletionFilePath(shell) {
26569
- return join2(getTraceDir(), completionFileName(shell));
27283
+ return join2(getTraceDir2(), completionFileName(shell));
26570
27284
  }
26571
27285
  function writeCompletionFile(shell, script) {
26572
- const dir = getTraceDir();
27286
+ const dir = getTraceDir2();
26573
27287
  if (!existsSync2(dir)) {
26574
27288
  mkdirSync2(dir, { recursive: true });
26575
27289
  }
@@ -26649,6 +27363,33 @@ function createCompletionCommand(program3) {
26649
27363
  });
26650
27364
  }
26651
27365
 
27366
+ // src/metadata.ts
27367
+ import { readFileSync as readFileSync2 } from "fs";
27368
+ import { dirname, join as join3 } from "path";
27369
+ import { fileURLToPath } from "url";
27370
+ var DEFAULT_PACKAGE_NAME = "securewithtrace";
27371
+ var DEFAULT_VERSION = "0.0.1";
27372
+ function readPackageMetadata() {
27373
+ const currentFilePath = fileURLToPath(import.meta.url);
27374
+ const packageJsonPath = join3(dirname(currentFilePath), "..", "package.json");
27375
+ try {
27376
+ const rawPackageJson = readFileSync2(packageJsonPath, "utf-8");
27377
+ const parsed = JSON.parse(rawPackageJson);
27378
+ if (typeof parsed !== "object" || parsed === null) {
27379
+ return { name: DEFAULT_PACKAGE_NAME, version: DEFAULT_VERSION };
27380
+ }
27381
+ const metadata = parsed;
27382
+ const name = typeof metadata.name === "string" && metadata.name.trim().length > 0 ? metadata.name : DEFAULT_PACKAGE_NAME;
27383
+ const version2 = typeof metadata.version === "string" && metadata.version.trim().length > 0 ? metadata.version : DEFAULT_VERSION;
27384
+ return { name, version: version2 };
27385
+ } catch {
27386
+ return { name: DEFAULT_PACKAGE_NAME, version: DEFAULT_VERSION };
27387
+ }
27388
+ }
27389
+ var packageMetadata = readPackageMetadata();
27390
+ var CLI_PACKAGE_NAME = packageMetadata.name;
27391
+ var CLI_VERSION = packageMetadata.version;
27392
+
26652
27393
  // src/pentest/commands.ts
26653
27394
  var DEFAULT_LIMIT = 30;
26654
27395
  var MAX_LIMIT = 100;
@@ -26659,8 +27400,8 @@ function formatDate(date5) {
26659
27400
  if (!date5) {
26660
27401
  return "\u2014";
26661
27402
  }
26662
- const d = typeof date5 === "string" ? new Date(date5) : date5;
26663
- return d.toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
27403
+ const d3 = typeof date5 === "string" ? new Date(date5) : date5;
27404
+ return d3.toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
26664
27405
  }
26665
27406
  function formatFindingSeverity(severity) {
26666
27407
  switch (severity) {
@@ -26704,7 +27445,7 @@ async function resolvePentestId(organizationId, identifier) {
26704
27445
  console.error(`Failed to list pentests (status ${result.status}).`);
26705
27446
  process.exit(1);
26706
27447
  }
26707
- const pentest = result.body.find((p) => p.displayId === displayId);
27448
+ const pentest = result.body.find((p2) => p2.displayId === displayId);
26708
27449
  if (!pentest) {
26709
27450
  console.error(
26710
27451
  `Pentest with display ID ${displayId} not found.
@@ -26898,13 +27639,13 @@ function createPentestCommand() {
26898
27639
  // src/repo/commands.ts
26899
27640
  import { chmodSync, mkdtempSync, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
26900
27641
  import { tmpdir } from "os";
26901
- import { join as join3 } from "path";
27642
+ import { join as join4 } from "path";
26902
27643
  function stripAnsi(str) {
26903
- const ESC = String.fromCharCode(27);
26904
- const CSI = String.fromCharCode(155);
27644
+ const ESC2 = String.fromCharCode(27);
27645
+ const CSI2 = String.fromCharCode(155);
26905
27646
  const BEL = String.fromCharCode(7);
26906
- const csi = `[${ESC}${CSI}][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]`;
26907
- const osc = `${ESC}\\].*?(?:${BEL}|${ESC}\\\\)`;
27647
+ const csi = `[${ESC2}${CSI2}][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]`;
27648
+ const osc = `${ESC2}\\].*?(?:${BEL}|${ESC2}\\\\)`;
26908
27649
  const pattern = new RegExp(`${osc}|${csi}`, "g");
26909
27650
  return str.replace(pattern, "");
26910
27651
  }
@@ -27470,8 +28211,8 @@ function urlWithUsername(httpsUrl) {
27470
28211
  return url2.toString();
27471
28212
  }
27472
28213
  function createAskPassScript() {
27473
- const dir = mkdtempSync(join3(tmpdir(), "trace-askpass-"));
27474
- const scriptPath = join3(dir, "askpass.sh");
28214
+ const dir = mkdtempSync(join4(tmpdir(), "trace-askpass-"));
28215
+ const scriptPath = join4(dir, "askpass.sh");
27475
28216
  writeFileSync3(
27476
28217
  scriptPath,
27477
28218
  `#!/bin/sh
@@ -27572,7 +28313,7 @@ Examples:
27572
28313
  installationToken = cloneTokenResult.token;
27573
28314
  cloneTokenFailure = cloneTokenResult.failure;
27574
28315
  if (cloneTokenFailure) {
27575
- console.warn(buildCloneTokenFailureWarning(cloneUrl, cloneTokenFailure));
28316
+ console.warn(colorWarning(buildCloneTokenFailureWarning(cloneUrl, cloneTokenFailure)));
27576
28317
  }
27577
28318
  }
27578
28319
  const effectiveUrl = installationToken ? urlWithUsername(cloneUrl) : cloneUrl;
@@ -27604,7 +28345,9 @@ Examples:
27604
28345
  if (exitCode !== 0) {
27605
28346
  if (!installationToken && cloneTokenFailure) {
27606
28347
  console.error(
27607
- "Clone failed while Trace clone credentials were unavailable. Resolve the warning above and retry."
28348
+ colorError(
28349
+ "Clone failed while Trace clone credentials were unavailable. Resolve the warning above and retry."
28350
+ )
27608
28351
  );
27609
28352
  }
27610
28353
  process.exit(1);
@@ -27618,11 +28361,13 @@ Examples:
27618
28361
  const resetExitCode = await resetProc.exited;
27619
28362
  if (resetExitCode !== 0) {
27620
28363
  console.error(
27621
- "Warning: failed to reset remote URL \u2014 the token username may persist in .git/config"
28364
+ colorWarningPrefix(
28365
+ "failed to reset remote URL \u2014 the token username may persist in .git/config"
28366
+ )
27622
28367
  );
27623
28368
  }
27624
28369
  }
27625
- console.log(`Repository cloned into ${targetDir}`);
28370
+ console.log(colorSuccess(`Repository cloned into ${targetDir}`));
27626
28371
  } finally {
27627
28372
  if (askPassScript) {
27628
28373
  rmSync2(askPassScript.replace(/\/[^/]+$/, ""), { recursive: true, force: true });
@@ -27639,6 +28384,311 @@ function createRepoCommand() {
27639
28384
  return repo;
27640
28385
  }
27641
28386
 
28387
+ // src/update/commands.ts
28388
+ import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync4 } from "fs";
28389
+ import { dirname as dirname2, join as join5 } from "path";
28390
+ import { createInterface as createInterface3 } from "readline/promises";
28391
+ var UPDATE_CACHE_FILE = "update-check.json";
28392
+ var UPDATE_CHECK_TTL_MS = 24 * 60 * 60 * 1e3;
28393
+ var UPDATE_CHECK_TIMEOUT_MS = 1500;
28394
+ var DISABLE_UPDATE_NOTIFIER_ENV = "TRACECLI_DISABLE_UPDATE_NOTIFIER";
28395
+ var REGISTRY_URL_ENV = "TRACECLI_NPM_REGISTRY_URL";
28396
+ var noticePrinted = false;
28397
+ function getUpdateCheckCachePath() {
28398
+ return join5(getTraceDir(), UPDATE_CACHE_FILE);
28399
+ }
28400
+ function readUpdateCheckCache() {
28401
+ const cachePath = getUpdateCheckCachePath();
28402
+ if (!existsSync3(cachePath)) {
28403
+ return null;
28404
+ }
28405
+ try {
28406
+ const rawCache = readFileSync3(cachePath, "utf-8");
28407
+ const parsed = JSON.parse(rawCache);
28408
+ if (typeof parsed !== "object" || parsed === null) {
28409
+ return null;
28410
+ }
28411
+ const cache = parsed;
28412
+ if (typeof cache.checkedAt !== "number" || !Number.isFinite(cache.checkedAt)) {
28413
+ return null;
28414
+ }
28415
+ if (typeof cache.latestVersion === "string" && cache.latestVersion.trim().length > 0) {
28416
+ return { checkedAt: cache.checkedAt, latestVersion: cache.latestVersion };
28417
+ }
28418
+ return { checkedAt: cache.checkedAt };
28419
+ } catch {
28420
+ return null;
28421
+ }
28422
+ }
28423
+ function writeUpdateCheckCache(cache) {
28424
+ const cachePath = getUpdateCheckCachePath();
28425
+ mkdirSync3(dirname2(cachePath), { recursive: true, mode: 448 });
28426
+ writeFileSync4(cachePath, `${JSON.stringify(cache, null, 2)}
28427
+ `, {
28428
+ encoding: "utf-8",
28429
+ mode: 384
28430
+ });
28431
+ }
28432
+ function parseSemver(version2) {
28433
+ const normalized = version2.trim();
28434
+ const match = normalized.match(
28435
+ /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-.]+)?$/
28436
+ );
28437
+ if (!match?.[1] || !match[2] || !match[3]) {
28438
+ return null;
28439
+ }
28440
+ const major = Number.parseInt(match[1], 10);
28441
+ const minor = Number.parseInt(match[2], 10);
28442
+ const patch = Number.parseInt(match[3], 10);
28443
+ if (!Number.isFinite(major) || !Number.isFinite(minor) || !Number.isFinite(patch)) {
28444
+ return null;
28445
+ }
28446
+ const prerelease = match[4] ? match[4].split(".") : [];
28447
+ return { major, minor, patch, prerelease };
28448
+ }
28449
+ function comparePrerelease(a, b) {
28450
+ const maxLength = Math.max(a.length, b.length);
28451
+ for (let index = 0; index < maxLength; index += 1) {
28452
+ const aPart = a[index];
28453
+ const bPart = b[index];
28454
+ if (aPart === void 0 && bPart === void 0) {
28455
+ return 0;
28456
+ }
28457
+ if (aPart === void 0) {
28458
+ return -1;
28459
+ }
28460
+ if (bPart === void 0) {
28461
+ return 1;
28462
+ }
28463
+ const aIsNumeric = /^\d+$/.test(aPart);
28464
+ const bIsNumeric = /^\d+$/.test(bPart);
28465
+ if (aIsNumeric && bIsNumeric) {
28466
+ const aValue = Number.parseInt(aPart, 10);
28467
+ const bValue = Number.parseInt(bPart, 10);
28468
+ if (aValue !== bValue) {
28469
+ return aValue > bValue ? 1 : -1;
28470
+ }
28471
+ continue;
28472
+ }
28473
+ if (aIsNumeric) {
28474
+ return -1;
28475
+ }
28476
+ if (bIsNumeric) {
28477
+ return 1;
28478
+ }
28479
+ if (aPart !== bPart) {
28480
+ return aPart > bPart ? 1 : -1;
28481
+ }
28482
+ }
28483
+ return 0;
28484
+ }
28485
+ function compareSemver(a, b) {
28486
+ const aSemver = parseSemver(a);
28487
+ const bSemver = parseSemver(b);
28488
+ if (!aSemver || !bSemver) {
28489
+ return null;
28490
+ }
28491
+ if (aSemver.major !== bSemver.major) {
28492
+ return aSemver.major > bSemver.major ? 1 : -1;
28493
+ }
28494
+ if (aSemver.minor !== bSemver.minor) {
28495
+ return aSemver.minor > bSemver.minor ? 1 : -1;
28496
+ }
28497
+ if (aSemver.patch !== bSemver.patch) {
28498
+ return aSemver.patch > bSemver.patch ? 1 : -1;
28499
+ }
28500
+ if (aSemver.prerelease.length === 0 && bSemver.prerelease.length === 0) {
28501
+ return 0;
28502
+ }
28503
+ if (aSemver.prerelease.length === 0) {
28504
+ return 1;
28505
+ }
28506
+ if (bSemver.prerelease.length === 0) {
28507
+ return -1;
28508
+ }
28509
+ return comparePrerelease(aSemver.prerelease, bSemver.prerelease);
28510
+ }
28511
+ function isVersionNewer(currentVersion, candidateVersion) {
28512
+ const comparison = compareSemver(candidateVersion, currentVersion);
28513
+ return comparison !== null && comparison > 0;
28514
+ }
28515
+ function resolveRegistryUrl() {
28516
+ const override = process.env[REGISTRY_URL_ENV];
28517
+ if (typeof override === "string" && override.trim().length > 0) {
28518
+ return override;
28519
+ }
28520
+ return `https://registry.npmjs.org/${encodeURIComponent(CLI_PACKAGE_NAME)}/latest`;
28521
+ }
28522
+ function extractLatestVersionFromRegistryPayload(payload) {
28523
+ if (typeof payload !== "object" || payload === null) {
28524
+ return null;
28525
+ }
28526
+ if ("version" in payload && typeof payload.version === "string" && payload.version.trim().length > 0) {
28527
+ return payload.version;
28528
+ }
28529
+ return null;
28530
+ }
28531
+ async function fetchLatestVersionFromRegistry() {
28532
+ try {
28533
+ const response = await fetch(resolveRegistryUrl(), {
28534
+ headers: { accept: "application/json" },
28535
+ signal: AbortSignal.timeout(UPDATE_CHECK_TIMEOUT_MS)
28536
+ });
28537
+ if (!response.ok) {
28538
+ return null;
28539
+ }
28540
+ const payload = await response.json();
28541
+ return extractLatestVersionFromRegistryPayload(payload);
28542
+ } catch {
28543
+ return null;
28544
+ }
28545
+ }
28546
+ async function getLatestVersion(forceRefresh) {
28547
+ const now = Date.now();
28548
+ const cached2 = readUpdateCheckCache();
28549
+ if (!forceRefresh && cached2 && now - cached2.checkedAt < UPDATE_CHECK_TTL_MS) {
28550
+ return cached2.latestVersion ?? null;
28551
+ }
28552
+ const latestVersion = await fetchLatestVersionFromRegistry();
28553
+ if (latestVersion) {
28554
+ writeUpdateCheckCache({ checkedAt: now, latestVersion });
28555
+ return latestVersion;
28556
+ }
28557
+ if (cached2?.latestVersion) {
28558
+ writeUpdateCheckCache({ checkedAt: now, latestVersion: cached2.latestVersion });
28559
+ return cached2.latestVersion;
28560
+ }
28561
+ writeUpdateCheckCache({ checkedAt: now });
28562
+ return null;
28563
+ }
28564
+ async function getUpdateAvailability(forceRefresh) {
28565
+ const latestVersion = await getLatestVersion(forceRefresh);
28566
+ return {
28567
+ currentVersion: CLI_VERSION,
28568
+ latestVersion,
28569
+ isUpdateAvailable: latestVersion ? isVersionNewer(CLI_VERSION, latestVersion) : false
28570
+ };
28571
+ }
28572
+ function shouldSkipUpdateNotifier(commandName) {
28573
+ if (process.env[DISABLE_UPDATE_NOTIFIER_ENV] === "1") {
28574
+ return true;
28575
+ }
28576
+ if (process.env["CI"] === "true") {
28577
+ return true;
28578
+ }
28579
+ if (!process.stdout.isTTY) {
28580
+ return true;
28581
+ }
28582
+ if (commandName === "upgrade") {
28583
+ return true;
28584
+ }
28585
+ return false;
28586
+ }
28587
+ async function maybeNotifyUpdateAvailable(commandName) {
28588
+ if (noticePrinted || shouldSkipUpdateNotifier(commandName)) {
28589
+ return;
28590
+ }
28591
+ const availability = await getUpdateAvailability(false);
28592
+ if (!availability.isUpdateAvailable || !availability.latestVersion) {
28593
+ return;
28594
+ }
28595
+ noticePrinted = true;
28596
+ console.error("");
28597
+ console.error(
28598
+ `A new tracecli version is available: ${availability.currentVersion} -> ${availability.latestVersion}`
28599
+ );
28600
+ console.error("Run `tracecli upgrade` to install the latest version.");
28601
+ console.error("");
28602
+ }
28603
+ function resolveUpgradePlan() {
28604
+ const packageSpec = `${CLI_PACKAGE_NAME}@latest`;
28605
+ if (Bun.which("npm")) {
28606
+ return { command: "npm", args: ["install", "-g", packageSpec] };
28607
+ }
28608
+ if (Bun.which("bun")) {
28609
+ return { command: "bun", args: ["add", "-g", packageSpec] };
28610
+ }
28611
+ if (Bun.which("pnpm")) {
28612
+ return { command: "pnpm", args: ["add", "-g", packageSpec] };
28613
+ }
28614
+ return null;
28615
+ }
28616
+ async function promptForUpgradeConfirmation(latestVersion) {
28617
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
28618
+ return true;
28619
+ }
28620
+ const readline = createInterface3({
28621
+ input: process.stdin,
28622
+ output: process.stdout
28623
+ });
28624
+ try {
28625
+ const input = await readline.question(`Install tracecli ${latestVersion} now? [Y/n] `);
28626
+ const normalized = input.trim().toLowerCase();
28627
+ if (normalized === "n" || normalized === "no") {
28628
+ return false;
28629
+ }
28630
+ return true;
28631
+ } finally {
28632
+ readline.close();
28633
+ }
28634
+ }
28635
+ function createUpgradeCommand() {
28636
+ 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(
28637
+ "after",
28638
+ `
28639
+ Examples:
28640
+ tracecli upgrade
28641
+ tracecli upgrade --check
28642
+ tracecli self-update`
28643
+ ).action(async (options) => {
28644
+ const availability = await getUpdateAvailability(true);
28645
+ if (availability.latestVersion) {
28646
+ if (availability.isUpdateAvailable) {
28647
+ console.log(
28648
+ `Update available: ${availability.currentVersion} -> ${availability.latestVersion}`
28649
+ );
28650
+ } else {
28651
+ console.log(`tracecli is up to date (${availability.currentVersion}).`);
28652
+ return;
28653
+ }
28654
+ } else {
28655
+ console.warn(
28656
+ "Could not determine the latest published version from npm. Proceeding with best-effort upgrade."
28657
+ );
28658
+ }
28659
+ if (options.check) {
28660
+ return;
28661
+ }
28662
+ const versionLabel = availability.latestVersion ?? "the latest available version";
28663
+ const shouldUpgrade = options.yes ? true : await promptForUpgradeConfirmation(versionLabel);
28664
+ if (!shouldUpgrade) {
28665
+ console.log("Upgrade cancelled.");
28666
+ return;
28667
+ }
28668
+ const plan = resolveUpgradePlan();
28669
+ if (!plan) {
28670
+ console.error(
28671
+ `No supported package manager found (npm, bun, pnpm). Install the latest version manually from https://www.npmjs.com/package/${CLI_PACKAGE_NAME}`
28672
+ );
28673
+ process.exit(1);
28674
+ }
28675
+ console.log(`Running: ${plan.command} ${plan.args.join(" ")}`);
28676
+ const proc = Bun.spawn([plan.command, ...plan.args], {
28677
+ stdout: "inherit",
28678
+ stderr: "inherit"
28679
+ });
28680
+ const exitCode = await proc.exited;
28681
+ if (exitCode !== 0) {
28682
+ console.error(
28683
+ `Upgrade failed while running '${plan.command} ${plan.args.join(" ")}' (exit code ${exitCode}).`
28684
+ );
28685
+ process.exit(1);
28686
+ }
28687
+ console.log("tracecli upgrade completed.");
28688
+ console.log("Run `tracecli --version` to verify the installed version.");
28689
+ });
28690
+ }
28691
+
27642
28692
  // src/vulnerabilities/commands.ts
27643
28693
  var DEFAULT_LIMIT3 = 30;
27644
28694
  var MAX_LIMIT3 = 100;
@@ -27848,7 +28898,10 @@ function createVulnerabilitiesCommand() {
27848
28898
 
27849
28899
  // src/index.ts
27850
28900
  var program2 = new Command();
27851
- program2.name("tracecli").description("Trace CLI").version("0.0.1");
28901
+ program2.name("tracecli").description("Trace CLI").version(CLI_VERSION);
28902
+ program2.hook("preAction", async (_thisCommand, actionCommand) => {
28903
+ await maybeNotifyUpdateAvailable(actionCommand.name());
28904
+ });
27852
28905
  program2.action(() => {
27853
28906
  showBanner();
27854
28907
  program2.outputHelp();
@@ -27859,4 +28912,5 @@ program2.addCommand(createRepoCommand());
27859
28912
  program2.addCommand(createVulnerabilitiesCommand());
27860
28913
  program2.addCommand(createPentestCommand());
27861
28914
  program2.addCommand(createCompletionCommand(program2));
27862
- program2.parse();
28915
+ program2.addCommand(createUpgradeCommand());
28916
+ await program2.parseAsync();