@kaynooo/cli-forgejo 0.28.2 → 0.29.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 +114 -86
  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 process28 from "process";
5
+ import process29 from "process";
6
6
  // ../kit/src/args.ts
7
7
  import process10 from "process";
8
8
  import { parseArgs } from "util";
@@ -897,11 +897,35 @@ function nearestOption(message, options, allowNegative) {
897
897
  const meant = closest(word, known.map((flag) => flag.replace(DASHES, "")));
898
898
  return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
899
899
  }
900
- // ../kit/src/chart.ts
900
+ // ../kit/src/argv.ts
901
+ import { readFileSync as readFileSync3, realpathSync } from "fs";
902
+ import { resolve as resolve3 } from "path";
901
903
  import process11 from "process";
904
+ function commandLine() {
905
+ try {
906
+ return readFileSync3("/proc/self/cmdline", "utf8").split("\x00").slice(0, -1);
907
+ } catch {
908
+ return;
909
+ }
910
+ }
911
+ function realPath(word) {
912
+ try {
913
+ return realpathSync(resolve3(word));
914
+ } catch {
915
+ return;
916
+ }
917
+ }
918
+ function scriptArgs(argv = process11.argv.slice(2), cmdline = commandLine(), script = process11.argv[1]) {
919
+ const target = script === undefined ? undefined : realPath(script) ?? script;
920
+ const at = cmdline === undefined || target === undefined ? -1 : cmdline.findIndex((word, index) => index > 0 && (resolve3(word) === script || realPath(word) === target));
921
+ const after = at === -1 ? [] : cmdline.slice(at + 1);
922
+ return after[0] === "--" && after.length === argv.length + 1 && argv.every((word, index) => word === after[index + 1]) ? after : argv;
923
+ }
924
+ // ../kit/src/chart.ts
925
+ import process12 from "process";
902
926
  var FILLED = "\u2501";
903
927
  var EMPTY = "\u2500";
904
- function bar(ratio, { width = 20, stream = process11.stdout, env = process11.env } = {}) {
928
+ function bar(ratio, { width = 20, stream = process12.stdout, env = process12.env } = {}) {
905
929
  if (outputMode(stream, env) === "agent")
906
930
  return formatPercent(Math.min(1, Math.max(0, ratio)));
907
931
  const colors = paint(stream, env);
@@ -912,12 +936,12 @@ function bar(ratio, { width = 20, stream = process11.stdout, env = process11.env
912
936
  return `${shaded(theme, colors, theme.glyphs.bar, filled, width, env)}${colors.dim(theme.glyphs.bar.repeat(width - filled))}`;
913
937
  }
914
938
  // ../kit/src/progress.ts
915
- import process13 from "process";
939
+ import process14 from "process";
916
940
 
917
941
  // ../kit/src/process.ts
918
942
  import { constants } from "os";
919
- import { resolve as resolve3 } from "path";
920
- import process12 from "process";
943
+ import { resolve as resolve4 } from "path";
944
+ import process13 from "process";
921
945
  var KILL_GRACE_MS = 2000;
922
946
  var SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
923
947
  var SCHEME = /^[a-z][\w+.-]+:/i;
@@ -941,7 +965,7 @@ function holdSignals(cleanup) {
941
965
  },
942
966
  release: () => {
943
967
  for (const signal of SIGNALS)
944
- process12.off(signal, onSignal);
968
+ process13.off(signal, onSignal);
945
969
  }
946
970
  };
947
971
  function onSignal(signal) {
@@ -954,16 +978,16 @@ function holdSignals(cleanup) {
954
978
  return;
955
979
  held.release();
956
980
  cleanup(signal);
957
- process12.kill(process12.pid, signal);
981
+ process13.kill(process13.pid, signal);
958
982
  }
959
983
  for (const signal of SIGNALS)
960
- process12.on(signal, onSignal);
984
+ process13.on(signal, onSignal);
961
985
  return held;
962
986
  }
963
- function openUrl(target, env = process12.env, platform = process12.platform) {
987
+ function openUrl(target, env = process13.env, platform = process13.platform) {
964
988
  const opener = env.BROWSER === undefined || env.BROWSER === "" ? OPENERS[platform] ?? ["xdg-open"] : [env.BROWSER];
965
989
  try {
966
- Bun.spawn([...opener, SCHEME.test(target) ? target : resolve3(target)], { env, stdio: ["ignore", "ignore", "ignore"] }).unref();
990
+ Bun.spawn([...opener, SCHEME.test(target) ? target : resolve4(target)], { env, stdio: ["ignore", "ignore", "ignore"] }).unref();
967
991
  return true;
968
992
  } catch {
969
993
  return false;
@@ -997,7 +1021,7 @@ async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal,
997
1021
  return;
998
1022
  try {
999
1023
  if (grouped)
1000
- process12.kill(-proc.pid, killing);
1024
+ process13.kill(-proc.pid, killing);
1001
1025
  else
1002
1026
  proc.kill(killing);
1003
1027
  } catch {}
@@ -1075,7 +1099,7 @@ var RESET_STYLE = `${ESC}[0m`;
1075
1099
  var CTRL_C = 3;
1076
1100
  var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
1077
1101
  var CONSOLE_METHODS = ["log", "info", "warn", "error", "debug", "dir", "dirxml", "table", "trace", "group", "groupCollapsed", "count", "timeEnd", "timeLog", "assert"];
1078
- function liveRegion(render, stream = process13.stderr, env = process13.env) {
1102
+ function liveRegion(render, stream = process14.stderr, env = process14.env) {
1079
1103
  if (!takesControlCodes(stream, env))
1080
1104
  return { redraw: () => {
1081
1105
  return;
@@ -1122,11 +1146,11 @@ function liveRegion(render, stream = process13.stderr, env = process13.env) {
1122
1146
  clear();
1123
1147
  restore();
1124
1148
  release();
1125
- process13.off("exit", onExit);
1149
+ process14.off("exit", onExit);
1126
1150
  signals.release();
1127
1151
  }
1128
1152
  timer.unref();
1129
- process13.on("exit", onExit);
1153
+ process14.on("exit", onExit);
1130
1154
  return {
1131
1155
  redraw: draw,
1132
1156
  print: (text) => {
@@ -1165,14 +1189,14 @@ function cutToWidth(line, width) {
1165
1189
  return `${kept}${RESET_STYLE}${linked ? CLOSE_LINK : ""}`;
1166
1190
  }
1167
1191
  function swallowInput() {
1168
- const input = process13.stdin;
1192
+ const input = process14.stdin;
1169
1193
  if (!input.isTTY)
1170
1194
  return () => {
1171
1195
  return;
1172
1196
  };
1173
1197
  const onData = (data) => {
1174
1198
  if (data.includes(CTRL_C))
1175
- process13.kill(process13.pid, "SIGINT");
1199
+ process14.kill(process14.pid, "SIGINT");
1176
1200
  };
1177
1201
  input.setRawMode(true);
1178
1202
  input.on("data", onData);
@@ -1188,7 +1212,7 @@ function swallowInput() {
1188
1212
  };
1189
1213
  }
1190
1214
  function interceptOutput(clear) {
1191
- const targets = [...CONSOLE_METHODS.map((name) => [console, name]), [process13.stdout, "write"], [process13.stderr, "write"]];
1215
+ const targets = [...CONSOLE_METHODS.map((name) => [console, name]), [process14.stdout, "write"], [process14.stderr, "write"]];
1192
1216
  const wrapped = targets.map(([target, name]) => {
1193
1217
  const original = Reflect.get(target, name);
1194
1218
  const wrapper = (...args) => {
@@ -1207,11 +1231,11 @@ function interceptOutput(clear) {
1207
1231
  }
1208
1232
 
1209
1233
  // ../kit/src/tool.ts
1210
- import process14 from "process";
1234
+ import process15 from "process";
1211
1235
  var PERMANENT = /\bHTTP (?:401|403|404)\b|unauthorized|forbidden|not found|couldn't be found|token is required/i;
1212
1236
  function cwdGone() {
1213
1237
  try {
1214
- process14.cwd();
1238
+ process15.cwd();
1215
1239
  return false;
1216
1240
  } catch {
1217
1241
  return true;
@@ -1238,7 +1262,7 @@ function isPermanentFailure(error) {
1238
1262
  async function runTool(label, argv, { timeoutMs, cwd, onStart } = {}) {
1239
1263
  let ran;
1240
1264
  try {
1241
- ran = await runCommand(argv, { env: process14.env, ...timeoutMs === undefined ? {} : { timeoutMs }, ...cwd === undefined ? {} : { cwd }, ...onStart === undefined ? {} : { onStart } });
1265
+ ran = await runCommand(argv, { env: process15.env, ...timeoutMs === undefined ? {} : { timeoutMs }, ...cwd === undefined ? {} : { cwd }, ...onStart === undefined ? {} : { onStart } });
1242
1266
  } catch (error) {
1243
1267
  throw spawnFailure(label, error);
1244
1268
  }
@@ -1330,15 +1354,15 @@ function ciHeader(spinner, label, startedAt, out) {
1330
1354
  return `${spinner} ${label} ${paint(out).dim(formatElapsed(Date.now() - startedAt))}`;
1331
1355
  }
1332
1356
  // ../kit/src/cli.ts
1333
- import { readFileSync as readFileSync3, realpathSync } from "fs";
1357
+ import { readFileSync as readFileSync4, realpathSync as realpathSync2 } from "fs";
1334
1358
  import { dirname as dirname3, join as join5 } from "path";
1335
- import process16 from "process";
1359
+ import process17 from "process";
1336
1360
 
1337
1361
  // ../kit/src/usage.ts
1338
1362
  import { appendFileSync, mkdirSync } from "fs";
1339
1363
  import { homedir as homedir3 } from "os";
1340
1364
  import { dirname as dirname2, isAbsolute, join as join4 } from "path";
1341
- import process15 from "process";
1365
+ import process16 from "process";
1342
1366
 
1343
1367
  // ../kit/src/logs.ts
1344
1368
  var DAY_MS = 24 * 60 * 60 * 1000;
@@ -1352,14 +1376,14 @@ var usageError;
1352
1376
  function noteUsageError(message) {
1353
1377
  usageError = message;
1354
1378
  }
1355
- function stateHome(env = process15.env) {
1379
+ function stateHome(env = process16.env) {
1356
1380
  const dir = env.XDG_STATE_HOME;
1357
1381
  return dir !== undefined && isAbsolute(dir) ? dir : join4(homedir3(), ".local", "state");
1358
1382
  }
1359
- function usagePath(env = process15.env) {
1383
+ function usagePath(env = process16.env) {
1360
1384
  return join4(stateHome(env), CLI_FOLDER, "usage.jsonl");
1361
1385
  }
1362
- function usageRecorded(env = process15.env) {
1386
+ function usageRecorded(env = process16.env) {
1363
1387
  const off = env.KAYNOOO_CLI_NO_USAGE;
1364
1388
  return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
1365
1389
  }
@@ -1373,7 +1397,7 @@ function usageEntry(bin, command, argv, code, now = new Date) {
1373
1397
  usageError = undefined;
1374
1398
  return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
1375
1399
  }
1376
- function recordUsage(entry, env = process15.env) {
1400
+ function recordUsage(entry, env = process16.env) {
1377
1401
  if (!usageRecorded(env))
1378
1402
  return;
1379
1403
  try {
@@ -1464,8 +1488,8 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
1464
1488
  `);
1465
1489
  }
1466
1490
  function printError(prefix, message, hint, cause) {
1467
- const colors = paint(process16.stderr);
1468
- const styled = takesControlCodes(process16.stderr);
1491
+ const colors = paint(process17.stderr);
1492
+ const styled = takesControlCodes(process17.stderr);
1469
1493
  const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
1470
1494
  const under = (label, text, tint) => text === undefined ? "" : `
1471
1495
  ${styled ? tint(label) : `${label}:`} ${text}`;
@@ -1475,8 +1499,8 @@ function runHint(command, effect) {
1475
1499
  return `run \`${command}\`${effect === undefined ? "" : ` to ${effect}`}`;
1476
1500
  }
1477
1501
  function printHint(hint) {
1478
- const colors = paint(process16.stderr);
1479
- console.error(` ${takesControlCodes(process16.stderr) ? colors.yellow("hint") : "hint:"} ${hint}`);
1502
+ const colors = paint(process17.stderr);
1503
+ console.error(` ${takesControlCodes(process17.stderr) ? colors.yellow("hint") : "hint:"} ${hint}`);
1480
1504
  }
1481
1505
  function printJsonError(message, hint, cause) {
1482
1506
  console.error(JSON.stringify({ error: message, ...hint === undefined ? {} : { hint }, ...cause === undefined ? {} : { cause } }));
@@ -1515,11 +1539,11 @@ async function dispatch(level, typed, { version, redact }) {
1515
1539
  }
1516
1540
  }
1517
1541
  if (name === undefined && level.path.length > 1) {
1518
- console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process16.stderr));
1542
+ console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process17.stderr));
1519
1543
  return 2;
1520
1544
  }
1521
1545
  if (name === undefined || name === "help" || name === "--help" || name === "-h") {
1522
- console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process16.stdout));
1546
+ console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process17.stdout));
1523
1547
  return 0;
1524
1548
  }
1525
1549
  if (level.path.length === 1 && (name === "--version" || name === "-v")) {
@@ -1575,24 +1599,24 @@ function candidateLine(candidate) {
1575
1599
  }
1576
1600
  function positionalBeingTyped(before, { options, positionals }) {
1577
1601
  const takesValue = (word) => !word.includes("=") && Object.entries(options).some(([name, { short, type }]) => type === "string" && (word === `--${name}` || word === `-${short}`));
1578
- let index = 0;
1602
+ const typed = [];
1579
1603
  let at = 0;
1580
1604
  while (at < before.length) {
1581
1605
  const word = before[at];
1582
1606
  if (word === "--") {
1583
- index += before.length - at - 1;
1607
+ typed.push(...before.slice(at + 1));
1584
1608
  break;
1585
1609
  }
1586
1610
  if (!word.startsWith("-"))
1587
- index++;
1611
+ typed.push(word);
1588
1612
  else if (takesValue(word))
1589
1613
  at++;
1590
1614
  at++;
1591
1615
  }
1592
1616
  const last = positionals.at(-1);
1593
- if (index < positionals.length)
1594
- return positionals[index];
1595
- return last?.replace("]", "").endsWith("...") === true ? last : undefined;
1617
+ if (typed.length < positionals.length)
1618
+ return { name: positionals[typed.length], typed };
1619
+ return { name: last?.replace("]", "").endsWith("...") === true ? last : undefined, typed };
1596
1620
  }
1597
1621
  async function leafCandidates(run, words) {
1598
1622
  const completing = await completingOf(run);
@@ -1600,12 +1624,12 @@ async function leafCandidates(run, words) {
1600
1624
  return Object.entries(completing.options).map(([name, option]) => option.description === undefined ? `--${name}` : `--${name} ${option.description}`);
1601
1625
  const flag = words.at(-2);
1602
1626
  const option = flag?.startsWith("-") === true ? Object.entries(completing.options).find(([name, { short }]) => flag === `--${name}` || flag === `-${short}`)?.[1] : undefined;
1627
+ const { name, typed } = positionalBeingTyped(words.slice(0, -1), completing);
1603
1628
  if (option?.type === "string") {
1604
- const values = option.choices === undefined ? await option.candidates?.() : option.choices;
1629
+ const values = option.choices === undefined ? await option.candidates?.(typed) : option.choices;
1605
1630
  return values === undefined ? [FILES] : values.map(candidateLine);
1606
1631
  }
1607
- const name = positionalBeingTyped(words.slice(0, -1), completing);
1608
- const values = name === undefined ? undefined : await completing.candidates[name]?.();
1632
+ const values = name === undefined ? undefined : await completing.candidates[name]?.(typed);
1609
1633
  return values === undefined ? [FILES] : values.map(candidateLine);
1610
1634
  }
1611
1635
  async function candidates(scope, defaultCommand, words, before = []) {
@@ -1636,9 +1660,13 @@ async function printCandidates(found) {
1636
1660
  return 0;
1637
1661
  }
1638
1662
  function packageVersion(entry = Bun.main) {
1639
- for (let dir = dirname3(realpathSync(entry));; dir = dirname3(dir)) {
1663
+ let resolved = entry;
1664
+ try {
1665
+ resolved = realpathSync2(entry);
1666
+ } catch {}
1667
+ for (let dir = dirname3(resolved);; dir = dirname3(dir)) {
1640
1668
  try {
1641
- const { version } = JSON.parse(readFileSync3(join5(dir, "package.json"), "utf8"));
1669
+ const { version } = JSON.parse(readFileSync4(join5(dir, "package.json"), "utf8"));
1642
1670
  if (typeof version === "string")
1643
1671
  return version;
1644
1672
  } catch {}
@@ -1646,7 +1674,7 @@ function packageVersion(entry = Bun.main) {
1646
1674
  return "0.0.0";
1647
1675
  }
1648
1676
  }
1649
- async function runCli(cli, argv = process16.argv.slice(2)) {
1677
+ async function runCli(cli, argv = scriptArgs()) {
1650
1678
  const version = cli.version ?? packageVersion();
1651
1679
  if (argv[0] === COMPLETE)
1652
1680
  return printCandidates(candidates(scopeOf(cli.commands, cli.extraCommands, cli.aliases), cli.defaultCommand, argv.slice(1)));
@@ -1677,7 +1705,7 @@ function commandPath(scope, argv) {
1677
1705
  var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
1678
1706
  // ../kit/src/git.ts
1679
1707
  import { basename, dirname as dirname4 } from "path";
1680
- import process17 from "process";
1708
+ import process18 from "process";
1681
1709
  var ORIGIN_PREFIX = /^origin\//;
1682
1710
  var GIT_NETWORK_MS = 60000;
1683
1711
  async function git(args, timeoutMs) {
@@ -1707,7 +1735,7 @@ async function defaultBranch() {
1707
1735
  async function leaveWorktree() {
1708
1736
  const common = await git(["rev-parse", "--path-format=absolute", "--git-common-dir"]);
1709
1737
  if (basename(common) === ".git")
1710
- process17.chdir(dirname4(common));
1738
+ process18.chdir(dirname4(common));
1711
1739
  }
1712
1740
  // ../kit/src/limit.ts
1713
1741
  function limitOptions(fallback) {
@@ -1748,15 +1776,15 @@ var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "ses
1748
1776
  // ../kit/src/sessions.ts
1749
1777
  import { homedir as homedir4 } from "os";
1750
1778
  import { join as join6 } from "path";
1751
- import process18 from "process";
1779
+ import process19 from "process";
1752
1780
  var {Glob } = globalThis.Bun;
1753
1781
  var SESSION_FILES = new Glob("*.json");
1754
1782
  var ACCOUNT_DIRS = new Glob("*/sessions");
1755
1783
  async function sessionDirs() {
1756
1784
  const home = homedir4();
1757
1785
  const dirs = new Set([join6(home, ".claude", "sessions")]);
1758
- if (process18.env.CLAUDE_CONFIG_DIR !== undefined)
1759
- dirs.add(join6(process18.env.CLAUDE_CONFIG_DIR, "sessions"));
1786
+ if (process19.env.CLAUDE_CONFIG_DIR !== undefined)
1787
+ dirs.add(join6(process19.env.CLAUDE_CONFIG_DIR, "sessions"));
1760
1788
  try {
1761
1789
  for await (const dir of ACCOUNT_DIRS.scan({ cwd: join6(home, ".claude-accounts"), onlyFiles: false, absolute: true }))
1762
1790
  dirs.add(dir);
@@ -1802,7 +1830,7 @@ async function liveSessions() {
1802
1830
  }
1803
1831
  async function currentSession(sessions) {
1804
1832
  const byPid = new Map(sessions.map((session) => [session.pid, session]));
1805
- let pid = process18.ppid;
1833
+ let pid = process19.ppid;
1806
1834
  for (let depth = 0;depth < 32 && pid > 1; depth++) {
1807
1835
  const session = byPid.get(pid);
1808
1836
  if (session !== undefined)
@@ -1815,7 +1843,7 @@ async function currentSession(sessions) {
1815
1843
  return;
1816
1844
  }
1817
1845
  // ../kit/src/watch.ts
1818
- import process19 from "process";
1846
+ import process20 from "process";
1819
1847
  import { format } from "util";
1820
1848
  var CLEAR_SCREEN = "\x1B[H\x1B[2J";
1821
1849
  var DEFAULT_SECONDS = 2;
@@ -1837,7 +1865,7 @@ function withoutWatch(args) {
1837
1865
  }
1838
1866
  return rest;
1839
1867
  }
1840
- async function watching(value, step, stream = process19.stdout, sleep = Bun.sleep, rounds = Number.POSITIVE_INFINITY) {
1868
+ async function watching(value, step, stream = process20.stdout, sleep = Bun.sleep, rounds = Number.POSITIVE_INFINITY) {
1841
1869
  const interval = value === "" ? DEFAULT_SECONDS * 1000 : duration(value, "watch", DEFAULT_SECONDS * 1000);
1842
1870
  if (!takesControlCodes(stream))
1843
1871
  badUsage("--watch redraws the screen, so it needs a terminal");
@@ -1845,12 +1873,12 @@ async function watching(value, step, stream = process19.stdout, sleep = Bun.slee
1845
1873
  for (let round = 0;round < rounds; round++) {
1846
1874
  const held = [];
1847
1875
  const { log, info } = console;
1848
- const write = process19.stdout.write.bind(process19.stdout);
1876
+ const write = process20.stdout.write.bind(process20.stdout);
1849
1877
  const hold = (...parts) => void held.push(`${format(...parts)}
1850
1878
  `);
1851
1879
  console.log = hold;
1852
1880
  console.info = hold;
1853
- process19.stdout.write = (text) => {
1881
+ process20.stdout.write = (text) => {
1854
1882
  held.push(typeof text === "string" ? text : Buffer.from(text).toString());
1855
1883
  return true;
1856
1884
  };
@@ -1859,7 +1887,7 @@ async function watching(value, step, stream = process19.stdout, sleep = Bun.slee
1859
1887
  } finally {
1860
1888
  console.log = log;
1861
1889
  console.info = info;
1862
- process19.stdout.write = write;
1890
+ process20.stdout.write = write;
1863
1891
  }
1864
1892
  stream.write(`${CLEAR_SCREEN}${held.join("")}`);
1865
1893
  await sleep(interval);
@@ -2037,9 +2065,9 @@ function holderSession(holder, sessions) {
2037
2065
  }
2038
2066
 
2039
2067
  // src/good.ts
2040
- import process21 from "process";
2068
+ import process22 from "process";
2041
2069
  function good(text) {
2042
- return role("ok", process21.stdout)(text);
2070
+ return role("ok", process22.stdout)(text);
2043
2071
  }
2044
2072
 
2045
2073
  // src/config.ts
@@ -2074,7 +2102,7 @@ async function loadSettings(home) {
2074
2102
  // src/forge.ts
2075
2103
  import { homedir as homedir5 } from "os";
2076
2104
  import { join as join7 } from "path";
2077
- import process22 from "process";
2105
+ import process23 from "process";
2078
2106
 
2079
2107
  // src/remote.ts
2080
2108
  var SCP_LIKE = /^(?:([^@/]+)@)?([^:/]+):(?!\/)(.+?)(?:\.git)?\/?$/;
@@ -2129,7 +2157,7 @@ function loginHosts(config) {
2129
2157
  return hosts;
2130
2158
  }
2131
2159
  function teaConfigPath() {
2132
- const base = process22.env.XDG_CONFIG_HOME;
2160
+ const base = process23.env.XDG_CONFIG_HOME;
2133
2161
  return join7(base !== undefined && base !== "" ? base : join7(homedir5(), ".config"), "tea", "config.yml");
2134
2162
  }
2135
2163
  async function readConfig() {
@@ -2665,7 +2693,7 @@ async function drop(args) {
2665
2693
  }
2666
2694
 
2667
2695
  // src/commands/ci.ts
2668
- import process23 from "process";
2696
+ import process24 from "process";
2669
2697
 
2670
2698
  // src/git.ts
2671
2699
  async function tagsAt(commit) {
@@ -2931,7 +2959,7 @@ async function ci2(args) {
2931
2959
  return;
2932
2960
  }
2933
2961
  const json = values.json === true;
2934
- const live = takesControlCodes(process23.stderr) && takesControlCodes(process23.stdout) && !json && values.quiet !== true;
2962
+ const live = takesControlCodes(process24.stderr) && takesControlCodes(process24.stdout) && !json && values.quiet !== true;
2935
2963
  const runs = await waitForCi({
2936
2964
  tool: "ft ci",
2937
2965
  short,
@@ -2957,8 +2985,8 @@ async function ci2(args) {
2957
2985
  return stall === undefined ? undefined : { message: `runs queued on ${short} are not moving: ${stall.reason}`, certain: stall.certain };
2958
2986
  },
2959
2987
  lines: (spinner, found, started) => [
2960
- ciHeader(spinner, `CI on ${short}`, started, process23.stderr),
2961
- ...(found ?? []).map((run) => ` ${runLine(run, process23.stderr, undefined, run.commit_sha.slice(0, 7))}`)
2988
+ ciHeader(spinner, `CI on ${short}`, started, process24.stderr),
2989
+ ...(found ?? []).map((run) => ` ${runLine(run, process24.stderr, undefined, run.commit_sha.slice(0, 7))}`)
2962
2990
  ]
2963
2991
  });
2964
2992
  const status = overall(runs);
@@ -2975,7 +3003,7 @@ async function ci2(args) {
2975
3003
  }
2976
3004
  if (live) {
2977
3005
  for (const run of runs)
2978
- console.log(runLine(run, process23.stdout, undefined, run.commit_sha.slice(0, 7)));
3006
+ console.log(runLine(run, process24.stdout, undefined, run.commit_sha.slice(0, 7)));
2979
3007
  }
2980
3008
  if (status !== "failure") {
2981
3009
  if (live)
@@ -2994,7 +3022,7 @@ run ${run.id} failed${run.commit_sha === sha ? "" : `, testing every commit from
2994
3022
  }
2995
3023
 
2996
3024
  // src/commands/digest.ts
2997
- import process24 from "process";
3025
+ import process25 from "process";
2998
3026
  var RUNS_SCANNED = 50;
2999
3027
  var TITLE_WIDTH2 = 70;
3000
3028
  var SHOWN = 8;
@@ -3044,7 +3072,7 @@ async function quietly(read) {
3044
3072
  }
3045
3073
  }
3046
3074
  async function staleTodos() {
3047
- const bin = Bun.which("todo-scan", { PATH: process24.env.PATH ?? "" });
3075
+ const bin = Bun.which("todo-scan", { PATH: process25.env.PATH ?? "" });
3048
3076
  if (bin === null)
3049
3077
  return [];
3050
3078
  let found;
@@ -3066,8 +3094,8 @@ async function staleTodos() {
3066
3094
  return [...byIssue.values()];
3067
3095
  }
3068
3096
  function claimLine(row, now) {
3069
- const id = role("id", process24.stdout);
3070
- return [id(`#${row.number}`), row.holder, paint(process24.stdout).dim(formatAge(row.since, now)), row.boxesTotal === 0 ? "" : `${row.boxesLeft}/${row.boxesTotal} left`, truncate(row.title, TITLE_WIDTH2)];
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)];
3071
3099
  }
3072
3100
  function capped2(lines) {
3073
3101
  return lines.length > SHOWN ? [...lines.slice(0, SHOWN), `... ${lines.length - SHOWN} more`] : lines;
@@ -3078,13 +3106,13 @@ function renderDigest(digest, now = Date.now()) {
3078
3106
  `) },
3079
3107
  { heading: "claimed, no live session here", tone: "warn", count: digest.away.length, lines: table(digest.away.map((row) => claimLine(row, now))).split(`
3080
3108
  `) },
3081
- { heading: "CI on the default branch", tone: "failed", count: digest.ci.length, lines: digest.ci.map((run) => `${run.workflow} ${badge(run.status, process24.stdout)} (run ${run.id}) ${truncate(upTo(run.title, `
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, `
3082
3110
  `), TITLE_WIDTH2)}`) },
3083
3111
  { heading: "unpushed commits", tone: "queued", count: digest.unpushed.length, lines: capped2(digest.unpushed) },
3084
- { heading: "dirty files", tone: "warn", count: digest.dirty.length, lines: capped2(digest.dirty.map((file) => `${file.status} ${role("path", process24.stdout)(file.path)}`)) },
3112
+ { heading: "dirty files", tone: "warn", count: digest.dirty.length, lines: capped2(digest.dirty.map((file) => `${file.status} ${role("path", process25.stdout)(file.path)}`)) },
3085
3113
  { 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(", ")}`)) }
3086
3114
  ].filter((each) => each.count > 0);
3087
- return sections.length === 0 ? "nothing to pick up" : sections.map(({ heading, tone, count, lines }) => `${section(heading, count, process24.stdout, process24.env, tone)}
3115
+ return sections.length === 0 ? "nothing to pick up" : sections.map(({ heading, tone, count, lines }) => `${section(heading, count, process25.stdout, process25.env, tone)}
3088
3116
  ${lines.join(`
3089
3117
  `).replace(LINE_START2, " ")}`).join(`
3090
3118
 
@@ -3647,7 +3675,7 @@ ${await text(job)}`);
3647
3675
  }
3648
3676
 
3649
3677
  // src/commands/milestone.ts
3650
- import process25 from "process";
3678
+ import process26 from "process";
3651
3679
  var TITLE_WIDTH3 = 60;
3652
3680
  var LIST_LIMIT = 30;
3653
3681
  var CONCURRENCY2 = 4;
@@ -3656,15 +3684,15 @@ function counts(milestone) {
3656
3684
  }
3657
3685
  function progressBar(milestone) {
3658
3686
  const total = milestone.open_issues + milestone.closed_issues;
3659
- return takesControlCodes(process25.stdout) ? bar(total === 0 ? 0 : milestone.closed_issues / total, { width: 16 }) : "";
3687
+ return takesControlCodes(process26.stdout) ? bar(total === 0 ? 0 : milestone.closed_issues / total, { width: 16 }) : "";
3660
3688
  }
3661
3689
  function milestoneCells(each, showState) {
3662
3690
  const drawn = progressBar(each);
3663
3691
  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] : []];
3664
3692
  }
3665
3693
  async function printWithIssues(list, repo) {
3666
- const colors = paint(process25.stdout);
3667
- const id = role("id", process25.stdout);
3694
+ const colors = paint(process26.stdout);
3695
+ const id = role("id", process26.stdout);
3668
3696
  const issuesOf = await pool(list, concurrencyOf(CONCURRENCY2), async (each) => Promise.all([openIssues(undefined, repo, each.id), closedIssues(each.id, repo)]));
3669
3697
  const blocks = list.map((each, index) => {
3670
3698
  const byNumber = (left, right) => left.number - right.number;
@@ -3675,7 +3703,7 @@ async function printWithIssues(list, repo) {
3675
3703
  ...open.map((issue) => ` ${id(`#${issue.number}`)} ${truncate(issue.title, TITLE_WIDTH3)}`),
3676
3704
  ...closed.map((issue) => colors.dim(` #${issue.number} ${truncate(issue.title, TITLE_WIDTH3)} (closed)`))
3677
3705
  ];
3678
- return [section(`${each.title}${drawn === "" ? "" : ` ${drawn}`} ${facts}`, undefined, process25.stdout, process25.env, "accent"), ...lines].join(`
3706
+ return [section(`${each.title}${drawn === "" ? "" : ` ${drawn}`} ${facts}`, undefined, process26.stdout, process26.env, "accent"), ...lines].join(`
3679
3707
  `);
3680
3708
  });
3681
3709
  console.log(blocks.join(`
@@ -3941,7 +3969,7 @@ function report2(plan, added, skipped) {
3941
3969
 
3942
3970
  // src/commands/release.ts
3943
3971
  import { basename as basename3, join as join11 } from "path";
3944
- import process27 from "process";
3972
+ import process28 from "process";
3945
3973
  var {$: $2 } = globalThis.Bun;
3946
3974
 
3947
3975
  // src/commands/watch.ts
@@ -4179,12 +4207,12 @@ async function publishable() {
4179
4207
 
4180
4208
  // src/commands/release-plan.ts
4181
4209
  import { basename as basename2, join as join9, relative } from "path";
4182
- import process26 from "process";
4210
+ import process27 from "process";
4183
4211
  async function planOf({ level, dir, prefix }, registry) {
4184
4212
  const file = Bun.file(join9(dir ?? ".", "package.json"));
4185
4213
  const pkg = await file.exists() ? await file.json() : undefined;
4186
- const name = pkg?.name ?? basename2(dir ?? process26.cwd());
4187
- const where = dir === undefined ? "" : ` in ${relative(process26.cwd(), dir) || "."}`;
4214
+ const name = pkg?.name ?? basename2(dir ?? process27.cwd());
4215
+ const where = dir === undefined ? "" : ` in ${relative(process27.cwd(), dir) || "."}`;
4188
4216
  let version;
4189
4217
  let bump;
4190
4218
  if (level === undefined) {
@@ -4223,12 +4251,12 @@ async function printPlan({ releases, branch, base, timeout, registry }) {
4223
4251
  }
4224
4252
 
4225
4253
  // src/commands/release-steps.ts
4226
- import { join as join10, relative as relative2, resolve as resolve4 } from "path";
4254
+ import { join as join10, relative as relative2, resolve as resolve5 } from "path";
4227
4255
  var {$ } = globalThis.Bun;
4228
4256
  var registryWait = { tries: 12, poll: 5000 };
4229
4257
  var REGISTRY_INFO_MS = 30000;
4230
4258
  async function packageDir(value) {
4231
- for (const dir of [resolve4(value), join10(await git(["rev-parse", "--show-toplevel"]), "packages", value)]) {
4259
+ for (const dir of [resolve5(value), join10(await git(["rev-parse", "--show-toplevel"]), "packages", value)]) {
4232
4260
  if (await Bun.file(join10(dir, "package.json")).exists())
4233
4261
  return dir;
4234
4262
  }
@@ -4429,7 +4457,7 @@ ${push.stderr.trim()}`, signal === undefined ? 1 : exitCodeOf(null, signal));
4429
4457
  if (late !== undefined)
4430
4458
  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));
4431
4459
  say(`pushed ${branch} and ${bumped.map((each) => each.tag).join(", ")}, waiting for their runs`);
4432
- followed = await followRuns((runs) => runs.filter((run) => run.id > before && heads.has(run.commit_sha)), timeout, undefined, NO_RUN2, json ? process27.stderr : process27.stdout, { json });
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 });
4433
4461
  if (followed.code !== 0) {
4434
4462
  report();
4435
4463
  return followed.code;
@@ -4606,7 +4634,7 @@ async function runs(args) {
4606
4634
  }
4607
4635
 
4608
4636
  // src/cli.ts
4609
- process28.exitCode = await runCli({
4637
+ process29.exitCode = await runCli({
4610
4638
  name: "ft",
4611
4639
  about: "Forgejo tools over tea, run from a repository whose origin is on Forgejo",
4612
4640
  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.28.2",
4
+ "version": "0.29.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.37.0"
34
+ "@kaynooo/cli-kit": "0.38.2"
35
35
  }
36
36
  }