@kaynooo/cli-forgejo 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +138 -83
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -29,7 +29,7 @@ Needs [tea](https://gitea.com/gitea/tea) logged in to the Forgejo instance (`tea
29
29
  | `ft close <n>... [-m reason]` | closes issues no commit fixed (a duplicate, one dropped), posting the reason first; `ft reopen` reopens them the same way |
30
30
  | `ft label <n> [+]a -b` | adds the labels named bare or with `+`, removes those named with `-`, refusing one the repository lacks, and prints the issue's labels |
31
31
  | `ft plan add <plan> <n>...` / `ft plan carry <from> <to>` | adds `- [ ] #<n> <title>` lines to a release plan's checklist, or copies one plan's unticked `#<n>` lines into the next, both under `--section "Bugs:"` (created when missing) and skipping issues already listed |
32
- | `ft milestones` | lists the milestones (`--state open\|closed\|all`, `--json`) with the issues open and closed in each, the progress and the due date |
32
+ | `ft milestones` | lists the milestones (`--state open\|closed\|all`, `--json`, `--issues` for each one's issues by title) with the issues open and closed in each, the progress and the due date |
33
33
  | `ft milestone <title\|id>` | shows a milestone's open issues as `ft board` does (available, taken, claimed by one gone); `ft milestone new <title> [-d text] [--due YYYY-MM-DD]` creates one through the API, sending no `due_on` unless `--due` is given, never a zero date; `ft milestone close <m>` refuses while issues are open in it, naming them, unless `--force` |
34
34
  | `ft remote [--fix]` | switches an origin using an ssh alias (`forgejo:owner/repo`) to `git@<host>:owner/repo.git`, which tea matches; the host comes from `--host` or `remoteHost` in `~/.config/kaynooo-cli/ft.json` (`{"remoteHost": "git.example.com"}`; the older `~/.config/ft/config.json` is read while the new file is missing), and with neither it checks nothing |
35
35
 
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // @bun
3
3
 
4
4
  // src/cli.ts
5
- import process25 from "process";
5
+ import process28 from "process";
6
6
  // ../kit/src/args.ts
7
7
  import process10 from "process";
8
8
  import { parseArgs } from "util";
@@ -668,6 +668,9 @@ function jsonText(value, replacer, { stream = process7.stdout, env = process7.en
668
668
  function printJson(value) {
669
669
  console.log(jsonText(value));
670
670
  }
671
+ function formatPercent(ratio, digits = 0) {
672
+ return `${(ratio * 100).toFixed(digits)}%`;
673
+ }
671
674
 
672
675
  // ../kit/src/help.ts
673
676
  import process8 from "process";
@@ -1000,13 +1003,27 @@ function nearestOption(message, options, allowNegative) {
1000
1003
  const meant = closest(word, known.map((flag) => flag.replace(DASHES, "")));
1001
1004
  return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
1002
1005
  }
1006
+ // ../kit/src/chart.ts
1007
+ import process11 from "process";
1008
+ var FILLED = "\u2501";
1009
+ var EMPTY = "\u2500";
1010
+ function bar(ratio, { width = 20, stream = process11.stdout, env = process11.env } = {}) {
1011
+ if (outputMode(stream, env) === "agent")
1012
+ return formatPercent(Math.min(1, Math.max(0, ratio)));
1013
+ const colors = paint(stream, env);
1014
+ const filled = Math.round(Math.min(1, Math.max(0, ratio)) * width);
1015
+ if (!takesControlCodes(stream, env))
1016
+ return `${FILLED.repeat(filled)}${EMPTY.repeat(width - filled)}`;
1017
+ const { theme } = activeTheme();
1018
+ return `${tinted(colors, theme.colors.accent, env)(theme.glyphs.bar.repeat(filled))}${colors.dim(theme.glyphs.bar.repeat(width - filled))}`;
1019
+ }
1003
1020
  // ../kit/src/progress.ts
1004
- import process12 from "process";
1021
+ import process13 from "process";
1005
1022
 
1006
1023
  // ../kit/src/process.ts
1007
1024
  import { constants } from "os";
1008
1025
  import { resolve as resolve3 } from "path";
1009
- import process11 from "process";
1026
+ import process12 from "process";
1010
1027
  var KILL_GRACE_MS = 2000;
1011
1028
  var SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
1012
1029
  var SCHEME = /^[a-z][\w+.-]+:/i;
@@ -1030,7 +1047,7 @@ function holdSignals(cleanup) {
1030
1047
  },
1031
1048
  release: () => {
1032
1049
  for (const signal of SIGNALS)
1033
- process11.off(signal, onSignal);
1050
+ process12.off(signal, onSignal);
1034
1051
  }
1035
1052
  };
1036
1053
  function onSignal(signal) {
@@ -1043,13 +1060,13 @@ function holdSignals(cleanup) {
1043
1060
  return;
1044
1061
  held.release();
1045
1062
  cleanup(signal);
1046
- process11.kill(process11.pid, signal);
1063
+ process12.kill(process12.pid, signal);
1047
1064
  }
1048
1065
  for (const signal of SIGNALS)
1049
- process11.on(signal, onSignal);
1066
+ process12.on(signal, onSignal);
1050
1067
  return held;
1051
1068
  }
1052
- function openUrl(target, env = process11.env, platform = process11.platform) {
1069
+ function openUrl(target, env = process12.env, platform = process12.platform) {
1053
1070
  const opener = env.BROWSER === undefined || env.BROWSER === "" ? OPENERS[platform] ?? ["xdg-open"] : [env.BROWSER];
1054
1071
  try {
1055
1072
  Bun.spawn([...opener, SCHEME.test(target) ? target : resolve3(target)], { env, stdio: ["ignore", "ignore", "ignore"] }).unref();
@@ -1086,7 +1103,7 @@ async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal,
1086
1103
  return;
1087
1104
  try {
1088
1105
  if (grouped)
1089
- process11.kill(-proc.pid, killing);
1106
+ process12.kill(-proc.pid, killing);
1090
1107
  else
1091
1108
  proc.kill(killing);
1092
1109
  } catch {}
@@ -1165,7 +1182,7 @@ var RESET_STYLE = `${ESC}[0m`;
1165
1182
  var CTRL_C = 3;
1166
1183
  var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
1167
1184
  var CONSOLE_METHODS = ["log", "info", "warn", "error", "debug", "dir", "dirxml", "table", "trace", "group", "groupCollapsed", "count", "timeEnd", "timeLog", "assert"];
1168
- function liveRegion(render, stream = process12.stderr, env = process12.env) {
1185
+ function liveRegion(render, stream = process13.stderr, env = process13.env) {
1169
1186
  if (!takesControlCodes(stream, env))
1170
1187
  return { redraw: () => {
1171
1188
  return;
@@ -1210,11 +1227,11 @@ function liveRegion(render, stream = process12.stderr, env = process12.env) {
1210
1227
  clear();
1211
1228
  restore();
1212
1229
  release();
1213
- process12.off("exit", onExit);
1230
+ process13.off("exit", onExit);
1214
1231
  signals.release();
1215
1232
  }
1216
1233
  timer.unref();
1217
- process12.on("exit", onExit);
1234
+ process13.on("exit", onExit);
1218
1235
  return {
1219
1236
  redraw: draw,
1220
1237
  print: (text) => {
@@ -1253,14 +1270,14 @@ function cutToWidth(line, width) {
1253
1270
  return `${kept}${RESET_STYLE}${linked ? CLOSE_LINK : ""}`;
1254
1271
  }
1255
1272
  function swallowInput() {
1256
- const input = process12.stdin;
1273
+ const input = process13.stdin;
1257
1274
  if (!input.isTTY)
1258
1275
  return () => {
1259
1276
  return;
1260
1277
  };
1261
1278
  const onData = (data) => {
1262
1279
  if (data.includes(CTRL_C))
1263
- process12.kill(process12.pid, "SIGINT");
1280
+ process13.kill(process13.pid, "SIGINT");
1264
1281
  };
1265
1282
  input.setRawMode(true);
1266
1283
  input.on("data", onData);
@@ -1276,7 +1293,7 @@ function swallowInput() {
1276
1293
  };
1277
1294
  }
1278
1295
  function interceptOutput(clear) {
1279
- const targets = [...CONSOLE_METHODS.map((name) => [console, name]), [process12.stdout, "write"], [process12.stderr, "write"]];
1296
+ const targets = [...CONSOLE_METHODS.map((name) => [console, name]), [process13.stdout, "write"], [process13.stderr, "write"]];
1280
1297
  const wrapped = targets.map(([target, name]) => {
1281
1298
  const original = Reflect.get(target, name);
1282
1299
  const wrapper = (...args) => {
@@ -1295,11 +1312,11 @@ function interceptOutput(clear) {
1295
1312
  }
1296
1313
 
1297
1314
  // ../kit/src/tool.ts
1298
- import process13 from "process";
1315
+ import process14 from "process";
1299
1316
  var PERMANENT = /\bHTTP (?:401|403|404)\b|unauthorized|forbidden|not found|couldn't be found|token is required/i;
1300
1317
  function cwdGone() {
1301
1318
  try {
1302
- process13.cwd();
1319
+ process14.cwd();
1303
1320
  return false;
1304
1321
  } catch {
1305
1322
  return true;
@@ -1326,7 +1343,7 @@ function isPermanentFailure(error) {
1326
1343
  async function runTool(label, argv, { timeoutMs, cwd, onStart } = {}) {
1327
1344
  let ran;
1328
1345
  try {
1329
- ran = await runCommand(argv, { env: process13.env, ...timeoutMs === undefined ? {} : { timeoutMs }, ...cwd === undefined ? {} : { cwd }, ...onStart === undefined ? {} : { onStart } });
1346
+ ran = await runCommand(argv, { env: process14.env, ...timeoutMs === undefined ? {} : { timeoutMs }, ...cwd === undefined ? {} : { cwd }, ...onStart === undefined ? {} : { onStart } });
1330
1347
  } catch (error) {
1331
1348
  throw spawnFailure(label, error);
1332
1349
  }
@@ -1413,13 +1430,13 @@ async function waitForCi(wait) {
1413
1430
  // ../kit/src/cli.ts
1414
1431
  import { readFileSync as readFileSync2, realpathSync } from "fs";
1415
1432
  import { dirname as dirname3, join as join5 } from "path";
1416
- import process15 from "process";
1433
+ import process16 from "process";
1417
1434
 
1418
1435
  // ../kit/src/usage.ts
1419
1436
  import { appendFileSync, mkdirSync } from "fs";
1420
1437
  import { homedir as homedir3 } from "os";
1421
1438
  import { dirname as dirname2, isAbsolute, join as join4 } from "path";
1422
- import process14 from "process";
1439
+ import process15 from "process";
1423
1440
 
1424
1441
  // ../kit/src/logs.ts
1425
1442
  var DAY_MS = 24 * 60 * 60 * 1000;
@@ -1433,14 +1450,14 @@ var usageError;
1433
1450
  function noteUsageError(message) {
1434
1451
  usageError = message;
1435
1452
  }
1436
- function stateHome(env = process14.env) {
1453
+ function stateHome(env = process15.env) {
1437
1454
  const dir = env.XDG_STATE_HOME;
1438
1455
  return dir !== undefined && isAbsolute(dir) ? dir : join4(homedir3(), ".local", "state");
1439
1456
  }
1440
- function usagePath(env = process14.env) {
1457
+ function usagePath(env = process15.env) {
1441
1458
  return join4(stateHome(env), CLI_FOLDER, "usage.jsonl");
1442
1459
  }
1443
- function usageRecorded(env = process14.env) {
1460
+ function usageRecorded(env = process15.env) {
1444
1461
  const off = env.KAYNOOO_CLI_NO_USAGE;
1445
1462
  return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
1446
1463
  }
@@ -1454,7 +1471,7 @@ function usageEntry(bin, command, argv, code, now = new Date) {
1454
1471
  usageError = undefined;
1455
1472
  return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
1456
1473
  }
1457
- function recordUsage(entry, env = process14.env) {
1474
+ function recordUsage(entry, env = process15.env) {
1458
1475
  if (!usageRecorded(env))
1459
1476
  return;
1460
1477
  try {
@@ -1545,8 +1562,8 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
1545
1562
  `);
1546
1563
  }
1547
1564
  function printError(prefix, message, hint, cause) {
1548
- const colors = paint(process15.stderr);
1549
- const styled = takesControlCodes(process15.stderr);
1565
+ const colors = paint(process16.stderr);
1566
+ const styled = takesControlCodes(process16.stderr);
1550
1567
  const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
1551
1568
  const under = (label, text, tint) => text === undefined ? "" : `
1552
1569
  ${styled ? tint(label) : `${label}:`} ${text}`;
@@ -1556,8 +1573,8 @@ function runHint(command, effect) {
1556
1573
  return `run \`${command}\`${effect === undefined ? "" : ` to ${effect}`}`;
1557
1574
  }
1558
1575
  function printHint(hint) {
1559
- const colors = paint(process15.stderr);
1560
- console.error(` ${takesControlCodes(process15.stderr) ? colors.yellow("hint") : "hint:"} ${hint}`);
1576
+ const colors = paint(process16.stderr);
1577
+ console.error(` ${takesControlCodes(process16.stderr) ? colors.yellow("hint") : "hint:"} ${hint}`);
1561
1578
  }
1562
1579
  function printJsonError(message, hint, cause) {
1563
1580
  console.error(JSON.stringify({ error: message, ...hint === undefined ? {} : { hint }, ...cause === undefined ? {} : { cause } }));
@@ -1596,11 +1613,11 @@ async function dispatch(level, typed, { version, redact }) {
1596
1613
  }
1597
1614
  }
1598
1615
  if (name === undefined && level.path.length > 1) {
1599
- console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process15.stderr));
1616
+ console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process16.stderr));
1600
1617
  return 2;
1601
1618
  }
1602
1619
  if (name === undefined || name === "help" || name === "--help" || name === "-h") {
1603
- console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process15.stdout));
1620
+ console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process16.stdout));
1604
1621
  return 0;
1605
1622
  }
1606
1623
  if (level.path.length === 1 && (name === "--version" || name === "-v")) {
@@ -1727,7 +1744,7 @@ function packageVersion(entry = Bun.main) {
1727
1744
  return "0.0.0";
1728
1745
  }
1729
1746
  }
1730
- async function runCli(cli, argv = process15.argv.slice(2)) {
1747
+ async function runCli(cli, argv = process16.argv.slice(2)) {
1731
1748
  const version = cli.version ?? packageVersion();
1732
1749
  if (argv[0] === COMPLETE)
1733
1750
  return printCandidates(candidates(scopeOf(cli.commands, cli.extraCommands, cli.aliases), cli.defaultCommand, argv.slice(1)));
@@ -1758,7 +1775,7 @@ function commandPath(scope, argv) {
1758
1775
  var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
1759
1776
  // ../kit/src/git.ts
1760
1777
  import { basename, dirname as dirname4 } from "path";
1761
- import process16 from "process";
1778
+ import process17 from "process";
1762
1779
  var ORIGIN_PREFIX = /^origin\//;
1763
1780
  var GIT_NETWORK_MS = 60000;
1764
1781
  async function git(args, timeoutMs) {
@@ -1788,7 +1805,7 @@ async function defaultBranch() {
1788
1805
  async function leaveWorktree() {
1789
1806
  const common = await git(["rev-parse", "--path-format=absolute", "--git-common-dir"]);
1790
1807
  if (basename(common) === ".git")
1791
- process16.chdir(dirname4(common));
1808
+ process17.chdir(dirname4(common));
1792
1809
  }
1793
1810
  // ../kit/src/limit.ts
1794
1811
  function limitOptions(fallback) {
@@ -1829,15 +1846,15 @@ var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "ses
1829
1846
  // ../kit/src/sessions.ts
1830
1847
  import { homedir as homedir4 } from "os";
1831
1848
  import { join as join6 } from "path";
1832
- import process17 from "process";
1849
+ import process18 from "process";
1833
1850
  var {Glob } = globalThis.Bun;
1834
1851
  var SESSION_FILES = new Glob("*.json");
1835
1852
  var ACCOUNT_DIRS = new Glob("*/sessions");
1836
1853
  async function sessionDirs() {
1837
1854
  const home = homedir4();
1838
1855
  const dirs = new Set([join6(home, ".claude", "sessions")]);
1839
- if (process17.env.CLAUDE_CONFIG_DIR !== undefined)
1840
- dirs.add(join6(process17.env.CLAUDE_CONFIG_DIR, "sessions"));
1856
+ if (process18.env.CLAUDE_CONFIG_DIR !== undefined)
1857
+ dirs.add(join6(process18.env.CLAUDE_CONFIG_DIR, "sessions"));
1841
1858
  try {
1842
1859
  for await (const dir of ACCOUNT_DIRS.scan({ cwd: join6(home, ".claude-accounts"), onlyFiles: false, absolute: true }))
1843
1860
  dirs.add(dir);
@@ -1883,7 +1900,7 @@ async function liveSessions() {
1883
1900
  }
1884
1901
  async function currentSession(sessions) {
1885
1902
  const byPid = new Map(sessions.map((session) => [session.pid, session]));
1886
- let pid = process17.ppid;
1903
+ let pid = process18.ppid;
1887
1904
  for (let depth = 0;depth < 32 && pid > 1; depth++) {
1888
1905
  const session = byPid.get(pid);
1889
1906
  if (session !== undefined)
@@ -1896,7 +1913,7 @@ async function currentSession(sessions) {
1896
1913
  return;
1897
1914
  }
1898
1915
  // ../kit/src/watch.ts
1899
- import process18 from "process";
1916
+ import process19 from "process";
1900
1917
  import { format } from "util";
1901
1918
  var CLEAR_SCREEN = "\x1B[H\x1B[2J";
1902
1919
  var DEFAULT_SECONDS = 2;
@@ -1918,7 +1935,7 @@ function withoutWatch(args) {
1918
1935
  }
1919
1936
  return rest;
1920
1937
  }
1921
- async function watching(value, step, stream = process18.stdout, sleep = Bun.sleep, rounds = Number.POSITIVE_INFINITY) {
1938
+ async function watching(value, step, stream = process19.stdout, sleep = Bun.sleep, rounds = Number.POSITIVE_INFINITY) {
1922
1939
  const interval = value === "" ? DEFAULT_SECONDS * 1000 : duration(value, "watch", DEFAULT_SECONDS * 1000);
1923
1940
  if (!takesControlCodes(stream))
1924
1941
  badUsage("--watch redraws the screen, so it needs a terminal");
@@ -1926,12 +1943,12 @@ async function watching(value, step, stream = process18.stdout, sleep = Bun.slee
1926
1943
  for (let round = 0;round < rounds; round++) {
1927
1944
  const held = [];
1928
1945
  const { log, info } = console;
1929
- const write = process18.stdout.write.bind(process18.stdout);
1946
+ const write = process19.stdout.write.bind(process19.stdout);
1930
1947
  const hold = (...parts) => void held.push(`${format(...parts)}
1931
1948
  `);
1932
1949
  console.log = hold;
1933
1950
  console.info = hold;
1934
- process18.stdout.write = (text) => {
1951
+ process19.stdout.write = (text) => {
1935
1952
  held.push(typeof text === "string" ? text : Buffer.from(text).toString());
1936
1953
  return true;
1937
1954
  };
@@ -1940,7 +1957,7 @@ async function watching(value, step, stream = process18.stdout, sleep = Bun.slee
1940
1957
  } finally {
1941
1958
  console.log = log;
1942
1959
  console.info = info;
1943
- process18.stdout.write = write;
1960
+ process19.stdout.write = write;
1944
1961
  }
1945
1962
  stream.write(`${CLEAR_SCREEN}${held.join("")}`);
1946
1963
  await sleep(interval);
@@ -2117,10 +2134,16 @@ function holderSession(holder, sessions) {
2117
2134
  return lane === undefined ? undefined : sessions.find((session) => session.name.endsWith(`-${lane}`));
2118
2135
  }
2119
2136
 
2137
+ // src/good.ts
2138
+ import process21 from "process";
2139
+ function good(text) {
2140
+ return role("ok", process21.stdout)(text);
2141
+ }
2142
+
2120
2143
  // src/forge.ts
2121
2144
  import { homedir as homedir5 } from "os";
2122
2145
  import { join as join7 } from "path";
2123
- import process20 from "process";
2146
+ import process22 from "process";
2124
2147
 
2125
2148
  // src/remote.ts
2126
2149
  var SCP_LIKE = /^(?:([^@/]+)@)?([^:/]+):(?!\/)(.+?)(?:\.git)?\/?$/;
@@ -2175,7 +2198,7 @@ function loginHosts(config) {
2175
2198
  return hosts;
2176
2199
  }
2177
2200
  function teaConfigPath() {
2178
- const base = process20.env.XDG_CONFIG_HOME;
2201
+ const base = process22.env.XDG_CONFIG_HOME;
2179
2202
  return join7(base !== undefined && base !== "" ? base : join7(homedir5(), ".config"), "tea", "config.yml");
2180
2203
  }
2181
2204
  async function readConfig() {
@@ -2564,7 +2587,7 @@ async function board(args) {
2564
2587
  printJson(boardJson(rows.slice(0, limit)));
2565
2588
  return 0;
2566
2589
  }
2567
- printHeader("ft", "board");
2590
+ printHeader("ft", `${rows.length} open ${rows.length === 1 ? "issue" : "issues"}`);
2568
2591
  console.log(rows.length === 0 && (query !== undefined || state !== undefined) ? "no open issue matches" : renderBoard(rows, Date.now(), limit));
2569
2592
  return 0;
2570
2593
  }
@@ -2642,7 +2665,7 @@ async function take(args) {
2642
2665
  const standingNow = latestClaim(await commentsOf(number, values.repo), author);
2643
2666
  if (standingNow?.holder !== name)
2644
2667
  fail(`#${number} was taken by ${standingNow?.holder ?? "another session"} at the same moment`, 1);
2645
- console.log(`took #${number} as ${name}: ${found.title}`);
2668
+ console.log(good(`took #${number} as ${name}: ${found.title}`));
2646
2669
  });
2647
2670
  }
2648
2671
  var dropUsage = `ft drop <n>... [--stale] | --all-stale [--dry-run]
@@ -2668,7 +2691,7 @@ async function releaseStale(number, me, author, sessions, repo) {
2668
2691
  fail(`#${number} is taken by ${claim.holder}, which still runs (${current.session.status})`, 1);
2669
2692
  await comment(number, releasedComment(claim.holder), repo);
2670
2693
  await comment(number, `Claim of ${claim.holder} from ${formatAge(claim.at)}, which no live session answered to, released as stale by session ${me}.`, repo);
2671
- console.log(`released #${number}, held by ${claim.holder}`);
2694
+ console.log(good(`released #${number}, held by ${claim.holder}`));
2672
2695
  }
2673
2696
  async function drop(args) {
2674
2697
  const parsed = parse(args, dropUsage, dropOptions);
@@ -2706,12 +2729,12 @@ async function drop(args) {
2706
2729
  if (claim?.holder !== name)
2707
2730
  fail(`#${number} is ${claim === undefined ? "not taken" : `taken by ${claim.holder}, not ${name}`}`, 1, claim === undefined ? undefined : runHint(`ft drop ${number} --stale`, "release it if no session answers to it"));
2708
2731
  await comment(number, releasedComment(name), values.repo);
2709
- console.log(`released #${number}`);
2732
+ console.log(good(`released #${number}`));
2710
2733
  });
2711
2734
  }
2712
2735
 
2713
2736
  // src/commands/ci.ts
2714
- import process21 from "process";
2737
+ import process23 from "process";
2715
2738
 
2716
2739
  // src/git.ts
2717
2740
  async function tagsAt(commit) {
@@ -2967,7 +2990,7 @@ async function ci2(args) {
2967
2990
  return;
2968
2991
  }
2969
2992
  const json = values.json === true;
2970
- const { dim } = paint(process21.stderr);
2993
+ const { dim } = paint(process23.stderr);
2971
2994
  const runs = await waitForCi({
2972
2995
  tool: "ft ci",
2973
2996
  short,
@@ -2992,7 +3015,7 @@ async function ci2(args) {
2992
3015
  },
2993
3016
  lines: (spinner, found, started) => [
2994
3017
  `${spinner} CI on ${short} ${dim(formatElapsed(Date.now() - started))}`,
2995
- ...(found ?? []).map((run) => ` ${badge(run.status, process21.stderr)} ${run.workflow_id} ${dim(`run ${run.id}`)}`)
3018
+ ...(found ?? []).map((run) => ` ${badge(run.status, process23.stderr)} ${run.workflow_id} ${dim(`run ${run.id}`)}`)
2996
3019
  ]
2997
3020
  });
2998
3021
  const status = overall(runs);
@@ -3008,7 +3031,7 @@ async function ci2(args) {
3008
3031
  return status === "failure" ? 1 : 0;
3009
3032
  }
3010
3033
  if (status !== "failure") {
3011
- console.log(`CI ${status === "success" ? "passed" : "skipped its tests, a release tag's workflow testing them"} on ${short}`);
3034
+ console.log(good(`CI ${status === "success" ? "passed" : "skipped its tests, a release tag's workflow testing them"} on ${short}`));
3012
3035
  return 0;
3013
3036
  }
3014
3037
  for (const run of runs) {
@@ -3022,7 +3045,7 @@ run ${run.id} failed${run.commit_sha === sha ? "" : `, testing every commit from
3022
3045
  }
3023
3046
 
3024
3047
  // src/commands/digest.ts
3025
- import process22 from "process";
3048
+ import process24 from "process";
3026
3049
  var RUNS_SCANNED = 50;
3027
3050
  var TITLE_WIDTH2 = 70;
3028
3051
  var SHOWN = 8;
@@ -3072,7 +3095,7 @@ async function quietly(read) {
3072
3095
  }
3073
3096
  }
3074
3097
  async function staleTodos() {
3075
- const bin = Bun.which("todo-scan", { PATH: process22.env.PATH ?? "" });
3098
+ const bin = Bun.which("todo-scan", { PATH: process24.env.PATH ?? "" });
3076
3099
  if (bin === null)
3077
3100
  return [];
3078
3101
  let found;
@@ -3094,8 +3117,8 @@ async function staleTodos() {
3094
3117
  return [...byIssue.values()];
3095
3118
  }
3096
3119
  function claimLine(row, now) {
3097
- const id = role("id", process22.stdout);
3098
- return [id(`#${row.number}`), row.holder, paint(process22.stdout).dim(formatAge(row.since, now)), row.boxesTotal === 0 ? "" : `${row.boxesLeft}/${row.boxesTotal} left`, truncate(row.title, TITLE_WIDTH2)];
3120
+ const id = role("id", process24.stdout);
3121
+ 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)];
3099
3122
  }
3100
3123
  function capped2(lines) {
3101
3124
  return lines.length > SHOWN ? [...lines.slice(0, SHOWN), `... ${lines.length - SHOWN} more`] : lines;
@@ -3106,13 +3129,13 @@ function renderDigest(digest, now = Date.now()) {
3106
3129
  `) },
3107
3130
  { heading: "claimed, no live session here", tone: "warn", count: digest.away.length, lines: table(digest.away.map((row) => claimLine(row, now))).split(`
3108
3131
  `) },
3109
- { heading: "CI on the default branch", tone: "failed", count: digest.ci.length, lines: digest.ci.map((run) => `${run.workflow} ${badge(run.status, process22.stdout)} (run ${run.id}) ${truncate(upTo(run.title, `
3132
+ { 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, `
3110
3133
  `), TITLE_WIDTH2)}`) },
3111
3134
  { 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", process22.stdout)(file.path)}`)) },
3135
+ { heading: "dirty files", tone: "warn", count: digest.dirty.length, lines: capped2(digest.dirty.map((file) => `${file.status} ${role("path", process24.stdout)(file.path)}`)) },
3113
3136
  { 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
3137
  ].filter((each) => each.count > 0);
3115
- return sections.length === 0 ? "nothing to pick up" : sections.map(({ heading, tone, count, lines }) => `${section(heading, count, process22.stdout, process22.env, tone)}
3138
+ return sections.length === 0 ? "nothing to pick up" : sections.map(({ heading, tone, count, lines }) => `${section(heading, count, process24.stdout, process24.env, tone)}
3116
3139
  ${lines.join(`
3117
3140
  `).replace(LINE_START2, " ")}`).join(`
3118
3141
 
@@ -3144,7 +3167,6 @@ async function digest(args) {
3144
3167
  if (values.json === true) {
3145
3168
  printJson(summary);
3146
3169
  } else {
3147
- printHeader("ft", "digest");
3148
3170
  console.log(renderDigest(summary));
3149
3171
  }
3150
3172
  return 0;
@@ -3241,12 +3263,12 @@ ${tickUsage}`);
3241
3263
  }, values.repo);
3242
3264
  }
3243
3265
  for (const box of result.changed)
3244
- console.log(`${done ? "ticked" : "unticked"} ${box.number}: ${box.text}`);
3266
+ console.log(good(`${done ? "ticked" : "unticked"} ${box.number}: ${box.text}`));
3245
3267
  const left = boxes(result.body).filter((box) => !box.done).length;
3246
3268
  console.log(`#${number}: ${result.changed.length === 0 ? "nothing to change, " : ""}${left} box${left === 1 ? "" : "es"} left`);
3247
3269
  if (note !== undefined) {
3248
3270
  await comment(number, note, values.repo);
3249
- console.log(`commented on #${number}`);
3271
+ console.log(good(`commented on #${number}`));
3250
3272
  }
3251
3273
  return 0;
3252
3274
  }
@@ -3293,7 +3315,7 @@ async function tickListings(closed, repo) {
3293
3315
  if (!referencedBoxes(listing.body).some(({ box, issue }) => issue === closed && !box.done))
3294
3316
  continue;
3295
3317
  if (await editBody(listing.number, (body) => tickReferences(body, (issue) => issue === closed).body, repo))
3296
- console.log(`ticked #${closed} in #${listing.number}`);
3318
+ console.log(good(`ticked #${closed} in #${listing.number}`));
3297
3319
  }
3298
3320
  }
3299
3321
  async function fixed(args) {
@@ -3307,7 +3329,7 @@ async function fixed(args) {
3307
3329
  const left = boxes(found.body).filter((box) => !box.done);
3308
3330
  if (left.length > 0 && values.tick === true) {
3309
3331
  await editBody(number, (body) => setBoxes(body, boxes(body).filter((box) => !box.done).map((box) => String(box.number)), true).body, values.repo);
3310
- console.log(`ticked ${left.length} box${left.length === 1 ? "" : "es"} of #${number}`);
3332
+ console.log(good(`ticked ${left.length} box${left.length === 1 ? "" : "es"} of #${number}`));
3311
3333
  } else if (left.length > 0 && values.force !== true) {
3312
3334
  fail(`#${number} has ${left.length} boxes left:
3313
3335
  ${left.map((box) => `${String(box.number).padStart(3)} [ ] ${box.text}`).join(`
@@ -3318,7 +3340,7 @@ ${left.map((box) => `${String(box.number).padStart(3)} [ ] ${box.text}`).join(`
3318
3340
  if ((await commentsOf(number, values.repo)).at(-1)?.body.trim() !== line.trim())
3319
3341
  await comment(number, line, values.repo);
3320
3342
  await close(number, values.repo);
3321
- console.log(`closed #${number}: fixed in ${shas}`);
3343
+ console.log(good(`closed #${number}: fixed in ${shas}`));
3322
3344
  await tickListings(number, values.repo);
3323
3345
  return 0;
3324
3346
  }
@@ -3349,7 +3371,7 @@ async function setState(args, usage, wanted) {
3349
3371
  await close(number, values.repo);
3350
3372
  else
3351
3373
  await reopen(number, values.repo);
3352
- console.log(`${wanted === "closed" ? "closed" : "reopened"} #${number}`);
3374
+ console.log(good(`${wanted === "closed" ? "closed" : "reopened"} #${number}`));
3353
3375
  }
3354
3376
  return 0;
3355
3377
  }
@@ -3495,7 +3517,7 @@ ${text}` : body;
3495
3517
  return missing.length > 0 ? appendBoxes(appended, missing) : appended;
3496
3518
  }, values.repo);
3497
3519
  }
3498
- console.log(`edited #${number}`);
3520
+ console.log(good(`edited #${number}`));
3499
3521
  return 0;
3500
3522
  }
3501
3523
  var commentUsage = `ft comment [<n>] [text]
@@ -3519,7 +3541,7 @@ async function commentOn(args) {
3519
3541
 
3520
3542
  ${commentUsage}`);
3521
3543
  await comment(number, text, values.repo);
3522
- console.log(`commented on #${number}`);
3544
+ console.log(good(`commented on #${number}`));
3523
3545
  return 0;
3524
3546
  }
3525
3547
 
@@ -3666,28 +3688,59 @@ async function logs2(args) {
3666
3688
  printJson({ ...ciJson([run], shown.filter((job) => job.status === "failure").map((job) => ({ name: job.name, run: run.id, workflow: run.workflow_id, excerpt: job.excerpt }))), jobs: shown });
3667
3689
  return 0;
3668
3690
  }
3669
- console.log(`${run.workflow_id} run ${run.id} on ${run.prettyref} (${run.commit_sha.slice(0, 7)}): ${badge(run.status, process.stdout)}, ${run.html_url}`);
3691
+ console.log(`${paint(process.stdout).bold(`${run.workflow_id} run ${run.id}`)} on ${run.prettyref} (${run.commit_sha.slice(0, 7)}): ${badge(run.status, process.stdout)}, ${role("path", process.stdout)(run.html_url)}`);
3670
3692
  for (const job of picked) {
3671
3693
  console.log(`
3672
- job ${job.name}: ${badge(job.status, process.stdout)}
3694
+ ${paint(process.stdout).bold(`job ${job.name}`)}: ${badge(job.status, process.stdout)}
3673
3695
  ${await text(job)}`);
3674
3696
  }
3675
3697
  return 0;
3676
3698
  }
3677
3699
 
3678
3700
  // src/commands/milestone.ts
3701
+ import process25 from "process";
3679
3702
  var TITLE_WIDTH3 = 60;
3680
3703
  var LIST_LIMIT = 30;
3704
+ var CONCURRENCY2 = 4;
3681
3705
  function counts(milestone) {
3682
3706
  return `${milestone.open_issues} open, ${milestone.closed_issues} closed`;
3683
3707
  }
3708
+ function progressBar(milestone) {
3709
+ const total = milestone.open_issues + milestone.closed_issues;
3710
+ return takesControlCodes(process25.stdout) ? bar(total === 0 ? 0 : milestone.closed_issues / total, { width: 16 }) : "";
3711
+ }
3712
+ function milestoneCells(each, showState) {
3713
+ const drawn = progressBar(each);
3714
+ 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] : []];
3715
+ }
3716
+ async function printWithIssues(list, repo) {
3717
+ const colors = paint(process25.stdout);
3718
+ const id = role("id", process25.stdout);
3719
+ const issuesOf = await pool(list, CONCURRENCY2, async (each) => Promise.all([openIssues(undefined, repo, each.id), closedIssues(each.id, repo)]));
3720
+ const blocks = list.map((each, index) => {
3721
+ const byNumber = (left, right) => left.number - right.number;
3722
+ const [open, closed] = issuesOf[index].map((found) => found.toSorted(byNumber));
3723
+ const drawn = progressBar(each);
3724
+ const facts = [counts(each), progress(each), dueDate(each) === "" ? "" : `due ${dueDate(each)}`].filter((fact) => fact !== "").join(", ");
3725
+ const lines = [
3726
+ ...open.map((issue) => ` ${id(`#${issue.number}`)} ${truncate(issue.title, TITLE_WIDTH3)}`),
3727
+ ...closed.map((issue) => colors.dim(` #${issue.number} ${truncate(issue.title, TITLE_WIDTH3)} (closed)`))
3728
+ ];
3729
+ return [section(`${each.title}${drawn === "" ? "" : ` ${drawn}`} ${facts}`, undefined, process25.stdout, process25.env, "accent"), ...lines].join(`
3730
+ `);
3731
+ });
3732
+ console.log(blocks.join(`
3733
+
3734
+ `));
3735
+ }
3684
3736
  var listUsage = `ft milestones
3685
3737
 
3686
- 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.
3738
+ 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.
3687
3739
 
3688
3740
  Exits 0 when it listed them, 1 when Forgejo refuses, 2 on a usage error.`;
3689
3741
  var listOptions = {
3690
3742
  state: { type: "string", description: "open (the default), closed or all" },
3743
+ issues: { type: "boolean", short: "i", description: "list the open and closed issues of each milestone by title" },
3691
3744
  ...limitOptions(LIST_LIMIT),
3692
3745
  json: jsonOption("id, title, state, description, open, closed, due (YYYY-MM-DD or null)"),
3693
3746
  ...repoOption
@@ -3700,6 +3753,8 @@ async function milestones(args) {
3700
3753
  fail(`--state takes open, closed or all, not ${state}`);
3701
3754
  const limit = limitOf(values, LIST_LIMIT);
3702
3755
  const found = await listMilestones(state, values.repo);
3756
+ if (values.issues === true && values.json === true)
3757
+ fail("--issues lists for a person, --json has the counts only");
3703
3758
  if (values.json === true) {
3704
3759
  printJson(found.slice(0, limit).map((each) => ({ id: each.id, title: each.title, state: each.state, description: each.description, open: each.open_issues, closed: each.closed_issues, due: dueDate(each) || null })));
3705
3760
  return 0;
@@ -3709,9 +3764,10 @@ async function milestones(args) {
3709
3764
  return 0;
3710
3765
  }
3711
3766
  const { shown, footer } = capped(found, limit);
3712
- const showState = state === "all";
3713
- const rows = shown.map((each) => [String(each.id), truncate(each.title, TITLE_WIDTH3), `${each.open_issues} open`, `${each.closed_issues} closed`, progress(each), dueDate(each) === "" ? "" : `due ${dueDate(each)}`, ...showState ? [each.state] : []]);
3714
- console.log(table(rows));
3767
+ if (values.issues === true)
3768
+ await printWithIssues(shown, values.repo);
3769
+ else
3770
+ console.log(table(shown.map((each) => milestoneCells(each, state === "all"))));
3715
3771
  if (footer !== undefined)
3716
3772
  console.log(footer);
3717
3773
  return 0;
@@ -3767,7 +3823,7 @@ ${closeUsage2}`);
3767
3823
  ${open.map((issue) => ` #${issue.number} ${truncate(issue.title, TITLE_WIDTH3)}`).join(`
3768
3824
  `)}`, 1, `${runHint(`ft milestone close ${found.title} --force`, "close it with them open")}, or move them with \`ft edit <n> -m <milestone>\``);
3769
3825
  await closeMilestone(found.id, values.repo);
3770
- console.log(`closed milestone ${found.title}`);
3826
+ console.log(good(`closed milestone ${found.title}`));
3771
3827
  return 0;
3772
3828
  }
3773
3829
  var showUsage = `ft milestone <title|id>
@@ -3931,12 +3987,12 @@ async function carry(args) {
3931
3987
  function report(plan, added, skipped) {
3932
3988
  for (const line of added)
3933
3989
  console.log(`#${plan}: ${line}`);
3934
- console.log(`#${plan}: ${added.length} added${skipped === 0 ? "" : `, ${skipped} already listed`}`);
3990
+ console.log(good(`#${plan}: ${added.length} added${skipped === 0 ? "" : `, ${skipped} already listed`}`));
3935
3991
  }
3936
3992
 
3937
3993
  // src/commands/release.ts
3938
3994
  import { basename as basename3, join as join11 } from "path";
3939
- import process24 from "process";
3995
+ import process27 from "process";
3940
3996
  var {$: $2 } = globalThis.Bun;
3941
3997
 
3942
3998
  // src/commands/watch.ts
@@ -4180,12 +4236,12 @@ async function publishable() {
4180
4236
 
4181
4237
  // src/commands/release-plan.ts
4182
4238
  import { basename as basename2, join as join9, relative } from "path";
4183
- import process23 from "process";
4239
+ import process26 from "process";
4184
4240
  async function planOf({ level, dir, prefix }, registry) {
4185
4241
  const file = Bun.file(join9(dir ?? ".", "package.json"));
4186
4242
  const pkg = await file.exists() ? await file.json() : undefined;
4187
- const name = pkg?.name ?? basename2(dir ?? process23.cwd());
4188
- const where = dir === undefined ? "" : ` in ${relative(process23.cwd(), dir) || "."}`;
4243
+ const name = pkg?.name ?? basename2(dir ?? process26.cwd());
4244
+ const where = dir === undefined ? "" : ` in ${relative(process26.cwd(), dir) || "."}`;
4189
4245
  let version;
4190
4246
  let bump;
4191
4247
  if (level === undefined) {
@@ -4430,7 +4486,7 @@ ${push.stderr.trim()}`, signal === undefined ? 1 : exitCodeOf(null, signal));
4430
4486
  if (late !== undefined)
4431
4487
  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));
4432
4488
  say(`pushed ${branch} and ${bumped.map((each) => each.tag).join(", ")}, waiting for their runs`);
4433
- followed = await followRuns((runs) => runs.filter((run) => run.id > before && heads.has(run.commit_sha)), timeout, undefined, NO_RUN2, json ? process24.stderr : process24.stdout, { json });
4489
+ 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 });
4434
4490
  if (followed.code !== 0) {
4435
4491
  report();
4436
4492
  return followed.code;
@@ -4580,7 +4636,7 @@ async function remote(args, home) {
4580
4636
  await restoreOrigin(fetchUrl, pushUrls, changes);
4581
4637
  return fail(`the switched origin does not answer, so the old URLs were put back: ${redactUrl(error instanceof Error ? error.message : String(error))}`, 1);
4582
4638
  }
4583
- console.log("origin switched, and git ls-remote reaches it");
4639
+ console.log(good("origin switched, and git ls-remote reaches it"));
4584
4640
  return 0;
4585
4641
  }
4586
4642
 
@@ -4620,7 +4676,6 @@ async function runs(args) {
4620
4676
  printJson(list.map((run) => ({ id: run.id, number: run.index_in_repo, status: run.status, workflow: run.workflow_id, ref: run.prettyref, event: run.event, sha: run.commit_sha, seconds: runSeconds(run), started: run.started, title: run.title, url: run.html_url })));
4621
4677
  return 0;
4622
4678
  }
4623
- printHeader("ft", "runs");
4624
4679
  if (list.length === 0) {
4625
4680
  console.log("no run");
4626
4681
  return 0;
@@ -4636,7 +4691,7 @@ async function runs(args) {
4636
4691
  }
4637
4692
 
4638
4693
  // src/cli.ts
4639
- process25.exitCode = await runCli({
4694
+ process28.exitCode = await runCli({
4640
4695
  name: "ft",
4641
4696
  about: "Forgejo tools over tea, run from a repository whose origin is on Forgejo",
4642
4697
  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.23.0",
4
+ "version": "0.25.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",
@@ -28,6 +28,6 @@
28
28
  "ft": "$npm_execpath src/cli.ts"
29
29
  },
30
30
  "devDependencies": {
31
- "@kaynooo/cli-kit": "0.28.0"
31
+ "@kaynooo/cli-kit": "0.29.0"
32
32
  }
33
33
  }