rudel 0.1.9 → 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.
- package/dist/cli.js +914 -821
- package/package.json +3 -2
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __getProtoOf = Object.getPrototypeOf;
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -26,77 +26,7 @@ var __export = (target, all) => {
|
|
|
26
26
|
set: (newValue) => all[name] = () => newValue
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
|
-
var __require = import.meta.
|
|
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
|
-
});
|
|
29
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
100
30
|
|
|
101
31
|
// ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
102
32
|
var require_src = __commonJS((exports, module) => {
|
|
@@ -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.
|
|
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[
|
|
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[
|
|
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[
|
|
1628
|
-
row.hidden ? `\x1B[
|
|
1629
|
-
row.hidden ? `\x1B[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
1845
|
-
row.hidden ? `\x1B[
|
|
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.
|
|
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",
|
|
@@ -1991,7 +1921,7 @@ var package_default = {
|
|
|
1991
1921
|
scripts: {
|
|
1992
1922
|
dev: "bun run src/bin/cli.ts",
|
|
1993
1923
|
"check-types": "tsc --noEmit",
|
|
1994
|
-
build: "bun build src/bin/cli.ts --outdir dist --target
|
|
1924
|
+
build: "bun build src/bin/cli.ts --outdir dist --target node",
|
|
1995
1925
|
test: "bun test"
|
|
1996
1926
|
},
|
|
1997
1927
|
dependencies: {
|
|
@@ -2007,15 +1937,16 @@ var package_default = {
|
|
|
2007
1937
|
"@rudel/agent-adapters": "workspace:*",
|
|
2008
1938
|
"@rudel/api-routes": "workspace:*",
|
|
2009
1939
|
"@rudel/typescript-config": "workspace:*",
|
|
1940
|
+
"@types/node": "^22",
|
|
2010
1941
|
"bun-types": "latest",
|
|
2011
1942
|
typescript: "5.9.2"
|
|
2012
1943
|
}
|
|
2013
1944
|
};
|
|
2014
1945
|
|
|
2015
1946
|
// ../../packages/agent-adapters/src/adapters/claude-code/index.ts
|
|
2016
|
-
import { readdir as readdir2, readFile as readFile2, stat } from "fs/promises";
|
|
2017
|
-
import { homedir as homedir2 } from "os";
|
|
2018
|
-
import { dirname as dirname2, join as join3 } from "path";
|
|
1947
|
+
import { readdir as readdir2, readFile as readFile2, stat } from "node:fs/promises";
|
|
1948
|
+
import { homedir as homedir2 } from "node:os";
|
|
1949
|
+
import { dirname as dirname2, join as join3 } from "node:path";
|
|
2019
1950
|
|
|
2020
1951
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
|
|
2021
1952
|
var exports_external = {};
|
|
@@ -6076,9 +6007,9 @@ async function ingestRudelCodexSessions(ingestor, rows, options) {
|
|
|
6076
6007
|
await ingestor.insert({ table: "rudel.codex_sessions", values: data });
|
|
6077
6008
|
}
|
|
6078
6009
|
// ../../packages/agent-adapters/src/utils.ts
|
|
6079
|
-
import { readdir, readFile } from "fs/promises";
|
|
6080
|
-
import { homedir } from "os";
|
|
6081
|
-
import { join } from "path";
|
|
6010
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
6011
|
+
import { homedir } from "node:os";
|
|
6012
|
+
import { join } from "node:path";
|
|
6082
6013
|
function toClickHouseDateTime(isoString) {
|
|
6083
6014
|
return isoString.replace("T", " ").replace("Z", "").replace(/\+.*$/, "");
|
|
6084
6015
|
}
|
|
@@ -6134,9 +6065,9 @@ function toDisplayPath(absolutePath) {
|
|
|
6134
6065
|
}
|
|
6135
6066
|
|
|
6136
6067
|
// ../../packages/agent-adapters/src/adapters/claude-code/settings.ts
|
|
6137
|
-
import { execSync } from "child_process";
|
|
6138
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
6139
|
-
import { dirname, join as join2, resolve } from "path";
|
|
6068
|
+
import { execSync } from "node:child_process";
|
|
6069
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
6070
|
+
import { dirname, join as join2, resolve } from "node:path";
|
|
6140
6071
|
var HOOK_COMMAND = "rudel hooks claude session-end";
|
|
6141
6072
|
function findClaudeDir() {
|
|
6142
6073
|
let dir = resolve(process.cwd());
|
|
@@ -6455,14 +6386,14 @@ class ClaudeCodeAdapter {
|
|
|
6455
6386
|
}
|
|
6456
6387
|
var claudeCodeAdapter = new ClaudeCodeAdapter;
|
|
6457
6388
|
// ../../packages/agent-adapters/src/adapters/codex/index.ts
|
|
6458
|
-
import { readFile as readFile3 } from "fs/promises";
|
|
6459
|
-
import { homedir as homedir4 } from "os";
|
|
6460
|
-
import { join as join5 } from "path";
|
|
6389
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
6390
|
+
import { homedir as homedir4 } from "node:os";
|
|
6391
|
+
import { join as join5 } from "node:path";
|
|
6461
6392
|
|
|
6462
6393
|
// ../../packages/agent-adapters/src/adapters/codex/config.ts
|
|
6463
|
-
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
6464
|
-
import { homedir as homedir3 } from "os";
|
|
6465
|
-
import { join as join4 } from "path";
|
|
6394
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
6395
|
+
import { homedir as homedir3 } from "node:os";
|
|
6396
|
+
import { join as join4 } from "node:path";
|
|
6466
6397
|
|
|
6467
6398
|
// ../../node_modules/.bun/smol-toml@1.6.0/node_modules/smol-toml/dist/error.js
|
|
6468
6399
|
/*!
|
|
@@ -6584,7 +6515,7 @@ function skipComment(str, ptr) {
|
|
|
6584
6515
|
if (c === "\r" && str[i + 1] === `
|
|
6585
6516
|
`)
|
|
6586
6517
|
return i + 1;
|
|
6587
|
-
if (c < " " && c !== "\t" || c === "
|
|
6518
|
+
if (c < " " && c !== "\t" || c === "") {
|
|
6588
6519
|
throw new TomlError("control characters are not allowed in comments", {
|
|
6589
6520
|
toml: str,
|
|
6590
6521
|
ptr
|
|
@@ -6831,7 +6762,7 @@ function parseString(str, ptr = 0, endPtr = str.length) {
|
|
|
6831
6762
|
ptr: ptr - 1
|
|
6832
6763
|
});
|
|
6833
6764
|
}
|
|
6834
|
-
} else if (c < " " && c !== "\t" || c === "
|
|
6765
|
+
} else if (c < " " && c !== "\t" || c === "") {
|
|
6835
6766
|
throw new TomlError("control characters are not allowed in strings", {
|
|
6836
6767
|
toml: str,
|
|
6837
6768
|
ptr: ptr - 1
|
|
@@ -7746,7 +7677,7 @@ class CodexAdapter {
|
|
|
7746
7677
|
}
|
|
7747
7678
|
var codexAdapter = new CodexAdapter;
|
|
7748
7679
|
// ../../packages/agent-adapters/src/registry.ts
|
|
7749
|
-
import { existsSync as existsSync3 } from "fs";
|
|
7680
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
7750
7681
|
var adapters = new Map;
|
|
7751
7682
|
function registerAdapter(adapter) {
|
|
7752
7683
|
adapters.set(adapter.source, adapter);
|
|
@@ -7769,11 +7700,27 @@ registerAdapter(claudeCodeAdapter);
|
|
|
7769
7700
|
registerAdapter(codexAdapter);
|
|
7770
7701
|
|
|
7771
7702
|
// src/lib/project-grouping.ts
|
|
7772
|
-
import { homedir as homedir6 } from "os";
|
|
7703
|
+
import { homedir as homedir6 } from "node:os";
|
|
7704
|
+
|
|
7705
|
+
// src/lib/git-info.ts
|
|
7706
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
|
|
7707
|
+
import { join as join6 } from "node:path";
|
|
7708
|
+
|
|
7709
|
+
// src/lib/exec.ts
|
|
7710
|
+
import { execFile } from "node:child_process";
|
|
7711
|
+
function exec(cmd, args) {
|
|
7712
|
+
return new Promise((resolve2) => {
|
|
7713
|
+
execFile(cmd, args, { encoding: "utf8" }, (error, stdout, stderr) => {
|
|
7714
|
+
resolve2({
|
|
7715
|
+
exitCode: error ? error.code ?? 1 : 0,
|
|
7716
|
+
stdout,
|
|
7717
|
+
stderr
|
|
7718
|
+
});
|
|
7719
|
+
});
|
|
7720
|
+
});
|
|
7721
|
+
}
|
|
7773
7722
|
|
|
7774
7723
|
// src/lib/git-info.ts
|
|
7775
|
-
import { join as join6 } from "path";
|
|
7776
|
-
var {$ } = globalThis.Bun;
|
|
7777
7724
|
function normalizeRemoteUrl(url) {
|
|
7778
7725
|
return url.replace(/^(https?:\/\/|git@|ssh:\/\/)/, "").replace(/:/, "/").replace(/\.git$/, "");
|
|
7779
7726
|
}
|
|
@@ -7795,54 +7742,59 @@ async function getGitInfo(cwd) {
|
|
|
7795
7742
|
}
|
|
7796
7743
|
async function getPackageInfo(cwd) {
|
|
7797
7744
|
try {
|
|
7798
|
-
const
|
|
7799
|
-
|
|
7800
|
-
|
|
7745
|
+
const result = await exec("git", [
|
|
7746
|
+
"-C",
|
|
7747
|
+
cwd,
|
|
7748
|
+
"rev-parse",
|
|
7749
|
+
"--show-toplevel"
|
|
7750
|
+
]);
|
|
7751
|
+
const root = result.exitCode === 0 ? result.stdout.trim() : cwd;
|
|
7752
|
+
return getNodePackage(root) ?? getPythonPackage(root) ?? getRustPackage(root) ?? getGoModule(root);
|
|
7801
7753
|
} catch {
|
|
7802
7754
|
return null;
|
|
7803
7755
|
}
|
|
7804
7756
|
}
|
|
7805
|
-
|
|
7757
|
+
function getNodePackage(root) {
|
|
7806
7758
|
try {
|
|
7807
|
-
const
|
|
7808
|
-
if (!
|
|
7759
|
+
const filePath = join6(root, "package.json");
|
|
7760
|
+
if (!existsSync4(filePath))
|
|
7809
7761
|
return null;
|
|
7810
|
-
const pkg =
|
|
7762
|
+
const pkg = JSON.parse(readFileSync3(filePath, "utf-8"));
|
|
7811
7763
|
return pkg.name ? { name: pkg.name, type: "package.json" } : null;
|
|
7812
7764
|
} catch {
|
|
7813
7765
|
return null;
|
|
7814
7766
|
}
|
|
7815
7767
|
}
|
|
7816
|
-
|
|
7768
|
+
function getPythonPackage(root) {
|
|
7817
7769
|
try {
|
|
7818
|
-
const
|
|
7819
|
-
if (!
|
|
7770
|
+
const filePath = join6(root, "pyproject.toml");
|
|
7771
|
+
if (!existsSync4(filePath))
|
|
7820
7772
|
return null;
|
|
7821
|
-
const content =
|
|
7773
|
+
const content = readFileSync3(filePath, "utf-8");
|
|
7822
7774
|
const name = content.match(/^\s*name\s*=\s*"([^"]+)"/m)?.[1];
|
|
7823
7775
|
return name ? { name, type: "pyproject.toml" } : null;
|
|
7824
7776
|
} catch {
|
|
7825
7777
|
return null;
|
|
7826
7778
|
}
|
|
7827
7779
|
}
|
|
7828
|
-
|
|
7780
|
+
function getRustPackage(root) {
|
|
7829
7781
|
try {
|
|
7830
|
-
const
|
|
7831
|
-
if (!
|
|
7782
|
+
const filePath = join6(root, "Cargo.toml");
|
|
7783
|
+
if (!existsSync4(filePath))
|
|
7832
7784
|
return null;
|
|
7833
|
-
const content =
|
|
7785
|
+
const content = readFileSync3(filePath, "utf-8");
|
|
7834
7786
|
const name = content.match(/^\s*name\s*=\s*"([^"]+)"/m)?.[1];
|
|
7835
7787
|
return name ? { name, type: "Cargo.toml" } : null;
|
|
7836
7788
|
} catch {
|
|
7837
7789
|
return null;
|
|
7838
7790
|
}
|
|
7839
7791
|
}
|
|
7840
|
-
|
|
7792
|
+
function getGoModule(root) {
|
|
7841
7793
|
try {
|
|
7842
|
-
const
|
|
7843
|
-
if (!
|
|
7794
|
+
const filePath = join6(root, "go.mod");
|
|
7795
|
+
if (!existsSync4(filePath))
|
|
7844
7796
|
return null;
|
|
7845
|
-
const content =
|
|
7797
|
+
const content = readFileSync3(filePath, "utf-8");
|
|
7846
7798
|
const name = content.match(/^module\s+(\S+)/m)?.[1];
|
|
7847
7799
|
return name ? { name, type: "go.mod" } : null;
|
|
7848
7800
|
} catch {
|
|
@@ -7851,45 +7803,58 @@ async function getGoModule(root) {
|
|
|
7851
7803
|
}
|
|
7852
7804
|
async function getGitRemoteUrl(cwd) {
|
|
7853
7805
|
try {
|
|
7854
|
-
const result = await
|
|
7806
|
+
const result = await exec("git", [
|
|
7807
|
+
"-C",
|
|
7808
|
+
cwd,
|
|
7809
|
+
"remote",
|
|
7810
|
+
"get-url",
|
|
7811
|
+
"origin"
|
|
7812
|
+
]);
|
|
7855
7813
|
if (result.exitCode !== 0)
|
|
7856
7814
|
return null;
|
|
7857
|
-
return result.
|
|
7815
|
+
return result.stdout.trim() || null;
|
|
7858
7816
|
} catch {
|
|
7859
7817
|
return null;
|
|
7860
7818
|
}
|
|
7861
7819
|
}
|
|
7862
7820
|
async function getGitBranch(cwd) {
|
|
7863
7821
|
try {
|
|
7864
|
-
const result = await
|
|
7822
|
+
const result = await exec("git", [
|
|
7823
|
+
"-C",
|
|
7824
|
+
cwd,
|
|
7825
|
+
"rev-parse",
|
|
7826
|
+
"--abbrev-ref",
|
|
7827
|
+
"HEAD"
|
|
7828
|
+
]);
|
|
7865
7829
|
if (result.exitCode !== 0)
|
|
7866
7830
|
return null;
|
|
7867
|
-
return result.
|
|
7831
|
+
return result.stdout.trim();
|
|
7868
7832
|
} catch {
|
|
7869
7833
|
return null;
|
|
7870
7834
|
}
|
|
7871
7835
|
}
|
|
7872
7836
|
async function getGitSha(cwd) {
|
|
7873
7837
|
try {
|
|
7874
|
-
const result = await
|
|
7838
|
+
const result = await exec("git", ["-C", cwd, "rev-parse", "HEAD"]);
|
|
7875
7839
|
if (result.exitCode !== 0)
|
|
7876
7840
|
return null;
|
|
7877
|
-
return result.
|
|
7841
|
+
return result.stdout.trim();
|
|
7878
7842
|
} catch {
|
|
7879
7843
|
return null;
|
|
7880
7844
|
}
|
|
7881
7845
|
}
|
|
7882
7846
|
|
|
7883
7847
|
// src/lib/remote-cache.ts
|
|
7884
|
-
import {
|
|
7885
|
-
import {
|
|
7848
|
+
import { existsSync as existsSync5, readFileSync as readFileSync4 } from "node:fs";
|
|
7849
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
7850
|
+
import { homedir as homedir5 } from "node:os";
|
|
7851
|
+
import { dirname as dirname3, join as join7 } from "node:path";
|
|
7886
7852
|
var CACHE_PATH = join7(homedir5(), ".rudel", "remote-cache.json");
|
|
7887
7853
|
async function getRemoteCache() {
|
|
7888
7854
|
try {
|
|
7889
|
-
|
|
7890
|
-
if (!await file.exists())
|
|
7855
|
+
if (!existsSync5(CACHE_PATH))
|
|
7891
7856
|
return {};
|
|
7892
|
-
return
|
|
7857
|
+
return JSON.parse(readFileSync4(CACHE_PATH, "utf-8"));
|
|
7893
7858
|
} catch {
|
|
7894
7859
|
return {};
|
|
7895
7860
|
}
|
|
@@ -7902,10 +7867,8 @@ function cacheRemote(cache, encodedDir, normalizedRemote) {
|
|
|
7902
7867
|
}
|
|
7903
7868
|
async function cacheRemotes(cache) {
|
|
7904
7869
|
try {
|
|
7905
|
-
const { mkdir } = await import("fs/promises");
|
|
7906
|
-
const { dirname: dirname3 } = await import("path");
|
|
7907
7870
|
await mkdir(dirname3(CACHE_PATH), { recursive: true });
|
|
7908
|
-
await
|
|
7871
|
+
await writeFile(CACHE_PATH, JSON.stringify(cache));
|
|
7909
7872
|
} catch {}
|
|
7910
7873
|
}
|
|
7911
7874
|
|
|
@@ -8102,18 +8065,18 @@ var devRouteMap = buildRouteMap({
|
|
|
8102
8065
|
}
|
|
8103
8066
|
});
|
|
8104
8067
|
|
|
8105
|
-
// ../../node_modules/.bun/@clack+core@1.0
|
|
8106
|
-
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
8068
|
+
// ../../node_modules/.bun/@clack+core@1.1.0/node_modules/@clack/core/dist/index.mjs
|
|
8107
8069
|
var import_sisteransi = __toESM(require_src(), 1);
|
|
8108
|
-
import {
|
|
8109
|
-
import
|
|
8110
|
-
import
|
|
8111
|
-
import
|
|
8112
|
-
|
|
8070
|
+
import { styleText as D } from "node:util";
|
|
8071
|
+
import { stdout as R, stdin as q } from "node:process";
|
|
8072
|
+
import * as k from "node:readline";
|
|
8073
|
+
import ot from "node:readline";
|
|
8074
|
+
import { ReadStream as J } from "node:tty";
|
|
8075
|
+
function x(t, e, s) {
|
|
8113
8076
|
if (!s.some((u) => !u.disabled))
|
|
8114
8077
|
return t;
|
|
8115
8078
|
const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
8116
|
-
return s[n].disabled ?
|
|
8079
|
+
return s[n].disabled ? x(n, e < 0 ? -1 : 1, s) : n;
|
|
8117
8080
|
}
|
|
8118
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;
|
|
8119
8082
|
var lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
|
|
@@ -8134,8 +8097,8 @@ var X = (t, e = {}, s = {}) => {
|
|
|
8134
8097
|
const ut = t.slice(C, w) || t.slice(h, o);
|
|
8135
8098
|
v = 0;
|
|
8136
8099
|
for (const Y of ut.replaceAll(ct, "")) {
|
|
8137
|
-
const $
|
|
8138
|
-
if (lt($
|
|
8100
|
+
const $ = Y.codePointAt(0) || 0;
|
|
8101
|
+
if (lt($) ? f = m : ht($) ? f = V : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
|
|
8139
8102
|
F = true;
|
|
8140
8103
|
break t;
|
|
8141
8104
|
}
|
|
@@ -8191,8 +8154,8 @@ var X = (t, e = {}, s = {}) => {
|
|
|
8191
8154
|
};
|
|
8192
8155
|
var pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
8193
8156
|
var S = (t, e = {}) => X(t, pt, e).width;
|
|
8194
|
-
var
|
|
8195
|
-
var Z = "
|
|
8157
|
+
var T = "\x1B";
|
|
8158
|
+
var Z = "";
|
|
8196
8159
|
var Ft = 39;
|
|
8197
8160
|
var j = "\x07";
|
|
8198
8161
|
var Q = "[";
|
|
@@ -8220,15 +8183,15 @@ var mt = (t) => {
|
|
|
8220
8183
|
if (t === 0)
|
|
8221
8184
|
return 0;
|
|
8222
8185
|
};
|
|
8223
|
-
var st = (t) => `${
|
|
8224
|
-
var it = (t) => `${
|
|
8186
|
+
var st = (t) => `${T}${Q}${t}${tt}`;
|
|
8187
|
+
var it = (t) => `${T}${U}${t}${j}`;
|
|
8225
8188
|
var gt = (t) => t.map((e) => S(e));
|
|
8226
8189
|
var G = (t, e, s) => {
|
|
8227
8190
|
const i = e[Symbol.iterator]();
|
|
8228
8191
|
let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
8229
8192
|
for (;!l.done; ) {
|
|
8230
8193
|
const m = l.value, A = S(m);
|
|
8231
|
-
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m ===
|
|
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;
|
|
8232
8195
|
}
|
|
8233
8196
|
u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
8234
8197
|
};
|
|
@@ -8272,7 +8235,7 @@ var Et = (t, e, s = {}) => {
|
|
|
8272
8235
|
let m = g.next(), A = g.next(), V = 0;
|
|
8273
8236
|
for (;!m.done; ) {
|
|
8274
8237
|
const h = m.value, o = A.value;
|
|
8275
|
-
if (i += h, h ===
|
|
8238
|
+
if (i += h, h === T || h === Z) {
|
|
8276
8239
|
et.lastIndex = V + 1;
|
|
8277
8240
|
const F = et.exec(E)?.groups;
|
|
8278
8241
|
if (F?.code !== undefined) {
|
|
@@ -8320,11 +8283,11 @@ var z = Symbol("clack:cancel");
|
|
|
8320
8283
|
function Ct(t) {
|
|
8321
8284
|
return t === z;
|
|
8322
8285
|
}
|
|
8323
|
-
function
|
|
8286
|
+
function W(t, e) {
|
|
8324
8287
|
const s = t;
|
|
8325
8288
|
s.isTTY && s.setRawMode(e);
|
|
8326
8289
|
}
|
|
8327
|
-
function
|
|
8290
|
+
function xt({ input: t = q, output: e = R, overwrite: s = true, hideCursor: i = true } = {}) {
|
|
8328
8291
|
const r = k.createInterface({ input: t, output: e, prompt: "", tabSize: 1 });
|
|
8329
8292
|
k.emitKeypressEvents(t, r), t instanceof J && t.isTTY && t.setRawMode(true);
|
|
8330
8293
|
const n = (u, { name: a, sequence: l }) => {
|
|
@@ -8348,14 +8311,14 @@ function Bt({ input: t = q, output: e = R, overwrite: s = true, hideCursor: i =
|
|
|
8348
8311
|
}
|
|
8349
8312
|
var rt = (t) => ("columns" in t) && typeof t.columns == "number" ? t.columns : 80;
|
|
8350
8313
|
var nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20;
|
|
8351
|
-
function
|
|
8314
|
+
function Bt(t, e, s, i = s) {
|
|
8352
8315
|
const r = rt(t ?? R);
|
|
8353
8316
|
return K(e, r - s.length, { hard: true, trim: false }).split(`
|
|
8354
8317
|
`).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
|
|
8355
8318
|
`);
|
|
8356
8319
|
}
|
|
8357
8320
|
|
|
8358
|
-
class
|
|
8321
|
+
class B {
|
|
8359
8322
|
input;
|
|
8360
8323
|
output;
|
|
8361
8324
|
_abortSignal;
|
|
@@ -8403,10 +8366,10 @@ class x {
|
|
|
8403
8366
|
this.state = "cancel", this.close();
|
|
8404
8367
|
}, { once: true });
|
|
8405
8368
|
}
|
|
8406
|
-
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),
|
|
8407
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render),
|
|
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);
|
|
8408
8371
|
}), this.once("cancel", () => {
|
|
8409
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render),
|
|
8372
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e(z);
|
|
8410
8373
|
});
|
|
8411
8374
|
});
|
|
8412
8375
|
}
|
|
@@ -8434,7 +8397,7 @@ class x {
|
|
|
8434
8397
|
}
|
|
8435
8398
|
close() {
|
|
8436
8399
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
8437
|
-
`),
|
|
8400
|
+
`), W(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
8438
8401
|
}
|
|
8439
8402
|
restoreCursor() {
|
|
8440
8403
|
const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
@@ -8496,7 +8459,7 @@ function St(t, e) {
|
|
|
8496
8459
|
return t ? e : e[0];
|
|
8497
8460
|
}
|
|
8498
8461
|
|
|
8499
|
-
class Vt extends
|
|
8462
|
+
class Vt extends B {
|
|
8500
8463
|
filteredOptions;
|
|
8501
8464
|
multiple;
|
|
8502
8465
|
isNavigating = false;
|
|
@@ -8511,11 +8474,11 @@ class Vt extends x {
|
|
|
8511
8474
|
}
|
|
8512
8475
|
get userInputWithCursor() {
|
|
8513
8476
|
if (!this.userInput)
|
|
8514
|
-
return
|
|
8477
|
+
return D(["inverse", "hidden"], "_");
|
|
8515
8478
|
if (this._cursor >= this.userInput.length)
|
|
8516
|
-
return `${this.userInput}
|
|
8479
|
+
return `${this.userInput}█`;
|
|
8517
8480
|
const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
|
|
8518
|
-
return `${e}${
|
|
8481
|
+
return `${e}${D("inverse", s)}${i.join("")}`;
|
|
8519
8482
|
}
|
|
8520
8483
|
get options() {
|
|
8521
8484
|
return typeof this.#e == "function" ? this.#e() : this.#e;
|
|
@@ -8537,7 +8500,7 @@ class Vt extends x {
|
|
|
8537
8500
|
}
|
|
8538
8501
|
#r(e, s) {
|
|
8539
8502
|
const i = s.name === "up", r = s.name === "down", n = s.name === "return";
|
|
8540
|
-
i || r ? (this.#t =
|
|
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);
|
|
8541
8504
|
}
|
|
8542
8505
|
deselectAll() {
|
|
8543
8506
|
this.selectedValues = [];
|
|
@@ -8551,14 +8514,14 @@ class Vt extends x {
|
|
|
8551
8514
|
const s = this.options;
|
|
8552
8515
|
e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
|
|
8553
8516
|
const i = wt(this.focusedValue, this.filteredOptions);
|
|
8554
|
-
this.#t =
|
|
8517
|
+
this.#t = x(i, 0, this.filteredOptions);
|
|
8555
8518
|
const r = this.filteredOptions[this.#t];
|
|
8556
8519
|
r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
8557
8520
|
}
|
|
8558
8521
|
}
|
|
8559
8522
|
}
|
|
8560
8523
|
|
|
8561
|
-
class kt extends
|
|
8524
|
+
class kt extends B {
|
|
8562
8525
|
get cursor() {
|
|
8563
8526
|
return this.value ? 0 : 1;
|
|
8564
8527
|
}
|
|
@@ -8576,7 +8539,7 @@ class kt extends x {
|
|
|
8576
8539
|
}
|
|
8577
8540
|
}
|
|
8578
8541
|
|
|
8579
|
-
class yt extends
|
|
8542
|
+
class yt extends B {
|
|
8580
8543
|
options;
|
|
8581
8544
|
cursor = 0;
|
|
8582
8545
|
#t;
|
|
@@ -8623,8 +8586,7 @@ class yt extends x {
|
|
|
8623
8586
|
});
|
|
8624
8587
|
}
|
|
8625
8588
|
}
|
|
8626
|
-
|
|
8627
|
-
class Lt extends x {
|
|
8589
|
+
var Lt = class extends B {
|
|
8628
8590
|
options;
|
|
8629
8591
|
cursor = 0;
|
|
8630
8592
|
get _value() {
|
|
@@ -8652,17 +8614,17 @@ class Lt extends x {
|
|
|
8652
8614
|
constructor(e) {
|
|
8653
8615
|
super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
8654
8616
|
const s = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), 0);
|
|
8655
|
-
this.cursor = this.options[s].disabled ?
|
|
8617
|
+
this.cursor = this.options[s].disabled ? x(s, 1, this.options) : s, this.on("key", (i) => {
|
|
8656
8618
|
i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
|
|
8657
8619
|
}), this.on("cursor", (i) => {
|
|
8658
8620
|
switch (i) {
|
|
8659
8621
|
case "left":
|
|
8660
8622
|
case "up":
|
|
8661
|
-
this.cursor =
|
|
8623
|
+
this.cursor = x(this.cursor, -1, this.options);
|
|
8662
8624
|
break;
|
|
8663
8625
|
case "down":
|
|
8664
8626
|
case "right":
|
|
8665
|
-
this.cursor =
|
|
8627
|
+
this.cursor = x(this.cursor, 1, this.options);
|
|
8666
8628
|
break;
|
|
8667
8629
|
case "space":
|
|
8668
8630
|
this.toggleValue();
|
|
@@ -8670,8 +8632,8 @@ class Lt extends x {
|
|
|
8670
8632
|
}
|
|
8671
8633
|
});
|
|
8672
8634
|
}
|
|
8673
|
-
}
|
|
8674
|
-
class
|
|
8635
|
+
};
|
|
8636
|
+
class Tt extends B {
|
|
8675
8637
|
options;
|
|
8676
8638
|
cursor = 0;
|
|
8677
8639
|
get _selectedValue() {
|
|
@@ -8683,15 +8645,15 @@ class Wt extends x {
|
|
|
8683
8645
|
constructor(e) {
|
|
8684
8646
|
super(e, false), this.options = e.options;
|
|
8685
8647
|
const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
|
|
8686
|
-
this.cursor = this.options[i].disabled ?
|
|
8648
|
+
this.cursor = this.options[i].disabled ? x(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
|
|
8687
8649
|
switch (r) {
|
|
8688
8650
|
case "left":
|
|
8689
8651
|
case "up":
|
|
8690
|
-
this.cursor =
|
|
8652
|
+
this.cursor = x(this.cursor, -1, this.options);
|
|
8691
8653
|
break;
|
|
8692
8654
|
case "down":
|
|
8693
8655
|
case "right":
|
|
8694
|
-
this.cursor =
|
|
8656
|
+
this.cursor = x(this.cursor, 1, this.options);
|
|
8695
8657
|
break;
|
|
8696
8658
|
}
|
|
8697
8659
|
this.changeValue();
|
|
@@ -8699,401 +8661,404 @@ class Wt extends x {
|
|
|
8699
8661
|
}
|
|
8700
8662
|
}
|
|
8701
8663
|
|
|
8702
|
-
// ../../node_modules/.bun/@clack+prompts@1.0
|
|
8703
|
-
|
|
8704
|
-
import N2 from "process";
|
|
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";
|
|
8666
|
+
import N2 from "node:process";
|
|
8705
8667
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
8706
|
-
function
|
|
8668
|
+
function pt2() {
|
|
8707
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";
|
|
8708
8670
|
}
|
|
8709
|
-
var
|
|
8710
|
-
var
|
|
8711
|
-
var
|
|
8712
|
-
var
|
|
8713
|
-
var
|
|
8714
|
-
var
|
|
8715
|
-
var V =
|
|
8716
|
-
var
|
|
8717
|
-
var
|
|
8718
|
-
var x2 =
|
|
8719
|
-
var
|
|
8720
|
-
var
|
|
8721
|
-
var
|
|
8722
|
-
var H2 =
|
|
8723
|
-
var
|
|
8724
|
-
var U2 =
|
|
8725
|
-
var q2 =
|
|
8726
|
-
var
|
|
8727
|
-
var
|
|
8728
|
-
var
|
|
8729
|
-
var
|
|
8730
|
-
var
|
|
8731
|
-
var
|
|
8732
|
-
var
|
|
8733
|
-
var
|
|
8734
|
-
var
|
|
8735
|
-
var
|
|
8736
|
-
var
|
|
8737
|
-
var W2 = (
|
|
8738
|
-
switch (
|
|
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) {
|
|
8739
8701
|
case "initial":
|
|
8740
8702
|
case "active":
|
|
8741
|
-
return
|
|
8703
|
+
return t("cyan", Re);
|
|
8742
8704
|
case "cancel":
|
|
8743
|
-
return
|
|
8705
|
+
return t("red", $e);
|
|
8744
8706
|
case "error":
|
|
8745
|
-
return
|
|
8707
|
+
return t("yellow", de);
|
|
8746
8708
|
case "submit":
|
|
8747
|
-
return
|
|
8709
|
+
return t("green", V);
|
|
8748
8710
|
}
|
|
8749
8711
|
};
|
|
8750
|
-
var
|
|
8751
|
-
switch (
|
|
8712
|
+
var ve = (e) => {
|
|
8713
|
+
switch (e) {
|
|
8752
8714
|
case "initial":
|
|
8753
8715
|
case "active":
|
|
8754
|
-
return
|
|
8716
|
+
return t("cyan", h);
|
|
8755
8717
|
case "cancel":
|
|
8756
|
-
return
|
|
8718
|
+
return t("red", h);
|
|
8757
8719
|
case "error":
|
|
8758
|
-
return
|
|
8720
|
+
return t("yellow", h);
|
|
8759
8721
|
case "submit":
|
|
8760
|
-
return
|
|
8722
|
+
return t("green", h);
|
|
8761
8723
|
}
|
|
8762
8724
|
};
|
|
8763
|
-
var
|
|
8764
|
-
var
|
|
8765
|
-
var
|
|
8766
|
-
var
|
|
8767
|
-
var
|
|
8768
|
-
var
|
|
8769
|
-
var
|
|
8770
|
-
var
|
|
8771
|
-
var
|
|
8772
|
-
var
|
|
8773
|
-
var
|
|
8774
|
-
const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ?
|
|
8775
|
-
let $
|
|
8776
|
-
|
|
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:
|
|
8777
8739
|
for (;; ) {
|
|
8778
|
-
if (
|
|
8779
|
-
const
|
|
8780
|
-
|
|
8781
|
-
for (const
|
|
8782
|
-
const
|
|
8783
|
-
if (
|
|
8784
|
-
|
|
8785
|
-
break
|
|
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;
|
|
8786
8748
|
}
|
|
8787
|
-
|
|
8749
|
+
F += M2.length, w += S2;
|
|
8788
8750
|
}
|
|
8789
|
-
|
|
8751
|
+
A = b = 0;
|
|
8790
8752
|
}
|
|
8791
|
-
if (m >=
|
|
8753
|
+
if (m >= d)
|
|
8792
8754
|
break;
|
|
8793
|
-
if (
|
|
8794
|
-
if (
|
|
8795
|
-
|
|
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;
|
|
8796
8758
|
break;
|
|
8797
8759
|
}
|
|
8798
|
-
|
|
8760
|
+
w += S2, A = $, b = m, m = $ = ne.lastIndex;
|
|
8799
8761
|
continue;
|
|
8800
8762
|
}
|
|
8801
|
-
if (
|
|
8802
|
-
if (
|
|
8803
|
-
|
|
8763
|
+
if (we.lastIndex = m, we.test(e)) {
|
|
8764
|
+
if (w + u > C && (v = Math.min(v, m)), w + u > i) {
|
|
8765
|
+
y2 = true;
|
|
8804
8766
|
break;
|
|
8805
8767
|
}
|
|
8806
|
-
|
|
8768
|
+
w += u, A = $, b = m, m = $ = we.lastIndex;
|
|
8807
8769
|
continue;
|
|
8808
8770
|
}
|
|
8809
|
-
if (
|
|
8810
|
-
if (
|
|
8811
|
-
|
|
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;
|
|
8812
8774
|
break;
|
|
8813
8775
|
}
|
|
8814
|
-
|
|
8776
|
+
w += S2, A = $, b = m, m = $ = re.lastIndex;
|
|
8815
8777
|
continue;
|
|
8816
8778
|
}
|
|
8817
|
-
if (
|
|
8818
|
-
if (
|
|
8819
|
-
|
|
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;
|
|
8820
8782
|
break;
|
|
8821
8783
|
}
|
|
8822
|
-
|
|
8784
|
+
w += S2, A = $, b = m, m = $ = ie.lastIndex;
|
|
8823
8785
|
continue;
|
|
8824
8786
|
}
|
|
8825
|
-
if (
|
|
8826
|
-
if (
|
|
8827
|
-
|
|
8787
|
+
if (Ae.lastIndex = m, Ae.test(e)) {
|
|
8788
|
+
if (w + p > C && (v = Math.min(v, m)), w + p > i) {
|
|
8789
|
+
y2 = true;
|
|
8828
8790
|
break;
|
|
8829
8791
|
}
|
|
8830
|
-
|
|
8792
|
+
w += p, A = $, b = m, m = $ = Ae.lastIndex;
|
|
8831
8793
|
continue;
|
|
8832
8794
|
}
|
|
8833
8795
|
m += 1;
|
|
8834
8796
|
}
|
|
8835
|
-
return { width:
|
|
8797
|
+
return { width: y2 ? C : w, index: y2 ? v : d, truncated: y2, ellipsed: y2 && i >= o };
|
|
8836
8798
|
};
|
|
8837
|
-
var
|
|
8838
|
-
var
|
|
8839
|
-
var
|
|
8840
|
-
var
|
|
8841
|
-
var
|
|
8842
|
-
var
|
|
8843
|
-
var
|
|
8844
|
-
var
|
|
8845
|
-
var
|
|
8846
|
-
var
|
|
8847
|
-
var
|
|
8848
|
-
var
|
|
8849
|
-
if (
|
|
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)
|
|
8850
8812
|
return 39;
|
|
8851
|
-
if (
|
|
8813
|
+
if (e >= 40 && e <= 47 || e >= 100 && e <= 107)
|
|
8852
8814
|
return 49;
|
|
8853
|
-
if (
|
|
8815
|
+
if (e === 1 || e === 2)
|
|
8854
8816
|
return 22;
|
|
8855
|
-
if (
|
|
8817
|
+
if (e === 3)
|
|
8856
8818
|
return 23;
|
|
8857
|
-
if (
|
|
8819
|
+
if (e === 4)
|
|
8858
8820
|
return 24;
|
|
8859
|
-
if (
|
|
8821
|
+
if (e === 7)
|
|
8860
8822
|
return 27;
|
|
8861
|
-
if (
|
|
8823
|
+
if (e === 8)
|
|
8862
8824
|
return 28;
|
|
8863
|
-
if (
|
|
8825
|
+
if (e === 9)
|
|
8864
8826
|
return 29;
|
|
8865
|
-
if (
|
|
8827
|
+
if (e === 0)
|
|
8866
8828
|
return 0;
|
|
8867
8829
|
};
|
|
8868
|
-
var
|
|
8869
|
-
var
|
|
8870
|
-
var
|
|
8871
|
-
var
|
|
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) => {
|
|
8872
8834
|
const i = r[Symbol.iterator]();
|
|
8873
|
-
let a = false, o = false, u =
|
|
8835
|
+
let a = false, o = false, u = e.at(-1), l = u === undefined ? 0 : D2(u), n = i.next(), c = i.next(), p = 0;
|
|
8874
8836
|
for (;!n.done; ) {
|
|
8875
|
-
const
|
|
8876
|
-
l +
|
|
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;
|
|
8877
8839
|
}
|
|
8878
|
-
u =
|
|
8840
|
+
u = e.at(-1), !l && u !== undefined && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
8879
8841
|
};
|
|
8880
|
-
var
|
|
8881
|
-
const r =
|
|
8842
|
+
var St2 = (e) => {
|
|
8843
|
+
const r = e.split(" ");
|
|
8882
8844
|
let s = r.length;
|
|
8883
|
-
for (;s > 0 && !(
|
|
8845
|
+
for (;s > 0 && !(D2(r[s - 1]) > 0); )
|
|
8884
8846
|
s--;
|
|
8885
|
-
return s === r.length ?
|
|
8847
|
+
return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
8886
8848
|
};
|
|
8887
|
-
var
|
|
8888
|
-
if (s.trim !== false &&
|
|
8849
|
+
var It2 = (e, r, s = {}) => {
|
|
8850
|
+
if (s.trim !== false && e.trim() === "")
|
|
8889
8851
|
return "";
|
|
8890
8852
|
let i = "", a, o;
|
|
8891
|
-
const u =
|
|
8853
|
+
const u = e.split(" "), l = Ct2(u);
|
|
8892
8854
|
let n = [""];
|
|
8893
|
-
for (const [
|
|
8855
|
+
for (const [$, m] of u.entries()) {
|
|
8894
8856
|
s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
8895
|
-
let
|
|
8896
|
-
if ($
|
|
8897
|
-
const
|
|
8898
|
-
Math.floor((l[$
|
|
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);
|
|
8899
8861
|
continue;
|
|
8900
8862
|
}
|
|
8901
|
-
if (
|
|
8902
|
-
if (s.wordWrap === false &&
|
|
8903
|
-
|
|
8863
|
+
if (d + l[$] > r && d > 0 && l[$] > 0) {
|
|
8864
|
+
if (s.wordWrap === false && d < r) {
|
|
8865
|
+
Ie(n, m, r);
|
|
8904
8866
|
continue;
|
|
8905
8867
|
}
|
|
8906
8868
|
n.push("");
|
|
8907
8869
|
}
|
|
8908
|
-
if (
|
|
8909
|
-
|
|
8870
|
+
if (d + l[$] > r && s.wordWrap === false) {
|
|
8871
|
+
Ie(n, m, r);
|
|
8910
8872
|
continue;
|
|
8911
8873
|
}
|
|
8912
8874
|
n[n.length - 1] += m;
|
|
8913
8875
|
}
|
|
8914
|
-
s.trim !== false && (n = n.map(($
|
|
8876
|
+
s.trim !== false && (n = n.map(($) => St2($)));
|
|
8915
8877
|
const c = n.join(`
|
|
8916
|
-
`),
|
|
8917
|
-
let
|
|
8918
|
-
for (;!
|
|
8919
|
-
const $
|
|
8920
|
-
if (i +=
|
|
8921
|
-
|
|
8922
|
-
const
|
|
8923
|
-
if (
|
|
8924
|
-
const v = Number.parseFloat(
|
|
8925
|
-
a = 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;
|
|
8926
8888
|
} else
|
|
8927
|
-
|
|
8889
|
+
y2?.uri !== undefined && (o = y2.uri.length === 0 ? undefined : y2.uri);
|
|
8928
8890
|
}
|
|
8929
|
-
const
|
|
8891
|
+
const d = a ? At2(a) : undefined;
|
|
8930
8892
|
m === `
|
|
8931
|
-
` ? (o && (i +=
|
|
8932
|
-
` && (a &&
|
|
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();
|
|
8933
8895
|
}
|
|
8934
8896
|
return i;
|
|
8935
8897
|
};
|
|
8936
|
-
function J2(
|
|
8937
|
-
return String(
|
|
8898
|
+
function J2(e, r, s) {
|
|
8899
|
+
return String(e).normalize().replaceAll(`\r
|
|
8938
8900
|
`, `
|
|
8939
8901
|
`).split(`
|
|
8940
|
-
`).map((i) =>
|
|
8902
|
+
`).map((i) => It2(i, r, s)).join(`
|
|
8941
8903
|
`);
|
|
8942
8904
|
}
|
|
8943
|
-
var
|
|
8905
|
+
var bt2 = (e, r, s, i, a) => {
|
|
8944
8906
|
let o = r, u = 0;
|
|
8945
8907
|
for (let l = s;l < i; l++) {
|
|
8946
|
-
const n =
|
|
8908
|
+
const n = e[l];
|
|
8947
8909
|
if (o = o - n.length, u++, o <= a)
|
|
8948
8910
|
break;
|
|
8949
8911
|
}
|
|
8950
8912
|
return { lineCount: o, removals: u };
|
|
8951
8913
|
};
|
|
8952
|
-
var X2 = (
|
|
8953
|
-
const
|
|
8954
|
-
let
|
|
8955
|
-
|
|
8956
|
-
let
|
|
8957
|
-
const
|
|
8958
|
-
let
|
|
8959
|
-
|
|
8960
|
-
const
|
|
8961
|
-
for (let A =
|
|
8962
|
-
const
|
|
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(`
|
|
8963
8925
|
`);
|
|
8964
|
-
|
|
8965
|
-
}
|
|
8966
|
-
if (
|
|
8967
|
-
let A = 0,
|
|
8968
|
-
const
|
|
8969
|
-
|
|
8970
|
-
}
|
|
8971
|
-
const
|
|
8972
|
-
|
|
8973
|
-
for (const A of
|
|
8974
|
-
for (const
|
|
8975
|
-
|
|
8976
|
-
return
|
|
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;
|
|
8977
8939
|
};
|
|
8978
|
-
var
|
|
8979
|
-
var
|
|
8980
|
-
function
|
|
8940
|
+
var _t2 = [Ge, pe, ge, me];
|
|
8941
|
+
var Dt2 = [he, Oe, x2, Pe];
|
|
8942
|
+
function Ye(e, r, s, i) {
|
|
8981
8943
|
let a = s, o = s;
|
|
8982
|
-
return i === "center" ? a = Math.floor((r -
|
|
8944
|
+
return i === "center" ? a = Math.floor((r - e) / 2) : i === "right" && (a = r - e - s), o = r - a - e, [a, o];
|
|
8983
8945
|
}
|
|
8984
|
-
var
|
|
8985
|
-
var
|
|
8986
|
-
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 ? `${
|
|
8987
|
-
let
|
|
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) - $;
|
|
8988
8950
|
if (s?.width === "auto") {
|
|
8989
|
-
const
|
|
8951
|
+
const T2 = e.split(`
|
|
8990
8952
|
`);
|
|
8991
|
-
let
|
|
8992
|
-
for (const
|
|
8993
|
-
const
|
|
8994
|
-
|
|
8953
|
+
let M2 = m + u * 2;
|
|
8954
|
+
for (const le of T2) {
|
|
8955
|
+
const k2 = D2(le) + l * 2;
|
|
8956
|
+
k2 > M2 && (M2 = k2);
|
|
8995
8957
|
}
|
|
8996
|
-
const
|
|
8997
|
-
|
|
8958
|
+
const O2 = M2 + o;
|
|
8959
|
+
O2 < F && (F = O2);
|
|
8998
8960
|
}
|
|
8999
|
-
|
|
9000
|
-
const
|
|
9001
|
-
i.write(`${c}${
|
|
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]}
|
|
9002
8964
|
`);
|
|
9003
|
-
const
|
|
8965
|
+
const S2 = w.split(`
|
|
9004
8966
|
`);
|
|
9005
|
-
for (const
|
|
9006
|
-
const [
|
|
9007
|
-
i.write(`${c}${E}${" ".repeat(
|
|
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}
|
|
9008
8970
|
`);
|
|
9009
8971
|
}
|
|
9010
|
-
i.write(`${c}${
|
|
8972
|
+
i.write(`${c}${f[2]}${g.repeat(y2)}${f[3]}
|
|
9011
8973
|
`);
|
|
9012
8974
|
};
|
|
9013
|
-
var
|
|
9014
|
-
const r =
|
|
9015
|
-
return new kt({ active: r, inactive: s, signal:
|
|
9016
|
-
const i =
|
|
9017
|
-
` : ""}${W2(this.state)} ${
|
|
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}
|
|
9018
8980
|
`, o = this.value ? r : s;
|
|
9019
8981
|
switch (this.state) {
|
|
9020
8982
|
case "submit": {
|
|
9021
|
-
const u = i ? `${
|
|
9022
|
-
return `${a}${u}${
|
|
8983
|
+
const u = i ? `${t("gray", h)} ` : "";
|
|
8984
|
+
return `${a}${u}${t("dim", o)}`;
|
|
9023
8985
|
}
|
|
9024
8986
|
case "cancel": {
|
|
9025
|
-
const u = i ? `${
|
|
9026
|
-
return `${a}${u}${
|
|
9027
|
-
${
|
|
8987
|
+
const u = i ? `${t("gray", h)} ` : "";
|
|
8988
|
+
return `${a}${u}${t(["strikethrough", "dim"], o)}${i ? `
|
|
8989
|
+
${t("gray", h)}` : ""}`;
|
|
9028
8990
|
}
|
|
9029
8991
|
default: {
|
|
9030
|
-
const u = i ? `${
|
|
9031
|
-
return `${a}${u}${this.value ? `${
|
|
9032
|
-
${
|
|
9033
|
-
` : ` ${
|
|
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}`}
|
|
9034
8996
|
${l}
|
|
9035
8997
|
`;
|
|
9036
8998
|
}
|
|
9037
8999
|
}
|
|
9038
9000
|
} }).prompt();
|
|
9039
9001
|
};
|
|
9040
|
-
var R2 = { message: (
|
|
9041
|
-
const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "",
|
|
9042
|
-
for (let
|
|
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++)
|
|
9043
9005
|
u.push(n);
|
|
9044
|
-
const
|
|
9006
|
+
const f = Array.isArray(e) ? e : e.split(`
|
|
9045
9007
|
`);
|
|
9046
|
-
if (
|
|
9047
|
-
const [
|
|
9048
|
-
|
|
9049
|
-
for (const $
|
|
9050
|
-
|
|
9008
|
+
if (f.length > 0) {
|
|
9009
|
+
const [g, ...E] = f;
|
|
9010
|
+
g.length > 0 ? u.push(`${c}${g}`) : u.push(l ? r : "");
|
|
9011
|
+
for (const $ of E)
|
|
9012
|
+
$.length > 0 ? u.push(`${p}${$}`) : u.push(l ? s : "");
|
|
9051
9013
|
}
|
|
9052
9014
|
i.write(`${u.join(`
|
|
9053
9015
|
`)}
|
|
9054
9016
|
`);
|
|
9055
|
-
}, info: (
|
|
9056
|
-
R2.message(
|
|
9057
|
-
}, success: (
|
|
9058
|
-
R2.message(
|
|
9059
|
-
}, step: (
|
|
9060
|
-
R2.message(
|
|
9061
|
-
}, warn: (
|
|
9062
|
-
R2.message(
|
|
9063
|
-
}, warning: (
|
|
9064
|
-
R2.warn(
|
|
9065
|
-
}, error: (
|
|
9066
|
-
R2.message(
|
|
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) });
|
|
9067
9029
|
} };
|
|
9068
|
-
var
|
|
9069
|
-
|
|
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)}
|
|
9070
9033
|
|
|
9071
9034
|
`);
|
|
9072
9035
|
};
|
|
9073
|
-
var
|
|
9074
|
-
|
|
9036
|
+
var Wt2 = (e = "", r) => {
|
|
9037
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", he)} ` : "";
|
|
9038
|
+
s.write(`${i}${e}
|
|
9075
9039
|
`);
|
|
9076
9040
|
};
|
|
9077
|
-
var
|
|
9078
|
-
|
|
9079
|
-
${
|
|
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}
|
|
9080
9045
|
|
|
9081
9046
|
`);
|
|
9082
9047
|
};
|
|
9083
|
-
var
|
|
9048
|
+
var Q2 = (e, r) => e.split(`
|
|
9084
9049
|
`).map((s) => r(s)).join(`
|
|
9085
9050
|
`);
|
|
9086
|
-
var
|
|
9051
|
+
var Lt2 = (e) => {
|
|
9087
9052
|
const r = (i, a) => {
|
|
9088
9053
|
const o = i.label ?? String(i.value);
|
|
9089
|
-
return a === "disabled" ? `${
|
|
9090
|
-
}, s =
|
|
9091
|
-
return new Lt({ options:
|
|
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) {
|
|
9092
9057
|
if (s && (i === undefined || i.length === 0))
|
|
9093
9058
|
return `Please select at least one option.
|
|
9094
|
-
${
|
|
9059
|
+
${t("reset", t("dim", `Press ${t(["gray", "bgWhite", "inverse"], " space ")} to select, ${t("gray", t("bgWhite", t("inverse", " enter ")))} to submit`))}`;
|
|
9095
9060
|
}, render() {
|
|
9096
|
-
const i =
|
|
9061
|
+
const i = Bt(e.output, e.message, `${ve(this.state)} `, `${W2(this.state)} `), a = `${t("gray", h)}
|
|
9097
9062
|
${i}
|
|
9098
9063
|
`, o = this.value ?? [], u = (l, n) => {
|
|
9099
9064
|
if (l.disabled)
|
|
@@ -9103,162 +9068,162 @@ ${i}
|
|
|
9103
9068
|
};
|
|
9104
9069
|
switch (this.state) {
|
|
9105
9070
|
case "submit": {
|
|
9106
|
-
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(
|
|
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)} `);
|
|
9107
9072
|
return `${a}${n}`;
|
|
9108
9073
|
}
|
|
9109
9074
|
case "cancel": {
|
|
9110
|
-
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(
|
|
9075
|
+
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(t("dim", ", "));
|
|
9111
9076
|
if (l.trim() === "")
|
|
9112
|
-
return `${a}${
|
|
9113
|
-
const n =
|
|
9077
|
+
return `${a}${t("gray", h)}`;
|
|
9078
|
+
const n = Bt(e.output, l, `${t("gray", h)} `);
|
|
9114
9079
|
return `${a}${n}
|
|
9115
|
-
${
|
|
9080
|
+
${t("gray", h)}`;
|
|
9116
9081
|
}
|
|
9117
9082
|
case "error": {
|
|
9118
|
-
const l = `${
|
|
9119
|
-
`).map((
|
|
9083
|
+
const l = `${t("yellow", h)} `, n = this.error.split(`
|
|
9084
|
+
`).map((f, g) => g === 0 ? `${t("yellow", x2)} ${t("yellow", f)}` : ` ${f}`).join(`
|
|
9120
9085
|
`), c = a.split(`
|
|
9121
|
-
`).length,
|
|
9086
|
+
`).length, p = n.split(`
|
|
9122
9087
|
`).length + 1;
|
|
9123
|
-
return `${a}${l}${X2({ output:
|
|
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(`
|
|
9124
9089
|
${l}`)}
|
|
9125
9090
|
${n}
|
|
9126
9091
|
`;
|
|
9127
9092
|
}
|
|
9128
9093
|
default: {
|
|
9129
|
-
const l = `${
|
|
9094
|
+
const l = `${t("cyan", h)} `, n = a.split(`
|
|
9130
9095
|
`).length;
|
|
9131
|
-
return `${a}${l}${X2({ output:
|
|
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(`
|
|
9132
9097
|
${l}`)}
|
|
9133
|
-
${
|
|
9098
|
+
${t("cyan", x2)}
|
|
9134
9099
|
`;
|
|
9135
9100
|
}
|
|
9136
9101
|
}
|
|
9137
9102
|
} }).prompt();
|
|
9138
9103
|
};
|
|
9139
|
-
var
|
|
9140
|
-
var
|
|
9141
|
-
const c =
|
|
9142
|
-
let
|
|
9143
|
-
const
|
|
9144
|
-
const
|
|
9145
|
-
E =
|
|
9146
|
-
},
|
|
9147
|
-
process.on("uncaughtExceptionMonitor",
|
|
9148
|
-
}, A = () => {
|
|
9149
|
-
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);
|
|
9150
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 = () => {
|
|
9151
9116
|
if (m === undefined)
|
|
9152
9117
|
return;
|
|
9153
9118
|
c && s.write(`
|
|
9154
9119
|
`);
|
|
9155
|
-
const
|
|
9120
|
+
const B2 = J2(m, F, { hard: true, trim: false }).split(`
|
|
9156
9121
|
`);
|
|
9157
|
-
|
|
9158
|
-
},
|
|
9159
|
-
const
|
|
9160
|
-
return
|
|
9161
|
-
},
|
|
9162
|
-
|
|
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)}
|
|
9163
9128
|
`);
|
|
9164
|
-
let
|
|
9165
|
-
|
|
9166
|
-
if (c && $
|
|
9129
|
+
let P2 = 0, G2 = 0;
|
|
9130
|
+
b(), f = setInterval(() => {
|
|
9131
|
+
if (c && $ === m)
|
|
9167
9132
|
return;
|
|
9168
|
-
|
|
9169
|
-
const
|
|
9170
|
-
let
|
|
9133
|
+
S2(), m = $;
|
|
9134
|
+
const L2 = y2(o[P2]);
|
|
9135
|
+
let Z2;
|
|
9171
9136
|
if (c)
|
|
9172
|
-
|
|
9173
|
-
else if (
|
|
9174
|
-
|
|
9137
|
+
Z2 = `${L2} ${$}...`;
|
|
9138
|
+
else if (e === "timer")
|
|
9139
|
+
Z2 = `${L2} ${$} ${M2(d)}`;
|
|
9175
9140
|
else {
|
|
9176
|
-
const
|
|
9177
|
-
|
|
9141
|
+
const et2 = ".".repeat(Math.floor(G2)).slice(0, 3);
|
|
9142
|
+
Z2 = `${L2} ${$}${et2}`;
|
|
9178
9143
|
}
|
|
9179
|
-
const
|
|
9180
|
-
s.write(
|
|
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;
|
|
9181
9146
|
}, u);
|
|
9182
|
-
},
|
|
9183
|
-
if (!
|
|
9147
|
+
}, k2 = (B2 = "", P2 = 0, G2 = false) => {
|
|
9148
|
+
if (!g)
|
|
9184
9149
|
return;
|
|
9185
|
-
|
|
9186
|
-
const
|
|
9187
|
-
$
|
|
9188
|
-
`) : s.write(`${
|
|
9189
|
-
`)),
|
|
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();
|
|
9190
9155
|
};
|
|
9191
|
-
return { start:
|
|
9192
|
-
$
|
|
9193
|
-
}, cancel: (
|
|
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() {
|
|
9194
9159
|
return E;
|
|
9195
9160
|
} };
|
|
9196
9161
|
};
|
|
9197
|
-
var
|
|
9198
|
-
function
|
|
9199
|
-
const a =
|
|
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);
|
|
9200
9165
|
let o = 0, u = "";
|
|
9201
9166
|
const l = Math.max(1, r), n = Math.max(1, s), c = (E) => {
|
|
9202
9167
|
switch (E) {
|
|
9203
9168
|
case "initial":
|
|
9204
9169
|
case "active":
|
|
9205
|
-
return
|
|
9170
|
+
return ($) => t("magenta", $);
|
|
9206
9171
|
case "error":
|
|
9207
9172
|
case "cancel":
|
|
9208
|
-
return
|
|
9173
|
+
return ($) => t("red", $);
|
|
9209
9174
|
case "submit":
|
|
9210
|
-
return
|
|
9175
|
+
return ($) => t("green", $);
|
|
9211
9176
|
default:
|
|
9212
|
-
return
|
|
9177
|
+
return ($) => t("magenta", $);
|
|
9213
9178
|
}
|
|
9214
|
-
},
|
|
9179
|
+
}, p = (E, $) => {
|
|
9215
9180
|
const m = Math.floor(o / l * n);
|
|
9216
|
-
return `${c(E)(
|
|
9217
|
-
},
|
|
9218
|
-
u = E, a.start(
|
|
9219
|
-
},
|
|
9220
|
-
o = Math.min(l, E + o), a.message(
|
|
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;
|
|
9221
9186
|
};
|
|
9222
|
-
return { start:
|
|
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) };
|
|
9223
9188
|
}
|
|
9224
|
-
var
|
|
9225
|
-
`) ?
|
|
9189
|
+
var oe = (e, r) => e.includes(`
|
|
9190
|
+
`) ? e.split(`
|
|
9226
9191
|
`).map((s) => r(s)).join(`
|
|
9227
|
-
`) : r(
|
|
9228
|
-
var
|
|
9192
|
+
`) : r(e);
|
|
9193
|
+
var Jt = (e) => {
|
|
9229
9194
|
const r = (s, i) => {
|
|
9230
9195
|
const a = s.label ?? String(s.value);
|
|
9231
9196
|
switch (i) {
|
|
9232
9197
|
case "disabled":
|
|
9233
|
-
return `${
|
|
9198
|
+
return `${t("gray", H2)} ${oe(a, (o) => t("gray", o))}${s.hint ? ` ${t("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
9234
9199
|
case "selected":
|
|
9235
|
-
return `${
|
|
9200
|
+
return `${oe(a, (o) => t("dim", o))}`;
|
|
9236
9201
|
case "active":
|
|
9237
|
-
return `${
|
|
9202
|
+
return `${t("green", z2)} ${a}${s.hint ? ` ${t("dim", `(${s.hint})`)}` : ""}`;
|
|
9238
9203
|
case "cancelled":
|
|
9239
|
-
return `${
|
|
9204
|
+
return `${oe(a, (o) => t(["strikethrough", "dim"], o))}`;
|
|
9240
9205
|
default:
|
|
9241
|
-
return `${
|
|
9206
|
+
return `${t("dim", H2)} ${oe(a, (o) => t("dim", o))}`;
|
|
9242
9207
|
}
|
|
9243
9208
|
};
|
|
9244
|
-
return new
|
|
9245
|
-
const s =
|
|
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)}
|
|
9246
9211
|
` : ""}${o}
|
|
9247
9212
|
`;
|
|
9248
9213
|
switch (this.state) {
|
|
9249
9214
|
case "submit": {
|
|
9250
|
-
const l = s ? `${
|
|
9215
|
+
const l = s ? `${t("gray", h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "selected"), l);
|
|
9251
9216
|
return `${u}${n}`;
|
|
9252
9217
|
}
|
|
9253
9218
|
case "cancel": {
|
|
9254
|
-
const l = s ? `${
|
|
9219
|
+
const l = s ? `${t("gray", h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "cancelled"), l);
|
|
9255
9220
|
return `${u}${n}${s ? `
|
|
9256
|
-
${
|
|
9221
|
+
${t("gray", h)}` : ""}`;
|
|
9257
9222
|
}
|
|
9258
9223
|
default: {
|
|
9259
|
-
const l = s ? `${
|
|
9260
|
-
`).length,
|
|
9261
|
-
return `${u}${l}${X2({ output:
|
|
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(`
|
|
9262
9227
|
${l}`)}
|
|
9263
9228
|
${n}
|
|
9264
9229
|
`;
|
|
@@ -9266,7 +9231,7 @@ ${n}
|
|
|
9266
9231
|
}
|
|
9267
9232
|
} }).prompt();
|
|
9268
9233
|
};
|
|
9269
|
-
var
|
|
9234
|
+
var Qe = `${t("gray", h)} `;
|
|
9270
9235
|
|
|
9271
9236
|
// src/commands/disable.ts
|
|
9272
9237
|
async function runDisable() {
|
|
@@ -9371,9 +9336,9 @@ async function runWithSpan({ name, context, ...options }, fn) {
|
|
|
9371
9336
|
const callback = async (span) => {
|
|
9372
9337
|
try {
|
|
9373
9338
|
return await fn(span);
|
|
9374
|
-
} catch (
|
|
9375
|
-
setSpanError(span,
|
|
9376
|
-
throw
|
|
9339
|
+
} catch (e) {
|
|
9340
|
+
setSpanError(span, e, options);
|
|
9341
|
+
throw e;
|
|
9377
9342
|
} finally {
|
|
9378
9343
|
span.end();
|
|
9379
9344
|
}
|
|
@@ -10139,11 +10104,11 @@ function toEventIterator(stream, options = {}) {
|
|
|
10139
10104
|
}
|
|
10140
10105
|
}
|
|
10141
10106
|
}
|
|
10142
|
-
} catch (
|
|
10143
|
-
if (!(
|
|
10144
|
-
setSpanError(span,
|
|
10107
|
+
} catch (e) {
|
|
10108
|
+
if (!(e instanceof ErrorEvent)) {
|
|
10109
|
+
setSpanError(span, e, options);
|
|
10145
10110
|
}
|
|
10146
|
-
throw
|
|
10111
|
+
throw e;
|
|
10147
10112
|
}
|
|
10148
10113
|
}, async (reason) => {
|
|
10149
10114
|
try {
|
|
@@ -10152,9 +10117,9 @@ function toEventIterator(stream, options = {}) {
|
|
|
10152
10117
|
span?.addEvent("cancelled");
|
|
10153
10118
|
}
|
|
10154
10119
|
await runInSpanContext(span, () => reader?.cancel());
|
|
10155
|
-
} catch (
|
|
10156
|
-
setSpanError(span,
|
|
10157
|
-
throw
|
|
10120
|
+
} catch (e) {
|
|
10121
|
+
setSpanError(span, e, options);
|
|
10122
|
+
throw e;
|
|
10158
10123
|
} finally {
|
|
10159
10124
|
span?.end();
|
|
10160
10125
|
}
|
|
@@ -10233,9 +10198,9 @@ function toEventStream(iterator, options = {}) {
|
|
|
10233
10198
|
clearInterval(timeout);
|
|
10234
10199
|
span?.addEvent("cancelled");
|
|
10235
10200
|
await runInSpanContext(span, () => iterator.return?.());
|
|
10236
|
-
} catch (
|
|
10237
|
-
setSpanError(span,
|
|
10238
|
-
throw
|
|
10201
|
+
} catch (e) {
|
|
10202
|
+
setSpanError(span, e);
|
|
10203
|
+
throw e;
|
|
10239
10204
|
} finally {
|
|
10240
10205
|
span?.end();
|
|
10241
10206
|
}
|
|
@@ -10243,35 +10208,35 @@ function toEventStream(iterator, options = {}) {
|
|
|
10243
10208
|
}).pipeThrough(new TextEncoderStream);
|
|
10244
10209
|
return stream;
|
|
10245
10210
|
}
|
|
10246
|
-
function toStandardBody(
|
|
10211
|
+
function toStandardBody(re2, options = {}) {
|
|
10247
10212
|
return runWithSpan({ name: "parse_standard_body", signal: options.signal }, async () => {
|
|
10248
|
-
const contentDisposition =
|
|
10213
|
+
const contentDisposition = re2.headers.get("content-disposition");
|
|
10249
10214
|
if (typeof contentDisposition === "string") {
|
|
10250
10215
|
const fileName = getFilenameFromContentDisposition(contentDisposition) ?? "blob";
|
|
10251
|
-
const blob2 = await
|
|
10216
|
+
const blob2 = await re2.blob();
|
|
10252
10217
|
return new File([blob2], fileName, {
|
|
10253
10218
|
type: blob2.type
|
|
10254
10219
|
});
|
|
10255
10220
|
}
|
|
10256
|
-
const contentType =
|
|
10221
|
+
const contentType = re2.headers.get("content-type");
|
|
10257
10222
|
if (!contentType || contentType.startsWith("application/json")) {
|
|
10258
|
-
const text = await
|
|
10223
|
+
const text = await re2.text();
|
|
10259
10224
|
return parseEmptyableJSON(text);
|
|
10260
10225
|
}
|
|
10261
10226
|
if (contentType.startsWith("multipart/form-data")) {
|
|
10262
|
-
return await
|
|
10227
|
+
return await re2.formData();
|
|
10263
10228
|
}
|
|
10264
10229
|
if (contentType.startsWith("application/x-www-form-urlencoded")) {
|
|
10265
|
-
const text = await
|
|
10230
|
+
const text = await re2.text();
|
|
10266
10231
|
return new URLSearchParams(text);
|
|
10267
10232
|
}
|
|
10268
10233
|
if (contentType.startsWith("text/event-stream")) {
|
|
10269
|
-
return toEventIterator(
|
|
10234
|
+
return toEventIterator(re2.body, options);
|
|
10270
10235
|
}
|
|
10271
10236
|
if (contentType.startsWith("text/plain")) {
|
|
10272
|
-
return await
|
|
10237
|
+
return await re2.text();
|
|
10273
10238
|
}
|
|
10274
|
-
const blob = await
|
|
10239
|
+
const blob = await re2.blob();
|
|
10275
10240
|
return new File([blob], "blob", {
|
|
10276
10241
|
type: blob.type
|
|
10277
10242
|
});
|
|
@@ -10654,10 +10619,10 @@ class StandardRPCSerializer {
|
|
|
10654
10619
|
if (isAsyncIteratorObject(data)) {
|
|
10655
10620
|
return mapEventIterator(data, {
|
|
10656
10621
|
value: async (value2) => this.#serialize(value2, false),
|
|
10657
|
-
error: async (
|
|
10622
|
+
error: async (e) => {
|
|
10658
10623
|
return new ErrorEvent({
|
|
10659
|
-
data: this.#serialize(toORPCError(
|
|
10660
|
-
cause:
|
|
10624
|
+
data: this.#serialize(toORPCError(e).toJSON(), false),
|
|
10625
|
+
cause: e
|
|
10661
10626
|
});
|
|
10662
10627
|
}
|
|
10663
10628
|
});
|
|
@@ -10684,17 +10649,17 @@ class StandardRPCSerializer {
|
|
|
10684
10649
|
if (isAsyncIteratorObject(data)) {
|
|
10685
10650
|
return mapEventIterator(data, {
|
|
10686
10651
|
value: async (value2) => this.#deserialize(value2),
|
|
10687
|
-
error: async (
|
|
10688
|
-
if (!(
|
|
10689
|
-
return
|
|
10652
|
+
error: async (e) => {
|
|
10653
|
+
if (!(e instanceof ErrorEvent)) {
|
|
10654
|
+
return e;
|
|
10690
10655
|
}
|
|
10691
|
-
const deserialized = this.#deserialize(
|
|
10656
|
+
const deserialized = this.#deserialize(e.data);
|
|
10692
10657
|
if (isORPCErrorJson(deserialized)) {
|
|
10693
|
-
return createORPCErrorFromJson(deserialized, { cause:
|
|
10658
|
+
return createORPCErrorFromJson(deserialized, { cause: e });
|
|
10694
10659
|
}
|
|
10695
10660
|
return new ErrorEvent({
|
|
10696
10661
|
data: deserialized,
|
|
10697
|
-
cause:
|
|
10662
|
+
cause: e
|
|
10698
10663
|
});
|
|
10699
10664
|
}
|
|
10700
10665
|
});
|
|
@@ -10759,51 +10724,50 @@ class RPCLink extends StandardRPCLink {
|
|
|
10759
10724
|
|
|
10760
10725
|
// src/lib/api-client.ts
|
|
10761
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}` };
|
|
10762
10729
|
const link = new RPCLink({
|
|
10763
10730
|
url: `${config.apiBaseUrl}/rpc`,
|
|
10764
|
-
headers:
|
|
10765
|
-
Authorization: `Bearer ${config.token}`
|
|
10766
|
-
}
|
|
10731
|
+
headers: authHeaders
|
|
10767
10732
|
});
|
|
10768
10733
|
return createORPCClient(link);
|
|
10769
10734
|
}
|
|
10770
10735
|
|
|
10771
10736
|
// src/lib/credentials.ts
|
|
10772
10737
|
import {
|
|
10773
|
-
existsSync as
|
|
10738
|
+
existsSync as existsSync6,
|
|
10774
10739
|
mkdirSync as mkdirSync2,
|
|
10775
|
-
readFileSync as
|
|
10740
|
+
readFileSync as readFileSync5,
|
|
10776
10741
|
rmSync,
|
|
10777
10742
|
writeFileSync as writeFileSync3
|
|
10778
|
-
} from "fs";
|
|
10779
|
-
import { homedir as homedir7 } from "os";
|
|
10780
|
-
import { join as join8 } from "path";
|
|
10743
|
+
} from "node:fs";
|
|
10744
|
+
import { homedir as homedir7 } from "node:os";
|
|
10745
|
+
import { join as join8 } from "node:path";
|
|
10781
10746
|
function getConfigDir() {
|
|
10782
10747
|
return process.env.RUDEL_CONFIG_DIR ?? join8(homedir7(), ".rudel");
|
|
10783
10748
|
}
|
|
10784
10749
|
function getCredentialsPath() {
|
|
10785
10750
|
return join8(getConfigDir(), "credentials.json");
|
|
10786
10751
|
}
|
|
10787
|
-
function saveCredentials(
|
|
10752
|
+
function saveCredentials(credentials) {
|
|
10788
10753
|
const dir = getConfigDir();
|
|
10789
|
-
if (!
|
|
10754
|
+
if (!existsSync6(dir)) {
|
|
10790
10755
|
mkdirSync2(dir, { recursive: true, mode: 448 });
|
|
10791
10756
|
}
|
|
10792
|
-
|
|
10793
|
-
writeFileSync3(getCredentialsPath(), JSON.stringify(data, null, 2), {
|
|
10757
|
+
writeFileSync3(getCredentialsPath(), JSON.stringify(credentials, null, 2), {
|
|
10794
10758
|
mode: 384
|
|
10795
10759
|
});
|
|
10796
10760
|
}
|
|
10797
10761
|
function loadCredentials() {
|
|
10798
10762
|
const path = getCredentialsPath();
|
|
10799
|
-
if (!
|
|
10763
|
+
if (!existsSync6(path))
|
|
10800
10764
|
return null;
|
|
10801
|
-
const content =
|
|
10765
|
+
const content = readFileSync5(path, "utf-8");
|
|
10802
10766
|
return JSON.parse(content);
|
|
10803
10767
|
}
|
|
10804
10768
|
function clearCredentials() {
|
|
10805
10769
|
const path = getCredentialsPath();
|
|
10806
|
-
if (
|
|
10770
|
+
if (existsSync6(path)) {
|
|
10807
10771
|
rmSync(path);
|
|
10808
10772
|
}
|
|
10809
10773
|
}
|
|
@@ -10820,7 +10784,7 @@ async function verifyAuth() {
|
|
|
10820
10784
|
}
|
|
10821
10785
|
const client = createApiClient(credentials);
|
|
10822
10786
|
try {
|
|
10823
|
-
const user = await client.me();
|
|
10787
|
+
const user = credentials.authType === "api-key" ? await client.cli.authStatus() : await client.me();
|
|
10824
10788
|
return { authenticated: true, credentials, user };
|
|
10825
10789
|
} catch (error) {
|
|
10826
10790
|
const message = String(error);
|
|
@@ -10965,8 +10929,10 @@ async function pMap(iterable, mapper, {
|
|
|
10965
10929
|
var pMapSkip = Symbol("skip");
|
|
10966
10930
|
|
|
10967
10931
|
// src/lib/failed-uploads.ts
|
|
10968
|
-
import {
|
|
10969
|
-
import {
|
|
10932
|
+
import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
|
|
10933
|
+
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
10934
|
+
import { homedir as homedir8 } from "node:os";
|
|
10935
|
+
import { dirname as dirname4, join as join9 } from "node:path";
|
|
10970
10936
|
|
|
10971
10937
|
// ../../node_modules/.bun/@orpc+contract@1.13.6/node_modules/@orpc/contract/dist/shared/contract.D_dZrO__.mjs
|
|
10972
10938
|
function mergeErrorMap(errorMap1, errorMap2) {
|
|
@@ -11135,6 +11101,8 @@ var DateRangeInputSchema = exports_external.object({
|
|
|
11135
11101
|
startDate: exports_external.string().date(),
|
|
11136
11102
|
endDate: exports_external.string().date()
|
|
11137
11103
|
});
|
|
11104
|
+
var MAX_ID_FILTER_LENGTH = 512;
|
|
11105
|
+
var MAX_PATH_FILTER_LENGTH = 4096;
|
|
11138
11106
|
var OverviewKPIsSchema = exports_external.object({
|
|
11139
11107
|
distinct_users: exports_external.number(),
|
|
11140
11108
|
distinct_sessions: exports_external.number(),
|
|
@@ -11269,11 +11237,11 @@ var DeveloperErrorSchema = exports_external.object({
|
|
|
11269
11237
|
last_seen: exports_external.string()
|
|
11270
11238
|
});
|
|
11271
11239
|
var DeveloperDetailsInputSchema = DaysInputSchema.extend({
|
|
11272
|
-
userId: exports_external.string()
|
|
11240
|
+
userId: exports_external.string().max(MAX_ID_FILTER_LENGTH)
|
|
11273
11241
|
});
|
|
11274
11242
|
var DeveloperSessionsInputSchema = DaysInputSchema.extend({
|
|
11275
|
-
userId: exports_external.string(),
|
|
11276
|
-
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(),
|
|
11277
11245
|
outcome: exports_external.enum(["all", "success"]).default("all"),
|
|
11278
11246
|
limit: exports_external.number().int().positive().default(100),
|
|
11279
11247
|
offset: exports_external.number().int().nonnegative().default(0),
|
|
@@ -11327,13 +11295,14 @@ var ProjectErrorSchema = exports_external.object({
|
|
|
11327
11295
|
var ProjectTrendDataPointSchema = exports_external.object({
|
|
11328
11296
|
date: exports_external.string(),
|
|
11329
11297
|
project_path: exports_external.string(),
|
|
11298
|
+
project_name: exports_external.string(),
|
|
11330
11299
|
sessions: exports_external.number(),
|
|
11331
11300
|
total_hours: exports_external.number(),
|
|
11332
11301
|
total_tokens: exports_external.number(),
|
|
11333
11302
|
avg_success_rate: exports_external.number()
|
|
11334
11303
|
});
|
|
11335
11304
|
var ProjectDetailsInputSchema = DaysInputSchema.extend({
|
|
11336
|
-
projectPath: exports_external.string()
|
|
11305
|
+
projectPath: exports_external.string().max(MAX_PATH_FILTER_LENGTH)
|
|
11337
11306
|
});
|
|
11338
11307
|
var SessionAnalyticsSchema = exports_external.object({
|
|
11339
11308
|
session_id: exports_external.string(),
|
|
@@ -11376,9 +11345,9 @@ var SessionAnalyticsSummaryComparisonSchema = exports_external.object({
|
|
|
11376
11345
|
})
|
|
11377
11346
|
});
|
|
11378
11347
|
var SessionListInputSchema = DaysInputSchema.extend({
|
|
11379
|
-
userId: exports_external.string().optional(),
|
|
11380
|
-
projectPath: exports_external.string().optional(),
|
|
11381
|
-
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(),
|
|
11382
11351
|
source: SourceSchema.optional(),
|
|
11383
11352
|
limit: exports_external.number().int().positive().default(100),
|
|
11384
11353
|
offset: exports_external.number().int().nonnegative().default(0),
|
|
@@ -11416,8 +11385,8 @@ var DimensionAnalysisInputSchema = DaysInputSchema.extend({
|
|
|
11416
11385
|
metric: exports_external.enum(VALID_METRICS),
|
|
11417
11386
|
splitBy: exports_external.enum(VALID_DIMENSIONS).optional(),
|
|
11418
11387
|
limit: exports_external.number().int().positive().default(20),
|
|
11419
|
-
userId: exports_external.string().optional(),
|
|
11420
|
-
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()
|
|
11421
11390
|
});
|
|
11422
11391
|
var DimensionAnalysisDataPointSchema = exports_external.object({
|
|
11423
11392
|
dimension_value: exports_external.string(),
|
|
@@ -11448,7 +11417,7 @@ var SessionDetailSchema = exports_external.object({
|
|
|
11448
11417
|
source: SourceSchema.optional()
|
|
11449
11418
|
});
|
|
11450
11419
|
var SessionDetailInputSchema = exports_external.object({
|
|
11451
|
-
sessionId: exports_external.string()
|
|
11420
|
+
sessionId: exports_external.string().max(MAX_ID_FILTER_LENGTH)
|
|
11452
11421
|
});
|
|
11453
11422
|
var ROIMetricsSchema = exports_external.object({
|
|
11454
11423
|
total_cost: exports_external.number(),
|
|
@@ -11523,7 +11492,7 @@ var ErrorTrendDataPointSchema = exports_external.object({
|
|
|
11523
11492
|
total_errors: exports_external.number()
|
|
11524
11493
|
});
|
|
11525
11494
|
var ErrorTrendsInputSchema = DateRangeInputSchema.extend({
|
|
11526
|
-
splitBy: exports_external.enum(["
|
|
11495
|
+
splitBy: exports_external.enum(["project_path", "user_id", "model"]).default("project_path")
|
|
11527
11496
|
});
|
|
11528
11497
|
var RecurringErrorsInputSchema = DaysInputSchema.extend({
|
|
11529
11498
|
minOccurrences: exports_external.number().int().positive().default(2),
|
|
@@ -11565,6 +11534,11 @@ var UserSchema = exports_external.object({
|
|
|
11565
11534
|
image: exports_external.string().nullable(),
|
|
11566
11535
|
activeOrganizationId: exports_external.string().nullable()
|
|
11567
11536
|
});
|
|
11537
|
+
var CliUserSchema = exports_external.object({
|
|
11538
|
+
id: exports_external.string(),
|
|
11539
|
+
email: exports_external.string(),
|
|
11540
|
+
name: exports_external.string()
|
|
11541
|
+
});
|
|
11568
11542
|
var OrganizationSchema = exports_external.object({
|
|
11569
11543
|
id: exports_external.string(),
|
|
11570
11544
|
name: exports_external.string(),
|
|
@@ -11586,17 +11560,17 @@ var SubagentFileSchema = exports_external.object({
|
|
|
11586
11560
|
});
|
|
11587
11561
|
var IngestSessionInputSchema = exports_external.object({
|
|
11588
11562
|
source: SourceSchema.default("claude_code"),
|
|
11589
|
-
sessionId: exports_external.string(),
|
|
11590
|
-
projectPath: exports_external.string(),
|
|
11591
|
-
gitRemote: exports_external.string().optional(),
|
|
11592
|
-
packageName: exports_external.string().optional(),
|
|
11593
|
-
packageType: exports_external.string().optional(),
|
|
11594
|
-
gitBranch: exports_external.string().optional(),
|
|
11595
|
-
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(),
|
|
11596
11570
|
tag: SessionTagSchema.optional(),
|
|
11597
11571
|
content: exports_external.string(),
|
|
11598
11572
|
subagents: exports_external.array(SubagentFileSchema).optional(),
|
|
11599
|
-
organizationId: exports_external.string().optional()
|
|
11573
|
+
organizationId: exports_external.string().max(200).optional()
|
|
11600
11574
|
});
|
|
11601
11575
|
var IngestSessionOutputSchema = exports_external.object({
|
|
11602
11576
|
success: exports_external.literal(true),
|
|
@@ -11605,6 +11579,10 @@ var IngestSessionOutputSchema = exports_external.object({
|
|
|
11605
11579
|
var contract = {
|
|
11606
11580
|
health: oc.output(HealthSchema),
|
|
11607
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
|
+
},
|
|
11608
11586
|
listMyOrganizations: oc.output(exports_external.array(OrganizationSchema)),
|
|
11609
11587
|
ingestSession: oc.input(IngestSessionInputSchema).output(IngestSessionOutputSchema),
|
|
11610
11588
|
getOrganizationSessionCount: oc.input(exports_external.object({ organizationId: exports_external.string() })).output(exports_external.object({ count: exports_external.number() })),
|
|
@@ -11674,10 +11652,9 @@ function normalizeSource(raw) {
|
|
|
11674
11652
|
}
|
|
11675
11653
|
async function loadFailedUploads() {
|
|
11676
11654
|
try {
|
|
11677
|
-
|
|
11678
|
-
if (!await file.exists())
|
|
11655
|
+
if (!existsSync7(FAILED_UPLOADS_PATH))
|
|
11679
11656
|
return [];
|
|
11680
|
-
const data =
|
|
11657
|
+
const data = JSON.parse(readFileSync6(FAILED_UPLOADS_PATH, "utf-8"));
|
|
11681
11658
|
return data.failures.map((f) => ({
|
|
11682
11659
|
...f,
|
|
11683
11660
|
source: normalizeSource(f.source)
|
|
@@ -11688,11 +11665,9 @@ async function loadFailedUploads() {
|
|
|
11688
11665
|
}
|
|
11689
11666
|
async function saveFailedUploads(failures) {
|
|
11690
11667
|
try {
|
|
11691
|
-
|
|
11692
|
-
const { dirname: dirname3 } = await import("path");
|
|
11693
|
-
await mkdir(dirname3(FAILED_UPLOADS_PATH), { recursive: true });
|
|
11668
|
+
await mkdir2(dirname4(FAILED_UPLOADS_PATH), { recursive: true });
|
|
11694
11669
|
const data = { failures };
|
|
11695
|
-
await
|
|
11670
|
+
await writeFile2(FAILED_UPLOADS_PATH, JSON.stringify(data, null, 2));
|
|
11696
11671
|
} catch {}
|
|
11697
11672
|
}
|
|
11698
11673
|
async function recordFailedUpload(failure) {
|
|
@@ -11770,7 +11745,7 @@ async function batchUpload(options) {
|
|
|
11770
11745
|
// src/lib/batch-upload-ui.ts
|
|
11771
11746
|
async function runBatchUpload(options) {
|
|
11772
11747
|
const { items, upload, label, concurrency } = options;
|
|
11773
|
-
const bar =
|
|
11748
|
+
const bar = qt({ max: items.length });
|
|
11774
11749
|
bar.start(label);
|
|
11775
11750
|
const summary = await batchUpload({
|
|
11776
11751
|
items,
|
|
@@ -11807,16 +11782,15 @@ function renderBatchSummary(summary, options) {
|
|
|
11807
11782
|
lines.push("Run `rudel upload --retry` to retry failed uploads.");
|
|
11808
11783
|
}
|
|
11809
11784
|
if (lines.length > 0) {
|
|
11810
|
-
|
|
11785
|
+
Mt2(lines.join(`
|
|
11811
11786
|
`), "Upload Summary");
|
|
11812
11787
|
}
|
|
11813
11788
|
}
|
|
11814
11789
|
|
|
11815
11790
|
// src/lib/project-config.ts
|
|
11816
|
-
import { existsSync as
|
|
11817
|
-
import { homedir as homedir9 } from "os";
|
|
11818
|
-
import { join as join10 } from "path";
|
|
11819
|
-
var {$: $2 } = globalThis.Bun;
|
|
11791
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "node:fs";
|
|
11792
|
+
import { homedir as homedir9 } from "node:os";
|
|
11793
|
+
import { join as join10 } from "node:path";
|
|
11820
11794
|
function getConfigDir2() {
|
|
11821
11795
|
return process.env.RUDEL_CONFIG_DIR ?? join10(homedir9(), ".rudel");
|
|
11822
11796
|
}
|
|
@@ -11825,14 +11799,14 @@ function getProjectsConfigPath() {
|
|
|
11825
11799
|
}
|
|
11826
11800
|
function loadProjectsConfig() {
|
|
11827
11801
|
const path = getProjectsConfigPath();
|
|
11828
|
-
if (!
|
|
11802
|
+
if (!existsSync8(path))
|
|
11829
11803
|
return { projects: {} };
|
|
11830
|
-
const content =
|
|
11804
|
+
const content = readFileSync7(path, "utf-8");
|
|
11831
11805
|
return JSON.parse(content);
|
|
11832
11806
|
}
|
|
11833
11807
|
function saveProjectsConfig(config) {
|
|
11834
11808
|
const dir = getConfigDir2();
|
|
11835
|
-
if (!
|
|
11809
|
+
if (!existsSync8(dir)) {
|
|
11836
11810
|
mkdirSync3(dir, { recursive: true, mode: 448 });
|
|
11837
11811
|
}
|
|
11838
11812
|
writeFileSync4(getProjectsConfigPath(), JSON.stringify(config, null, 2), {
|
|
@@ -11841,16 +11815,27 @@ function saveProjectsConfig(config) {
|
|
|
11841
11815
|
}
|
|
11842
11816
|
async function getProjectKey(cwd) {
|
|
11843
11817
|
try {
|
|
11844
|
-
const result = await
|
|
11818
|
+
const result = await exec("git", [
|
|
11819
|
+
"-C",
|
|
11820
|
+
cwd,
|
|
11821
|
+
"remote",
|
|
11822
|
+
"get-url",
|
|
11823
|
+
"origin"
|
|
11824
|
+
]);
|
|
11845
11825
|
if (result.exitCode === 0) {
|
|
11846
|
-
const url = result.
|
|
11826
|
+
const url = result.stdout.trim();
|
|
11847
11827
|
return url.replace(/^(https?:\/\/|git@|ssh:\/\/)/, "").replace(/:/, "/").replace(/\.git$/, "");
|
|
11848
11828
|
}
|
|
11849
11829
|
} catch {}
|
|
11850
11830
|
try {
|
|
11851
|
-
const result = await
|
|
11831
|
+
const result = await exec("git", [
|
|
11832
|
+
"-C",
|
|
11833
|
+
cwd,
|
|
11834
|
+
"rev-parse",
|
|
11835
|
+
"--show-toplevel"
|
|
11836
|
+
]);
|
|
11852
11837
|
if (result.exitCode === 0) {
|
|
11853
|
-
return result.
|
|
11838
|
+
return result.stdout.trim();
|
|
11854
11839
|
}
|
|
11855
11840
|
} catch {}
|
|
11856
11841
|
return cwd;
|
|
@@ -11892,9 +11877,7 @@ function formatError(error) {
|
|
|
11892
11877
|
async function uploadSession(request, config) {
|
|
11893
11878
|
const link = new RPCLink({
|
|
11894
11879
|
url: config.endpoint,
|
|
11895
|
-
headers: {
|
|
11896
|
-
Authorization: `Bearer ${config.token}`
|
|
11897
|
-
}
|
|
11880
|
+
headers: config.authType === "api-key" ? { "x-api-key": config.token } : { Authorization: `Bearer ${config.token}` }
|
|
11898
11881
|
});
|
|
11899
11882
|
const client = createORPCClient(link);
|
|
11900
11883
|
for (let attempt = 1;attempt <= MAX_ATTEMPTS; attempt++) {
|
|
@@ -11925,27 +11908,31 @@ async function uploadSession(request, config) {
|
|
|
11925
11908
|
|
|
11926
11909
|
// src/commands/enable.ts
|
|
11927
11910
|
async function runEnable() {
|
|
11928
|
-
|
|
11911
|
+
Wt2("rudel enable");
|
|
11929
11912
|
const auth = await verifyAuth();
|
|
11930
11913
|
if (!auth.authenticated) {
|
|
11931
11914
|
R2.error(auth.message);
|
|
11932
|
-
|
|
11915
|
+
Gt("Run `rudel login` to authenticate.");
|
|
11933
11916
|
process.exitCode = 1;
|
|
11934
11917
|
return;
|
|
11935
11918
|
}
|
|
11936
11919
|
const { credentials } = auth;
|
|
11937
|
-
const client = createApiClient(credentials);
|
|
11938
11920
|
let orgs;
|
|
11939
|
-
|
|
11940
|
-
orgs =
|
|
11941
|
-
}
|
|
11942
|
-
|
|
11943
|
-
|
|
11944
|
-
|
|
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
|
+
}
|
|
11945
11932
|
}
|
|
11946
11933
|
if (orgs.length === 0) {
|
|
11947
11934
|
R2.error("No organizations found.");
|
|
11948
|
-
|
|
11935
|
+
Gt("Create one at app.rudel.ai first.");
|
|
11949
11936
|
process.exitCode = 1;
|
|
11950
11937
|
return;
|
|
11951
11938
|
}
|
|
@@ -11961,7 +11948,7 @@ async function runEnable() {
|
|
|
11961
11948
|
R2.info(`Currently configured for: ${existingOrg.name}`);
|
|
11962
11949
|
selectedOrgId = existingOrg.id;
|
|
11963
11950
|
} else {
|
|
11964
|
-
const selected = await
|
|
11951
|
+
const selected = await Jt({
|
|
11965
11952
|
message: "Select an organization for this repository",
|
|
11966
11953
|
options: orgs.map((org) => ({
|
|
11967
11954
|
value: org.id,
|
|
@@ -11970,7 +11957,7 @@ async function runEnable() {
|
|
|
11970
11957
|
}))
|
|
11971
11958
|
});
|
|
11972
11959
|
if (Ct(selected)) {
|
|
11973
|
-
|
|
11960
|
+
Nt("Setup cancelled.");
|
|
11974
11961
|
return;
|
|
11975
11962
|
}
|
|
11976
11963
|
selectedOrgId = selected;
|
|
@@ -11988,14 +11975,14 @@ async function runEnable() {
|
|
|
11988
11975
|
label: a.name,
|
|
11989
11976
|
hint: a.isHookInstalled() ? "already enabled" : undefined
|
|
11990
11977
|
}));
|
|
11991
|
-
const selectedAdapters = await
|
|
11978
|
+
const selectedAdapters = await Lt2({
|
|
11992
11979
|
message: "Select agents to enable auto-upload for",
|
|
11993
11980
|
options: agentOptions,
|
|
11994
11981
|
initialValues: adapters2,
|
|
11995
11982
|
required: true
|
|
11996
11983
|
});
|
|
11997
11984
|
if (Ct(selectedAdapters)) {
|
|
11998
|
-
|
|
11985
|
+
Nt("Setup cancelled.");
|
|
11999
11986
|
return;
|
|
12000
11987
|
}
|
|
12001
11988
|
adaptersToEnable = selectedAdapters;
|
|
@@ -12016,7 +12003,7 @@ async function runEnable() {
|
|
|
12016
12003
|
const sessions = await adapter.findProjectSessions(cwd);
|
|
12017
12004
|
if (sessions.length === 0)
|
|
12018
12005
|
continue;
|
|
12019
|
-
const shouldUpload = await
|
|
12006
|
+
const shouldUpload = await Rt({
|
|
12020
12007
|
message: `Found ${sessions.length} previous ${adapter.name} session(s). Upload them now?`,
|
|
12021
12008
|
initialValue: false
|
|
12022
12009
|
});
|
|
@@ -12046,6 +12033,7 @@ async function runEnable() {
|
|
|
12046
12033
|
return uploadSession(request, {
|
|
12047
12034
|
endpoint,
|
|
12048
12035
|
token: credentials.token,
|
|
12036
|
+
authType: credentials.authType,
|
|
12049
12037
|
onRetry
|
|
12050
12038
|
});
|
|
12051
12039
|
}
|
|
@@ -12056,7 +12044,7 @@ async function runEnable() {
|
|
|
12056
12044
|
if (totalFailed > 0) {
|
|
12057
12045
|
R2.info("Run `rudel upload --retry` to retry failed uploads.");
|
|
12058
12046
|
}
|
|
12059
|
-
|
|
12047
|
+
Gt("Done!");
|
|
12060
12048
|
if (totalFailed > 0) {
|
|
12061
12049
|
process.exitCode = 1;
|
|
12062
12050
|
}
|
|
@@ -13058,7 +13046,7 @@ var exports_util_node = {};
|
|
|
13058
13046
|
__export(exports_util_node, {
|
|
13059
13047
|
inspect: () => inspect
|
|
13060
13048
|
});
|
|
13061
|
-
import util3 from "util";
|
|
13049
|
+
import util3 from "node:util";
|
|
13062
13050
|
function inspect(obj, options) {
|
|
13063
13051
|
return util3.inspect(obj, options);
|
|
13064
13052
|
}
|
|
@@ -13089,67 +13077,67 @@ function padThree(num) {
|
|
|
13089
13077
|
}
|
|
13090
13078
|
var timestampFormatters = {
|
|
13091
13079
|
"date-time-timezone": (ts) => {
|
|
13092
|
-
const
|
|
13093
|
-
const year =
|
|
13094
|
-
const month = padZero(
|
|
13095
|
-
const day = padZero(
|
|
13096
|
-
const hour = padZero(
|
|
13097
|
-
const minute = padZero(
|
|
13098
|
-
const second = padZero(
|
|
13099
|
-
const ms = padThree(
|
|
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());
|
|
13100
13088
|
return `${year}-${month}-${day} ${hour}:${minute}:${second}.${ms} +00:00`;
|
|
13101
13089
|
},
|
|
13102
13090
|
"date-time-tz": (ts) => {
|
|
13103
|
-
const
|
|
13104
|
-
const year =
|
|
13105
|
-
const month = padZero(
|
|
13106
|
-
const day = padZero(
|
|
13107
|
-
const hour = padZero(
|
|
13108
|
-
const minute = padZero(
|
|
13109
|
-
const second = padZero(
|
|
13110
|
-
const ms = padThree(
|
|
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());
|
|
13111
13099
|
return `${year}-${month}-${day} ${hour}:${minute}:${second}.${ms} +00`;
|
|
13112
13100
|
},
|
|
13113
13101
|
"date-time": (ts) => {
|
|
13114
|
-
const
|
|
13115
|
-
const year =
|
|
13116
|
-
const month = padZero(
|
|
13117
|
-
const day = padZero(
|
|
13118
|
-
const hour = padZero(
|
|
13119
|
-
const minute = padZero(
|
|
13120
|
-
const second = padZero(
|
|
13121
|
-
const ms = padThree(
|
|
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());
|
|
13122
13110
|
return `${year}-${month}-${day} ${hour}:${minute}:${second}.${ms}`;
|
|
13123
13111
|
},
|
|
13124
13112
|
"time-timezone": (ts) => {
|
|
13125
|
-
const
|
|
13126
|
-
const hour = padZero(
|
|
13127
|
-
const minute = padZero(
|
|
13128
|
-
const second = padZero(
|
|
13129
|
-
const ms = padThree(
|
|
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());
|
|
13130
13118
|
return `${hour}:${minute}:${second}.${ms} +00:00`;
|
|
13131
13119
|
},
|
|
13132
13120
|
"time-tz": (ts) => {
|
|
13133
|
-
const
|
|
13134
|
-
const hour = padZero(
|
|
13135
|
-
const minute = padZero(
|
|
13136
|
-
const second = padZero(
|
|
13137
|
-
const ms = padThree(
|
|
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());
|
|
13138
13126
|
return `${hour}:${minute}:${second}.${ms} +00`;
|
|
13139
13127
|
},
|
|
13140
13128
|
time: (ts) => {
|
|
13141
|
-
const
|
|
13142
|
-
const hour = padZero(
|
|
13143
|
-
const minute = padZero(
|
|
13144
|
-
const second = padZero(
|
|
13145
|
-
const ms = padThree(
|
|
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());
|
|
13146
13134
|
return `${hour}:${minute}:${second}.${ms}`;
|
|
13147
13135
|
},
|
|
13148
13136
|
date: (ts) => {
|
|
13149
|
-
const
|
|
13150
|
-
const year =
|
|
13151
|
-
const month = padZero(
|
|
13152
|
-
const day = padZero(
|
|
13137
|
+
const d = new Date(ts);
|
|
13138
|
+
const year = d.getUTCFullYear();
|
|
13139
|
+
const month = padZero(d.getUTCMonth() + 1);
|
|
13140
|
+
const day = padZero(d.getUTCDate());
|
|
13153
13141
|
return `${year}-${month}-${day}`;
|
|
13154
13142
|
},
|
|
13155
13143
|
rfc3339: (ts) => new Date(ts).toISOString(),
|
|
@@ -13234,7 +13222,7 @@ function getTextFormatter(options = {}) {
|
|
|
13234
13222
|
else
|
|
13235
13223
|
return tsOption;
|
|
13236
13224
|
})();
|
|
13237
|
-
const categorySeparator = options.category ?? "
|
|
13225
|
+
const categorySeparator = options.category ?? "·";
|
|
13238
13226
|
const valueRenderer = options.value ? (v) => options.value(v, inspect2) : inspect2;
|
|
13239
13227
|
const levelRenderer = (() => {
|
|
13240
13228
|
const levelOption = options.level;
|
|
@@ -13454,7 +13442,7 @@ function defaultConsoleFormatter(record) {
|
|
|
13454
13442
|
const date = new Date(record.timestamp);
|
|
13455
13443
|
const time = `${date.getUTCHours().toString().padStart(2, "0")}:${date.getUTCMinutes().toString().padStart(2, "0")}:${date.getUTCSeconds().toString().padStart(2, "0")}.${date.getUTCMilliseconds().toString().padStart(3, "0")}`;
|
|
13456
13444
|
return [
|
|
13457
|
-
`%c${time} %c${levelAbbreviations[record.level]}%c %c${record.category.join("
|
|
13445
|
+
`%c${time} %c${levelAbbreviations[record.level]}%c %c${record.category.join("·")} %c${msg}`,
|
|
13458
13446
|
"color: gray;",
|
|
13459
13447
|
logLevelStyles[record.level],
|
|
13460
13448
|
"background-color: default;",
|
|
@@ -13559,10 +13547,10 @@ async function configure(config) {
|
|
|
13559
13547
|
await reset();
|
|
13560
13548
|
try {
|
|
13561
13549
|
configureInternal(config, true);
|
|
13562
|
-
} catch (
|
|
13563
|
-
if (
|
|
13550
|
+
} catch (e) {
|
|
13551
|
+
if (e instanceof ConfigError)
|
|
13564
13552
|
await reset();
|
|
13565
|
-
throw
|
|
13553
|
+
throw e;
|
|
13566
13554
|
}
|
|
13567
13555
|
}
|
|
13568
13556
|
function configureInternal(config, allowAsync) {
|
|
@@ -13665,8 +13653,8 @@ var ConfigError = class extends Error {
|
|
|
13665
13653
|
};
|
|
13666
13654
|
|
|
13667
13655
|
// src/logging.ts
|
|
13668
|
-
import { homedir as homedir10 } from "os";
|
|
13669
|
-
import { join as join12 } from "path";
|
|
13656
|
+
import { homedir as homedir10 } from "node:os";
|
|
13657
|
+
import { join as join12 } from "node:path";
|
|
13670
13658
|
|
|
13671
13659
|
// ../../node_modules/.bun/@logtape+file@2.0.4+2d5de51540e256d2/node_modules/@logtape/file/dist/filesink.base.js
|
|
13672
13660
|
var AdaptiveFlushStrategy = class {
|
|
@@ -13931,9 +13919,9 @@ function getBaseFileSink(path, options) {
|
|
|
13931
13919
|
}
|
|
13932
13920
|
|
|
13933
13921
|
// ../../node_modules/.bun/@logtape+file@2.0.4+2d5de51540e256d2/node_modules/@logtape/file/dist/filesink.node.js
|
|
13934
|
-
import fs from "fs";
|
|
13935
|
-
import { join as join11 } from "path";
|
|
13936
|
-
import { promisify } from "util";
|
|
13922
|
+
import fs from "node:fs";
|
|
13923
|
+
import { join as join11 } from "node:path";
|
|
13924
|
+
import { promisify } from "node:util";
|
|
13937
13925
|
var nodeDriver = {
|
|
13938
13926
|
openSync(path) {
|
|
13939
13927
|
return fs.openSync(path, "a");
|
|
@@ -13997,8 +13985,8 @@ function getFileSink(path, options = {}) {
|
|
|
13997
13985
|
var LOG_DIR = join12(homedir10(), ".rudel", "logs");
|
|
13998
13986
|
var LOG_FILE = join12(LOG_DIR, "hook-upload.log");
|
|
13999
13987
|
async function setupHookLogging() {
|
|
14000
|
-
const { mkdir } = await import("fs/promises");
|
|
14001
|
-
await
|
|
13988
|
+
const { mkdir: mkdir3 } = await import("node:fs/promises");
|
|
13989
|
+
await mkdir3(LOG_DIR, { recursive: true }).catch(() => {});
|
|
14002
13990
|
await configure({
|
|
14003
13991
|
sinks: {
|
|
14004
13992
|
file: getFileSink(LOG_FILE)
|
|
@@ -14053,6 +14041,7 @@ async function runSessionEnd() {
|
|
|
14053
14041
|
const result = await uploadSession(request, {
|
|
14054
14042
|
endpoint,
|
|
14055
14043
|
token: credentials.token,
|
|
14044
|
+
authType: credentials.authType,
|
|
14056
14045
|
onRetry: (attempt, maxAttempts, error) => {
|
|
14057
14046
|
logger.warn("Retrying upload for {sessionId} ({attempt}/{maxAttempts}): {error}", { sessionId: input.session_id, attempt, maxAttempts, error });
|
|
14058
14047
|
}
|
|
@@ -14135,7 +14124,8 @@ async function runTurnComplete() {
|
|
|
14135
14124
|
const endpoint = `${apiBase}/rpc`;
|
|
14136
14125
|
const result = await uploadSession(request, {
|
|
14137
14126
|
endpoint,
|
|
14138
|
-
token: credentials.token
|
|
14127
|
+
token: credentials.token,
|
|
14128
|
+
authType: credentials.authType
|
|
14139
14129
|
});
|
|
14140
14130
|
if (result.success) {
|
|
14141
14131
|
await removeFailedUpload(input.thread_id);
|
|
@@ -14181,100 +14171,176 @@ var hooksRouteMap = buildRouteMap({
|
|
|
14181
14171
|
});
|
|
14182
14172
|
|
|
14183
14173
|
// src/commands/login.ts
|
|
14184
|
-
import {
|
|
14174
|
+
import { spawn } from "node:child_process";
|
|
14185
14175
|
var DEFAULT_API_BASE = "https://app.rudel.ai";
|
|
14186
14176
|
var DEFAULT_WEB_URL = "https://app.rudel.ai";
|
|
14187
|
-
var
|
|
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();
|
|
14189
|
+
return;
|
|
14190
|
+
}
|
|
14191
|
+
const opener = process.platform === "darwin" ? "open" : "xdg-open";
|
|
14192
|
+
const child = spawn(opener, [url], {
|
|
14193
|
+
detached: true,
|
|
14194
|
+
stdio: "ignore"
|
|
14195
|
+
});
|
|
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;
|
|
14231
|
+
}
|
|
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;
|
|
14237
|
+
}
|
|
14238
|
+
if (errorCode === "slow_down") {
|
|
14239
|
+
intervalMs += 1000;
|
|
14240
|
+
await sleep(intervalMs);
|
|
14241
|
+
continue;
|
|
14242
|
+
}
|
|
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
|
+
})
|
|
14258
|
+
});
|
|
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
|
+
}
|
|
14188
14265
|
async function runLogin(flags) {
|
|
14189
|
-
|
|
14266
|
+
Wt2("rudel login");
|
|
14190
14267
|
const existing = loadCredentials();
|
|
14191
14268
|
if (existing) {
|
|
14192
14269
|
R2.warn("Already logged in.");
|
|
14193
|
-
|
|
14270
|
+
Gt("Run `rudel logout` first to switch accounts.");
|
|
14194
14271
|
return;
|
|
14195
14272
|
}
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
|
|
14201
|
-
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
|
|
14205
|
-
hostname: "127.0.0.1",
|
|
14206
|
-
fetch(request) {
|
|
14207
|
-
const url = new URL(request.url);
|
|
14208
|
-
if (url.pathname !== "/callback") {
|
|
14209
|
-
return new Response("Not found", { status: 404 });
|
|
14210
|
-
}
|
|
14211
|
-
const receivedToken = url.searchParams.get("token");
|
|
14212
|
-
const receivedState = url.searchParams.get("state");
|
|
14213
|
-
if (receivedState !== state) {
|
|
14214
|
-
rejectCallback(new Error("State mismatch \u2014 possible CSRF attack"));
|
|
14215
|
-
return new Response("<html><body><h1>Login failed</h1><p>State mismatch. Please try again.</p></body></html>", { headers: { "Content-Type": "text/html" } });
|
|
14216
|
-
}
|
|
14217
|
-
if (!receivedToken) {
|
|
14218
|
-
rejectCallback(new Error("No token received"));
|
|
14219
|
-
return new Response("<html><body><h1>Login failed</h1><p>No token received.</p></body></html>", { headers: { "Content-Type": "text/html" } });
|
|
14220
|
-
}
|
|
14221
|
-
resolveCallback(receivedToken);
|
|
14222
|
-
return new Response("<html><body><h1>Login successful!</h1><p>You can close this tab and return to the terminal.</p></body></html>", { headers: { "Content-Type": "text/html" } });
|
|
14223
|
-
}
|
|
14224
|
-
});
|
|
14225
|
-
const callbackUrl = `http://127.0.0.1:${server.port}/callback`;
|
|
14226
|
-
const loginUrl = `${flags.webUrl}?cli_callback=${encodeURIComponent(callbackUrl)}&state=${state}`;
|
|
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)}`;
|
|
14227
14282
|
R2.info(`If the browser doesn't open, visit:
|
|
14228
|
-
${
|
|
14283
|
+
${verifyUrl}`);
|
|
14284
|
+
R2.info(`User code: ${deviceCode.user_code}`);
|
|
14229
14285
|
if (!flags.noBrowser) {
|
|
14230
|
-
|
|
14231
|
-
Bun.spawn(["cmd", "/c", "start", "", loginUrl], {
|
|
14232
|
-
stdout: "ignore",
|
|
14233
|
-
stderr: "ignore"
|
|
14234
|
-
});
|
|
14235
|
-
} else {
|
|
14236
|
-
const opener = process.platform === "darwin" ? "open" : "xdg-open";
|
|
14237
|
-
Bun.spawn([opener, loginUrl], { stdout: "ignore", stderr: "ignore" });
|
|
14238
|
-
}
|
|
14286
|
+
openUrl(verifyUrl);
|
|
14239
14287
|
}
|
|
14240
|
-
const
|
|
14241
|
-
rejectCallback(new Error("Login timed out after 120 seconds"));
|
|
14242
|
-
}, CALLBACK_TIMEOUT_MS);
|
|
14243
|
-
const spin = bt2();
|
|
14288
|
+
const spin = be();
|
|
14244
14289
|
spin.start("Waiting for browser authentication...");
|
|
14245
|
-
let
|
|
14290
|
+
let accessToken;
|
|
14246
14291
|
try {
|
|
14247
|
-
|
|
14292
|
+
accessToken = await pollForAccessToken(flags.apiBase, deviceCode);
|
|
14248
14293
|
} catch (error) {
|
|
14249
|
-
clearTimeout(timeout);
|
|
14250
|
-
server.stop();
|
|
14251
14294
|
spin.stop("Authentication failed");
|
|
14252
14295
|
R2.error(error instanceof Error ? error.message : String(error));
|
|
14253
14296
|
process.exitCode = 1;
|
|
14254
14297
|
return;
|
|
14255
14298
|
}
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
|
|
14260
|
-
|
|
14261
|
-
|
|
14262
|
-
|
|
14263
|
-
|
|
14264
|
-
|
|
14265
|
-
|
|
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"
|
|
14266
14313
|
});
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
|
|
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");
|
|
14270
14330
|
process.exitCode = 1;
|
|
14271
14331
|
return;
|
|
14272
14332
|
}
|
|
14273
|
-
|
|
14274
|
-
|
|
14333
|
+
saveCredentials({
|
|
14334
|
+
token: ingestKey.key,
|
|
14335
|
+
apiBaseUrl: flags.apiBase,
|
|
14336
|
+
authType: "api-key",
|
|
14337
|
+
apiKeyId: ingestKey.id,
|
|
14338
|
+
user,
|
|
14339
|
+
organizations
|
|
14340
|
+
});
|
|
14275
14341
|
spin.stop("Authenticated");
|
|
14276
|
-
R2.success(`Logged in as ${
|
|
14277
|
-
|
|
14342
|
+
R2.success(`Logged in as ${user.name} (${user.email})`);
|
|
14343
|
+
Gt("Done!");
|
|
14278
14344
|
}
|
|
14279
14345
|
var loginCommand = buildCommand({
|
|
14280
14346
|
loader: async () => ({ default: runLogin }),
|
|
@@ -14311,6 +14377,14 @@ async function runLogout() {
|
|
|
14311
14377
|
R2.info("Not logged in.");
|
|
14312
14378
|
return;
|
|
14313
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
|
+
}
|
|
14314
14388
|
clearCredentials();
|
|
14315
14389
|
R2.success("Logged out successfully.");
|
|
14316
14390
|
}
|
|
@@ -14324,32 +14398,36 @@ var logoutCommand = buildCommand({
|
|
|
14324
14398
|
|
|
14325
14399
|
// src/commands/set-org.ts
|
|
14326
14400
|
async function runSetOrg() {
|
|
14327
|
-
|
|
14401
|
+
Wt2("rudel set-org");
|
|
14328
14402
|
const credentials = loadCredentials();
|
|
14329
14403
|
if (!credentials) {
|
|
14330
14404
|
R2.error("Not authenticated.");
|
|
14331
|
-
|
|
14405
|
+
Gt("Run `rudel login` first.");
|
|
14332
14406
|
process.exitCode = 1;
|
|
14333
14407
|
return;
|
|
14334
14408
|
}
|
|
14335
|
-
const client = createApiClient(credentials);
|
|
14336
14409
|
let orgs;
|
|
14337
|
-
|
|
14338
|
-
orgs =
|
|
14339
|
-
}
|
|
14340
|
-
|
|
14341
|
-
|
|
14342
|
-
|
|
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
|
+
}
|
|
14343
14421
|
}
|
|
14344
14422
|
if (orgs.length === 0) {
|
|
14345
14423
|
R2.error("No organizations found.");
|
|
14346
|
-
|
|
14424
|
+
Gt("Create one at app.rudel.ai first.");
|
|
14347
14425
|
process.exitCode = 1;
|
|
14348
14426
|
return;
|
|
14349
14427
|
}
|
|
14350
14428
|
const cwd = process.cwd();
|
|
14351
14429
|
const currentOrgId = await getProjectOrgId(cwd);
|
|
14352
|
-
const selected = await
|
|
14430
|
+
const selected = await Jt({
|
|
14353
14431
|
message: "Select an organization for this repository",
|
|
14354
14432
|
options: orgs.map((org) => ({
|
|
14355
14433
|
value: org.id,
|
|
@@ -14359,13 +14437,13 @@ async function runSetOrg() {
|
|
|
14359
14437
|
initialValue: currentOrgId ?? undefined
|
|
14360
14438
|
});
|
|
14361
14439
|
if (Ct(selected)) {
|
|
14362
|
-
|
|
14440
|
+
Nt("Cancelled.");
|
|
14363
14441
|
return;
|
|
14364
14442
|
}
|
|
14365
14443
|
await setProjectOrgId(cwd, selected);
|
|
14366
14444
|
const selectedOrg = orgs.find((o) => o.id === selected);
|
|
14367
14445
|
R2.success(`Organization set to: ${selectedOrg?.name}`);
|
|
14368
|
-
|
|
14446
|
+
Gt("Done!");
|
|
14369
14447
|
}
|
|
14370
14448
|
var setOrgCommand = buildCommand({
|
|
14371
14449
|
loader: async () => ({ default: runSetOrg }),
|
|
@@ -14376,9 +14454,7 @@ var setOrgCommand = buildCommand({
|
|
|
14376
14454
|
});
|
|
14377
14455
|
|
|
14378
14456
|
// src/lib/classifier.ts
|
|
14379
|
-
import {
|
|
14380
|
-
import { homedir as homedir11 } from "os";
|
|
14381
|
-
import { join as join13 } from "path";
|
|
14457
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
14382
14458
|
|
|
14383
14459
|
// src/lib/types.ts
|
|
14384
14460
|
var SESSION_TAGS = [
|
|
@@ -14405,27 +14481,24 @@ var SYSTEM_PROMPT = `You are a session classifier. Analyze the Claude Code sessi
|
|
|
14405
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`;
|
|
14406
14482
|
async function classifySession(content) {
|
|
14407
14483
|
const truncatedContent = content.slice(0, 50000);
|
|
14408
|
-
const
|
|
14409
|
-
|
|
14484
|
+
const prompt = `Classify this session transcript:
|
|
14485
|
+
|
|
14486
|
+
${truncatedContent}`;
|
|
14410
14487
|
try {
|
|
14411
|
-
await
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
|
|
14419
|
-
|
|
14420
|
-
|
|
14421
|
-
|
|
14422
|
-
], { stdout: "pipe", stderr: "pipe" });
|
|
14423
|
-
const exitCode = await proc.exited;
|
|
14424
|
-
const stdout = await new Response(proc.stdout).text();
|
|
14425
|
-
if (exitCode !== 0) {
|
|
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);
|
|
14498
|
+
if (result.exitCode !== 0) {
|
|
14426
14499
|
return "other";
|
|
14427
14500
|
}
|
|
14428
|
-
const output = stdout.trim().toLowerCase();
|
|
14501
|
+
const output = result.stdout.trim().toLowerCase();
|
|
14429
14502
|
if (SESSION_TAGS.includes(output)) {
|
|
14430
14503
|
return output;
|
|
14431
14504
|
}
|
|
@@ -14437,18 +14510,35 @@ ${truncatedContent}`);
|
|
|
14437
14510
|
return "other";
|
|
14438
14511
|
} catch {
|
|
14439
14512
|
return;
|
|
14440
|
-
} finally {
|
|
14441
|
-
try {
|
|
14442
|
-
await unlink(tempFile);
|
|
14443
|
-
} catch {}
|
|
14444
14513
|
}
|
|
14445
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
|
+
}
|
|
14446
14536
|
|
|
14447
14537
|
// src/lib/session-resolver.ts
|
|
14448
|
-
import { access, readdir as readdir3 } from "fs/promises";
|
|
14449
|
-
import { homedir as
|
|
14450
|
-
import { basename, dirname as
|
|
14451
|
-
var SESSIONS_BASE_DIR3 =
|
|
14538
|
+
import { access, readdir as readdir3 } from "node:fs/promises";
|
|
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");
|
|
14452
14542
|
async function resolveSession(input) {
|
|
14453
14543
|
const isPath = input.includes("/") || input.endsWith(".jsonl");
|
|
14454
14544
|
if (isPath) {
|
|
@@ -14465,7 +14555,7 @@ async function resolveFromPath(filePath) {
|
|
|
14465
14555
|
throw new Error(`Session file not found: ${filePath}`);
|
|
14466
14556
|
}
|
|
14467
14557
|
const sessionId = filename.replace(/\.jsonl$/, "");
|
|
14468
|
-
const sessionDir =
|
|
14558
|
+
const sessionDir = dirname5(filePath);
|
|
14469
14559
|
const parentDir = basename(sessionDir);
|
|
14470
14560
|
const projectPath = await decodeProjectPath(parentDir);
|
|
14471
14561
|
return { transcriptPath: filePath, projectPath, sessionDir, sessionId };
|
|
@@ -14480,11 +14570,11 @@ async function resolveFromId(sessionId) {
|
|
|
14480
14570
|
throw new Error(`Session not found: ${sessionId}`);
|
|
14481
14571
|
}
|
|
14482
14572
|
for (const projectDir of projectDirs) {
|
|
14483
|
-
const sessionDir =
|
|
14573
|
+
const sessionDir = join13(SESSIONS_BASE_DIR3, projectDir);
|
|
14484
14574
|
try {
|
|
14485
14575
|
const files = await readdir3(sessionDir);
|
|
14486
14576
|
if (files.includes(sessionFileName)) {
|
|
14487
|
-
const transcriptPath =
|
|
14577
|
+
const transcriptPath = join13(sessionDir, sessionFileName);
|
|
14488
14578
|
const projectPath = await decodeProjectPath(projectDir);
|
|
14489
14579
|
return {
|
|
14490
14580
|
transcriptPath,
|
|
@@ -14511,14 +14601,14 @@ async function runInteractiveUpload(flags) {
|
|
|
14511
14601
|
process.exitCode = 1;
|
|
14512
14602
|
return;
|
|
14513
14603
|
}
|
|
14514
|
-
|
|
14515
|
-
const spin =
|
|
14604
|
+
Wt2("rudel upload");
|
|
14605
|
+
const spin = be();
|
|
14516
14606
|
spin.start("Scanning projects...");
|
|
14517
14607
|
const { projects: allProjects, groups } = await scanAndGroupProjects();
|
|
14518
14608
|
spin.stop(`Found ${allProjects.length} project(s)`);
|
|
14519
14609
|
if (allProjects.length === 0) {
|
|
14520
14610
|
R2.warn("No projects with sessions found.");
|
|
14521
|
-
|
|
14611
|
+
Gt("Nothing to upload.");
|
|
14522
14612
|
return;
|
|
14523
14613
|
}
|
|
14524
14614
|
const options = [];
|
|
@@ -14535,21 +14625,22 @@ async function runInteractiveUpload(flags) {
|
|
|
14535
14625
|
}
|
|
14536
14626
|
}
|
|
14537
14627
|
}
|
|
14538
|
-
const selected = await
|
|
14628
|
+
const selected = await Lt2({
|
|
14539
14629
|
message: "Select projects to upload",
|
|
14540
14630
|
options,
|
|
14541
14631
|
initialValues: preSelected,
|
|
14542
14632
|
required: true
|
|
14543
14633
|
});
|
|
14544
14634
|
if (Ct(selected)) {
|
|
14545
|
-
|
|
14635
|
+
Nt("Upload cancelled.");
|
|
14546
14636
|
return;
|
|
14547
14637
|
}
|
|
14548
14638
|
const totalSessions = selected.reduce((sum, proj) => sum + proj.sessionCount, 0);
|
|
14549
14639
|
R2.info(`Uploading ${totalSessions} session(s) from ${selected.length} project(s)`);
|
|
14550
14640
|
const uploadConfig = {
|
|
14551
14641
|
endpoint: flags.endpoint,
|
|
14552
|
-
token: credentials?.token ?? ""
|
|
14642
|
+
token: credentials?.token ?? "",
|
|
14643
|
+
authType: credentials?.authType
|
|
14553
14644
|
};
|
|
14554
14645
|
const work = [];
|
|
14555
14646
|
for (const project of selected) {
|
|
@@ -14595,9 +14686,9 @@ async function runInteractiveUpload(flags) {
|
|
|
14595
14686
|
});
|
|
14596
14687
|
renderBatchSummary(summary, { showRetryHint: summary.failed > 0 });
|
|
14597
14688
|
if (flags.dryRun) {
|
|
14598
|
-
|
|
14689
|
+
Gt("Dry run complete — no sessions were uploaded.");
|
|
14599
14690
|
} else {
|
|
14600
|
-
|
|
14691
|
+
Gt("Done!");
|
|
14601
14692
|
}
|
|
14602
14693
|
if (summary.failed > 0) {
|
|
14603
14694
|
process.exitCode = 1;
|
|
@@ -14682,7 +14773,8 @@ async function runSingleUpload(flags, session) {
|
|
|
14682
14773
|
write("Uploading...");
|
|
14683
14774
|
const result = await uploadSession(request, {
|
|
14684
14775
|
endpoint: flags.endpoint,
|
|
14685
|
-
token: credentials.token
|
|
14776
|
+
token: credentials.token,
|
|
14777
|
+
authType: credentials?.authType
|
|
14686
14778
|
});
|
|
14687
14779
|
if (result.success) {
|
|
14688
14780
|
write("Upload successful!");
|
|
@@ -14698,10 +14790,10 @@ async function runRetryUpload(flags) {
|
|
|
14698
14790
|
process.exitCode = 1;
|
|
14699
14791
|
return;
|
|
14700
14792
|
}
|
|
14701
|
-
|
|
14793
|
+
Wt2("rudel upload --retry");
|
|
14702
14794
|
const failures = await loadFailedUploads();
|
|
14703
14795
|
if (failures.length === 0) {
|
|
14704
|
-
|
|
14796
|
+
Gt("No failed uploads to retry.");
|
|
14705
14797
|
return;
|
|
14706
14798
|
}
|
|
14707
14799
|
R2.info(`Found ${failures.length} failed upload(s):`);
|
|
@@ -14711,12 +14803,12 @@ async function runRetryUpload(flags) {
|
|
|
14711
14803
|
if (failures.length > 10) {
|
|
14712
14804
|
R2.warn(` ...and ${failures.length - 10} more`);
|
|
14713
14805
|
}
|
|
14714
|
-
const shouldRetry = await
|
|
14806
|
+
const shouldRetry = await Rt({
|
|
14715
14807
|
message: `Retry all ${failures.length} failed upload(s)?`,
|
|
14716
14808
|
initialValue: true
|
|
14717
14809
|
});
|
|
14718
14810
|
if (Ct(shouldRetry) || !shouldRetry) {
|
|
14719
|
-
|
|
14811
|
+
Nt("Retry cancelled.");
|
|
14720
14812
|
return;
|
|
14721
14813
|
}
|
|
14722
14814
|
const endpoint = flags.endpoint;
|
|
@@ -14750,12 +14842,13 @@ async function runRetryUpload(flags) {
|
|
|
14750
14842
|
return uploadSession(request, {
|
|
14751
14843
|
endpoint,
|
|
14752
14844
|
token: credentials.token,
|
|
14845
|
+
authType: credentials.authType,
|
|
14753
14846
|
onRetry
|
|
14754
14847
|
});
|
|
14755
14848
|
}
|
|
14756
14849
|
});
|
|
14757
14850
|
renderBatchSummary(summary);
|
|
14758
|
-
|
|
14851
|
+
Gt("Done!");
|
|
14759
14852
|
if (summary.failed > 0) {
|
|
14760
14853
|
process.exitCode = 1;
|
|
14761
14854
|
}
|