@kaynooo/cli-proc 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/procs-cli.js CHANGED
@@ -1,15 +1,45 @@
1
- #!/usr/bin/env -S bun --no-env-file
1
+ #!/usr/bin/env -S bun --no-env-file --config=/dev/null
2
2
  // @bun
3
3
 
4
4
  // src/procs-cli.ts
5
- import process16 from "process";
5
+ import process13 from "process";
6
6
  // ../kit/src/args.ts
7
- import process9 from "process";
7
+ import process6 from "process";
8
8
  import { parseArgs } from "util";
9
9
 
10
10
  // ../kit/src/format.ts
11
- import process7 from "process";
11
+ import process4 from "process";
12
12
 
13
+ // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-n6z2kk96.js
14
+ var r = new Map;
15
+ var i = new Map;
16
+ var l = new Map;
17
+ function a(e, t, o) {
18
+ return JSON.stringify([e ?? null, t ?? null, o]);
19
+ }
20
+ function y(e, t) {
21
+ let o = a(e, t), n = i.get(o);
22
+ if (!n)
23
+ n = new Intl.NumberFormat(e, t), i.set(o, n);
24
+ return n;
25
+ }
26
+ // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-rxztfxgv.js
27
+ var N = new Map;
28
+ var Nt = /\s+\S*$/;
29
+ var Y = /\s/;
30
+ function ko(t, e, r = "...") {
31
+ let { suffix: n = "...", includeSuffix: s = false, wordBoundary: o = false } = typeof r === "string" ? { suffix: r } : r;
32
+ if (t.length <= e)
33
+ return t;
34
+ let l = Math.max(0, e), c = t.substring(0, Math.max(0, s ? l - n.length : l));
35
+ if (o && !Y.test(t[c.length] ?? " "))
36
+ c = c.replace(Nt, "") || c;
37
+ if (o)
38
+ c = c.trimEnd();
39
+ return s ? (c + n).slice(0, l) : c + n;
40
+ }
41
+ 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));
42
+ var z = new Map;
13
43
  // ../kit/src/mode.ts
14
44
  import process2 from "process";
15
45
  var MODES = new Set(["terminal", "ci", "agent", "pipe"]);
@@ -32,479 +62,75 @@ function isInteractive(streams = process2) {
32
62
  }
33
63
 
34
64
  // ../kit/src/style.ts
35
- import process6 from "process";
65
+ import process3 from "process";
36
66
 
37
- // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-mtetydvc.js
38
- function x(s) {
39
- let r = s.startsWith("#") ? s.slice(1).toLowerCase() : s.toLowerCase();
40
- if (!/^[a-f0-9]+$/.test(r))
67
+ // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
68
+ var G2 = /^[a-f0-9]+$/i;
69
+ function b(r) {
70
+ let e = r.startsWith("#") ? r.slice(1) : r;
71
+ if (!G2.test(e))
41
72
  return [0, 0, 0];
42
- let t = r.length, n = (c) => Number.parseInt(c, 16);
43
- if (t === 3 || t === 4) {
44
- let c = n(r[0] + r[0]), u = n(r[1] + r[1]), h = n(r[2] + r[2]), g = t === 4 ? n(r[3] + r[3]) : undefined;
45
- return g !== undefined ? [c, u, h, g] : [c, u, h];
46
- }
47
- if (t !== 6 && t !== 8)
48
- throw Error(`Invalid hex color length: ${t}`);
49
- let a = n(r.slice(0, 2)), b = n(r.slice(2, 4)), o = n(r.slice(4, 6)), y = t === 8 ? n(r.slice(6, 8)) : undefined;
50
- if ([a, b, o].some(Number.isNaN) || y !== undefined && Number.isNaN(y))
51
- throw Error(`Invalid hex color value: ${s}`);
52
- return y !== undefined ? [a, b, o, y] : [a, b, o];
53
- }
54
- function A(s) {
55
- let [r, t, n, a] = s;
56
- if (a)
57
- return `#${(r << 24 | t << 16 | n << 8 | Math.round((a ?? 1) * 255)).toString(16).padStart(8, "0").toUpperCase()}`;
58
- return `#${(r << 16 | t << 8 | n).toString(16).padStart(6, "0").toUpperCase()}`;
59
- }
60
- function R(s, r, t) {
61
- s = (s % 360 + 360) % 360, t /= 100;
62
- let n = r * Math.min(t, 1 - t) / 100, a = (b) => {
63
- let o = (b + s / 30) % 12, y = t - n * Math.max(Math.min(o - 3, 9 - o, 1), -1);
64
- return Math.round(255 * y);
65
- };
66
- return [a(0), a(8), a(4)];
67
- }
68
- function k(s) {
69
- let [r, t, n] = s;
70
- r /= 255, t /= 255, n /= 255;
71
- let a = Math.max(r, t, n), b = Math.min(r, t, n), o = 0, y = 0, c = (a + b) / 2;
72
- if (a !== b) {
73
- let u = a - b;
74
- if (y = c > 0 && c < 1 ? u / (1 - Math.abs(2 * c - 1)) : 0, a === r)
75
- o = (t - n) / u + (t < n ? 6 : 0);
76
- else if (a === t)
77
- o = (n - r) / u + 2;
78
- else
79
- o = (r - t) / u + 4;
80
- o /= 6;
81
- }
82
- return [Math.round(o * 360), Math.round(y * 100), Math.round(c * 100)];
83
- }
84
- function H(s, r, t) {
85
- s = (s % 360 + 360) % 360, r /= 100, t /= 100;
86
- let n = (a) => {
87
- let b = (a + s / 60) % 6, o = t - t * r * Math.max(Math.min(b, 4 - b, 1), 0);
88
- return Math.round(255 * o);
89
- };
90
- return [n(5), n(3), n(1)];
91
- }
92
- function f(s) {
93
- let [r, t, n] = s;
94
- r /= 255, t /= 255, n /= 255;
95
- let a = Math.max(r, t, n), b = Math.min(r, t, n), o = a - b, y = 0, c = a === 0 ? 0 : o / a, u = a;
96
- if (o !== 0) {
97
- if (a === r)
98
- y = (t - n) / o + (t < n ? 6 : 0);
99
- else if (a === t)
100
- y = (n - r) / o + 2;
101
- else
102
- y = (r - t) / o + 4;
103
- y /= 6;
104
- }
105
- return [Math.round(y * 360), Math.round(c * 100), Math.round(u * 100)];
106
- }
107
- function O(s) {
108
- let r = s[0] / 255, t = s[1] / 255, n = s[2] / 255, a = 1 - Math.max(r, t, n);
109
- if (a === 1)
110
- return [0, 0, 0, 100];
111
- let b = (1 - r - a) / (1 - a), o = (1 - t - a) / (1 - a), y = (1 - n - a) / (1 - a);
112
- return [Math.round(b * 100), Math.round(o * 100), Math.round(y * 100), Math.round(a * 100)];
113
- }
114
- function v(s, r, t, n) {
115
- return s /= 100, r /= 100, t /= 100, n /= 100, [Math.round(255 * (1 - s) * (1 - n)), Math.round(255 * (1 - r) * (1 - n)), Math.round(255 * (1 - t) * (1 - n))];
116
- }
117
- var m = (s) => s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
118
- var p = (s) => s <= 0.0031308 ? 12.92 * s : 1.055 * s ** 0.4166666666666667 - 0.055;
119
- var i = (s, r) => Math.round(s * 10 ** r) / 10 ** r;
120
- function T(s) {
121
- let r = m(s[0] / 255), t = m(s[1] / 255), n = m(s[2] / 255), a = Math.cbrt(0.4122214708 * r + 0.5363325363 * t + 0.0514459929 * n), b = Math.cbrt(0.2119034982 * r + 0.6806995451 * t + 0.1073969566 * n), o = Math.cbrt(0.0883024619 * r + 0.2817188376 * t + 0.6299787005 * n);
122
- return [i(0.2104542553 * a + 0.793617785 * b - 0.0040720468 * o, 4), i(1.9779984951 * a - 2.428592205 * b + 0.4505937099 * o, 4), i(0.0259040371 * a + 0.7827717662 * b - 0.808675766 * o, 4)];
123
- }
124
- function M(s, r, t) {
125
- let n = (s + 0.3963377774 * r + 0.2158037573 * t) ** 3, a = (s - 0.1055613458 * r - 0.0638541728 * t) ** 3, b = (s - 0.0894841775 * r - 1.291485548 * t) ** 3, o = p(4.0767416621 * n - 3.3077115913 * a + 0.2309699292 * b), y = p(-1.2684380046 * n + 2.6097574011 * a - 0.3413193965 * b), c = p(-0.0041960863 * n - 0.7034186147 * a + 1.707614701 * b), u = (h) => Math.min(255, Math.max(0, Math.round(h * 255)));
126
- return [u(o), u(y), u(c)];
127
- }
128
- function d(s) {
129
- let [r, t, n] = T(s), a = Math.sqrt(t * t + n * n), b = (Math.atan2(n, t) * 180 / Math.PI + 360) % 360;
130
- return [i(r, 4), i(a, 4), i(b, 2)];
131
- }
132
- function C(s, r, t) {
133
- let n = t * Math.PI / 180;
134
- return M(s, r * Math.cos(n), r * Math.sin(n));
135
- }
136
- function l(s) {
137
- let r = s / 255;
138
- return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
139
- }
140
-
141
- class e {
142
- r;
143
- g;
144
- b;
145
- a;
146
- constructor(s, r, t, n = 1) {
147
- this.r = s, this.g = r, this.b = t, this.a = n;
148
- }
149
- static from(s, r) {
150
- if (s === "hex") {
151
- let [t, n, a, b] = x(r);
152
- return new e(t, n, a, b);
153
- }
154
- if (s === "rgb") {
155
- if (Array.isArray(r)) {
156
- let [o, y, c, u] = r;
157
- return new e(o, y, c, u);
158
- }
159
- let { r: t, g: n, b: a, a: b } = r;
160
- return new e(t, n, a, b);
161
- }
162
- if (s === "hsl") {
163
- let t, n, a, b;
164
- if (Array.isArray(r))
165
- [t, n, a, b] = r;
166
- else
167
- ({ h: t, s: n, l: a, a: b } = r);
168
- let [o, y, c] = R(t, n, a);
169
- return new e(o, y, c, b);
170
- }
171
- if (s === "hsv") {
172
- let t, n, a, b;
173
- if (Array.isArray(r))
174
- [t, n, a, b] = r;
175
- else
176
- ({ h: t, s: n, v: a, a: b } = r);
177
- let [o, y, c] = H(t, n, a);
178
- return new e(o, y, c, b);
179
- }
180
- if (s === "cmyk") {
181
- let t, n, a, b, o;
182
- if (Array.isArray(r))
183
- [t, n, a, b, o] = r;
184
- else
185
- ({ c: t, m: n, y: a, k: b, a: o } = r);
186
- let [y, c, u] = v(t, n, a, b);
187
- return new e(y, c, u, o);
188
- }
189
- if (s === "oklch") {
190
- let t, n, a, b;
191
- if (Array.isArray(r))
192
- [t, n, a, b] = r;
193
- else
194
- ({ l: t, c: n, h: a, a: b } = r);
195
- let [o, y, c] = C(t, n, a);
196
- return new e(o, y, c, b);
197
- }
198
- if (s === "oklab") {
199
- let t, n, a, b;
200
- if (Array.isArray(r))
201
- [t, n, a, b] = r;
202
- else
203
- ({ l: t, a: n, b: a, alpha: b } = r);
204
- let [o, y, c] = M(t, n, a);
205
- return new e(o, y, c, b);
206
- }
207
- throw Error("Invalid input");
208
- }
209
- to(s) {
210
- switch (s) {
211
- case "rgb":
212
- return [this.r, this.g, this.b];
213
- case "rgba":
214
- return [this.r, this.g, this.b, this.a];
215
- case "hex":
216
- return A([this.r, this.g, this.b]);
217
- case "hexa":
218
- return A([this.r, this.g, this.b, this.a]);
219
- case "hsl":
220
- return k([this.r, this.g, this.b]);
221
- case "hsla":
222
- return [...k([this.r, this.g, this.b]), this.a];
223
- case "hsv":
224
- return f([this.r, this.g, this.b]);
225
- case "hsva":
226
- return [...f([this.r, this.g, this.b]), this.a];
227
- case "cmyk":
228
- return O([this.r, this.g, this.b]);
229
- case "cmyka":
230
- return [...O([this.r, this.g, this.b]), this.a];
231
- case "oklch":
232
- return d([this.r, this.g, this.b]);
233
- case "oklcha":
234
- return [...d([this.r, this.g, this.b]), this.a];
235
- case "oklab":
236
- return T([this.r, this.g, this.b]);
237
- case "oklaba":
238
- return [...T([this.r, this.g, this.b]), this.a];
239
- default:
240
- return [this.r, this.g, this.b];
241
- }
242
- }
243
- getLuminance() {
244
- let s = l(this.r), r = l(this.g), t = l(this.b);
245
- return 0.2126 * s + 0.7152 * r + 0.0722 * t;
246
- }
247
- contrastRatio(s) {
248
- let r = this.getLuminance(), t = s.getLuminance(), [n, a] = r >= t ? [r, t] : [t, r];
249
- return (n + 0.05) / (a + 0.05);
250
- }
251
- bestContrastForeground() {
252
- let s = new e(255, 255, 255, 1), r = new e(0, 0, 0, 1), t = this.contrastRatio(s), n = this.contrastRatio(r);
253
- return t >= n ? s : r;
254
- }
255
- }
256
-
257
- // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-y1msbssb.js
258
- var r = 39;
259
- var o = 49;
260
- var f2 = "\x1B[";
261
- var C2 = { 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, r], red: [31, r], green: [32, r], yellow: [33, r], blue: [34, r], magenta: [35, r], cyan: [36, r], white: [37, r], gray: [90, r], grey: [90, r], blackBright: [90, r], redBright: [91, r], greenBright: [92, r], yellowBright: [93, r], blueBright: [94, r], magentaBright: [95, r], cyanBright: [96, r], whiteBright: [97, r], bgBlack: [40, o], bgRed: [41, o], bgGreen: [42, o], bgYellow: [43, o], bgBlue: [44, o], bgMagenta: [45, o], bgCyan: [46, o], bgWhite: [47, o], bgBlackBright: [100, o], bgRedBright: [101, o], bgGreenBright: [102, o], bgYellowBright: [103, o], bgBlueBright: [104, o], bgMagentaBright: [105, o], bgCyanBright: [106, o], bgWhiteBright: [107, o], rgb: (i, n, a, l = "fg") => [`${l === "fg" ? 38 : 48};2;${i};${n};${a}`, l === "fg" ? r : o], hex: (i, n = "fg") => {
262
- let [a, l, s] = e.from("hex", i).to("rgb");
263
- return [`${n === "fg" ? 38 : 48};2;${a};${l};${s}`, n === "fg" ? r : o];
264
- }, ansi256: (i, n = "fg") => [`${n === "fg" ? 38 : 48};5;${i}`, n === "fg" ? r : o] };
265
- var b = new Set(["", "1", "2", "3", "true"]);
266
- function h(i, n = globalThis.process?.env ?? {}) {
267
- if (n.FORCE_COLOR !== undefined)
268
- return b.has(n.FORCE_COLOR);
269
- if (n.NO_COLOR !== undefined || n.NODE_DISABLE_COLORS !== undefined || n.TERM === "dumb")
73
+ if (e.length === 3 || e.length === 4)
74
+ return [Number.parseInt(e[0] + e[0], 16), Number.parseInt(e[1] + e[1], 16), Number.parseInt(e[2] + e[2], 16)];
75
+ if (e.length !== 6 && e.length !== 8)
76
+ throw Error(`Invalid hex color length: ${e.length}`);
77
+ return [Number.parseInt(e.slice(0, 2), 16), Number.parseInt(e.slice(2, 4), 16), Number.parseInt(e.slice(4, 6), 16)];
78
+ }
79
+ 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") => {
80
+ let [l, n, c] = b(r);
81
+ return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
82
+ }, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
83
+ var h = new Set(["", "1", "2", "3", "true"]);
84
+ function C(r, e = globalThis.process?.env ?? {}) {
85
+ if (e.FORCE_COLOR !== undefined)
86
+ return h.has(e.FORCE_COLOR);
87
+ if (e.NO_COLOR !== undefined || e.NODE_DISABLE_COLORS !== undefined || e.TERM === "dumb")
270
88
  return false;
271
- return i?.isTTY === true;
272
- }
273
- function d2(i, n, a) {
274
- if (!h(a.stream ?? globalThis.process?.stdout, a.env))
275
- return n;
276
- let l = "", s = "";
277
- for (let g = 0, y = i.length;g < y; g++) {
278
- let [c, p] = i[g];
279
- l += `${f2}${c}m`, s = `${f2}${p}m${s}`;
280
- }
281
- return l + n + s;
282
- }
283
- function u(i, n = []) {
284
- return new Proxy((l) => d2(n, l, i), { get(l, s) {
285
- let g = C2[s];
286
- if (Array.isArray(g))
287
- return u(i, [...n, g]);
288
- if (typeof g === "function")
289
- return (...y) => u(i, [...n, g(...y)]);
290
- throw Error(`Unknown style: ${String(s)}`);
89
+ return r?.isTTY === true;
90
+ }
91
+ function f2(r, e = []) {
92
+ let l = "", n = "";
93
+ for (let t = 0, i = e.length;t < i; t++)
94
+ l += `\x1B[${e[t][0]}m`, n = `\x1B[${e[t][1]}m${n}`;
95
+ let c = (t) => C(r.stream ?? globalThis.process?.stdout, r.env) ? l + t + n : t, g = new Map;
96
+ return new Proxy(c, { get(t, i) {
97
+ let a = B2[i];
98
+ if (Array.isArray(a)) {
99
+ let s = g.get(i);
100
+ if (s === undefined)
101
+ s = f2(r, [...e, a]), g.set(i, s);
102
+ return s;
103
+ }
104
+ if (typeof a === "function")
105
+ return (...s) => {
106
+ let y = `${i}:${s.join(",")}`, u = g.get(y);
107
+ if (u === undefined) {
108
+ if (g.size >= 64)
109
+ g.clear();
110
+ u = f2(r, [...e, a(...s)]), g.set(y, u);
111
+ }
112
+ return u;
113
+ };
114
+ throw Error(`Unknown style: ${String(i)}`);
291
115
  } });
292
116
  }
293
- function le(i = {}) {
294
- return u(i);
117
+ function Fe2(r = {}) {
118
+ return f2(r);
295
119
  }
296
- var t = le();
120
+ var o2 = Fe2();
297
121
 
298
122
  // ../kit/src/theme.ts
299
- import { existsSync as existsSync2, readFileSync, statSync } from "fs";
300
- import { homedir as homedir2 } from "os";
301
- import { join as join3, resolve as resolve2 } from "path";
302
- import process5 from "process";
303
-
304
- // ../kit/src/config.ts
305
- import { existsSync } from "fs";
306
- import { dirname, join, resolve } from "path";
307
- import process3 from "process";
308
- function findUp(names, from = process3.cwd(), stop = () => false) {
309
- const wanted = typeof names === "string" ? [names] : names;
310
- for (let dir = resolve(from);; dir = dirname(dir)) {
311
- const found = wanted.map((name) => join(dir, name)).find((path) => existsSync(path));
312
- if (found !== undefined)
313
- return found;
314
- if (stop(dir) || dirname(dir) === dir)
315
- return;
316
- }
317
- }
318
-
319
- // ../kit/src/user-config.ts
320
- import { homedir } from "os";
321
- import { join as join2 } from "path";
322
- import process4 from "process";
323
- function configBase(where = {}) {
324
- const xdg = where.xdg ?? (where.home === undefined ? process4.env.XDG_CONFIG_HOME : undefined);
325
- return xdg !== undefined && xdg !== "" ? xdg : join2(where.home ?? homedir(), ".config");
326
- }
327
- function userConfigPath(bin, where = {}) {
328
- return join2(configBase(where), "kaynooo-cli", `${bin}.json`);
329
- }
330
-
331
- // ../kit/src/theme.ts
332
- var DEFAULT = {
333
- colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
334
- glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D" },
335
- accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
336
- bins: {}
337
- };
338
- var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
339
- var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
340
- var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+" };
341
- var PRESETS = {
342
- default: {},
343
- "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
344
- mono: { colors: MONO, accents: ["bold"] },
345
- ascii: { glyphs: ASCII }
346
- };
123
+ var ENDS = new Map;
347
124
  var STYLES = new Set(["bold", "dim", "italic", "underline", "inverse", "strikethrough", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "gray", "grey", "blackBright", "redBright", "greenBright", "yellowBright", "blueBright", "magentaBright", "cyanBright", "whiteBright"]);
348
- var HEX = /^#[0-9a-f]{6}$/i;
349
- var CONTROL = /\p{Cc}/u;
350
125
  var MAX_FILE_BYTES = 64 * 1024;
351
- var SPACES = /\s+/;
352
- function isColorSpec(spec) {
353
- if (typeof spec === "number")
354
- return Number.isInteger(spec) && spec >= 0 && spec <= 255;
355
- return typeof spec === "string" && spec.trim() !== "" && spec.trim().split(SPACES).every((token) => STYLES.has(token) || HEX.test(token));
356
- }
357
- var CUBE = [0, 95, 135, 175, 215, 255];
358
- function cubeLevel(channel) {
359
- return CUBE.reduce((best, value, level) => Math.abs(value - channel) < Math.abs(CUBE[best] - channel) ? level : best, 0);
360
- }
361
- function nearest256(hex) {
362
- const rgb = [1, 3, 5].map((at) => Number.parseInt(hex.slice(at, at + 2), 16));
363
- const levels = rgb.map(cubeLevel);
364
- const cube = levels.map((level) => CUBE[level]);
365
- const grey = Math.min(23, Math.max(0, Math.round((rgb.reduce((sum, channel) => sum + channel, 0) / 3 - 8) / 10)));
366
- const greyValue = 8 + grey * 10;
367
- const distance = (colour) => colour.reduce((sum, channel, at) => sum + (channel - rgb[at]) ** 2, 0);
368
- return distance([greyValue, greyValue, greyValue]) < distance(cube) ? 232 + grey : 16 + 36 * levels[0] + 6 * levels[1] + levels[2];
369
- }
370
- function hasTrueColor(env) {
371
- return env.COLORTERM === "truecolor" || env.COLORTERM === "24bit";
372
- }
373
- function tinted(colors, spec, env = process5.env) {
374
- if (typeof spec === "number")
375
- return colors.ansi256(spec);
376
- return spec.trim().split(SPACES).reduce((chain, token) => {
377
- if (HEX.test(token))
378
- return hasTrueColor(env) ? chain.hex(token) : chain.ansi256(nearest256(token));
379
- return chain[token] ?? chain;
380
- }, colors);
381
- }
382
- function isRecord(value) {
383
- return typeof value === "object" && value !== null && !Array.isArray(value);
384
- }
385
- function readThemeFile(path, warn) {
386
- try {
387
- const stat = statSync(path, { throwIfNoEntry: false });
388
- if (stat === undefined)
389
- return;
390
- if (!stat.isFile() || stat.size > MAX_FILE_BYTES) {
391
- warn(`${path} is not a regular file under ${MAX_FILE_BYTES / 1024} KiB, theme ignored`);
392
- return;
393
- }
394
- const parsed = JSON.parse(readFileSync(path, "utf8"));
395
- if (isRecord(parsed))
396
- return parsed;
397
- warn(`${path} is not a JSON object, theme ignored`);
398
- } catch (error) {
399
- warn(`${path} does not parse (${error instanceof Error ? error.message : String(error)}), theme ignored`);
400
- }
401
- return;
402
- }
403
- function applyPreset(theme, name, warn, where) {
404
- if (name === undefined)
405
- return;
406
- if (typeof name !== "string" || !Object.hasOwn(PRESETS, name)) {
407
- warn(`${where}: no preset ${String(name)}, one of ${Object.keys(PRESETS).join(", ")}`);
408
- return;
409
- }
410
- const preset = PRESETS[name];
411
- Object.assign(theme.colors, preset.colors);
412
- Object.assign(theme.glyphs, preset.glyphs);
413
- if (preset.accents !== undefined)
414
- theme.accents = [...preset.accents];
415
- return name;
416
- }
417
- function applyFile(theme, file, where, warn) {
418
- if (isRecord(file.colors)) {
419
- for (const [key, value] of Object.entries(file.colors)) {
420
- if (!Object.hasOwn(DEFAULT.colors, key))
421
- warn(`${where}: no colour ${key}, one of ${Object.keys(DEFAULT.colors).join(", ")}`);
422
- else if (!isColorSpec(value))
423
- warn(`${where}: colour ${key} is not an ANSI name, \`#rrggbb\` or a number up to 255`);
424
- else
425
- theme.colors[key] = value;
426
- }
427
- }
428
- if (isRecord(file.glyphs)) {
429
- for (const [key, value] of Object.entries(file.glyphs)) {
430
- if (!Object.hasOwn(DEFAULT.glyphs, key))
431
- warn(`${where}: no glyph ${key}, one of ${Object.keys(DEFAULT.glyphs).join(", ")}`);
432
- else if (typeof value !== "string" || CONTROL.test(value) || Bun.stringWidth(value) !== 1)
433
- warn(`${where}: glyph ${key} must be one visible character wide, with no control character`);
434
- else
435
- theme.glyphs[key] = value;
436
- }
437
- }
438
- if (Array.isArray(file.accents) && file.accents.length > 0 && file.accents.every(isColorSpec))
439
- theme.accents = [...file.accents];
440
- else if (file.accents !== undefined)
441
- warn(`${where}: accents must be a non-empty list of colours`);
442
- if (isRecord(file.bins)) {
443
- for (const [bin, value] of Object.entries(file.bins)) {
444
- if (isColorSpec(value))
445
- theme.bins[bin] = value;
446
- else
447
- warn(`${where}: bin ${bin} has no valid colour`);
448
- }
449
- }
450
- }
451
- function endsWalk(home) {
452
- return (dir) => dir === resolve2(home) || existsSync2(join3(dir, ".git"));
453
- }
454
126
  var warned = new Set;
455
- function warnOnce(message) {
456
- if (warned.has(message))
457
- return;
458
- warned.add(message);
459
- console.error(`warning: theme ${message}`);
460
- }
461
- function isPath(chosen) {
462
- return chosen.includes("/") || chosen.endsWith(".json");
463
- }
464
- function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(), warn = warnOnce } = {}) {
465
- const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null) };
466
- const sources = [];
467
- const chosen = env.KIT_THEME ?? "";
468
- const wanted = chosen === "" ? [userConfigPath("theme", { home, xdg: env.XDG_CONFIG_HOME }), findUp(join3(".kaynooo", "theme.json"), from, endsWalk(home))] : [];
469
- if (isPath(chosen))
470
- wanted.push(resolve2(from, chosen));
471
- const files = [];
472
- for (const path of wanted) {
473
- const file = path === undefined ? undefined : readThemeFile(path, warn);
474
- if (path !== undefined && file !== undefined)
475
- files.push({ path, file });
476
- }
477
- let preset = "default";
478
- if (chosen !== "" && !isPath(chosen)) {
479
- preset = applyPreset(theme, chosen, warn, "KIT_THEME") ?? preset;
480
- } else {
481
- const named = files.findLast(({ file }) => file.preset !== undefined);
482
- if (named !== undefined)
483
- preset = applyPreset(theme, named.file.preset, warn, named.path) ?? preset;
484
- }
485
- for (const { path, file } of files) {
486
- applyFile(theme, file, path, warn);
487
- sources.push(path);
488
- }
489
- return { theme, sources, preset };
490
- }
491
- var current;
492
- var currentKey = "";
493
- function activeTheme() {
494
- const key = `${process5.cwd()}\x00${process5.env.KIT_THEME ?? ""}\x00${process5.env.XDG_CONFIG_HOME ?? ""}`;
495
- if (current === undefined || key !== currentKey) {
496
- current = loadTheme();
497
- currentKey = key;
498
- }
499
- return current;
500
- }
501
127
 
502
128
  // ../kit/src/style.ts
503
- function takesControlCodes(stream, env = process6.env) {
129
+ function takesControlCodes(stream, env = process3.env) {
504
130
  return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
505
131
  }
506
- function paint(stream, env = process6.env) {
507
- return le({ stream: { isTTY: takesControlCodes(stream, env) }, env });
132
+ function paint(stream, env = process3.env) {
133
+ return Fe2({ stream: { isTTY: takesControlCodes(stream, env) }, env });
508
134
  }
509
135
  var STATUS_WORDS = {
510
136
  passed: ["passed", "success", "succeeded", "ok"],
@@ -514,31 +140,16 @@ var STATUS_WORDS = {
514
140
  skipped: ["skipped", "cancelled", "canceled", "manual"]
515
141
  };
516
142
  var STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
517
- function header(bin, context, stream, env = process6.env) {
518
- if (!takesControlCodes(stream, env))
519
- return "";
520
- const colors = paint(stream, env);
521
- const hash = [...bin].reduce((sum, char) => sum + char.charCodeAt(0), 0);
522
- const { theme } = activeTheme();
523
- const spec = theme.bins[bin] ?? theme.accents[hash % theme.accents.length];
524
- const accent = tinted(typeof spec === "string" && spec.split(" ").includes("bold") ? colors : colors.bold, spec, env);
525
- return `${accent(bin)}${context === undefined ? "" : colors.dim(` \u203A ${context}`)}`;
526
- }
527
- function printHeader(bin, context, stream = process6.stdout, env = process6.env) {
528
- const line = header(bin, context, stream, env);
529
- if (line !== "")
530
- console.log(line);
531
- }
532
- // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-hrsswv1w.js
533
- function $e(t, e = false, i = 1) {
534
- let n = typeof e === "object" ? e : { units: e ? "si" : "iec", dp: i }, { units: s = "iec", dp: u = 1 } = n, r = s === "si" ? 1000 : 1024;
535
- if (Math.abs(t) < r)
536
- return `${t} B`;
537
- let c = s === "iec" ? ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"] : ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], o = -1, l = 10 ** u;
143
+ // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-knqbxp56.js
144
+ function tt2(i, { units: r = "iec", dp: t = 1, locale: n } = {}) {
145
+ let e = r === "si" ? 1000 : 1024;
146
+ if (Math.abs(i) < e)
147
+ return `${i} B`;
148
+ let s = r === "iec" ? ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"] : ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], o = -1, a = 10 ** t;
538
149
  do
539
- t /= r, ++o;
540
- while (Math.round(Math.abs(t) * l) / l >= r && o < c.length - 1);
541
- return `${t.toFixed(u)} ${c[o]}`;
150
+ i /= e, ++o;
151
+ while (Math.round(Math.abs(i) * a) / a >= e && o < s.length - 1);
152
+ return `${n ? y(n, { minimumFractionDigits: t, maximumFractionDigits: t }).format(i) : i.toFixed(t)} ${s[o]}`;
542
153
  }
543
154
 
544
155
  // ../kit/src/format.ts
@@ -561,14 +172,14 @@ function upTo(text, separator) {
561
172
  return end === -1 ? text : text.slice(0, end);
562
173
  }
563
174
  function truncate(text, width) {
564
- return text.length <= width ? text : `${text.slice(0, Math.max(0, width - 1))}\u2026`;
175
+ return ko(text, width, { suffix: "\u2026", includeSuffix: true });
565
176
  }
566
177
  var LINE_BREAKS = /\s*\n\s*/g;
567
178
  var ESCAPE = String.fromCharCode(27);
568
179
  function textWidth(text) {
569
180
  return Bun.stringWidth(text);
570
181
  }
571
- function table(rows, { cellWidth, header = false, align = [], fit, stream = process7.stdout, env = process7.env } = {}) {
182
+ function table(rows, { cellWidth, header = false, align = [], fit, stream = process4.stdout, env = process4.env } = {}) {
572
183
  const cells = cellWidth === undefined ? rows : rows.map((row) => row.map((cell) => truncate(cell.replaceAll(LINE_BREAKS, " "), cellWidth)));
573
184
  if (outputMode(stream, env) === "agent")
574
185
  return cells.map((row) => row.map((cell) => Bun.stripANSI(cell).replaceAll(/[\t\r\n]+/g, " ")).join("\t")).join(`
@@ -607,7 +218,7 @@ function narrow(rows, widths, limit) {
607
218
  }
608
219
  return rows.map((row) => row.map((cell, index) => textWidth(cell) > (widths[index] ?? 0) ? truncate(cell, widths[index] ?? 0) : cell));
609
220
  }
610
- function jsonText(value, replacer, { stream = process7.stdout, env = process7.env } = {}) {
221
+ function jsonText(value, replacer, { stream = process4.stdout, env = process4.env } = {}) {
611
222
  return JSON.stringify(value, replacer, outputMode(stream, env) === "agent" ? undefined : 2);
612
223
  }
613
224
  function printJson(value) {
@@ -615,27 +226,27 @@ function printJson(value) {
615
226
  }
616
227
 
617
228
  // ../kit/src/help.ts
618
- import process8 from "process";
229
+ import process5 from "process";
619
230
  var OPTIONAL = /\[[^\]]+\]/g;
620
231
  var USAGE_PREFIX = /^usage:\s*/i;
621
232
  var FULL_STOP = /\.$/;
622
- function usageLine(usage, colors = paint(process8.stdout)) {
233
+ function usageLine(usage, colors = paint(process5.stdout)) {
623
234
  return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
624
235
  }
625
- function helpText(usage, options, colors = paint(process8.stdout), { examples = [], replaces, exits = [] } = {}) {
236
+ function helpText(usage, options, colors = paint(process5.stdout), { examples = [], replaces, exits = [] } = {}) {
626
237
  return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
627
238
  `);
628
239
  }
629
- function exitRows(exits, colors = paint(process8.stdout)) {
240
+ function exitRows(exits, colors = paint(process5.stdout)) {
630
241
  if (exits.length === 0)
631
242
  return [];
632
243
  const width = Math.max(...exits.map(([code]) => String(code).length));
633
244
  return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
634
245
  }
635
- function replacesRows(replaces, colors = paint(process8.stdout)) {
246
+ function replacesRows(replaces, colors = paint(process5.stdout)) {
636
247
  return replaces === undefined || outputMode() === "agent" ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
637
248
  }
638
- function wantsHelpJson(env = process8.env) {
249
+ function wantsHelpJson(env = process5.env) {
639
250
  return env.KIT_HELP === "json";
640
251
  }
641
252
  function description(usage, { examples = [], replaces, exits } = {}, options) {
@@ -654,12 +265,12 @@ function description(usage, { examples = [], replaces, exits } = {}, options) {
654
265
  ...options === undefined ? {} : { options: Object.entries(options).map(([name, { short, description }]) => ({ name, ...short === undefined ? {} : { short }, ...description === undefined ? {} : { description } })) }
655
266
  };
656
267
  }
657
- function exampleRows(examples, colors = paint(process8.stdout)) {
268
+ function exampleRows(examples, colors = paint(process5.stdout)) {
658
269
  if (examples.length === 0 || outputMode() === "agent")
659
270
  return [];
660
271
  return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
661
272
  }
662
- function optionRows(options, colors = paint(process8.stdout)) {
273
+ function optionRows(options, colors = paint(process5.stdout)) {
663
274
  const rows = Object.entries(options).map(([name, option]) => {
664
275
  const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
665
276
  const named = option.choices === undefined ? "<value>" : `<${option.choices.join("|")}>`;
@@ -760,7 +371,7 @@ var OUTPUT_OPTIONS = {
760
371
  color: { type: "string", description: "auto (on a terminal alone), always or never" },
761
372
  plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
762
373
  };
763
- function applyOutput(color, plain, env = process9.env) {
374
+ function applyOutput(color, plain, env = process6.env) {
764
375
  const when = plain === true ? "never" : color ?? "auto";
765
376
  if (when === "auto")
766
377
  return;
@@ -931,7 +542,7 @@ function nearestOption(message, options, allowNegative) {
931
542
  }
932
543
  // ../kit/src/process.ts
933
544
  import { constants } from "os";
934
- import process10 from "process";
545
+ import process7 from "process";
935
546
  var KILL_GRACE_MS = 2000;
936
547
  function exitCodeOf(code, signal) {
937
548
  if (code !== null)
@@ -951,7 +562,7 @@ async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal,
951
562
  return;
952
563
  try {
953
564
  if (grouped)
954
- process10.kill(-proc.pid, killing);
565
+ process7.kill(-proc.pid, killing);
955
566
  else
956
567
  proc.kill(killing);
957
568
  } catch {}
@@ -1025,15 +636,15 @@ var ESCAPE_CODE = new RegExp(`${ESC}(?:\\[[\\x30-\\x3F]*[\\x20-\\x2F]*[\\x40-\\x
1025
636
  var RESET_STYLE = `${ESC}[0m`;
1026
637
  var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
1027
638
  // ../kit/src/cli.ts
1028
- import { readFileSync as readFileSync2, realpathSync } from "fs";
1029
- import { dirname as dirname3, join as join5 } from "path";
1030
- import process12 from "process";
639
+ import { readFileSync, realpathSync } from "fs";
640
+ import { dirname as dirname2, join as join2 } from "path";
641
+ import process9 from "process";
1031
642
 
1032
643
  // ../kit/src/usage.ts
1033
644
  import { appendFileSync, mkdirSync } from "fs";
1034
- import { homedir as homedir3 } from "os";
1035
- import { dirname as dirname2, isAbsolute, join as join4 } from "path";
1036
- import process11 from "process";
645
+ import { homedir } from "os";
646
+ import { dirname, isAbsolute, join } from "path";
647
+ import process8 from "process";
1037
648
 
1038
649
  // ../kit/src/logs.ts
1039
650
  var DAY_MS = 24 * 60 * 60 * 1000;
@@ -1047,14 +658,14 @@ var usageError;
1047
658
  function noteUsageError(message) {
1048
659
  usageError = message;
1049
660
  }
1050
- function stateHome(env = process11.env) {
661
+ function stateHome(env = process8.env) {
1051
662
  const dir = env.XDG_STATE_HOME;
1052
- return dir !== undefined && isAbsolute(dir) ? dir : join4(homedir3(), ".local", "state");
663
+ return dir !== undefined && isAbsolute(dir) ? dir : join(homedir(), ".local", "state");
1053
664
  }
1054
- function usagePath(env = process11.env) {
1055
- return join4(stateHome(env), CLI_FOLDER, "usage.jsonl");
665
+ function usagePath(env = process8.env) {
666
+ return join(stateHome(env), CLI_FOLDER, "usage.jsonl");
1056
667
  }
1057
- function usageRecorded(env = process11.env) {
668
+ function usageRecorded(env = process8.env) {
1058
669
  const off = env.KAYNOOO_CLI_NO_USAGE;
1059
670
  return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
1060
671
  }
@@ -1068,12 +679,12 @@ function usageEntry(bin, command, argv, code, now = new Date) {
1068
679
  usageError = undefined;
1069
680
  return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
1070
681
  }
1071
- function recordUsage(entry, env = process11.env) {
682
+ function recordUsage(entry, env = process8.env) {
1072
683
  if (!usageRecorded(env))
1073
684
  return;
1074
685
  try {
1075
686
  const path = usagePath(env);
1076
- mkdirSync(dirname2(path), { recursive: true, mode: 448 });
687
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
1077
688
  appendFileSync(path, `${JSON.stringify(entry)}
1078
689
  `, { mode: 384 });
1079
690
  } catch {}
@@ -1159,8 +770,8 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
1159
770
  `);
1160
771
  }
1161
772
  function printError(prefix, message, hint, cause) {
1162
- const colors = paint(process12.stderr);
1163
- const styled = takesControlCodes(process12.stderr);
773
+ const colors = paint(process9.stderr);
774
+ const styled = takesControlCodes(process9.stderr);
1164
775
  const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
1165
776
  const under = (label, text, tint) => text === undefined ? "" : `
1166
777
  ${styled ? tint(label) : `${label}:`} ${text}`;
@@ -1203,11 +814,11 @@ async function dispatch(level, typed, { version, redact }) {
1203
814
  }
1204
815
  }
1205
816
  if (name === undefined && level.path.length > 1) {
1206
- console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process12.stderr));
817
+ console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process9.stderr));
1207
818
  return 2;
1208
819
  }
1209
820
  if (name === undefined || name === "help" || name === "--help" || name === "-h") {
1210
- console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process12.stdout));
821
+ console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process9.stdout));
1211
822
  return 0;
1212
823
  }
1213
824
  if (level.path.length === 1 && (name === "--version" || name === "-v")) {
@@ -1324,17 +935,17 @@ async function printCandidates(found) {
1324
935
  return 0;
1325
936
  }
1326
937
  function packageVersion(entry = Bun.main) {
1327
- for (let dir = dirname3(realpathSync(entry));; dir = dirname3(dir)) {
938
+ for (let dir = dirname2(realpathSync(entry));; dir = dirname2(dir)) {
1328
939
  try {
1329
- const { version } = JSON.parse(readFileSync2(join5(dir, "package.json"), "utf8"));
940
+ const { version } = JSON.parse(readFileSync(join2(dir, "package.json"), "utf8"));
1330
941
  if (typeof version === "string")
1331
942
  return version;
1332
943
  } catch {}
1333
- if (dirname3(dir) === dir)
944
+ if (dirname2(dir) === dir)
1334
945
  return "0.0.0";
1335
946
  }
1336
947
  }
1337
- async function runCli(cli, argv = process12.argv.slice(2)) {
948
+ async function runCli(cli, argv = process9.argv.slice(2)) {
1338
949
  const version = cli.version ?? packageVersion();
1339
950
  if (argv[0] === COMPLETE)
1340
951
  return printCandidates(candidates(scopeOf(cli.commands, cli.extraCommands, cli.aliases), cli.defaultCommand, argv.slice(1)));
@@ -1361,7 +972,7 @@ function commandPath(scope, argv) {
1361
972
  }
1362
973
  return path.length === 0 ? undefined : path.join(" ");
1363
974
  }
1364
- async function runMain({ name, version, run, redact, usage }, argv = process12.argv.slice(2)) {
975
+ async function runMain({ name, version, run, redact, usage }, argv = process9.argv.slice(2)) {
1365
976
  if (argv[0] === COMPLETE)
1366
977
  return printCandidates(leafCandidates(run, argv.slice(1)));
1367
978
  if (argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v")) {
@@ -1405,7 +1016,7 @@ function parseSize(text, bareUnit = 1) {
1405
1016
  return Math.round(Number(match[1]) * (suffix === "" ? bareUnit : 1024 ** POWERS[suffix]));
1406
1017
  }
1407
1018
  // ../kit/src/watch.ts
1408
- import process13 from "process";
1019
+ import process10 from "process";
1409
1020
  import { format } from "util";
1410
1021
  var CLEAR_SCREEN = "\x1B[H\x1B[2J";
1411
1022
  var DEFAULT_SECONDS = 2;
@@ -1427,7 +1038,7 @@ function withoutWatch(args) {
1427
1038
  }
1428
1039
  return rest;
1429
1040
  }
1430
- async function watching(value, step, stream = process13.stdout, sleep = Bun.sleep, rounds = Number.POSITIVE_INFINITY) {
1041
+ async function watching(value, step, stream = process10.stdout, sleep = Bun.sleep, rounds = Number.POSITIVE_INFINITY) {
1431
1042
  const interval = value === "" ? DEFAULT_SECONDS * 1000 : duration(value, "watch", DEFAULT_SECONDS * 1000);
1432
1043
  if (!takesControlCodes(stream))
1433
1044
  badUsage("--watch redraws the screen, so it needs a terminal");
@@ -1435,12 +1046,12 @@ async function watching(value, step, stream = process13.stdout, sleep = Bun.slee
1435
1046
  for (let round = 0;round < rounds; round++) {
1436
1047
  const held = [];
1437
1048
  const { log, info } = console;
1438
- const write = process13.stdout.write.bind(process13.stdout);
1049
+ const write = process10.stdout.write.bind(process10.stdout);
1439
1050
  const hold = (...parts) => void held.push(`${format(...parts)}
1440
1051
  `);
1441
1052
  console.log = hold;
1442
1053
  console.info = hold;
1443
- process13.stdout.write = (text) => {
1054
+ process10.stdout.write = (text) => {
1444
1055
  held.push(typeof text === "string" ? text : Buffer.from(text).toString());
1445
1056
  return true;
1446
1057
  };
@@ -1449,7 +1060,7 @@ async function watching(value, step, stream = process13.stdout, sleep = Bun.slee
1449
1060
  } finally {
1450
1061
  console.log = log;
1451
1062
  console.info = info;
1452
- process13.stdout.write = write;
1063
+ process10.stdout.write = write;
1453
1064
  }
1454
1065
  stream.write(`${CLEAR_SCREEN}${held.join("")}`);
1455
1066
  await sleep(interval);
@@ -1457,9 +1068,9 @@ async function watching(value, step, stream = process13.stdout, sleep = Bun.slee
1457
1068
  return code;
1458
1069
  }
1459
1070
  // src/procs.ts
1460
- import { existsSync as existsSync3 } from "fs";
1461
- import { homedir as homedir4 } from "os";
1462
- import process15 from "process";
1071
+ import { existsSync } from "fs";
1072
+ import { homedir as homedir2 } from "os";
1073
+ import process12 from "process";
1463
1074
 
1464
1075
  // src/read.ts
1465
1076
  import { readdir, readFile, readlink } from "fs/promises";
@@ -1837,7 +1448,7 @@ function maskArgs(args) {
1837
1448
  }
1838
1449
 
1839
1450
  // src/select.ts
1840
- import { basename as basename2, join as join6, relative } from "path";
1451
+ import { basename as basename2, join as join3, relative } from "path";
1841
1452
  var BROWSERS = /^(?:chrom(?:e|ium)(?:-browser)?|google-chrome(?:-stable|-beta|-unstable)?|chrome_crashpad_handler|chrome-headless-shell|headless_shell|chromium-headless-shell|brave|brave-browser|msedge|microsoft-edge|webkitwebprocess|webkitnetworkprocess|webkitgpuprocess|minibrowser|webkitwebdriver|wpewebprocess|wpenetworkprocess|bun-webview.*)$/i;
1842
1453
  var NATIVE = new Set(["rust-analyzer", "gopls", "clangd", "lua-language-server", "pyright-langserver", "pylsp", "intelephense", "phpactor", "tsgo", "esbuild", "biome", "ruff", "phpunit", "pytest", "vitest", "jest"]);
1843
1454
  var RUNTIMES = new Set(["node", "bun", "bunx", "deno", "nodejs"]);
@@ -1874,9 +1485,9 @@ function projectOf(cwd, exists, home) {
1874
1485
  if (cwd === undefined || !cwd.startsWith(`${home}/`))
1875
1486
  return;
1876
1487
  const folders = [];
1877
- for (let dir = cwd;dir.startsWith(`${home}/`); dir = join6(dir, ".."))
1488
+ for (let dir = cwd;dir.startsWith(`${home}/`); dir = join3(dir, ".."))
1878
1489
  folders.push(dir);
1879
- return folders.find((dir) => exists(join6(dir, ".git"))) ?? folders.find((dir) => MARKERS.some((marker) => exists(join6(dir, marker))));
1490
+ return folders.find((dir) => exists(join3(dir, ".git"))) ?? folders.find((dir) => MARKERS.some((marker) => exists(join3(dir, marker))));
1880
1491
  }
1881
1492
  function isOrphan(proc, byPid) {
1882
1493
  if (proc.unit?.endsWith(".service") === true)
@@ -1983,11 +1594,11 @@ function summary(group) {
1983
1594
  };
1984
1595
  }
1985
1596
  function render(groups) {
1986
- const colors = paint(process15.stdout);
1597
+ const colors = paint(process12.stdout);
1987
1598
  const rows = groups.map((group) => [
1988
1599
  group.origin,
1989
1600
  String(group.members.length),
1990
- $e(group.rss),
1601
+ tt2(group.rss),
1991
1602
  formatSeconds(group.oldestMs / 1000),
1992
1603
  colors.dim(truncate(Object.entries(Object.groupBy(group.members, ({ tool }) => tool)).map(([tool, list]) => `${tool}${list.length > 1 ? ` x${list.length}` : ""}`).join(", "), 50)),
1993
1604
  group.orphans === 0 ? "" : colors.yellow(`${group.orphans} orphaned`)
@@ -2010,23 +1621,22 @@ async function procs(args) {
2010
1621
  if (values.watch !== undefined)
2011
1622
  return watching(values.watch, async () => procs(withoutWatch(args)));
2012
1623
  const olderMs = values.older === undefined ? undefined : duration(values.older, "older", 0, "m");
2013
- const uid = process15.getuid?.() ?? -1;
1624
+ const uid = process12.getuid?.() ?? -1;
2014
1625
  const all = await snapshot("/proc", (owner) => owner === uid);
2015
- const mine = new Set(ancestry(process15.pid, new Map(all.map((proc) => [proc.pid, proc]))));
2016
- const { groups, protectedCount } = selectGroups(all, { guard: { uid, mine }, now: Date.now(), home: homedir4(), exists: existsSync3, minMem, olderMs });
1626
+ const mine = new Set(ancestry(process12.pid, new Map(all.map((proc) => [proc.pid, proc]))));
1627
+ const { groups, protectedCount } = selectGroups(all, { guard: { uid, mine }, now: Date.now(), home: homedir2(), exists: existsSync, minMem, olderMs });
2017
1628
  const pids = groups.flatMap((group) => group.members.map(({ proc }) => proc.pid));
2018
1629
  const show = (extra = {}) => {
2019
1630
  if (values.json === true) {
2020
1631
  printJson({ groups: groups.map(summary), skipped: protectedCount, ...extra });
2021
1632
  } else {
2022
- printHeader("procs");
2023
1633
  console.log(groups.length === 0 ? "nothing to clean" : render(groups));
2024
1634
  }
2025
1635
  };
2026
1636
  if (values.kill !== true || pids.length === 0 || values.yes !== true) {
2027
1637
  show();
2028
1638
  if (values.json !== true && protectedCount > 0)
2029
- console.error(paint(process15.stderr).dim(`${protectedCount} more left out: shells, terminals and this command's ancestors are never touched`));
1639
+ console.error(paint(process12.stderr).dim(`${protectedCount} more left out: shells, terminals and this command's ancestors are never touched`));
2030
1640
  if (values.kill === true && pids.length > 0)
2031
1641
  console.error(`dry run: would stop ${pids.length} ${pids.length === 1 ? "process" : "processes"} (${pids.join(" ")}), pass --yes to do it`);
2032
1642
  return 0;
@@ -2041,4 +1651,4 @@ async function procs(args) {
2041
1651
  }
2042
1652
 
2043
1653
  // src/procs-cli.ts
2044
- process16.exitCode = await runMain({ name: "procs", run: procs });
1654
+ process13.exitCode = await runMain({ name: "procs", run: procs });