rudel 0.1.10 → 0.1.11

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 (2) hide show
  1. package/dist/cli.js +757 -719
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -28,76 +28,6 @@ var __export = (target, all) => {
28
28
  };
29
29
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
30
30
 
31
- // ../../node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js
32
- var require_picocolors = __commonJS((exports, module) => {
33
- var p = process || {};
34
- var argv = p.argv || [];
35
- var env = p.env || {};
36
- var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
37
- var formatter = (open, close, replace = open) => (input) => {
38
- let string = "" + input, index = string.indexOf(close, open.length);
39
- return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
40
- };
41
- var replaceClose = (string, close, replace, index) => {
42
- let result = "", cursor = 0;
43
- do {
44
- result += string.substring(cursor, index) + replace;
45
- cursor = index + close.length;
46
- index = string.indexOf(close, cursor);
47
- } while (~index);
48
- return result + string.substring(cursor);
49
- };
50
- var createColors = (enabled = isColorSupported) => {
51
- let f = enabled ? formatter : () => String;
52
- return {
53
- isColorSupported: enabled,
54
- reset: f("\x1B[0m", "\x1B[0m"),
55
- bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
56
- dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
57
- italic: f("\x1B[3m", "\x1B[23m"),
58
- underline: f("\x1B[4m", "\x1B[24m"),
59
- inverse: f("\x1B[7m", "\x1B[27m"),
60
- hidden: f("\x1B[8m", "\x1B[28m"),
61
- strikethrough: f("\x1B[9m", "\x1B[29m"),
62
- black: f("\x1B[30m", "\x1B[39m"),
63
- red: f("\x1B[31m", "\x1B[39m"),
64
- green: f("\x1B[32m", "\x1B[39m"),
65
- yellow: f("\x1B[33m", "\x1B[39m"),
66
- blue: f("\x1B[34m", "\x1B[39m"),
67
- magenta: f("\x1B[35m", "\x1B[39m"),
68
- cyan: f("\x1B[36m", "\x1B[39m"),
69
- white: f("\x1B[37m", "\x1B[39m"),
70
- gray: f("\x1B[90m", "\x1B[39m"),
71
- bgBlack: f("\x1B[40m", "\x1B[49m"),
72
- bgRed: f("\x1B[41m", "\x1B[49m"),
73
- bgGreen: f("\x1B[42m", "\x1B[49m"),
74
- bgYellow: f("\x1B[43m", "\x1B[49m"),
75
- bgBlue: f("\x1B[44m", "\x1B[49m"),
76
- bgMagenta: f("\x1B[45m", "\x1B[49m"),
77
- bgCyan: f("\x1B[46m", "\x1B[49m"),
78
- bgWhite: f("\x1B[47m", "\x1B[49m"),
79
- blackBright: f("\x1B[90m", "\x1B[39m"),
80
- redBright: f("\x1B[91m", "\x1B[39m"),
81
- greenBright: f("\x1B[92m", "\x1B[39m"),
82
- yellowBright: f("\x1B[93m", "\x1B[39m"),
83
- blueBright: f("\x1B[94m", "\x1B[39m"),
84
- magentaBright: f("\x1B[95m", "\x1B[39m"),
85
- cyanBright: f("\x1B[96m", "\x1B[39m"),
86
- whiteBright: f("\x1B[97m", "\x1B[39m"),
87
- bgBlackBright: f("\x1B[100m", "\x1B[49m"),
88
- bgRedBright: f("\x1B[101m", "\x1B[49m"),
89
- bgGreenBright: f("\x1B[102m", "\x1B[49m"),
90
- bgYellowBright: f("\x1B[103m", "\x1B[49m"),
91
- bgBlueBright: f("\x1B[104m", "\x1B[49m"),
92
- bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
93
- bgCyanBright: f("\x1B[106m", "\x1B[49m"),
94
- bgWhiteBright: f("\x1B[107m", "\x1B[49m")
95
- };
96
- };
97
- module.exports = createColors();
98
- module.exports.createColors = createColors;
99
- });
100
-
101
31
  // ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
102
32
  var require_src = __commonJS((exports, module) => {
103
33
  var ESC = "\x1B";
@@ -156,7 +86,7 @@ var require_src = __commonJS((exports, module) => {
156
86
  module.exports = { cursor, scroll, erase, beep };
157
87
  });
158
88
 
159
- // ../../node_modules/.bun/@stricli+core@1.2.5/node_modules/@stricli/core/dist/index.js
89
+ // ../../node_modules/.bun/@stricli+core@1.2.6/node_modules/@stricli/core/dist/index.js
160
90
  function checkEnvironmentVariable(process2, varName) {
161
91
  const value = process2.env?.[varName];
162
92
  return typeof value === "string" && value !== "0";
@@ -1564,7 +1494,7 @@ function formatDocumentationForFlagParameters(flags, aliases, args) {
1564
1494
  suffixParts.push(choices);
1565
1495
  }
1566
1496
  if (hasDefault(flag)) {
1567
- const defaultKeyword = args.ansiColor ? `\x1B[90m${keywords.default}\x1B[39m` : keywords.default;
1497
+ const defaultKeyword = args.ansiColor ? `\x1B[2m${keywords.default}\x1B[22m` : keywords.default;
1568
1498
  let defaultValue;
1569
1499
  if (Array.isArray(flag.default)) {
1570
1500
  if (flag.default.length === 0) {
@@ -1579,7 +1509,7 @@ function formatDocumentationForFlagParameters(flags, aliases, args) {
1579
1509
  suffixParts.push(`${defaultKeyword} ${defaultValue}`);
1580
1510
  }
1581
1511
  if ("variadic" in flag && typeof flag.variadic === "string") {
1582
- const separatorKeyword = args.ansiColor ? `\x1B[90m${keywords.separator}\x1B[39m` : keywords.separator;
1512
+ const separatorKeyword = args.ansiColor ? `\x1B[2m${keywords.separator}\x1B[22m` : keywords.separator;
1583
1513
  suffixParts.push(`${separatorKeyword} ${flag.variadic}`);
1584
1514
  }
1585
1515
  const suffix = suffixParts.length > 0 ? `[${suffixParts.join(", ")}]` : undefined;
@@ -1624,9 +1554,9 @@ function formatDocumentationForFlagParameters(flags, aliases, args) {
1624
1554
  return [row.aliases, row.flagName, row.brief, row.suffix ?? ""];
1625
1555
  }
1626
1556
  return [
1627
- row.hidden ? `\x1B[90m${row.aliases}\x1B[39m` : `\x1B[97m${row.aliases}\x1B[39m`,
1628
- row.hidden ? `\x1B[90m${row.flagName}\x1B[39m` : `\x1B[97m${row.flagName}\x1B[39m`,
1629
- row.hidden ? `\x1B[90m${row.brief}\x1B[39m` : `\x1B[03m${row.brief}\x1B[23m`,
1557
+ row.hidden ? `\x1B[2m${row.aliases}\x1B[22m` : `\x1B[1m${row.aliases}\x1B[22m`,
1558
+ row.hidden ? `\x1B[2m${row.flagName}\x1B[22m` : `\x1B[1m${row.flagName}\x1B[22m`,
1559
+ row.hidden ? `\x1B[2;3m${row.brief}\x1B[22;23m` : `\x1B[;;3m${row.brief}\x1B[;;;23m`,
1630
1560
  row.suffix ?? ""
1631
1561
  ];
1632
1562
  }), [" ", " ", " "]);
@@ -1644,7 +1574,7 @@ function* generateBuiltInFlagUsageLines(args) {
1644
1574
  function formatDocumentationForPositionalParameters(positional, args) {
1645
1575
  if (positional.kind === "array") {
1646
1576
  const name = positional.parameter.placeholder ?? "args";
1647
- const argName = args.ansiColor ? `\x1B[97m${name}...\x1B[39m` : `${name}...`;
1577
+ const argName = args.ansiColor ? `\x1B[1m${name}...\x1B[22m` : `${name}...`;
1648
1578
  const brief = args.ansiColor ? `\x1B[3m${positional.parameter.brief}\x1B[23m` : positional.parameter.brief;
1649
1579
  return formatRowsWithColumns([[argName, brief]], [" "]);
1650
1580
  }
@@ -1659,11 +1589,11 @@ function formatDocumentationForPositionalParameters(positional, args) {
1659
1589
  name = ` ${name}`;
1660
1590
  }
1661
1591
  if (def.default) {
1662
- const defaultKeyword = args.ansiColor ? `\x1B[90m${keywords.default}\x1B[39m` : keywords.default;
1592
+ const defaultKeyword = args.ansiColor ? `\x1B[2m${keywords.default}\x1B[22m` : keywords.default;
1663
1593
  suffix = `[${defaultKeyword} ${def.default}]`;
1664
1594
  }
1665
1595
  return [
1666
- args.ansiColor ? `\x1B[97m${name}\x1B[39m` : name,
1596
+ args.ansiColor ? `\x1B[1m${name}\x1B[22m` : name,
1667
1597
  args.ansiColor ? `\x1B[3m${def.brief}\x1B[23m` : def.brief,
1668
1598
  suffix ?? ""
1669
1599
  ];
@@ -1673,7 +1603,7 @@ function* generateCommandHelpLines(parameters, docs, args) {
1673
1603
  const { brief, fullDescription, customUsage } = docs;
1674
1604
  const { headers } = args.text;
1675
1605
  const prefix = args.prefix.join(" ");
1676
- yield args.ansiColor ? `\x1B[1m${headers.usage}\x1B[22m` : headers.usage;
1606
+ yield args.ansiColor ? `\x1B[4m${headers.usage}\x1B[24m` : headers.usage;
1677
1607
  if (customUsage) {
1678
1608
  for (const usage of customUsage) {
1679
1609
  if (typeof usage === "string") {
@@ -1695,20 +1625,20 @@ function* generateCommandHelpLines(parameters, docs, args) {
1695
1625
  if (args.aliases && args.aliases.length > 0) {
1696
1626
  const aliasPrefix = args.prefix.slice(0, -1).join(" ");
1697
1627
  yield "";
1698
- yield args.ansiColor ? `\x1B[1m${headers.aliases}\x1B[22m` : headers.aliases;
1628
+ yield args.ansiColor ? `\x1B[4m${headers.aliases}\x1B[24m` : headers.aliases;
1699
1629
  for (const alias of args.aliases) {
1700
1630
  yield ` ${aliasPrefix} ${alias}`;
1701
1631
  }
1702
1632
  }
1703
1633
  yield "";
1704
- yield args.ansiColor ? `\x1B[1m${headers.flags}\x1B[22m` : headers.flags;
1634
+ yield args.ansiColor ? `\x1B[4m${headers.flags}\x1B[24m` : headers.flags;
1705
1635
  for (const line of formatDocumentationForFlagParameters(parameters.flags ?? {}, parameters.aliases ?? {}, args)) {
1706
1636
  yield ` ${line}`;
1707
1637
  }
1708
1638
  const positional = parameters.positional ?? { kind: "tuple", parameters: [] };
1709
1639
  if (positional.kind === "array" || positional.parameters.length > 0) {
1710
1640
  yield "";
1711
- yield args.ansiColor ? `\x1B[1m${headers.arguments}\x1B[22m` : headers.arguments;
1641
+ yield args.ansiColor ? `\x1B[4m${headers.arguments}\x1B[24m` : headers.arguments;
1712
1642
  for (const line of formatDocumentationForPositionalParameters(positional, args)) {
1713
1643
  yield ` ${line}`;
1714
1644
  }
@@ -1796,7 +1726,7 @@ function buildCommand(builderArgs) {
1796
1726
  function* generateRouteMapHelpLines(routes, docs, args) {
1797
1727
  const { brief, fullDescription, hideRoute } = docs;
1798
1728
  const { headers } = args.text;
1799
- yield args.ansiColor ? `\x1B[1m${headers.usage}\x1B[22m` : headers.usage;
1729
+ yield args.ansiColor ? `\x1B[4m${headers.usage}\x1B[24m` : headers.usage;
1800
1730
  for (const [name, route] of Object.entries(routes)) {
1801
1731
  if (!hideRoute || !hideRoute[name] || args.includeHidden) {
1802
1732
  const externalRouteName = args.config.caseStyle === "convert-camel-to-kebab" ? convertCamelCaseToKebabCase(name) : name;
@@ -1815,18 +1745,18 @@ function* generateRouteMapHelpLines(routes, docs, args) {
1815
1745
  if (args.aliases && args.aliases.length > 0) {
1816
1746
  const aliasPrefix = args.prefix.slice(0, -1).join(" ");
1817
1747
  yield "";
1818
- yield args.ansiColor ? `\x1B[1m${headers.aliases}\x1B[22m` : headers.aliases;
1748
+ yield args.ansiColor ? `\x1B[4m${headers.aliases}\x1B[24m` : headers.aliases;
1819
1749
  for (const alias of args.aliases) {
1820
1750
  yield ` ${aliasPrefix} ${alias}`;
1821
1751
  }
1822
1752
  }
1823
1753
  yield "";
1824
- yield args.ansiColor ? `\x1B[1m${headers.flags}\x1B[22m` : headers.flags;
1754
+ yield args.ansiColor ? `\x1B[4m${headers.flags}\x1B[24m` : headers.flags;
1825
1755
  for (const line of formatDocumentationForFlagParameters({}, {}, args)) {
1826
1756
  yield ` ${line}`;
1827
1757
  }
1828
1758
  yield "";
1829
- yield args.ansiColor ? `\x1B[1m${headers.commands}\x1B[22m` : headers.commands;
1759
+ yield args.ansiColor ? `\x1B[4m${headers.commands}\x1B[24m` : headers.commands;
1830
1760
  const visibleRoutes = Object.entries(routes).filter(([name]) => !hideRoute || !hideRoute[name] || args.includeHidden);
1831
1761
  const rows = visibleRoutes.map(([internalRouteName, route]) => {
1832
1762
  const externalRouteName = formatForDisplay(internalRouteName, args.config.caseStyle);
@@ -1841,8 +1771,8 @@ function* generateRouteMapHelpLines(routes, docs, args) {
1841
1771
  return [row.routeName, row.brief];
1842
1772
  }
1843
1773
  return [
1844
- row.hidden ? `\x1B[90m${row.routeName}\x1B[39m` : `\x1B[97m${row.routeName}\x1B[39m`,
1845
- row.hidden ? `\x1B[90m${row.brief}\x1B[39m` : `\x1B[03m${row.brief}\x1B[23m`
1774
+ row.hidden ? `\x1B[2m${row.routeName}\x1B[22m` : `\x1B[1m${row.routeName}\x1B[32m`,
1775
+ row.hidden ? `\x1B[2;3m${row.brief}\x1B[22;23m` : `\x1B[;;3m${row.brief}\x1B[;;;23m`
1846
1776
  ];
1847
1777
  }), [" "]);
1848
1778
  for (const line of formattedRows) {
@@ -1959,7 +1889,7 @@ async function run(app, inputs, context) {
1959
1889
  // package.json
1960
1890
  var package_default = {
1961
1891
  name: "rudel",
1962
- version: "0.1.10",
1892
+ version: "0.1.11",
1963
1893
  type: "module",
1964
1894
  description: "CLI for the Coding Agent Analytics Platform rudel.ai",
1965
1895
  license: "MIT",
@@ -8135,18 +8065,18 @@ var devRouteMap = buildRouteMap({
8135
8065
  }
8136
8066
  });
8137
8067
 
8138
- // ../../node_modules/.bun/@clack+core@1.0.1/node_modules/@clack/core/dist/index.mjs
8139
- var import_picocolors = __toESM(require_picocolors(), 1);
8068
+ // ../../node_modules/.bun/@clack+core@1.1.0/node_modules/@clack/core/dist/index.mjs
8140
8069
  var import_sisteransi = __toESM(require_src(), 1);
8070
+ import { styleText as D } from "node:util";
8141
8071
  import { stdout as R, stdin as q } from "node:process";
8142
8072
  import * as k from "node:readline";
8143
8073
  import ot from "node:readline";
8144
8074
  import { ReadStream as J } from "node:tty";
8145
- function B(t, e, s) {
8075
+ function x(t, e, s) {
8146
8076
  if (!s.some((u) => !u.disabled))
8147
8077
  return t;
8148
8078
  const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
8149
- return s[n].disabled ? B(n, e < 0 ? -1 : 1, s) : n;
8079
+ return s[n].disabled ? x(n, e < 0 ? -1 : 1, s) : n;
8150
8080
  }
8151
8081
  var at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109;
8152
8082
  var lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
@@ -8224,7 +8154,7 @@ var X = (t, e = {}, s = {}) => {
8224
8154
  };
8225
8155
  var pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
8226
8156
  var S = (t, e = {}) => X(t, pt, e).width;
8227
- var W = "\x1B";
8157
+ var T = "\x1B";
8228
8158
  var Z = "›";
8229
8159
  var Ft = 39;
8230
8160
  var j = "\x07";
@@ -8253,15 +8183,15 @@ var mt = (t) => {
8253
8183
  if (t === 0)
8254
8184
  return 0;
8255
8185
  };
8256
- var st = (t) => `${W}${Q}${t}${tt}`;
8257
- var it = (t) => `${W}${U}${t}${j}`;
8186
+ var st = (t) => `${T}${Q}${t}${tt}`;
8187
+ var it = (t) => `${T}${U}${t}${j}`;
8258
8188
  var gt = (t) => t.map((e) => S(e));
8259
8189
  var G = (t, e, s) => {
8260
8190
  const i = e[Symbol.iterator]();
8261
8191
  let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
8262
8192
  for (;!l.done; ) {
8263
8193
  const m = l.value, A = S(m);
8264
- a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
8194
+ a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === T || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
8265
8195
  }
8266
8196
  u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
8267
8197
  };
@@ -8305,7 +8235,7 @@ var Et = (t, e, s = {}) => {
8305
8235
  let m = g.next(), A = g.next(), V = 0;
8306
8236
  for (;!m.done; ) {
8307
8237
  const h = m.value, o = A.value;
8308
- if (i += h, h === W || h === Z) {
8238
+ if (i += h, h === T || h === Z) {
8309
8239
  et.lastIndex = V + 1;
8310
8240
  const F = et.exec(E)?.groups;
8311
8241
  if (F?.code !== undefined) {
@@ -8353,11 +8283,11 @@ var z = Symbol("clack:cancel");
8353
8283
  function Ct(t) {
8354
8284
  return t === z;
8355
8285
  }
8356
- function T(t, e) {
8286
+ function W(t, e) {
8357
8287
  const s = t;
8358
8288
  s.isTTY && s.setRawMode(e);
8359
8289
  }
8360
- function Bt({ input: t = q, output: e = R, overwrite: s = true, hideCursor: i = true } = {}) {
8290
+ function xt({ input: t = q, output: e = R, overwrite: s = true, hideCursor: i = true } = {}) {
8361
8291
  const r = k.createInterface({ input: t, output: e, prompt: "", tabSize: 1 });
8362
8292
  k.emitKeypressEvents(t, r), t instanceof J && t.isTTY && t.setRawMode(true);
8363
8293
  const n = (u, { name: a, sequence: l }) => {
@@ -8381,14 +8311,14 @@ function Bt({ input: t = q, output: e = R, overwrite: s = true, hideCursor: i =
8381
8311
  }
8382
8312
  var rt = (t) => ("columns" in t) && typeof t.columns == "number" ? t.columns : 80;
8383
8313
  var nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20;
8384
- function xt(t, e, s, i = s) {
8314
+ function Bt(t, e, s, i = s) {
8385
8315
  const r = rt(t ?? R);
8386
8316
  return K(e, r - s.length, { hard: true, trim: false }).split(`
8387
8317
  `).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
8388
8318
  `);
8389
8319
  }
8390
8320
 
8391
- class x {
8321
+ class B {
8392
8322
  input;
8393
8323
  output;
8394
8324
  _abortSignal;
@@ -8436,10 +8366,10 @@ class x {
8436
8366
  this.state = "cancel", this.close();
8437
8367
  }, { once: true });
8438
8368
  }
8439
- this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), T(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
8440
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(this.value);
8369
+ this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && 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", () => {
8370
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e(this.value);
8441
8371
  }), this.once("cancel", () => {
8442
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(z);
8372
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e(z);
8443
8373
  });
8444
8374
  });
8445
8375
  }
@@ -8467,7 +8397,7 @@ class x {
8467
8397
  }
8468
8398
  close() {
8469
8399
  this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
8470
- `), T(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
8400
+ `), W(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
8471
8401
  }
8472
8402
  restoreCursor() {
8473
8403
  const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
@@ -8529,7 +8459,7 @@ function St(t, e) {
8529
8459
  return t ? e : e[0];
8530
8460
  }
8531
8461
 
8532
- class Vt extends x {
8462
+ class Vt extends B {
8533
8463
  filteredOptions;
8534
8464
  multiple;
8535
8465
  isNavigating = false;
@@ -8544,11 +8474,11 @@ class Vt extends x {
8544
8474
  }
8545
8475
  get userInputWithCursor() {
8546
8476
  if (!this.userInput)
8547
- return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
8477
+ return D(["inverse", "hidden"], "_");
8548
8478
  if (this._cursor >= this.userInput.length)
8549
8479
  return `${this.userInput}█`;
8550
8480
  const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
8551
- return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
8481
+ return `${e}${D("inverse", s)}${i.join("")}`;
8552
8482
  }
8553
8483
  get options() {
8554
8484
  return typeof this.#e == "function" ? this.#e() : this.#e;
@@ -8570,7 +8500,7 @@ class Vt extends x {
8570
8500
  }
8571
8501
  #r(e, s) {
8572
8502
  const i = s.name === "up", r = s.name === "down", n = s.name === "return";
8573
- i || r ? (this.#t = B(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
8503
+ i || r ? (this.#t = x(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
8574
8504
  }
8575
8505
  deselectAll() {
8576
8506
  this.selectedValues = [];
@@ -8584,14 +8514,14 @@ class Vt extends x {
8584
8514
  const s = this.options;
8585
8515
  e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
8586
8516
  const i = wt(this.focusedValue, this.filteredOptions);
8587
- this.#t = B(i, 0, this.filteredOptions);
8517
+ this.#t = x(i, 0, this.filteredOptions);
8588
8518
  const r = this.filteredOptions[this.#t];
8589
8519
  r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
8590
8520
  }
8591
8521
  }
8592
8522
  }
8593
8523
 
8594
- class kt extends x {
8524
+ class kt extends B {
8595
8525
  get cursor() {
8596
8526
  return this.value ? 0 : 1;
8597
8527
  }
@@ -8609,7 +8539,7 @@ class kt extends x {
8609
8539
  }
8610
8540
  }
8611
8541
 
8612
- class yt extends x {
8542
+ class yt extends B {
8613
8543
  options;
8614
8544
  cursor = 0;
8615
8545
  #t;
@@ -8656,8 +8586,7 @@ class yt extends x {
8656
8586
  });
8657
8587
  }
8658
8588
  }
8659
-
8660
- class Lt extends x {
8589
+ var Lt = class extends B {
8661
8590
  options;
8662
8591
  cursor = 0;
8663
8592
  get _value() {
@@ -8685,17 +8614,17 @@ class Lt extends x {
8685
8614
  constructor(e) {
8686
8615
  super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
8687
8616
  const s = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), 0);
8688
- this.cursor = this.options[s].disabled ? B(s, 1, this.options) : s, this.on("key", (i) => {
8617
+ this.cursor = this.options[s].disabled ? x(s, 1, this.options) : s, this.on("key", (i) => {
8689
8618
  i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
8690
8619
  }), this.on("cursor", (i) => {
8691
8620
  switch (i) {
8692
8621
  case "left":
8693
8622
  case "up":
8694
- this.cursor = B(this.cursor, -1, this.options);
8623
+ this.cursor = x(this.cursor, -1, this.options);
8695
8624
  break;
8696
8625
  case "down":
8697
8626
  case "right":
8698
- this.cursor = B(this.cursor, 1, this.options);
8627
+ this.cursor = x(this.cursor, 1, this.options);
8699
8628
  break;
8700
8629
  case "space":
8701
8630
  this.toggleValue();
@@ -8703,8 +8632,8 @@ class Lt extends x {
8703
8632
  }
8704
8633
  });
8705
8634
  }
8706
- }
8707
- class Wt extends x {
8635
+ };
8636
+ class Tt extends B {
8708
8637
  options;
8709
8638
  cursor = 0;
8710
8639
  get _selectedValue() {
@@ -8716,15 +8645,15 @@ class Wt extends x {
8716
8645
  constructor(e) {
8717
8646
  super(e, false), this.options = e.options;
8718
8647
  const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
8719
- this.cursor = this.options[i].disabled ? B(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
8648
+ this.cursor = this.options[i].disabled ? x(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
8720
8649
  switch (r) {
8721
8650
  case "left":
8722
8651
  case "up":
8723
- this.cursor = B(this.cursor, -1, this.options);
8652
+ this.cursor = x(this.cursor, -1, this.options);
8724
8653
  break;
8725
8654
  case "down":
8726
8655
  case "right":
8727
- this.cursor = B(this.cursor, 1, this.options);
8656
+ this.cursor = x(this.cursor, 1, this.options);
8728
8657
  break;
8729
8658
  }
8730
8659
  this.changeValue();
@@ -8732,401 +8661,404 @@ class Wt extends x {
8732
8661
  }
8733
8662
  }
8734
8663
 
8735
- // ../../node_modules/.bun/@clack+prompts@1.0.1/node_modules/@clack/prompts/dist/index.mjs
8736
- var import_picocolors2 = __toESM(require_picocolors(), 1);
8664
+ // ../../node_modules/.bun/@clack+prompts@1.1.0/node_modules/@clack/prompts/dist/index.mjs
8665
+ import { styleText as t, stripVTControlCharacters as ue } from "node:util";
8737
8666
  import N2 from "node:process";
8738
8667
  var import_sisteransi2 = __toESM(require_src(), 1);
8739
- function me() {
8668
+ function pt2() {
8740
8669
  return N2.platform !== "win32" ? N2.env.TERM !== "linux" : !!N2.env.CI || !!N2.env.WT_SESSION || !!N2.env.TERMINUS_SUBLIME || N2.env.ConEmuTask === "{cmd::Cmder}" || N2.env.TERM_PROGRAM === "Terminus-Sublime" || N2.env.TERM_PROGRAM === "vscode" || N2.env.TERM === "xterm-256color" || N2.env.TERM === "alacritty" || N2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
8741
8670
  }
8742
- var et2 = me();
8743
- var ct2 = () => process.env.CI === "true";
8744
- var C = (t, r) => et2 ? t : r;
8745
- var Rt = C("◆", "*");
8746
- var dt2 = C("■", "x");
8747
- var $t2 = C("▲", "x");
8748
- var V = C("◇", "o");
8749
- var ht2 = C("┌", "T");
8750
- var d = C("│", "|");
8751
- var x2 = C("└", "—");
8752
- var Ot = C("┐", "T");
8753
- var Pt = C("┘", "—");
8754
- var Q2 = C("●", ">");
8755
- var H2 = C("○", " ");
8756
- var st2 = C("◻", "[•]");
8757
- var U2 = C("◼", "[+]");
8758
- var q2 = C("◻", "[ ]");
8759
- var Nt = C("▪", "•");
8760
- var rt2 = C("─", "-");
8761
- var mt2 = C("╮", "+");
8762
- var Wt2 = C("├", "+");
8763
- var pt2 = C("╯", "+");
8764
- var gt2 = C("╰", "+");
8765
- var Lt2 = C("╭", "+");
8766
- var ft2 = C("●", "•");
8767
- var Ft2 = C("◆", "*");
8768
- var yt2 = C("▲", "!");
8769
- var Et2 = C("■", "x");
8770
- var W2 = (t) => {
8771
- switch (t) {
8671
+ var ee = pt2();
8672
+ var ce = () => process.env.CI === "true";
8673
+ var I2 = (e, r) => ee ? e : r;
8674
+ var Re = I2("◆", "*");
8675
+ var $e = I2("■", "x");
8676
+ var de = I2("▲", "x");
8677
+ var V = I2("◇", "o");
8678
+ var he = I2("┌", "T");
8679
+ var h = I2("│", "|");
8680
+ var x2 = I2("└", "—");
8681
+ var Oe = I2("┐", "T");
8682
+ var Pe = I2("┘", "—");
8683
+ var z2 = I2("●", ">");
8684
+ var H2 = I2("○", " ");
8685
+ var te = I2("◻", "[•]");
8686
+ var U2 = I2("◼", "[+]");
8687
+ var q2 = I2("◻", "[ ]");
8688
+ var Ne = I2("▪", "•");
8689
+ var se = I2("─", "-");
8690
+ var pe = I2("╮", "+");
8691
+ var We = I2("├", "+");
8692
+ var me = I2("╯", "+");
8693
+ var ge = I2("╰", "+");
8694
+ var Ge = I2("╭", "+");
8695
+ var fe = I2("●", "•");
8696
+ var Fe = I2("◆", "*");
8697
+ var ye = I2("▲", "!");
8698
+ var Ee = I2("■", "x");
8699
+ var W2 = (e) => {
8700
+ switch (e) {
8772
8701
  case "initial":
8773
8702
  case "active":
8774
- return import_picocolors2.default.cyan(Rt);
8703
+ return t("cyan", Re);
8775
8704
  case "cancel":
8776
- return import_picocolors2.default.red(dt2);
8705
+ return t("red", $e);
8777
8706
  case "error":
8778
- return import_picocolors2.default.yellow($t2);
8707
+ return t("yellow", de);
8779
8708
  case "submit":
8780
- return import_picocolors2.default.green(V);
8709
+ return t("green", V);
8781
8710
  }
8782
8711
  };
8783
- var vt2 = (t) => {
8784
- switch (t) {
8712
+ var ve = (e) => {
8713
+ switch (e) {
8785
8714
  case "initial":
8786
8715
  case "active":
8787
- return import_picocolors2.default.cyan(d);
8716
+ return t("cyan", h);
8788
8717
  case "cancel":
8789
- return import_picocolors2.default.red(d);
8718
+ return t("red", h);
8790
8719
  case "error":
8791
- return import_picocolors2.default.yellow(d);
8720
+ return t("yellow", h);
8792
8721
  case "submit":
8793
- return import_picocolors2.default.green(d);
8722
+ return t("green", h);
8794
8723
  }
8795
8724
  };
8796
- var pe = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109;
8797
- var ge = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
8798
- var fe = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141;
8799
- var At2 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
8800
- var it2 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
8801
- var nt2 = /\t{1,1000}/y;
8802
- var wt2 = /[\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;
8803
- var at2 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
8804
- var Fe = /\p{M}+/gu;
8805
- var ye = { limit: 1 / 0, ellipsis: "" };
8806
- var jt = (t, r = {}, s = {}) => {
8807
- const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? jt(a, ye, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, F = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
8808
- let $ = 0, m = 0, h = t.length, y2 = 0, f = false, v = h, S2 = Math.max(0, i - o), I2 = 0, B2 = 0, A = 0, w = 0;
8809
- t:
8725
+ var mt2 = (e) => e === 161 || e === 164 || e === 167 || e === 168 || e === 170 || e === 173 || e === 174 || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || e === 198 || e === 208 || e === 215 || e === 216 || e >= 222 && e <= 225 || e === 230 || e >= 232 && e <= 234 || e === 236 || e === 237 || e === 240 || e === 242 || e === 243 || e >= 247 && e <= 250 || e === 252 || e === 254 || e === 257 || e === 273 || e === 275 || e === 283 || e === 294 || e === 295 || e === 299 || e >= 305 && e <= 307 || e === 312 || e >= 319 && e <= 322 || e === 324 || e >= 328 && e <= 331 || e === 333 || e === 338 || e === 339 || e === 358 || e === 359 || e === 363 || e === 462 || e === 464 || e === 466 || e === 468 || e === 470 || e === 472 || e === 474 || e === 476 || e === 593 || e === 609 || e === 708 || e === 711 || e >= 713 && e <= 715 || e === 717 || e === 720 || e >= 728 && e <= 731 || e === 733 || e === 735 || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || e === 1025 || e >= 1040 && e <= 1103 || e === 1105 || e === 8208 || e >= 8211 && e <= 8214 || e === 8216 || e === 8217 || e === 8220 || e === 8221 || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || e === 8240 || e === 8242 || e === 8243 || e === 8245 || e === 8251 || e === 8254 || e === 8308 || e === 8319 || e >= 8321 && e <= 8324 || e === 8364 || e === 8451 || e === 8453 || e === 8457 || e === 8467 || e === 8470 || e === 8481 || e === 8482 || e === 8486 || e === 8491 || e === 8531 || e === 8532 || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || e === 8585 || e >= 8592 && e <= 8601 || e === 8632 || e === 8633 || e === 8658 || e === 8660 || e === 8679 || e === 8704 || e === 8706 || e === 8707 || e === 8711 || e === 8712 || e === 8715 || e === 8719 || e === 8721 || e === 8725 || e === 8730 || e >= 8733 && e <= 8736 || e === 8739 || e === 8741 || e >= 8743 && e <= 8748 || e === 8750 || e >= 8756 && e <= 8759 || e === 8764 || e === 8765 || e === 8776 || e === 8780 || e === 8786 || e === 8800 || e === 8801 || e >= 8804 && e <= 8807 || e === 8810 || e === 8811 || e === 8814 || e === 8815 || e === 8834 || e === 8835 || e === 8838 || e === 8839 || e === 8853 || e === 8857 || e === 8869 || e === 8895 || e === 8978 || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || e === 9632 || e === 9633 || e >= 9635 && e <= 9641 || e === 9650 || e === 9651 || e === 9654 || e === 9655 || e === 9660 || e === 9661 || e === 9664 || e === 9665 || e >= 9670 && e <= 9672 || e === 9675 || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || e === 9711 || e === 9733 || e === 9734 || e === 9737 || e === 9742 || e === 9743 || e === 9756 || e === 9758 || e === 9792 || e === 9794 || e === 9824 || e === 9825 || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || e === 9836 || e === 9837 || e === 9839 || e === 9886 || e === 9887 || e === 9919 || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || e === 9955 || e === 9960 || e === 9961 || e >= 9963 && e <= 9969 || e === 9972 || e >= 9974 && e <= 9977 || e === 9979 || e === 9980 || e === 9982 || e === 9983 || e === 10045 || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || e === 65533 || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || e === 127375 || e === 127376 || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109;
8726
+ var gt2 = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
8727
+ var ft2 = (e) => e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9800 && e <= 9811 || e === 9855 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141;
8728
+ var we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
8729
+ var re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
8730
+ var ie = /\t{1,1000}/y;
8731
+ var Ae = /[\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;
8732
+ var ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
8733
+ var Ft2 = /\p{M}+/gu;
8734
+ var yt2 = { limit: 1 / 0, ellipsis: "" };
8735
+ var Le = (e, r = {}, s = {}) => {
8736
+ const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, yt2, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
8737
+ let $ = 0, m = 0, d = e.length, F = 0, y2 = false, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S2 = 0;
8738
+ e:
8810
8739
  for (;; ) {
8811
- if (B2 > I2 || m >= h && m > $) {
8812
- const _2 = t.slice(I2, B2) || t.slice($, m);
8813
- y2 = 0;
8814
- for (const D2 of _2.replaceAll(Fe, "")) {
8815
- const T2 = D2.codePointAt(0) || 0;
8816
- if (ge(T2) ? w = F : fe(T2) ? w = E : c !== p && pe(T2) ? w = c : w = p, A + w > S2 && (v = Math.min(v, Math.max(I2, $) + y2)), A + w > i) {
8817
- f = true;
8818
- break t;
8740
+ if (b > A || m >= d && m > $) {
8741
+ const T2 = e.slice(A, b) || e.slice($, m);
8742
+ F = 0;
8743
+ for (const M2 of T2.replaceAll(Ft2, "")) {
8744
+ const O2 = M2.codePointAt(0) || 0;
8745
+ if (gt2(O2) ? S2 = f : ft2(O2) ? S2 = E : c !== g && mt2(O2) ? S2 = c : S2 = g, w + S2 > C && (v = Math.min(v, Math.max(A, $) + F)), w + S2 > i) {
8746
+ y2 = true;
8747
+ break e;
8819
8748
  }
8820
- y2 += D2.length, A += w;
8749
+ F += M2.length, w += S2;
8821
8750
  }
8822
- I2 = B2 = 0;
8751
+ A = b = 0;
8823
8752
  }
8824
- if (m >= h)
8753
+ if (m >= d)
8825
8754
  break;
8826
- if (at2.lastIndex = m, at2.test(t)) {
8827
- if (y2 = at2.lastIndex - m, w = y2 * p, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / p))), A + w > i) {
8828
- f = true;
8755
+ if (ne.lastIndex = m, ne.test(e)) {
8756
+ if (F = ne.lastIndex - m, S2 = F * g, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S2 > i) {
8757
+ y2 = true;
8829
8758
  break;
8830
8759
  }
8831
- A += w, I2 = $, B2 = m, m = $ = at2.lastIndex;
8760
+ w += S2, A = $, b = m, m = $ = ne.lastIndex;
8832
8761
  continue;
8833
8762
  }
8834
- if (At2.lastIndex = m, At2.test(t)) {
8835
- if (A + u > S2 && (v = Math.min(v, m)), A + u > i) {
8836
- f = true;
8763
+ if (we.lastIndex = m, we.test(e)) {
8764
+ if (w + u > C && (v = Math.min(v, m)), w + u > i) {
8765
+ y2 = true;
8837
8766
  break;
8838
8767
  }
8839
- A += u, I2 = $, B2 = m, m = $ = At2.lastIndex;
8768
+ w += u, A = $, b = m, m = $ = we.lastIndex;
8840
8769
  continue;
8841
8770
  }
8842
- if (it2.lastIndex = m, it2.test(t)) {
8843
- if (y2 = it2.lastIndex - m, w = y2 * l, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / l))), A + w > i) {
8844
- f = true;
8771
+ if (re.lastIndex = m, re.test(e)) {
8772
+ if (F = re.lastIndex - m, S2 = F * l, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S2 > i) {
8773
+ y2 = true;
8845
8774
  break;
8846
8775
  }
8847
- A += w, I2 = $, B2 = m, m = $ = it2.lastIndex;
8776
+ w += S2, A = $, b = m, m = $ = re.lastIndex;
8848
8777
  continue;
8849
8778
  }
8850
- if (nt2.lastIndex = m, nt2.test(t)) {
8851
- if (y2 = nt2.lastIndex - m, w = y2 * n, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / n))), A + w > i) {
8852
- f = true;
8779
+ if (ie.lastIndex = m, ie.test(e)) {
8780
+ if (F = ie.lastIndex - m, S2 = F * n, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S2 > i) {
8781
+ y2 = true;
8853
8782
  break;
8854
8783
  }
8855
- A += w, I2 = $, B2 = m, m = $ = nt2.lastIndex;
8784
+ w += S2, A = $, b = m, m = $ = ie.lastIndex;
8856
8785
  continue;
8857
8786
  }
8858
- if (wt2.lastIndex = m, wt2.test(t)) {
8859
- if (A + g > S2 && (v = Math.min(v, m)), A + g > i) {
8860
- f = true;
8787
+ if (Ae.lastIndex = m, Ae.test(e)) {
8788
+ if (w + p > C && (v = Math.min(v, m)), w + p > i) {
8789
+ y2 = true;
8861
8790
  break;
8862
8791
  }
8863
- A += g, I2 = $, B2 = m, m = $ = wt2.lastIndex;
8792
+ w += p, A = $, b = m, m = $ = Ae.lastIndex;
8864
8793
  continue;
8865
8794
  }
8866
8795
  m += 1;
8867
8796
  }
8868
- return { width: f ? S2 : A, index: f ? v : h, truncated: f, ellipsed: f && i >= o };
8797
+ return { width: y2 ? C : w, index: y2 ? v : d, truncated: y2, ellipsed: y2 && i >= o };
8869
8798
  };
8870
- var Ee = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
8871
- var M2 = (t, r = {}) => jt(t, Ee, r).width;
8872
- var ot2 = "\x1B";
8873
- var Gt = "›";
8874
- var ve = 39;
8875
- var Ct2 = "\x07";
8876
- var kt2 = "[";
8877
- var Ae = "]";
8878
- var Vt2 = "m";
8879
- var St2 = `${Ae}8;;`;
8880
- var Ht = new RegExp(`(?:\\${kt2}(?<code>\\d+)m|\\${St2}(?<uri>.*)${Ct2})`, "y");
8881
- var we = (t) => {
8882
- if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
8799
+ var Et2 = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
8800
+ var D2 = (e, r = {}) => Le(e, Et2, r).width;
8801
+ var ae = "\x1B";
8802
+ var je = "›";
8803
+ var vt2 = 39;
8804
+ var Ce = "\x07";
8805
+ var ke = "[";
8806
+ var wt2 = "]";
8807
+ var Ve = "m";
8808
+ var Se = `${wt2}8;;`;
8809
+ var He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y");
8810
+ var At2 = (e) => {
8811
+ if (e >= 30 && e <= 37 || e >= 90 && e <= 97)
8883
8812
  return 39;
8884
- if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
8813
+ if (e >= 40 && e <= 47 || e >= 100 && e <= 107)
8885
8814
  return 49;
8886
- if (t === 1 || t === 2)
8815
+ if (e === 1 || e === 2)
8887
8816
  return 22;
8888
- if (t === 3)
8817
+ if (e === 3)
8889
8818
  return 23;
8890
- if (t === 4)
8819
+ if (e === 4)
8891
8820
  return 24;
8892
- if (t === 7)
8821
+ if (e === 7)
8893
8822
  return 27;
8894
- if (t === 8)
8823
+ if (e === 8)
8895
8824
  return 28;
8896
- if (t === 9)
8825
+ if (e === 9)
8897
8826
  return 29;
8898
- if (t === 0)
8827
+ if (e === 0)
8899
8828
  return 0;
8900
8829
  };
8901
- var Ut = (t) => `${ot2}${kt2}${t}${Vt2}`;
8902
- var Kt = (t) => `${ot2}${St2}${t}${Ct2}`;
8903
- var Ce = (t) => t.map((r) => M2(r));
8904
- var It2 = (t, r, s) => {
8830
+ var Ue = (e) => `${ae}${ke}${e}${Ve}`;
8831
+ var Ke = (e) => `${ae}${Se}${e}${Ce}`;
8832
+ var Ct2 = (e) => e.map((r) => D2(r));
8833
+ var Ie = (e, r, s) => {
8905
8834
  const i = r[Symbol.iterator]();
8906
- let a = false, o = false, u = t.at(-1), l = u === undefined ? 0 : M2(u), n = i.next(), c = i.next(), g = 0;
8835
+ let a = false, o = false, u = e.at(-1), l = u === undefined ? 0 : D2(u), n = i.next(), c = i.next(), p = 0;
8907
8836
  for (;!n.done; ) {
8908
- const F = n.value, p = M2(F);
8909
- l + p <= s ? t[t.length - 1] += F : (t.push(F), l = 0), (F === ot2 || F === Gt) && (a = true, o = r.startsWith(St2, g + 1)), a ? o ? F === Ct2 && (a = false, o = false) : F === Vt2 && (a = false) : (l += p, l === s && !c.done && (t.push(""), l = 0)), n = c, c = i.next(), g += F.length;
8837
+ const f = n.value, g = D2(f);
8838
+ l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = true, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = false, o = false) : f === Ve && (a = false) : (l += g, l === s && !c.done && (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
8910
8839
  }
8911
- u = t.at(-1), !l && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
8840
+ u = e.at(-1), !l && u !== undefined && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
8912
8841
  };
8913
- var Se = (t) => {
8914
- const r = t.split(" ");
8842
+ var St2 = (e) => {
8843
+ const r = e.split(" ");
8915
8844
  let s = r.length;
8916
- for (;s > 0 && !(M2(r[s - 1]) > 0); )
8845
+ for (;s > 0 && !(D2(r[s - 1]) > 0); )
8917
8846
  s--;
8918
- return s === r.length ? t : r.slice(0, s).join(" ") + r.slice(s).join("");
8847
+ return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
8919
8848
  };
8920
- var Ie = (t, r, s = {}) => {
8921
- if (s.trim !== false && t.trim() === "")
8849
+ var It2 = (e, r, s = {}) => {
8850
+ if (s.trim !== false && e.trim() === "")
8922
8851
  return "";
8923
8852
  let i = "", a, o;
8924
- const u = t.split(" "), l = Ce(u);
8853
+ const u = e.split(" "), l = Ct2(u);
8925
8854
  let n = [""];
8926
8855
  for (const [$, m] of u.entries()) {
8927
8856
  s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
8928
- let h = M2(n.at(-1) ?? "");
8929
- if ($ !== 0 && (h >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), h = 0), (h > 0 || s.trim === false) && (n[n.length - 1] += " ", h++)), s.hard && l[$] > r) {
8930
- const y2 = r - h, f = 1 + Math.floor((l[$] - y2 - 1) / r);
8931
- Math.floor((l[$] - 1) / r) < f && n.push(""), It2(n, m, r);
8857
+ let d = D2(n.at(-1) ?? "");
8858
+ if ($ !== 0 && (d >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), d = 0), (d > 0 || s.trim === false) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
8859
+ const F = r - d, y2 = 1 + Math.floor((l[$] - F - 1) / r);
8860
+ Math.floor((l[$] - 1) / r) < y2 && n.push(""), Ie(n, m, r);
8932
8861
  continue;
8933
8862
  }
8934
- if (h + l[$] > r && h > 0 && l[$] > 0) {
8935
- if (s.wordWrap === false && h < r) {
8936
- It2(n, m, r);
8863
+ if (d + l[$] > r && d > 0 && l[$] > 0) {
8864
+ if (s.wordWrap === false && d < r) {
8865
+ Ie(n, m, r);
8937
8866
  continue;
8938
8867
  }
8939
8868
  n.push("");
8940
8869
  }
8941
- if (h + l[$] > r && s.wordWrap === false) {
8942
- It2(n, m, r);
8870
+ if (d + l[$] > r && s.wordWrap === false) {
8871
+ Ie(n, m, r);
8943
8872
  continue;
8944
8873
  }
8945
8874
  n[n.length - 1] += m;
8946
8875
  }
8947
- s.trim !== false && (n = n.map(($) => Se($)));
8876
+ s.trim !== false && (n = n.map(($) => St2($)));
8948
8877
  const c = n.join(`
8949
- `), g = c[Symbol.iterator]();
8950
- let F = g.next(), p = g.next(), E = 0;
8951
- for (;!F.done; ) {
8952
- const $ = F.value, m = p.value;
8953
- if (i += $, $ === ot2 || $ === Gt) {
8954
- Ht.lastIndex = E + 1;
8955
- const f = Ht.exec(c)?.groups;
8956
- if (f?.code !== undefined) {
8957
- const v = Number.parseFloat(f.code);
8958
- a = v === ve ? undefined : v;
8878
+ `), p = c[Symbol.iterator]();
8879
+ let f = p.next(), g = p.next(), E = 0;
8880
+ for (;!f.done; ) {
8881
+ const $ = f.value, m = g.value;
8882
+ if (i += $, $ === ae || $ === je) {
8883
+ He.lastIndex = E + 1;
8884
+ const y2 = He.exec(c)?.groups;
8885
+ if (y2?.code !== undefined) {
8886
+ const v = Number.parseFloat(y2.code);
8887
+ a = v === vt2 ? undefined : v;
8959
8888
  } else
8960
- f?.uri !== undefined && (o = f.uri.length === 0 ? undefined : f.uri);
8889
+ y2?.uri !== undefined && (o = y2.uri.length === 0 ? undefined : y2.uri);
8961
8890
  }
8962
- const h = a ? we(a) : undefined;
8891
+ const d = a ? At2(a) : undefined;
8963
8892
  m === `
8964
- ` ? (o && (i += Kt("")), a && h && (i += Ut(h))) : $ === `
8965
- ` && (a && h && (i += Ut(a)), o && (i += Kt(o))), E += $.length, F = p, p = g.next();
8893
+ ` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
8894
+ ` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
8966
8895
  }
8967
8896
  return i;
8968
8897
  };
8969
- function J2(t, r, s) {
8970
- return String(t).normalize().replaceAll(`\r
8898
+ function J2(e, r, s) {
8899
+ return String(e).normalize().replaceAll(`\r
8971
8900
  `, `
8972
8901
  `).split(`
8973
- `).map((i) => Ie(i, r, s)).join(`
8902
+ `).map((i) => It2(i, r, s)).join(`
8974
8903
  `);
8975
8904
  }
8976
- var be = (t, r, s, i, a) => {
8905
+ var bt2 = (e, r, s, i, a) => {
8977
8906
  let o = r, u = 0;
8978
8907
  for (let l = s;l < i; l++) {
8979
- const n = t[l];
8908
+ const n = e[l];
8980
8909
  if (o = o - n.length, u++, o <= a)
8981
8910
  break;
8982
8911
  }
8983
8912
  return { lineCount: o, removals: u };
8984
8913
  };
8985
- var X2 = (t) => {
8986
- const { cursor: r, options: s, style: i } = t, a = t.output ?? process.stdout, o = rt(a), u = t.columnPadding ?? 0, l = t.rowPadding ?? 4, n = o - u, c = nt(a), g = import_picocolors2.default.dim("..."), F = t.maxItems ?? Number.POSITIVE_INFINITY, p = Math.max(c - l, 0), E = Math.max(Math.min(F, p), 5);
8987
- let $ = 0;
8988
- r >= E - 3 && ($ = Math.max(Math.min(r - E + 3, s.length - E), 0));
8989
- let m = E < s.length && $ > 0, h = E < s.length && $ + E < s.length;
8990
- const y2 = Math.min($ + E, s.length), f = [];
8991
- let v = 0;
8992
- m && v++, h && v++;
8993
- const S2 = $ + (m ? 1 : 0), I2 = y2 - (h ? 1 : 0);
8994
- for (let A = S2;A < I2; A++) {
8995
- const w = J2(i(s[A], A === r), n, { hard: true, trim: false }).split(`
8914
+ var X2 = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = Number.POSITIVE_INFINITY, columnPadding: o = 0, rowPadding: u = 4 }) => {
8915
+ const l = rt(i) - o, n = nt(i), c = t("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
8916
+ let g = 0;
8917
+ e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
8918
+ let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
8919
+ const m = Math.min(g + f, r.length), d = [];
8920
+ let F = 0;
8921
+ E && F++, $ && F++;
8922
+ const y2 = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
8923
+ for (let A = y2;A < v; A++) {
8924
+ const b = J2(s(r[A], A === e), l, { hard: true, trim: false }).split(`
8996
8925
  `);
8997
- f.push(w), v += w.length;
8998
- }
8999
- if (v > p) {
9000
- let A = 0, w = 0, _2 = v;
9001
- const D2 = r - S2, T2 = (Y, L2) => be(f, _2, Y, L2, p);
9002
- m ? ({ lineCount: _2, removals: A } = T2(0, D2), _2 > p && ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length))) : ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length), _2 > p && ({ lineCount: _2, removals: A } = T2(0, D2))), A > 0 && (m = true, f.splice(0, A)), w > 0 && (h = true, f.splice(f.length - w, w));
9003
- }
9004
- const B2 = [];
9005
- m && B2.push(g);
9006
- for (const A of f)
9007
- for (const w of A)
9008
- B2.push(w);
9009
- return h && B2.push(g), B2;
8926
+ d.push(b), F += b.length;
8927
+ }
8928
+ if (F > p) {
8929
+ let A = 0, b = 0, w = F;
8930
+ const S2 = e - y2, T2 = (M2, O2) => bt2(d, w, M2, O2, p);
8931
+ E ? ({ lineCount: w, removals: A } = T2(0, S2), w > p && ({ lineCount: w, removals: b } = T2(S2 + 1, d.length))) : ({ lineCount: w, removals: b } = T2(S2 + 1, d.length), w > p && ({ lineCount: w, removals: A } = T2(0, S2))), A > 0 && (E = true, d.splice(0, A)), b > 0 && ($ = true, d.splice(d.length - b, b));
8932
+ }
8933
+ const C = [];
8934
+ E && C.push(c);
8935
+ for (const A of d)
8936
+ for (const b of A)
8937
+ C.push(b);
8938
+ return $ && C.push(c), C;
9010
8939
  };
9011
- var _e = [Lt2, mt2, gt2, pt2];
9012
- var De = [ht2, Ot, x2, Pt];
9013
- function Yt(t, r, s, i) {
8940
+ var _t2 = [Ge, pe, ge, me];
8941
+ var Dt2 = [he, Oe, x2, Pe];
8942
+ function Ye(e, r, s, i) {
9014
8943
  let a = s, o = s;
9015
- return i === "center" ? a = Math.floor((r - t) / 2) : i === "right" && (a = r - t - s), o = r - a - t, [a, o];
8944
+ return i === "center" ? a = Math.floor((r - e) / 2) : i === "right" && (a = r - e - s), o = r - a - e, [a, o];
9016
8945
  }
9017
- var Te = (t) => t;
9018
- var Me = (t = "", r = "", s) => {
9019
- const i = s?.output ?? process.stdout, a = rt(i), o = 2, u = s?.titlePadding ?? 1, l = s?.contentPadding ?? 2, n = s?.width === undefined || s.width === "auto" ? 1 : Math.min(1, s.width), c = s?.withGuide ?? _.withGuide ? `${d} ` : "", g = s?.formatBorder ?? Te, F = ((s?.rounded) ? _e : De).map(g), p = g(rt2), E = g(d), $ = M2(c), m = M2(r), h = a - $;
9020
- let y2 = Math.floor(a * n) - $;
8946
+ var Tt2 = (e) => e;
8947
+ var Mt2 = (e = "", r = "", s) => {
8948
+ const i = s?.output ?? process.stdout, a = rt(i), o = 2, u = s?.titlePadding ?? 1, l = s?.contentPadding ?? 2, n = s?.width === undefined || s.width === "auto" ? 1 : Math.min(1, s.width), c = s?.withGuide ?? _.withGuide ? `${h} ` : "", p = s?.formatBorder ?? Tt2, f = ((s?.rounded) ? _t2 : Dt2).map(p), g = p(se), E = p(h), $ = D2(c), m = D2(r), d = a - $;
8949
+ let F = Math.floor(a * n) - $;
9021
8950
  if (s?.width === "auto") {
9022
- const _2 = t.split(`
8951
+ const T2 = e.split(`
9023
8952
  `);
9024
- let D2 = m + u * 2;
9025
- for (const Y of _2) {
9026
- const L2 = M2(Y) + l * 2;
9027
- L2 > D2 && (D2 = L2);
8953
+ let M2 = m + u * 2;
8954
+ for (const le of T2) {
8955
+ const k2 = D2(le) + l * 2;
8956
+ k2 > M2 && (M2 = k2);
9028
8957
  }
9029
- const T2 = D2 + o;
9030
- T2 < y2 && (y2 = T2);
8958
+ const O2 = M2 + o;
8959
+ O2 < F && (F = O2);
9031
8960
  }
9032
- y2 % 2 !== 0 && (y2 < h ? y2++ : y2--);
9033
- const f = y2 - o, v = f - u * 2, S2 = m > v ? `${r.slice(0, v - 3)}...` : r, [I2, B2] = Yt(M2(S2), f, u, s?.titleAlign), A = J2(t, f - l * 2, { hard: true, trim: false });
9034
- i.write(`${c}${F[0]}${p.repeat(I2)}${S2}${p.repeat(B2)}${F[1]}
8961
+ F % 2 !== 0 && (F < d ? F++ : F--);
8962
+ const y2 = F - o, v = y2 - u * 2, C = m > v ? `${r.slice(0, v - 3)}...` : r, [A, b] = Ye(D2(C), y2, u, s?.titleAlign), w = J2(e, y2 - l * 2, { hard: true, trim: false });
8963
+ i.write(`${c}${f[0]}${g.repeat(A)}${C}${g.repeat(b)}${f[1]}
9035
8964
  `);
9036
- const w = A.split(`
8965
+ const S2 = w.split(`
9037
8966
  `);
9038
- for (const _2 of w) {
9039
- const [D2, T2] = Yt(M2(_2), f, l, s?.contentAlign);
9040
- i.write(`${c}${E}${" ".repeat(D2)}${_2}${" ".repeat(T2)}${E}
8967
+ for (const T2 of S2) {
8968
+ const [M2, O2] = Ye(D2(T2), y2, l, s?.contentAlign);
8969
+ i.write(`${c}${E}${" ".repeat(M2)}${T2}${" ".repeat(O2)}${E}
9041
8970
  `);
9042
8971
  }
9043
- i.write(`${c}${F[2]}${p.repeat(f)}${F[3]}
8972
+ i.write(`${c}${f[2]}${g.repeat(y2)}${f[3]}
9044
8973
  `);
9045
8974
  };
9046
- var Re = (t) => {
9047
- const r = t.active ?? "Yes", s = t.inactive ?? "No";
9048
- return new kt({ active: r, inactive: s, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue ?? true, render() {
9049
- const i = t.withGuide ?? _.withGuide, a = `${i ? `${import_picocolors2.default.gray(d)}
9050
- ` : ""}${W2(this.state)} ${t.message}
8975
+ var Rt = (e) => {
8976
+ const r = e.active ?? "Yes", s = e.inactive ?? "No";
8977
+ return new kt({ active: r, inactive: s, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue ?? true, render() {
8978
+ const i = e.withGuide ?? _.withGuide, a = `${i ? `${t("gray", h)}
8979
+ ` : ""}${W2(this.state)} ${e.message}
9051
8980
  `, o = this.value ? r : s;
9052
8981
  switch (this.state) {
9053
8982
  case "submit": {
9054
- const u = i ? `${import_picocolors2.default.gray(d)} ` : "";
9055
- return `${a}${u}${import_picocolors2.default.dim(o)}`;
8983
+ const u = i ? `${t("gray", h)} ` : "";
8984
+ return `${a}${u}${t("dim", o)}`;
9056
8985
  }
9057
8986
  case "cancel": {
9058
- const u = i ? `${import_picocolors2.default.gray(d)} ` : "";
9059
- return `${a}${u}${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o))}${i ? `
9060
- ${import_picocolors2.default.gray(d)}` : ""}`;
8987
+ const u = i ? `${t("gray", h)} ` : "";
8988
+ return `${a}${u}${t(["strikethrough", "dim"], o)}${i ? `
8989
+ ${t("gray", h)}` : ""}`;
9061
8990
  }
9062
8991
  default: {
9063
- const u = i ? `${import_picocolors2.default.cyan(d)} ` : "", l = i ? import_picocolors2.default.cyan(x2) : "";
9064
- return `${a}${u}${this.value ? `${import_picocolors2.default.green(Q2)} ${r}` : `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(r)}`}${t.vertical ? i ? `
9065
- ${import_picocolors2.default.cyan(d)} ` : `
9066
- ` : ` ${import_picocolors2.default.dim("/")} `}${this.value ? `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.green(Q2)} ${s}`}
8992
+ const u = i ? `${t("cyan", h)} ` : "", l = i ? t("cyan", x2) : "";
8993
+ return `${a}${u}${this.value ? `${t("green", z2)} ${r}` : `${t("dim", H2)} ${t("dim", r)}`}${e.vertical ? i ? `
8994
+ ${t("cyan", h)} ` : `
8995
+ ` : ` ${t("dim", "/")} `}${this.value ? `${t("dim", H2)} ${t("dim", s)}` : `${t("green", z2)} ${s}`}
9067
8996
  ${l}
9068
8997
  `;
9069
8998
  }
9070
8999
  }
9071
9000
  } }).prompt();
9072
9001
  };
9073
- var R2 = { message: (t = [], { symbol: r = import_picocolors2.default.gray(d), secondarySymbol: s = import_picocolors2.default.gray(d), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
9074
- const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", g = l ? `${s} ` : "";
9075
- for (let p = 0;p < a; p++)
9002
+ var R2 = { message: (e = [], { symbol: r = t("gray", h), secondarySymbol: s = t("gray", h), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
9003
+ const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", p = l ? `${s} ` : "";
9004
+ for (let g = 0;g < a; g++)
9076
9005
  u.push(n);
9077
- const F = Array.isArray(t) ? t : t.split(`
9006
+ const f = Array.isArray(e) ? e : e.split(`
9078
9007
  `);
9079
- if (F.length > 0) {
9080
- const [p, ...E] = F;
9081
- p.length > 0 ? u.push(`${c}${p}`) : u.push(l ? r : "");
9008
+ if (f.length > 0) {
9009
+ const [g, ...E] = f;
9010
+ g.length > 0 ? u.push(`${c}${g}`) : u.push(l ? r : "");
9082
9011
  for (const $ of E)
9083
- $.length > 0 ? u.push(`${g}${$}`) : u.push(l ? s : "");
9012
+ $.length > 0 ? u.push(`${p}${$}`) : u.push(l ? s : "");
9084
9013
  }
9085
9014
  i.write(`${u.join(`
9086
9015
  `)}
9087
9016
  `);
9088
- }, info: (t, r) => {
9089
- R2.message(t, { ...r, symbol: import_picocolors2.default.blue(ft2) });
9090
- }, success: (t, r) => {
9091
- R2.message(t, { ...r, symbol: import_picocolors2.default.green(Ft2) });
9092
- }, step: (t, r) => {
9093
- R2.message(t, { ...r, symbol: import_picocolors2.default.green(V) });
9094
- }, warn: (t, r) => {
9095
- R2.message(t, { ...r, symbol: import_picocolors2.default.yellow(yt2) });
9096
- }, warning: (t, r) => {
9097
- R2.warn(t, r);
9098
- }, error: (t, r) => {
9099
- R2.message(t, { ...r, symbol: import_picocolors2.default.red(Et2) });
9017
+ }, info: (e, r) => {
9018
+ R2.message(e, { ...r, symbol: t("blue", fe) });
9019
+ }, success: (e, r) => {
9020
+ R2.message(e, { ...r, symbol: t("green", Fe) });
9021
+ }, step: (e, r) => {
9022
+ R2.message(e, { ...r, symbol: t("green", V) });
9023
+ }, warn: (e, r) => {
9024
+ R2.message(e, { ...r, symbol: t("yellow", ye) });
9025
+ }, warning: (e, r) => {
9026
+ R2.warn(e, r);
9027
+ }, error: (e, r) => {
9028
+ R2.message(e, { ...r, symbol: t("red", Ee) });
9100
9029
  } };
9101
- var Ne = (t = "", r) => {
9102
- (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(x2)} ${import_picocolors2.default.red(t)}
9030
+ var Nt = (e = "", r) => {
9031
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", x2)} ` : "";
9032
+ s.write(`${i}${t("red", e)}
9103
9033
 
9104
9034
  `);
9105
9035
  };
9106
- var We = (t = "", r) => {
9107
- (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(ht2)} ${t}
9036
+ var Wt2 = (e = "", r) => {
9037
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", he)} ` : "";
9038
+ s.write(`${i}${e}
9108
9039
  `);
9109
9040
  };
9110
- var Le = (t = "", r) => {
9111
- (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(d)}
9112
- ${import_picocolors2.default.gray(x2)} ${t}
9041
+ var Gt = (e = "", r) => {
9042
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", h)}
9043
+ ${t("gray", x2)} ` : "";
9044
+ s.write(`${i}${e}
9113
9045
 
9114
9046
  `);
9115
9047
  };
9116
- var Z2 = (t, r) => t.split(`
9048
+ var Q2 = (e, r) => e.split(`
9117
9049
  `).map((s) => r(s)).join(`
9118
9050
  `);
9119
- var je = (t) => {
9051
+ var Lt2 = (e) => {
9120
9052
  const r = (i, a) => {
9121
9053
  const o = i.label ?? String(i.value);
9122
- return a === "disabled" ? `${import_picocolors2.default.gray(q2)} ${Z2(o, (u) => import_picocolors2.default.strikethrough(import_picocolors2.default.gray(u)))}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${import_picocolors2.default.cyan(st2)} ${o}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "selected" ? `${import_picocolors2.default.green(U2)} ${Z2(o, import_picocolors2.default.dim)}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Z2(o, (u) => import_picocolors2.default.strikethrough(import_picocolors2.default.dim(u)))}` : a === "active-selected" ? `${import_picocolors2.default.green(U2)} ${o}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "submitted" ? `${Z2(o, import_picocolors2.default.dim)}` : `${import_picocolors2.default.dim(q2)} ${Z2(o, import_picocolors2.default.dim)}`;
9123
- }, s = t.required ?? true;
9124
- return new Lt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValues: t.initialValues, required: s, cursorAt: t.cursorAt, validate(i) {
9054
+ return a === "disabled" ? `${t("gray", q2)} ${Q2(o, (u) => t(["strikethrough", "gray"], u))}${i.hint ? ` ${t("dim", `(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${t("cyan", te)} ${o}${i.hint ? ` ${t("dim", `(${i.hint})`)}` : ""}` : a === "selected" ? `${t("green", U2)} ${Q2(o, (u) => t("dim", u))}${i.hint ? ` ${t("dim", `(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Q2(o, (u) => t(["strikethrough", "dim"], u))}` : a === "active-selected" ? `${t("green", U2)} ${o}${i.hint ? ` ${t("dim", `(${i.hint})`)}` : ""}` : a === "submitted" ? `${Q2(o, (u) => t("dim", u))}` : `${t("dim", q2)} ${Q2(o, (u) => t("dim", u))}`;
9055
+ }, s = e.required ?? true;
9056
+ return new Lt({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValues: e.initialValues, required: s, cursorAt: e.cursorAt, validate(i) {
9125
9057
  if (s && (i === undefined || i.length === 0))
9126
9058
  return `Please select at least one option.
9127
- ${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
9059
+ ${t("reset", t("dim", `Press ${t(["gray", "bgWhite", "inverse"], " space ")} to select, ${t("gray", t("bgWhite", t("inverse", " enter ")))} to submit`))}`;
9128
9060
  }, render() {
9129
- const i = xt(t.output, t.message, `${vt2(this.state)} `, `${W2(this.state)} `), a = `${import_picocolors2.default.gray(d)}
9061
+ const i = Bt(e.output, e.message, `${ve(this.state)} `, `${W2(this.state)} `), a = `${t("gray", h)}
9130
9062
  ${i}
9131
9063
  `, o = this.value ?? [], u = (l, n) => {
9132
9064
  if (l.disabled)
@@ -9136,162 +9068,162 @@ ${i}
9136
9068
  };
9137
9069
  switch (this.state) {
9138
9070
  case "submit": {
9139
- const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none"), n = xt(t.output, l, `${import_picocolors2.default.gray(d)} `);
9071
+ const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(t("dim", ", ")) || t("dim", "none"), n = Bt(e.output, l, `${t("gray", h)} `);
9140
9072
  return `${a}${n}`;
9141
9073
  }
9142
9074
  case "cancel": {
9143
- const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(import_picocolors2.default.dim(", "));
9075
+ const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(t("dim", ", "));
9144
9076
  if (l.trim() === "")
9145
- return `${a}${import_picocolors2.default.gray(d)}`;
9146
- const n = xt(t.output, l, `${import_picocolors2.default.gray(d)} `);
9077
+ return `${a}${t("gray", h)}`;
9078
+ const n = Bt(e.output, l, `${t("gray", h)} `);
9147
9079
  return `${a}${n}
9148
- ${import_picocolors2.default.gray(d)}`;
9080
+ ${t("gray", h)}`;
9149
9081
  }
9150
9082
  case "error": {
9151
- const l = `${import_picocolors2.default.yellow(d)} `, n = this.error.split(`
9152
- `).map((F, p) => p === 0 ? `${import_picocolors2.default.yellow(x2)} ${import_picocolors2.default.yellow(F)}` : ` ${F}`).join(`
9083
+ const l = `${t("yellow", h)} `, n = this.error.split(`
9084
+ `).map((f, g) => g === 0 ? `${t("yellow", x2)} ${t("yellow", f)}` : ` ${f}`).join(`
9153
9085
  `), c = a.split(`
9154
- `).length, g = n.split(`
9086
+ `).length, p = n.split(`
9155
9087
  `).length + 1;
9156
- return `${a}${l}${X2({ output: t.output, options: this.options, cursor: this.cursor, maxItems: t.maxItems, columnPadding: l.length, rowPadding: c + g, style: u }).join(`
9088
+ return `${a}${l}${X2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: l.length, rowPadding: c + p, style: u }).join(`
9157
9089
  ${l}`)}
9158
9090
  ${n}
9159
9091
  `;
9160
9092
  }
9161
9093
  default: {
9162
- const l = `${import_picocolors2.default.cyan(d)} `, n = a.split(`
9094
+ const l = `${t("cyan", h)} `, n = a.split(`
9163
9095
  `).length;
9164
- return `${a}${l}${X2({ output: t.output, options: this.options, cursor: this.cursor, maxItems: t.maxItems, columnPadding: l.length, rowPadding: n + 2, style: u }).join(`
9096
+ return `${a}${l}${X2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: l.length, rowPadding: n + 2, style: u }).join(`
9165
9097
  ${l}`)}
9166
- ${import_picocolors2.default.cyan(x2)}
9098
+ ${t("cyan", x2)}
9167
9099
  `;
9168
9100
  }
9169
9101
  }
9170
9102
  } }).prompt();
9171
9103
  };
9172
- var Ke = import_picocolors2.default.magenta;
9173
- var bt2 = ({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = et2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], delay: u = et2 ? 80 : 120, signal: l, ...n } = {}) => {
9174
- const c = ct2();
9175
- let g, F, p = false, E = false, $ = "", m, h = performance.now();
9176
- const y2 = rt(s), f = n?.styleFrame ?? Ke, v = (b) => {
9177
- const O2 = b > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
9178
- E = b === 1, p && (L2(O2, b), E && typeof r == "function" && r());
9179
- }, S2 = () => v(2), I2 = () => v(1), B2 = () => {
9180
- process.on("uncaughtExceptionMonitor", S2), process.on("unhandledRejection", S2), process.on("SIGINT", I2), process.on("SIGTERM", I2), process.on("exit", v), l && l.addEventListener("abort", I2);
9181
- }, A = () => {
9182
- process.removeListener("uncaughtExceptionMonitor", S2), process.removeListener("unhandledRejection", S2), process.removeListener("SIGINT", I2), process.removeListener("SIGTERM", I2), process.removeListener("exit", v), l && l.removeEventListener("abort", I2);
9104
+ var Kt = (e) => t("magenta", e);
9105
+ var be = ({ indicator: e = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = ee ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], delay: u = ee ? 80 : 120, signal: l, ...n } = {}) => {
9106
+ const c = ce();
9107
+ let p, f, g = false, E = false, $ = "", m, d = performance.now();
9108
+ const F = rt(s), y2 = n?.styleFrame ?? Kt, v = (B2) => {
9109
+ const P2 = B2 > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
9110
+ E = B2 === 1, g && (k2(P2, B2), E && typeof r == "function" && r());
9111
+ }, C = () => v(2), A = () => v(1), b = () => {
9112
+ process.on("uncaughtExceptionMonitor", C), process.on("unhandledRejection", C), process.on("SIGINT", A), process.on("SIGTERM", A), process.on("exit", v), l && l.addEventListener("abort", A);
9183
9113
  }, w = () => {
9114
+ process.removeListener("uncaughtExceptionMonitor", C), process.removeListener("unhandledRejection", C), process.removeListener("SIGINT", A), process.removeListener("SIGTERM", A), process.removeListener("exit", v), l && l.removeEventListener("abort", A);
9115
+ }, S2 = () => {
9184
9116
  if (m === undefined)
9185
9117
  return;
9186
9118
  c && s.write(`
9187
9119
  `);
9188
- const b = J2(m, y2, { hard: true, trim: false }).split(`
9120
+ const B2 = J2(m, F, { hard: true, trim: false }).split(`
9189
9121
  `);
9190
- b.length > 1 && s.write(import_sisteransi2.cursor.up(b.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
9191
- }, _2 = (b) => b.replace(/\.+$/, ""), D2 = (b) => {
9192
- const O2 = (performance.now() - b) / 1000, j2 = Math.floor(O2 / 60), G2 = Math.floor(O2 % 60);
9193
- return j2 > 0 ? `[${j2}m ${G2}s]` : `[${G2}s]`;
9194
- }, T2 = n.withGuide ?? _.withGuide, Y = (b = "") => {
9195
- p = true, g = Bt({ output: s }), $ = _2(b), h = performance.now(), T2 && s.write(`${import_picocolors2.default.gray(d)}
9122
+ B2.length > 1 && s.write(import_sisteransi2.cursor.up(B2.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
9123
+ }, T2 = (B2) => B2.replace(/\.+$/, ""), M2 = (B2) => {
9124
+ const P2 = (performance.now() - B2) / 1000, G2 = Math.floor(P2 / 60), L2 = Math.floor(P2 % 60);
9125
+ return G2 > 0 ? `[${G2}m ${L2}s]` : `[${L2}s]`;
9126
+ }, O2 = n.withGuide ?? _.withGuide, le = (B2 = "") => {
9127
+ g = true, p = xt({ output: s }), $ = T2(B2), d = performance.now(), O2 && s.write(`${t("gray", h)}
9196
9128
  `);
9197
- let O2 = 0, j2 = 0;
9198
- B2(), F = setInterval(() => {
9129
+ let P2 = 0, G2 = 0;
9130
+ b(), f = setInterval(() => {
9199
9131
  if (c && $ === m)
9200
9132
  return;
9201
- w(), m = $;
9202
- const G2 = f(o[O2]);
9203
- let tt2;
9133
+ S2(), m = $;
9134
+ const L2 = y2(o[P2]);
9135
+ let Z2;
9204
9136
  if (c)
9205
- tt2 = `${G2} ${$}...`;
9206
- else if (t === "timer")
9207
- tt2 = `${G2} ${$} ${D2(h)}`;
9137
+ Z2 = `${L2} ${$}...`;
9138
+ else if (e === "timer")
9139
+ Z2 = `${L2} ${$} ${M2(d)}`;
9208
9140
  else {
9209
- const te = ".".repeat(Math.floor(j2)).slice(0, 3);
9210
- tt2 = `${G2} ${$}${te}`;
9141
+ const et2 = ".".repeat(Math.floor(G2)).slice(0, 3);
9142
+ Z2 = `${L2} ${$}${et2}`;
9211
9143
  }
9212
- const Zt = J2(tt2, y2, { hard: true, trim: false });
9213
- s.write(Zt), O2 = O2 + 1 < o.length ? O2 + 1 : 0, j2 = j2 < 4 ? j2 + 0.125 : 0;
9144
+ const Ze = J2(Z2, F, { hard: true, trim: false });
9145
+ s.write(Ze), P2 = P2 + 1 < o.length ? P2 + 1 : 0, G2 = G2 < 4 ? G2 + 0.125 : 0;
9214
9146
  }, u);
9215
- }, L2 = (b = "", O2 = 0, j2 = false) => {
9216
- if (!p)
9147
+ }, k2 = (B2 = "", P2 = 0, G2 = false) => {
9148
+ if (!g)
9217
9149
  return;
9218
- p = false, clearInterval(F), w();
9219
- const G2 = O2 === 0 ? import_picocolors2.default.green(V) : O2 === 1 ? import_picocolors2.default.red(dt2) : import_picocolors2.default.red($t2);
9220
- $ = b ?? $, j2 || (t === "timer" ? s.write(`${G2} ${$} ${D2(h)}
9221
- `) : s.write(`${G2} ${$}
9222
- `)), A(), g();
9150
+ g = false, clearInterval(f), S2();
9151
+ const L2 = P2 === 0 ? t("green", V) : P2 === 1 ? t("red", $e) : t("red", de);
9152
+ $ = B2 ?? $, G2 || (e === "timer" ? s.write(`${L2} ${$} ${M2(d)}
9153
+ `) : s.write(`${L2} ${$}
9154
+ `)), w(), p();
9223
9155
  };
9224
- return { start: Y, stop: (b = "") => L2(b, 0), message: (b = "") => {
9225
- $ = _2(b ?? $);
9226
- }, cancel: (b = "") => L2(b, 1), error: (b = "") => L2(b, 2), clear: () => L2("", 0, true), get isCancelled() {
9156
+ return { start: le, stop: (B2 = "") => k2(B2, 0), message: (B2 = "") => {
9157
+ $ = T2(B2 ?? $);
9158
+ }, cancel: (B2 = "") => k2(B2, 1), error: (B2 = "") => k2(B2, 2), clear: () => k2("", 0, true), get isCancelled() {
9227
9159
  return E;
9228
9160
  } };
9229
9161
  };
9230
- var zt = { light: C("─", "-"), heavy: C("━", "="), block: C("█", "#") };
9231
- function qe({ style: t = "heavy", max: r = 100, size: s = 40, ...i } = {}) {
9232
- const a = bt2(i);
9162
+ var ze = { light: I2("─", "-"), heavy: I2("━", "="), block: I2("█", "#") };
9163
+ function qt({ style: e = "heavy", max: r = 100, size: s = 40, ...i } = {}) {
9164
+ const a = be(i);
9233
9165
  let o = 0, u = "";
9234
9166
  const l = Math.max(1, r), n = Math.max(1, s), c = (E) => {
9235
9167
  switch (E) {
9236
9168
  case "initial":
9237
9169
  case "active":
9238
- return import_picocolors2.default.magenta;
9170
+ return ($) => t("magenta", $);
9239
9171
  case "error":
9240
9172
  case "cancel":
9241
- return import_picocolors2.default.red;
9173
+ return ($) => t("red", $);
9242
9174
  case "submit":
9243
- return import_picocolors2.default.green;
9175
+ return ($) => t("green", $);
9244
9176
  default:
9245
- return import_picocolors2.default.magenta;
9177
+ return ($) => t("magenta", $);
9246
9178
  }
9247
- }, g = (E, $) => {
9179
+ }, p = (E, $) => {
9248
9180
  const m = Math.floor(o / l * n);
9249
- return `${c(E)(zt[t].repeat(m))}${import_picocolors2.default.dim(zt[t].repeat(n - m))} ${$}`;
9250
- }, F = (E = "") => {
9251
- u = E, a.start(g("initial", E));
9252
- }, p = (E = 1, $) => {
9253
- o = Math.min(l, E + o), a.message(g("active", $ ?? u)), u = $ ?? u;
9181
+ return `${c(E)(ze[e].repeat(m))}${t("dim", ze[e].repeat(n - m))} ${$}`;
9182
+ }, f = (E = "") => {
9183
+ u = E, a.start(p("initial", E));
9184
+ }, g = (E = 1, $) => {
9185
+ o = Math.min(l, E + o), a.message(p("active", $ ?? u)), u = $ ?? u;
9254
9186
  };
9255
- return { start: F, stop: a.stop, cancel: a.cancel, error: a.error, clear: a.clear, advance: p, isCancelled: a.isCancelled, message: (E) => p(0, E) };
9187
+ return { start: f, stop: a.stop, cancel: a.cancel, error: a.error, clear: a.clear, advance: g, isCancelled: a.isCancelled, message: (E) => g(0, E) };
9256
9188
  }
9257
- var lt2 = (t, r) => t.includes(`
9258
- `) ? t.split(`
9189
+ var oe = (e, r) => e.includes(`
9190
+ `) ? e.split(`
9259
9191
  `).map((s) => r(s)).join(`
9260
- `) : r(t);
9261
- var Je = (t) => {
9192
+ `) : r(e);
9193
+ var Jt = (e) => {
9262
9194
  const r = (s, i) => {
9263
9195
  const a = s.label ?? String(s.value);
9264
9196
  switch (i) {
9265
9197
  case "disabled":
9266
- return `${import_picocolors2.default.gray(H2)} ${lt2(a, import_picocolors2.default.gray)}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint ?? "disabled"})`)}` : ""}`;
9198
+ return `${t("gray", H2)} ${oe(a, (o) => t("gray", o))}${s.hint ? ` ${t("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
9267
9199
  case "selected":
9268
- return `${lt2(a, import_picocolors2.default.dim)}`;
9200
+ return `${oe(a, (o) => t("dim", o))}`;
9269
9201
  case "active":
9270
- return `${import_picocolors2.default.green(Q2)} ${a}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint})`)}` : ""}`;
9202
+ return `${t("green", z2)} ${a}${s.hint ? ` ${t("dim", `(${s.hint})`)}` : ""}`;
9271
9203
  case "cancelled":
9272
- return `${lt2(a, (o) => import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o)))}`;
9204
+ return `${oe(a, (o) => t(["strikethrough", "dim"], o))}`;
9273
9205
  default:
9274
- return `${import_picocolors2.default.dim(H2)} ${lt2(a, import_picocolors2.default.dim)}`;
9206
+ return `${t("dim", H2)} ${oe(a, (o) => t("dim", o))}`;
9275
9207
  }
9276
9208
  };
9277
- return new Wt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue, render() {
9278
- const s = t.withGuide ?? _.withGuide, i = `${W2(this.state)} `, a = `${vt2(this.state)} `, o = xt(t.output, t.message, a, i), u = `${s ? `${import_picocolors2.default.gray(d)}
9209
+ return new Tt({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue, render() {
9210
+ const s = e.withGuide ?? _.withGuide, i = `${W2(this.state)} `, a = `${ve(this.state)} `, o = Bt(e.output, e.message, a, i), u = `${s ? `${t("gray", h)}
9279
9211
  ` : ""}${o}
9280
9212
  `;
9281
9213
  switch (this.state) {
9282
9214
  case "submit": {
9283
- const l = s ? `${import_picocolors2.default.gray(d)} ` : "", n = xt(t.output, r(this.options[this.cursor], "selected"), l);
9215
+ const l = s ? `${t("gray", h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "selected"), l);
9284
9216
  return `${u}${n}`;
9285
9217
  }
9286
9218
  case "cancel": {
9287
- const l = s ? `${import_picocolors2.default.gray(d)} ` : "", n = xt(t.output, r(this.options[this.cursor], "cancelled"), l);
9219
+ const l = s ? `${t("gray", h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "cancelled"), l);
9288
9220
  return `${u}${n}${s ? `
9289
- ${import_picocolors2.default.gray(d)}` : ""}`;
9221
+ ${t("gray", h)}` : ""}`;
9290
9222
  }
9291
9223
  default: {
9292
- const l = s ? `${import_picocolors2.default.cyan(d)} ` : "", n = s ? import_picocolors2.default.cyan(x2) : "", c = u.split(`
9293
- `).length, g = s ? 2 : 1;
9294
- return `${u}${l}${X2({ output: t.output, cursor: this.cursor, options: this.options, maxItems: t.maxItems, columnPadding: l.length, rowPadding: c + g, style: (F, p) => r(F, F.disabled ? "disabled" : p ? "active" : "inactive") }).join(`
9224
+ const l = s ? `${t("cyan", h)} ` : "", n = s ? t("cyan", x2) : "", c = u.split(`
9225
+ `).length, p = s ? 2 : 1;
9226
+ return `${u}${l}${X2({ output: e.output, cursor: this.cursor, options: this.options, maxItems: e.maxItems, columnPadding: l.length, rowPadding: c + p, style: (f, g) => r(f, f.disabled ? "disabled" : g ? "active" : "inactive") }).join(`
9295
9227
  ${l}`)}
9296
9228
  ${n}
9297
9229
  `;
@@ -9299,7 +9231,7 @@ ${n}
9299
9231
  }
9300
9232
  } }).prompt();
9301
9233
  };
9302
- var Qt = `${import_picocolors2.default.gray(d)} `;
9234
+ var Qe = `${t("gray", h)} `;
9303
9235
 
9304
9236
  // src/commands/disable.ts
9305
9237
  async function runDisable() {
@@ -9404,9 +9336,9 @@ async function runWithSpan({ name, context, ...options }, fn) {
9404
9336
  const callback = async (span) => {
9405
9337
  try {
9406
9338
  return await fn(span);
9407
- } catch (e2) {
9408
- setSpanError(span, e2, options);
9409
- throw e2;
9339
+ } catch (e) {
9340
+ setSpanError(span, e, options);
9341
+ throw e;
9410
9342
  } finally {
9411
9343
  span.end();
9412
9344
  }
@@ -10172,11 +10104,11 @@ function toEventIterator(stream, options = {}) {
10172
10104
  }
10173
10105
  }
10174
10106
  }
10175
- } catch (e2) {
10176
- if (!(e2 instanceof ErrorEvent)) {
10177
- setSpanError(span, e2, options);
10107
+ } catch (e) {
10108
+ if (!(e instanceof ErrorEvent)) {
10109
+ setSpanError(span, e, options);
10178
10110
  }
10179
- throw e2;
10111
+ throw e;
10180
10112
  }
10181
10113
  }, async (reason) => {
10182
10114
  try {
@@ -10185,9 +10117,9 @@ function toEventIterator(stream, options = {}) {
10185
10117
  span?.addEvent("cancelled");
10186
10118
  }
10187
10119
  await runInSpanContext(span, () => reader?.cancel());
10188
- } catch (e2) {
10189
- setSpanError(span, e2, options);
10190
- throw e2;
10120
+ } catch (e) {
10121
+ setSpanError(span, e, options);
10122
+ throw e;
10191
10123
  } finally {
10192
10124
  span?.end();
10193
10125
  }
@@ -10266,9 +10198,9 @@ function toEventStream(iterator, options = {}) {
10266
10198
  clearInterval(timeout);
10267
10199
  span?.addEvent("cancelled");
10268
10200
  await runInSpanContext(span, () => iterator.return?.());
10269
- } catch (e2) {
10270
- setSpanError(span, e2);
10271
- throw e2;
10201
+ } catch (e) {
10202
+ setSpanError(span, e);
10203
+ throw e;
10272
10204
  } finally {
10273
10205
  span?.end();
10274
10206
  }
@@ -10276,35 +10208,35 @@ function toEventStream(iterator, options = {}) {
10276
10208
  }).pipeThrough(new TextEncoderStream);
10277
10209
  return stream;
10278
10210
  }
10279
- function toStandardBody(re, options = {}) {
10211
+ function toStandardBody(re2, options = {}) {
10280
10212
  return runWithSpan({ name: "parse_standard_body", signal: options.signal }, async () => {
10281
- const contentDisposition = re.headers.get("content-disposition");
10213
+ const contentDisposition = re2.headers.get("content-disposition");
10282
10214
  if (typeof contentDisposition === "string") {
10283
10215
  const fileName = getFilenameFromContentDisposition(contentDisposition) ?? "blob";
10284
- const blob2 = await re.blob();
10216
+ const blob2 = await re2.blob();
10285
10217
  return new File([blob2], fileName, {
10286
10218
  type: blob2.type
10287
10219
  });
10288
10220
  }
10289
- const contentType = re.headers.get("content-type");
10221
+ const contentType = re2.headers.get("content-type");
10290
10222
  if (!contentType || contentType.startsWith("application/json")) {
10291
- const text = await re.text();
10223
+ const text = await re2.text();
10292
10224
  return parseEmptyableJSON(text);
10293
10225
  }
10294
10226
  if (contentType.startsWith("multipart/form-data")) {
10295
- return await re.formData();
10227
+ return await re2.formData();
10296
10228
  }
10297
10229
  if (contentType.startsWith("application/x-www-form-urlencoded")) {
10298
- const text = await re.text();
10230
+ const text = await re2.text();
10299
10231
  return new URLSearchParams(text);
10300
10232
  }
10301
10233
  if (contentType.startsWith("text/event-stream")) {
10302
- return toEventIterator(re.body, options);
10234
+ return toEventIterator(re2.body, options);
10303
10235
  }
10304
10236
  if (contentType.startsWith("text/plain")) {
10305
- return await re.text();
10237
+ return await re2.text();
10306
10238
  }
10307
- const blob = await re.blob();
10239
+ const blob = await re2.blob();
10308
10240
  return new File([blob], "blob", {
10309
10241
  type: blob.type
10310
10242
  });
@@ -10687,10 +10619,10 @@ class StandardRPCSerializer {
10687
10619
  if (isAsyncIteratorObject(data)) {
10688
10620
  return mapEventIterator(data, {
10689
10621
  value: async (value2) => this.#serialize(value2, false),
10690
- error: async (e2) => {
10622
+ error: async (e) => {
10691
10623
  return new ErrorEvent({
10692
- data: this.#serialize(toORPCError(e2).toJSON(), false),
10693
- cause: e2
10624
+ data: this.#serialize(toORPCError(e).toJSON(), false),
10625
+ cause: e
10694
10626
  });
10695
10627
  }
10696
10628
  });
@@ -10717,17 +10649,17 @@ class StandardRPCSerializer {
10717
10649
  if (isAsyncIteratorObject(data)) {
10718
10650
  return mapEventIterator(data, {
10719
10651
  value: async (value2) => this.#deserialize(value2),
10720
- error: async (e2) => {
10721
- if (!(e2 instanceof ErrorEvent)) {
10722
- return e2;
10652
+ error: async (e) => {
10653
+ if (!(e instanceof ErrorEvent)) {
10654
+ return e;
10723
10655
  }
10724
- const deserialized = this.#deserialize(e2.data);
10656
+ const deserialized = this.#deserialize(e.data);
10725
10657
  if (isORPCErrorJson(deserialized)) {
10726
- return createORPCErrorFromJson(deserialized, { cause: e2 });
10658
+ return createORPCErrorFromJson(deserialized, { cause: e });
10727
10659
  }
10728
10660
  return new ErrorEvent({
10729
10661
  data: deserialized,
10730
- cause: e2
10662
+ cause: e
10731
10663
  });
10732
10664
  }
10733
10665
  });
@@ -10792,11 +10724,11 @@ class RPCLink extends StandardRPCLink {
10792
10724
 
10793
10725
  // src/lib/api-client.ts
10794
10726
  function createApiClient(config) {
10727
+ const authType = config.authType ?? "bearer";
10728
+ const authHeaders = authType === "api-key" ? { "x-api-key": config.token } : { Authorization: `Bearer ${config.token}` };
10795
10729
  const link = new RPCLink({
10796
10730
  url: `${config.apiBaseUrl}/rpc`,
10797
- headers: {
10798
- Authorization: `Bearer ${config.token}`
10799
- }
10731
+ headers: authHeaders
10800
10732
  });
10801
10733
  return createORPCClient(link);
10802
10734
  }
@@ -10817,13 +10749,12 @@ function getConfigDir() {
10817
10749
  function getCredentialsPath() {
10818
10750
  return join8(getConfigDir(), "credentials.json");
10819
10751
  }
10820
- function saveCredentials(token, apiBaseUrl) {
10752
+ function saveCredentials(credentials) {
10821
10753
  const dir = getConfigDir();
10822
10754
  if (!existsSync6(dir)) {
10823
10755
  mkdirSync2(dir, { recursive: true, mode: 448 });
10824
10756
  }
10825
- const data = { token, apiBaseUrl };
10826
- writeFileSync3(getCredentialsPath(), JSON.stringify(data, null, 2), {
10757
+ writeFileSync3(getCredentialsPath(), JSON.stringify(credentials, null, 2), {
10827
10758
  mode: 384
10828
10759
  });
10829
10760
  }
@@ -10853,7 +10784,7 @@ async function verifyAuth() {
10853
10784
  }
10854
10785
  const client = createApiClient(credentials);
10855
10786
  try {
10856
- const user = await client.me();
10787
+ const user = credentials.authType === "api-key" ? await client.cli.authStatus() : await client.me();
10857
10788
  return { authenticated: true, credentials, user };
10858
10789
  } catch (error) {
10859
10790
  const message = String(error);
@@ -11170,6 +11101,8 @@ var DateRangeInputSchema = exports_external.object({
11170
11101
  startDate: exports_external.string().date(),
11171
11102
  endDate: exports_external.string().date()
11172
11103
  });
11104
+ var MAX_ID_FILTER_LENGTH = 512;
11105
+ var MAX_PATH_FILTER_LENGTH = 4096;
11173
11106
  var OverviewKPIsSchema = exports_external.object({
11174
11107
  distinct_users: exports_external.number(),
11175
11108
  distinct_sessions: exports_external.number(),
@@ -11304,11 +11237,11 @@ var DeveloperErrorSchema = exports_external.object({
11304
11237
  last_seen: exports_external.string()
11305
11238
  });
11306
11239
  var DeveloperDetailsInputSchema = DaysInputSchema.extend({
11307
- userId: exports_external.string()
11240
+ userId: exports_external.string().max(MAX_ID_FILTER_LENGTH)
11308
11241
  });
11309
11242
  var DeveloperSessionsInputSchema = DaysInputSchema.extend({
11310
- userId: exports_external.string(),
11311
- projectPath: exports_external.string().optional(),
11243
+ userId: exports_external.string().max(MAX_ID_FILTER_LENGTH),
11244
+ projectPath: exports_external.string().max(MAX_PATH_FILTER_LENGTH).optional(),
11312
11245
  outcome: exports_external.enum(["all", "success"]).default("all"),
11313
11246
  limit: exports_external.number().int().positive().default(100),
11314
11247
  offset: exports_external.number().int().nonnegative().default(0),
@@ -11362,13 +11295,14 @@ var ProjectErrorSchema = exports_external.object({
11362
11295
  var ProjectTrendDataPointSchema = exports_external.object({
11363
11296
  date: exports_external.string(),
11364
11297
  project_path: exports_external.string(),
11298
+ project_name: exports_external.string(),
11365
11299
  sessions: exports_external.number(),
11366
11300
  total_hours: exports_external.number(),
11367
11301
  total_tokens: exports_external.number(),
11368
11302
  avg_success_rate: exports_external.number()
11369
11303
  });
11370
11304
  var ProjectDetailsInputSchema = DaysInputSchema.extend({
11371
- projectPath: exports_external.string()
11305
+ projectPath: exports_external.string().max(MAX_PATH_FILTER_LENGTH)
11372
11306
  });
11373
11307
  var SessionAnalyticsSchema = exports_external.object({
11374
11308
  session_id: exports_external.string(),
@@ -11411,9 +11345,9 @@ var SessionAnalyticsSummaryComparisonSchema = exports_external.object({
11411
11345
  })
11412
11346
  });
11413
11347
  var SessionListInputSchema = DaysInputSchema.extend({
11414
- userId: exports_external.string().optional(),
11415
- projectPath: exports_external.string().optional(),
11416
- repository: exports_external.string().optional(),
11348
+ userId: exports_external.string().max(MAX_ID_FILTER_LENGTH).optional(),
11349
+ projectPath: exports_external.string().max(MAX_PATH_FILTER_LENGTH).optional(),
11350
+ repository: exports_external.string().max(MAX_PATH_FILTER_LENGTH).optional(),
11417
11351
  source: SourceSchema.optional(),
11418
11352
  limit: exports_external.number().int().positive().default(100),
11419
11353
  offset: exports_external.number().int().nonnegative().default(0),
@@ -11451,8 +11385,8 @@ var DimensionAnalysisInputSchema = DaysInputSchema.extend({
11451
11385
  metric: exports_external.enum(VALID_METRICS),
11452
11386
  splitBy: exports_external.enum(VALID_DIMENSIONS).optional(),
11453
11387
  limit: exports_external.number().int().positive().default(20),
11454
- userId: exports_external.string().optional(),
11455
- projectPath: exports_external.string().optional()
11388
+ userId: exports_external.string().max(MAX_ID_FILTER_LENGTH).optional(),
11389
+ projectPath: exports_external.string().max(MAX_PATH_FILTER_LENGTH).optional()
11456
11390
  });
11457
11391
  var DimensionAnalysisDataPointSchema = exports_external.object({
11458
11392
  dimension_value: exports_external.string(),
@@ -11483,7 +11417,7 @@ var SessionDetailSchema = exports_external.object({
11483
11417
  source: SourceSchema.optional()
11484
11418
  });
11485
11419
  var SessionDetailInputSchema = exports_external.object({
11486
- sessionId: exports_external.string()
11420
+ sessionId: exports_external.string().max(MAX_ID_FILTER_LENGTH)
11487
11421
  });
11488
11422
  var ROIMetricsSchema = exports_external.object({
11489
11423
  total_cost: exports_external.number(),
@@ -11558,7 +11492,7 @@ var ErrorTrendDataPointSchema = exports_external.object({
11558
11492
  total_errors: exports_external.number()
11559
11493
  });
11560
11494
  var ErrorTrendsInputSchema = DateRangeInputSchema.extend({
11561
- splitBy: exports_external.enum(["repository", "user_id", "model"]).default("repository")
11495
+ splitBy: exports_external.enum(["project_path", "user_id", "model"]).default("project_path")
11562
11496
  });
11563
11497
  var RecurringErrorsInputSchema = DaysInputSchema.extend({
11564
11498
  minOccurrences: exports_external.number().int().positive().default(2),
@@ -11600,6 +11534,11 @@ var UserSchema = exports_external.object({
11600
11534
  image: exports_external.string().nullable(),
11601
11535
  activeOrganizationId: exports_external.string().nullable()
11602
11536
  });
11537
+ var CliUserSchema = exports_external.object({
11538
+ id: exports_external.string(),
11539
+ email: exports_external.string(),
11540
+ name: exports_external.string()
11541
+ });
11603
11542
  var OrganizationSchema = exports_external.object({
11604
11543
  id: exports_external.string(),
11605
11544
  name: exports_external.string(),
@@ -11621,17 +11560,17 @@ var SubagentFileSchema = exports_external.object({
11621
11560
  });
11622
11561
  var IngestSessionInputSchema = exports_external.object({
11623
11562
  source: SourceSchema.default("claude_code"),
11624
- sessionId: exports_external.string(),
11625
- projectPath: exports_external.string(),
11626
- gitRemote: exports_external.string().optional(),
11627
- packageName: exports_external.string().optional(),
11628
- packageType: exports_external.string().optional(),
11629
- gitBranch: exports_external.string().optional(),
11630
- gitSha: exports_external.string().optional(),
11563
+ sessionId: exports_external.string().max(200),
11564
+ projectPath: exports_external.string().max(200).transform((p) => p.replace(/\\/g, "/")),
11565
+ gitRemote: exports_external.string().max(200).optional(),
11566
+ packageName: exports_external.string().max(200).optional(),
11567
+ packageType: exports_external.string().max(200).optional(),
11568
+ gitBranch: exports_external.string().max(200).optional(),
11569
+ gitSha: exports_external.string().max(200).optional(),
11631
11570
  tag: SessionTagSchema.optional(),
11632
11571
  content: exports_external.string(),
11633
11572
  subagents: exports_external.array(SubagentFileSchema).optional(),
11634
- organizationId: exports_external.string().optional()
11573
+ organizationId: exports_external.string().max(200).optional()
11635
11574
  });
11636
11575
  var IngestSessionOutputSchema = exports_external.object({
11637
11576
  success: exports_external.literal(true),
@@ -11640,6 +11579,10 @@ var IngestSessionOutputSchema = exports_external.object({
11640
11579
  var contract = {
11641
11580
  health: oc.output(HealthSchema),
11642
11581
  me: oc.output(UserSchema),
11582
+ cli: {
11583
+ authStatus: oc.output(CliUserSchema),
11584
+ revokeToken: oc.output(exports_external.object({ success: exports_external.literal(true) }))
11585
+ },
11643
11586
  listMyOrganizations: oc.output(exports_external.array(OrganizationSchema)),
11644
11587
  ingestSession: oc.input(IngestSessionInputSchema).output(IngestSessionOutputSchema),
11645
11588
  getOrganizationSessionCount: oc.input(exports_external.object({ organizationId: exports_external.string() })).output(exports_external.object({ count: exports_external.number() })),
@@ -11802,7 +11745,7 @@ async function batchUpload(options) {
11802
11745
  // src/lib/batch-upload-ui.ts
11803
11746
  async function runBatchUpload(options) {
11804
11747
  const { items, upload, label, concurrency } = options;
11805
- const bar = qe({ max: items.length });
11748
+ const bar = qt({ max: items.length });
11806
11749
  bar.start(label);
11807
11750
  const summary = await batchUpload({
11808
11751
  items,
@@ -11839,7 +11782,7 @@ function renderBatchSummary(summary, options) {
11839
11782
  lines.push("Run `rudel upload --retry` to retry failed uploads.");
11840
11783
  }
11841
11784
  if (lines.length > 0) {
11842
- Me(lines.join(`
11785
+ Mt2(lines.join(`
11843
11786
  `), "Upload Summary");
11844
11787
  }
11845
11788
  }
@@ -11934,9 +11877,7 @@ function formatError(error) {
11934
11877
  async function uploadSession(request, config) {
11935
11878
  const link = new RPCLink({
11936
11879
  url: config.endpoint,
11937
- headers: {
11938
- Authorization: `Bearer ${config.token}`
11939
- }
11880
+ headers: config.authType === "api-key" ? { "x-api-key": config.token } : { Authorization: `Bearer ${config.token}` }
11940
11881
  });
11941
11882
  const client = createORPCClient(link);
11942
11883
  for (let attempt = 1;attempt <= MAX_ATTEMPTS; attempt++) {
@@ -11967,27 +11908,31 @@ async function uploadSession(request, config) {
11967
11908
 
11968
11909
  // src/commands/enable.ts
11969
11910
  async function runEnable() {
11970
- We("rudel enable");
11911
+ Wt2("rudel enable");
11971
11912
  const auth = await verifyAuth();
11972
11913
  if (!auth.authenticated) {
11973
11914
  R2.error(auth.message);
11974
- Le("Run `rudel login` to authenticate.");
11915
+ Gt("Run `rudel login` to authenticate.");
11975
11916
  process.exitCode = 1;
11976
11917
  return;
11977
11918
  }
11978
11919
  const { credentials } = auth;
11979
- const client = createApiClient(credentials);
11980
11920
  let orgs;
11981
- try {
11982
- orgs = await client.listMyOrganizations();
11983
- } catch {
11984
- R2.error("Failed to fetch organizations. Check your connection.");
11985
- process.exitCode = 1;
11986
- return;
11921
+ if (credentials.authType === "api-key") {
11922
+ orgs = credentials.organizations ?? [];
11923
+ } else {
11924
+ const client = createApiClient(credentials);
11925
+ try {
11926
+ orgs = await client.listMyOrganizations();
11927
+ } catch {
11928
+ R2.error("Failed to fetch organizations. Check your connection.");
11929
+ process.exitCode = 1;
11930
+ return;
11931
+ }
11987
11932
  }
11988
11933
  if (orgs.length === 0) {
11989
11934
  R2.error("No organizations found.");
11990
- Le("Create one at app.rudel.ai first.");
11935
+ Gt("Create one at app.rudel.ai first.");
11991
11936
  process.exitCode = 1;
11992
11937
  return;
11993
11938
  }
@@ -12003,7 +11948,7 @@ async function runEnable() {
12003
11948
  R2.info(`Currently configured for: ${existingOrg.name}`);
12004
11949
  selectedOrgId = existingOrg.id;
12005
11950
  } else {
12006
- const selected = await Je({
11951
+ const selected = await Jt({
12007
11952
  message: "Select an organization for this repository",
12008
11953
  options: orgs.map((org) => ({
12009
11954
  value: org.id,
@@ -12012,7 +11957,7 @@ async function runEnable() {
12012
11957
  }))
12013
11958
  });
12014
11959
  if (Ct(selected)) {
12015
- Ne("Setup cancelled.");
11960
+ Nt("Setup cancelled.");
12016
11961
  return;
12017
11962
  }
12018
11963
  selectedOrgId = selected;
@@ -12030,14 +11975,14 @@ async function runEnable() {
12030
11975
  label: a.name,
12031
11976
  hint: a.isHookInstalled() ? "already enabled" : undefined
12032
11977
  }));
12033
- const selectedAdapters = await je({
11978
+ const selectedAdapters = await Lt2({
12034
11979
  message: "Select agents to enable auto-upload for",
12035
11980
  options: agentOptions,
12036
11981
  initialValues: adapters2,
12037
11982
  required: true
12038
11983
  });
12039
11984
  if (Ct(selectedAdapters)) {
12040
- Ne("Setup cancelled.");
11985
+ Nt("Setup cancelled.");
12041
11986
  return;
12042
11987
  }
12043
11988
  adaptersToEnable = selectedAdapters;
@@ -12058,7 +12003,7 @@ async function runEnable() {
12058
12003
  const sessions = await adapter.findProjectSessions(cwd);
12059
12004
  if (sessions.length === 0)
12060
12005
  continue;
12061
- const shouldUpload = await Re({
12006
+ const shouldUpload = await Rt({
12062
12007
  message: `Found ${sessions.length} previous ${adapter.name} session(s). Upload them now?`,
12063
12008
  initialValue: false
12064
12009
  });
@@ -12088,6 +12033,7 @@ async function runEnable() {
12088
12033
  return uploadSession(request, {
12089
12034
  endpoint,
12090
12035
  token: credentials.token,
12036
+ authType: credentials.authType,
12091
12037
  onRetry
12092
12038
  });
12093
12039
  }
@@ -12098,7 +12044,7 @@ async function runEnable() {
12098
12044
  if (totalFailed > 0) {
12099
12045
  R2.info("Run `rudel upload --retry` to retry failed uploads.");
12100
12046
  }
12101
- Le("Done!");
12047
+ Gt("Done!");
12102
12048
  if (totalFailed > 0) {
12103
12049
  process.exitCode = 1;
12104
12050
  }
@@ -13131,67 +13077,67 @@ function padThree(num) {
13131
13077
  }
13132
13078
  var timestampFormatters = {
13133
13079
  "date-time-timezone": (ts) => {
13134
- const d2 = new Date(ts);
13135
- const year = d2.getUTCFullYear();
13136
- const month = padZero(d2.getUTCMonth() + 1);
13137
- const day = padZero(d2.getUTCDate());
13138
- const hour = padZero(d2.getUTCHours());
13139
- const minute = padZero(d2.getUTCMinutes());
13140
- const second = padZero(d2.getUTCSeconds());
13141
- const ms = padThree(d2.getUTCMilliseconds());
13080
+ const d = new Date(ts);
13081
+ const year = d.getUTCFullYear();
13082
+ const month = padZero(d.getUTCMonth() + 1);
13083
+ const day = padZero(d.getUTCDate());
13084
+ const hour = padZero(d.getUTCHours());
13085
+ const minute = padZero(d.getUTCMinutes());
13086
+ const second = padZero(d.getUTCSeconds());
13087
+ const ms = padThree(d.getUTCMilliseconds());
13142
13088
  return `${year}-${month}-${day} ${hour}:${minute}:${second}.${ms} +00:00`;
13143
13089
  },
13144
13090
  "date-time-tz": (ts) => {
13145
- const d2 = new Date(ts);
13146
- const year = d2.getUTCFullYear();
13147
- const month = padZero(d2.getUTCMonth() + 1);
13148
- const day = padZero(d2.getUTCDate());
13149
- const hour = padZero(d2.getUTCHours());
13150
- const minute = padZero(d2.getUTCMinutes());
13151
- const second = padZero(d2.getUTCSeconds());
13152
- const ms = padThree(d2.getUTCMilliseconds());
13091
+ const d = new Date(ts);
13092
+ const year = d.getUTCFullYear();
13093
+ const month = padZero(d.getUTCMonth() + 1);
13094
+ const day = padZero(d.getUTCDate());
13095
+ const hour = padZero(d.getUTCHours());
13096
+ const minute = padZero(d.getUTCMinutes());
13097
+ const second = padZero(d.getUTCSeconds());
13098
+ const ms = padThree(d.getUTCMilliseconds());
13153
13099
  return `${year}-${month}-${day} ${hour}:${minute}:${second}.${ms} +00`;
13154
13100
  },
13155
13101
  "date-time": (ts) => {
13156
- const d2 = new Date(ts);
13157
- const year = d2.getUTCFullYear();
13158
- const month = padZero(d2.getUTCMonth() + 1);
13159
- const day = padZero(d2.getUTCDate());
13160
- const hour = padZero(d2.getUTCHours());
13161
- const minute = padZero(d2.getUTCMinutes());
13162
- const second = padZero(d2.getUTCSeconds());
13163
- const ms = padThree(d2.getUTCMilliseconds());
13102
+ const d = new Date(ts);
13103
+ const year = d.getUTCFullYear();
13104
+ const month = padZero(d.getUTCMonth() + 1);
13105
+ const day = padZero(d.getUTCDate());
13106
+ const hour = padZero(d.getUTCHours());
13107
+ const minute = padZero(d.getUTCMinutes());
13108
+ const second = padZero(d.getUTCSeconds());
13109
+ const ms = padThree(d.getUTCMilliseconds());
13164
13110
  return `${year}-${month}-${day} ${hour}:${minute}:${second}.${ms}`;
13165
13111
  },
13166
13112
  "time-timezone": (ts) => {
13167
- const d2 = new Date(ts);
13168
- const hour = padZero(d2.getUTCHours());
13169
- const minute = padZero(d2.getUTCMinutes());
13170
- const second = padZero(d2.getUTCSeconds());
13171
- const ms = padThree(d2.getUTCMilliseconds());
13113
+ const d = new Date(ts);
13114
+ const hour = padZero(d.getUTCHours());
13115
+ const minute = padZero(d.getUTCMinutes());
13116
+ const second = padZero(d.getUTCSeconds());
13117
+ const ms = padThree(d.getUTCMilliseconds());
13172
13118
  return `${hour}:${minute}:${second}.${ms} +00:00`;
13173
13119
  },
13174
13120
  "time-tz": (ts) => {
13175
- const d2 = new Date(ts);
13176
- const hour = padZero(d2.getUTCHours());
13177
- const minute = padZero(d2.getUTCMinutes());
13178
- const second = padZero(d2.getUTCSeconds());
13179
- const ms = padThree(d2.getUTCMilliseconds());
13121
+ const d = new Date(ts);
13122
+ const hour = padZero(d.getUTCHours());
13123
+ const minute = padZero(d.getUTCMinutes());
13124
+ const second = padZero(d.getUTCSeconds());
13125
+ const ms = padThree(d.getUTCMilliseconds());
13180
13126
  return `${hour}:${minute}:${second}.${ms} +00`;
13181
13127
  },
13182
13128
  time: (ts) => {
13183
- const d2 = new Date(ts);
13184
- const hour = padZero(d2.getUTCHours());
13185
- const minute = padZero(d2.getUTCMinutes());
13186
- const second = padZero(d2.getUTCSeconds());
13187
- const ms = padThree(d2.getUTCMilliseconds());
13129
+ const d = new Date(ts);
13130
+ const hour = padZero(d.getUTCHours());
13131
+ const minute = padZero(d.getUTCMinutes());
13132
+ const second = padZero(d.getUTCSeconds());
13133
+ const ms = padThree(d.getUTCMilliseconds());
13188
13134
  return `${hour}:${minute}:${second}.${ms}`;
13189
13135
  },
13190
13136
  date: (ts) => {
13191
- const d2 = new Date(ts);
13192
- const year = d2.getUTCFullYear();
13193
- const month = padZero(d2.getUTCMonth() + 1);
13194
- const day = padZero(d2.getUTCDate());
13137
+ const d = new Date(ts);
13138
+ const year = d.getUTCFullYear();
13139
+ const month = padZero(d.getUTCMonth() + 1);
13140
+ const day = padZero(d.getUTCDate());
13195
13141
  return `${year}-${month}-${day}`;
13196
13142
  },
13197
13143
  rfc3339: (ts) => new Date(ts).toISOString(),
@@ -13601,10 +13547,10 @@ async function configure(config) {
13601
13547
  await reset();
13602
13548
  try {
13603
13549
  configureInternal(config, true);
13604
- } catch (e2) {
13605
- if (e2 instanceof ConfigError)
13550
+ } catch (e) {
13551
+ if (e instanceof ConfigError)
13606
13552
  await reset();
13607
- throw e2;
13553
+ throw e;
13608
13554
  }
13609
13555
  }
13610
13556
  function configureInternal(config, allowAsync) {
@@ -14095,6 +14041,7 @@ async function runSessionEnd() {
14095
14041
  const result = await uploadSession(request, {
14096
14042
  endpoint,
14097
14043
  token: credentials.token,
14044
+ authType: credentials.authType,
14098
14045
  onRetry: (attempt, maxAttempts, error) => {
14099
14046
  logger.warn("Retrying upload for {sessionId} ({attempt}/{maxAttempts}): {error}", { sessionId: input.session_id, attempt, maxAttempts, error });
14100
14047
  }
@@ -14177,7 +14124,8 @@ async function runTurnComplete() {
14177
14124
  const endpoint = `${apiBase}/rpc`;
14178
14125
  const result = await uploadSession(request, {
14179
14126
  endpoint,
14180
- token: credentials.token
14127
+ token: credentials.token,
14128
+ authType: credentials.authType
14181
14129
  });
14182
14130
  if (result.success) {
14183
14131
  await removeFailedUpload(input.thread_id);
@@ -14224,115 +14172,175 @@ var hooksRouteMap = buildRouteMap({
14224
14172
 
14225
14173
  // src/commands/login.ts
14226
14174
  import { spawn } from "node:child_process";
14227
- import { randomBytes } from "node:crypto";
14228
- import {
14229
- createServer
14230
- } from "node:http";
14231
14175
  var DEFAULT_API_BASE = "https://app.rudel.ai";
14232
14176
  var DEFAULT_WEB_URL = "https://app.rudel.ai";
14233
- var CALLBACK_TIMEOUT_MS = 120000;
14234
- async function runLogin(flags) {
14235
- We("rudel login");
14236
- const existing = loadCredentials();
14237
- if (existing) {
14238
- R2.warn("Already logged in.");
14239
- Le("Run `rudel logout` first to switch accounts.");
14177
+ var DEVICE_CLIENT_ID = "rudel-cli";
14178
+ var POLL_SAFETY_TIMEOUT_MS = 120000;
14179
+ async function sleep(ms) {
14180
+ await new Promise((resolve2) => setTimeout(resolve2, ms));
14181
+ }
14182
+ function openUrl(url) {
14183
+ if (process.platform === "win32") {
14184
+ const child2 = spawn("cmd", ["/c", "start", "", url], {
14185
+ detached: true,
14186
+ stdio: "ignore"
14187
+ });
14188
+ child2.unref();
14240
14189
  return;
14241
14190
  }
14242
- const state = randomBytes(16).toString("hex");
14243
- let resolveCallback;
14244
- let rejectCallback;
14245
- const tokenPromise = new Promise((resolve2, reject) => {
14246
- resolveCallback = resolve2;
14247
- rejectCallback = reject;
14191
+ const opener = process.platform === "darwin" ? "open" : "xdg-open";
14192
+ const child = spawn(opener, [url], {
14193
+ detached: true,
14194
+ stdio: "ignore"
14248
14195
  });
14249
- const server = createServer((req, res) => {
14250
- const url = new URL(req.url ?? "/", `http://${req.headers.host}`);
14251
- if (url.pathname !== "/callback") {
14252
- res.writeHead(404, { "Content-Type": "text/plain" });
14253
- res.end("Not found");
14254
- return;
14196
+ child.unref();
14197
+ }
14198
+ async function requestDeviceCode(apiBase) {
14199
+ const response = await fetch(`${apiBase}/api/auth/device/code`, {
14200
+ method: "POST",
14201
+ headers: { "Content-Type": "application/json" },
14202
+ body: JSON.stringify({
14203
+ client_id: DEVICE_CLIENT_ID,
14204
+ scope: "ingest:write"
14205
+ })
14206
+ });
14207
+ const body = await response.json().catch(() => null);
14208
+ if (!response.ok || !body || !("device_code" in body)) {
14209
+ throw new Error(body && "error_description" in body && body.error_description || body && "message" in body && body.message || `Failed to start device authorization (${response.status})`);
14210
+ }
14211
+ return body;
14212
+ }
14213
+ async function pollForAccessToken(apiBase, device) {
14214
+ const hardDeadline = Date.now() + POLL_SAFETY_TIMEOUT_MS;
14215
+ const deviceDeadline = Date.now() + device.expires_in * 1000;
14216
+ const deadline = Math.min(hardDeadline, deviceDeadline);
14217
+ let intervalMs = Math.max(1000, device.interval * 1000);
14218
+ while (Date.now() < deadline) {
14219
+ const response = await fetch(`${apiBase}/api/auth/device/token`, {
14220
+ method: "POST",
14221
+ headers: { "Content-Type": "application/json" },
14222
+ body: JSON.stringify({
14223
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code",
14224
+ device_code: device.device_code,
14225
+ client_id: DEVICE_CLIENT_ID
14226
+ })
14227
+ });
14228
+ const body = await response.json().catch(() => null);
14229
+ if (response.ok && body && "access_token" in body) {
14230
+ return body.access_token;
14255
14231
  }
14256
- const receivedToken = url.searchParams.get("token");
14257
- const receivedState = url.searchParams.get("state");
14258
- if (receivedState !== state) {
14259
- rejectCallback(new Error("State mismatch — possible CSRF attack"));
14260
- res.writeHead(200, { "Content-Type": "text/html" });
14261
- res.end("<html><body><h1>Login failed</h1><p>State mismatch. Please try again.</p></body></html>");
14262
- return;
14232
+ const errorCode = body && "error" in body && typeof body.error === "string" ? body.error : "";
14233
+ const errorDescription = body && "error_description" in body && typeof body.error_description === "string" ? body.error_description : "Device authorization failed";
14234
+ if (errorCode === "authorization_pending") {
14235
+ await sleep(intervalMs);
14236
+ continue;
14263
14237
  }
14264
- if (!receivedToken) {
14265
- rejectCallback(new Error("No token received"));
14266
- res.writeHead(200, { "Content-Type": "text/html" });
14267
- res.end("<html><body><h1>Login failed</h1><p>No token received.</p></body></html>");
14268
- return;
14238
+ if (errorCode === "slow_down") {
14239
+ intervalMs += 1000;
14240
+ await sleep(intervalMs);
14241
+ continue;
14269
14242
  }
14270
- resolveCallback(receivedToken);
14271
- res.writeHead(200, { "Content-Type": "text/html" });
14272
- res.end("<html><body><h1>Login successful!</h1><p>You can close this tab and return to the terminal.</p></body></html>");
14273
- });
14274
- await new Promise((resolve2) => {
14275
- server.listen(0, "127.0.0.1", resolve2);
14243
+ throw new Error(errorDescription);
14244
+ }
14245
+ throw new Error("Device authorization timed out");
14246
+ }
14247
+ async function createIngestApiKey(apiBase, accessToken) {
14248
+ const response = await fetch(`${apiBase}/api/auth/api-key/create`, {
14249
+ method: "POST",
14250
+ headers: {
14251
+ "Content-Type": "application/json",
14252
+ Authorization: `Bearer ${accessToken}`
14253
+ },
14254
+ body: JSON.stringify({
14255
+ name: "rudel-cli-ingest",
14256
+ expiresIn: null
14257
+ })
14276
14258
  });
14277
- const port = server.address().port;
14278
- const callbackUrl = `http://127.0.0.1:${port}/callback`;
14279
- const loginUrl = `${flags.webUrl}?cli_callback=${encodeURIComponent(callbackUrl)}&state=${state}`;
14259
+ const body = await response.json().catch(() => null);
14260
+ if (!response.ok || !body || !("key" in body) || !("id" in body)) {
14261
+ throw new Error(body && "error_description" in body && body.error_description || body && "message" in body && body.message || `Failed to create CLI API key (${response.status})`);
14262
+ }
14263
+ return body;
14264
+ }
14265
+ async function runLogin(flags) {
14266
+ Wt2("rudel login");
14267
+ const existing = loadCredentials();
14268
+ if (existing) {
14269
+ R2.warn("Already logged in.");
14270
+ Gt("Run `rudel logout` first to switch accounts.");
14271
+ return;
14272
+ }
14273
+ let deviceCode;
14274
+ try {
14275
+ deviceCode = await requestDeviceCode(flags.apiBase);
14276
+ } catch (error) {
14277
+ R2.error(error instanceof Error ? error.message : String(error));
14278
+ process.exitCode = 1;
14279
+ return;
14280
+ }
14281
+ const verifyUrl = deviceCode.verification_uri_complete ?? `${deviceCode.verification_uri}?user_code=${encodeURIComponent(deviceCode.user_code)}`;
14280
14282
  R2.info(`If the browser doesn't open, visit:
14281
- ${loginUrl}`);
14283
+ ${verifyUrl}`);
14284
+ R2.info(`User code: ${deviceCode.user_code}`);
14282
14285
  if (!flags.noBrowser) {
14283
- if (process.platform === "win32") {
14284
- const child = spawn("cmd", ["/c", "start", "", loginUrl], {
14285
- detached: true,
14286
- stdio: "ignore"
14287
- });
14288
- child.unref();
14289
- } else {
14290
- const opener = process.platform === "darwin" ? "open" : "xdg-open";
14291
- const child = spawn(opener, [loginUrl], {
14292
- detached: true,
14293
- stdio: "ignore"
14294
- });
14295
- child.unref();
14296
- }
14286
+ openUrl(verifyUrl);
14297
14287
  }
14298
- const timeout = setTimeout(() => {
14299
- rejectCallback(new Error("Login timed out after 120 seconds"));
14300
- }, CALLBACK_TIMEOUT_MS);
14301
- const spin = bt2();
14288
+ const spin = be();
14302
14289
  spin.start("Waiting for browser authentication...");
14303
- let token;
14290
+ let accessToken;
14304
14291
  try {
14305
- token = await tokenPromise;
14292
+ accessToken = await pollForAccessToken(flags.apiBase, deviceCode);
14306
14293
  } catch (error) {
14307
- clearTimeout(timeout);
14308
- server.close();
14309
14294
  spin.stop("Authentication failed");
14310
14295
  R2.error(error instanceof Error ? error.message : String(error));
14311
14296
  process.exitCode = 1;
14312
14297
  return;
14313
14298
  }
14314
- clearTimeout(timeout);
14315
- server.close();
14316
- spin.message("Validating token...");
14317
- const meResponse = await fetch(`${flags.apiBase}/rpc/me`, {
14318
- method: "POST",
14319
- headers: {
14320
- "Content-Type": "application/json",
14321
- Authorization: `Bearer ${token}`
14322
- },
14323
- body: JSON.stringify({})
14299
+ spin.message("Creating ingest token...");
14300
+ let ingestKey;
14301
+ try {
14302
+ ingestKey = await createIngestApiKey(flags.apiBase, accessToken);
14303
+ } catch (error) {
14304
+ spin.stop("Authentication failed");
14305
+ R2.error(error instanceof Error ? error.message : String(error));
14306
+ process.exitCode = 1;
14307
+ return;
14308
+ }
14309
+ const client = createApiClient({
14310
+ apiBaseUrl: flags.apiBase,
14311
+ token: accessToken,
14312
+ authType: "bearer"
14324
14313
  });
14325
- if (!meResponse.ok) {
14326
- spin.stop("Token validation failed");
14327
- R2.error("Login failed: token validation failed");
14314
+ let user;
14315
+ let organizations;
14316
+ try {
14317
+ const [me2, orgs] = await Promise.all([
14318
+ client.me(),
14319
+ client.listMyOrganizations()
14320
+ ]);
14321
+ user = { id: me2.id, email: me2.email, name: me2.name };
14322
+ organizations = orgs.map((org) => ({
14323
+ id: org.id,
14324
+ name: org.name,
14325
+ slug: org.slug
14326
+ }));
14327
+ } catch {
14328
+ spin.stop("Authentication failed");
14329
+ R2.error("Login failed: unable to fetch account details");
14328
14330
  process.exitCode = 1;
14329
14331
  return;
14330
14332
  }
14331
- const body = await meResponse.json();
14332
- saveCredentials(token, flags.apiBase);
14333
+ saveCredentials({
14334
+ token: ingestKey.key,
14335
+ apiBaseUrl: flags.apiBase,
14336
+ authType: "api-key",
14337
+ apiKeyId: ingestKey.id,
14338
+ user,
14339
+ organizations
14340
+ });
14333
14341
  spin.stop("Authenticated");
14334
- R2.success(`Logged in as ${body.json.name} (${body.json.email})`);
14335
- Le("Done!");
14342
+ R2.success(`Logged in as ${user.name} (${user.email})`);
14343
+ Gt("Done!");
14336
14344
  }
14337
14345
  var loginCommand = buildCommand({
14338
14346
  loader: async () => ({ default: runLogin }),
@@ -14369,6 +14377,14 @@ async function runLogout() {
14369
14377
  R2.info("Not logged in.");
14370
14378
  return;
14371
14379
  }
14380
+ if (credentials.authType === "api-key") {
14381
+ try {
14382
+ const client = createApiClient(credentials);
14383
+ await client.cli.revokeToken();
14384
+ } catch {
14385
+ R2.warn("Failed to revoke token on server. Local credentials were cleared.");
14386
+ }
14387
+ }
14372
14388
  clearCredentials();
14373
14389
  R2.success("Logged out successfully.");
14374
14390
  }
@@ -14382,32 +14398,36 @@ var logoutCommand = buildCommand({
14382
14398
 
14383
14399
  // src/commands/set-org.ts
14384
14400
  async function runSetOrg() {
14385
- We("rudel set-org");
14401
+ Wt2("rudel set-org");
14386
14402
  const credentials = loadCredentials();
14387
14403
  if (!credentials) {
14388
14404
  R2.error("Not authenticated.");
14389
- Le("Run `rudel login` first.");
14405
+ Gt("Run `rudel login` first.");
14390
14406
  process.exitCode = 1;
14391
14407
  return;
14392
14408
  }
14393
- const client = createApiClient(credentials);
14394
14409
  let orgs;
14395
- try {
14396
- orgs = await client.listMyOrganizations();
14397
- } catch {
14398
- R2.error("Failed to fetch organizations. Check your connection.");
14399
- process.exitCode = 1;
14400
- return;
14410
+ if (credentials.authType === "api-key") {
14411
+ orgs = credentials.organizations ?? [];
14412
+ } else {
14413
+ const client = createApiClient(credentials);
14414
+ try {
14415
+ orgs = await client.listMyOrganizations();
14416
+ } catch {
14417
+ R2.error("Failed to fetch organizations. Check your connection.");
14418
+ process.exitCode = 1;
14419
+ return;
14420
+ }
14401
14421
  }
14402
14422
  if (orgs.length === 0) {
14403
14423
  R2.error("No organizations found.");
14404
- Le("Create one at app.rudel.ai first.");
14424
+ Gt("Create one at app.rudel.ai first.");
14405
14425
  process.exitCode = 1;
14406
14426
  return;
14407
14427
  }
14408
14428
  const cwd = process.cwd();
14409
14429
  const currentOrgId = await getProjectOrgId(cwd);
14410
- const selected = await Je({
14430
+ const selected = await Jt({
14411
14431
  message: "Select an organization for this repository",
14412
14432
  options: orgs.map((org) => ({
14413
14433
  value: org.id,
@@ -14417,13 +14437,13 @@ async function runSetOrg() {
14417
14437
  initialValue: currentOrgId ?? undefined
14418
14438
  });
14419
14439
  if (Ct(selected)) {
14420
- Ne("Cancelled.");
14440
+ Nt("Cancelled.");
14421
14441
  return;
14422
14442
  }
14423
14443
  await setProjectOrgId(cwd, selected);
14424
14444
  const selectedOrg = orgs.find((o) => o.id === selected);
14425
14445
  R2.success(`Organization set to: ${selectedOrg?.name}`);
14426
- Le("Done!");
14446
+ Gt("Done!");
14427
14447
  }
14428
14448
  var setOrgCommand = buildCommand({
14429
14449
  loader: async () => ({ default: runSetOrg }),
@@ -14434,9 +14454,7 @@ var setOrgCommand = buildCommand({
14434
14454
  });
14435
14455
 
14436
14456
  // src/lib/classifier.ts
14437
- import { mkdir as mkdir3, unlink, writeFile as writeFile3 } from "node:fs/promises";
14438
- import { homedir as homedir11 } from "node:os";
14439
- import { join as join13 } from "node:path";
14457
+ import { spawn as spawn2 } from "node:child_process";
14440
14458
 
14441
14459
  // src/lib/types.ts
14442
14460
  var SESSION_TAGS = [
@@ -14463,20 +14481,20 @@ var SYSTEM_PROMPT = `You are a session classifier. Analyze the Claude Code sessi
14463
14481
  CRITICAL: Respond with ONLY the tag name. Nothing else. No explanation, no punctuation, no formatting. Just ONE of: research, new_feature, bug_fix, refactoring, documentation, tests`;
14464
14482
  async function classifySession(content) {
14465
14483
  const truncatedContent = content.slice(0, 50000);
14466
- const tempDir = join13(homedir11(), ".claude", "temp");
14467
- const tempFile = join13(tempDir, `classify-${Date.now()}.txt`);
14484
+ const prompt = `Classify this session transcript:
14485
+
14486
+ ${truncatedContent}`;
14468
14487
  try {
14469
- await mkdir3(tempDir, { recursive: true });
14470
- await writeFile3(tempFile, `Classify this session transcript:
14471
-
14472
- ${truncatedContent}`);
14473
- const prompt = `Read and classify the session transcript in this file: ${tempFile}`;
14474
- const escapedPrompt = prompt.replace(/'/g, "'\\''");
14475
- const escapedSystemPrompt = SYSTEM_PROMPT.replace(/'/g, "'\\''");
14476
- const result = await exec("sh", [
14477
- "-c",
14478
- `echo '${escapedPrompt}' | claude --output-format text --print --model haiku --no-session-persistence --dangerously-skip-permissions --system-prompt '${escapedSystemPrompt}'`
14479
- ]);
14488
+ const result = await execWithStdin("claude", [
14489
+ "--output-format",
14490
+ "text",
14491
+ "--print",
14492
+ "--model",
14493
+ "haiku",
14494
+ "--no-session-persistence",
14495
+ "--system-prompt",
14496
+ SYSTEM_PROMPT
14497
+ ], prompt);
14480
14498
  if (result.exitCode !== 0) {
14481
14499
  return "other";
14482
14500
  }
@@ -14492,18 +14510,35 @@ ${truncatedContent}`);
14492
14510
  return "other";
14493
14511
  } catch {
14494
14512
  return;
14495
- } finally {
14496
- try {
14497
- await unlink(tempFile);
14498
- } catch {}
14499
14513
  }
14500
14514
  }
14515
+ function execWithStdin(cmd, args, stdin) {
14516
+ return new Promise((resolve2) => {
14517
+ const child = spawn2(cmd, args, { stdio: ["pipe", "pipe", "pipe"] });
14518
+ let stdout = "";
14519
+ let stderr = "";
14520
+ child.stdout.on("data", (data) => {
14521
+ stdout += data.toString();
14522
+ });
14523
+ child.stderr.on("data", (data) => {
14524
+ stderr += data.toString();
14525
+ });
14526
+ child.on("close", (code) => {
14527
+ resolve2({ exitCode: code ?? 1, stdout, stderr });
14528
+ });
14529
+ child.on("error", () => {
14530
+ resolve2({ exitCode: 1, stdout, stderr });
14531
+ });
14532
+ child.stdin.write(stdin);
14533
+ child.stdin.end();
14534
+ });
14535
+ }
14501
14536
 
14502
14537
  // src/lib/session-resolver.ts
14503
14538
  import { access, readdir as readdir3 } from "node:fs/promises";
14504
- import { homedir as homedir12 } from "node:os";
14505
- import { basename, dirname as dirname5, join as join14 } from "node:path";
14506
- var SESSIONS_BASE_DIR3 = join14(homedir12(), ".claude", "projects");
14539
+ import { homedir as homedir11 } from "node:os";
14540
+ import { basename, dirname as dirname5, join as join13 } from "node:path";
14541
+ var SESSIONS_BASE_DIR3 = join13(homedir11(), ".claude", "projects");
14507
14542
  async function resolveSession(input) {
14508
14543
  const isPath = input.includes("/") || input.endsWith(".jsonl");
14509
14544
  if (isPath) {
@@ -14535,11 +14570,11 @@ async function resolveFromId(sessionId) {
14535
14570
  throw new Error(`Session not found: ${sessionId}`);
14536
14571
  }
14537
14572
  for (const projectDir of projectDirs) {
14538
- const sessionDir = join14(SESSIONS_BASE_DIR3, projectDir);
14573
+ const sessionDir = join13(SESSIONS_BASE_DIR3, projectDir);
14539
14574
  try {
14540
14575
  const files = await readdir3(sessionDir);
14541
14576
  if (files.includes(sessionFileName)) {
14542
- const transcriptPath = join14(sessionDir, sessionFileName);
14577
+ const transcriptPath = join13(sessionDir, sessionFileName);
14543
14578
  const projectPath = await decodeProjectPath(projectDir);
14544
14579
  return {
14545
14580
  transcriptPath,
@@ -14566,14 +14601,14 @@ async function runInteractiveUpload(flags) {
14566
14601
  process.exitCode = 1;
14567
14602
  return;
14568
14603
  }
14569
- We("rudel upload");
14570
- const spin = bt2();
14604
+ Wt2("rudel upload");
14605
+ const spin = be();
14571
14606
  spin.start("Scanning projects...");
14572
14607
  const { projects: allProjects, groups } = await scanAndGroupProjects();
14573
14608
  spin.stop(`Found ${allProjects.length} project(s)`);
14574
14609
  if (allProjects.length === 0) {
14575
14610
  R2.warn("No projects with sessions found.");
14576
- Le("Nothing to upload.");
14611
+ Gt("Nothing to upload.");
14577
14612
  return;
14578
14613
  }
14579
14614
  const options = [];
@@ -14590,21 +14625,22 @@ async function runInteractiveUpload(flags) {
14590
14625
  }
14591
14626
  }
14592
14627
  }
14593
- const selected = await je({
14628
+ const selected = await Lt2({
14594
14629
  message: "Select projects to upload",
14595
14630
  options,
14596
14631
  initialValues: preSelected,
14597
14632
  required: true
14598
14633
  });
14599
14634
  if (Ct(selected)) {
14600
- Ne("Upload cancelled.");
14635
+ Nt("Upload cancelled.");
14601
14636
  return;
14602
14637
  }
14603
14638
  const totalSessions = selected.reduce((sum, proj) => sum + proj.sessionCount, 0);
14604
14639
  R2.info(`Uploading ${totalSessions} session(s) from ${selected.length} project(s)`);
14605
14640
  const uploadConfig = {
14606
14641
  endpoint: flags.endpoint,
14607
- token: credentials?.token ?? ""
14642
+ token: credentials?.token ?? "",
14643
+ authType: credentials?.authType
14608
14644
  };
14609
14645
  const work = [];
14610
14646
  for (const project of selected) {
@@ -14650,9 +14686,9 @@ async function runInteractiveUpload(flags) {
14650
14686
  });
14651
14687
  renderBatchSummary(summary, { showRetryHint: summary.failed > 0 });
14652
14688
  if (flags.dryRun) {
14653
- Le("Dry run complete — no sessions were uploaded.");
14689
+ Gt("Dry run complete — no sessions were uploaded.");
14654
14690
  } else {
14655
- Le("Done!");
14691
+ Gt("Done!");
14656
14692
  }
14657
14693
  if (summary.failed > 0) {
14658
14694
  process.exitCode = 1;
@@ -14737,7 +14773,8 @@ async function runSingleUpload(flags, session) {
14737
14773
  write("Uploading...");
14738
14774
  const result = await uploadSession(request, {
14739
14775
  endpoint: flags.endpoint,
14740
- token: credentials.token
14776
+ token: credentials.token,
14777
+ authType: credentials?.authType
14741
14778
  });
14742
14779
  if (result.success) {
14743
14780
  write("Upload successful!");
@@ -14753,10 +14790,10 @@ async function runRetryUpload(flags) {
14753
14790
  process.exitCode = 1;
14754
14791
  return;
14755
14792
  }
14756
- We("rudel upload --retry");
14793
+ Wt2("rudel upload --retry");
14757
14794
  const failures = await loadFailedUploads();
14758
14795
  if (failures.length === 0) {
14759
- Le("No failed uploads to retry.");
14796
+ Gt("No failed uploads to retry.");
14760
14797
  return;
14761
14798
  }
14762
14799
  R2.info(`Found ${failures.length} failed upload(s):`);
@@ -14766,12 +14803,12 @@ async function runRetryUpload(flags) {
14766
14803
  if (failures.length > 10) {
14767
14804
  R2.warn(` ...and ${failures.length - 10} more`);
14768
14805
  }
14769
- const shouldRetry = await Re({
14806
+ const shouldRetry = await Rt({
14770
14807
  message: `Retry all ${failures.length} failed upload(s)?`,
14771
14808
  initialValue: true
14772
14809
  });
14773
14810
  if (Ct(shouldRetry) || !shouldRetry) {
14774
- Ne("Retry cancelled.");
14811
+ Nt("Retry cancelled.");
14775
14812
  return;
14776
14813
  }
14777
14814
  const endpoint = flags.endpoint;
@@ -14805,12 +14842,13 @@ async function runRetryUpload(flags) {
14805
14842
  return uploadSession(request, {
14806
14843
  endpoint,
14807
14844
  token: credentials.token,
14845
+ authType: credentials.authType,
14808
14846
  onRetry
14809
14847
  });
14810
14848
  }
14811
14849
  });
14812
14850
  renderBatchSummary(summary);
14813
- Le("Done!");
14851
+ Gt("Done!");
14814
14852
  if (summary.failed > 0) {
14815
14853
  process.exitCode = 1;
14816
14854
  }