@kaynooo/cli-check 0.13.0 → 0.15.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/fix-cli.js CHANGED
@@ -2,16 +2,37 @@
2
2
  // @bun
3
3
 
4
4
  // src/fix-cli.ts
5
- import process15 from "process";
5
+ import process19 from "process";
6
6
  // ../kit/src/args.ts
7
- import process6 from "process";
7
+ import process10 from "process";
8
8
  import { parseArgs } from "util";
9
9
 
10
10
  // ../kit/src/format.ts
11
- import process3 from "process";
11
+ import process7 from "process";
12
12
 
13
- // ../kit/src/style.ts
13
+ // ../kit/src/mode.ts
14
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
+ }
33
+
34
+ // ../kit/src/style.ts
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) {
@@ -274,36 +295,252 @@ function le(i = {}) {
274
295
  }
275
296
  var t = le();
276
297
 
277
- // ../kit/src/style.ts
278
- var MARKS = {
279
- ok: { symbol: "\u2713", word: "ok:", paint: (colors) => colors.green },
280
- warn: { symbol: "!", word: "warning:", paint: (colors) => colors.yellow },
281
- problem: { symbol: "\u2717", word: "error:", paint: (colors) => colors.red },
282
- note: { symbol: "\xB7", word: "note:", paint: (colors) => colors.dim }
298
+ // ../kit/src/theme.ts
299
+ import { existsSync as existsSync2, readFileSync, statSync } from "fs";
300
+ import { homedir as homedir2 } from "os";
301
+ import { join as join3, resolve as resolve2 } from "path";
302
+ import process5 from "process";
303
+
304
+ // ../kit/src/config.ts
305
+ import { existsSync } from "fs";
306
+ import { dirname, join, resolve } from "path";
307
+ import process3 from "process";
308
+ function findUp(names, from = process3.cwd(), stop = () => false) {
309
+ const wanted = typeof names === "string" ? [names] : names;
310
+ for (let dir = resolve(from);; dir = dirname(dir)) {
311
+ const found = wanted.map((name) => join(dir, name)).find((path) => existsSync(path));
312
+ if (found !== undefined)
313
+ return found;
314
+ if (stop(dir) || dirname(dir) === dir)
315
+ return;
316
+ }
317
+ }
318
+
319
+ // ../kit/src/user-config.ts
320
+ import { homedir } from "os";
321
+ import { join as join2 } from "path";
322
+ import process4 from "process";
323
+ function configBase(where = {}) {
324
+ const xdg = where.xdg ?? (where.home === undefined ? process4.env.XDG_CONFIG_HOME : undefined);
325
+ return xdg !== undefined && xdg !== "" ? xdg : join2(where.home ?? homedir(), ".config");
326
+ }
327
+ function userConfigPath(bin, where = {}) {
328
+ return join2(configBase(where), "kaynooo-cli", `${bin}.json`);
329
+ }
330
+
331
+ // ../kit/src/theme.ts
332
+ var DEFAULT = {
333
+ colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
334
+ glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501" },
335
+ accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
336
+ bins: {}
337
+ };
338
+ var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
339
+ var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
340
+ var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#" };
341
+ var PRESETS = {
342
+ default: {},
343
+ "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
344
+ mono: { colors: MONO, accents: ["bold"] },
345
+ ascii: { glyphs: ASCII }
283
346
  };
284
- function takesControlCodes(stream, env = process2.env) {
285
- return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb";
347
+ var STYLES = new Set(["bold", "dim", "italic", "underline", "inverse", "strikethrough", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "gray", "grey", "blackBright", "redBright", "greenBright", "yellowBright", "blueBright", "magentaBright", "cyanBright", "whiteBright"]);
348
+ var HEX = /^#[0-9a-f]{6}$/i;
349
+ var CONTROL = /\p{Cc}/u;
350
+ var MAX_FILE_BYTES = 64 * 1024;
351
+ var SPACES = /\s+/;
352
+ function isColorSpec(spec) {
353
+ if (typeof spec === "number")
354
+ return Number.isInteger(spec) && spec >= 0 && spec <= 255;
355
+ return typeof spec === "string" && spec.trim() !== "" && spec.trim().split(SPACES).every((token) => STYLES.has(token) || HEX.test(token));
356
+ }
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) {
374
+ if (typeof spec === "number")
375
+ return colors.ansi256(spec);
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);
381
+ }
382
+ function isRecord(value) {
383
+ return typeof value === "object" && value !== null && !Array.isArray(value);
384
+ }
385
+ function readThemeFile(path, warn) {
386
+ try {
387
+ const stat = statSync(path, { throwIfNoEntry: false });
388
+ if (stat === undefined)
389
+ return;
390
+ if (!stat.isFile() || stat.size > MAX_FILE_BYTES) {
391
+ warn(`${path} is not a regular file under ${MAX_FILE_BYTES / 1024} KiB, theme ignored`);
392
+ return;
393
+ }
394
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
395
+ if (isRecord(parsed))
396
+ return parsed;
397
+ warn(`${path} is not a JSON object, theme ignored`);
398
+ } catch (error) {
399
+ warn(`${path} does not parse (${error instanceof Error ? error.message : String(error)}), theme ignored`);
400
+ }
401
+ return;
402
+ }
403
+ function applyPreset(theme, name, warn, where) {
404
+ if (name === undefined)
405
+ return;
406
+ if (typeof name !== "string" || !Object.hasOwn(PRESETS, name)) {
407
+ warn(`${where}: no preset ${String(name)}, one of ${Object.keys(PRESETS).join(", ")}`);
408
+ return;
409
+ }
410
+ const preset = PRESETS[name];
411
+ Object.assign(theme.colors, preset.colors);
412
+ Object.assign(theme.glyphs, preset.glyphs);
413
+ if (preset.accents !== undefined)
414
+ theme.accents = [...preset.accents];
415
+ return name;
416
+ }
417
+ function applyFile(theme, file, where, warn) {
418
+ if (isRecord(file.colors)) {
419
+ for (const [key, value] of Object.entries(file.colors)) {
420
+ if (!Object.hasOwn(DEFAULT.colors, key))
421
+ warn(`${where}: no colour ${key}, one of ${Object.keys(DEFAULT.colors).join(", ")}`);
422
+ else if (!isColorSpec(value))
423
+ warn(`${where}: colour ${key} is not an ANSI name, \`#rrggbb\` or a number up to 255`);
424
+ else
425
+ theme.colors[key] = value;
426
+ }
427
+ }
428
+ if (isRecord(file.glyphs)) {
429
+ for (const [key, value] of Object.entries(file.glyphs)) {
430
+ if (!Object.hasOwn(DEFAULT.glyphs, key))
431
+ warn(`${where}: no glyph ${key}, one of ${Object.keys(DEFAULT.glyphs).join(", ")}`);
432
+ else if (typeof value !== "string" || CONTROL.test(value) || Bun.stringWidth(value) !== 1)
433
+ warn(`${where}: glyph ${key} must be one visible character wide, with no control character`);
434
+ else
435
+ theme.glyphs[key] = value;
436
+ }
437
+ }
438
+ if (Array.isArray(file.accents) && file.accents.length > 0 && file.accents.every(isColorSpec))
439
+ theme.accents = [...file.accents];
440
+ else if (file.accents !== undefined)
441
+ warn(`${where}: accents must be a non-empty list of colours`);
442
+ if (isRecord(file.bins)) {
443
+ for (const [bin, value] of Object.entries(file.bins)) {
444
+ if (isColorSpec(value))
445
+ theme.bins[bin] = value;
446
+ else
447
+ warn(`${where}: bin ${bin} has no valid colour`);
448
+ }
449
+ }
286
450
  }
287
- function paint(stream, env = process2.env) {
451
+ function endsWalk(home) {
452
+ return (dir) => dir === resolve2(home) || existsSync2(join3(dir, ".git"));
453
+ }
454
+ var warned = new Set;
455
+ function warnOnce(message) {
456
+ if (warned.has(message))
457
+ return;
458
+ warned.add(message);
459
+ console.error(`warning: theme ${message}`);
460
+ }
461
+ function isPath(chosen) {
462
+ return chosen.includes("/") || chosen.endsWith(".json");
463
+ }
464
+ function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(), warn = warnOnce } = {}) {
465
+ const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null) };
466
+ const sources = [];
467
+ const chosen = env.KIT_THEME ?? "";
468
+ const wanted = chosen === "" ? [userConfigPath("theme", { home, xdg: env.XDG_CONFIG_HOME }), findUp(join3(".kaynooo", "theme.json"), from, endsWalk(home))] : [];
469
+ if (isPath(chosen))
470
+ wanted.push(resolve2(from, chosen));
471
+ const files = [];
472
+ for (const path of wanted) {
473
+ const file = path === undefined ? undefined : readThemeFile(path, warn);
474
+ if (path !== undefined && file !== undefined)
475
+ files.push({ path, file });
476
+ }
477
+ let preset = "default";
478
+ if (chosen !== "" && !isPath(chosen)) {
479
+ preset = applyPreset(theme, chosen, warn, "KIT_THEME") ?? preset;
480
+ } else {
481
+ const named = files.findLast(({ file }) => file.preset !== undefined);
482
+ if (named !== undefined)
483
+ preset = applyPreset(theme, named.file.preset, warn, named.path) ?? preset;
484
+ }
485
+ for (const { path, file } of files) {
486
+ applyFile(theme, file, path, warn);
487
+ sources.push(path);
488
+ }
489
+ return { theme, sources, preset };
490
+ }
491
+ var current;
492
+ var currentKey = "";
493
+ function activeTheme() {
494
+ const key = `${process5.cwd()}\x00${process5.env.KIT_THEME ?? ""}\x00${process5.env.XDG_CONFIG_HOME ?? ""}`;
495
+ if (current === undefined || key !== currentKey) {
496
+ current = loadTheme();
497
+ currentKey = key;
498
+ }
499
+ return current;
500
+ }
501
+
502
+ // ../kit/src/style.ts
503
+ var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:" };
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";
506
+ }
507
+ function paint(stream, env = process6.env) {
288
508
  return le({ stream: { isTTY: takesControlCodes(stream, env) }, env });
289
509
  }
290
- function marked(mark, text, stream, detail, env = process2.env) {
510
+ function marked(mark, text, stream, detail, env = process6.env) {
291
511
  const colors = paint(stream, env);
292
- const { symbol, word, paint: tint } = MARKS[mark];
293
- const head = takesControlCodes(stream, env) ? tint(colors)(symbol) : word;
512
+ let head = MARK_WORDS[mark];
513
+ if (takesControlCodes(stream, env)) {
514
+ const { theme } = activeTheme();
515
+ head = tinted(colors.bold, theme.colors[mark], env)(theme.glyphs[mark]);
516
+ }
294
517
  return `${head} ${text}${detail === undefined ? "" : ` ${colors.dim(detail)}`}`;
295
518
  }
296
519
  function warn(text, detail) {
297
- console.error(marked("warn", text, process2.stderr, detail));
298
- }
299
- var STATUSES = {
300
- passed: { symbol: "\u2713", words: ["passed", "success", "succeeded", "ok"], paint: (colors) => colors.green },
301
- failed: { symbol: "\u2717", words: ["failed", "failure", "error", "errored"], paint: (colors) => colors.red },
302
- running: { symbol: "\u25CF", words: ["running", "in_progress", "started"], paint: (colors) => colors.cyan },
303
- queued: { symbol: "\u25CB", words: ["queued", "waiting", "pending", "created", "blocked", "scheduled"], paint: (colors) => colors.yellow },
304
- skipped: { symbol: "-", words: ["skipped", "cancelled", "canceled", "manual"], paint: (colors) => colors.dim }
520
+ console.error(marked("warn", text, process6.stderr, detail));
521
+ }
522
+ function role(name, stream, env = process6.env) {
523
+ const colors = paint(stream, env);
524
+ return takesControlCodes(stream, env) ? tinted(colors, activeTheme().theme.colors[name], env) : colors;
525
+ }
526
+ var STATUS_WORDS = {
527
+ passed: ["passed", "success", "succeeded", "ok"],
528
+ failed: ["failed", "failure", "error", "errored"],
529
+ running: ["running", "in_progress", "started", "holding"],
530
+ queued: ["queued", "waiting", "pending", "created", "blocked", "scheduled"],
531
+ skipped: ["skipped", "cancelled", "canceled", "manual"]
305
532
  };
306
- var STATUS_OF = new Map(Object.entries(STATUSES).flatMap(([status, { words }]) => words.map((word) => [word, status])));
533
+ var STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
534
+ function header(bin, context, stream, env = process6.env) {
535
+ if (!takesControlCodes(stream, env))
536
+ return "";
537
+ const colors = paint(stream, env);
538
+ const hash = [...bin].reduce((sum, char) => sum + char.charCodeAt(0), 0);
539
+ const { theme } = activeTheme();
540
+ const spec = theme.bins[bin] ?? theme.accents[hash % theme.accents.length];
541
+ const accent = tinted(typeof spec === "string" && spec.split(" ").includes("bold") ? colors : colors.bold, spec, env);
542
+ return `${accent(bin)}${context === undefined ? "" : colors.dim(` \u203A ${context}`)}`;
543
+ }
307
544
 
308
545
  // ../kit/src/format.ts
309
546
  var UNITS = [["d", 86400], ["h", 3600], ["m", 60], ["s", 1]];
@@ -335,15 +572,18 @@ var ESCAPE = String.fromCharCode(27);
335
572
  function textWidth(text) {
336
573
  return Bun.stringWidth(text);
337
574
  }
338
- function table(rows, { cellWidth, header = false, align = [], fit } = {}) {
575
+ function table(rows, { cellWidth, header = false, align = [], fit, stream = process7.stdout, env = process7.env } = {}) {
339
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
+ `);
340
580
  const widths = [];
341
581
  for (const row of cells) {
342
582
  for (const [index, cell] of row.entries())
343
583
  widths[index] = Math.max(widths[index] ?? 0, textWidth(cell));
344
584
  }
345
585
  const shown = fit === undefined ? cells : narrow(cells, widths, fit);
346
- const colors = paint(process3.stdout);
586
+ const colors = paint(stream);
347
587
  const lines = shown.map((row) => row.map((cell, index) => {
348
588
  const width = widths[index] ?? 0;
349
589
  const gap = " ".repeat(Math.max(0, width - textWidth(cell)));
@@ -351,7 +591,8 @@ function table(rows, { cellWidth, header = false, align = [], fit } = {}) {
351
591
  return `${gap}${cell}`;
352
592
  return index === row.length - 1 ? cell : `${cell}${gap}`;
353
593
  }).join(" ").trimEnd());
354
- return lines.map((line, index) => header && index === 0 ? colors.bold(line) : line).join(`
594
+ const rule = header && takesControlCodes(stream) && lines.length > 1 ? [colors.dim("\u2500".repeat(Math.max(...lines.map(textWidth))))] : [];
595
+ return lines.flatMap((line, index) => header && index === 0 ? [colors.bold(line), ...rule] : [line]).join(`
355
596
  `);
356
597
  }
357
598
  function narrow(rows, widths, limit) {
@@ -370,32 +611,35 @@ function narrow(rows, widths, limit) {
370
611
  }
371
612
  return rows.map((row) => row.map((cell, index) => textWidth(cell) > (widths[index] ?? 0) ? truncate(cell, widths[index] ?? 0) : cell));
372
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
+ }
373
617
  function printJson(value) {
374
- console.log(JSON.stringify(value, undefined, 2));
618
+ console.log(jsonText(value));
375
619
  }
376
620
 
377
621
  // ../kit/src/help.ts
378
- import process4 from "process";
622
+ import process8 from "process";
379
623
  var OPTIONAL = /\[[^\]]+\]/g;
380
624
  var USAGE_PREFIX = /^usage:\s*/i;
381
625
  var FULL_STOP = /\.$/;
382
- function usageLine(usage, colors = paint(process4.stdout)) {
626
+ function usageLine(usage, colors = paint(process8.stdout)) {
383
627
  return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
384
628
  }
385
- function helpText(usage, options, colors = paint(process4.stdout), { examples = [], replaces, exits = [] } = {}) {
629
+ function helpText(usage, options, colors = paint(process8.stdout), { examples = [], replaces, exits = [] } = {}) {
386
630
  return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
387
631
  `);
388
632
  }
389
- function exitRows(exits, colors = paint(process4.stdout)) {
633
+ function exitRows(exits, colors = paint(process8.stdout)) {
390
634
  if (exits.length === 0)
391
635
  return [];
392
636
  const width = Math.max(...exits.map(([code]) => String(code).length));
393
637
  return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
394
638
  }
395
- function replacesRows(replaces, colors = paint(process4.stdout)) {
396
- 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}`];
397
641
  }
398
- function wantsHelpJson(env = process4.env) {
642
+ function wantsHelpJson(env = process8.env) {
399
643
  return env.KIT_HELP === "json";
400
644
  }
401
645
  function description(usage, { examples = [], replaces, exits } = {}, options) {
@@ -414,12 +658,12 @@ function description(usage, { examples = [], replaces, exits } = {}, options) {
414
658
  ...options === undefined ? {} : { options: Object.entries(options).map(([name, { short, description }]) => ({ name, ...short === undefined ? {} : { short }, ...description === undefined ? {} : { description } })) }
415
659
  };
416
660
  }
417
- function exampleRows(examples, colors = paint(process4.stdout)) {
418
- if (examples.length === 0)
661
+ function exampleRows(examples, colors = paint(process8.stdout)) {
662
+ if (examples.length === 0 || outputMode() === "agent")
419
663
  return [];
420
664
  return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
421
665
  }
422
- function optionRows(options, colors = paint(process4.stdout)) {
666
+ function optionRows(options, colors = paint(process8.stdout)) {
423
667
  const rows = Object.entries(options).map(([name, option]) => {
424
668
  const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
425
669
  const named = option.choices === undefined ? "<value>" : `<${option.choices.join("|")}>`;
@@ -454,7 +698,7 @@ function closest(name, names) {
454
698
  return best !== undefined && best.far <= (name.length < 4 ? 1 : 2) ? best.known : undefined;
455
699
  }
456
700
  // ../kit/src/input.ts
457
- import process5 from "process";
701
+ import process9 from "process";
458
702
  var DURATION = /^(\d+(?:\.\d+)?)(ms|[smhd])?$/;
459
703
  var UNIT_MS = { ms: 1, s: 1000, m: 60000, h: 3600000, d: 86400000 };
460
704
  function duration(value, name, fallback, unit = "s") {
@@ -468,7 +712,7 @@ function duration(value, name, fallback, unit = "s") {
468
712
  }
469
713
  async function readInput(path, { noStdin = "nothing is piped on stdin" } = {}) {
470
714
  if (path === "-") {
471
- if (process5.stdin.isTTY)
715
+ if (process9.stdin.isTTY)
472
716
  fail(noStdin);
473
717
  return Bun.stdin.text();
474
718
  }
@@ -527,7 +771,7 @@ var OUTPUT_OPTIONS = {
527
771
  color: { type: "string", description: "auto (on a terminal alone), always or never" },
528
772
  plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
529
773
  };
530
- function applyOutput(color, plain, env = process6.env) {
774
+ function applyOutput(color, plain, env = process10.env) {
531
775
  const when = plain === true ? "never" : color ?? "auto";
532
776
  if (when === "auto")
533
777
  return;
@@ -698,7 +942,7 @@ function nearestOption(message, options, allowNegative) {
698
942
  }
699
943
  // ../kit/src/process.ts
700
944
  import { constants } from "os";
701
- import process7 from "process";
945
+ import process11 from "process";
702
946
  var KILL_GRACE_MS = 2000;
703
947
  var SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
704
948
  function exitCodeOf(code, signal) {
@@ -720,7 +964,7 @@ function holdSignals(cleanup) {
720
964
  },
721
965
  release: () => {
722
966
  for (const signal of SIGNALS)
723
- process7.off(signal, onSignal);
967
+ process11.off(signal, onSignal);
724
968
  }
725
969
  };
726
970
  function onSignal(signal) {
@@ -733,10 +977,10 @@ function holdSignals(cleanup) {
733
977
  return;
734
978
  held.release();
735
979
  cleanup(signal);
736
- process7.kill(process7.pid, signal);
980
+ process11.kill(process11.pid, signal);
737
981
  }
738
982
  for (const signal of SIGNALS)
739
- process7.on(signal, onSignal);
983
+ process11.on(signal, onSignal);
740
984
  return held;
741
985
  }
742
986
  async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
@@ -750,7 +994,7 @@ async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal,
750
994
  return;
751
995
  try {
752
996
  if (grouped)
753
- process7.kill(-proc.pid, killing);
997
+ process11.kill(-proc.pid, killing);
754
998
  else
755
999
  proc.kill(killing);
756
1000
  } catch {}
@@ -824,42 +1068,42 @@ var ESCAPE_CODE = new RegExp(`${ESC}(?:\\[[\\x30-\\x3F]*[\\x20-\\x2F]*[\\x40-\\x
824
1068
  var RESET_STYLE = `${ESC}[0m`;
825
1069
  var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
826
1070
  // ../kit/src/cli.ts
827
- import { readFileSync, realpathSync } from "fs";
828
- import { dirname as dirname2, join as join3 } from "path";
829
- import process10 from "process";
1071
+ import { readFileSync as readFileSync2, realpathSync } from "fs";
1072
+ import { dirname as dirname3, join as join6 } from "path";
1073
+ import process14 from "process";
830
1074
 
831
1075
  // ../kit/src/usage.ts
832
1076
  import { appendFileSync, mkdirSync } from "fs";
833
- import { homedir as homedir2 } from "os";
834
- import { dirname, isAbsolute, join as join2 } from "path";
835
- import process9 from "process";
1077
+ import { homedir as homedir4 } from "os";
1078
+ import { dirname as dirname2, isAbsolute, join as join5 } from "path";
1079
+ import process13 from "process";
836
1080
 
837
1081
  // ../kit/src/logs.ts
838
1082
  import { lstatSync, openSync } from "fs";
839
1083
  import { mkdir, mkdtemp, readdir, rm, stat } from "fs/promises";
840
- import { homedir, tmpdir } from "os";
841
- import { join } from "path";
842
- import process8 from "process";
1084
+ import { homedir as homedir3, tmpdir } from "os";
1085
+ import { join as join4 } from "path";
1086
+ import process12 from "process";
843
1087
  var DAY_MS = 24 * 60 * 60 * 1000;
844
1088
  var CLI_FOLDER = "kaynooo-cli";
845
1089
  function isPrivateDirectory(path) {
846
1090
  try {
847
1091
  const info = lstatSync(path, { throwIfNoEntry: false });
848
- return info !== undefined && info.isDirectory() && info.uid === (process8.getuid?.() ?? info.uid) && (info.mode & 63) === 0;
1092
+ return info !== undefined && info.isDirectory() && info.uid === (process12.getuid?.() ?? info.uid) && (info.mode & 63) === 0;
849
1093
  } catch {
850
1094
  return false;
851
1095
  }
852
1096
  }
853
- async function privateLogDirectory(name, env = process8.env) {
1097
+ async function privateLogDirectory(name, env = process12.env) {
854
1098
  const runtime = env.XDG_RUNTIME_DIR;
855
- const base = runtime === undefined || runtime === "" ? join(homedir(), ".cache", CLI_FOLDER) : join(runtime, CLI_FOLDER);
856
- const path = join(base, name);
1099
+ const base = runtime === undefined || runtime === "" ? join4(homedir3(), ".cache", CLI_FOLDER) : join4(runtime, CLI_FOLDER);
1100
+ const path = join4(base, name);
857
1101
  try {
858
1102
  await mkdir(path, { recursive: true, mode: 448 });
859
1103
  if (isPrivateDirectory(path))
860
1104
  return path;
861
1105
  } catch {}
862
- return mkdtemp(join(tmpdir(), `${name.replaceAll("/", "-")}-`));
1106
+ return mkdtemp(join4(tmpdir(), `${name.replaceAll("/", "-")}-`));
863
1107
  }
864
1108
  async function sweepLogs(dir, maxAgeMs = DAY_MS, now = Date.now()) {
865
1109
  let names;
@@ -869,7 +1113,7 @@ async function sweepLogs(dir, maxAgeMs = DAY_MS, now = Date.now()) {
869
1113
  return;
870
1114
  }
871
1115
  for (const name of names) {
872
- const path = join(dir, name);
1116
+ const path = join4(dir, name);
873
1117
  try {
874
1118
  const info = await stat(path);
875
1119
  if (info.isDirectory())
@@ -890,14 +1134,14 @@ var usageError;
890
1134
  function noteUsageError(message) {
891
1135
  usageError = message;
892
1136
  }
893
- function stateHome(env = process9.env) {
1137
+ function stateHome(env = process13.env) {
894
1138
  const dir = env.XDG_STATE_HOME;
895
- return dir !== undefined && isAbsolute(dir) ? dir : join2(homedir2(), ".local", "state");
1139
+ return dir !== undefined && isAbsolute(dir) ? dir : join5(homedir4(), ".local", "state");
896
1140
  }
897
- function usagePath(env = process9.env) {
898
- return join2(stateHome(env), CLI_FOLDER, "usage.jsonl");
1141
+ function usagePath(env = process13.env) {
1142
+ return join5(stateHome(env), CLI_FOLDER, "usage.jsonl");
899
1143
  }
900
- function usageRecorded(env = process9.env) {
1144
+ function usageRecorded(env = process13.env) {
901
1145
  const off = env.KAYNOOO_CLI_NO_USAGE;
902
1146
  return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
903
1147
  }
@@ -911,12 +1155,12 @@ function usageEntry(bin, command, argv, code, now = new Date) {
911
1155
  usageError = undefined;
912
1156
  return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
913
1157
  }
914
- function recordUsage(entry, env = process9.env) {
1158
+ function recordUsage(entry, env = process13.env) {
915
1159
  if (!usageRecorded(env))
916
1160
  return;
917
1161
  try {
918
1162
  const path = usagePath(env);
919
- mkdirSync(dirname(path), { recursive: true, mode: 448 });
1163
+ mkdirSync(dirname2(path), { recursive: true, mode: 448 });
920
1164
  appendFileSync(path, `${JSON.stringify(entry)}
921
1165
  `, { mode: 384 });
922
1166
  } catch {}
@@ -929,8 +1173,8 @@ var LEVEL_OPTIONS = {
929
1173
  };
930
1174
  var TOP_OPTIONS = { ...LEVEL_OPTIONS, version: { type: "boolean", short: "v", description: "print the version" } };
931
1175
  function printError(prefix, message, hint, cause) {
932
- const colors = paint(process10.stderr);
933
- const styled = takesControlCodes(process10.stderr);
1176
+ const colors = paint(process14.stderr);
1177
+ const styled = takesControlCodes(process14.stderr);
934
1178
  const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
935
1179
  const under = (label, text, tint) => text === undefined ? "" : `
936
1180
  ${styled ? tint(label) : `${label}:`} ${text}`;
@@ -1013,17 +1257,17 @@ async function printCandidates(found) {
1013
1257
  return 0;
1014
1258
  }
1015
1259
  function packageVersion(entry = Bun.main) {
1016
- for (let dir = dirname2(realpathSync(entry));; dir = dirname2(dir)) {
1260
+ for (let dir = dirname3(realpathSync(entry));; dir = dirname3(dir)) {
1017
1261
  try {
1018
- const { version } = JSON.parse(readFileSync(join3(dir, "package.json"), "utf8"));
1262
+ const { version } = JSON.parse(readFileSync2(join6(dir, "package.json"), "utf8"));
1019
1263
  if (typeof version === "string")
1020
1264
  return version;
1021
1265
  } catch {}
1022
- if (dirname2(dir) === dir)
1266
+ if (dirname3(dir) === dir)
1023
1267
  return "0.0.0";
1024
1268
  }
1025
1269
  }
1026
- async function runMain({ name, version, run, redact, usage }, argv = process10.argv.slice(2)) {
1270
+ async function runMain({ name, version, run, redact, usage }, argv = process14.argv.slice(2)) {
1027
1271
  if (argv[0] === COMPLETE)
1028
1272
  return printCandidates(leafCandidates(run, argv.slice(1)));
1029
1273
  if (argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v")) {
@@ -1050,17 +1294,17 @@ var {Glob } = globalThis.Bun;
1050
1294
  var SESSION_FILES = new Glob("*.json");
1051
1295
  var ACCOUNT_DIRS = new Glob("*/sessions");
1052
1296
  // package.json
1053
- var version = "0.13.0";
1297
+ var version = "0.15.0";
1054
1298
 
1055
1299
  // src/fix.ts
1056
- import { existsSync as existsSync2, statSync } from "fs";
1300
+ import { existsSync as existsSync4, statSync as statSync2 } from "fs";
1057
1301
  import { rename, writeFile as writeFile2 } from "fs/promises";
1058
- import { join as join8 } from "path";
1059
- import process14 from "process";
1302
+ import { join as join11 } from "path";
1303
+ import process18 from "process";
1060
1304
 
1061
1305
  // src/changes.ts
1062
1306
  import { stat as stat2 } from "fs/promises";
1063
- import { join as join4 } from "path";
1307
+ import { join as join7 } from "path";
1064
1308
  var {$ } = globalThis.Bun;
1065
1309
  async function dirtyFiles(dir) {
1066
1310
  const listed = await $`git ls-files -z --modified --others --exclude-standard`.cwd(dir).quiet().nothrow();
@@ -1069,7 +1313,7 @@ async function dirtyFiles(dir) {
1069
1313
  const files = new Map;
1070
1314
  for (const path of listed.stdout.toString().split("\x00").filter(Boolean)) {
1071
1315
  try {
1072
- const { size, mtimeMs } = await stat2(join4(dir, path));
1316
+ const { size, mtimeMs } = await stat2(join7(dir, path));
1073
1317
  files.set(path, `${size}:${mtimeMs}`);
1074
1318
  } catch {
1075
1319
  files.set(path, "");
@@ -1082,10 +1326,10 @@ function changedFiles(before, after) {
1082
1326
  }
1083
1327
 
1084
1328
  // src/compose.ts
1085
- import { existsSync } from "fs";
1086
- import { homedir as homedir3 } from "os";
1087
- import { basename, dirname as dirname3, join as join5, relative, resolve } from "path";
1088
- import process12 from "process";
1329
+ import { existsSync as existsSync3 } from "fs";
1330
+ import { homedir as homedir5 } from "os";
1331
+ import { basename, dirname as dirname4, join as join8, relative, resolve as resolve3 } from "path";
1332
+ import process16 from "process";
1089
1333
 
1090
1334
  // ../kit/src/shell.ts
1091
1335
  var SEPARATORS = new Set([`
@@ -1163,7 +1407,7 @@ function toolWords(program) {
1163
1407
  }
1164
1408
  async function readFiles(dir, names) {
1165
1409
  for (const name of names) {
1166
- const handle = Bun.file(join5(dir, name));
1410
+ const handle = Bun.file(join8(dir, name));
1167
1411
  if (await handle.exists())
1168
1412
  return { name, text: await handle.text() };
1169
1413
  }
@@ -1178,7 +1422,7 @@ async function variables(composeDir) {
1178
1422
  if (match !== null && !line.trimStart().startsWith("#"))
1179
1423
  env[match[1] ?? ""] = (match[2] ?? "").trim().replace(QUOTED, "$2");
1180
1424
  }
1181
- for (const [key, value] of Object.entries(process12.env)) {
1425
+ for (const [key, value] of Object.entries(process16.env)) {
1182
1426
  if (value !== undefined)
1183
1427
  env[key] = value;
1184
1428
  }
@@ -1198,10 +1442,10 @@ function interpolate(text, env) {
1198
1442
  function bindSource(source, composeDir, env) {
1199
1443
  const path = interpolate(source, env);
1200
1444
  if (path.startsWith("~"))
1201
- return join5(homedir3(), path.slice(1));
1445
+ return join8(homedir5(), path.slice(1));
1202
1446
  if (path.startsWith("/"))
1203
- return resolve(path);
1204
- return path.startsWith(".") ? resolve(composeDir, path) : undefined;
1447
+ return resolve3(path);
1448
+ return path.startsWith(".") ? resolve3(composeDir, path) : undefined;
1205
1449
  }
1206
1450
  function mountsOf(volumes, composeDir, env) {
1207
1451
  if (!Array.isArray(volumes))
@@ -1243,9 +1487,9 @@ async function composeFiles(composeDir, env) {
1243
1487
  const files = [];
1244
1488
  const separator = env.COMPOSE_PATH_SEPARATOR;
1245
1489
  for (const name of listed.split(separator === undefined || separator === "" ? ":" : separator).filter((entry) => entry !== "")) {
1246
- const file = Bun.file(resolve(composeDir, name));
1490
+ const file = Bun.file(resolve3(composeDir, name));
1247
1491
  if (!await file.exists())
1248
- fail(`COMPOSE_FILE names ${join5(composeDir, name)}, which does not exist`, 1, "fix COMPOSE_FILE, or run on the host with --host");
1492
+ fail(`COMPOSE_FILE names ${join8(composeDir, name)}, which does not exist`, 1, "fix COMPOSE_FILE, or run on the host with --host");
1249
1493
  files.push({ name, text: await file.text() });
1250
1494
  }
1251
1495
  return files;
@@ -1267,7 +1511,7 @@ async function readServices(composeDir) {
1267
1511
  try {
1268
1512
  parsed = parseServices(file.text, composeDir, env);
1269
1513
  } catch (error) {
1270
- fail(`cannot read ${join5(composeDir, file.name)}: ${error instanceof Error ? error.message : String(error)}`, 1, "fix the file, or run on the host with --host");
1514
+ fail(`cannot read ${join8(composeDir, file.name)}: ${error instanceof Error ? error.message : String(error)}`, 1, "fix the file, or run on the host with --host");
1271
1515
  }
1272
1516
  for (const [name, extra] of parsed) {
1273
1517
  const known = services.get(name);
@@ -1279,11 +1523,11 @@ async function readServices(composeDir) {
1279
1523
  function climb(dir) {
1280
1524
  const folders = [dir];
1281
1525
  let current = dir;
1282
- while (!existsSync(join5(current, ".git")) && dirname3(current) !== current) {
1283
- current = dirname3(current);
1526
+ while (!existsSync3(join8(current, ".git")) && dirname4(current) !== current) {
1527
+ current = dirname4(current);
1284
1528
  folders.push(current);
1285
1529
  }
1286
- return existsSync(join5(current, ".git")) ? folders : [dir];
1530
+ return existsSync3(join8(current, ".git")) ? folders : [dir];
1287
1531
  }
1288
1532
  function containerPath(service, dir) {
1289
1533
  const holding = service.mounts.filter((mount) => {
@@ -1294,7 +1538,7 @@ function containerPath(service, dir) {
1294
1538
  if (deepest === undefined)
1295
1539
  return;
1296
1540
  const inside = relative(deepest.source, dir);
1297
- return inside === "" ? deepest.target : join5(deepest.target, inside);
1541
+ return inside === "" ? deepest.target : join8(deepest.target, inside);
1298
1542
  }
1299
1543
  var noticed = new Set;
1300
1544
  async function place(dir, program, { service, host } = {}) {
@@ -1314,7 +1558,7 @@ async function place(dir, program, { service, host } = {}) {
1314
1558
  fail(`--in ${service}: no compose project mounts ${dir}`);
1315
1559
  return;
1316
1560
  }
1317
- if (Bun.which("docker", { PATH: process12.env.PATH ?? "" }) === null) {
1561
+ if (Bun.which("docker", { PATH: process16.env.PATH ?? "" }) === null) {
1318
1562
  if (service !== undefined)
1319
1563
  fail(`--in ${service}: docker not found`);
1320
1564
  if (!noticed.has(found.composeDir)) {
@@ -1366,7 +1610,7 @@ class Stack {
1366
1610
  }
1367
1611
  static async running(composeDir) {
1368
1612
  try {
1369
- const ran = await runCommand(["docker", "compose", "ps", "--services", "--status", "running"], { cwd: composeDir, env: process12.env, timeoutMs: PS_TIMEOUT_MS });
1613
+ const ran = await runCommand(["docker", "compose", "ps", "--services", "--status", "running"], { cwd: composeDir, env: process16.env, timeoutMs: PS_TIMEOUT_MS });
1370
1614
  if (ran.code !== 0)
1371
1615
  return `docker compose ps failed in ${composeDir}: ${ran.text.trim().split(`
1372
1616
  `).at(-1) ?? `exit ${ran.code}`}`;
@@ -1430,7 +1674,7 @@ ${body}`;
1430
1674
 
1431
1675
  // src/steps.ts
1432
1676
  import { readdir as readdir2 } from "fs/promises";
1433
- import { join as join6 } from "path";
1677
+ import { join as join9 } from "path";
1434
1678
  var STEP_NAMES = ["check", "typecheck", "lint", "test"];
1435
1679
  var TARGET2 = /^@?([\w-]+)(?:[ \t][^:=\n]*)?:(?!=)/gm;
1436
1680
  var JUSTFILES = ["justfile", "Justfile", ".justfile"];
@@ -1442,7 +1686,7 @@ var PHPUNIT_CONFIGS = ["phpunit.xml", "phpunit.xml.dist", "phpunit.dist.xml"];
1442
1686
  var SKIPPED = new Set(["node_modules", "vendor", "dist", "build", "var", "tmp", "coverage"]);
1443
1687
  async function readFirst(dir, files) {
1444
1688
  for (const file of files) {
1445
- const handle = Bun.file(join6(dir, file));
1689
+ const handle = Bun.file(join9(dir, file));
1446
1690
  if (await handle.exists())
1447
1691
  return { file, text: await handle.text() };
1448
1692
  }
@@ -1450,7 +1694,7 @@ async function readFirst(dir, files) {
1450
1694
  }
1451
1695
  async function read(dir, ...files) {
1452
1696
  for (const file of files) {
1453
- const handle = Bun.file(join6(dir, file));
1697
+ const handle = Bun.file(join9(dir, file));
1454
1698
  if (await handle.exists())
1455
1699
  return handle.text();
1456
1700
  }
@@ -1510,7 +1754,7 @@ async function candidates(dir, bin) {
1510
1754
  }
1511
1755
  async function firstFile(dir, names) {
1512
1756
  for (const name of names) {
1513
- if (await Bun.file(join6(dir, name)).exists())
1757
+ if (await Bun.file(join9(dir, name)).exists())
1514
1758
  return name;
1515
1759
  }
1516
1760
  return;
@@ -1537,9 +1781,9 @@ async function discoverProjects(dir) {
1537
1781
  for (const entry of entries.toSorted((a, b) => a.name.localeCompare(b.name))) {
1538
1782
  if (!entry.isDirectory() || entry.name.startsWith(".") || SKIPPED.has(entry.name))
1539
1783
  continue;
1540
- const steps = await discover(join6(dir, entry.name));
1784
+ const steps = await discover(join9(dir, entry.name));
1541
1785
  if (steps.length > 0)
1542
- projects.push({ name: entry.name, dir: join6(dir, entry.name), steps });
1786
+ projects.push({ name: entry.name, dir: join9(dir, entry.name), steps });
1543
1787
  }
1544
1788
  return projects;
1545
1789
  }
@@ -1581,8 +1825,8 @@ function pick(steps, only, noun = "step") {
1581
1825
 
1582
1826
  // src/run.ts
1583
1827
  import { mkdir as mkdir2, readdir as readdir3, stat as stat3, writeFile } from "fs/promises";
1584
- import { basename as basename2, join as join7 } from "path";
1585
- import process13 from "process";
1828
+ import { basename as basename2, join as join10 } from "path";
1829
+ import process17 from "process";
1586
1830
 
1587
1831
  // src/e2e.ts
1588
1832
  var E2E_NOISE = [
@@ -2217,7 +2461,7 @@ var runPrefix = (cwd) => `${basename2(cwd)}-${Bun.hash(cwd).toString(36)}-`;
2217
2461
  async function logDirectory(cwd) {
2218
2462
  const root = await privateLogDirectory("check");
2219
2463
  await sweepLogs(root, LOG_MAX_AGE_MS);
2220
- const path = join7(root, `${runPrefix(cwd)}${Date.now().toString(36)}-${process13.pid}`);
2464
+ const path = join10(root, `${runPrefix(cwd)}${Date.now().toString(36)}-${process17.pid}`);
2221
2465
  await mkdir2(path, { mode: 448 });
2222
2466
  return path;
2223
2467
  }
@@ -2228,7 +2472,7 @@ async function lastFailed(cwd) {
2228
2472
  for (const name of await readdir3(root)) {
2229
2473
  if (!name.startsWith(prefix))
2230
2474
  continue;
2231
- const file = join7(root, name, RESULTS_FILE);
2475
+ const file = join10(root, name, RESULTS_FILE);
2232
2476
  try {
2233
2477
  const { mtimeMs } = await stat3(file);
2234
2478
  if (latest === undefined || mtimeMs > latest.time)
@@ -2243,7 +2487,7 @@ async function lastFailed(cwd) {
2243
2487
  async function saveLog(output) {
2244
2488
  const root = await privateLogDirectory("errs");
2245
2489
  await sweepLogs(root);
2246
- const path = join7(root, `${new Date().toISOString().replaceAll(/[:.]/g, "-")}-${process13.pid}-${crypto.randomUUID().slice(0, 8)}.log`);
2490
+ const path = join10(root, `${new Date().toISOString().replaceAll(/[:.]/g, "-")}-${process17.pid}-${crypto.randomUUID().slice(0, 8)}.log`);
2247
2491
  await writeFile(path, output, { mode: 384, flag: "wx" });
2248
2492
  return path;
2249
2493
  }
@@ -2251,7 +2495,7 @@ async function runStep(command, cwd, logFile, { env = {}, timeoutMs, held } = {}
2251
2495
  const started = Date.now();
2252
2496
  const { code, text, timedOut } = await runCommand(["sh", "-c", `${command} 2>&1`], {
2253
2497
  cwd,
2254
- env: { ...process13.env, NO_COLOR: "1", FORCE_COLOR: "0", ...env },
2498
+ env: { ...process17.env, NO_COLOR: "1", FORCE_COLOR: "0", ...env },
2255
2499
  ...timeoutMs === undefined ? {} : { timeoutMs },
2256
2500
  ...held === undefined ? {} : { onStart: (child) => held.forward(child) }
2257
2501
  });
@@ -2267,14 +2511,17 @@ function outcomeJson(name, command, logFile, outcome, service) {
2267
2511
  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) } };
2268
2512
  }
2269
2513
  function printOutcome(name, width, command, logFile, outcome) {
2514
+ const colors = paint(process17.stdout);
2515
+ const path = role("path", process17.stdout);
2516
+ const took = colors.dim(formatDuration(outcome.ms));
2270
2517
  if (outcome.ok) {
2271
- console.log(`ok ${name.padEnd(width)} ${formatDuration(outcome.ms)} ${logFile}`);
2518
+ console.log(`${colors.bold(colors.green("ok "))} ${name.padEnd(width)} ${took} ${path(logFile)}`);
2272
2519
  return;
2273
2520
  }
2274
- const label = outcome.timedOut === true ? "TIME " : "FAIL ";
2275
- console.log(`${label} ${name.padEnd(width)} ${formatDuration(outcome.ms)} ${command} ${logFile}`);
2521
+ const label = outcome.timedOut === true ? colors.bold(colors.yellow("TIME ")) : colors.bold(colors.red("FAIL "));
2522
+ console.log(`${label} ${name.padEnd(width)} ${took} ${colors.dim(command)} ${path(logFile)}`);
2276
2523
  if (outcome.timedOut === true)
2277
- console.log(` timed out after ${formatDuration(outcome.ms)}, the step and what it started were ended`);
2524
+ console.log(colors.yellow(` timed out after ${formatDuration(outcome.ms)}, the step and what it started were ended`));
2278
2525
  console.log(failureExcerpt(outcome.output).split(`
2279
2526
  `).map((line) => ` ${line}`.trimEnd()).join(`
2280
2527
  `));
@@ -2296,8 +2543,8 @@ var RUFF_CONFIGS = ["ruff.toml", ".ruff.toml"];
2296
2543
  var RUFF_SECTION = /^\[tool\.ruff/m;
2297
2544
  var MAX_CHANGED = 30;
2298
2545
  async function replaceFile(path, content) {
2299
- const temporary = `${path}.${process14.pid}.tmp`;
2300
- await writeFile2(temporary, content, { mode: statSync(path).mode & 511 });
2546
+ const temporary = `${path}.${process18.pid}.tmp`;
2547
+ await writeFile2(temporary, content, { mode: statSync2(path).mode & 511 });
2301
2548
  await rename(temporary, path);
2302
2549
  }
2303
2550
  async function projectFixers(dir) {
@@ -2315,9 +2562,9 @@ async function toolFixers(dir) {
2315
2562
  const ruff = await firstFile(dir, RUFF_CONFIGS) !== undefined || RUFF_SECTION.test(await read(dir, "pyproject.toml") ?? "");
2316
2563
  if (makefile !== undefined) {
2317
2564
  fixers.push({ name: "makefile", command: "declare every target .PHONY", source: makefile, write: async (cwd) => {
2318
- const path = join8(cwd, makefile);
2565
+ const path = join11(cwd, makefile);
2319
2566
  const current = await Bun.file(path).text();
2320
- const { content, targets } = declarePhony(current, (name) => existsSync2(join8(cwd, name)));
2567
+ const { content, targets } = declarePhony(current, (name) => existsSync4(join11(cwd, name)));
2321
2568
  if (content !== current)
2322
2569
  await replaceFile(path, content);
2323
2570
  return `.PHONY: ${targets.join(" ")}`;
@@ -2325,9 +2572,9 @@ async function toolFixers(dir) {
2325
2572
  }
2326
2573
  if (justfile !== undefined)
2327
2574
  fixers.push({ name: "justfile", command: `just --justfile ${justfile} --fmt`, source: justfile, requires: "just" });
2328
- if (await Bun.file(join8(dir, "go.mod")).exists())
2575
+ if (await Bun.file(join11(dir, "go.mod")).exists())
2329
2576
  fixers.push({ name: "go", command: "go fmt ./... && go mod tidy", source: "go.mod", requires: "go" });
2330
- if (await Bun.file(join8(dir, "Cargo.toml")).exists())
2577
+ if (await Bun.file(join11(dir, "Cargo.toml")).exists())
2331
2578
  fixers.push({ name: "rust", command: "cargo fmt", source: "Cargo.toml", requires: "cargo" });
2332
2579
  if (ruff)
2333
2580
  fixers.push({ name: "python", command: "ruff check --fix . && ruff format .", source: "ruff", requires: "ruff" });
@@ -2368,14 +2615,14 @@ function printChanged(changed) {
2368
2615
  if (changed.length > MAX_CHANGED)
2369
2616
  console.log(` and ${changed.length - MAX_CHANGED} more`);
2370
2617
  }
2371
- async function fix(args, cwd = process14.cwd()) {
2618
+ async function fix(args, cwd = process18.cwd()) {
2372
2619
  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"]] });
2373
2620
  return runFixers(parsed.values, cwd);
2374
2621
  }
2375
2622
  async function runFixers(values, cwd) {
2376
2623
  const parsed = { values };
2377
2624
  const settings = placeSettings(values);
2378
- if (process14.env[RUNNING] !== undefined)
2625
+ if (process18.env[RUNNING] !== undefined)
2379
2626
  fail("a fixer called fix again, which would recurse: give its script another command");
2380
2627
  const found = await fixers(cwd);
2381
2628
  if (found.length === 0)
@@ -2409,11 +2656,11 @@ async function runFixers(values, cwd) {
2409
2656
  break;
2410
2657
  if (missing(fixer)) {
2411
2658
  if (!json)
2412
- console.log(`skip ${fixer.name.padEnd(width)} ${fixer.requires} is not installed`);
2659
+ console.log(`${paint(process18.stdout).yellow("skip ")} ${fixer.name.padEnd(width)} ${fixer.requires} is not installed`);
2413
2660
  ran.push({ name: fixer.name, command: fixer.command, skipped: `${fixer.requires} is not installed` });
2414
2661
  continue;
2415
2662
  }
2416
- const logFile = join8(directory, `fix-${fixer.name.replaceAll(":", "-")}.log`);
2663
+ const logFile = join11(directory, `fix-${fixer.name.replaceAll(":", "-")}.log`);
2417
2664
  const placement = placements.get(fixer);
2418
2665
  const down = placement === undefined ? undefined : await stack.problem(placement);
2419
2666
  const outcome = down === undefined ? await runFixer(fixer, placement, cwd, logFile, runSettings) : await refusedStep(down, logFile);
@@ -2442,4 +2689,4 @@ async function runFixers(values, cwd) {
2442
2689
  }
2443
2690
 
2444
2691
  // src/fix-cli.ts
2445
- process15.exitCode = await runMain({ name: "fix", version, run: async (args) => fix(args) });
2692
+ process19.exitCode = await runMain({ name: "fix", version, run: async (args) => fix(args) });