@kaynooo/cli-forgejo 0.29.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +299 -170
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // @bun
3
3
 
4
4
  // src/cli.ts
5
- import process29 from "process";
5
+ import process30 from "process";
6
6
  // ../kit/src/args.ts
7
7
  import process10 from "process";
8
8
  import { parseArgs } from "util";
@@ -568,24 +568,20 @@ function formatPercent(ratio, digits = 0) {
568
568
 
569
569
  // ../kit/src/help.ts
570
570
  import process8 from "process";
571
- var OPTIONAL = /\[[^\]]+\]/g;
571
+ var OPTIONAL = /(?<!\x1B)\[[^\]]+\]/g;
572
572
  var USAGE_PREFIX = /^usage:\s*/i;
573
573
  var FULL_STOP = /\.$/;
574
574
  function usageLine(usage, colors = paint(process8.stdout)) {
575
575
  return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
576
576
  }
577
- function helpText(usage, options, colors = paint(process8.stdout), { examples = [], replaces, exits = [] } = {}) {
578
- return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
577
+ function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
578
+ return [usageLine(usage, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
579
579
  `);
580
580
  }
581
581
  function exitRows(exits, colors = paint(process8.stdout)) {
582
582
  if (exits.length === 0)
583
583
  return [];
584
- const width = Math.max(...exits.map(([code]) => String(code).length));
585
- return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
586
- }
587
- function replacesRows(replaces, colors = paint(process8.stdout)) {
588
- return replaces === undefined || outputMode() === "agent" ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
584
+ return ["", `${colors.bold("Exit codes:")} ${exits.map(([code, meaning]) => `${colors.cyan(String(code))} ${meaning}`).join(", ")}`];
589
585
  }
590
586
  function wantsHelpJson(env = process8.env) {
591
587
  return env.KIT_HELP === "json";
@@ -611,29 +607,44 @@ function exampleRows(examples, colors = paint(process8.stdout)) {
611
607
  return [];
612
608
  return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
613
609
  }
610
+ var MAX_INLINE_CHOICES = 24;
614
611
  function optionRows(options, colors = paint(process8.stdout)) {
615
612
  const rows = Object.entries(options).map(([name, option]) => {
616
613
  const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
617
- const named = option.choices === undefined ? "<value>" : `<${option.choices.join("|")}>`;
614
+ const choices = option.choices?.join("|");
615
+ const inline = choices !== undefined && choices.length <= MAX_INLINE_CHOICES;
616
+ const named = inline ? `<${choices}>` : "<value>";
618
617
  const placeholder = option.optional === undefined ? named : `[${named}]`;
619
618
  const value = option.type === "string" ? ` ${colors.dim(placeholder)}` : "";
620
- return { flag: `${short}${colors.cyan(`--${name}`)}${value}`, width: `-x, --${name}`.length + (option.type === "string" ? placeholder.length + 1 : 0), description: option.description ?? "" };
619
+ const described = choices === undefined || inline ? option.description ?? "" : [option.description, `one of ${option.choices.join(", ")}`].filter(Boolean).join("; ");
620
+ return { flag: `${short}${colors.cyan(`--${name}`)}${value}`, width: `-x, --${name}`.length + (option.type === "string" ? placeholder.length + 1 : 0), description: described };
621
621
  });
622
622
  const width = Math.max(0, ...rows.map((row) => row.width));
623
623
  return rows.map((row) => row.description === "" ? ` ${row.flag}` : ` ${row.flag}${" ".repeat(width - row.width)} ${colors.dim(row.description)}`);
624
624
  }
625
625
 
626
626
  // ../kit/src/text.ts
627
- var ANSI = new RegExp(`${String.fromCharCode(27)}\\[[\\d;?]*[a-z]`, "gi");
627
+ var ANSI = /\x1B(?:\[[\x30-\x3F]*[\x20-\x2F]*[\x40-\x7E]|\][^\x07\x1B]*(?:\x07|\x1B\\)|[\x40-\x5A\x5C-\x5F])/g;
628
+ function stripAnsi(text) {
629
+ return text.replace(ANSI, "");
630
+ }
628
631
  function distance(a, b) {
629
- let previous = Array.from({ length: b.length + 1 }, (_, index) => index);
630
- for (const [i, left] of [...a].entries()) {
632
+ const left = [...a];
633
+ const right = [...b];
634
+ let before = [];
635
+ let previous = Array.from({ length: right.length + 1 }, (_, index) => index);
636
+ for (const [i, x] of left.entries()) {
631
637
  const current = [i + 1];
632
- for (const [j, right] of [...b].entries())
633
- current.push(Math.min((previous[j + 1] ?? 0) + 1, (current[j] ?? 0) + 1, (previous[j] ?? 0) + (left === right ? 0 : 1)));
638
+ for (const [j, y] of right.entries()) {
639
+ let cost = Math.min((previous[j + 1] ?? 0) + 1, (current[j] ?? 0) + 1, (previous[j] ?? 0) + (x === y ? 0 : 1));
640
+ if (i > 0 && j > 0 && x === right[j - 1] && left[i - 1] === y)
641
+ cost = Math.min(cost, (before[j - 1] ?? 0) + 1);
642
+ current.push(cost);
643
+ }
644
+ before = previous;
634
645
  previous = current;
635
646
  }
636
- return previous[b.length] ?? 0;
647
+ return previous[right.length] ?? 0;
637
648
  }
638
649
  function closest(name, names) {
639
650
  const started = names.find((known) => known.startsWith(name));
@@ -1356,13 +1367,31 @@ function ciHeader(spinner, label, startedAt, out) {
1356
1367
  // ../kit/src/cli.ts
1357
1368
  import { readFileSync as readFileSync4, realpathSync as realpathSync2 } from "fs";
1358
1369
  import { dirname as dirname3, join as join5 } from "path";
1359
- import process17 from "process";
1370
+ import process18 from "process";
1371
+
1372
+ // ../kit/src/notify.ts
1373
+ import process16 from "process";
1374
+ var NOTIFY_AFTER_MS = 1e4;
1375
+ var CANCELLED = 130;
1376
+ function base64(text) {
1377
+ return Buffer.from(text).toString("base64");
1378
+ }
1379
+ function notification(title, body, env = process16.env) {
1380
+ const id = `kit${process16.pid}`;
1381
+ const codes = [`\x1B]99;i=${id}:d=0:o=unfocused:e=1;${base64(title)}\x1B\\`, `\x1B]99;i=${id}:p=body:e=1;${base64(body)}\x1B\\`];
1382
+ return codes.map((code) => env.TMUX === undefined || env.TMUX === "" ? code : `\x1BPtmux;${code.replaceAll("\x1B", "\x1B\x1B")}\x1B\\`).join("");
1383
+ }
1384
+ function notifyEnd(command, code, ms, { stream = process16.stderr, env = process16.env } = {}) {
1385
+ if (ms < NOTIFY_AFTER_MS || code === CANCELLED || outputMode(stream, env) !== "terminal")
1386
+ return;
1387
+ stream.write(notification(command, code === 0 ? `done in ${formatDuration(ms)}` : `failed with exit ${code} after ${formatDuration(ms)}`, env));
1388
+ }
1360
1389
 
1361
1390
  // ../kit/src/usage.ts
1362
1391
  import { appendFileSync, mkdirSync } from "fs";
1363
1392
  import { homedir as homedir3 } from "os";
1364
1393
  import { dirname as dirname2, isAbsolute, join as join4 } from "path";
1365
- import process16 from "process";
1394
+ import process17 from "process";
1366
1395
 
1367
1396
  // ../kit/src/logs.ts
1368
1397
  var DAY_MS = 24 * 60 * 60 * 1000;
@@ -1376,14 +1405,14 @@ var usageError;
1376
1405
  function noteUsageError(message) {
1377
1406
  usageError = message;
1378
1407
  }
1379
- function stateHome(env = process16.env) {
1408
+ function stateHome(env = process17.env) {
1380
1409
  const dir = env.XDG_STATE_HOME;
1381
1410
  return dir !== undefined && isAbsolute(dir) ? dir : join4(homedir3(), ".local", "state");
1382
1411
  }
1383
- function usagePath(env = process16.env) {
1412
+ function usagePath(env = process17.env) {
1384
1413
  return join4(stateHome(env), CLI_FOLDER, "usage.jsonl");
1385
1414
  }
1386
- function usageRecorded(env = process16.env) {
1415
+ function usageRecorded(env = process17.env) {
1387
1416
  const off = env.KAYNOOO_CLI_NO_USAGE;
1388
1417
  return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
1389
1418
  }
@@ -1397,7 +1426,7 @@ function usageEntry(bin, command, argv, code, now = new Date) {
1397
1426
  usageError = undefined;
1398
1427
  return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
1399
1428
  }
1400
- function recordUsage(entry, env = process16.env) {
1429
+ function recordUsage(entry, env = process17.env) {
1401
1430
  if (!usageRecorded(env))
1402
1431
  return;
1403
1432
  try {
@@ -1474,7 +1503,6 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
1474
1503
  header(colors, summary),
1475
1504
  "",
1476
1505
  usageLine(`${prefix} ${defaultCommand === undefined ? colors.cyan("<command>") : `[${colors.cyan("<command>")}]`} [options]`, colors),
1477
- ...replacesRows(replaces, colors),
1478
1506
  "",
1479
1507
  ...await commandRows(commands, colors),
1480
1508
  ...own.length === 0 ? [] : ["", `${colors.bold(`Options of ${defaultCommand}:`)} ${colors.dim("the command run when none is named")}`, ...optionRows(Object.fromEntries(own), colors)],
@@ -1488,8 +1516,8 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
1488
1516
  `);
1489
1517
  }
1490
1518
  function printError(prefix, message, hint, cause) {
1491
- const colors = paint(process17.stderr);
1492
- const styled = takesControlCodes(process17.stderr);
1519
+ const colors = paint(process18.stderr);
1520
+ const styled = takesControlCodes(process18.stderr);
1493
1521
  const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
1494
1522
  const under = (label, text, tint) => text === undefined ? "" : `
1495
1523
  ${styled ? tint(label) : `${label}:`} ${text}`;
@@ -1499,8 +1527,8 @@ function runHint(command, effect) {
1499
1527
  return `run \`${command}\`${effect === undefined ? "" : ` to ${effect}`}`;
1500
1528
  }
1501
1529
  function printHint(hint) {
1502
- const colors = paint(process17.stderr);
1503
- console.error(` ${takesControlCodes(process17.stderr) ? colors.yellow("hint") : "hint:"} ${hint}`);
1530
+ const colors = paint(process18.stderr);
1531
+ console.error(` ${takesControlCodes(process18.stderr) ? colors.yellow("hint") : "hint:"} ${hint}`);
1504
1532
  }
1505
1533
  function printJsonError(message, hint, cause) {
1506
1534
  console.error(JSON.stringify({ error: message, ...hint === undefined ? {} : { hint }, ...cause === undefined ? {} : { cause } }));
@@ -1539,11 +1567,11 @@ async function dispatch(level, typed, { version, redact }) {
1539
1567
  }
1540
1568
  }
1541
1569
  if (name === undefined && level.path.length > 1) {
1542
- console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process17.stderr));
1570
+ console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process18.stderr));
1543
1571
  return 2;
1544
1572
  }
1545
1573
  if (name === undefined || name === "help" || name === "--help" || name === "-h") {
1546
- console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process17.stdout));
1574
+ console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process18.stdout));
1547
1575
  return 0;
1548
1576
  }
1549
1577
  if (level.path.length === 1 && (name === "--version" || name === "-v")) {
@@ -1678,10 +1706,13 @@ async function runCli(cli, argv = scriptArgs()) {
1678
1706
  const version = cli.version ?? packageVersion();
1679
1707
  if (argv[0] === COMPLETE)
1680
1708
  return printCandidates(candidates(scopeOf(cli.commands, cli.extraCommands, cli.aliases), cli.defaultCommand, argv.slice(1)));
1709
+ const started = performance.now();
1681
1710
  const code = await dispatch({ path: [cli.name], header: (colors, about) => `${colors.bold(cli.name)} ${colors.dim(version)} ${about}`, summary: cli.about, ...scopeOf(cli.commands, cli.extraCommands, cli.aliases), defaultCommand: cli.defaultCommand, runBare: cli.runBare === true, examples: cli.examples, replaces: cli.replaces }, argv, { version, redact: cli.redact });
1711
+ const command = commandPath(scopeOf(cli.commands, cli.extraCommands, cli.aliases), argv);
1712
+ notifyEnd(command === undefined ? cli.name : `${cli.name} ${command}`, code, performance.now() - started);
1682
1713
  if (cli.usage !== false) {
1683
1714
  try {
1684
- recordUsage(usageEntry(cli.name, commandPath(scopeOf(cli.commands, cli.extraCommands, cli.aliases), argv), argv, code));
1715
+ recordUsage(usageEntry(cli.name, command, argv, code));
1685
1716
  } catch {}
1686
1717
  }
1687
1718
  return code;
@@ -1701,11 +1732,130 @@ function commandPath(scope, argv) {
1701
1732
  }
1702
1733
  return path.length === 0 ? undefined : path.join(" ");
1703
1734
  }
1735
+ // ../kit/src/excerpt.ts
1736
+ var BUN_CHECK_BLOCK = /<error file=[\s\S]*?<\/error>/g;
1737
+ var BUN_CHECK_SOURCE = /<source>[\s\S]*?<\/source>\n?/g;
1738
+ var BUN_CHECK_ATTRIBUTE = /(\w+)="([^"]*)"/g;
1739
+ var BUN_CHECK_SUMMARY = /^Found \d+ errors?/;
1740
+ var TSC_ERROR = /\berror TS\d+/;
1741
+ var TSC_CONTINUATION = /^\s{2,}\S/;
1742
+ var TSC_FRAME = /^\s*[~^|]/;
1743
+ var TSC_SUMMARY = /^Found \d+ errors?/;
1744
+ var ESLINT_PROBLEM = /^\s+\d+:\d+\s+(?:error|warning)\s/;
1745
+ var ESLINT_SUMMARY = /^(?:\u2716 )?\d+ problems? \(/;
1746
+ var PHPSTAN_TABLE = /^\s*-{3,} -{3,}/;
1747
+ var PHPSTAN_NOISE = /^\s*\[OK\]/;
1748
+ var VITEST_FAIL_LINE = /^ FAIL {2}\S/;
1749
+ var PLAYWRIGHT_FAIL_LINE = /^ {2}1\) .+:\d+:\d+ \u203A .+ \u2500+$/;
1750
+ var CS_FIXER_LINE = /^\s+\d+\) \S.*\.php(?: \(.+\))?$/;
1751
+ var CS_FIXER_TOTAL = /^Found \d+ of \d+ files/;
1752
+ var MAX_LINES = 100;
1753
+ var bunCheck = (lines) => {
1754
+ const text = lines.join(`
1755
+ `);
1756
+ const blocks = text.match(BUN_CHECK_BLOCK);
1757
+ if (blocks === null)
1758
+ return;
1759
+ const errors = blocks.map((block) => {
1760
+ const { file, line, column, code, message } = bunCheckFields(block);
1761
+ return `${file}:${line}:${column} ${code}: ${message}`;
1762
+ });
1763
+ return [...errors, ...lines.filter((line) => BUN_CHECK_SUMMARY.test(line))];
1764
+ };
1765
+ function bunCheckFields(block) {
1766
+ const attributes = Object.fromEntries([...block.slice(0, block.indexOf(`
1767
+ `)).matchAll(BUN_CHECK_ATTRIBUTE)].map((match) => [match[1] ?? "", match[2] ?? ""]));
1768
+ return {
1769
+ file: attributes.file ?? "",
1770
+ line: attributes.line ?? "",
1771
+ column: attributes.column ?? "",
1772
+ code: attributes.code ?? "",
1773
+ message: block.replace(BUN_CHECK_SOURCE, "").split(`
1774
+ `).slice(1, -1).join(`
1775
+ `).trim()
1776
+ };
1777
+ }
1778
+ var tsc = (lines) => {
1779
+ const kept = [];
1780
+ let inError = false;
1781
+ for (const line of lines) {
1782
+ if (TSC_ERROR.test(line)) {
1783
+ inError = true;
1784
+ kept.push(line);
1785
+ } else if (TSC_SUMMARY.test(line)) {
1786
+ inError = false;
1787
+ kept.push(line);
1788
+ } else if (inError && TSC_CONTINUATION.test(line) && !TSC_FRAME.test(line)) {
1789
+ kept.push(line);
1790
+ } else {
1791
+ inError = false;
1792
+ }
1793
+ }
1794
+ return kept.some((line) => TSC_ERROR.test(line)) ? kept : undefined;
1795
+ };
1796
+ var eslint = (lines) => {
1797
+ const kept = [];
1798
+ let file = "";
1799
+ let shown = "";
1800
+ for (const line of lines) {
1801
+ if (ESLINT_PROBLEM.test(line)) {
1802
+ if (file !== shown) {
1803
+ kept.push(file);
1804
+ shown = file;
1805
+ }
1806
+ kept.push(line);
1807
+ } else if (ESLINT_SUMMARY.test(line)) {
1808
+ kept.push(line);
1809
+ } else if (line.trim() !== "") {
1810
+ file = line;
1811
+ }
1812
+ }
1813
+ return kept.some((line) => ESLINT_PROBLEM.test(line)) ? kept : undefined;
1814
+ };
1815
+ var phpstan = (lines) => {
1816
+ const start = lines.findIndex((line) => PHPSTAN_TABLE.test(line));
1817
+ return start === -1 ? undefined : lines.slice(start).filter((line) => !PHPSTAN_NOISE.test(line));
1818
+ };
1819
+ var vitest = (lines) => {
1820
+ const start = lines.findIndex((line) => VITEST_FAIL_LINE.test(line));
1821
+ return start === -1 ? undefined : lines.slice(start);
1822
+ };
1823
+ var playwright = (lines) => {
1824
+ const start = lines.findIndex((line) => PLAYWRIGHT_FAIL_LINE.test(line));
1825
+ return start === -1 ? undefined : lines.slice(start);
1826
+ };
1827
+ var phpCsFixer = (lines) => {
1828
+ const files = lines.filter((line) => CS_FIXER_LINE.test(line) || CS_FIXER_TOTAL.test(line));
1829
+ return files.some((line) => CS_FIXER_LINE.test(line)) ? files : undefined;
1830
+ };
1831
+ var TOOL_PARSERS = [bunCheck, tsc, eslint, vitest, playwright, phpCsFixer, phpstan];
1832
+ function squeeze(lines) {
1833
+ const out = [];
1834
+ for (const line of lines.map((text) => text.trimEnd())) {
1835
+ if (line !== "" || out.at(-1) !== "")
1836
+ out.push(line);
1837
+ }
1838
+ while (out.at(-1) === "")
1839
+ out.pop();
1840
+ return out;
1841
+ }
1842
+ function cut(shown) {
1843
+ return shown.length > MAX_LINES ? [...shown.slice(0, MAX_LINES), `... ${shown.length - MAX_LINES} more lines`].join(`
1844
+ `) : shown.join(`
1845
+ `);
1846
+ }
1847
+ function recognised(lines, parsers) {
1848
+ return parsers.map((parser) => parser(lines)).find((result) => result !== undefined && result.some((line) => line.trim() !== ""));
1849
+ }
1850
+ function toolExcerpt(lines) {
1851
+ const found = recognised(lines.map((line) => stripAnsi(line)), TOOL_PARSERS);
1852
+ return found === undefined ? undefined : cut(squeeze(found));
1853
+ }
1704
1854
  // ../kit/src/folders.ts
1705
1855
  var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
1706
1856
  // ../kit/src/git.ts
1707
1857
  import { basename, dirname as dirname4 } from "path";
1708
- import process18 from "process";
1858
+ import process19 from "process";
1709
1859
  var ORIGIN_PREFIX = /^origin\//;
1710
1860
  var GIT_NETWORK_MS = 60000;
1711
1861
  async function git(args, timeoutMs) {
@@ -1735,7 +1885,7 @@ async function defaultBranch() {
1735
1885
  async function leaveWorktree() {
1736
1886
  const common = await git(["rev-parse", "--path-format=absolute", "--git-common-dir"]);
1737
1887
  if (basename(common) === ".git")
1738
- process18.chdir(dirname4(common));
1888
+ process19.chdir(dirname4(common));
1739
1889
  }
1740
1890
  // ../kit/src/limit.ts
1741
1891
  function limitOptions(fallback) {
@@ -1776,15 +1926,15 @@ var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "ses
1776
1926
  // ../kit/src/sessions.ts
1777
1927
  import { homedir as homedir4 } from "os";
1778
1928
  import { join as join6 } from "path";
1779
- import process19 from "process";
1929
+ import process20 from "process";
1780
1930
  var {Glob } = globalThis.Bun;
1781
1931
  var SESSION_FILES = new Glob("*.json");
1782
1932
  var ACCOUNT_DIRS = new Glob("*/sessions");
1783
1933
  async function sessionDirs() {
1784
1934
  const home = homedir4();
1785
1935
  const dirs = new Set([join6(home, ".claude", "sessions")]);
1786
- if (process19.env.CLAUDE_CONFIG_DIR !== undefined)
1787
- dirs.add(join6(process19.env.CLAUDE_CONFIG_DIR, "sessions"));
1936
+ if (process20.env.CLAUDE_CONFIG_DIR !== undefined)
1937
+ dirs.add(join6(process20.env.CLAUDE_CONFIG_DIR, "sessions"));
1788
1938
  try {
1789
1939
  for await (const dir of ACCOUNT_DIRS.scan({ cwd: join6(home, ".claude-accounts"), onlyFiles: false, absolute: true }))
1790
1940
  dirs.add(dir);
@@ -1830,7 +1980,7 @@ async function liveSessions() {
1830
1980
  }
1831
1981
  async function currentSession(sessions) {
1832
1982
  const byPid = new Map(sessions.map((session) => [session.pid, session]));
1833
- let pid = process19.ppid;
1983
+ let pid = process20.ppid;
1834
1984
  for (let depth = 0;depth < 32 && pid > 1; depth++) {
1835
1985
  const session = byPid.get(pid);
1836
1986
  if (session !== undefined)
@@ -1843,7 +1993,7 @@ async function currentSession(sessions) {
1843
1993
  return;
1844
1994
  }
1845
1995
  // ../kit/src/watch.ts
1846
- import process20 from "process";
1996
+ import process21 from "process";
1847
1997
  import { format } from "util";
1848
1998
  var CLEAR_SCREEN = "\x1B[H\x1B[2J";
1849
1999
  var DEFAULT_SECONDS = 2;
@@ -1865,7 +2015,7 @@ function withoutWatch(args) {
1865
2015
  }
1866
2016
  return rest;
1867
2017
  }
1868
- async function watching(value, step, stream = process20.stdout, sleep = Bun.sleep, rounds = Number.POSITIVE_INFINITY) {
2018
+ async function watching(value, step, stream = process21.stdout, sleep = Bun.sleep, rounds = Number.POSITIVE_INFINITY) {
1869
2019
  const interval = value === "" ? DEFAULT_SECONDS * 1000 : duration(value, "watch", DEFAULT_SECONDS * 1000);
1870
2020
  if (!takesControlCodes(stream))
1871
2021
  badUsage("--watch redraws the screen, so it needs a terminal");
@@ -1873,12 +2023,12 @@ async function watching(value, step, stream = process20.stdout, sleep = Bun.slee
1873
2023
  for (let round = 0;round < rounds; round++) {
1874
2024
  const held = [];
1875
2025
  const { log, info } = console;
1876
- const write = process20.stdout.write.bind(process20.stdout);
2026
+ const write = process21.stdout.write.bind(process21.stdout);
1877
2027
  const hold = (...parts) => void held.push(`${format(...parts)}
1878
2028
  `);
1879
2029
  console.log = hold;
1880
2030
  console.info = hold;
1881
- process20.stdout.write = (text) => {
2031
+ process21.stdout.write = (text) => {
1882
2032
  held.push(typeof text === "string" ? text : Buffer.from(text).toString());
1883
2033
  return true;
1884
2034
  };
@@ -1887,7 +2037,7 @@ async function watching(value, step, stream = process20.stdout, sleep = Bun.slee
1887
2037
  } finally {
1888
2038
  console.log = log;
1889
2039
  console.info = info;
1890
- process20.stdout.write = write;
2040
+ process21.stdout.write = write;
1891
2041
  }
1892
2042
  stream.write(`${CLEAR_SCREEN}${held.join("")}`);
1893
2043
  await sleep(interval);
@@ -2065,9 +2215,9 @@ function holderSession(holder, sessions) {
2065
2215
  }
2066
2216
 
2067
2217
  // src/good.ts
2068
- import process22 from "process";
2218
+ import process23 from "process";
2069
2219
  function good(text) {
2070
- return role("ok", process22.stdout)(text);
2220
+ return role("ok", process23.stdout)(text);
2071
2221
  }
2072
2222
 
2073
2223
  // src/config.ts
@@ -2102,7 +2252,7 @@ async function loadSettings(home) {
2102
2252
  // src/forge.ts
2103
2253
  import { homedir as homedir5 } from "os";
2104
2254
  import { join as join7 } from "path";
2105
- import process23 from "process";
2255
+ import process24 from "process";
2106
2256
 
2107
2257
  // src/remote.ts
2108
2258
  var SCP_LIKE = /^(?:([^@/]+)@)?([^:/]+):(?!\/)(.+?)(?:\.git)?\/?$/;
@@ -2157,7 +2307,7 @@ function loginHosts(config) {
2157
2307
  return hosts;
2158
2308
  }
2159
2309
  function teaConfigPath() {
2160
- const base = process23.env.XDG_CONFIG_HOME;
2310
+ const base = process24.env.XDG_CONFIG_HOME;
2161
2311
  return join7(base !== undefined && base !== "" ? base : join7(homedir5(), ".config"), "tea", "config.yml");
2162
2312
  }
2163
2313
  async function readConfig() {
@@ -2509,9 +2659,8 @@ var boardUsage = `ft board
2509
2659
 
2510
2660
  Lists open issues, at most 30 of each kind (--full for all), as available, taken by a session running here, or claimed by a session no session here answers to, from their latest "Taken by session <name>." comment.
2511
2661
  A claim shows its boxes left, and one no live session holds also the latest comment that is not a claim.
2512
- A lane's claim (lane-<n>-<issue>) is held while the session whose name ends in -<n> runs.
2513
-
2514
- Exits 0 when it listed them, 1 when the issues cannot be read, 2 on a usage error.`;
2662
+ A lane's claim (lane-<n>-<issue>) is held while the session whose name ends in -<n> runs.`;
2663
+ var boardExits = [[0, "it listed them"], [1, "the issues cannot be read"], [2, "a usage error"]];
2515
2664
  var BOARD_LIMIT = 30;
2516
2665
  var boardOptions = {
2517
2666
  labels: { type: "string", short: "L", description: "only issues with these labels, comma separated" },
@@ -2524,7 +2673,7 @@ var boardOptions = {
2524
2673
  ...repoOption
2525
2674
  };
2526
2675
  async function board(args) {
2527
- const parsed = parse(args, boardUsage, boardOptions);
2676
+ const parsed = parse(args, boardUsage, boardOptions, { exits: boardExits });
2528
2677
  const { values } = parsed;
2529
2678
  if (values.watch !== undefined)
2530
2679
  return watching(values.watch, async () => board(withoutWatch(args)));
@@ -2561,9 +2710,8 @@ async function me(as, sessions) {
2561
2710
  var takeUsage = `ft take <n>...
2562
2711
 
2563
2712
  Claims each issue for this Claude Code session with a "Taken by session <name>." comment.
2564
- An issue another live session holds is refused, one this session or its lanes hold passes to the new name, and one claimed by a session no session here answers to needs --take-stale; a refusal leaves the other issues taken.
2565
-
2566
- Exits 0 when every issue is taken, 1 when one is refused, 2 on a usage error.`;
2713
+ An issue another live session holds is refused, one this session or its lanes hold passes to the new name, and one claimed by a session no session here answers to needs --take-stale; a refusal leaves the other issues taken.`;
2714
+ var takeExits = [[0, "every issue is taken"], [1, "one is refused"], [2, "a usage error"]];
2567
2715
  var laneOption = {
2568
2716
  lane: { type: "boolean", description: "claim each as lane-<s>-<n>, <s> ending this session's name, so the claim stays live while it runs" }
2569
2717
  };
@@ -2599,7 +2747,7 @@ async function eachIssue(command, numbers, step) {
2599
2747
  return code;
2600
2748
  }
2601
2749
  async function take(args) {
2602
- const parsed = parse(args, takeUsage, takeOptions);
2750
+ const parsed = parse(args, takeUsage, takeOptions, { exits: takeExits });
2603
2751
  const { values, positionals } = parsed;
2604
2752
  const numbers = issueNumbers(positionals, takeUsage);
2605
2753
  const sessions = await liveSessions();
@@ -2630,9 +2778,8 @@ async function take(args) {
2630
2778
  var dropUsage = `ft drop <n>... [--stale] | --all-stale [--dry-run]
2631
2779
 
2632
2780
  Gives each issue back with a "Released by session <name>." comment, when this session holds it.
2633
- With --stale, a claim no session here answers to is released too, in the name of its holder, followed by a comment saying this session released it as stale; a claim a live session holds is still refused. --all-stale does that for every such claim on the board, and with --dry-run only lists them.
2634
-
2635
- Exits 0 when every issue is given back, 1 when one is not held by this session or, with --stale, by a live one, 2 on a usage error.`;
2781
+ With --stale, a claim no session here answers to is released too, in the name of its holder, followed by a comment saying this session released it as stale; a claim a live session holds is still refused. --all-stale does that for every such claim on the board, and with --dry-run only lists them.`;
2782
+ var dropExits = [[0, "every issue is given back"], [1, "one is not held by this session or, with --stale, by a live one"], [2, "a usage error"]];
2636
2783
  var dropOptions = {
2637
2784
  as: { type: "string", description: "the name it was taken as, instead of this session's" },
2638
2785
  stale: { type: "boolean", description: "also release a claim no live session here answers to" },
@@ -2653,7 +2800,7 @@ async function releaseStale(number, me, author, sessions, repo) {
2653
2800
  console.log(good(`released #${number}, held by ${claim.holder}`));
2654
2801
  }
2655
2802
  async function drop(args) {
2656
- const parsed = parse(args, dropUsage, dropOptions);
2803
+ const parsed = parse(args, dropUsage, dropOptions, { exits: dropExits });
2657
2804
  const { values, positionals } = parsed;
2658
2805
  const sessions = await liveSessions();
2659
2806
  const nameFor = await claimant(values, sessions);
@@ -2693,7 +2840,7 @@ async function drop(args) {
2693
2840
  }
2694
2841
 
2695
2842
  // src/commands/ci.ts
2696
- import process24 from "process";
2843
+ import process25 from "process";
2697
2844
 
2698
2845
  // src/git.ts
2699
2846
  async function tagsAt(commit) {
@@ -2719,6 +2866,7 @@ var STAMP = /^\S+Z /;
2719
2866
  var FAILED_STEP = /\u274C\s+Failure - Main /;
2720
2867
  var STEP_TAIL = 30;
2721
2868
  var TAIL = 40;
2869
+ var TOOL_WINDOW = 200;
2722
2870
  function logLines(log) {
2723
2871
  return log.split(`
2724
2872
  `).map((line) => line.replace(STAMP, ""));
@@ -2744,7 +2892,7 @@ function excerpt(log) {
2744
2892
  const parts = failedTests(lines);
2745
2893
  for (const [index, line] of lines.entries()) {
2746
2894
  if (FAILED_STEP.test(line))
2747
- parts.push(lines.slice(Math.max(0, index - STEP_TAIL), index + 1).filter((text) => text.trim() !== "" && !text.startsWith(PASS) && !text.startsWith("::")).join(`
2895
+ parts.push(toolExcerpt(lines.slice(Math.max(0, index - TOOL_WINDOW), index)) ?? lines.slice(Math.max(0, index - STEP_TAIL), index + 1).filter((text) => text.trim() !== "" && !text.startsWith(PASS) && !text.startsWith("::")).join(`
2748
2896
  `));
2749
2897
  }
2750
2898
  return parts.length === 0 ? lines.slice(-TAIL).join(`
@@ -2892,8 +3040,8 @@ var usage2 = `ft ci [ref]
2892
3040
 
2893
3041
  Waits for the push runs covering a commit on the branch, by default origin's tip, and prints what each failed job's log says.
2894
3042
  A push's run tests every commit since the previous push, so a commit whose own run was cancelled, or whose --job was skipped, is covered by the next commit's runs.
2895
- --json prints {status, runs, failedJobs, url} on stdout, the progress going to stderr; --quiet prints only the announcement, the failures and the result.
2896
- Exits 0 when they pass, 1 when one fails, 2 on a timeout, a stalled queue or a commit not on the branch.`;
3043
+ --json prints {status, runs, failedJobs, url} on stdout, the progress going to stderr; --quiet prints only the announcement, the failures and the result.`;
3044
+ var EXITS = [[0, "they pass"], [1, "one fails"], [2, "a timeout, a stalled queue or a commit not on the branch"]];
2897
3045
  var options = {
2898
3046
  branch: { type: "string", short: "b", description: "branch the commit is on, by default the one origin/HEAD names" },
2899
3047
  workflow: { type: "string", short: "w", description: "only this workflow file, e.g. test.yml; by default every workflow a push starts" },
@@ -2923,7 +3071,7 @@ function settled(latest) {
2923
3071
  return latest !== undefined && latest.every((run) => FINISHED.has(run.status)) && judge(latest, false, false).kind === "runs" ? latest : undefined;
2924
3072
  }
2925
3073
  async function ci2(args) {
2926
- const parsed = parse(args, usage2, options);
3074
+ const parsed = parse(args, usage2, options, { exits: EXITS });
2927
3075
  const { values, positionals } = parsed;
2928
3076
  const branch = values.branch ?? await defaultBranch();
2929
3077
  const giveUp = duration(values.timeout, "timeout", 30 * 60000, "m");
@@ -2959,7 +3107,7 @@ async function ci2(args) {
2959
3107
  return;
2960
3108
  }
2961
3109
  const json = values.json === true;
2962
- const live = takesControlCodes(process24.stderr) && takesControlCodes(process24.stdout) && !json && values.quiet !== true;
3110
+ const live = takesControlCodes(process25.stderr) && takesControlCodes(process25.stdout) && !json && values.quiet !== true;
2963
3111
  const runs = await waitForCi({
2964
3112
  tool: "ft ci",
2965
3113
  short,
@@ -2985,8 +3133,8 @@ async function ci2(args) {
2985
3133
  return stall === undefined ? undefined : { message: `runs queued on ${short} are not moving: ${stall.reason}`, certain: stall.certain };
2986
3134
  },
2987
3135
  lines: (spinner, found, started) => [
2988
- ciHeader(spinner, `CI on ${short}`, started, process24.stderr),
2989
- ...(found ?? []).map((run) => ` ${runLine(run, process24.stderr, undefined, run.commit_sha.slice(0, 7))}`)
3136
+ ciHeader(spinner, `CI on ${short}`, started, process25.stderr),
3137
+ ...(found ?? []).map((run) => ` ${runLine(run, process25.stderr, undefined, run.commit_sha.slice(0, 7))}`)
2990
3138
  ]
2991
3139
  });
2992
3140
  const status = overall(runs);
@@ -3003,7 +3151,7 @@ async function ci2(args) {
3003
3151
  }
3004
3152
  if (live) {
3005
3153
  for (const run of runs)
3006
- console.log(runLine(run, process24.stdout, undefined, run.commit_sha.slice(0, 7)));
3154
+ console.log(runLine(run, process25.stdout, undefined, run.commit_sha.slice(0, 7)));
3007
3155
  }
3008
3156
  if (status !== "failure") {
3009
3157
  if (live)
@@ -3022,7 +3170,7 @@ run ${run.id} failed${run.commit_sha === sha ? "" : `, testing every commit from
3022
3170
  }
3023
3171
 
3024
3172
  // src/commands/digest.ts
3025
- import process25 from "process";
3173
+ import process26 from "process";
3026
3174
  var RUNS_SCANNED = 50;
3027
3175
  var TITLE_WIDTH2 = 70;
3028
3176
  var SHOWN = 8;
@@ -3072,7 +3220,7 @@ async function quietly(read) {
3072
3220
  }
3073
3221
  }
3074
3222
  async function staleTodos() {
3075
- const bin = Bun.which("todo-scan", { PATH: process25.env.PATH ?? "" });
3223
+ const bin = Bun.which("todo-scan", { PATH: process26.env.PATH ?? "" });
3076
3224
  if (bin === null)
3077
3225
  return [];
3078
3226
  let found;
@@ -3094,8 +3242,8 @@ async function staleTodos() {
3094
3242
  return [...byIssue.values()];
3095
3243
  }
3096
3244
  function claimLine(row, now) {
3097
- const id = role("id", process25.stdout);
3098
- return [id(`#${row.number}`), row.holder, paint(process25.stdout).dim(formatAge(row.since, now)), row.boxesTotal === 0 ? "" : `${row.boxesLeft}/${row.boxesTotal} left`, truncate(row.title, TITLE_WIDTH2)];
3245
+ const id = role("id", process26.stdout);
3246
+ return [id(`#${row.number}`), row.holder, paint(process26.stdout).dim(formatAge(row.since, now)), row.boxesTotal === 0 ? "" : `${row.boxesLeft}/${row.boxesTotal} left`, truncate(row.title, TITLE_WIDTH2)];
3099
3247
  }
3100
3248
  function capped2(lines) {
3101
3249
  return lines.length > SHOWN ? [...lines.slice(0, SHOWN), `... ${lines.length - SHOWN} more`] : lines;
@@ -3106,13 +3254,13 @@ function renderDigest(digest, now = Date.now()) {
3106
3254
  `) },
3107
3255
  { heading: "claimed, no live session here", tone: "warn", count: digest.away.length, lines: table(digest.away.map((row) => claimLine(row, now))).split(`
3108
3256
  `) },
3109
- { heading: "CI on the default branch", tone: "failed", count: digest.ci.length, lines: digest.ci.map((run) => `${run.workflow} ${badge(run.status, process25.stdout)} (run ${run.id}) ${truncate(upTo(run.title, `
3257
+ { heading: "CI on the default branch", tone: "failed", count: digest.ci.length, lines: digest.ci.map((run) => `${run.workflow} ${badge(run.status, process26.stdout)} (run ${run.id}) ${truncate(upTo(run.title, `
3110
3258
  `), TITLE_WIDTH2)}`) },
3111
3259
  { heading: "unpushed commits", tone: "queued", count: digest.unpushed.length, lines: capped2(digest.unpushed) },
3112
- { heading: "dirty files", tone: "warn", count: digest.dirty.length, lines: capped2(digest.dirty.map((file) => `${file.status} ${role("path", process25.stdout)(file.path)}`)) },
3260
+ { heading: "dirty files", tone: "warn", count: digest.dirty.length, lines: capped2(digest.dirty.map((file) => `${file.status} ${role("path", process26.stdout)(file.path)}`)) },
3113
3261
  { heading: "stale TODO comments", tone: "skipped", count: digest.stale.length, lines: capped2(digest.stale.map((todo) => `${todo.issue} closed: ${todo.comments.map((each) => `${each.path}:${each.line}`).join(", ")}`)) }
3114
3262
  ].filter((each) => each.count > 0);
3115
- return sections.length === 0 ? "nothing to pick up" : sections.map(({ heading, tone, count, lines }) => `${section(heading, count, process25.stdout, process25.env, tone)}
3263
+ return sections.length === 0 ? "nothing to pick up" : sections.map(({ heading, tone, count, lines }) => `${section(heading, count, process26.stdout, process26.env, tone)}
3116
3264
  ${lines.join(`
3117
3265
  `).replace(LINE_START2, " ")}`).join(`
3118
3266
 
@@ -3121,16 +3269,15 @@ ${lines.join(`
3121
3269
  var usage3 = `ft digest
3122
3270
 
3123
3271
  Summarises the repository for a session starting cold: the issues this session holds with their boxes left, the claims no live session here answers to, red or running CI on the default branch, unpushed commits, dirty files and TODO comments naming a closed issue.
3124
- A section with nothing in it is left out, and the stale TODO comments need todo-scan on the PATH.
3125
-
3126
- Exits 0 when it summarised the repository, 1 when Forgejo cannot be read, 2 on a usage error.`;
3272
+ A section with nothing in it is left out, and the stale TODO comments need todo-scan on the PATH.`;
3273
+ var EXITS2 = [[0, "it summarised the repository"], [1, "Forgejo cannot be read"], [2, "a usage error"]];
3127
3274
  var options2 = {
3128
3275
  json: jsonOption("held and away (number, title, holder, since, boxesLeft, boxesTotal), ci (id, status, workflow, started, title), unpushed, dirty (status, path) and stale (issue, comments: path, line)"),
3129
3276
  watch: watchOption("the digest"),
3130
3277
  ...repoOption
3131
3278
  };
3132
3279
  async function digest(args) {
3133
- const parsed = parse(args, usage3, options2);
3280
+ const parsed = parse(args, usage3, options2, { exits: EXITS2 });
3134
3281
  const { values } = parsed;
3135
3282
  if (values.watch !== undefined)
3136
3283
  return watching(values.watch, async () => digest(withoutWatch(args)));
@@ -3199,9 +3346,8 @@ var tickUsage = `ft tick [<n>] <box>...
3199
3346
  Ticks checklist boxes of issue <n>, each given by its number from \`ft issue\` or by text matching exactly one box, then posts the -m or -F comment.
3200
3347
  With --closed, ticks instead every box opening with \`#<issue>\` whose issue is closed, as a release plan lists them.
3201
3348
 
3202
- Without <n> (a first argument that is not a number) it takes the one open issue this session holds (\`ft take\`), and exits 2 when it holds none or several, saying which issue it used. A first argument that is a number is always the issue, so boxes named by number need it.
3203
-
3204
- Exits 0 when it ticked the boxes, 1 when Forgejo refuses, 2 on a usage error or a box matching none or several.`;
3349
+ Without <n> (a first argument that is not a number) it takes the one open issue this session holds (\`ft take\`), and exits 2 when it holds none or several, saying which issue it used. A first argument that is a number is always the issue, so boxes named by number need it.`;
3350
+ var tickExits = [[0, "it ticked the boxes"], [1, "Forgejo refuses"], [2, "a usage error or a box matching none or several"]];
3205
3351
  var tickOptions = {
3206
3352
  undo: { type: "boolean", short: "u", description: "untick them instead" },
3207
3353
  closed: { type: "boolean", description: "tick the boxes listing a closed issue, no box to name" },
@@ -3216,7 +3362,7 @@ function tickedOrFail(number, run) {
3216
3362
  }
3217
3363
  }
3218
3364
  async function tick(args) {
3219
- const parsed = parse(args, tickUsage, tickOptions);
3365
+ const parsed = parse(args, tickUsage, tickOptions, { exits: tickExits });
3220
3366
  const { values, positionals } = parsed;
3221
3367
  const { number, rest: picks } = await targetIssue(positionals, values.repo, tickUsage);
3222
3368
  if (values.closed === true && (picks.length > 0 || values.undo === true))
@@ -3253,9 +3399,8 @@ var fixedUsage = `ft fixed [<n>] [commit]...
3253
3399
 
3254
3400
  Comments "Fixed in <sha>: <message>" on issue <n> and closes it, naming each commit given as "Fixed in <a>, <b> and <c>".
3255
3401
  Without a commit it takes those on origin's default branch whose message names #<n>, and says which, or HEAD when none does.
3256
- Without <n> it takes the one open issue this session holds (\`ft take\`). The message defaults to the subject of the first commit. Every open issue listing \`- [ ] #<n>\` in its checklist gets that line ticked. An issue with boxes left is refused, as a partly done issue stays open, unless --tick ticks them first.
3257
-
3258
- Exits 0 when it closed the issue, 1 when the issue is already closed, has boxes left or Forgejo refuses, 2 on a usage error.`;
3402
+ Without <n> it takes the one open issue this session holds (\`ft take\`). The message defaults to the subject of the first commit. Every open issue listing \`- [ ] #<n>\` in its checklist gets that line ticked. An issue with boxes left is refused, as a partly done issue stays open, unless --tick ticks them first.`;
3403
+ var fixedExits = [[0, "it closed the issue"], [1, "the issue is already closed, has boxes left or Forgejo refuses"], [2, "a usage error"]];
3259
3404
  var fixedOptions = {
3260
3405
  message: { type: "string", short: "m", description: 'the line after "Fixed in <sha>:"' },
3261
3406
  tick: { type: "boolean", description: "tick the boxes left before closing" },
@@ -3296,7 +3441,7 @@ async function tickListings(closed, repo) {
3296
3441
  }
3297
3442
  }
3298
3443
  async function fixed(args) {
3299
- const parsed = parse(args, fixedUsage, fixedOptions);
3444
+ const parsed = parse(args, fixedUsage, fixedOptions, { exits: fixedExits });
3300
3445
  const { values, positionals } = parsed;
3301
3446
  const { number, rest } = await targetIssue(positionals, values.repo, fixedUsage);
3302
3447
  const commits = await fixingCommits(number, rest);
@@ -3334,8 +3479,8 @@ var stateOptions = {
3334
3479
  message: { type: "string", short: "m", description: "a comment posted first, saying why" },
3335
3480
  ...repoOption
3336
3481
  };
3337
- async function setState(args, usage, wanted) {
3338
- const parsed = parse(args, usage, stateOptions);
3482
+ async function setState(args, usage, exits, wanted) {
3483
+ const parsed = parse(args, usage, stateOptions, { exits });
3339
3484
  const { values, positionals } = parsed;
3340
3485
  for (const number of issueNumbers(positionals, usage)) {
3341
3486
  if ((await getIssue(number, values.repo)).state === wanted) {
@@ -3354,19 +3499,17 @@ async function setState(args, usage, wanted) {
3354
3499
  }
3355
3500
  var closeUsage = `ft close <n>... [-m <reason>]
3356
3501
 
3357
- Closes issues without a fix, a duplicate or one dropped, posting the -m reason first. \`ft fixed\` closes one a commit fixed.
3358
-
3359
- Exits 0 when every issue is closed, 1 when Forgejo refuses, 2 on a usage error.`;
3502
+ Closes issues without a fix, a duplicate or one dropped, posting the -m reason first. \`ft fixed\` closes one a commit fixed.`;
3503
+ var closeExits = [[0, "every issue is closed"], [1, "Forgejo refuses"], [2, "a usage error"]];
3360
3504
  async function closeIssues(args) {
3361
- return setState(args, closeUsage, "closed");
3505
+ return setState(args, closeUsage, closeExits, "closed");
3362
3506
  }
3363
3507
  var reopenUsage = `ft reopen <n>... [-m <reason>]
3364
3508
 
3365
- Reopens closed issues, posting the -m reason first.
3366
-
3367
- Exits 0 when every issue is open, 1 when Forgejo refuses, 2 on a usage error.`;
3509
+ Reopens closed issues, posting the -m reason first.`;
3510
+ var reopenExits = [[0, "every issue is open"], [1, "Forgejo refuses"], [2, "a usage error"]];
3368
3511
  async function reopenIssues(args) {
3369
- return setState(args, reopenUsage, "open");
3512
+ return setState(args, reopenUsage, reopenExits, "open");
3370
3513
  }
3371
3514
  var LABEL_FLAGS = new Set(["-h", "--help"]);
3372
3515
  var REPO_FLAGS = new Set(["-r", "--repo"]);
@@ -3389,12 +3532,11 @@ function labelChanges(args) {
3389
3532
  }
3390
3533
  var labelUsage = `ft label <n> [+]<label>... -<label>...
3391
3534
 
3392
- Adds the labels named bare or with +, removes those named with -, then prints the issue's labels. A label the repository lacks is refused.
3393
-
3394
- Exits 0 when it changed the labels, 1 when Forgejo refuses, 2 on a usage error or a label the repository lacks.`;
3535
+ Adds the labels named bare or with +, removes those named with -, then prints the issue's labels. A label the repository lacks is refused.`;
3536
+ var labelExits = [[0, "it changed the labels"], [1, "Forgejo refuses"], [2, "a usage error or a label the repository lacks"]];
3395
3537
  async function label(args) {
3396
3538
  const changes = labelChanges(args);
3397
- const parsed = parse(changes.rest, labelUsage, repoOption);
3539
+ const parsed = parse(changes.rest, labelUsage, repoOption, { exits: labelExits });
3398
3540
  const { values, positionals } = parsed;
3399
3541
  const number = issueNumber(positionals[0], labelUsage);
3400
3542
  const add = [...positionals.slice(1), ...changes.add];
@@ -3416,9 +3558,8 @@ ${labelUsage}`);
3416
3558
  // src/commands/issue-write.ts
3417
3559
  var newUsage = `ft new -t <title> [-F <file>] [-L a,b] [-m <milestone>]
3418
3560
 
3419
- Creates an issue and prints its number and url. The description is read from -F <file>, or from stdin with -F -, and is empty without it. A label or milestone the repository lacks is refused before anything is created.
3420
-
3421
- Exits 0 when it created the issue, 1 when Forgejo refuses, 2 on a usage error or a label or milestone the repository lacks.`;
3561
+ Creates an issue and prints its number and url. The description is read from -F <file>, or from stdin with -F -, and is empty without it. A label or milestone the repository lacks is refused before anything is created.`;
3562
+ var newExits = [[0, "it created the issue"], [1, "Forgejo refuses"], [2, "a usage error or a label or milestone the repository lacks"]];
3422
3563
  var newOptions = {
3423
3564
  title: { type: "string", short: "t", description: "the issue title" },
3424
3565
  file: { type: "string", short: "F", description: "the description: a file, - for stdin" },
@@ -3432,7 +3573,7 @@ async function milestoneTitle(reference, repo) {
3432
3573
  return reference.trim() === "" ? "" : (await findMilestone(reference.trim(), repo)).title;
3433
3574
  }
3434
3575
  async function newIssue(args) {
3435
- const parsed = parse(args, newUsage, newOptions);
3576
+ const parsed = parse(args, newUsage, newOptions, { exits: newExits });
3436
3577
  const { values } = parsed;
3437
3578
  if (values.title === undefined || values.title.trim() === "")
3438
3579
  fail(`give the issue a title with -t
@@ -3450,9 +3591,8 @@ var editUsage = `ft edit <n> [-t <title>] [-F <file> [--append]] [--add-box <tex
3450
3591
  Replaces the title and/or the description of issue <n>, the description from -F <file> or from stdin with -F -.
3451
3592
  -m moves it to a milestone given by title or id, and \`-m ''\` takes it out of its milestone.
3452
3593
  --append adds the -F text after the description instead, and each --add-box an unticked box after the last one, the rest of the description untouched.
3453
- \`ft issue <n> --body\` prints the description to edit.
3454
-
3455
- Exits 0 when it edited the issue, 1 when Forgejo refuses, 2 on a usage error.`;
3594
+ \`ft issue <n> --body\` prints the description to edit.`;
3595
+ var editExits = [[0, "it edited the issue"], [1, "Forgejo refuses"], [2, "a usage error"]];
3456
3596
  var editOptions = {
3457
3597
  title: { type: "string", short: "t", description: "the new title" },
3458
3598
  file: { type: "string", short: "F", description: "the new description: a file, - for stdin" },
@@ -3462,7 +3602,7 @@ var editOptions = {
3462
3602
  ...repoOption
3463
3603
  };
3464
3604
  async function edit(args) {
3465
- const parsed = parse(args, editUsage, editOptions);
3605
+ const parsed = parse(args, editUsage, editOptions, { exits: editExits });
3466
3606
  const { values, positionals } = parsed;
3467
3607
  const number = issueNumber(positionals[0], editUsage);
3468
3608
  const text = await noteText({ file: values.file });
@@ -3500,15 +3640,14 @@ ${text}` : body;
3500
3640
  var commentUsage = `ft comment [<n>] [text]
3501
3641
 
3502
3642
  Posts a comment on issue <n>: the text given, -F <file>, or stdin when neither is, so a heredoc needs no escaping.
3503
- Without <n> (a first argument that is not a number) it takes the one open issue this session holds (\`ft take\`), and exits 2 when it holds none or several, saying which issue it used. A first argument that is a number is always the issue, so boxes named by number need it.
3504
-
3505
- Exits 0 when it posted the comment, 1 when Forgejo refuses, 2 on a usage error.`;
3643
+ Without <n> (a first argument that is not a number) it takes the one open issue this session holds (\`ft take\`), and exits 2 when it holds none or several, saying which issue it used. A first argument that is a number is always the issue, so boxes named by number need it.`;
3644
+ var commentExits = [[0, "it posted the comment"], [1, "Forgejo refuses"], [2, "a usage error"]];
3506
3645
  var commentOptions = {
3507
3646
  file: noteOptions.file,
3508
3647
  ...repoOption
3509
3648
  };
3510
3649
  async function commentOn(args) {
3511
- const parsed = parse(args, commentUsage, commentOptions);
3650
+ const parsed = parse(args, commentUsage, commentOptions, { exits: commentExits });
3512
3651
  const { values, positionals } = parsed;
3513
3652
  const { number, rest } = await targetIssue(positionals, values.repo, commentUsage);
3514
3653
  const given = rest.join(" ") || undefined;
@@ -3527,9 +3666,8 @@ var issueUsage = `ft issue [<n>...]
3527
3666
 
3528
3667
  Prints each issue: its title, state, boxes left and claim, then its description with each checklist box numbered as \`ft tick\` takes it. --open also opens each in the browser.
3529
3668
  With --body, prints only the raw description, to edit and give back to \`ft edit -F\`.
3530
- With no number, prints the open issues this session holds (\`ft take\`), and exits 2 when it holds none.
3531
-
3532
- Exits 0 when it printed them, 1 when an issue cannot be read, 2 on a usage error.`;
3669
+ With no number, prints the open issues this session holds (\`ft take\`), and exits 2 when it holds none.`;
3670
+ var issueExits = [[0, "it printed them"], [1, "an issue cannot be read"], [2, "a usage error"]];
3533
3671
  var issueOptions = {
3534
3672
  todo: { type: "boolean", short: "t", description: "only the header and the boxes left to tick" },
3535
3673
  comments: { type: "boolean", short: "c", description: "add the comments, each with its author and age" },
@@ -3582,7 +3720,7 @@ function issueJson(found, comments, author) {
3582
3720
  };
3583
3721
  }
3584
3722
  async function issue(args) {
3585
- const parsed = parse(args, issueUsage, issueOptions);
3723
+ const parsed = parse(args, issueUsage, issueOptions, { exits: issueExits });
3586
3724
  const { values, positionals } = parsed;
3587
3725
  const held = positionals.length === 0 ? await heldIssues(values.repo) : [];
3588
3726
  const numbers = held.length === 0 ? issueNumbers(positionals, issueUsage) : held;
@@ -3627,10 +3765,9 @@ async function issue(args) {
3627
3765
  // src/commands/logs.ts
3628
3766
  var usage4 = `ft logs <run id>
3629
3767
 
3630
- Prints what the failed jobs of a run say went wrong: each failed bun test's output and the end of each failed step.
3631
- With no failed job it prints every job's last lines; --full prints whole logs.
3632
-
3633
- Exits 0 when it printed the logs, 1 when Forgejo cannot be read, 2 on a usage error or a job the run lacks.`;
3768
+ Prints what the failed jobs of a run say went wrong: each failed bun test's output and the end of each failed step, cut to the errors when it is a tsc, eslint, vitest, playwright, phpstan or php-cs-fixer step.
3769
+ With no failed job it prints every job's last lines; --full prints whole logs.`;
3770
+ var EXITS3 = [[0, "it printed the logs"], [1, "Forgejo cannot be read"], [2, "a usage error or a job the run lacks"]];
3634
3771
  var options3 = {
3635
3772
  job: { type: "string", short: "j", description: "only this job, by name or id" },
3636
3773
  full: { type: "boolean", short: "f", description: "the whole log, timestamps stripped" },
@@ -3644,7 +3781,7 @@ function pickJobs(jobs, wanted) {
3644
3781
  return failed.length > 0 ? failed : jobs;
3645
3782
  }
3646
3783
  async function logs2(args) {
3647
- const parsed = parse(args, usage4, options3);
3784
+ const parsed = parse(args, usage4, options3, { exits: EXITS3 });
3648
3785
  const { values, positionals } = parsed;
3649
3786
  if (positionals[0] === undefined)
3650
3787
  fail("a run id is needed", 2, runHint("ft runs", "list them"));
@@ -3675,7 +3812,7 @@ ${await text(job)}`);
3675
3812
  }
3676
3813
 
3677
3814
  // src/commands/milestone.ts
3678
- import process26 from "process";
3815
+ import process27 from "process";
3679
3816
  var TITLE_WIDTH3 = 60;
3680
3817
  var LIST_LIMIT = 30;
3681
3818
  var CONCURRENCY2 = 4;
@@ -3684,15 +3821,15 @@ function counts(milestone) {
3684
3821
  }
3685
3822
  function progressBar(milestone) {
3686
3823
  const total = milestone.open_issues + milestone.closed_issues;
3687
- return takesControlCodes(process26.stdout) ? bar(total === 0 ? 0 : milestone.closed_issues / total, { width: 16 }) : "";
3824
+ return takesControlCodes(process27.stdout) ? bar(total === 0 ? 0 : milestone.closed_issues / total, { width: 16 }) : "";
3688
3825
  }
3689
3826
  function milestoneCells(each, showState) {
3690
3827
  const drawn = progressBar(each);
3691
3828
  return [String(each.id), truncate(each.title, TITLE_WIDTH3), `${each.open_issues} open`, `${each.closed_issues} closed`, ...drawn === "" ? [] : [drawn], progress(each), dueDate(each) === "" ? "" : `due ${dueDate(each)}`, ...showState ? [each.state] : []];
3692
3829
  }
3693
3830
  async function printWithIssues(list, repo) {
3694
- const colors = paint(process26.stdout);
3695
- const id = role("id", process26.stdout);
3831
+ const colors = paint(process27.stdout);
3832
+ const id = role("id", process27.stdout);
3696
3833
  const issuesOf = await pool(list, concurrencyOf(CONCURRENCY2), async (each) => Promise.all([openIssues(undefined, repo, each.id), closedIssues(each.id, repo)]));
3697
3834
  const blocks = list.map((each, index) => {
3698
3835
  const byNumber = (left, right) => left.number - right.number;
@@ -3703,7 +3840,7 @@ async function printWithIssues(list, repo) {
3703
3840
  ...open.map((issue) => ` ${id(`#${issue.number}`)} ${truncate(issue.title, TITLE_WIDTH3)}`),
3704
3841
  ...closed.map((issue) => colors.dim(` #${issue.number} ${truncate(issue.title, TITLE_WIDTH3)} (closed)`))
3705
3842
  ];
3706
- return [section(`${each.title}${drawn === "" ? "" : ` ${drawn}`} ${facts}`, undefined, process26.stdout, process26.env, "accent"), ...lines].join(`
3843
+ return [section(`${each.title}${drawn === "" ? "" : ` ${drawn}`} ${facts}`, undefined, process27.stdout, process27.env, "accent"), ...lines].join(`
3707
3844
  `);
3708
3845
  });
3709
3846
  console.log(blocks.join(`
@@ -3712,9 +3849,8 @@ async function printWithIssues(list, repo) {
3712
3849
  }
3713
3850
  var listUsage = `ft milestones
3714
3851
 
3715
- Lists the repository's milestones, the open ones unless --state says otherwise, with the issues open and closed in each, the progress and the due date; on a terminal the progress is a bar, and --issues lists the title of every issue under its milestone.
3716
-
3717
- Exits 0 when it listed them, 1 when Forgejo refuses, 2 on a usage error.`;
3852
+ Lists the repository's milestones, the open ones unless --state says otherwise, with the issues open and closed in each, the progress and the due date; on a terminal the progress is a bar, and --issues lists the title of every issue under its milestone.`;
3853
+ var listExits = [[0, "it listed them"], [1, "Forgejo refuses"], [2, "a usage error"]];
3718
3854
  var listOptions = {
3719
3855
  state: { type: "string", description: "open (the default), closed or all" },
3720
3856
  issues: { type: "boolean", short: "i", description: "list the open and closed issues of each milestone by title" },
@@ -3723,7 +3859,7 @@ var listOptions = {
3723
3859
  ...repoOption
3724
3860
  };
3725
3861
  async function milestones(args) {
3726
- const parsed = parse(args, listUsage, listOptions);
3862
+ const parsed = parse(args, listUsage, listOptions, { exits: listExits });
3727
3863
  const { values } = parsed;
3728
3864
  const state = values.state ?? "open";
3729
3865
  if (state !== "open" && state !== "closed" && state !== "all")
@@ -3751,16 +3887,15 @@ async function milestones(args) {
3751
3887
  }
3752
3888
  var newUsage2 = `ft milestone new <title> [-d <text>] [--due <YYYY-MM-DD>]
3753
3889
 
3754
- Creates a milestone through the API and prints its id. Without --due it has no due date.
3755
-
3756
- Exits 0 when it created the milestone, 1 when Forgejo refuses, 2 on a usage error.`;
3890
+ Creates a milestone through the API and prints its id. Without --due it has no due date.`;
3891
+ var newExits2 = [[0, "it created the milestone"], [1, "Forgejo refuses"], [2, "a usage error"]];
3757
3892
  var newOptions2 = {
3758
3893
  description: { type: "string", short: "d", description: "the milestone description" },
3759
3894
  due: { type: "string", description: "the due date, YYYY-MM-DD" },
3760
3895
  ...repoOption
3761
3896
  };
3762
3897
  async function create(args) {
3763
- const parsed = parse(args, newUsage2, newOptions2);
3898
+ const parsed = parse(args, newUsage2, newOptions2, { exits: newExits2 });
3764
3899
  const { values, positionals } = parsed;
3765
3900
  const title = positionals.join(" ").trim();
3766
3901
  if (title === "")
@@ -3774,15 +3909,14 @@ ${newUsage2}`);
3774
3909
  }
3775
3910
  var closeUsage2 = `ft milestone close <title|id> [--force]
3776
3911
 
3777
- Closes a milestone, refused while issues are open in it, which it names. --force closes it with them left.
3778
-
3779
- Exits 0 when it closed the milestone, 1 when issues are open in it or Forgejo refuses, 2 on a usage error.`;
3912
+ Closes a milestone, refused while issues are open in it, which it names. --force closes it with them left.`;
3913
+ var closeExits2 = [[0, "it closed the milestone"], [1, "issues are open in it or Forgejo refuses"], [2, "a usage error"]];
3780
3914
  var closeOptions = {
3781
3915
  force: { type: "boolean", description: "close it with issues left open" },
3782
3916
  ...repoOption
3783
3917
  };
3784
3918
  async function closeOne(args) {
3785
- const parsed = parse(args, closeUsage2, closeOptions);
3919
+ const parsed = parse(args, closeUsage2, closeOptions, { exits: closeExits2 });
3786
3920
  const { values, positionals } = parsed;
3787
3921
  const reference = positionals.join(" ").trim();
3788
3922
  if (reference === "")
@@ -3808,16 +3942,15 @@ ft milestone new <title> [-d <text>] [--due <YYYY-MM-DD>]
3808
3942
  ft milestone close <title|id> [--force]
3809
3943
 
3810
3944
  Shows a milestone with its open issues as \`ft board\` does: available, taken by a session running here, or claimed by one gone, each with its boxes left, at most 30 of each kind (--full for all).
3811
- \`ft milestone new\` and \`ft milestone close\` have their own --help; a milestone titled new or close is named by its id.
3812
-
3813
- Exits 0 when it showed the milestone, 1 when it cannot be read, 2 on a usage error or an unknown milestone.`;
3945
+ \`ft milestone new\` and \`ft milestone close\` have their own --help; a milestone titled new or close is named by its id.`;
3946
+ var showExits = [[0, "it showed the milestone"], [1, "it cannot be read"], [2, "a usage error or an unknown milestone"]];
3814
3947
  var showOptions = {
3815
3948
  ...limitOptions(LIST_LIMIT),
3816
3949
  json: jsonOption("the milestone (id, title, state, description, open, closed, due) and its open issues as `ft board --json` lists them"),
3817
3950
  ...repoOption
3818
3951
  };
3819
3952
  async function show(args) {
3820
- const parsed = parse(args, showUsage, showOptions);
3953
+ const parsed = parse(args, showUsage, showOptions, { exits: showExits });
3821
3954
  const { values, positionals } = parsed;
3822
3955
  const reference = positionals.join(" ").trim();
3823
3956
  if (reference === "")
@@ -3904,16 +4037,14 @@ var addUsage = `ft plan add <plan> <n>... [--section "Bugs:"]
3904
4037
 
3905
4038
  Lists each issue <n> as \`- [ ] #<n> <title>\` in the checklist of issue <plan>, skipping those already listed.
3906
4039
  Lines go under --section, created at the end of the body when missing, or else after the checklist's last box.
3907
- The body is read again just before it is written, so an edit made meanwhile is kept.
3908
-
3909
- Exits 0 when it listed the issues, 1 when Forgejo refuses, 2 on a usage error.`;
4040
+ The body is read again just before it is written, so an edit made meanwhile is kept.`;
4041
+ var addExits = [[0, "it listed the issues"], [1, "Forgejo refuses"], [2, "a usage error"]];
3910
4042
  var carryUsage = `ft plan carry <from> <to> [--section "Carried from 1.71.0:"]
3911
4043
 
3912
4044
  Copies the unticked \`#<n>\` lines of issue <from> into issue <to>, skipping those <to> already lists.
3913
4045
  Lines go under --section, created at the end of the body when missing, or else after the checklist's last box.
3914
- The body is read again just before it is written, so an edit made meanwhile is kept.
3915
-
3916
- Exits 0 when it copied the lines, 1 when Forgejo refuses, 2 on a usage error.`;
4046
+ The body is read again just before it is written, so an edit made meanwhile is kept.`;
4047
+ var carryExits = [[0, "it copied the lines"], [1, "Forgejo refuses"], [2, "a usage error"]];
3917
4048
  var options4 = {
3918
4049
  section: { type: "string", short: "s", description: 'the heading the lines go under, e.g. "Bugs:"' },
3919
4050
  ...repoOption
@@ -3926,7 +4057,7 @@ var plan = {
3926
4057
  }
3927
4058
  };
3928
4059
  async function add(args) {
3929
- const parsed = parse(args, addUsage, options4);
4060
+ const parsed = parse(args, addUsage, options4, { exits: addExits });
3930
4061
  const { section, repo } = parsed.values;
3931
4062
  const [target, ...listed] = parsed.positionals;
3932
4063
  const planNumber = issueNumber(target, addUsage);
@@ -3947,7 +4078,7 @@ ${addUsage}`);
3947
4078
  return 0;
3948
4079
  }
3949
4080
  async function carry(args) {
3950
- const parsed = parse(args, carryUsage, options4);
4081
+ const parsed = parse(args, carryUsage, options4, { exits: carryExits });
3951
4082
  const { section, repo } = parsed.values;
3952
4083
  const from = issueNumber(parsed.positionals[0], carryUsage);
3953
4084
  const to = issueNumber(parsed.positionals[1], carryUsage);
@@ -3969,15 +4100,15 @@ function report2(plan, added, skipped) {
3969
4100
 
3970
4101
  // src/commands/release.ts
3971
4102
  import { basename as basename3, join as join11 } from "path";
3972
- import process28 from "process";
4103
+ import process29 from "process";
3973
4104
  var {$: $2 } = globalThis.Bun;
3974
4105
 
3975
4106
  // src/commands/watch.ts
3976
4107
  var usage5 = `ft watch [--after <id>]
3977
4108
 
3978
4109
  Waits for runs to finish: those newer than run <id>, or else the ones in progress now.
3979
- Prints nothing but failures and each run's final status with --quiet, and a JSON result with --json.
3980
- Exits 0 when every one passed or was skipped, 1 when one failed or was cancelled, 2 on a timeout or a stalled queue.`;
4110
+ Prints nothing but failures and each run's final status with --quiet, and a JSON result with --json.`;
4111
+ var EXITS4 = [[0, "every one passed or was skipped"], [1, "one failed or was cancelled"], [2, "a timeout or a stalled queue"]];
3981
4112
  var options5 = {
3982
4113
  after: { type: "string", short: "a", description: "watch the runs newer than this run id, as `ft runs --json` gives it" },
3983
4114
  timeout: { type: "string", short: "t", description: "how long before giving up (15m), a bare number in minutes" },
@@ -4081,7 +4212,7 @@ ${run.html_url}`);
4081
4212
  }
4082
4213
  }
4083
4214
  async function watch2(args) {
4084
- const parsed = parse(args, usage5, options5);
4215
+ const parsed = parse(args, usage5, options5, { exits: EXITS4 });
4085
4216
  const { values } = parsed;
4086
4217
  const timeout = duration(values.timeout, "timeout", 15 * 60000, "m");
4087
4218
  const json = values.json === true;
@@ -4207,12 +4338,12 @@ async function publishable() {
4207
4338
 
4208
4339
  // src/commands/release-plan.ts
4209
4340
  import { basename as basename2, join as join9, relative } from "path";
4210
- import process27 from "process";
4341
+ import process28 from "process";
4211
4342
  async function planOf({ level, dir, prefix }, registry) {
4212
4343
  const file = Bun.file(join9(dir ?? ".", "package.json"));
4213
4344
  const pkg = await file.exists() ? await file.json() : undefined;
4214
- const name = pkg?.name ?? basename2(dir ?? process27.cwd());
4215
- const where = dir === undefined ? "" : ` in ${relative(process27.cwd(), dir) || "."}`;
4345
+ const name = pkg?.name ?? basename2(dir ?? process28.cwd());
4346
+ const where = dir === undefined ? "" : ` in ${relative(process28.cwd(), dir) || "."}`;
4216
4347
  let version;
4217
4348
  let bump;
4218
4349
  if (level === undefined) {
@@ -4342,8 +4473,8 @@ Cuts a release from the default branch: first the commit it sits on is pushed an
4342
4473
  A refused or interrupted push drops the bump commits and their tags, so a retry starts clean; with --tagged the commit and tag are yours and stay.
4343
4474
  Once released, an open milestone titled like the version (\`1.2.0\`, \`v1.2.0\` or the tag) has its closed issues listed and is closed; a failure there only warns.
4344
4475
  --dry-run checks the same and prints the plan: the version bump, the tag, the pushes and the runs and registry it would wait for, changing nothing.
4345
- --json prints {released, tag, package, version, status, runs, failedJobs, url} on stdout and the progress on stderr, an array of them with --package a,b or --all; it does not take --dry-run.
4346
- Exits 0 once released or planned, 1 when a run fails, origin refuses a push or the registry never serves the version, 2 on a timeout, a stalled queue, a refusal before anything ran (another branch, uncommitted changes, origin ahead) or a usage error.`;
4476
+ --json prints {released, tag, package, version, status, runs, failedJobs, url} on stdout and the progress on stderr, an array of them with --package a,b or --all; it does not take --dry-run.`;
4477
+ var EXITS5 = [[0, "released or planned"], [1, "a run fails, origin refuses a push or the registry never serves the version"], [2, "a timeout, a stalled queue, a refusal before anything ran (another branch, uncommitted changes, origin ahead) or a usage error"]];
4347
4478
  var options6 = {
4348
4479
  tagged: { type: "boolean", description: "push the version commit and tag already at HEAD instead of bumping" },
4349
4480
  package: { type: "string", short: "p", description: "workspace folder to release, a path or a name under packages/, several separated by commas" },
@@ -4354,7 +4485,7 @@ var options6 = {
4354
4485
  json: jsonOption("what was released and how its runs ended")
4355
4486
  };
4356
4487
  async function release(args) {
4357
- const parsed = parse(args, usage6, options6);
4488
+ const parsed = parse(args, usage6, options6, { exits: EXITS5 });
4358
4489
  const { values, positionals } = parsed;
4359
4490
  const json = values.json === true;
4360
4491
  const say = json ? console.error : console.log;
@@ -4457,7 +4588,7 @@ ${push.stderr.trim()}`, signal === undefined ? 1 : exitCodeOf(null, signal));
4457
4588
  if (late !== undefined)
4458
4589
  fail(`interrupted by ${late} after ${bumped.map((each) => each.tag).join(", ")} ${bumped.length === 1 ? "was pushed: its runs are" : "were pushed: their runs are"} not waited for`, exitCodeOf(null, late));
4459
4590
  say(`pushed ${branch} and ${bumped.map((each) => each.tag).join(", ")}, waiting for their runs`);
4460
- followed = await followRuns((runs) => runs.filter((run) => run.id > before && heads.has(run.commit_sha)), timeout, undefined, NO_RUN2, json ? process28.stderr : process28.stdout, { json });
4591
+ followed = await followRuns((runs) => runs.filter((run) => run.id > before && heads.has(run.commit_sha)), timeout, undefined, NO_RUN2, json ? process29.stderr : process29.stdout, { json });
4461
4592
  if (followed.code !== 0) {
4462
4593
  report();
4463
4594
  return followed.code;
@@ -4492,9 +4623,8 @@ var usage7 = `ft remote [--fix]
4492
4623
 
4493
4624
  Checks that origin's URLs name the Forgejo host itself: tea only finds the repository when origin's host is the login's ssh_host, never through an ssh alias such as \`forgejo\` or \`gitea\`.
4494
4625
  --fix switches every alias URL to \`git@<host>:<owner>/<repo>.git\` and proves it with \`git ls-remote\`.
4495
- The host comes from --host, else \`remoteHost\` in ~/.config/kaynooo-cli/ft.json; with neither, it checks nothing.
4496
-
4497
- Exits 0 when origin names the Forgejo host (or was switched) or no host is set, 1 when it does not or a switch is still to run, 2 on a usage error.`;
4626
+ The host comes from --host, else \`remoteHost\` in ~/.config/kaynooo-cli/ft.json; with neither, it checks nothing.`;
4627
+ var EXITS6 = [[0, "origin names the Forgejo host (or was switched) or no host is set"], [1, "it does not or a switch is still to run"], [2, "a usage error"]];
4498
4628
  var options7 = {
4499
4629
  host: { type: "string", description: "the Forgejo ssh host, instead of remoteHost in ~/.config/kaynooo-cli/ft.json" },
4500
4630
  fix: { type: "boolean", description: "rewrite the alias URLs" }
@@ -4528,7 +4658,7 @@ function originHost2(url) {
4528
4658
  return parseSshRemote(url)?.host ?? (URL.canParse(url) ? new URL(url).hostname : undefined);
4529
4659
  }
4530
4660
  async function remote(args, home) {
4531
- const { values } = parse(args, usage7, options7);
4661
+ const { values } = parse(args, usage7, options7, { exits: EXITS6 });
4532
4662
  const host = values.host ?? (await loadSettings(home)).remoteHost;
4533
4663
  if (host === undefined) {
4534
4664
  note(`no Forgejo host to check origin against: pass --host, or set "remoteHost" in ${settingsPath(home)}`);
@@ -4588,9 +4718,8 @@ var usage8 = `ft runs [--sha <ref>]
4588
4718
 
4589
4719
  Lists recent runs with what tea's own listing leaves empty: workflow, ref, duration and age, ten by default with the count of the rest (--full for all of them; --json is never cut unless --limit is given).
4590
4720
 
4591
- --open also opens the newest run listed in the browser.
4592
-
4593
- Exits 0 when it listed them, 1 when Forgejo or git cannot be read, 2 on a usage error.`;
4721
+ --open also opens the newest run listed in the browser.`;
4722
+ var EXITS7 = [[0, "it listed them"], [1, "Forgejo or git cannot be read"], [2, "a usage error"]];
4594
4723
  var DEFAULT_LIMIT = 10;
4595
4724
  var options8 = {
4596
4725
  ...limitOptions(DEFAULT_LIMIT),
@@ -4606,7 +4735,7 @@ async function onCommit(sha, repo) {
4606
4735
  return { runs: found, total: found.length };
4607
4736
  }
4608
4737
  async function runs(args) {
4609
- const parsed = parse(args, usage8, options8);
4738
+ const parsed = parse(args, usage8, options8, { exits: EXITS7 });
4610
4739
  const { values } = parsed;
4611
4740
  const limit = limitOf(values, DEFAULT_LIMIT);
4612
4741
  const { runs: found, total } = values.sha === undefined ? await runsListing(limit, values.repo, values.workflow) : await onCommit(values.sha, values.repo);
@@ -4634,7 +4763,7 @@ async function runs(args) {
4634
4763
  }
4635
4764
 
4636
4765
  // src/cli.ts
4637
- process29.exitCode = await runCli({
4766
+ process30.exitCode = await runCli({
4638
4767
  name: "ft",
4639
4768
  about: "Forgejo tools over tea, run from a repository whose origin is on Forgejo",
4640
4769
  replaces: "tea api calls piped through jq, and sleep loops waiting on CI",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-forgejo",
3
3
  "type": "module",
4
- "version": "0.29.0",
4
+ "version": "0.30.0",
5
5
  "description": "ft: Forgejo CI runs, logs, releases and issue checklists from the terminal, through tea.",
6
6
  "author": "Kaynooo <contact@kaynooo.fr>",
7
7
  "license": "MIT",
@@ -31,6 +31,6 @@
31
31
  "@kaynooo/utils": "3.0.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@kaynooo/cli-kit": "0.38.2"
34
+ "@kaynooo/cli-kit": "0.39.0"
35
35
  }
36
36
  }