@kaynooo/cli-check 0.14.0 → 0.16.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.
package/dist/cli.js CHANGED
@@ -2,16 +2,37 @@
2
2
  // @bun
3
3
 
4
4
  // src/cli.ts
5
- import process19 from "process";
5
+ import process20 from "process";
6
6
  // ../kit/src/args.ts
7
- import process9 from "process";
7
+ import process10 from "process";
8
8
  import { parseArgs } from "util";
9
9
 
10
10
  // ../kit/src/format.ts
11
- import process6 from "process";
11
+ import process7 from "process";
12
+
13
+ // ../kit/src/mode.ts
14
+ import process2 from "process";
15
+ var MODES = new Set(["terminal", "ci", "agent", "pipe"]);
16
+ var AGENT_VARIABLES = ["CLAUDECODE", "AI_AGENT"];
17
+ function isSet(value) {
18
+ return value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
19
+ }
20
+ function outputMode(stream = process2.stdout, env = process2.env) {
21
+ const chosen = env.KIT_MODE;
22
+ if (chosen !== undefined && MODES.has(chosen))
23
+ return chosen;
24
+ if (AGENT_VARIABLES.some((name) => isSet(env[name])))
25
+ return "agent";
26
+ if (stream.isTTY === true)
27
+ return "terminal";
28
+ return isSet(env.CI) ? "ci" : "pipe";
29
+ }
30
+ function isInteractive(streams = process2) {
31
+ return streams.stdin?.isTTY === true && streams.stderr?.isTTY === true;
32
+ }
12
33
 
13
34
  // ../kit/src/style.ts
14
- import process5 from "process";
35
+ import process6 from "process";
15
36
 
16
37
  // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-mtetydvc.js
17
38
  function x(s) {
@@ -278,13 +299,13 @@ var t = le();
278
299
  import { existsSync as existsSync2, readFileSync, statSync } from "fs";
279
300
  import { homedir as homedir2 } from "os";
280
301
  import { join as join3, resolve as resolve2 } from "path";
281
- import process4 from "process";
302
+ import process5 from "process";
282
303
 
283
304
  // ../kit/src/config.ts
284
305
  import { existsSync } from "fs";
285
306
  import { dirname, join, resolve } from "path";
286
- import process2 from "process";
287
- function findUp(names, from = process2.cwd(), stop = () => false) {
307
+ import process3 from "process";
308
+ function findUp(names, from = process3.cwd(), stop = () => false) {
288
309
  const wanted = typeof names === "string" ? [names] : names;
289
310
  for (let dir = resolve(from);; dir = dirname(dir)) {
290
311
  const found = wanted.map((name) => join(dir, name)).find((path) => existsSync(path));
@@ -298,9 +319,9 @@ function findUp(names, from = process2.cwd(), stop = () => false) {
298
319
  // ../kit/src/user-config.ts
299
320
  import { homedir } from "os";
300
321
  import { join as join2 } from "path";
301
- import process3 from "process";
322
+ import process4 from "process";
302
323
  function configBase(where = {}) {
303
- const xdg = where.xdg ?? (where.home === undefined ? process3.env.XDG_CONFIG_HOME : undefined);
324
+ const xdg = where.xdg ?? (where.home === undefined ? process4.env.XDG_CONFIG_HOME : undefined);
304
325
  return xdg !== undefined && xdg !== "" ? xdg : join2(where.home ?? homedir(), ".config");
305
326
  }
306
327
  function userConfigPath(bin, where = {}) {
@@ -333,10 +354,30 @@ function isColorSpec(spec) {
333
354
  return Number.isInteger(spec) && spec >= 0 && spec <= 255;
334
355
  return typeof spec === "string" && spec.trim() !== "" && spec.trim().split(SPACES).every((token) => STYLES.has(token) || HEX.test(token));
335
356
  }
336
- function tinted(colors, spec) {
357
+ var CUBE = [0, 95, 135, 175, 215, 255];
358
+ function cubeLevel(channel) {
359
+ return CUBE.reduce((best, value, level) => Math.abs(value - channel) < Math.abs(CUBE[best] - channel) ? level : best, 0);
360
+ }
361
+ function nearest256(hex) {
362
+ const rgb = [1, 3, 5].map((at) => Number.parseInt(hex.slice(at, at + 2), 16));
363
+ const levels = rgb.map(cubeLevel);
364
+ const cube = levels.map((level) => CUBE[level]);
365
+ const grey = Math.min(23, Math.max(0, Math.round((rgb.reduce((sum, channel) => sum + channel, 0) / 3 - 8) / 10)));
366
+ const greyValue = 8 + grey * 10;
367
+ const distance = (colour) => colour.reduce((sum, channel, at) => sum + (channel - rgb[at]) ** 2, 0);
368
+ return distance([greyValue, greyValue, greyValue]) < distance(cube) ? 232 + grey : 16 + 36 * levels[0] + 6 * levels[1] + levels[2];
369
+ }
370
+ function hasTrueColor(env) {
371
+ return env.COLORTERM === "truecolor" || env.COLORTERM === "24bit";
372
+ }
373
+ function tinted(colors, spec, env = process5.env) {
337
374
  if (typeof spec === "number")
338
375
  return colors.ansi256(spec);
339
- return spec.trim().split(SPACES).reduce((chain, token) => HEX.test(token) ? chain.hex(token) : chain[token] ?? chain, colors);
376
+ return spec.trim().split(SPACES).reduce((chain, token) => {
377
+ if (HEX.test(token))
378
+ return hasTrueColor(env) ? chain.hex(token) : chain.ansi256(nearest256(token));
379
+ return chain[token] ?? chain;
380
+ }, colors);
340
381
  }
341
382
  function isRecord(value) {
342
383
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -420,7 +461,7 @@ function warnOnce(message) {
420
461
  function isPath(chosen) {
421
462
  return chosen.includes("/") || chosen.endsWith(".json");
422
463
  }
423
- function loadTheme({ env = process4.env, from = process4.cwd(), home = homedir2(), warn = warnOnce } = {}) {
464
+ function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(), warn = warnOnce } = {}) {
424
465
  const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null) };
425
466
  const sources = [];
426
467
  const chosen = env.KIT_THEME ?? "";
@@ -450,7 +491,7 @@ function loadTheme({ env = process4.env, from = process4.cwd(), home = homedir2(
450
491
  var current;
451
492
  var currentKey = "";
452
493
  function activeTheme() {
453
- const key = `${process4.cwd()}\x00${process4.env.KIT_THEME ?? ""}\x00${process4.env.XDG_CONFIG_HOME ?? ""}`;
494
+ const key = `${process5.cwd()}\x00${process5.env.KIT_THEME ?? ""}\x00${process5.env.XDG_CONFIG_HOME ?? ""}`;
454
495
  if (current === undefined || key !== currentKey) {
455
496
  current = loadTheme();
456
497
  currentKey = key;
@@ -460,44 +501,44 @@ function activeTheme() {
460
501
 
461
502
  // ../kit/src/style.ts
462
503
  var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:" };
463
- function takesControlCodes(stream, env = process5.env) {
464
- return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb";
504
+ function takesControlCodes(stream, env = process6.env) {
505
+ return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
465
506
  }
466
- function paint(stream, env = process5.env) {
507
+ function paint(stream, env = process6.env) {
467
508
  return le({ stream: { isTTY: takesControlCodes(stream, env) }, env });
468
509
  }
469
- function marked(mark, text, stream, detail, env = process5.env) {
510
+ function marked(mark, text, stream, detail, env = process6.env) {
470
511
  const colors = paint(stream, env);
471
512
  let head = MARK_WORDS[mark];
472
513
  if (takesControlCodes(stream, env)) {
473
514
  const { theme } = activeTheme();
474
- head = tinted(colors.bold, theme.colors[mark])(theme.glyphs[mark]);
515
+ head = tinted(colors.bold, theme.colors[mark], env)(theme.glyphs[mark]);
475
516
  }
476
517
  return `${head} ${text}${detail === undefined ? "" : ` ${colors.dim(detail)}`}`;
477
518
  }
478
519
  function warn(text, detail) {
479
- console.error(marked("warn", text, process5.stderr, detail));
520
+ console.error(marked("warn", text, process6.stderr, detail));
480
521
  }
481
- function role(name, stream, env = process5.env) {
522
+ function role(name, stream, env = process6.env) {
482
523
  const colors = paint(stream, env);
483
- return takesControlCodes(stream, env) ? tinted(colors, activeTheme().theme.colors[name]) : colors;
524
+ return takesControlCodes(stream, env) ? tinted(colors, activeTheme().theme.colors[name], env) : colors;
484
525
  }
485
526
  var STATUS_WORDS = {
486
527
  passed: ["passed", "success", "succeeded", "ok"],
487
528
  failed: ["failed", "failure", "error", "errored"],
488
- running: ["running", "in_progress", "started"],
529
+ running: ["running", "in_progress", "started", "holding"],
489
530
  queued: ["queued", "waiting", "pending", "created", "blocked", "scheduled"],
490
531
  skipped: ["skipped", "cancelled", "canceled", "manual"]
491
532
  };
492
533
  var STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
493
- function header(bin, context, stream, env = process5.env) {
534
+ function header(bin, context, stream, env = process6.env) {
494
535
  if (!takesControlCodes(stream, env))
495
536
  return "";
496
537
  const colors = paint(stream, env);
497
538
  const hash = [...bin].reduce((sum, char) => sum + char.charCodeAt(0), 0);
498
539
  const { theme } = activeTheme();
499
540
  const spec = theme.bins[bin] ?? theme.accents[hash % theme.accents.length];
500
- const accent = tinted(typeof spec === "string" && spec.split(" ").includes("bold") ? colors : colors.bold, spec);
541
+ const accent = tinted(typeof spec === "string" && spec.split(" ").includes("bold") ? colors : colors.bold, spec, env);
501
542
  return `${accent(bin)}${context === undefined ? "" : colors.dim(` \u203A ${context}`)}`;
502
543
  }
503
544
 
@@ -531,8 +572,11 @@ var ESCAPE = String.fromCharCode(27);
531
572
  function textWidth(text) {
532
573
  return Bun.stringWidth(text);
533
574
  }
534
- function table(rows, { cellWidth, header = false, align = [], fit, stream = process6.stdout } = {}) {
575
+ function table(rows, { cellWidth, header = false, align = [], fit, stream = process7.stdout, env = process7.env } = {}) {
535
576
  const cells = cellWidth === undefined ? rows : rows.map((row) => row.map((cell) => truncate(cell.replaceAll(LINE_BREAKS, " "), cellWidth)));
577
+ if (outputMode(stream, env) === "agent")
578
+ return cells.map((row) => row.map((cell) => Bun.stripANSI(cell).replaceAll(/[\t\r\n]+/g, " ")).join("\t")).join(`
579
+ `);
536
580
  const widths = [];
537
581
  for (const row of cells) {
538
582
  for (const [index, cell] of row.entries())
@@ -567,32 +611,35 @@ function narrow(rows, widths, limit) {
567
611
  }
568
612
  return rows.map((row) => row.map((cell, index) => textWidth(cell) > (widths[index] ?? 0) ? truncate(cell, widths[index] ?? 0) : cell));
569
613
  }
614
+ function jsonText(value, replacer, { stream = process7.stdout, env = process7.env } = {}) {
615
+ return JSON.stringify(value, replacer, outputMode(stream, env) === "agent" ? undefined : 2);
616
+ }
570
617
  function printJson(value) {
571
- console.log(JSON.stringify(value, undefined, 2));
618
+ console.log(jsonText(value));
572
619
  }
573
620
 
574
621
  // ../kit/src/help.ts
575
- import process7 from "process";
622
+ import process8 from "process";
576
623
  var OPTIONAL = /\[[^\]]+\]/g;
577
624
  var USAGE_PREFIX = /^usage:\s*/i;
578
625
  var FULL_STOP = /\.$/;
579
- function usageLine(usage, colors = paint(process7.stdout)) {
626
+ function usageLine(usage, colors = paint(process8.stdout)) {
580
627
  return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
581
628
  }
582
- function helpText(usage, options, colors = paint(process7.stdout), { examples = [], replaces, exits = [] } = {}) {
629
+ function helpText(usage, options, colors = paint(process8.stdout), { examples = [], replaces, exits = [] } = {}) {
583
630
  return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
584
631
  `);
585
632
  }
586
- function exitRows(exits, colors = paint(process7.stdout)) {
633
+ function exitRows(exits, colors = paint(process8.stdout)) {
587
634
  if (exits.length === 0)
588
635
  return [];
589
636
  const width = Math.max(...exits.map(([code]) => String(code).length));
590
637
  return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
591
638
  }
592
- function replacesRows(replaces, colors = paint(process7.stdout)) {
593
- return replaces === undefined ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
639
+ function replacesRows(replaces, colors = paint(process8.stdout)) {
640
+ return replaces === undefined || outputMode() === "agent" ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
594
641
  }
595
- function wantsHelpJson(env = process7.env) {
642
+ function wantsHelpJson(env = process8.env) {
596
643
  return env.KIT_HELP === "json";
597
644
  }
598
645
  function description(usage, { examples = [], replaces, exits } = {}, options) {
@@ -611,12 +658,12 @@ function description(usage, { examples = [], replaces, exits } = {}, options) {
611
658
  ...options === undefined ? {} : { options: Object.entries(options).map(([name, { short, description }]) => ({ name, ...short === undefined ? {} : { short }, ...description === undefined ? {} : { description } })) }
612
659
  };
613
660
  }
614
- function exampleRows(examples, colors = paint(process7.stdout)) {
615
- if (examples.length === 0)
661
+ function exampleRows(examples, colors = paint(process8.stdout)) {
662
+ if (examples.length === 0 || outputMode() === "agent")
616
663
  return [];
617
664
  return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
618
665
  }
619
- function optionRows(options, colors = paint(process7.stdout)) {
666
+ function optionRows(options, colors = paint(process8.stdout)) {
620
667
  const rows = Object.entries(options).map(([name, option]) => {
621
668
  const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
622
669
  const named = option.choices === undefined ? "<value>" : `<${option.choices.join("|")}>`;
@@ -651,7 +698,7 @@ function closest(name, names) {
651
698
  return best !== undefined && best.far <= (name.length < 4 ? 1 : 2) ? best.known : undefined;
652
699
  }
653
700
  // ../kit/src/input.ts
654
- import process8 from "process";
701
+ import process9 from "process";
655
702
  var DURATION = /^(\d+(?:\.\d+)?)(ms|[smhd])?$/;
656
703
  var UNIT_MS = { ms: 1, s: 1000, m: 60000, h: 3600000, d: 86400000 };
657
704
  function duration(value, name, fallback, unit = "s") {
@@ -665,7 +712,7 @@ function duration(value, name, fallback, unit = "s") {
665
712
  }
666
713
  async function readInput(path, { noStdin = "nothing is piped on stdin" } = {}) {
667
714
  if (path === "-") {
668
- if (process8.stdin.isTTY)
715
+ if (process9.stdin.isTTY)
669
716
  fail(noStdin);
670
717
  return Bun.stdin.text();
671
718
  }
@@ -680,7 +727,6 @@ var DASHES = /^-+/;
680
727
  function jsonOption(holds) {
681
728
  return { type: "boolean", description: holds === undefined ? "print JSON" : `print JSON: ${holds}` };
682
729
  }
683
-
684
730
  class Exit extends Error {
685
731
  code;
686
732
  hint;
@@ -724,7 +770,7 @@ var OUTPUT_OPTIONS = {
724
770
  color: { type: "string", description: "auto (on a terminal alone), always or never" },
725
771
  plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
726
772
  };
727
- function applyOutput(color, plain, env = process9.env) {
773
+ function applyOutput(color, plain, env = process10.env) {
728
774
  const when = plain === true ? "never" : color ?? "auto";
729
775
  if (when === "auto")
730
776
  return;
@@ -895,7 +941,7 @@ function nearestOption(message, options, allowNegative) {
895
941
  }
896
942
  // ../kit/src/process.ts
897
943
  import { constants } from "os";
898
- import process10 from "process";
944
+ import process11 from "process";
899
945
  var KILL_GRACE_MS = 2000;
900
946
  var SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
901
947
  function exitCodeOf(code, signal) {
@@ -917,7 +963,7 @@ function holdSignals(cleanup) {
917
963
  },
918
964
  release: () => {
919
965
  for (const signal of SIGNALS)
920
- process10.off(signal, onSignal);
966
+ process11.off(signal, onSignal);
921
967
  }
922
968
  };
923
969
  function onSignal(signal) {
@@ -930,10 +976,10 @@ function holdSignals(cleanup) {
930
976
  return;
931
977
  held.release();
932
978
  cleanup(signal);
933
- process10.kill(process10.pid, signal);
979
+ process11.kill(process11.pid, signal);
934
980
  }
935
981
  for (const signal of SIGNALS)
936
- process10.on(signal, onSignal);
982
+ process11.on(signal, onSignal);
937
983
  return held;
938
984
  }
939
985
  async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
@@ -947,7 +993,7 @@ async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal,
947
993
  return;
948
994
  try {
949
995
  if (grouped)
950
- process10.kill(-proc.pid, killing);
996
+ process11.kill(-proc.pid, killing);
951
997
  else
952
998
  proc.kill(killing);
953
999
  } catch {}
@@ -1023,31 +1069,31 @@ var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
1023
1069
  // ../kit/src/cli.ts
1024
1070
  import { readFileSync as readFileSync2, realpathSync } from "fs";
1025
1071
  import { dirname as dirname3, join as join6 } from "path";
1026
- import process13 from "process";
1072
+ import process14 from "process";
1027
1073
 
1028
1074
  // ../kit/src/usage.ts
1029
1075
  import { appendFileSync, mkdirSync } from "fs";
1030
1076
  import { homedir as homedir4 } from "os";
1031
1077
  import { dirname as dirname2, isAbsolute, join as join5 } from "path";
1032
- import process12 from "process";
1078
+ import process13 from "process";
1033
1079
 
1034
1080
  // ../kit/src/logs.ts
1035
1081
  import { lstatSync, openSync } from "fs";
1036
1082
  import { mkdir, mkdtemp, readdir, rm, stat } from "fs/promises";
1037
1083
  import { homedir as homedir3, tmpdir } from "os";
1038
1084
  import { join as join4 } from "path";
1039
- import process11 from "process";
1085
+ import process12 from "process";
1040
1086
  var DAY_MS = 24 * 60 * 60 * 1000;
1041
1087
  var CLI_FOLDER = "kaynooo-cli";
1042
1088
  function isPrivateDirectory(path) {
1043
1089
  try {
1044
1090
  const info = lstatSync(path, { throwIfNoEntry: false });
1045
- return info !== undefined && info.isDirectory() && info.uid === (process11.getuid?.() ?? info.uid) && (info.mode & 63) === 0;
1091
+ return info !== undefined && info.isDirectory() && info.uid === (process12.getuid?.() ?? info.uid) && (info.mode & 63) === 0;
1046
1092
  } catch {
1047
1093
  return false;
1048
1094
  }
1049
1095
  }
1050
- async function privateLogDirectory(name, env = process11.env) {
1096
+ async function privateLogDirectory(name, env = process12.env) {
1051
1097
  const runtime = env.XDG_RUNTIME_DIR;
1052
1098
  const base = runtime === undefined || runtime === "" ? join4(homedir3(), ".cache", CLI_FOLDER) : join4(runtime, CLI_FOLDER);
1053
1099
  const path = join4(base, name);
@@ -1087,14 +1133,14 @@ var usageError;
1087
1133
  function noteUsageError(message) {
1088
1134
  usageError = message;
1089
1135
  }
1090
- function stateHome(env = process12.env) {
1136
+ function stateHome(env = process13.env) {
1091
1137
  const dir = env.XDG_STATE_HOME;
1092
1138
  return dir !== undefined && isAbsolute(dir) ? dir : join5(homedir4(), ".local", "state");
1093
1139
  }
1094
- function usagePath(env = process12.env) {
1140
+ function usagePath(env = process13.env) {
1095
1141
  return join5(stateHome(env), CLI_FOLDER, "usage.jsonl");
1096
1142
  }
1097
- function usageRecorded(env = process12.env) {
1143
+ function usageRecorded(env = process13.env) {
1098
1144
  const off = env.KAYNOOO_CLI_NO_USAGE;
1099
1145
  return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
1100
1146
  }
@@ -1108,7 +1154,7 @@ function usageEntry(bin, command, argv, code, now = new Date) {
1108
1154
  usageError = undefined;
1109
1155
  return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
1110
1156
  }
1111
- function recordUsage(entry, env = process12.env) {
1157
+ function recordUsage(entry, env = process13.env) {
1112
1158
  if (!usageRecorded(env))
1113
1159
  return;
1114
1160
  try {
@@ -1126,8 +1172,8 @@ var LEVEL_OPTIONS = {
1126
1172
  };
1127
1173
  var TOP_OPTIONS = { ...LEVEL_OPTIONS, version: { type: "boolean", short: "v", description: "print the version" } };
1128
1174
  function printError(prefix, message, hint, cause) {
1129
- const colors = paint(process13.stderr);
1130
- const styled = takesControlCodes(process13.stderr);
1175
+ const colors = paint(process14.stderr);
1176
+ const styled = takesControlCodes(process14.stderr);
1131
1177
  const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
1132
1178
  const under = (label, text, tint) => text === undefined ? "" : `
1133
1179
  ${styled ? tint(label) : `${label}:`} ${text}`;
@@ -1220,7 +1266,7 @@ function packageVersion(entry = Bun.main) {
1220
1266
  return "0.0.0";
1221
1267
  }
1222
1268
  }
1223
- async function runMain({ name, version, run, redact, usage }, argv = process13.argv.slice(2)) {
1269
+ async function runMain({ name, version, run, redact, usage }, argv = process14.argv.slice(2)) {
1224
1270
  if (argv[0] === COMPLETE)
1225
1271
  return printCandidates(leafCandidates(run, argv.slice(1)));
1226
1272
  if (argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v")) {
@@ -1240,6 +1286,8 @@ async function runMain({ name, version, run, redact, usage }, argv = process13.a
1240
1286
  }
1241
1287
  return code;
1242
1288
  }
1289
+ // ../kit/src/folders.ts
1290
+ var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
1243
1291
  // ../kit/src/secrets.ts
1244
1292
  var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
1245
1293
  // ../kit/src/sessions.ts
@@ -1247,12 +1295,12 @@ var {Glob } = globalThis.Bun;
1247
1295
  var SESSION_FILES = new Glob("*.json");
1248
1296
  var ACCOUNT_DIRS = new Glob("*/sessions");
1249
1297
  // package.json
1250
- var version = "0.14.0";
1298
+ var version = "0.16.0";
1251
1299
 
1252
1300
  // src/check.ts
1253
1301
  import { writeFile as writeFile3 } from "fs/promises";
1254
1302
  import { basename as basename4, join as join13 } from "path";
1255
- import process18 from "process";
1303
+ import process19 from "process";
1256
1304
 
1257
1305
  // ../kit/src/shell.ts
1258
1306
  var SEPARATORS = new Set([`
@@ -1305,7 +1353,7 @@ function shellQuote(word) {
1305
1353
  import { existsSync as existsSync3 } from "fs";
1306
1354
  import { homedir as homedir5 } from "os";
1307
1355
  import { basename, dirname as dirname4, join as join7, relative, resolve as resolve3 } from "path";
1308
- import process15 from "process";
1356
+ import process16 from "process";
1309
1357
  var COMPOSE_FILES = ["compose.yaml", "compose.yml", "docker-compose.yaml", "docker-compose.yml"];
1310
1358
  var OVERRIDE_FILES = ["compose.override.yaml", "compose.override.yml", "docker-compose.override.yaml", "docker-compose.override.yml"];
1311
1359
  var PS_TIMEOUT_MS = 20000;
@@ -1349,7 +1397,7 @@ async function variables(composeDir) {
1349
1397
  if (match !== null && !line.trimStart().startsWith("#"))
1350
1398
  env[match[1] ?? ""] = (match[2] ?? "").trim().replace(QUOTED, "$2");
1351
1399
  }
1352
- for (const [key, value] of Object.entries(process15.env)) {
1400
+ for (const [key, value] of Object.entries(process16.env)) {
1353
1401
  if (value !== undefined)
1354
1402
  env[key] = value;
1355
1403
  }
@@ -1485,7 +1533,7 @@ async function place(dir, program, { service, host } = {}) {
1485
1533
  fail(`--in ${service}: no compose project mounts ${dir}`);
1486
1534
  return;
1487
1535
  }
1488
- if (Bun.which("docker", { PATH: process15.env.PATH ?? "" }) === null) {
1536
+ if (Bun.which("docker", { PATH: process16.env.PATH ?? "" }) === null) {
1489
1537
  if (service !== undefined)
1490
1538
  fail(`--in ${service}: docker not found`);
1491
1539
  if (!noticed.has(found.composeDir)) {
@@ -1537,7 +1585,7 @@ class Stack {
1537
1585
  }
1538
1586
  static async running(composeDir) {
1539
1587
  try {
1540
- const ran = await runCommand(["docker", "compose", "ps", "--services", "--status", "running"], { cwd: composeDir, env: process15.env, timeoutMs: PS_TIMEOUT_MS });
1588
+ const ran = await runCommand(["docker", "compose", "ps", "--services", "--status", "running"], { cwd: composeDir, env: process16.env, timeoutMs: PS_TIMEOUT_MS });
1541
1589
  if (ran.code !== 0)
1542
1590
  return `docker compose ps failed in ${composeDir}: ${ran.text.trim().split(`
1543
1591
  `).at(-1) ?? `exit ${ran.code}`}`;
@@ -1572,7 +1620,7 @@ function placeSettings(values) {
1572
1620
  import { existsSync as existsSync4, statSync as statSync2 } from "fs";
1573
1621
  import { rename, writeFile as writeFile2 } from "fs/promises";
1574
1622
  import { join as join11 } from "path";
1575
- import process17 from "process";
1623
+ import process18 from "process";
1576
1624
 
1577
1625
  // src/changes.ts
1578
1626
  import { stat as stat2 } from "fs/promises";
@@ -1639,7 +1687,7 @@ var CS_FIXER_CONFIGS = [".php-cs-fixer.php", ".php-cs-fixer.dist.php"];
1639
1687
  var JUST_TIMEOUT_MS = 1e4;
1640
1688
  var PHPSTAN_CONFIGS = ["phpstan.neon", "phpstan.neon.dist", "phpstan.dist.neon"];
1641
1689
  var PHPUNIT_CONFIGS = ["phpunit.xml", "phpunit.xml.dist", "phpunit.dist.xml"];
1642
- var SKIPPED = new Set(["node_modules", "vendor", "dist", "build", "var", "tmp", "coverage"]);
1690
+ var SKIPPED = new Set([...SKIPPED_FOLDERS, "var", "tmp"]);
1643
1691
  async function readFirst(dir, files) {
1644
1692
  for (const file of files) {
1645
1693
  const handle = Bun.file(join9(dir, file));
@@ -1782,7 +1830,7 @@ function pick(steps, only, noun = "step") {
1782
1830
  // src/run.ts
1783
1831
  import { mkdir as mkdir2, readdir as readdir3, stat as stat3, writeFile } from "fs/promises";
1784
1832
  import { basename as basename2, join as join10 } from "path";
1785
- import process16 from "process";
1833
+ import process17 from "process";
1786
1834
 
1787
1835
  // src/e2e.ts
1788
1836
  var E2E_NOISE = [
@@ -2417,7 +2465,7 @@ var runPrefix = (cwd) => `${basename2(cwd)}-${Bun.hash(cwd).toString(36)}-`;
2417
2465
  async function logDirectory(cwd) {
2418
2466
  const root = await privateLogDirectory("check");
2419
2467
  await sweepLogs(root, LOG_MAX_AGE_MS);
2420
- const path = join10(root, `${runPrefix(cwd)}${Date.now().toString(36)}-${process16.pid}`);
2468
+ const path = join10(root, `${runPrefix(cwd)}${Date.now().toString(36)}-${process17.pid}`);
2421
2469
  await mkdir2(path, { mode: 448 });
2422
2470
  return path;
2423
2471
  }
@@ -2443,7 +2491,7 @@ async function lastFailed(cwd) {
2443
2491
  async function saveLog(output) {
2444
2492
  const root = await privateLogDirectory("errs");
2445
2493
  await sweepLogs(root);
2446
- const path = join10(root, `${new Date().toISOString().replaceAll(/[:.]/g, "-")}-${process16.pid}-${crypto.randomUUID().slice(0, 8)}.log`);
2494
+ const path = join10(root, `${new Date().toISOString().replaceAll(/[:.]/g, "-")}-${process17.pid}-${crypto.randomUUID().slice(0, 8)}.log`);
2447
2495
  await writeFile(path, output, { mode: 384, flag: "wx" });
2448
2496
  return path;
2449
2497
  }
@@ -2451,7 +2499,7 @@ async function runStep(command, cwd, logFile, { env = {}, timeoutMs, held } = {}
2451
2499
  const started = Date.now();
2452
2500
  const { code, text, timedOut } = await runCommand(["sh", "-c", `${command} 2>&1`], {
2453
2501
  cwd,
2454
- env: { ...process16.env, NO_COLOR: "1", FORCE_COLOR: "0", ...env },
2502
+ env: { ...process17.env, NO_COLOR: "1", FORCE_COLOR: "0", ...env },
2455
2503
  ...timeoutMs === undefined ? {} : { timeoutMs },
2456
2504
  ...held === undefined ? {} : { onStart: (child) => held.forward(child) }
2457
2505
  });
@@ -2467,8 +2515,8 @@ function outcomeJson(name, command, logFile, outcome, service) {
2467
2515
  return { name, command, ...service === undefined ? {} : { in: service }, ok: outcome.ok, ms: outcome.ms, log: logFile, ...outcome.timedOut === true ? { timedOut: true } : {}, ...outcome.ok ? {} : { failed: failureExcerpt(outcome.output) } };
2468
2516
  }
2469
2517
  function printOutcome(name, width, command, logFile, outcome) {
2470
- const colors = paint(process16.stdout);
2471
- const path = role("path", process16.stdout);
2518
+ const colors = paint(process17.stdout);
2519
+ const path = role("path", process17.stdout);
2472
2520
  const took = colors.dim(formatDuration(outcome.ms));
2473
2521
  if (outcome.ok) {
2474
2522
  console.log(`${colors.bold(colors.green("ok "))} ${name.padEnd(width)} ${took} ${path(logFile)}`);
@@ -2499,7 +2547,7 @@ var RUFF_CONFIGS = ["ruff.toml", ".ruff.toml"];
2499
2547
  var RUFF_SECTION = /^\[tool\.ruff/m;
2500
2548
  var MAX_CHANGED = 30;
2501
2549
  async function replaceFile(path, content) {
2502
- const temporary = `${path}.${process17.pid}.tmp`;
2550
+ const temporary = `${path}.${process18.pid}.tmp`;
2503
2551
  await writeFile2(temporary, content, { mode: statSync2(path).mode & 511 });
2504
2552
  await rename(temporary, path);
2505
2553
  }
@@ -2571,14 +2619,14 @@ function printChanged(changed) {
2571
2619
  if (changed.length > MAX_CHANGED)
2572
2620
  console.log(` and ${changed.length - MAX_CHANGED} more`);
2573
2621
  }
2574
- async function fix(args, cwd = process17.cwd()) {
2622
+ async function fix(args, cwd = process18.cwd()) {
2575
2623
  const parsed = parse(args, fixUsage, fixOptions, { replaces: "running each fixer and formatter by hand, or docker compose exec <service> bun run lint:fix", examples: ["fix", ["fix --list", "the fixers it would run"]] });
2576
2624
  return runFixers(parsed.values, cwd);
2577
2625
  }
2578
2626
  async function runFixers(values, cwd) {
2579
2627
  const parsed = { values };
2580
2628
  const settings = placeSettings(values);
2581
- if (process17.env[RUNNING] !== undefined)
2629
+ if (process18.env[RUNNING] !== undefined)
2582
2630
  fail("a fixer called fix again, which would recurse: give its script another command");
2583
2631
  const found = await fixers(cwd);
2584
2632
  if (found.length === 0)
@@ -2612,7 +2660,7 @@ async function runFixers(values, cwd) {
2612
2660
  break;
2613
2661
  if (missing(fixer)) {
2614
2662
  if (!json)
2615
- console.log(`${paint(process17.stdout).yellow("skip ")} ${fixer.name.padEnd(width)} ${fixer.requires} is not installed`);
2663
+ console.log(`${paint(process18.stdout).yellow("skip ")} ${fixer.name.padEnd(width)} ${fixer.requires} is not installed`);
2616
2664
  ran.push({ name: fixer.name, command: fixer.command, skipped: `${fixer.requires} is not installed` });
2617
2665
  continue;
2618
2666
  }
@@ -2760,13 +2808,13 @@ function launch(step) {
2760
2808
  return step.placement === undefined ? step.command : shellIn(step.placement, step.command);
2761
2809
  }
2762
2810
  function summaryLine(outcomes) {
2763
- const colors = paint(process18.stdout);
2811
+ const colors = paint(process19.stdout);
2764
2812
  const failed = outcomes.filter((outcome) => !outcome.ok).length;
2765
2813
  const passed = outcomes.length - failed;
2766
2814
  const parts = [colors.green(`${passed} passed`), ...failed === 0 ? [] : [colors.red(`${failed} failed`)], colors.dim(formatDuration(outcomes.reduce((sum, outcome) => sum + outcome.ms, 0)))];
2767
2815
  return parts.join(colors.dim(" \xB7 "));
2768
2816
  }
2769
- async function check(args, cwd = process18.cwd()) {
2817
+ async function check(args, cwd = process19.cwd()) {
2770
2818
  const parsed = parse(args, usage2, options, { replaces: "chaining docker compose exec <service> bun run check | tail, lint and test by hand, or bun run check && bun run lint && bun run test read through tail", examples: ["check", ["check --only lint,test", "two of the steps"], ["check --in app", "every step inside the app service"]] });
2771
2819
  const settings = placeSettings(parsed.values);
2772
2820
  if (parsed.values.fix === true) {
@@ -2777,7 +2825,7 @@ async function check(args, cwd = process18.cwd()) {
2777
2825
  return runFixers(parsed.values, cwd);
2778
2826
  }
2779
2827
  const timeoutMs = parsed.values.timeout === undefined ? undefined : duration(parsed.values.timeout, "timeout", 0);
2780
- if (parsed.values.slot === true && Bun.which("slot", { PATH: process18.env.PATH ?? "" }) === null)
2828
+ if (parsed.values.slot === true && Bun.which("slot", { PATH: process19.env.PATH ?? "" }) === null)
2781
2829
  fail("--slot needs the slot bin: bun install -g @kaynooo/cli-wait");
2782
2830
  const projects = await discoverProjects(cwd);
2783
2831
  const found = projects.flatMap((project) => project.steps.map((step) => ({ ...step, project })));
@@ -2807,7 +2855,7 @@ async function check(args, cwd = process18.cwd()) {
2807
2855
  const stack = new Stack;
2808
2856
  const width = Math.max(...steps.map((step) => step.label.length));
2809
2857
  const outcomes = [];
2810
- const heading = json ? "" : header("check", `${basename4(cwd)} \xB7 ${steps.length} ${steps.length === 1 ? "step" : "steps"}`, process18.stdout);
2858
+ const heading = json ? "" : header("check", `${basename4(cwd)} \xB7 ${steps.length} ${steps.length === 1 ? "step" : "steps"}`, process19.stdout);
2811
2859
  if (heading !== "")
2812
2860
  console.log(heading);
2813
2861
  try {
@@ -2838,4 +2886,4 @@ async function check(args, cwd = process18.cwd()) {
2838
2886
  }
2839
2887
 
2840
2888
  // src/cli.ts
2841
- process19.exitCode = await runMain({ name: "check", version, run: async (args) => check(args) });
2889
+ process20.exitCode = await runMain({ name: "check", version, run: async (args) => check(args) });