@kaynooo/cli-workspace 0.10.2 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/repos-cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // @bun
3
3
 
4
4
  // src/repos-cli.ts
5
- import process20 from "process";
5
+ import process21 from "process";
6
6
 
7
7
  // ../kit/src/advisory.ts
8
8
  var SEVERITIES = ["low", "moderate", "high", "critical"];
@@ -492,7 +492,7 @@ function printJson(value) {
492
492
 
493
493
  // ../kit/src/help.ts
494
494
  import process8 from "process";
495
- var OPTIONAL = /\[[^\]]+\]/g;
495
+ var OPTIONAL = /(?<!\x1B)\[[^\]]+\]/g;
496
496
  var USAGE_PREFIX = /^usage:\s*/i;
497
497
  var FULL_STOP = /\.$/;
498
498
  function usageLine(usage, colors = paint(process8.stdout)) {
@@ -531,29 +531,40 @@ function exampleRows(examples, colors = paint(process8.stdout)) {
531
531
  return [];
532
532
  return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
533
533
  }
534
+ var MAX_INLINE_CHOICES = 24;
534
535
  function optionRows(options, colors = paint(process8.stdout)) {
535
536
  const rows = Object.entries(options).map(([name, option]) => {
536
537
  const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
537
- const named = option.choices === undefined ? "<value>" : `<${option.choices.join("|")}>`;
538
+ const choices = option.choices?.join("|");
539
+ const inline = choices !== undefined && choices.length <= MAX_INLINE_CHOICES;
540
+ const named = inline ? `<${choices}>` : "<value>";
538
541
  const placeholder = option.optional === undefined ? named : `[${named}]`;
539
542
  const value = option.type === "string" ? ` ${colors.dim(placeholder)}` : "";
540
- return { flag: `${short}${colors.cyan(`--${name}`)}${value}`, width: `-x, --${name}`.length + (option.type === "string" ? placeholder.length + 1 : 0), description: option.description ?? "" };
543
+ const described = choices === undefined || inline ? option.description ?? "" : [option.description, `one of ${option.choices.join(", ")}`].filter(Boolean).join("; ");
544
+ return { flag: `${short}${colors.cyan(`--${name}`)}${value}`, width: `-x, --${name}`.length + (option.type === "string" ? placeholder.length + 1 : 0), description: described };
541
545
  });
542
546
  const width = Math.max(0, ...rows.map((row) => row.width));
543
547
  return rows.map((row) => row.description === "" ? ` ${row.flag}` : ` ${row.flag}${" ".repeat(width - row.width)} ${colors.dim(row.description)}`);
544
548
  }
545
549
 
546
550
  // ../kit/src/text.ts
547
- var ANSI = new RegExp(`${String.fromCharCode(27)}\\[[\\d;?]*[a-z]`, "gi");
548
551
  function distance(a, b) {
549
- let previous = Array.from({ length: b.length + 1 }, (_, index) => index);
550
- for (const [i, left] of [...a].entries()) {
552
+ const left = [...a];
553
+ const right = [...b];
554
+ let before = [];
555
+ let previous = Array.from({ length: right.length + 1 }, (_, index) => index);
556
+ for (const [i, x] of left.entries()) {
551
557
  const current = [i + 1];
552
- for (const [j, right] of [...b].entries())
553
- current.push(Math.min((previous[j + 1] ?? 0) + 1, (current[j] ?? 0) + 1, (previous[j] ?? 0) + (left === right ? 0 : 1)));
558
+ for (const [j, y] of right.entries()) {
559
+ let cost = Math.min((previous[j + 1] ?? 0) + 1, (current[j] ?? 0) + 1, (previous[j] ?? 0) + (x === y ? 0 : 1));
560
+ if (i > 0 && j > 0 && x === right[j - 1] && left[i - 1] === y)
561
+ cost = Math.min(cost, (before[j - 1] ?? 0) + 1);
562
+ current.push(cost);
563
+ }
564
+ before = previous;
554
565
  previous = current;
555
566
  }
556
- return previous[b.length] ?? 0;
567
+ return previous[right.length] ?? 0;
557
568
  }
558
569
  function closest(name, names) {
559
570
  const started = names.find((known) => known.startsWith(name));
@@ -620,7 +631,7 @@ class Completing {
620
631
  }
621
632
  var completion = { active: false };
622
633
  var OUTPUT_OPTIONS = {
623
- color: { type: "string", description: "auto (on a terminal alone), always or never" },
634
+ color: { type: "string", choices: ["auto", "always", "never"], description: "auto (the default) colours on a terminal alone" },
624
635
  plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
625
636
  };
626
637
  function applyOutput(color, plain, env = process9.env) {
@@ -955,13 +966,91 @@ async function runTool(label, argv, { timeoutMs, cwd, onStart } = {}) {
955
966
  // ../kit/src/cli.ts
956
967
  import { readFileSync as readFileSync4, realpathSync as realpathSync2 } from "fs";
957
968
  import { dirname as dirname3, join as join5 } from "path";
958
- import process14 from "process";
969
+ import process15 from "process";
970
+
971
+ // ../kit/src/completions.ts
972
+ var COMPLETION_SHELLS = ["fish", "bash", "zsh"];
973
+ var FISH_FUNCTION = `functions -q __kaynooo_cli_complete; or function __kaynooo_cli_complete --argument-names bin --description 'what a @kaynooo/cli-kit bin offers for the word being typed'
974
+ set -l tokens (commandline -xpc 2>/dev/null; or commandline -opc)
975
+ set -l current (commandline -ct)
976
+ for line in ($bin __complete $tokens[2..-1] $current 2>/dev/null)
977
+ if test "$line" = __files__
978
+ __fish_complete_path $current
979
+ else
980
+ echo $line
981
+ end
982
+ end
983
+ end`;
984
+ var BASH_FUNCTION = `__kaynooo_cli_complete() {
985
+ local IFS=$'\\n' cur=\${COMP_WORDS[COMP_CWORD]} line words=
986
+ local -a lines
987
+ COMPREPLY=()
988
+ lines=($("\${COMP_WORDS[0]}" __complete "\${COMP_WORDS[@]:1:COMP_CWORD}" 2>/dev/null))
989
+ for line in "\${lines[@]}"; do
990
+ if [[ $line == __files__ ]]; then
991
+ COMPREPLY+=($(compgen -f -- "$cur"))
992
+ else
993
+ words+="\${line%%$'\\t'*}"$'\\n'
994
+ fi
995
+ done
996
+ COMPREPLY+=($(compgen -W "$words" -- "$cur"))
997
+ }`;
998
+ var ZSH_FUNCTION = `__kaynooo_cli_complete() {
999
+ local line
1000
+ local -a described plain
1001
+ for line in \${(f)"$("\${words[1]}" __complete "\${(@)words[2,CURRENT]}" 2>/dev/null)"}; do
1002
+ if [[ $line == __files__ ]]; then
1003
+ _files
1004
+ elif [[ $line == *$'\\t'* ]]; then
1005
+ described+=("\${\${line%%$'\\t'*}//:/\\\\:}:\${line#*$'\\t'}")
1006
+ else
1007
+ plain+=("$line")
1008
+ fi
1009
+ done
1010
+ (( \${#described} )) && _describe -V value described
1011
+ (( \${#plain} )) && compadd -- "\${plain[@]}"
1012
+ return 0
1013
+ }`;
1014
+ function completionScript(shell, bins, header = `# Generated by \`${bins[0]} --completions ${shell}\``) {
1015
+ if (shell === "fish")
1016
+ return `${header}
1017
+ ${FISH_FUNCTION}
1018
+ ${bins.map((bin) => `complete -c ${bin} -f -a '(__kaynooo_cli_complete ${bin})'
1019
+ `).join("")}`;
1020
+ if (shell === "bash")
1021
+ return `${header}
1022
+ ${BASH_FUNCTION}
1023
+ complete -F __kaynooo_cli_complete ${bins.join(" ")}
1024
+ `;
1025
+ return `${header}
1026
+ ${ZSH_FUNCTION}
1027
+ compdef __kaynooo_cli_complete ${bins.join(" ")}
1028
+ `;
1029
+ }
1030
+
1031
+ // ../kit/src/notify.ts
1032
+ import process13 from "process";
1033
+ var NOTIFY_AFTER_MS = 1e4;
1034
+ var CANCELLED = 130;
1035
+ function base64(text) {
1036
+ return Buffer.from(text).toString("base64");
1037
+ }
1038
+ function notification(title, body, env = process13.env) {
1039
+ const id = `kit${process13.pid}`;
1040
+ 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\\`];
1041
+ return codes.map((code) => env.TMUX === undefined || env.TMUX === "" ? code : `\x1BPtmux;${code.replaceAll("\x1B", "\x1B\x1B")}\x1B\\`).join("");
1042
+ }
1043
+ function notifyEnd(command, code, ms, { stream = process13.stderr, env = process13.env } = {}) {
1044
+ if (ms < NOTIFY_AFTER_MS || code === CANCELLED || outputMode(stream, env) !== "terminal")
1045
+ return;
1046
+ stream.write(notification(command, code === 0 ? `done in ${formatDuration(ms)}` : `failed with exit ${code} after ${formatDuration(ms)}`, env));
1047
+ }
959
1048
 
960
1049
  // ../kit/src/usage.ts
961
1050
  import { appendFileSync, mkdirSync } from "fs";
962
1051
  import { homedir as homedir3 } from "os";
963
1052
  import { dirname as dirname2, isAbsolute, join as join4 } from "path";
964
- import process13 from "process";
1053
+ import process14 from "process";
965
1054
 
966
1055
  // ../kit/src/logs.ts
967
1056
  var DAY_MS = 24 * 60 * 60 * 1000;
@@ -975,14 +1064,14 @@ var usageError;
975
1064
  function noteUsageError(message) {
976
1065
  usageError = message;
977
1066
  }
978
- function stateHome(env = process13.env) {
1067
+ function stateHome(env = process14.env) {
979
1068
  const dir = env.XDG_STATE_HOME;
980
1069
  return dir !== undefined && isAbsolute(dir) ? dir : join4(homedir3(), ".local", "state");
981
1070
  }
982
- function usagePath(env = process13.env) {
1071
+ function usagePath(env = process14.env) {
983
1072
  return join4(stateHome(env), CLI_FOLDER, "usage.jsonl");
984
1073
  }
985
- function usageRecorded(env = process13.env) {
1074
+ function usageRecorded(env = process14.env) {
986
1075
  const off = env.KAYNOOO_CLI_NO_USAGE;
987
1076
  return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
988
1077
  }
@@ -996,7 +1085,7 @@ function usageEntry(bin, command, argv, code, now = new Date) {
996
1085
  usageError = undefined;
997
1086
  return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
998
1087
  }
999
- function recordUsage(entry, env = process13.env) {
1088
+ function recordUsage(entry, env = process14.env) {
1000
1089
  if (!usageRecorded(env))
1001
1090
  return;
1002
1091
  try {
@@ -1012,7 +1101,11 @@ var LEVEL_OPTIONS = {
1012
1101
  ...OUTPUT_OPTIONS,
1013
1102
  help: { type: "boolean", short: "h", description: "show this help" }
1014
1103
  };
1015
- var TOP_OPTIONS = { ...LEVEL_OPTIONS, version: { type: "boolean", short: "v", description: "print the version" } };
1104
+ var TOP_OPTIONS = {
1105
+ ...LEVEL_OPTIONS,
1106
+ version: { type: "boolean", short: "v", description: "print the version" },
1107
+ completions: { type: "string", choices: COMPLETION_SHELLS, description: "print the shell completion script" }
1108
+ };
1016
1109
  async function commandRows(all, colors) {
1017
1110
  const commands = shown(all);
1018
1111
  const width = Math.max(0, ...Object.keys(commands).map((name) => name.length));
@@ -1086,8 +1179,8 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
1086
1179
  `);
1087
1180
  }
1088
1181
  function printError(prefix, message, hint, cause) {
1089
- const colors = paint(process14.stderr);
1090
- const styled = takesControlCodes(process14.stderr);
1182
+ const colors = paint(process15.stderr);
1183
+ const styled = takesControlCodes(process15.stderr);
1091
1184
  const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
1092
1185
  const under = (label, text, tint) => text === undefined ? "" : `
1093
1186
  ${styled ? tint(label) : `${label}:`} ${text}`;
@@ -1130,11 +1223,11 @@ async function dispatch(level, typed, { version, redact }) {
1130
1223
  }
1131
1224
  }
1132
1225
  if (name === undefined && level.path.length > 1) {
1133
- console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process14.stderr));
1226
+ console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process15.stderr));
1134
1227
  return 2;
1135
1228
  }
1136
1229
  if (name === undefined || name === "help" || name === "--help" || name === "-h") {
1137
- console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process14.stdout));
1230
+ console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process15.stdout));
1138
1231
  return 0;
1139
1232
  }
1140
1233
  if (level.path.length === 1 && (name === "--version" || name === "-v")) {
@@ -1245,6 +1338,19 @@ async function candidates(scope, defaultCommand, words, before = []) {
1245
1338
  }
1246
1339
  return "commands" in command ? candidates(scopeOf(command.commands, command.extraCommands, command.aliases), undefined, rest, [...before, word]) : leafCandidates(command.run, rest);
1247
1340
  }
1341
+ var COMPLETIONS = "--completions";
1342
+ function flagValue([flag = "", ...rest]) {
1343
+ return flag.includes("=") ? [flag.slice(flag.indexOf("=") + 1), ...rest] : rest;
1344
+ }
1345
+ function printCompletionScript(name, args) {
1346
+ const shell = COMPLETION_SHELLS.find((each) => each === args[0]);
1347
+ if (shell === undefined || args.length !== 1) {
1348
+ printError(name, `${COMPLETIONS} takes one of ${COMPLETION_SHELLS.join(", ")}`, `${name} ${COMPLETIONS} fish`);
1349
+ return 2;
1350
+ }
1351
+ console.log(completionScript(shell, [name]).trimEnd());
1352
+ return 0;
1353
+ }
1248
1354
  async function printCandidates(found) {
1249
1355
  for (const line of await found)
1250
1356
  console.log(line);
@@ -1269,10 +1375,15 @@ async function runCli(cli, argv = scriptArgs()) {
1269
1375
  const version = cli.version ?? packageVersion();
1270
1376
  if (argv[0] === COMPLETE)
1271
1377
  return printCandidates(candidates(scopeOf(cli.commands, cli.extraCommands, cli.aliases), cli.defaultCommand, argv.slice(1)));
1378
+ if (argv[0] === COMPLETIONS || argv[0]?.startsWith(`${COMPLETIONS}=`) === true)
1379
+ return printCompletionScript(cli.name, flagValue(argv));
1380
+ const started = performance.now();
1272
1381
  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 });
1382
+ const command = commandPath(scopeOf(cli.commands, cli.extraCommands, cli.aliases), argv);
1383
+ notifyEnd(command === undefined ? cli.name : `${cli.name} ${command}`, code, performance.now() - started);
1273
1384
  if (cli.usage !== false) {
1274
1385
  try {
1275
- recordUsage(usageEntry(cli.name, commandPath(scopeOf(cli.commands, cli.extraCommands, cli.aliases), argv), argv, code));
1386
+ recordUsage(usageEntry(cli.name, command, argv, code));
1276
1387
  } catch {}
1277
1388
  }
1278
1389
  return code;
@@ -1295,16 +1406,20 @@ function commandPath(scope, argv) {
1295
1406
  async function runMain({ name, version, run, redact, usage }, argv = scriptArgs()) {
1296
1407
  if (argv[0] === COMPLETE)
1297
1408
  return printCandidates(leafCandidates(run, argv.slice(1)));
1409
+ if (argv[0] === COMPLETIONS || argv[0]?.startsWith(`${COMPLETIONS}=`) === true)
1410
+ return printCompletionScript(name, flagValue(argv));
1298
1411
  if (argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v")) {
1299
1412
  console.log(version ?? packageVersion());
1300
1413
  return 0;
1301
1414
  }
1302
1415
  let code;
1416
+ const started = performance.now();
1303
1417
  try {
1304
1418
  code = await run(argv);
1305
1419
  } catch (error) {
1306
1420
  code = reportThrown(name, error, redact, wantsJson(argv));
1307
1421
  }
1422
+ notifyEnd(name, code, performance.now() - started);
1308
1423
  if (usage !== false) {
1309
1424
  try {
1310
1425
  recordUsage(usageEntry(name, undefined, argv, code));
@@ -1344,7 +1459,7 @@ function parseSize(text, bareUnit = 1) {
1344
1459
  return Math.round(Number(match[1]) * (suffix === "" ? bareUnit : 1024 ** POWERS[suffix]));
1345
1460
  }
1346
1461
  // ../kit/src/watch.ts
1347
- import process15 from "process";
1462
+ import process16 from "process";
1348
1463
  import { format } from "util";
1349
1464
  var CLEAR_SCREEN = "\x1B[H\x1B[2J";
1350
1465
  var DEFAULT_SECONDS = 2;
@@ -1366,7 +1481,7 @@ function withoutWatch(args) {
1366
1481
  }
1367
1482
  return rest;
1368
1483
  }
1369
- async function watching(value, step, stream = process15.stdout, sleep = Bun.sleep, rounds = Number.POSITIVE_INFINITY) {
1484
+ async function watching(value, step, stream = process16.stdout, sleep = Bun.sleep, rounds = Number.POSITIVE_INFINITY) {
1370
1485
  const interval = value === "" ? DEFAULT_SECONDS * 1000 : duration(value, "watch", DEFAULT_SECONDS * 1000);
1371
1486
  if (!takesControlCodes(stream))
1372
1487
  badUsage("--watch redraws the screen, so it needs a terminal");
@@ -1374,12 +1489,12 @@ async function watching(value, step, stream = process15.stdout, sleep = Bun.slee
1374
1489
  for (let round = 0;round < rounds; round++) {
1375
1490
  const held = [];
1376
1491
  const { log, info } = console;
1377
- const write = process15.stdout.write.bind(process15.stdout);
1492
+ const write = process16.stdout.write.bind(process16.stdout);
1378
1493
  const hold = (...parts) => void held.push(`${format(...parts)}
1379
1494
  `);
1380
1495
  console.log = hold;
1381
1496
  console.info = hold;
1382
- process15.stdout.write = (text) => {
1497
+ process16.stdout.write = (text) => {
1383
1498
  held.push(typeof text === "string" ? text : Buffer.from(text).toString());
1384
1499
  return true;
1385
1500
  };
@@ -1388,7 +1503,7 @@ async function watching(value, step, stream = process15.stdout, sleep = Bun.slee
1388
1503
  } finally {
1389
1504
  console.log = log;
1390
1505
  console.info = info;
1391
- process15.stdout.write = write;
1506
+ process16.stdout.write = write;
1392
1507
  }
1393
1508
  stream.write(`${CLEAR_SCREEN}${held.join("")}`);
1394
1509
  await sleep(interval);
@@ -1398,7 +1513,7 @@ async function watching(value, step, stream = process15.stdout, sleep = Bun.slee
1398
1513
  // ../kit/src/workspace-root.ts
1399
1514
  import { homedir as homedir4 } from "os";
1400
1515
  import { dirname as dirname4, join as join6, resolve as resolve4 } from "path";
1401
- import process16 from "process";
1516
+ import process17 from "process";
1402
1517
  function expandHome(path, home) {
1403
1518
  if (path === "~")
1404
1519
  return home;
@@ -1408,20 +1523,20 @@ function configured(env, home) {
1408
1523
  const folder = readUserConfig("config", { home, xdg: env.XDG_CONFIG_HOME }).workspace;
1409
1524
  return typeof folder === "string" && folder !== "" ? folder : undefined;
1410
1525
  }
1411
- function workspaceRoot({ given, env = process16.env, home = homedir4() } = {}) {
1526
+ function workspaceRoot({ given, env = process17.env, home = homedir4() } = {}) {
1412
1527
  const fromEnv = env.KAYNOOO_WORKSPACE === "" ? undefined : env.KAYNOOO_WORKSPACE;
1413
1528
  return resolve4(expandHome(given ?? fromEnv ?? configured(env, home) ?? join6(home, "Workspace"), home));
1414
1529
  }
1415
1530
  // src/repos.ts
1416
1531
  import { existsSync as existsSync5, statSync as statSync2 } from "fs";
1417
1532
  import { basename as basename2, relative } from "path";
1418
- import process19 from "process";
1533
+ import process20 from "process";
1419
1534
 
1420
1535
  // src/repos-scan.ts
1421
1536
  import { existsSync as existsSync4 } from "fs";
1422
1537
  import { readdir } from "fs/promises";
1423
1538
  import { basename, join as join7 } from "path";
1424
- import process18 from "process";
1539
+ import process19 from "process";
1425
1540
  var MAX_DEPTH = 3;
1426
1541
  var CONCURRENCY = 8;
1427
1542
  var PACKAGE_CONCURRENCY = 4;
@@ -1468,7 +1583,7 @@ async function findRepos(root, skip) {
1468
1583
  }
1469
1584
  async function read(path, args, timeoutMs = GIT_MS) {
1470
1585
  try {
1471
- const ran = await runCommand(["git", "--no-optional-locks", ...args], { cwd: path, env: { ...process18.env, GIT_TERMINAL_PROMPT: "0" }, timeoutMs });
1586
+ const ran = await runCommand(["git", "--no-optional-locks", ...args], { cwd: path, env: { ...process19.env, GIT_TERMINAL_PROMPT: "0" }, timeoutMs });
1472
1587
  return ran.code === 0 && !ran.timedOut ? ran.text.trim() : undefined;
1473
1588
  } catch {
1474
1589
  return;
@@ -1545,7 +1660,7 @@ function firstLine(text) {
1545
1660
  }
1546
1661
  async function fastForward(path) {
1547
1662
  try {
1548
- const ran = await runCommand(["git", "--no-optional-locks", "merge", "--ff-only", "--quiet", "@{upstream}"], { cwd: path, env: { ...process18.env, GIT_TERMINAL_PROMPT: "0" }, timeoutMs: GIT_MS });
1663
+ const ran = await runCommand(["git", "--no-optional-locks", "merge", "--ff-only", "--quiet", "@{upstream}"], { cwd: path, env: { ...process19.env, GIT_TERMINAL_PROMPT: "0" }, timeoutMs: GIT_MS });
1549
1664
  if (ran.timedOut)
1550
1665
  return "timed out";
1551
1666
  return ran.code === 0 ? undefined : firstLine(ran.text.trim()) || `exit ${ran.code}`;
@@ -1588,7 +1703,7 @@ function releasedCell(repo) {
1588
1703
  return repo.packages.filter((release) => release.unreleased > 0).map((release) => `${release.name} ${release.unreleased}`).join(", ") || "-";
1589
1704
  return repo.tag === null || repo.unreleased === 0 ? "-" : `${repo.unreleased} since ${repo.tag}`;
1590
1705
  }
1591
- function syncCell(repo, stream = process19.stdout) {
1706
+ function syncCell(repo, stream = process20.stdout) {
1592
1707
  const colors = paint(stream);
1593
1708
  const ahead = repo.ahead ?? 0;
1594
1709
  const behind = repo.behind ?? 0;
@@ -1599,7 +1714,7 @@ function syncCell(repo, stream = process19.stdout) {
1599
1714
  return parts.length === 0 ? colors.dim("-") : `${parts.join(" ")}${diverged ? colors.yellow(" diverged") : ""}`;
1600
1715
  }
1601
1716
  var DEFAULT_BRANCHES = new Set(["main", "master"]);
1602
- function branchCell(repo, stream = process19.stdout) {
1717
+ function branchCell(repo, stream = process20.stdout) {
1603
1718
  const colors = paint(stream);
1604
1719
  if (repo.unreadable)
1605
1720
  return colors.red("? (unreadable)");
@@ -1608,8 +1723,8 @@ function branchCell(repo, stream = process19.stdout) {
1608
1723
  return DEFAULT_BRANCHES.has(repo.branch) ? repo.branch : role("accent", stream)(repo.branch);
1609
1724
  }
1610
1725
  function row(repo, shown) {
1611
- const colors = paint(process19.stdout);
1612
- const tint = role("path", process19.stdout);
1726
+ const colors = paint(process20.stdout);
1727
+ const tint = role("path", process20.stdout);
1613
1728
  const unreleased = releasedCell(repo);
1614
1729
  return [
1615
1730
  tint(shown),
@@ -1627,7 +1742,7 @@ async function repos(args) {
1627
1742
  const root = workspaceRoot({ given: positionals[0] });
1628
1743
  if (!existsSync5(root) || !statSync2(root).isDirectory())
1629
1744
  fail(`no folder ${root}`);
1630
- const only = values.only === undefined ? undefined : oneOf(values.only, "only", REASONS);
1745
+ const only = values.only;
1631
1746
  const paths = await findRepos(root, await skipped());
1632
1747
  const states = await pool(paths, configuredNumber("repos", "concurrency", CONCURRENCY), async (path) => inspect(path, values.fetch === true || values.pull === true));
1633
1748
  const keeps = (repo) => {
@@ -1643,12 +1758,12 @@ async function repos(args) {
1643
1758
  const blocker = pullBlocker(repo);
1644
1759
  const refused = blocker === undefined ? await fastForward(repo.path) : undefined;
1645
1760
  if (blocker !== undefined) {
1646
- log(marked("note", `${repo.name} skipped`, process19.stdout, blocker));
1761
+ log(marked("note", `${repo.name} skipped`, process20.stdout, blocker));
1647
1762
  } else if (refused !== undefined) {
1648
1763
  failedPulls++;
1649
- log(marked("problem", `${repo.name} not pulled`, process19.stdout, refused));
1764
+ log(marked("problem", `${repo.name} not pulled`, process20.stdout, refused));
1650
1765
  } else {
1651
- log(marked("ok", `${repo.name} pulled`, process19.stdout, `${repo.behind} ${repo.behind === 1 ? "commit" : "commits"}`));
1766
+ log(marked("ok", `${repo.name} pulled`, process20.stdout, `${repo.behind} ${repo.behind === 1 ? "commit" : "commits"}`));
1652
1767
  states[index] = await inspect(repo.path, false);
1653
1768
  }
1654
1769
  }
@@ -1663,7 +1778,7 @@ async function repos(args) {
1663
1778
  printJson(kept.map((repo) => ({ ...repo, reasons: reasonsOf(repo) })));
1664
1779
  return failedPulls > 0 ? 1 : 0;
1665
1780
  }
1666
- const label = role("label", process19.stdout);
1781
+ const label = role("label", process20.stdout);
1667
1782
  printHeader("repos", `${basename2(root)} \xB7 ${states.length} ${states.length === 1 ? "repository" : "repositories"}`);
1668
1783
  if (kept.length === 0) {
1669
1784
  console.log(label(`nothing needs attention in ${states.length} repositories`));
@@ -1679,4 +1794,4 @@ async function repos(args) {
1679
1794
  }
1680
1795
 
1681
1796
  // src/repos-cli.ts
1682
- process20.exitCode = await runMain({ name: "repos", run: repos });
1797
+ process21.exitCode = await runMain({ name: "repos", run: repos });