@kaynooo/cli-check 0.20.1 → 0.21.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/errs-cli.js CHANGED
@@ -1,20 +1,19 @@
1
1
  #!/usr/bin/env -S bun --no-env-file --config=/dev/null
2
2
  // @bun
3
+ var __esm = (fn, res, err) => () => {
4
+ if (fn)
5
+ try {
6
+ res = fn(fn = 0);
7
+ } catch (e) {
8
+ err = [e];
9
+ }
10
+ if (err)
11
+ throw err[0];
12
+ return res;
13
+ };
3
14
 
4
- // src/errs-cli.ts
5
- import process22 from "process";
6
- // ../kit/src/args.ts
7
- import process10 from "process";
8
- import { parseArgs } from "util";
9
-
10
- // ../kit/src/format.ts
11
- import process7 from "process";
12
-
13
- // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-rxztfxgv.js
14
- var N = new Map;
15
- var Nt = /\s+\S*$/;
16
- var Y = /\s/;
17
- function ko(t, e, r = "...") {
15
+ // ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-rkhsft4a.js
16
+ function Ao(t, e, r = "...") {
18
17
  let { suffix: n = "...", includeSuffix: s = false, wordBoundary: o = false } = typeof r === "string" ? { suffix: r } : r;
19
18
  if (t.length <= e)
20
19
  return t;
@@ -25,13 +24,22 @@ function ko(t, e, r = "...") {
25
24
  c = c.trimEnd();
26
25
  return s ? (c + n).slice(0, l) : c + n;
27
26
  }
28
- var be = new Map(["\u20AC", "", "\u201A", "\u0192", "\u201E", "\u2026", "\u2020", "\u2021", "\u02C6", "\u2030", "\u0160", "\u2039", "\u0152", "", "\u017D", "", "", "\u2018", "\u2019", "\u201C", "\u201D", "\u2022", "\u2013", "\u2014", "\u02DC", "\u2122", "\u0161", "\u203A", "\u0153", "", "\u017E", "\u0178"].map((t, e) => [t, 128 + e]).filter(([t]) => t));
29
- var z = new Map;
27
+ var N, Nt, Y, be, W;
28
+ var init_chunk_rkhsft4a = __esm(() => {
29
+ N = new Map;
30
+ Nt = /\s+\S*$/;
31
+ Y = /\s/;
32
+ be = new Map(["\u20AC", "", "\u201A", "\u0192", "\u201E", "\u2026", "\u2020", "\u2021", "\u02C6", "\u2030", "\u0160", "\u2039", "\u0152", "", "\u017D", "", "", "\u2018", "\u2019", "\u201C", "\u201D", "\u2022", "\u2013", "\u2014", "\u02DC", "\u2122", "\u0161", "\u203A", "\u0153", "", "\u017E", "\u0178"].map((t, e) => [t, 128 + e]).filter(([t]) => t));
33
+ W = new Map;
34
+ });
35
+
36
+ // ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/text.js
37
+ var init_text = __esm(() => {
38
+ init_chunk_rkhsft4a();
39
+ });
30
40
 
31
41
  // ../kit/src/mode.ts
32
42
  import process2 from "process";
33
- var MODES = new Set(["terminal", "ci", "agent", "pipe"]);
34
- var AGENT_VARIABLES = ["CLAUDECODE", "AI_AGENT"];
35
43
  function isSet(value) {
36
44
  return value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
37
45
  }
@@ -48,12 +56,13 @@ function outputMode(stream = process2.stdout, env = process2.env) {
48
56
  function isInteractive(streams = process2) {
49
57
  return streams.stdin?.isTTY === true && streams.stderr?.isTTY === true;
50
58
  }
59
+ var MODES, AGENT_VARIABLES;
60
+ var init_mode = __esm(() => {
61
+ MODES = new Set(["terminal", "ci", "agent", "pipe"]);
62
+ AGENT_VARIABLES = ["CLAUDECODE", "AI_AGENT"];
63
+ });
51
64
 
52
- // ../kit/src/style.ts
53
- import process6 from "process";
54
-
55
- // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
56
- var G2 = /^[a-f0-9]+$/i;
65
+ // ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
57
66
  function b(r) {
58
67
  let e = r.startsWith("#") ? r.slice(1) : r;
59
68
  if (!G2.test(e))
@@ -64,11 +73,6 @@ function b(r) {
64
73
  throw Error(`Invalid hex color length: ${e.length}`);
65
74
  return [Number.parseInt(e.slice(0, 2), 16), Number.parseInt(e.slice(2, 4), 16), Number.parseInt(e.slice(4, 6), 16)];
66
75
  }
67
- var B2 = { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29], black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], gray: [90, 39], grey: [90, 39], blackBright: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39], bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49], rgb: (r, e, l, n = "fg") => [`${n === "fg" ? 38 : 48};2;${r};${e};${l}`, n === "fg" ? 39 : 49], hex: (r, e = "fg") => {
68
- let [l, n, c] = b(r);
69
- return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
70
- }, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
71
- var h = new Set(["", "1", "2", "3", "true"]);
72
76
  function C(r, e = globalThis.process?.env ?? {}) {
73
77
  if (e.FORCE_COLOR !== undefined)
74
78
  return h.has(e.FORCE_COLOR);
@@ -82,7 +86,7 @@ function f(r, e = []) {
82
86
  l += `\x1B[${e[t][0]}m`, n = `\x1B[${e[t][1]}m${n}`;
83
87
  let c = (t) => C(r.stream ?? globalThis.process?.stdout, r.env) ? l + t + n : t, g = new Map;
84
88
  return new Proxy(c, { get(t, i) {
85
- let a = B2[i];
89
+ let a = B[i];
86
90
  if (Array.isArray(a)) {
87
91
  let s = g.get(i);
88
92
  if (s === undefined)
@@ -105,13 +109,21 @@ function f(r, e = []) {
105
109
  function Fe(r = {}) {
106
110
  return f(r);
107
111
  }
108
- var o = Fe();
112
+ var G2, B, h, o;
113
+ var init_chunk_x450vn3m = __esm(() => {
114
+ G2 = /^[a-f0-9]+$/i;
115
+ B = { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29], black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], gray: [90, 39], grey: [90, 39], blackBright: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39], bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49], rgb: (r, e, l, n = "fg") => [`${n === "fg" ? 38 : 48};2;${r};${e};${l}`, n === "fg" ? 39 : 49], hex: (r, e = "fg") => {
116
+ let [l, n, c] = b(r);
117
+ return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
118
+ }, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
119
+ h = new Set(["", "1", "2", "3", "true"]);
120
+ o = Fe();
121
+ });
109
122
 
110
- // ../kit/src/theme.ts
111
- import { existsSync as existsSync3, readFileSync as readFileSync2, statSync } from "fs";
112
- import { homedir as homedir2 } from "os";
113
- import { join as join3, resolve as resolve2 } from "path";
114
- import process5 from "process";
123
+ // ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/tools/colors.js
124
+ var init_colors = __esm(() => {
125
+ init_chunk_x450vn3m();
126
+ });
115
127
 
116
128
  // ../kit/src/config.ts
117
129
  import { existsSync } from "fs";
@@ -127,6 +139,9 @@ function findUp(names, from = process3.cwd(), stop = () => false) {
127
139
  return;
128
140
  }
129
141
  }
142
+ var init_config = __esm(() => {
143
+ init_args();
144
+ });
130
145
 
131
146
  // ../kit/src/user-config.ts
132
147
  import { existsSync as existsSync2, readFileSync } from "fs";
@@ -158,36 +173,18 @@ function readUserConfig(bin, where = {}, legacy = []) {
158
173
  return {};
159
174
  }
160
175
  }
176
+ var init_user_config = () => {};
161
177
 
162
178
  // ../kit/src/theme.ts
163
- var ENDS = new Map;
164
- var DEFAULT = {
165
- colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", plan: "magenta", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
166
- glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", plan: "\u25C7", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D", open: "\u2022", leaf: "\xB7", guide: "\u2502" },
167
- accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
168
- bins: {},
169
- gradient: ["#c084fc", "#67e8f9"]
170
- };
171
- var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", plan: "magentaBright", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
172
- var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", plan: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
173
- var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", plan: "?", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
174
- var PRESETS = {
175
- default: {},
176
- "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
177
- mono: { colors: MONO, accents: ["bold"], gradient: undefined },
178
- ascii: { glyphs: ASCII }
179
- };
180
- 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"]);
181
- var HEX = /^#[0-9a-f]{6}$/i;
182
- var CONTROL = /\p{Cc}/u;
183
- var MAX_FILE_BYTES = 64 * 1024;
184
- var SPACES = /\s+/;
179
+ import { existsSync as existsSync3, readFileSync as readFileSync2, statSync } from "fs";
180
+ import { homedir as homedir2 } from "os";
181
+ import { join as join3, resolve as resolve2 } from "path";
182
+ import process5 from "process";
185
183
  function isColorSpec(spec) {
186
184
  if (typeof spec === "number")
187
185
  return Number.isInteger(spec) && spec >= 0 && spec <= 255;
188
186
  return typeof spec === "string" && spec.trim() !== "" && spec.trim().split(SPACES).every((token) => STYLES.has(token) || HEX.test(token));
189
187
  }
190
- var CUBE = [0, 95, 135, 175, 215, 255];
191
188
  function cubeLevel(channel) {
192
189
  return CUBE.reduce((best, value, level) => Math.abs(value - channel) < Math.abs(CUBE[best] - channel) ? level : best, 0);
193
190
  }
@@ -292,7 +289,6 @@ function applyFile(theme, file, where, warn) {
292
289
  function endsWalk(home) {
293
290
  return (dir) => dir === resolve2(home) || existsSync3(join3(dir, ".git"));
294
291
  }
295
- var warned = new Set;
296
292
  function warnOnce(message) {
297
293
  if (warned.has(message))
298
294
  return;
@@ -329,8 +325,6 @@ function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(
329
325
  }
330
326
  return { theme, sources, preset };
331
327
  }
332
- var current;
333
- var currentKey = "";
334
328
  function activeTheme() {
335
329
  const key = `${process5.cwd()}\x00${process5.env.KIT_THEME ?? ""}\x00${process5.env.XDG_CONFIG_HOME ?? ""}`;
336
330
  if (current === undefined || key !== currentKey) {
@@ -339,9 +333,38 @@ function activeTheme() {
339
333
  }
340
334
  return current;
341
335
  }
336
+ var ENDS, DEFAULT, BRIGHT, MONO, ASCII, PRESETS, STYLES, HEX, CONTROL, MAX_FILE_BYTES, SPACES, CUBE, warned, current, currentKey = "";
337
+ var init_theme = __esm(() => {
338
+ init_config();
339
+ init_user_config();
340
+ ENDS = new Map;
341
+ DEFAULT = {
342
+ colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", plan: "magenta", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
343
+ glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", plan: "\u25C7", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D", open: "\u2022", leaf: "\xB7", guide: "\u2502" },
344
+ accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
345
+ bins: {},
346
+ gradient: ["#c084fc", "#67e8f9"]
347
+ };
348
+ BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", plan: "magentaBright", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
349
+ MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", plan: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
350
+ ASCII = { ok: "+", warn: "!", problem: "x", note: ">", plan: "?", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
351
+ PRESETS = {
352
+ default: {},
353
+ "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
354
+ mono: { colors: MONO, accents: ["bold"], gradient: undefined },
355
+ ascii: { glyphs: ASCII }
356
+ };
357
+ 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"]);
358
+ HEX = /^#[0-9a-f]{6}$/i;
359
+ CONTROL = /\p{Cc}/u;
360
+ MAX_FILE_BYTES = 64 * 1024;
361
+ SPACES = /\s+/;
362
+ CUBE = [0, 95, 135, 175, 215, 255];
363
+ warned = new Set;
364
+ });
342
365
 
343
366
  // ../kit/src/style.ts
344
- var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:", plan: "would:" };
367
+ import process6 from "process";
345
368
  function takesControlCodes(stream, env = process6.env) {
346
369
  return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
347
370
  }
@@ -364,14 +387,6 @@ function role(name, stream, env = process6.env) {
364
387
  const colors = paint(stream, env);
365
388
  return takesControlCodes(stream, env) ? tinted(colors, activeTheme().theme.colors[name], env) : colors;
366
389
  }
367
- var STATUS_WORDS = {
368
- passed: ["passed", "success", "succeeded", "ok"],
369
- failed: ["failed", "failure", "error", "errored"],
370
- running: ["running", "in_progress", "started", "holding"],
371
- queued: ["queued", "waiting", "pending", "created", "blocked", "scheduled"],
372
- skipped: ["skipped", "cancelled", "canceled", "manual"]
373
- };
374
- var STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
375
390
  function header(bin, context, stream, env = process6.env) {
376
391
  if (!takesControlCodes(stream, env))
377
392
  return "";
@@ -382,9 +397,24 @@ function header(bin, context, stream, env = process6.env) {
382
397
  const accent = tinted(typeof spec === "string" && spec.split(" ").includes("bold") ? colors : colors.bold, spec, env);
383
398
  return `${accent(bin)}${context === undefined ? "" : colors.dim(` \u203A ${context}`)}`;
384
399
  }
400
+ var MARK_WORDS, STATUS_WORDS, STATUS_OF;
401
+ var init_style = __esm(() => {
402
+ init_colors();
403
+ init_mode();
404
+ init_theme();
405
+ MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:", plan: "would:" };
406
+ STATUS_WORDS = {
407
+ passed: ["passed", "success", "succeeded", "ok"],
408
+ failed: ["failed", "failure", "error", "errored"],
409
+ running: ["running", "in_progress", "started", "holding"],
410
+ queued: ["queued", "waiting", "pending", "created", "blocked", "scheduled"],
411
+ skipped: ["skipped", "cancelled", "canceled", "manual"]
412
+ };
413
+ STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
414
+ });
385
415
 
386
416
  // ../kit/src/format.ts
387
- var UNITS = [["d", 86400], ["h", 3600], ["m", 60], ["s", 1]];
417
+ import process7 from "process";
388
418
  function formatSeconds(total) {
389
419
  let rest = Math.max(0, Math.round(total));
390
420
  const amounts = UNITS.map(([unit, size]) => {
@@ -406,10 +436,8 @@ function upTo(text, separator) {
406
436
  return end === -1 ? text : text.slice(0, end);
407
437
  }
408
438
  function truncate(text, width) {
409
- return ko(text, width, { suffix: "\u2026", includeSuffix: true });
439
+ return Ao(text, width, { suffix: "\u2026", includeSuffix: true });
410
440
  }
411
- var LINE_BREAKS = /\s*\n\s*/g;
412
- var ESCAPE = String.fromCharCode(27);
413
441
  function textWidth(text) {
414
442
  return Bun.stringWidth(text);
415
443
  }
@@ -458,14 +486,40 @@ function jsonText(value, replacer, { stream = process7.stdout, env = process7.en
458
486
  function printJson(value) {
459
487
  console.log(jsonText(value));
460
488
  }
489
+ var UNITS, LINE_BREAKS, ESCAPE;
490
+ var init_format = __esm(() => {
491
+ init_text();
492
+ init_mode();
493
+ init_style();
494
+ UNITS = [["d", 86400], ["h", 3600], ["m", 60], ["s", 1]];
495
+ LINE_BREAKS = /\s*\n\s*/g;
496
+ ESCAPE = String.fromCharCode(27);
497
+ });
461
498
 
462
499
  // ../kit/src/help.ts
463
500
  import process8 from "process";
464
- var OPTIONAL = /(?<!\x1B)\[[^\]]+\]/g;
465
- var USAGE_PREFIX = /^usage:\s*/i;
466
- var FULL_STOP = /\.$/;
467
501
  function usageLine(usage, colors = paint(process8.stdout)) {
468
- return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
502
+ const lines = usage.replace(USAGE_PREFIX, "").split(`
503
+ `);
504
+ const blank = lines.indexOf("");
505
+ const synopses = blank === -1 ? lines : lines.slice(0, blank);
506
+ const details = blank === -1 ? [] : lines.slice(blank + 1);
507
+ const colon = synopses[0].indexOf(": ");
508
+ const inline = synopses[0].slice(colon + 2);
509
+ const summary = colon === -1 ? details.shift() : `${inline.charAt(0).toUpperCase()}${inline.slice(1)}`;
510
+ if (colon !== -1)
511
+ synopses[0] = synopses[0].slice(0, colon);
512
+ const head = `${colors.bold("Usage:")} ${synopses.map((line) => line.replaceAll(OPTIONAL, (part) => colors.dim(part))).join(`
513
+ `)}`;
514
+ const lead = summary === undefined ? [] : ["", colors.bold(prose(summary, colors))];
515
+ const rest = details.length === 0 ? [] : ["", ...details.map((line) => prose(line, colors))];
516
+ return [head, ...lead, ...rest].join(`
517
+ `);
518
+ }
519
+ function prose(line, colors) {
520
+ if (colors.cyan("x") === "x")
521
+ return line;
522
+ return line.replaceAll(PROSE_MARKS, (match, code, flag) => code === undefined ? colors.cyan(flag ?? match) : colors.bold(code));
469
523
  }
470
524
  function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
471
525
  return [usageLine(usage, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
@@ -500,7 +554,6 @@ function exampleRows(examples, colors = paint(process8.stdout)) {
500
554
  return [];
501
555
  return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
502
556
  }
503
- var MAX_INLINE_CHOICES = 24;
504
557
  function optionRows(options, colors = paint(process8.stdout)) {
505
558
  const rows = Object.entries(options).map(([name, option]) => {
506
559
  const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
@@ -515,9 +568,17 @@ function optionRows(options, colors = paint(process8.stdout)) {
515
568
  const width = Math.max(0, ...rows.map((row) => row.width));
516
569
  return rows.map((row) => row.description === "" ? ` ${row.flag}` : ` ${row.flag}${" ".repeat(width - row.width)} ${colors.dim(row.description)}`);
517
570
  }
571
+ var OPTIONAL, USAGE_PREFIX, FULL_STOP, PROSE_MARKS, MAX_INLINE_CHOICES = 24;
572
+ var init_help = __esm(() => {
573
+ init_mode();
574
+ init_style();
575
+ OPTIONAL = /(?<!\x1B)\[[^\]]+\]/g;
576
+ USAGE_PREFIX = /^usage:\s*/i;
577
+ FULL_STOP = /\.$/;
578
+ PROSE_MARKS = /`([^`\n]+)`|(?<![\w-])(--[a-z][\w-]*|-[a-z](?![\w-]))/gi;
579
+ });
518
580
 
519
581
  // ../kit/src/text.ts
520
- var ANSI = /\x1B(?:\[[\x30-\x3F]*[\x20-\x2F]*[\x40-\x7E]|\][^\x07\x1B]*(?:\x07|\x1B\\)|[\x40-\x5A\x5C-\x5F])/g;
521
582
  function stripAnsi(text) {
522
583
  return text.replace(ANSI, "");
523
584
  }
@@ -546,10 +607,13 @@ function closest(name, names) {
546
607
  const [best] = names.map((known) => ({ known, far: distance(name, known) })).sort((a, b) => a.far - b.far);
547
608
  return best !== undefined && best.far <= (name.length < 4 ? 1 : 2) ? best.known : undefined;
548
609
  }
610
+ var ANSI;
611
+ var init_text2 = __esm(() => {
612
+ ANSI = /\x1B(?:\[[\x30-\x3F]*[\x20-\x2F]*[\x40-\x7E]|\][^\x07\x1B]*(?:\x07|\x1B\\)|[\x40-\x5A\x5C-\x5F])/g;
613
+ });
614
+
549
615
  // ../kit/src/input.ts
550
616
  import process9 from "process";
551
- var DURATION = /^(\d+(?:\.\d+)?)(ms|[smhd])?$/;
552
- var UNIT_MS = { ms: 1, s: 1000, m: 60000, h: 3600000, d: 86400000 };
553
617
  function duration(value, name, fallback, unit = "s") {
554
618
  if (value === undefined)
555
619
  return fallback;
@@ -570,40 +634,26 @@ async function readInput(path, { noStdin = "nothing is piped on stdin" } = {}) {
570
634
  fail(`no file ${path}`);
571
635
  return file.text();
572
636
  }
637
+ var DURATION, UNIT_MS;
638
+ var init_input = __esm(() => {
639
+ init_args();
640
+ DURATION = /^(\d+(?:\.\d+)?)(ms|[smhd])?$/;
641
+ UNIT_MS = { ms: 1, s: 1000, m: 60000, h: 3600000, d: 86400000 };
642
+ });
573
643
 
574
644
  // ../kit/src/args.ts
575
- var DASHES = /^-+/;
645
+ import process10 from "process";
646
+ import { parseArgs } from "util";
576
647
  function jsonOption(holds) {
577
648
  return { type: "boolean", description: holds === undefined ? "print JSON" : `print JSON: ${holds}` };
578
649
  }
579
- class Exit extends Error {
580
- code;
581
- hint;
582
- constructor(message, code, hint) {
583
- super(message);
584
- this.code = code;
585
- this.hint = hint;
586
- }
587
- }
588
650
  function fail(message, code = 2, hint) {
589
651
  throw new Exit(message, code, hint);
590
652
  }
591
-
592
- class UsageError extends Exit {
593
- constructor(message, hint) {
594
- super(message, 2, hint);
595
- }
596
- }
597
653
  function badUsage(message) {
598
654
  throw new UsageError(message);
599
655
  }
600
656
 
601
- class HelpShown extends Exit {
602
- constructor() {
603
- super("help shown", 0);
604
- }
605
- }
606
-
607
657
  class Completing {
608
658
  options;
609
659
  positionals;
@@ -614,11 +664,6 @@ class Completing {
614
664
  this.candidates = candidates;
615
665
  }
616
666
  }
617
- var completion = { active: false };
618
- var OUTPUT_OPTIONS = {
619
- color: { type: "string", choices: ["auto", "always", "never"], description: "auto (the default) colours on a terminal alone" },
620
- plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
621
- };
622
667
  function applyOutput(color, plain, env = process10.env) {
623
668
  const when = plain === true ? "never" : color ?? "auto";
624
669
  if (when === "auto")
@@ -772,7 +817,6 @@ function parseError(error) {
772
817
  const message = upTo(error instanceof Error ? error.message : String(error), ". ");
773
818
  return `${message.charAt(0).toLowerCase()}${message.slice(1)}`;
774
819
  }
775
- var UNKNOWN_OPTION = /^unknown option '(-[^']+)'/;
776
820
  function nearestOption(message, options, allowNegative) {
777
821
  const typed = UNKNOWN_OPTION.exec(message)?.[1];
778
822
  if (typed === undefined)
@@ -788,6 +832,72 @@ function nearestOption(message, options, allowNegative) {
788
832
  const meant = closest(word, known.map((flag) => flag.replace(DASHES, "")));
789
833
  return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
790
834
  }
835
+ var DASHES, EXIT, Exit, UsageError, HelpShown, completion, OUTPUT_OPTIONS, UNKNOWN_OPTION;
836
+ var init_args = __esm(() => {
837
+ init_format();
838
+ init_help();
839
+ init_text2();
840
+ init_help();
841
+ init_input();
842
+ DASHES = /^-+/;
843
+ EXIT = Symbol.for("@kaynooo/cli-kit/Exit");
844
+ Exit = class Exit extends Error {
845
+ code;
846
+ hint;
847
+ [EXIT] = true;
848
+ constructor(message, code, hint) {
849
+ super(message);
850
+ this.code = code;
851
+ this.hint = hint;
852
+ }
853
+ static [Symbol.hasInstance](value) {
854
+ if (this !== Exit)
855
+ return Function.prototype[Symbol.hasInstance].call(this, value);
856
+ return typeof value === "object" && value !== null && value[EXIT] === true;
857
+ }
858
+ };
859
+ UsageError = class UsageError extends Exit {
860
+ constructor(message, hint) {
861
+ super(message, 2, hint);
862
+ }
863
+ };
864
+ HelpShown = class HelpShown extends Exit {
865
+ constructor() {
866
+ super("help shown", 0);
867
+ }
868
+ };
869
+ completion = { active: false };
870
+ OUTPUT_OPTIONS = {
871
+ color: { type: "string", choices: ["auto", "always", "never"], description: "auto (the default) colours on a terminal alone" },
872
+ plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
873
+ };
874
+ UNKNOWN_OPTION = /^unknown option '(-[^']+)'/;
875
+ });
876
+
877
+ // ../kit/src/folders.ts
878
+ import { homedir as homedir5 } from "os";
879
+ import { join as join7 } from "path";
880
+ import process18 from "process";
881
+ function ignoredFolders(extra = [], where = {}) {
882
+ const configured = readUserConfig("config", where).ignore;
883
+ const names = Array.isArray(configured) ? configured.filter((name) => typeof name === "string" && name !== "") : [];
884
+ return new Set([...SKIPPED_FOLDERS, ...extra, ...names]);
885
+ }
886
+ function cacheFolder({ home = homedir5(), env = process18.env } = {}) {
887
+ return env.XDG_CACHE_HOME ?? join7(home, ".cache");
888
+ }
889
+ var SKIPPED_FOLDERS;
890
+ var init_folders = __esm(() => {
891
+ init_user_config();
892
+ SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
893
+ });
894
+
895
+ // src/errs-cli.ts
896
+ import process23 from "process";
897
+
898
+ // ../kit/src/index.ts
899
+ init_args();
900
+
791
901
  // ../kit/src/argv.ts
792
902
  import { readFileSync as readFileSync3, realpathSync } from "fs";
793
903
  import { resolve as resolve3 } from "path";
@@ -812,6 +922,18 @@ function scriptArgs(argv = process11.argv.slice(2), cmdline = commandLine(), scr
812
922
  const after = at === -1 ? [] : cmdline.slice(at + 1);
813
923
  return after[0] === "--" && after.length === argv.length + 1 && argv.every((word, index) => word === after[index + 1]) ? after : argv;
814
924
  }
925
+ // ../kit/src/chart.ts
926
+ init_format();
927
+ init_mode();
928
+ init_style();
929
+ init_theme();
930
+ // ../kit/src/ci.ts
931
+ init_args();
932
+ init_format();
933
+
934
+ // ../kit/src/progress.ts
935
+ init_format();
936
+
815
937
  // ../kit/src/process.ts
816
938
  import { constants } from "os";
817
939
  import process12 from "process";
@@ -855,10 +977,10 @@ function holdSignals(cleanup) {
855
977
  process12.on(signal, onSignal);
856
978
  return held;
857
979
  }
858
- async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
980
+ async function runCommand(argv, { cwd, env, stdin = "ignore", input, timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
859
981
  const chunks = [];
860
982
  const grouped = timeoutMs !== undefined || signal !== undefined || onStart !== undefined || onChunk !== undefined;
861
- const proc = Bun.spawn(argv, { ...cwd === undefined ? {} : { cwd }, ...env === undefined ? {} : { env }, stdin, stdout: "pipe", stderr: "pipe", ...grouped ? { detached: true } : {} });
983
+ const proc = Bun.spawn(argv, { ...cwd === undefined ? {} : { cwd }, ...env === undefined ? {} : { env }, stdin: input === undefined ? stdin : new TextEncoder().encode(input), stdout: "pipe", stderr: "pipe", ...grouped ? { detached: true } : {} });
862
984
  const state = { kept: 0, truncated: false, timedOut: false, failure: undefined, done: false };
863
985
  const timers = [];
864
986
  const killGroup = (killing) => {
@@ -935,14 +1057,62 @@ async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal,
935
1057
  }
936
1058
 
937
1059
  // ../kit/src/progress.ts
1060
+ init_style();
1061
+ init_theme();
938
1062
  var ESC = String.fromCharCode(27);
939
1063
  var ESCAPE_CODE = new RegExp(`${ESC}(?:\\[[\\x30-\\x3F]*[\\x20-\\x2F]*[\\x40-\\x7E]|\\][^\\u0007${ESC}]*(?:\\u0007|${ESC}\\\\))`, "y");
940
1064
  var RESET_STYLE = `${ESC}[0m`;
941
1065
  var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
1066
+
1067
+ // ../kit/src/ci.ts
1068
+ init_style();
1069
+
1070
+ // ../kit/src/tool.ts
1071
+ init_format();
942
1072
  // ../kit/src/cli.ts
1073
+ init_args();
943
1074
  import { readFileSync as readFileSync4, realpathSync as realpathSync2 } from "fs";
944
1075
  import { dirname as dirname3, join as join6 } from "path";
945
- import process16 from "process";
1076
+ import process17 from "process";
1077
+
1078
+ // ../kit/src/askpass.ts
1079
+ import process13 from "process";
1080
+ var SOCKET_VARIABLE = "KAYNOOO_ASKPASS_SOCKET";
1081
+ async function askpassClient(argv) {
1082
+ const socketPath = process13.env[SOCKET_VARIABLE];
1083
+ if (socketPath === undefined)
1084
+ return;
1085
+ const request = { prompt: argv[0] ?? "", ...process13.env.SSH_ASKPASS_PROMPT === "none" ? { notice: true } : {} };
1086
+ const { promise, resolve } = Promise.withResolvers();
1087
+ let received = "";
1088
+ try {
1089
+ await Bun.connect({
1090
+ unix: socketPath,
1091
+ socket: {
1092
+ open: (socket) => void socket.write(`${JSON.stringify(request)}
1093
+ `),
1094
+ data: (_, chunk) => {
1095
+ received += chunk.toString();
1096
+ },
1097
+ close: () => resolve(received),
1098
+ error: () => resolve("")
1099
+ }
1100
+ });
1101
+ } catch {
1102
+ return 1;
1103
+ }
1104
+ const reply = await promise;
1105
+ if (reply === "")
1106
+ return 1;
1107
+ const { answer } = JSON.parse(reply);
1108
+ if (request.notice === true)
1109
+ return 0;
1110
+ if (answer === undefined)
1111
+ return 1;
1112
+ process13.stdout.write(`${answer}
1113
+ `);
1114
+ return 0;
1115
+ }
946
1116
 
947
1117
  // ../kit/src/completions.ts
948
1118
  var COMPLETION_SHELLS = ["fish", "bash", "zsh"];
@@ -1005,46 +1175,52 @@ compdef __kaynooo_cli_complete ${bins.join(" ")}
1005
1175
  }
1006
1176
 
1007
1177
  // ../kit/src/notify.ts
1008
- import process13 from "process";
1178
+ init_format();
1179
+ init_mode();
1180
+ import process14 from "process";
1009
1181
  var NOTIFY_AFTER_MS = 1e4;
1010
1182
  var CANCELLED = 130;
1011
1183
  function base64(text) {
1012
1184
  return Buffer.from(text).toString("base64");
1013
1185
  }
1014
- function notification(title, body, env = process13.env) {
1015
- const id = `kit${process13.pid}`;
1186
+ function notification(title, body, env = process14.env) {
1187
+ const id = `kit${process14.pid}`;
1016
1188
  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\\`];
1017
1189
  return codes.map((code) => env.TMUX === undefined || env.TMUX === "" ? code : `\x1BPtmux;${code.replaceAll("\x1B", "\x1B\x1B")}\x1B\\`).join("");
1018
1190
  }
1019
- function notifyEnd(command, code, ms, { stream = process13.stderr, env = process13.env } = {}) {
1191
+ function notifyEnd(command, code, ms, { stream = process14.stderr, env = process14.env } = {}) {
1020
1192
  if (ms < NOTIFY_AFTER_MS || code === CANCELLED || outputMode(stream, env) !== "terminal")
1021
1193
  return;
1022
1194
  stream.write(notification(command, code === 0 ? `done in ${formatDuration(ms)}` : `failed with exit ${code} after ${formatDuration(ms)}`, env));
1023
1195
  }
1024
1196
 
1197
+ // ../kit/src/cli.ts
1198
+ init_style();
1199
+ init_text2();
1200
+
1025
1201
  // ../kit/src/usage.ts
1026
1202
  import { appendFileSync, mkdirSync } from "fs";
1027
1203
  import { homedir as homedir4 } from "os";
1028
1204
  import { dirname as dirname2, isAbsolute, join as join5 } from "path";
1029
- import process15 from "process";
1205
+ import process16 from "process";
1030
1206
 
1031
1207
  // ../kit/src/logs.ts
1032
1208
  import { lstatSync, openSync } from "fs";
1033
1209
  import { mkdir, mkdtemp, readdir, rm, stat } from "fs/promises";
1034
1210
  import { homedir as homedir3, tmpdir } from "os";
1035
1211
  import { join as join4 } from "path";
1036
- import process14 from "process";
1212
+ import process15 from "process";
1037
1213
  var DAY_MS = 24 * 60 * 60 * 1000;
1038
1214
  var CLI_FOLDER = "kaynooo-cli";
1039
1215
  function isPrivateDirectory(path) {
1040
1216
  try {
1041
1217
  const info = lstatSync(path, { throwIfNoEntry: false });
1042
- return info !== undefined && info.isDirectory() && info.uid === (process14.getuid?.() ?? info.uid) && (info.mode & 63) === 0;
1218
+ return info !== undefined && info.isDirectory() && info.uid === (process15.getuid?.() ?? info.uid) && (info.mode & 63) === 0;
1043
1219
  } catch {
1044
1220
  return false;
1045
1221
  }
1046
1222
  }
1047
- async function privateLogDirectory(name, env = process14.env) {
1223
+ async function privateLogDirectory(name, env = process15.env) {
1048
1224
  const runtime = env.XDG_RUNTIME_DIR;
1049
1225
  const base = runtime === undefined || runtime === "" ? join4(homedir3(), ".cache", CLI_FOLDER) : join4(runtime, CLI_FOLDER);
1050
1226
  const path = join4(base, name);
@@ -1084,14 +1260,14 @@ var usageError;
1084
1260
  function noteUsageError(message) {
1085
1261
  usageError = message;
1086
1262
  }
1087
- function stateHome(env = process15.env) {
1263
+ function stateHome(env = process16.env) {
1088
1264
  const dir = env.XDG_STATE_HOME;
1089
1265
  return dir !== undefined && isAbsolute(dir) ? dir : join5(homedir4(), ".local", "state");
1090
1266
  }
1091
- function usagePath(env = process15.env) {
1267
+ function usagePath(env = process16.env) {
1092
1268
  return join5(stateHome(env), CLI_FOLDER, "usage.jsonl");
1093
1269
  }
1094
- function usageRecorded(env = process15.env) {
1270
+ function usageRecorded(env = process16.env) {
1095
1271
  const off = env.KAYNOOO_CLI_NO_USAGE;
1096
1272
  return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
1097
1273
  }
@@ -1100,12 +1276,12 @@ function flagNames(argv) {
1100
1276
  const names = (end === -1 ? argv : argv.slice(0, end)).filter((word) => word.startsWith("-") && word !== "-").map((word) => word.includes("=") ? word.slice(0, word.indexOf("=")) : word);
1101
1277
  return [...new Set(names)].filter((name) => name.length <= LONGEST_NAME && FLAG_NAME.test(name));
1102
1278
  }
1103
- function usageEntry(bin, command, argv, code, now = new Date) {
1279
+ function usageEntry(bin, command, argv, code, { ms, now = new Date } = {}) {
1104
1280
  const unknown = code === 2 && usageError !== undefined ? UNKNOWN_OPTION2.exec(usageError)?.[1] : undefined;
1105
1281
  usageError = undefined;
1106
- return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
1282
+ return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown }, ...ms === undefined ? {} : { ms: Math.round(ms) } };
1107
1283
  }
1108
- function recordUsage(entry, env = process15.env) {
1284
+ function recordUsage(entry, env = process16.env) {
1109
1285
  if (!usageRecorded(env))
1110
1286
  return;
1111
1287
  try {
@@ -1127,8 +1303,8 @@ var TOP_OPTIONS = {
1127
1303
  completions: { type: "string", choices: COMPLETION_SHELLS, description: "print the shell completion script" }
1128
1304
  };
1129
1305
  function printError(prefix, message, hint, cause) {
1130
- const colors = paint(process16.stderr);
1131
- const styled = takesControlCodes(process16.stderr);
1306
+ const colors = paint(process17.stderr);
1307
+ const styled = takesControlCodes(process17.stderr);
1132
1308
  const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
1133
1309
  const under = (label, text, tint) => text === undefined ? "" : `
1134
1310
  ${styled ? tint(label) : `${label}:`} ${text}`;
@@ -1239,6 +1415,9 @@ function packageVersion(entry = Bun.main) {
1239
1415
  }
1240
1416
  }
1241
1417
  async function runMain({ name, version, run, redact, usage }, argv = scriptArgs()) {
1418
+ const answered = await askpassClient(argv);
1419
+ if (answered !== undefined)
1420
+ return answered;
1242
1421
  if (argv[0] === COMPLETE)
1243
1422
  return printCandidates(leafCandidates(run, argv.slice(1)));
1244
1423
  if (argv[0] === COMPLETIONS || argv[0]?.startsWith(`${COMPLETIONS}=`) === true)
@@ -1257,12 +1436,17 @@ async function runMain({ name, version, run, redact, usage }, argv = scriptArgs(
1257
1436
  notifyEnd(name, code, performance.now() - started);
1258
1437
  if (usage !== false) {
1259
1438
  try {
1260
- recordUsage(usageEntry(name, undefined, argv, code));
1439
+ recordUsage(usageEntry(name, undefined, argv, code, { ms: performance.now() - started }));
1261
1440
  } catch {}
1262
1441
  }
1263
1442
  return code;
1264
1443
  }
1444
+
1445
+ // ../kit/src/index.ts
1446
+ init_config();
1447
+
1265
1448
  // ../kit/src/excerpt.ts
1449
+ init_text2();
1266
1450
  var BASH_ECHO = /^\$ /;
1267
1451
  var DURATION2 = / \[[\d.]+m?s\]$/;
1268
1452
  var BOUNDARY = /^(?:\((?:pass|fail|skip|todo)\) |\S+\.test\.[jt]sx?:$)/;
@@ -1417,37 +1601,53 @@ function failureExcerpt(output) {
1417
1601
  return cut(squeeze(recognised(lines, PARSERS) ?? lines.slice(-TAIL)));
1418
1602
  }
1419
1603
  var LOG_PATTERNS = { BASH_ECHO, DURATION: DURATION2, BOUNDARY, BUN_TEST_SUMMARY, BUN_CHECK_SUMMARY, TSC_CONTINUATION, TSC_FRAME, TSC_SUMMARY, ESLINT_PROBLEM, ESLINT_SUMMARY };
1420
- // ../kit/src/folders.ts
1421
- import { homedir as homedir5 } from "os";
1422
- import { join as join7 } from "path";
1423
- import process17 from "process";
1424
- var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
1425
- function ignoredFolders(extra = [], where = {}) {
1426
- const configured = readUserConfig("config", where).ignore;
1427
- const names = Array.isArray(configured) ? configured.filter((name) => typeof name === "string" && name !== "") : [];
1428
- return new Set([...SKIPPED_FOLDERS, ...extra, ...names]);
1429
- }
1430
- function cacheFolder({ home = homedir5(), env = process17.env } = {}) {
1431
- return env.XDG_CACHE_HOME ?? join7(home, ".cache");
1432
- }
1604
+
1605
+ // ../kit/src/index.ts
1606
+ init_folders();
1607
+ init_format();
1608
+
1609
+ // ../kit/src/git.ts
1610
+ init_args();
1611
+ // ../kit/src/limit.ts
1612
+ init_args();
1613
+
1614
+ // ../kit/src/index.ts
1615
+ init_mode();
1616
+
1617
+ // ../kit/src/report.ts
1618
+ init_style();
1619
+ init_text2();
1433
1620
  // ../kit/src/secrets.ts
1434
1621
  var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
1435
1622
  // ../kit/src/sessions.ts
1436
1623
  var {Glob } = globalThis.Bun;
1437
1624
  var SESSION_FILES = new Glob("*.json");
1438
1625
  var ACCOUNT_DIRS = new Glob("*/sessions");
1626
+
1627
+ // ../kit/src/index.ts
1628
+ init_style();
1629
+ init_text2();
1630
+ init_theme();
1631
+ init_user_config();
1632
+
1633
+ // ../kit/src/watch.ts
1634
+ init_args();
1635
+ init_input();
1636
+ init_style();
1637
+ // ../kit/src/workspace-root.ts
1638
+ init_user_config();
1439
1639
  // package.json
1440
- var version = "0.20.1";
1640
+ var version = "0.21.1";
1441
1641
 
1442
1642
  // src/errs.ts
1443
1643
  import { relative as relative2 } from "path";
1444
- import process21 from "process";
1644
+ import process22 from "process";
1445
1645
 
1446
1646
  // src/compose.ts
1447
1647
  import { existsSync as existsSync4 } from "fs";
1448
1648
  import { homedir as homedir6 } from "os";
1449
1649
  import { basename, dirname as dirname4, join as join8, relative, resolve as resolve4 } from "path";
1450
- import process19 from "process";
1650
+ import process20 from "process";
1451
1651
 
1452
1652
  // ../kit/src/shell.ts
1453
1653
  var SEPARATORS = new Set([`
@@ -1540,7 +1740,7 @@ async function variables(composeDir) {
1540
1740
  if (match !== null && !line.trimStart().startsWith("#"))
1541
1741
  env[match[1] ?? ""] = (match[2] ?? "").trim().replace(QUOTED, "$2");
1542
1742
  }
1543
- for (const [key, value] of Object.entries(process19.env)) {
1743
+ for (const [key, value] of Object.entries(process20.env)) {
1544
1744
  if (value !== undefined)
1545
1745
  env[key] = value;
1546
1746
  }
@@ -1676,7 +1876,7 @@ async function place(dir, program, { service, host } = {}) {
1676
1876
  fail(`--in ${service}: no compose project mounts ${dir}`);
1677
1877
  return;
1678
1878
  }
1679
- if (Bun.which("docker", { PATH: process19.env.PATH ?? "" }) === null) {
1879
+ if (Bun.which("docker", { PATH: process20.env.PATH ?? "" }) === null) {
1680
1880
  if (service !== undefined)
1681
1881
  fail(`--in ${service}: docker not found`);
1682
1882
  if (!noticed.has(found.composeDir)) {
@@ -1728,7 +1928,7 @@ class Stack {
1728
1928
  }
1729
1929
  static async running(composeDir) {
1730
1930
  try {
1731
- const ran = await runCommand(["docker", "compose", "ps", "--services", "--status", "running"], { cwd: composeDir, env: process19.env, timeoutMs: PS_TIMEOUT_MS });
1931
+ const ran = await runCommand(["docker", "compose", "ps", "--services", "--status", "running"], { cwd: composeDir, env: process20.env, timeoutMs: PS_TIMEOUT_MS });
1732
1932
  if (ran.code !== 0)
1733
1933
  return `docker compose ps failed in ${composeDir}: ${ran.text.trim().split(`
1734
1934
  `).at(-1) ?? `exit ${ran.code}`}`;
@@ -2277,14 +2477,14 @@ function parseErrors(output) {
2277
2477
  // src/run.ts
2278
2478
  import { mkdir as mkdir2, readdir as readdir2, stat as stat2, writeFile } from "fs/promises";
2279
2479
  import { basename as basename2, join as join9 } from "path";
2280
- import process20 from "process";
2480
+ import process21 from "process";
2281
2481
  var LOG_MAX_AGE_MS = 3 * 24 * 60 * 60 * 1000;
2282
2482
  var RESULTS_FILE = "results.json";
2283
2483
  var runPrefix = (cwd) => `${basename2(cwd)}-${Bun.hash(cwd).toString(36)}-`;
2284
2484
  async function logDirectory(cwd) {
2285
2485
  const root = await privateLogDirectory("check");
2286
2486
  await sweepLogs(root, LOG_MAX_AGE_MS);
2287
- const path = join9(root, `${runPrefix(cwd)}${Date.now().toString(36)}-${process20.pid}`);
2487
+ const path = join9(root, `${runPrefix(cwd)}${Date.now().toString(36)}-${process21.pid}`);
2288
2488
  await mkdir2(path, { mode: 448 });
2289
2489
  return path;
2290
2490
  }
@@ -2312,7 +2512,7 @@ async function lastFailed(cwd) {
2312
2512
  async function saveLog(output) {
2313
2513
  const root = await privateLogDirectory("errs");
2314
2514
  await sweepLogs(root);
2315
- const path = join9(root, `${new Date().toISOString().replaceAll(/[:.]/g, "-")}-${process20.pid}-${crypto.randomUUID().slice(0, 8)}.log`);
2515
+ const path = join9(root, `${new Date().toISOString().replaceAll(/[:.]/g, "-")}-${process21.pid}-${crypto.randomUUID().slice(0, 8)}.log`);
2316
2516
  await writeFile(path, output, { mode: 384, flag: "wx" });
2317
2517
  return path;
2318
2518
  }
@@ -2320,7 +2520,7 @@ async function runStep(command, cwd, logFile, { env = {}, timeoutMs, held } = {}
2320
2520
  const started = Date.now();
2321
2521
  const { code, text, timedOut } = await runCommand(["sh", "-c", `${command} 2>&1`], {
2322
2522
  cwd,
2323
- env: { ...process20.env, NO_COLOR: "1", FORCE_COLOR: "0", ...env },
2523
+ env: { ...process21.env, NO_COLOR: "1", FORCE_COLOR: "0", ...env },
2324
2524
  ...timeoutMs === undefined ? {} : { timeoutMs },
2325
2525
  ...held === undefined ? {} : { onStart: (child) => held.forward(child) }
2326
2526
  });
@@ -2336,8 +2536,8 @@ function outcomeJson(name, command, logFile, outcome, service) {
2336
2536
  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) } };
2337
2537
  }
2338
2538
  function printOutcome(name, width, command, logFile, outcome) {
2339
- const colors = paint(process20.stdout);
2340
- const path = role("path", process20.stdout);
2539
+ const colors = paint(process21.stdout);
2540
+ const path = role("path", process21.stdout);
2341
2541
  const took = colors.dim(formatDuration(outcome.ms));
2342
2542
  if (outcome.ok) {
2343
2543
  console.log(`${colors.bold(colors.green("ok "))} ${name.padEnd(width)} ${took} ${path(logFile)}`);
@@ -2357,14 +2557,13 @@ var usage2 = `errs [options] [log]
2357
2557
  errs [options] -- <command> [args...]
2358
2558
  errs --in <service> | --host -- <command> [args...]
2359
2559
 
2360
- Prints one \`file:line:col: message (rule)\` line per error found in a tsc, tsgo, vue-tsc, bun check, kay check, eslint, keslint, bun test, vitest, playwright (list and line reporters), phpunit, paratest, phpstan (table, raw and json), php-cs-fixer, go (build, vet), cargo (rustc), ruff (concise and full) or pytest log, or any line shaped \`file:line[:col]: error|warning: message\` (mypy, gcc, clang, \`shellcheck -f gcc\`, golangci-lint), read from the file given, from stdin (no argument or -), or from the output of the command run after --.
2361
- The lines no format recognised are counted on stderr, never dropped silently, and a command's full output is saved to a log file whose path is printed with that count.
2362
- A command runs inside the docker compose service that bind-mounts the current folder (found in compose.yml, compose.yaml or docker-compose.yml, up to the repository root), at the matching path, with its output read here; a service that is down is never started, the call fails naming it. --in picks the service, --host forces the host.
2363
- --json prints {errors: [{tool, file, line, column, rule, severity, message, test?}], unrecognised, log?, code?}, tool one of tsc, eslint, bun check, kay check, bun test, vitest, playwright, phpunit, phpstan, php-cs-fixer, go, cargo, ruff, pytest, generic. An error repeated with the same file, position and message is printed once.`;
2560
+ Prints one \`file:line:col: message (rule)\` line per error found in a tsc, eslint, bun test, vitest, playwright, phpunit, phpstan, php-cs-fixer, go, cargo, ruff or pytest log, or any \`file:line[:col]: error|warning: message\` line, read from a file, from stdin or from the output of the command run after --.
2561
+ The lines no format recognised are counted on stderr, never dropped, and a command's full output is saved to a log file whose path is printed with that count.
2562
+ A command runs inside the running compose service that bind-mounts the current folder and never starts one; --in picks the service, --host forces the host.`;
2364
2563
  var EXITS = [[0, "no error was found and the command, if any, passed"], [1, "errors were found or the command failed"], [2, "a usage error"]];
2365
2564
  var options = {
2366
2565
  ...placeOptions,
2367
- json: jsonOption()
2566
+ json: jsonOption("{errors: [{tool, file, line, column, rule, severity, message, test?}], unrecognised, log?, code?}")
2368
2567
  };
2369
2568
  function display(file, cwd) {
2370
2569
  const path = file.startsWith("/") ? relative2(cwd, file) : file;
@@ -2394,7 +2593,7 @@ async function readInput2(command, run, settings, cwd) {
2394
2593
  const held = holdSignals();
2395
2594
  let ran;
2396
2595
  try {
2397
- ran = await runCommand(placement === undefined ? command : argvIn(placement, command), { ...placement === undefined ? {} : { cwd: placement.composeDir }, env: { ...process21.env, NO_COLOR: "1", FORCE_COLOR: "0" }, onStart: (child) => held.forward(child) });
2596
+ ran = await runCommand(placement === undefined ? command : argvIn(placement, command), { ...placement === undefined ? {} : { cwd: placement.composeDir }, env: { ...process22.env, NO_COLOR: "1", FORCE_COLOR: "0" }, onStart: (child) => held.forward(child) });
2398
2597
  } catch (error) {
2399
2598
  fail(`cannot run ${command[0]}: ${error instanceof Error ? error.message : String(error)}`);
2400
2599
  } finally {
@@ -2402,7 +2601,7 @@ async function readInput2(command, run, settings, cwd) {
2402
2601
  }
2403
2602
  return { text: stripAnsi(ran.text), log: await saveLog(ran.output), code: ran.code };
2404
2603
  }
2405
- async function errs(args, cwd = process21.cwd()) {
2604
+ async function errs(args, cwd = process22.cwd()) {
2406
2605
  const first = args[0];
2407
2606
  const bare = first !== undefined && !first.startsWith("-") && !await Bun.file(first).exists();
2408
2607
  const parsed = parse(bare ? [] : args, usage2, options, { exits: EXITS, rest: true, replaces: "reading raw tsc, eslint, phpunit, phpstan or playwright logs, or grepping a test summary out of them", examples: [["errs -- bun run check", "the type errors of a run"], ["bun test 2>&1 | errs", "the failed tests from stdin"], ["errs -- vendor/bin/phpunit", "each failed PHP test with its file and line"]] });
@@ -2426,4 +2625,4 @@ ${usage2}`);
2426
2625
  }
2427
2626
 
2428
2627
  // src/errs-cli.ts
2429
- process22.exitCode = await runMain({ name: "errs", version, run: async (args) => errs(args) });
2628
+ process23.exitCode = await runMain({ name: "errs", version, run: async (args) => errs(args) });