@kaynooo/cli-wait 0.12.1 → 0.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/cli.js +378 -151
  2. package/dist/slot-cli.js +382 -155
  3. package/package.json +5 -5
package/dist/slot-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/slot-cli.ts
5
- import process21 from "process";
6
- // ../kit/src/args.ts
7
- import process9 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
  }
@@ -45,12 +53,13 @@ function outputMode(stream = process2.stdout, env = process2.env) {
45
53
  return "terminal";
46
54
  return isSet(env.CI) ? "ci" : "pipe";
47
55
  }
56
+ var MODES, AGENT_VARIABLES;
57
+ var init_mode = __esm(() => {
58
+ MODES = new Set(["terminal", "ci", "agent", "pipe"]);
59
+ AGENT_VARIABLES = ["CLAUDECODE", "AI_AGENT"];
60
+ });
48
61
 
49
- // ../kit/src/style.ts
50
- import process6 from "process";
51
-
52
- // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
53
- var G2 = /^[a-f0-9]+$/i;
62
+ // ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
54
63
  function b(r) {
55
64
  let e = r.startsWith("#") ? r.slice(1) : r;
56
65
  if (!G2.test(e))
@@ -61,11 +70,6 @@ function b(r) {
61
70
  throw Error(`Invalid hex color length: ${e.length}`);
62
71
  return [Number.parseInt(e.slice(0, 2), 16), Number.parseInt(e.slice(2, 4), 16), Number.parseInt(e.slice(4, 6), 16)];
63
72
  }
64
- 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") => {
65
- let [l, n, c] = b(r);
66
- return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
67
- }, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
68
- var h = new Set(["", "1", "2", "3", "true"]);
69
73
  function C(r, e = globalThis.process?.env ?? {}) {
70
74
  if (e.FORCE_COLOR !== undefined)
71
75
  return h.has(e.FORCE_COLOR);
@@ -79,7 +83,7 @@ function f(r, e = []) {
79
83
  l += `\x1B[${e[t][0]}m`, n = `\x1B[${e[t][1]}m${n}`;
80
84
  let c = (t) => C(r.stream ?? globalThis.process?.stdout, r.env) ? l + t + n : t, g = new Map;
81
85
  return new Proxy(c, { get(t, i) {
82
- let a = B2[i];
86
+ let a = B[i];
83
87
  if (Array.isArray(a)) {
84
88
  let s = g.get(i);
85
89
  if (s === undefined)
@@ -102,13 +106,21 @@ function f(r, e = []) {
102
106
  function Fe(r = {}) {
103
107
  return f(r);
104
108
  }
105
- var o = Fe();
109
+ var G2, B, h, o;
110
+ var init_chunk_x450vn3m = __esm(() => {
111
+ G2 = /^[a-f0-9]+$/i;
112
+ 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") => {
113
+ let [l, n, c] = b(r);
114
+ return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
115
+ }, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
116
+ h = new Set(["", "1", "2", "3", "true"]);
117
+ o = Fe();
118
+ });
106
119
 
107
- // ../kit/src/theme.ts
108
- import { existsSync as existsSync3, readFileSync as readFileSync2, statSync } from "fs";
109
- import { homedir as homedir2 } from "os";
110
- import { join as join3, resolve as resolve2 } from "path";
111
- import process5 from "process";
120
+ // ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/tools/colors.js
121
+ var init_colors = __esm(() => {
122
+ init_chunk_x450vn3m();
123
+ });
112
124
 
113
125
  // ../kit/src/config.ts
114
126
  import { existsSync } from "fs";
@@ -124,6 +136,9 @@ function findUp(names, from = process3.cwd(), stop = () => false) {
124
136
  return;
125
137
  }
126
138
  }
139
+ var init_config = __esm(() => {
140
+ init_args();
141
+ });
127
142
 
128
143
  // ../kit/src/user-config.ts
129
144
  import { existsSync as existsSync2, readFileSync } from "fs";
@@ -159,36 +174,18 @@ function configuredNumber(bin, key, fallback, where = {}, legacy = []) {
159
174
  const value = readUserConfig(bin, where, legacy)[key];
160
175
  return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : fallback;
161
176
  }
177
+ var init_user_config = () => {};
162
178
 
163
179
  // ../kit/src/theme.ts
164
- var ENDS = new Map;
165
- var DEFAULT = {
166
- 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" },
167
- 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" },
168
- accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
169
- bins: {},
170
- gradient: ["#c084fc", "#67e8f9"]
171
- };
172
- 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" };
173
- 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" };
174
- var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", plan: "?", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
175
- var PRESETS = {
176
- default: {},
177
- "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
178
- mono: { colors: MONO, accents: ["bold"], gradient: undefined },
179
- ascii: { glyphs: ASCII }
180
- };
181
- 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"]);
182
- var HEX = /^#[0-9a-f]{6}$/i;
183
- var CONTROL = /\p{Cc}/u;
184
- var MAX_FILE_BYTES = 64 * 1024;
185
- var SPACES = /\s+/;
180
+ import { existsSync as existsSync3, readFileSync as readFileSync2, statSync } from "fs";
181
+ import { homedir as homedir2 } from "os";
182
+ import { join as join3, resolve as resolve2 } from "path";
183
+ import process5 from "process";
186
184
  function isColorSpec(spec) {
187
185
  if (typeof spec === "number")
188
186
  return Number.isInteger(spec) && spec >= 0 && spec <= 255;
189
187
  return typeof spec === "string" && spec.trim() !== "" && spec.trim().split(SPACES).every((token) => STYLES.has(token) || HEX.test(token));
190
188
  }
191
- var CUBE = [0, 95, 135, 175, 215, 255];
192
189
  function cubeLevel(channel) {
193
190
  return CUBE.reduce((best, value, level) => Math.abs(value - channel) < Math.abs(CUBE[best] - channel) ? level : best, 0);
194
191
  }
@@ -293,7 +290,6 @@ function applyFile(theme, file, where, warn) {
293
290
  function endsWalk(home) {
294
291
  return (dir) => dir === resolve2(home) || existsSync3(join3(dir, ".git"));
295
292
  }
296
- var warned = new Set;
297
293
  function warnOnce(message) {
298
294
  if (warned.has(message))
299
295
  return;
@@ -330,8 +326,6 @@ function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(
330
326
  }
331
327
  return { theme, sources, preset };
332
328
  }
333
- var current;
334
- var currentKey = "";
335
329
  function activeTheme() {
336
330
  const key = `${process5.cwd()}\x00${process5.env.KIT_THEME ?? ""}\x00${process5.env.XDG_CONFIG_HOME ?? ""}`;
337
331
  if (current === undefined || key !== currentKey) {
@@ -340,9 +334,38 @@ function activeTheme() {
340
334
  }
341
335
  return current;
342
336
  }
337
+ var ENDS, DEFAULT, BRIGHT, MONO, ASCII, PRESETS, STYLES, HEX, CONTROL, MAX_FILE_BYTES, SPACES, CUBE, warned, current, currentKey = "";
338
+ var init_theme = __esm(() => {
339
+ init_config();
340
+ init_user_config();
341
+ ENDS = new Map;
342
+ DEFAULT = {
343
+ 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" },
344
+ 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" },
345
+ accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
346
+ bins: {},
347
+ gradient: ["#c084fc", "#67e8f9"]
348
+ };
349
+ 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" };
350
+ 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" };
351
+ ASCII = { ok: "+", warn: "!", problem: "x", note: ">", plan: "?", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
352
+ PRESETS = {
353
+ default: {},
354
+ "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
355
+ mono: { colors: MONO, accents: ["bold"], gradient: undefined },
356
+ ascii: { glyphs: ASCII }
357
+ };
358
+ 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"]);
359
+ HEX = /^#[0-9a-f]{6}$/i;
360
+ CONTROL = /\p{Cc}/u;
361
+ MAX_FILE_BYTES = 64 * 1024;
362
+ SPACES = /\s+/;
363
+ CUBE = [0, 95, 135, 175, 215, 255];
364
+ warned = new Set;
365
+ });
343
366
 
344
367
  // ../kit/src/style.ts
345
- var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:", plan: "would:" };
368
+ import process6 from "process";
346
369
  function takesControlCodes(stream, env = process6.env) {
347
370
  return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
348
371
  }
@@ -361,14 +384,6 @@ function marked(mark, text, stream, detail, env = process6.env) {
361
384
  function problem(text, detail) {
362
385
  console.error(marked("problem", text, process6.stderr, detail));
363
386
  }
364
- var STATUS_WORDS = {
365
- passed: ["passed", "success", "succeeded", "ok"],
366
- failed: ["failed", "failure", "error", "errored"],
367
- running: ["running", "in_progress", "started", "holding"],
368
- queued: ["queued", "waiting", "pending", "created", "blocked", "scheduled"],
369
- skipped: ["skipped", "cancelled", "canceled", "manual"]
370
- };
371
- var STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
372
387
  function statusOf(word) {
373
388
  return STATUS_OF.get(word.toLowerCase());
374
389
  }
@@ -379,9 +394,24 @@ function badge(word, stream, env = process6.env) {
379
394
  const { theme } = activeTheme();
380
395
  return tinted(paint(stream, env), theme.colors[status], env)(`${theme.glyphs[status]} ${word}`);
381
396
  }
397
+ var MARK_WORDS, STATUS_WORDS, STATUS_OF;
398
+ var init_style = __esm(() => {
399
+ init_colors();
400
+ init_mode();
401
+ init_theme();
402
+ MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:", plan: "would:" };
403
+ STATUS_WORDS = {
404
+ passed: ["passed", "success", "succeeded", "ok"],
405
+ failed: ["failed", "failure", "error", "errored"],
406
+ running: ["running", "in_progress", "started", "holding"],
407
+ queued: ["queued", "waiting", "pending", "created", "blocked", "scheduled"],
408
+ skipped: ["skipped", "cancelled", "canceled", "manual"]
409
+ };
410
+ STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
411
+ });
382
412
 
383
413
  // ../kit/src/format.ts
384
- var UNITS = [["d", 86400], ["h", 3600], ["m", 60], ["s", 1]];
414
+ import process7 from "process";
385
415
  function formatSeconds(total) {
386
416
  let rest = Math.max(0, Math.round(total));
387
417
  const amounts = UNITS.map(([unit, size]) => {
@@ -413,10 +443,8 @@ function formatAge(date, now = Date.now()) {
413
443
  return seconds < 60 ? "just now" : `${upTo(formatSeconds(seconds), " ")} ago`;
414
444
  }
415
445
  function truncate(text, width) {
416
- return ko(text, width, { suffix: "\u2026", includeSuffix: true });
446
+ return Ao(text, width, { suffix: "\u2026", includeSuffix: true });
417
447
  }
418
- var LINE_BREAKS = /\s*\n\s*/g;
419
- var ESCAPE = String.fromCharCode(27);
420
448
  function textWidth(text) {
421
449
  return Bun.stringWidth(text);
422
450
  }
@@ -465,14 +493,40 @@ function jsonText(value, replacer, { stream = process7.stdout, env = process7.en
465
493
  function printJson(value) {
466
494
  console.log(jsonText(value));
467
495
  }
496
+ var UNITS, LINE_BREAKS, ESCAPE;
497
+ var init_format = __esm(() => {
498
+ init_text();
499
+ init_mode();
500
+ init_style();
501
+ UNITS = [["d", 86400], ["h", 3600], ["m", 60], ["s", 1]];
502
+ LINE_BREAKS = /\s*\n\s*/g;
503
+ ESCAPE = String.fromCharCode(27);
504
+ });
468
505
 
469
506
  // ../kit/src/help.ts
470
507
  import process8 from "process";
471
- var OPTIONAL = /(?<!\x1B)\[[^\]]+\]/g;
472
- var USAGE_PREFIX = /^usage:\s*/i;
473
- var FULL_STOP = /\.$/;
474
508
  function usageLine(usage, colors = paint(process8.stdout)) {
475
- return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
509
+ const lines = usage.replace(USAGE_PREFIX, "").split(`
510
+ `);
511
+ const blank = lines.indexOf("");
512
+ const synopses = blank === -1 ? lines : lines.slice(0, blank);
513
+ const details = blank === -1 ? [] : lines.slice(blank + 1);
514
+ const colon = synopses[0].indexOf(": ");
515
+ const inline = synopses[0].slice(colon + 2);
516
+ const summary = colon === -1 ? details.shift() : `${inline.charAt(0).toUpperCase()}${inline.slice(1)}`;
517
+ if (colon !== -1)
518
+ synopses[0] = synopses[0].slice(0, colon);
519
+ const head = `${colors.bold("Usage:")} ${synopses.map((line) => line.replaceAll(OPTIONAL, (part) => colors.dim(part))).join(`
520
+ `)}`;
521
+ const lead = summary === undefined ? [] : ["", colors.bold(prose(summary, colors))];
522
+ const rest = details.length === 0 ? [] : ["", ...details.map((line) => prose(line, colors))];
523
+ return [head, ...lead, ...rest].join(`
524
+ `);
525
+ }
526
+ function prose(line, colors) {
527
+ if (colors.cyan("x") === "x")
528
+ return line;
529
+ return line.replaceAll(PROSE_MARKS, (match, code, flag) => code === undefined ? colors.cyan(flag ?? match) : colors.bold(code));
476
530
  }
477
531
  function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
478
532
  return [usageLine(usage, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
@@ -507,7 +561,6 @@ function exampleRows(examples, colors = paint(process8.stdout)) {
507
561
  return [];
508
562
  return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
509
563
  }
510
- var MAX_INLINE_CHOICES = 24;
511
564
  function optionRows(options, colors = paint(process8.stdout)) {
512
565
  const rows = Object.entries(options).map(([name, option]) => {
513
566
  const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
@@ -522,6 +575,15 @@ function optionRows(options, colors = paint(process8.stdout)) {
522
575
  const width = Math.max(0, ...rows.map((row) => row.width));
523
576
  return rows.map((row) => row.description === "" ? ` ${row.flag}` : ` ${row.flag}${" ".repeat(width - row.width)} ${colors.dim(row.description)}`);
524
577
  }
578
+ var OPTIONAL, USAGE_PREFIX, FULL_STOP, PROSE_MARKS, MAX_INLINE_CHOICES = 24;
579
+ var init_help = __esm(() => {
580
+ init_mode();
581
+ init_style();
582
+ OPTIONAL = /(?<!\x1B)\[[^\]]+\]/g;
583
+ USAGE_PREFIX = /^usage:\s*/i;
584
+ FULL_STOP = /\.$/;
585
+ PROSE_MARKS = /`([^`\n]+)`|(?<![\w-])(--[a-z][\w-]*|-[a-z](?![\w-]))/gi;
586
+ });
525
587
 
526
588
  // ../kit/src/text.ts
527
589
  function distance(a, b) {
@@ -549,8 +611,9 @@ function closest(name, names) {
549
611
  const [best] = names.map((known) => ({ known, far: distance(name, known) })).sort((a, b) => a.far - b.far);
550
612
  return best !== undefined && best.far <= (name.length < 4 ? 1 : 2) ? best.known : undefined;
551
613
  }
614
+ var init_text2 = () => {};
615
+
552
616
  // ../kit/src/input.ts
553
- var WHOLE = /^\d+$/;
554
617
  function wholeNumber(value, name, fallback, min = 1) {
555
618
  if (value === undefined)
556
619
  return fallback;
@@ -559,8 +622,6 @@ function wholeNumber(value, name, fallback, min = 1) {
559
622
  badUsage(`${name.startsWith("<") ? name : `--${name}`} takes a whole number from ${min}, not ${value}`);
560
623
  return number;
561
624
  }
562
- var DURATION = /^(\d+(?:\.\d+)?)(ms|[smhd])?$/;
563
- var UNIT_MS = { ms: 1, s: 1000, m: 60000, h: 3600000, d: 86400000 };
564
625
  function duration(value, name, fallback, unit = "s") {
565
626
  if (value === undefined)
566
627
  return fallback;
@@ -570,40 +631,27 @@ function duration(value, name, fallback, unit = "s") {
570
631
  badUsage(`--${name} takes a duration such as 30s, 5m, 1h or 7d, not ${value}`);
571
632
  return ms;
572
633
  }
634
+ var WHOLE, DURATION, UNIT_MS;
635
+ var init_input = __esm(() => {
636
+ init_args();
637
+ WHOLE = /^\d+$/;
638
+ DURATION = /^(\d+(?:\.\d+)?)(ms|[smhd])?$/;
639
+ UNIT_MS = { ms: 1, s: 1000, m: 60000, h: 3600000, d: 86400000 };
640
+ });
573
641
 
574
642
  // ../kit/src/args.ts
575
- var DASHES = /^-+/;
643
+ import process9 from "process";
644
+ import { parseArgs } from "util";
576
645
  function jsonOption(holds) {
577
646
  return { type: "boolean", description: holds === undefined ? "print JSON" : `print JSON: ${holds}` };
578
647
  }
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
648
  function fail(message, code = 2, hint) {
589
649
  throw new Exit(message, code, hint);
590
650
  }
591
-
592
- class UsageError extends Exit {
593
- constructor(message, hint) {
594
- super(message, 2, hint);
595
- }
596
- }
597
651
  function badUsage(message) {
598
652
  throw new UsageError(message);
599
653
  }
600
654
 
601
- class HelpShown extends Exit {
602
- constructor() {
603
- super("help shown", 0);
604
- }
605
- }
606
-
607
655
  class Completing {
608
656
  options;
609
657
  positionals;
@@ -614,11 +662,6 @@ class Completing {
614
662
  this.candidates = candidates;
615
663
  }
616
664
  }
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
665
  function applyOutput(color, plain, env = process9.env) {
623
666
  const when = plain === true ? "never" : color ?? "auto";
624
667
  if (when === "auto")
@@ -772,7 +815,6 @@ function parseError(error) {
772
815
  const message = upTo(error instanceof Error ? error.message : String(error), ". ");
773
816
  return `${message.charAt(0).toLowerCase()}${message.slice(1)}`;
774
817
  }
775
- var UNKNOWN_OPTION = /^unknown option '(-[^']+)'/;
776
818
  function nearestOption(message, options, allowNegative) {
777
819
  const typed = UNKNOWN_OPTION.exec(message)?.[1];
778
820
  if (typed === undefined)
@@ -788,6 +830,61 @@ function nearestOption(message, options, allowNegative) {
788
830
  const meant = closest(word, known.map((flag) => flag.replace(DASHES, "")));
789
831
  return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
790
832
  }
833
+ var DASHES, EXIT, Exit, UsageError, HelpShown, completion, OUTPUT_OPTIONS, UNKNOWN_OPTION;
834
+ var init_args = __esm(() => {
835
+ init_format();
836
+ init_help();
837
+ init_text2();
838
+ init_help();
839
+ init_input();
840
+ DASHES = /^-+/;
841
+ EXIT = Symbol.for("@kaynooo/cli-kit/Exit");
842
+ Exit = class Exit extends Error {
843
+ code;
844
+ hint;
845
+ [EXIT] = true;
846
+ constructor(message, code, hint) {
847
+ super(message);
848
+ this.code = code;
849
+ this.hint = hint;
850
+ }
851
+ static [Symbol.hasInstance](value) {
852
+ if (this !== Exit)
853
+ return Function.prototype[Symbol.hasInstance].call(this, value);
854
+ return typeof value === "object" && value !== null && value[EXIT] === true;
855
+ }
856
+ };
857
+ UsageError = class UsageError extends Exit {
858
+ constructor(message, hint) {
859
+ super(message, 2, hint);
860
+ }
861
+ };
862
+ HelpShown = class HelpShown extends Exit {
863
+ constructor() {
864
+ super("help shown", 0);
865
+ }
866
+ };
867
+ completion = { active: false };
868
+ OUTPUT_OPTIONS = {
869
+ color: { type: "string", choices: ["auto", "always", "never"], description: "auto (the default) colours on a terminal alone" },
870
+ plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
871
+ };
872
+ UNKNOWN_OPTION = /^unknown option '(-[^']+)'/;
873
+ });
874
+
875
+ // ../kit/src/folders.ts
876
+ var SKIPPED_FOLDERS;
877
+ var init_folders = __esm(() => {
878
+ init_user_config();
879
+ SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
880
+ });
881
+
882
+ // src/slot-cli.ts
883
+ import process22 from "process";
884
+
885
+ // ../kit/src/index.ts
886
+ init_args();
887
+
791
888
  // ../kit/src/argv.ts
792
889
  import { readFileSync as readFileSync3, realpathSync } from "fs";
793
890
  import { resolve as resolve3 } from "path";
@@ -812,7 +909,17 @@ function scriptArgs(argv = process10.argv.slice(2), cmdline = commandLine(), scr
812
909
  const after = at === -1 ? [] : cmdline.slice(at + 1);
813
910
  return after[0] === "--" && after.length === argv.length + 1 && argv.every((word, index) => word === after[index + 1]) ? after : argv;
814
911
  }
912
+ // ../kit/src/chart.ts
913
+ init_format();
914
+ init_mode();
915
+ init_style();
916
+ init_theme();
917
+ // ../kit/src/ci.ts
918
+ init_args();
919
+ init_format();
920
+
815
921
  // ../kit/src/progress.ts
922
+ init_format();
816
923
  import process12 from "process";
817
924
 
818
925
  // ../kit/src/process.ts
@@ -858,10 +965,10 @@ function holdSignals(cleanup) {
858
965
  process11.on(signal, onSignal);
859
966
  return held;
860
967
  }
861
- async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
968
+ async function runCommand(argv, { cwd, env, stdin = "ignore", input, timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
862
969
  const chunks = [];
863
970
  const grouped = timeoutMs !== undefined || signal !== undefined || onStart !== undefined || onChunk !== undefined;
864
- const proc = Bun.spawn(argv, { ...cwd === undefined ? {} : { cwd }, ...env === undefined ? {} : { env }, stdin, stdout: "pipe", stderr: "pipe", ...grouped ? { detached: true } : {} });
971
+ 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 } : {} });
865
972
  const state = { kept: 0, truncated: false, timedOut: false, failure: undefined, done: false };
866
973
  const timers = [];
867
974
  const killGroup = (killing) => {
@@ -938,6 +1045,8 @@ async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal,
938
1045
  }
939
1046
 
940
1047
  // ../kit/src/progress.ts
1048
+ init_style();
1049
+ init_theme();
941
1050
  var FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
942
1051
  var FRAME_MS = 200;
943
1052
  var CLEAR_BELOW = "\r\x1B[J";
@@ -954,10 +1063,14 @@ function liveRegion(render, stream = process12.stderr, env = process12.env) {
954
1063
  }, print: (text) => void stream.write(`${text}
955
1064
  `), stop: () => {
956
1065
  return;
1066
+ }, pause: () => () => {
1067
+ return;
957
1068
  } };
958
1069
  const write = stream.write.bind(stream);
959
1070
  let frame = 0;
960
1071
  let drawn = false;
1072
+ let paused = false;
1073
+ let stopped = false;
961
1074
  const columns = () => {
962
1075
  const now = stream.getWindowSize?.()[0] ?? stream.columns;
963
1076
  return now === undefined || now === 0 ? 80 : now;
@@ -968,6 +1081,8 @@ function liveRegion(render, stream = process12.stderr, env = process12.env) {
968
1081
  drawn = false;
969
1082
  };
970
1083
  const draw = () => {
1084
+ if (paused)
1085
+ return;
971
1086
  const width = columns() - 1;
972
1087
  const height = stream.rows === undefined || stream.rows === 0 ? 24 : stream.rows;
973
1088
  const lines = render(FRAMES[frame++ % FRAMES.length]).slice(0, Math.max(1, height - 1)).map((line) => cutToWidth(line, width));
@@ -979,16 +1094,17 @@ function liveRegion(render, stream = process12.stderr, env = process12.env) {
979
1094
  `)}${lines.length > 1 ? `\x1B[${lines.length - 1}A` : ""}\r`);
980
1095
  drawn = true;
981
1096
  };
982
- const timer = setInterval(draw, FRAME_MS);
1097
+ let timer = setInterval(draw, FRAME_MS);
983
1098
  stream.on?.("resize", draw);
984
- const restore = interceptOutput(clear);
985
- const release = swallowInput();
1099
+ let restore = interceptOutput(clear);
1100
+ let release = swallowInput();
986
1101
  const onExit = () => {
987
1102
  clear();
988
1103
  release();
989
1104
  };
990
1105
  const signals = holdSignals(stop);
991
1106
  function stop() {
1107
+ stopped = true;
992
1108
  clearInterval(timer);
993
1109
  stream.off?.("resize", draw);
994
1110
  clear();
@@ -997,6 +1113,29 @@ function liveRegion(render, stream = process12.stderr, env = process12.env) {
997
1113
  process12.off("exit", onExit);
998
1114
  signals.release();
999
1115
  }
1116
+ function pause() {
1117
+ if (paused || stopped)
1118
+ return () => {
1119
+ return;
1120
+ };
1121
+ paused = true;
1122
+ clearInterval(timer);
1123
+ stream.off?.("resize", draw);
1124
+ clear();
1125
+ restore();
1126
+ release();
1127
+ return () => {
1128
+ if (!paused || stopped)
1129
+ return;
1130
+ paused = false;
1131
+ timer = setInterval(draw, FRAME_MS);
1132
+ timer.unref();
1133
+ stream.on?.("resize", draw);
1134
+ restore = interceptOutput(clear);
1135
+ release = swallowInput();
1136
+ draw();
1137
+ };
1138
+ }
1000
1139
  timer.unref();
1001
1140
  process12.on("exit", onExit);
1002
1141
  return {
@@ -1007,7 +1146,8 @@ function liveRegion(render, stream = process12.stderr, env = process12.env) {
1007
1146
  `);
1008
1147
  draw();
1009
1148
  },
1010
- stop
1149
+ stop,
1150
+ pause
1011
1151
  };
1012
1152
  }
1013
1153
  function cutToWidth(line, width) {
@@ -1077,10 +1217,56 @@ function interceptOutput(clear) {
1077
1217
  }
1078
1218
  };
1079
1219
  }
1220
+
1221
+ // ../kit/src/ci.ts
1222
+ init_style();
1223
+
1224
+ // ../kit/src/tool.ts
1225
+ init_format();
1080
1226
  // ../kit/src/cli.ts
1227
+ init_args();
1081
1228
  import { readFileSync as readFileSync4, realpathSync as realpathSync2 } from "fs";
1082
1229
  import { dirname as dirname3, join as join6 } from "path";
1083
- import process16 from "process";
1230
+ import process17 from "process";
1231
+
1232
+ // ../kit/src/askpass.ts
1233
+ import process13 from "process";
1234
+ var SOCKET_VARIABLE = "KAYNOOO_ASKPASS_SOCKET";
1235
+ async function askpassClient(argv) {
1236
+ const socketPath = process13.env[SOCKET_VARIABLE];
1237
+ if (socketPath === undefined)
1238
+ return;
1239
+ const request = { prompt: argv[0] ?? "", ...process13.env.SSH_ASKPASS_PROMPT === "none" ? { notice: true } : {} };
1240
+ const { promise, resolve } = Promise.withResolvers();
1241
+ let received = "";
1242
+ try {
1243
+ await Bun.connect({
1244
+ unix: socketPath,
1245
+ socket: {
1246
+ open: (socket) => void socket.write(`${JSON.stringify(request)}
1247
+ `),
1248
+ data: (_, chunk) => {
1249
+ received += chunk.toString();
1250
+ },
1251
+ close: () => resolve(received),
1252
+ error: () => resolve("")
1253
+ }
1254
+ });
1255
+ } catch {
1256
+ return 1;
1257
+ }
1258
+ const reply = await promise;
1259
+ if (reply === "")
1260
+ return 1;
1261
+ const { answer } = JSON.parse(reply);
1262
+ if (request.notice === true)
1263
+ return 0;
1264
+ if (answer === undefined)
1265
+ return 1;
1266
+ process13.stdout.write(`${answer}
1267
+ `);
1268
+ return 0;
1269
+ }
1084
1270
 
1085
1271
  // ../kit/src/completions.ts
1086
1272
  var COMPLETION_SHELLS = ["fish", "bash", "zsh"];
@@ -1143,46 +1329,52 @@ compdef __kaynooo_cli_complete ${bins.join(" ")}
1143
1329
  }
1144
1330
 
1145
1331
  // ../kit/src/notify.ts
1146
- import process13 from "process";
1332
+ init_format();
1333
+ init_mode();
1334
+ import process14 from "process";
1147
1335
  var NOTIFY_AFTER_MS = 1e4;
1148
1336
  var CANCELLED = 130;
1149
1337
  function base64(text) {
1150
1338
  return Buffer.from(text).toString("base64");
1151
1339
  }
1152
- function notification(title, body, env = process13.env) {
1153
- const id = `kit${process13.pid}`;
1340
+ function notification(title, body, env = process14.env) {
1341
+ const id = `kit${process14.pid}`;
1154
1342
  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\\`];
1155
1343
  return codes.map((code) => env.TMUX === undefined || env.TMUX === "" ? code : `\x1BPtmux;${code.replaceAll("\x1B", "\x1B\x1B")}\x1B\\`).join("");
1156
1344
  }
1157
- function notifyEnd(command, code, ms, { stream = process13.stderr, env = process13.env } = {}) {
1345
+ function notifyEnd(command, code, ms, { stream = process14.stderr, env = process14.env } = {}) {
1158
1346
  if (ms < NOTIFY_AFTER_MS || code === CANCELLED || outputMode(stream, env) !== "terminal")
1159
1347
  return;
1160
1348
  stream.write(notification(command, code === 0 ? `done in ${formatDuration(ms)}` : `failed with exit ${code} after ${formatDuration(ms)}`, env));
1161
1349
  }
1162
1350
 
1351
+ // ../kit/src/cli.ts
1352
+ init_style();
1353
+ init_text2();
1354
+
1163
1355
  // ../kit/src/usage.ts
1164
1356
  import { appendFileSync, mkdirSync } from "fs";
1165
1357
  import { homedir as homedir4 } from "os";
1166
1358
  import { dirname as dirname2, isAbsolute, join as join5 } from "path";
1167
- import process15 from "process";
1359
+ import process16 from "process";
1168
1360
 
1169
1361
  // ../kit/src/logs.ts
1170
1362
  import { lstatSync, openSync } from "fs";
1171
1363
  import { mkdir, mkdtemp, readdir, rm, stat } from "fs/promises";
1172
1364
  import { homedir as homedir3, tmpdir } from "os";
1173
1365
  import { join as join4 } from "path";
1174
- import process14 from "process";
1366
+ import process15 from "process";
1175
1367
  var DAY_MS = 24 * 60 * 60 * 1000;
1176
1368
  var CLI_FOLDER = "kaynooo-cli";
1177
1369
  function isPrivateDirectory(path) {
1178
1370
  try {
1179
1371
  const info = lstatSync(path, { throwIfNoEntry: false });
1180
- return info !== undefined && info.isDirectory() && info.uid === (process14.getuid?.() ?? info.uid) && (info.mode & 63) === 0;
1372
+ return info !== undefined && info.isDirectory() && info.uid === (process15.getuid?.() ?? info.uid) && (info.mode & 63) === 0;
1181
1373
  } catch {
1182
1374
  return false;
1183
1375
  }
1184
1376
  }
1185
- async function privateLogDirectory(name, env = process14.env) {
1377
+ async function privateLogDirectory(name, env = process15.env) {
1186
1378
  const runtime = env.XDG_RUNTIME_DIR;
1187
1379
  const base = runtime === undefined || runtime === "" ? join4(homedir3(), ".cache", CLI_FOLDER) : join4(runtime, CLI_FOLDER);
1188
1380
  const path = join4(base, name);
@@ -1202,14 +1394,14 @@ var usageError;
1202
1394
  function noteUsageError(message) {
1203
1395
  usageError = message;
1204
1396
  }
1205
- function stateHome(env = process15.env) {
1397
+ function stateHome(env = process16.env) {
1206
1398
  const dir = env.XDG_STATE_HOME;
1207
1399
  return dir !== undefined && isAbsolute(dir) ? dir : join5(homedir4(), ".local", "state");
1208
1400
  }
1209
- function usagePath(env = process15.env) {
1401
+ function usagePath(env = process16.env) {
1210
1402
  return join5(stateHome(env), CLI_FOLDER, "usage.jsonl");
1211
1403
  }
1212
- function usageRecorded(env = process15.env) {
1404
+ function usageRecorded(env = process16.env) {
1213
1405
  const off = env.KAYNOOO_CLI_NO_USAGE;
1214
1406
  return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
1215
1407
  }
@@ -1218,12 +1410,12 @@ function flagNames(argv) {
1218
1410
  const names = (end === -1 ? argv : argv.slice(0, end)).filter((word) => word.startsWith("-") && word !== "-").map((word) => word.includes("=") ? word.slice(0, word.indexOf("=")) : word);
1219
1411
  return [...new Set(names)].filter((name) => name.length <= LONGEST_NAME && FLAG_NAME.test(name));
1220
1412
  }
1221
- function usageEntry(bin, command, argv, code, now = new Date) {
1413
+ function usageEntry(bin, command, argv, code, { ms, now = new Date } = {}) {
1222
1414
  const unknown = code === 2 && usageError !== undefined ? UNKNOWN_OPTION2.exec(usageError)?.[1] : undefined;
1223
1415
  usageError = undefined;
1224
- return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
1416
+ return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown }, ...ms === undefined ? {} : { ms: Math.round(ms) } };
1225
1417
  }
1226
- function recordUsage(entry, env = process15.env) {
1418
+ function recordUsage(entry, env = process16.env) {
1227
1419
  if (!usageRecorded(env))
1228
1420
  return;
1229
1421
  try {
@@ -1245,8 +1437,8 @@ var TOP_OPTIONS = {
1245
1437
  completions: { type: "string", choices: COMPLETION_SHELLS, description: "print the shell completion script" }
1246
1438
  };
1247
1439
  function printError(prefix, message, hint, cause) {
1248
- const colors = paint(process16.stderr);
1249
- const styled = takesControlCodes(process16.stderr);
1440
+ const colors = paint(process17.stderr);
1441
+ const styled = takesControlCodes(process17.stderr);
1250
1442
  const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
1251
1443
  const under = (label, text, tint) => text === undefined ? "" : `
1252
1444
  ${styled ? tint(label) : `${label}:`} ${text}`;
@@ -1357,6 +1549,9 @@ function packageVersion(entry = Bun.main) {
1357
1549
  }
1358
1550
  }
1359
1551
  async function runMain({ name, version, run, redact, usage }, argv = scriptArgs()) {
1552
+ const answered = await askpassClient(argv);
1553
+ if (answered !== undefined)
1554
+ return answered;
1360
1555
  if (argv[0] === COMPLETE)
1361
1556
  return printCandidates(leafCandidates(run, argv.slice(1)));
1362
1557
  if (argv[0] === COMPLETIONS || argv[0]?.startsWith(`${COMPLETIONS}=`) === true)
@@ -1375,27 +1570,47 @@ async function runMain({ name, version, run, redact, usage }, argv = scriptArgs(
1375
1570
  notifyEnd(name, code, performance.now() - started);
1376
1571
  if (usage !== false) {
1377
1572
  try {
1378
- recordUsage(usageEntry(name, undefined, argv, code));
1573
+ recordUsage(usageEntry(name, undefined, argv, code, { ms: performance.now() - started }));
1379
1574
  } catch {}
1380
1575
  }
1381
1576
  return code;
1382
1577
  }
1383
- // ../kit/src/folders.ts
1384
- var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
1578
+
1579
+ // ../kit/src/index.ts
1580
+ init_config();
1581
+
1582
+ // ../kit/src/excerpt.ts
1583
+ init_text2();
1584
+
1585
+ // ../kit/src/index.ts
1586
+ init_folders();
1587
+ init_format();
1588
+
1589
+ // ../kit/src/git.ts
1590
+ init_args();
1591
+ // ../kit/src/limit.ts
1592
+ init_args();
1593
+
1594
+ // ../kit/src/index.ts
1595
+ init_mode();
1596
+
1597
+ // ../kit/src/report.ts
1598
+ init_style();
1599
+ init_text2();
1385
1600
  // ../kit/src/secrets.ts
1386
1601
  var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
1387
1602
  // ../kit/src/sessions.ts
1388
1603
  import { homedir as homedir5 } from "os";
1389
1604
  import { join as join7 } from "path";
1390
- import process17 from "process";
1605
+ import process18 from "process";
1391
1606
  var {Glob } = globalThis.Bun;
1392
1607
  var SESSION_FILES = new Glob("*.json");
1393
1608
  var ACCOUNT_DIRS = new Glob("*/sessions");
1394
1609
  async function sessionDirs() {
1395
1610
  const home = homedir5();
1396
1611
  const dirs = new Set([join7(home, ".claude", "sessions")]);
1397
- if (process17.env.CLAUDE_CONFIG_DIR !== undefined)
1398
- dirs.add(join7(process17.env.CLAUDE_CONFIG_DIR, "sessions"));
1612
+ if (process18.env.CLAUDE_CONFIG_DIR !== undefined)
1613
+ dirs.add(join7(process18.env.CLAUDE_CONFIG_DIR, "sessions"));
1399
1614
  try {
1400
1615
  for await (const dir of ACCOUNT_DIRS.scan({ cwd: join7(home, ".claude-accounts"), onlyFiles: false, absolute: true }))
1401
1616
  dirs.add(dir);
@@ -1441,7 +1656,7 @@ async function liveSessions() {
1441
1656
  }
1442
1657
  async function currentSession(sessions) {
1443
1658
  const byPid = new Map(sessions.map((session) => [session.pid, session]));
1444
- let pid = process17.ppid;
1659
+ let pid = process18.ppid;
1445
1660
  for (let depth = 0;depth < 32 && pid > 1; depth++) {
1446
1661
  const session = byPid.get(pid);
1447
1662
  if (session !== undefined)
@@ -1453,21 +1668,34 @@ async function currentSession(sessions) {
1453
1668
  }
1454
1669
  return;
1455
1670
  }
1671
+
1672
+ // ../kit/src/index.ts
1673
+ init_style();
1674
+ init_text2();
1675
+ init_theme();
1676
+ init_user_config();
1677
+
1678
+ // ../kit/src/watch.ts
1679
+ init_args();
1680
+ init_input();
1681
+ init_style();
1682
+ // ../kit/src/workspace-root.ts
1683
+ init_user_config();
1456
1684
  // src/slot.ts
1457
1685
  import { existsSync as existsSync4, mkdirSync as mkdirSync2, readdirSync, readFileSync as readFileSync5, rmSync } from "fs";
1458
1686
  import { availableParallelism } from "os";
1459
1687
  import { join as join8 } from "path";
1460
- import process20 from "process";
1688
+ import process21 from "process";
1461
1689
 
1462
1690
  // src/flock.ts
1463
1691
  import { closeSync, constants as constants2, ftruncateSync, openSync as openSync2, writeSync } from "fs";
1464
- import process19 from "process";
1692
+ import process20 from "process";
1465
1693
  import { dlopen, FFIType } from "bun:ffi";
1466
1694
  var LOCK_EX = 2;
1467
1695
  var LOCK_NB = 4;
1468
1696
  var flock;
1469
1697
  function native() {
1470
- flock ??= dlopen(process19.platform === "darwin" ? "libSystem.B.dylib" : "libc.so.6", { flock: { args: [FFIType.i32, FFIType.i32], returns: FFIType.i32 } }).symbols.flock;
1698
+ flock ??= dlopen(process20.platform === "darwin" ? "libSystem.B.dylib" : "libc.so.6", { flock: { args: [FFIType.i32, FFIType.i32], returns: FFIType.i32 } }).symbols.flock;
1471
1699
  return flock;
1472
1700
  }
1473
1701
  function tryLock(path) {
@@ -1487,10 +1715,9 @@ function writeHeld(held, text) {
1487
1715
  var RUN_USAGE = `slot [options] -- <cmd>...: waits for a free machine-wide slot, then runs the command and exits with its code
1488
1716
  slot ls [--json]: lists who holds a slot or a lock and who waits for one (slot ls --help)
1489
1717
 
1490
- The slots and locks are shared by every session, worktree and shell of this user, so heavy jobs (phpunit, playwright, vue-tsc, eslint) queue instead of overloading the machine.
1491
- A slot or lock is freed the moment its holder ends, SIGKILL included, since the kernel drops it with the process.
1492
- A slotted command that runs slot again does not wait for a second slot, so wrapping both a script and the commands inside it cannot deadlock.
1493
- A first word \`ls\` always means the listing, so run the ls command as \`slot -n 4 -- ls\` or by its path.`;
1718
+ The slots and locks are shared by every session, worktree and shell of this user, so heavy jobs (phpunit, playwright, vue-tsc, eslint) queue instead of overloading the machine; one is freed the moment its holder ends, SIGKILL included.
1719
+ A slotted command that runs slot again does not wait for a second slot, so wrapping a script and the commands inside it cannot deadlock.
1720
+ A first word \`ls\` always means the listing: run the ls command as \`slot -n 4 -- ls\`.`;
1494
1721
  var RUN_EXITS = [[0, "the command did"], ["its own", "the code of a command that failed"], [2, "it timed out waiting for the slot or a usage error"], [127, "the command cannot be started"]];
1495
1722
  var LS_USAGE = `slot ls [options]: lists the slots and locks held, with the session, the command and how long ago it started, then who waits for one
1496
1723
 
@@ -1511,7 +1738,7 @@ function defaultSlots() {
1511
1738
  return Math.max(1, Math.floor(availableParallelism() / 2));
1512
1739
  }
1513
1740
  async function stateDir() {
1514
- const dir = process20.env.SLOT_DIR ?? await privateLogDirectory("slot");
1741
+ const dir = process21.env.SLOT_DIR ?? await privateLogDirectory("slot");
1515
1742
  for (const sub of ["slots", "locks", "waiters"])
1516
1743
  mkdirSync2(join8(dir, sub), { recursive: true, mode: 448 });
1517
1744
  return dir;
@@ -1553,7 +1780,7 @@ function waitingLine(dir, wanted) {
1553
1780
  }
1554
1781
  async function holderOf(command) {
1555
1782
  const session = await currentSession(await liveSessions());
1556
- return { pid: process20.pid, command: command.join(" "), cwd: process20.cwd(), since: Date.now(), ...session === undefined ? {} : { session: session.name } };
1783
+ return { pid: process21.pid, command: command.join(" "), cwd: process21.cwd(), since: Date.now(), ...session === undefined ? {} : { session: session.name } };
1557
1784
  }
1558
1785
  var waiterCount = 0;
1559
1786
  async function acquire(dir, resources, holder, deadline, timeoutMs) {
@@ -1579,7 +1806,7 @@ async function acquire(dir, resources, holder, deadline, timeoutMs) {
1579
1806
  held.release();
1580
1807
  const resource = busy.kind === "lock" ? `lock ${busy.name}` : "slot";
1581
1808
  if (waiter === undefined) {
1582
- const path = join8(dir, "waiters", `${process20.pid}-${waiterCount++}`);
1809
+ const path = join8(dir, "waiters", `${process21.pid}-${waiterCount++}`);
1583
1810
  const held = tryLock(path);
1584
1811
  if (held !== undefined) {
1585
1812
  writeHeld(held, JSON.stringify({ ...holder, resource }));
@@ -1620,7 +1847,7 @@ ${RUN_USAGE}`);
1620
1847
  const count = wholeNumber(values.slots, "slots", defaultSlots());
1621
1848
  const timeoutMs = duration(values.timeout, "timeout", Number.POSITIVE_INFINITY);
1622
1849
  const deadline = Date.now() + timeoutMs;
1623
- const holding = new Set((process20.env[HOLDING] ?? "").split(",").filter((token) => token !== ""));
1850
+ const holding = new Set((process21.env[HOLDING] ?? "").split(",").filter((token) => token !== ""));
1624
1851
  const wanted = [...locks.filter((name) => !holding.has(`lock:${name}`)).map((name) => ({ kind: "lock", name, count })), ...values["no-slot"] === true || holding.has("slot") ? [] : [{ kind: "slot", name: "", count }]];
1625
1852
  const signals = holdSignals(() => {
1626
1853
  return;
@@ -1635,7 +1862,7 @@ ${RUN_USAGE}`);
1635
1862
  const tokens = new Set([...holding, ...locks.map((name) => `lock:${name}`), ...wanted.some((resource) => resource.kind === "slot") ? ["slot"] : []]);
1636
1863
  let child;
1637
1864
  try {
1638
- child = Bun.spawn(rest, { stdio: ["inherit", "inherit", "inherit"], env: { ...process20.env, [HOLDING]: [...tokens].join(",") } });
1865
+ child = Bun.spawn(rest, { stdio: ["inherit", "inherit", "inherit"], env: { ...process21.env, [HOLDING]: [...tokens].join(",") } });
1639
1866
  } catch (error) {
1640
1867
  fail(`cannot run ${rest[0]}: ${error instanceof Error ? error.message : String(error)}`, 127);
1641
1868
  }
@@ -1678,11 +1905,11 @@ async function listSlots(args) {
1678
1905
  printJson({ slots: count, busy, entries });
1679
1906
  return 0;
1680
1907
  }
1681
- console.log(paint(process20.stdout).bold(`slots: ${busy} of ${count} busy`));
1908
+ console.log(paint(process21.stdout).bold(`slots: ${busy} of ${count} busy`));
1682
1909
  if (entries.length > 0)
1683
- console.log(table(entries.map((entry) => [badge(entry.state, process20.stdout), entry.resource, entry.session ?? `pid ${entry.pid}`, truncate(entry.command, COMMAND_WIDTH), entry.since === 0 ? "?" : formatAge(entry.since)])));
1910
+ console.log(table(entries.map((entry) => [badge(entry.state, process21.stdout), entry.resource, entry.session ?? `pid ${entry.pid}`, truncate(entry.command, COMMAND_WIDTH), entry.since === 0 ? "?" : formatAge(entry.since)])));
1684
1911
  return 0;
1685
1912
  }
1686
1913
 
1687
1914
  // src/slot-cli.ts
1688
- process21.exitCode = await runMain({ name: "slot", run: async (args) => args[0] === "ls" ? listSlots(args.slice(1)) : runSlotted(args) });
1915
+ process22.exitCode = await runMain({ name: "slot", run: async (args) => args[0] === "ls" ? listSlots(args.slice(1)) : runSlotted(args) });