@kaynooo/cli-workspace 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
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/cli.ts
@@ -19,6 +19,38 @@ import { parseArgs } from "util";
19
19
  // ../kit/src/format.ts
20
20
  import process7 from "process";
21
21
 
22
+ // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-n6z2kk96.js
23
+ var r = new Map;
24
+ var i = new Map;
25
+ var l = new Map;
26
+ function a(e, t, o) {
27
+ return JSON.stringify([e ?? null, t ?? null, o]);
28
+ }
29
+ function y(e, t) {
30
+ let o = a(e, t), n = i.get(o);
31
+ if (!n)
32
+ n = new Intl.NumberFormat(e, t), i.set(o, n);
33
+ return n;
34
+ }
35
+
36
+ // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-rxztfxgv.js
37
+ var N = new Map;
38
+ var Nt = /\s+\S*$/;
39
+ var Y = /\s/;
40
+ function ko(t, e, r = "...") {
41
+ let { suffix: n = "...", includeSuffix: s = false, wordBoundary: o = false } = typeof r === "string" ? { suffix: r } : r;
42
+ if (t.length <= e)
43
+ return t;
44
+ let l = Math.max(0, e), c = t.substring(0, Math.max(0, s ? l - n.length : l));
45
+ if (o && !Y.test(t[c.length] ?? " "))
46
+ c = c.replace(Nt, "") || c;
47
+ if (o)
48
+ c = c.trimEnd();
49
+ return s ? (c + n).slice(0, l) : c + n;
50
+ }
51
+ 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));
52
+ var z = new Map;
53
+
22
54
  // ../kit/src/mode.ts
23
55
  import process2 from "process";
24
56
  var MODES = new Set(["terminal", "ci", "agent", "pipe"]);
@@ -43,269 +75,63 @@ function isInteractive(streams = process2) {
43
75
  // ../kit/src/style.ts
44
76
  import process6 from "process";
45
77
 
46
- // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-mtetydvc.js
47
- function x(s) {
48
- let r = s.startsWith("#") ? s.slice(1).toLowerCase() : s.toLowerCase();
49
- if (!/^[a-f0-9]+$/.test(r))
78
+ // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
79
+ var G2 = /^[a-f0-9]+$/i;
80
+ function b(r) {
81
+ let e = r.startsWith("#") ? r.slice(1) : r;
82
+ if (!G2.test(e))
50
83
  return [0, 0, 0];
51
- let t = r.length, n = (c) => Number.parseInt(c, 16);
52
- if (t === 3 || t === 4) {
53
- 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;
54
- return g !== undefined ? [c, u, h, g] : [c, u, h];
55
- }
56
- if (t !== 6 && t !== 8)
57
- throw Error(`Invalid hex color length: ${t}`);
58
- 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;
59
- if ([a, b, o].some(Number.isNaN) || y !== undefined && Number.isNaN(y))
60
- throw Error(`Invalid hex color value: ${s}`);
61
- return y !== undefined ? [a, b, o, y] : [a, b, o];
62
- }
63
- function A(s) {
64
- let [r, t, n, a] = s;
65
- if (a)
66
- return `#${(r << 24 | t << 16 | n << 8 | Math.round((a ?? 1) * 255)).toString(16).padStart(8, "0").toUpperCase()}`;
67
- return `#${(r << 16 | t << 8 | n).toString(16).padStart(6, "0").toUpperCase()}`;
68
- }
69
- function R(s, r, t) {
70
- s = (s % 360 + 360) % 360, t /= 100;
71
- let n = r * Math.min(t, 1 - t) / 100, a = (b) => {
72
- let o = (b + s / 30) % 12, y = t - n * Math.max(Math.min(o - 3, 9 - o, 1), -1);
73
- return Math.round(255 * y);
74
- };
75
- return [a(0), a(8), a(4)];
76
- }
77
- function k(s) {
78
- let [r, t, n] = s;
79
- r /= 255, t /= 255, n /= 255;
80
- let a = Math.max(r, t, n), b = Math.min(r, t, n), o = 0, y = 0, c = (a + b) / 2;
81
- if (a !== b) {
82
- let u = a - b;
83
- if (y = c > 0 && c < 1 ? u / (1 - Math.abs(2 * c - 1)) : 0, a === r)
84
- o = (t - n) / u + (t < n ? 6 : 0);
85
- else if (a === t)
86
- o = (n - r) / u + 2;
87
- else
88
- o = (r - t) / u + 4;
89
- o /= 6;
90
- }
91
- return [Math.round(o * 360), Math.round(y * 100), Math.round(c * 100)];
92
- }
93
- function H(s, r, t) {
94
- s = (s % 360 + 360) % 360, r /= 100, t /= 100;
95
- let n = (a) => {
96
- let b = (a + s / 60) % 6, o = t - t * r * Math.max(Math.min(b, 4 - b, 1), 0);
97
- return Math.round(255 * o);
98
- };
99
- return [n(5), n(3), n(1)];
100
- }
101
- function f(s) {
102
- let [r, t, n] = s;
103
- r /= 255, t /= 255, n /= 255;
104
- 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;
105
- if (o !== 0) {
106
- if (a === r)
107
- y = (t - n) / o + (t < n ? 6 : 0);
108
- else if (a === t)
109
- y = (n - r) / o + 2;
110
- else
111
- y = (r - t) / o + 4;
112
- y /= 6;
113
- }
114
- return [Math.round(y * 360), Math.round(c * 100), Math.round(u * 100)];
115
- }
116
- function O(s) {
117
- let r = s[0] / 255, t = s[1] / 255, n = s[2] / 255, a = 1 - Math.max(r, t, n);
118
- if (a === 1)
119
- return [0, 0, 0, 100];
120
- let b = (1 - r - a) / (1 - a), o = (1 - t - a) / (1 - a), y = (1 - n - a) / (1 - a);
121
- return [Math.round(b * 100), Math.round(o * 100), Math.round(y * 100), Math.round(a * 100)];
122
- }
123
- function v(s, r, t, n) {
124
- 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))];
125
- }
126
- var m = (s) => s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
127
- var p = (s) => s <= 0.0031308 ? 12.92 * s : 1.055 * s ** 0.4166666666666667 - 0.055;
128
- var i = (s, r) => Math.round(s * 10 ** r) / 10 ** r;
129
- function T(s) {
130
- 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);
131
- 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)];
132
- }
133
- function M(s, r, t) {
134
- 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)));
135
- return [u(o), u(y), u(c)];
136
- }
137
- function d(s) {
138
- let [r, t, n] = T(s), a = Math.sqrt(t * t + n * n), b = (Math.atan2(n, t) * 180 / Math.PI + 360) % 360;
139
- return [i(r, 4), i(a, 4), i(b, 2)];
140
- }
141
- function C(s, r, t) {
142
- let n = t * Math.PI / 180;
143
- return M(s, r * Math.cos(n), r * Math.sin(n));
144
- }
145
- function l(s) {
146
- let r = s / 255;
147
- return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
148
- }
149
-
150
- class e {
151
- r;
152
- g;
153
- b;
154
- a;
155
- constructor(s, r, t, n = 1) {
156
- this.r = s, this.g = r, this.b = t, this.a = n;
157
- }
158
- static from(s, r) {
159
- if (s === "hex") {
160
- let [t, n, a, b] = x(r);
161
- return new e(t, n, a, b);
162
- }
163
- if (s === "rgb") {
164
- if (Array.isArray(r)) {
165
- let [o, y, c, u] = r;
166
- return new e(o, y, c, u);
167
- }
168
- let { r: t, g: n, b: a, a: b } = r;
169
- return new e(t, n, a, b);
170
- }
171
- if (s === "hsl") {
172
- let t, n, a, b;
173
- if (Array.isArray(r))
174
- [t, n, a, b] = r;
175
- else
176
- ({ h: t, s: n, l: a, a: b } = r);
177
- let [o, y, c] = R(t, n, a);
178
- return new e(o, y, c, b);
179
- }
180
- if (s === "hsv") {
181
- let t, n, a, b;
182
- if (Array.isArray(r))
183
- [t, n, a, b] = r;
184
- else
185
- ({ h: t, s: n, v: a, a: b } = r);
186
- let [o, y, c] = H(t, n, a);
187
- return new e(o, y, c, b);
188
- }
189
- if (s === "cmyk") {
190
- let t, n, a, b, o;
191
- if (Array.isArray(r))
192
- [t, n, a, b, o] = r;
193
- else
194
- ({ c: t, m: n, y: a, k: b, a: o } = r);
195
- let [y, c, u] = v(t, n, a, b);
196
- return new e(y, c, u, o);
197
- }
198
- if (s === "oklch") {
199
- let t, n, a, b;
200
- if (Array.isArray(r))
201
- [t, n, a, b] = r;
202
- else
203
- ({ l: t, c: n, h: a, a: b } = r);
204
- let [o, y, c] = C(t, n, a);
205
- return new e(o, y, c, b);
206
- }
207
- if (s === "oklab") {
208
- let t, n, a, b;
209
- if (Array.isArray(r))
210
- [t, n, a, b] = r;
211
- else
212
- ({ l: t, a: n, b: a, alpha: b } = r);
213
- let [o, y, c] = M(t, n, a);
214
- return new e(o, y, c, b);
215
- }
216
- throw Error("Invalid input");
217
- }
218
- to(s) {
219
- switch (s) {
220
- case "rgb":
221
- return [this.r, this.g, this.b];
222
- case "rgba":
223
- return [this.r, this.g, this.b, this.a];
224
- case "hex":
225
- return A([this.r, this.g, this.b]);
226
- case "hexa":
227
- return A([this.r, this.g, this.b, this.a]);
228
- case "hsl":
229
- return k([this.r, this.g, this.b]);
230
- case "hsla":
231
- return [...k([this.r, this.g, this.b]), this.a];
232
- case "hsv":
233
- return f([this.r, this.g, this.b]);
234
- case "hsva":
235
- return [...f([this.r, this.g, this.b]), this.a];
236
- case "cmyk":
237
- return O([this.r, this.g, this.b]);
238
- case "cmyka":
239
- return [...O([this.r, this.g, this.b]), this.a];
240
- case "oklch":
241
- return d([this.r, this.g, this.b]);
242
- case "oklcha":
243
- return [...d([this.r, this.g, this.b]), this.a];
244
- case "oklab":
245
- return T([this.r, this.g, this.b]);
246
- case "oklaba":
247
- return [...T([this.r, this.g, this.b]), this.a];
248
- default:
249
- return [this.r, this.g, this.b];
250
- }
251
- }
252
- getLuminance() {
253
- let s = l(this.r), r = l(this.g), t = l(this.b);
254
- return 0.2126 * s + 0.7152 * r + 0.0722 * t;
255
- }
256
- contrastRatio(s) {
257
- let r = this.getLuminance(), t = s.getLuminance(), [n, a] = r >= t ? [r, t] : [t, r];
258
- return (n + 0.05) / (a + 0.05);
259
- }
260
- bestContrastForeground() {
261
- let s = new e(255, 255, 255, 1), r = new e(0, 0, 0, 1), t = this.contrastRatio(s), n = this.contrastRatio(r);
262
- return t >= n ? s : r;
263
- }
264
- }
265
-
266
- // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-y1msbssb.js
267
- var r = 39;
268
- var o = 49;
269
- var f2 = "\x1B[";
270
- 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") => {
271
- let [a, l, s] = e.from("hex", i).to("rgb");
272
- return [`${n === "fg" ? 38 : 48};2;${a};${l};${s}`, n === "fg" ? r : o];
273
- }, ansi256: (i, n = "fg") => [`${n === "fg" ? 38 : 48};5;${i}`, n === "fg" ? r : o] };
274
- var b = new Set(["", "1", "2", "3", "true"]);
275
- function h(i, n = globalThis.process?.env ?? {}) {
276
- if (n.FORCE_COLOR !== undefined)
277
- return b.has(n.FORCE_COLOR);
278
- if (n.NO_COLOR !== undefined || n.NODE_DISABLE_COLORS !== undefined || n.TERM === "dumb")
84
+ if (e.length === 3 || e.length === 4)
85
+ return [Number.parseInt(e[0] + e[0], 16), Number.parseInt(e[1] + e[1], 16), Number.parseInt(e[2] + e[2], 16)];
86
+ if (e.length !== 6 && e.length !== 8)
87
+ throw Error(`Invalid hex color length: ${e.length}`);
88
+ return [Number.parseInt(e.slice(0, 2), 16), Number.parseInt(e.slice(2, 4), 16), Number.parseInt(e.slice(4, 6), 16)];
89
+ }
90
+ 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") => {
91
+ let [l, n, c] = b(r);
92
+ return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
93
+ }, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
94
+ var h = new Set(["", "1", "2", "3", "true"]);
95
+ function C(r, e = globalThis.process?.env ?? {}) {
96
+ if (e.FORCE_COLOR !== undefined)
97
+ return h.has(e.FORCE_COLOR);
98
+ if (e.NO_COLOR !== undefined || e.NODE_DISABLE_COLORS !== undefined || e.TERM === "dumb")
279
99
  return false;
280
- return i?.isTTY === true;
281
- }
282
- function d2(i, n, a) {
283
- if (!h(a.stream ?? globalThis.process?.stdout, a.env))
284
- return n;
285
- let l = "", s = "";
286
- for (let g = 0, y = i.length;g < y; g++) {
287
- let [c, p] = i[g];
288
- l += `${f2}${c}m`, s = `${f2}${p}m${s}`;
289
- }
290
- return l + n + s;
291
- }
292
- function u(i, n = []) {
293
- return new Proxy((l) => d2(n, l, i), { get(l, s) {
294
- let g = C2[s];
295
- if (Array.isArray(g))
296
- return u(i, [...n, g]);
297
- if (typeof g === "function")
298
- return (...y) => u(i, [...n, g(...y)]);
299
- throw Error(`Unknown style: ${String(s)}`);
100
+ return r?.isTTY === true;
101
+ }
102
+ function f(r, e = []) {
103
+ let l = "", n = "";
104
+ for (let t = 0, i = e.length;t < i; t++)
105
+ l += `\x1B[${e[t][0]}m`, n = `\x1B[${e[t][1]}m${n}`;
106
+ let c = (t) => C(r.stream ?? globalThis.process?.stdout, r.env) ? l + t + n : t, g = new Map;
107
+ return new Proxy(c, { get(t, i) {
108
+ let a = B2[i];
109
+ if (Array.isArray(a)) {
110
+ let s = g.get(i);
111
+ if (s === undefined)
112
+ s = f(r, [...e, a]), g.set(i, s);
113
+ return s;
114
+ }
115
+ if (typeof a === "function")
116
+ return (...s) => {
117
+ let y = `${i}:${s.join(",")}`, u = g.get(y);
118
+ if (u === undefined) {
119
+ if (g.size >= 64)
120
+ g.clear();
121
+ u = f(r, [...e, a(...s)]), g.set(y, u);
122
+ }
123
+ return u;
124
+ };
125
+ throw Error(`Unknown style: ${String(i)}`);
300
126
  } });
301
127
  }
302
- function le(i = {}) {
303
- return u(i);
128
+ function Fe(r = {}) {
129
+ return f(r);
304
130
  }
305
- var t = le();
131
+ var o = Fe();
306
132
 
307
133
  // ../kit/src/theme.ts
308
- import { existsSync as existsSync3, readFileSync, statSync } from "fs";
134
+ import { existsSync as existsSync3, readFileSync as readFileSync2, statSync } from "fs";
309
135
  import { homedir as homedir2 } from "os";
310
136
  import { join as join3, resolve as resolve2 } from "path";
311
137
  import process5 from "process";
@@ -326,7 +152,7 @@ function findUp(names, from = process3.cwd(), stop = () => false) {
326
152
  }
327
153
 
328
154
  // ../kit/src/user-config.ts
329
- import { existsSync as existsSync2 } from "fs";
155
+ import { existsSync as existsSync2, readFileSync } from "fs";
330
156
  import { homedir } from "os";
331
157
  import { join as join2 } from "path";
332
158
  import process4 from "process";
@@ -344,21 +170,38 @@ function userConfigReadPath(bin, legacy = [], where = {}) {
344
170
  const base = configBase(where);
345
171
  return legacy.map((parts) => join2(base, ...parts)).find((path) => existsSync2(path)) ?? current;
346
172
  }
173
+ function readUserConfig(bin, where = {}, legacy = []) {
174
+ const path = userConfigReadPath(bin, legacy, where);
175
+ if (!existsSync2(path))
176
+ return {};
177
+ try {
178
+ const parsed = Bun.JSONC.parse(readFileSync(path, "utf8"));
179
+ return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : {};
180
+ } catch {
181
+ return {};
182
+ }
183
+ }
184
+ function configuredNumber(bin, key, fallback, where = {}, legacy = []) {
185
+ const value = readUserConfig(bin, where, legacy)[key];
186
+ return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : fallback;
187
+ }
347
188
 
348
189
  // ../kit/src/theme.ts
190
+ var ENDS = new Map;
349
191
  var DEFAULT = {
350
- 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" },
351
- glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D" },
192
+ 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" },
193
+ 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" },
352
194
  accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
353
- bins: {}
195
+ bins: {},
196
+ gradient: ["#c084fc", "#67e8f9"]
354
197
  };
355
- 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" };
356
- 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" };
357
- var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+" };
198
+ 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" };
199
+ 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" };
200
+ var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", plan: "?", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
358
201
  var PRESETS = {
359
202
  default: {},
360
- "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
361
- mono: { colors: MONO, accents: ["bold"] },
203
+ "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
204
+ mono: { colors: MONO, accents: ["bold"], gradient: undefined },
362
205
  ascii: { glyphs: ASCII }
363
206
  };
364
207
  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"]);
@@ -408,7 +251,7 @@ function readThemeFile(path, warn) {
408
251
  warn(`${path} is not a regular file under ${MAX_FILE_BYTES / 1024} KiB, theme ignored`);
409
252
  return;
410
253
  }
411
- const parsed = JSON.parse(readFileSync(path, "utf8"));
254
+ const parsed = JSON.parse(readFileSync2(path, "utf8"));
412
255
  if (isRecord(parsed))
413
256
  return parsed;
414
257
  warn(`${path} is not a JSON object, theme ignored`);
@@ -429,6 +272,8 @@ function applyPreset(theme, name, warn, where) {
429
272
  Object.assign(theme.glyphs, preset.glyphs);
430
273
  if (preset.accents !== undefined)
431
274
  theme.accents = [...preset.accents];
275
+ if (Object.hasOwn(preset, "gradient"))
276
+ theme.gradient = preset.gradient;
432
277
  return name;
433
278
  }
434
279
  function applyFile(theme, file, where, warn) {
@@ -456,6 +301,12 @@ function applyFile(theme, file, where, warn) {
456
301
  theme.accents = [...file.accents];
457
302
  else if (file.accents !== undefined)
458
303
  warn(`${where}: accents must be a non-empty list of colours`);
304
+ if (file.gradient === null)
305
+ theme.gradient = undefined;
306
+ else if (Array.isArray(file.gradient) && file.gradient.length === 2 && file.gradient.every((end) => typeof end === "string" && HEX.test(end)))
307
+ theme.gradient = [file.gradient[0], file.gradient[1]];
308
+ else if (file.gradient !== undefined)
309
+ warn(`${where}: gradient must be two \`#rrggbb\` colours, or null for none`);
459
310
  if (isRecord(file.bins)) {
460
311
  for (const [bin, value] of Object.entries(file.bins)) {
461
312
  if (isColorSpec(value))
@@ -479,7 +330,7 @@ function isPath(chosen) {
479
330
  return chosen.includes("/") || chosen.endsWith(".json");
480
331
  }
481
332
  function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(), warn = warnOnce } = {}) {
482
- const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null) };
333
+ const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null), gradient: DEFAULT.gradient };
483
334
  const sources = [];
484
335
  const chosen = env.KIT_THEME ?? "";
485
336
  const wanted = chosen === "" ? [userConfigPath("theme", { home, xdg: env.XDG_CONFIG_HOME }), findUp(join3(".kaynooo", "theme.json"), from, endsWalk(home))] : [];
@@ -517,12 +368,12 @@ function activeTheme() {
517
368
  }
518
369
 
519
370
  // ../kit/src/style.ts
520
- var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:" };
371
+ var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:", plan: "would:" };
521
372
  function takesControlCodes(stream, env = process6.env) {
522
373
  return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
523
374
  }
524
375
  function paint(stream, env = process6.env) {
525
- return le({ stream: { isTTY: takesControlCodes(stream, env) }, env });
376
+ return Fe({ stream: { isTTY: takesControlCodes(stream, env) }, env });
526
377
  }
527
378
  function marked(mark, text, stream, detail, env = process6.env) {
528
379
  const colors = paint(stream, env);
@@ -569,16 +420,16 @@ function printHeader(bin, context, stream = process6.stdout, env = process6.env)
569
420
  if (line !== "")
570
421
  console.log(line);
571
422
  }
572
- // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-hrsswv1w.js
573
- function $e(t, e = false, i = 1) {
574
- let n = typeof e === "object" ? e : { units: e ? "si" : "iec", dp: i }, { units: s = "iec", dp: u = 1 } = n, r = s === "si" ? 1000 : 1024;
575
- if (Math.abs(t) < r)
576
- return `${t} B`;
577
- 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;
423
+ // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-knqbxp56.js
424
+ function tt(i, { units: r = "iec", dp: t = 1, locale: n } = {}) {
425
+ let e = r === "si" ? 1000 : 1024;
426
+ if (Math.abs(i) < e)
427
+ return `${i} B`;
428
+ 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;
578
429
  do
579
- t /= r, ++o;
580
- while (Math.round(Math.abs(t) * l) / l >= r && o < c.length - 1);
581
- return `${t.toFixed(u)} ${c[o]}`;
430
+ i /= e, ++o;
431
+ while (Math.round(Math.abs(i) * a) / a >= e && o < s.length - 1);
432
+ return `${n ? y(n, { minimumFractionDigits: t, maximumFractionDigits: t }).format(i) : i.toFixed(t)} ${s[o]}`;
582
433
  }
583
434
 
584
435
  // ../kit/src/format.ts
@@ -611,7 +462,7 @@ function formatAge(date, now = Date.now()) {
611
462
  return seconds < 60 ? "just now" : `${upTo(formatSeconds(seconds), " ")} ago`;
612
463
  }
613
464
  function truncate(text, width) {
614
- return text.length <= width ? text : `${text.slice(0, Math.max(0, width - 1))}\u2026`;
465
+ return ko(text, width, { suffix: "\u2026", includeSuffix: true });
615
466
  }
616
467
  var LINE_BREAKS = /\s*\n\s*/g;
617
468
  var ESCAPE = String.fromCharCode(27);
@@ -1107,7 +958,7 @@ async function runTool(label, argv, { timeoutMs, cwd, onStart } = {}) {
1107
958
  return { code: ran.code, ...streams };
1108
959
  }
1109
960
  // ../kit/src/cli.ts
1110
- import { readFileSync as readFileSync2, realpathSync } from "fs";
961
+ import { readFileSync as readFileSync3, realpathSync } from "fs";
1111
962
  import { dirname as dirname3, join as join5 } from "path";
1112
963
  import process13 from "process";
1113
964
 
@@ -1408,7 +1259,7 @@ async function printCandidates(found) {
1408
1259
  function packageVersion(entry = Bun.main) {
1409
1260
  for (let dir = dirname3(realpathSync(entry));; dir = dirname3(dir)) {
1410
1261
  try {
1411
- const { version } = JSON.parse(readFileSync2(join5(dir, "package.json"), "utf8"));
1262
+ const { version } = JSON.parse(readFileSync3(join5(dir, "package.json"), "utf8"));
1412
1263
  if (typeof version === "string")
1413
1264
  return version;
1414
1265
  } catch {}
@@ -1547,7 +1398,6 @@ async function watching(value, step, stream = process14.stdout, sleep = Bun.slee
1547
1398
  return code;
1548
1399
  }
1549
1400
  // ../kit/src/workspace-root.ts
1550
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync } from "fs";
1551
1401
  import { homedir as homedir4 } from "os";
1552
1402
  import { dirname as dirname4, join as join6, resolve as resolve3 } from "path";
1553
1403
  import process15 from "process";
@@ -1557,29 +1407,21 @@ function expandHome(path, home) {
1557
1407
  return path.startsWith("~/") ? join6(home, path.slice(2)) : path;
1558
1408
  }
1559
1409
  function configured(env, home) {
1560
- const path = userConfigPath("config", { home, xdg: env.XDG_CONFIG_HOME });
1561
- if (!existsSync4(path))
1562
- return;
1563
- try {
1564
- const parsed = JSON.parse(readFileSync3(path, "utf8"));
1565
- const folder = typeof parsed === "object" && parsed !== null ? parsed.workspace : undefined;
1566
- return typeof folder === "string" && folder !== "" ? folder : undefined;
1567
- } catch {
1568
- return;
1569
- }
1410
+ const folder = readUserConfig("config", { home, xdg: env.XDG_CONFIG_HOME }).workspace;
1411
+ return typeof folder === "string" && folder !== "" ? folder : undefined;
1570
1412
  }
1571
1413
  function workspaceRoot({ given, env = process15.env, home = homedir4() } = {}) {
1572
1414
  const fromEnv = env.KAYNOOO_WORKSPACE === "" ? undefined : env.KAYNOOO_WORKSPACE;
1573
1415
  return resolve3(expandHome(given ?? fromEnv ?? configured(env, home) ?? join6(home, "Workspace"), home));
1574
1416
  }
1575
1417
  // src/audit.ts
1576
- import { existsSync as existsSync6, readdirSync, readFileSync as readFileSync5, statSync as statSync2 } from "fs";
1418
+ import { existsSync as existsSync5, readdirSync, readFileSync as readFileSync5, statSync as statSync2 } from "fs";
1577
1419
  import { readdir } from "fs/promises";
1578
1420
  import { join as join8, relative, resolve as resolve4 } from "path";
1579
1421
  import process17 from "process";
1580
1422
 
1581
1423
  // src/report.ts
1582
- import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
1424
+ import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
1583
1425
  import { join as join7 } from "path";
1584
1426
  var UPPER_BOUND = /<\s*(\d[\w.+-]*)/;
1585
1427
  var DEPENDENCY_KINDS = ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"];
@@ -1663,7 +1505,7 @@ function reachedFrom(graph, direct, targets) {
1663
1505
  }
1664
1506
  function readManifest(path) {
1665
1507
  try {
1666
- return existsSync5(path) ? JSON.parse(readFileSync4(path, "utf8")) : {};
1508
+ return existsSync4(path) ? JSON.parse(readFileSync4(path, "utf8")) : {};
1667
1509
  } catch {
1668
1510
  return {};
1669
1511
  }
@@ -1716,7 +1558,7 @@ function countAdvisories(findings) {
1716
1558
  return findings.reduce((sum, found) => sum + found.advisories.length, 0);
1717
1559
  }
1718
1560
  function holdsLock(dir) {
1719
- return existsSync6(join8(dir, "bun.lock")) || existsSync6(join8(dir, "bun.lockb"));
1561
+ return existsSync5(join8(dir, "bun.lock")) || existsSync5(join8(dir, "bun.lockb"));
1720
1562
  }
1721
1563
  async function findRepos(root) {
1722
1564
  if (holdsLock(root))
@@ -1806,13 +1648,13 @@ function rows(findings) {
1806
1648
  async function audit(args) {
1807
1649
  const { values, positionals } = parse(args, USAGE, OPTIONS, { positionals: ["[root]"], exits: EXITS, replaces: "a bun audit run in each repository and a read of every advisory to find what is worth fixing", examples: ["audit", "audit ~/Workspace --level high --prod"] });
1808
1650
  const root = resolve4(positionals[0] ?? ".");
1809
- if (!existsSync6(root) || !statSync2(root).isDirectory())
1651
+ if (!existsSync5(root) || !statSync2(root).isDirectory())
1810
1652
  fail(`no folder ${root}`);
1811
1653
  const level = oneOf(values.level, "level", SEVERITIES);
1812
1654
  const paths = await findRepos(root);
1813
1655
  if (paths.length === 0)
1814
1656
  fail(`no bun.lock under ${root}`);
1815
- const audits = await pool(paths, CONCURRENCY, async (path) => audited(path, relative(root, path) || ".", level, values.ignore ?? []));
1657
+ const audits = await pool(paths, configuredNumber("audit", "concurrency", CONCURRENCY), async (path) => audited(path, relative(root, path) || ".", level, values.ignore ?? []));
1816
1658
  const kept = audits.map((each) => ({ ...each, findings: values.prod === true ? each.findings.filter((found) => found.scope === "prod") : each.findings }));
1817
1659
  if (values.json === true)
1818
1660
  printJson(kept);
@@ -1844,12 +1686,12 @@ function show(audits, total) {
1844
1686
  }
1845
1687
 
1846
1688
  // src/repos.ts
1847
- import { existsSync as existsSync8, statSync as statSync3 } from "fs";
1689
+ import { existsSync as existsSync7, statSync as statSync3 } from "fs";
1848
1690
  import { basename as basename2, relative as relative2 } from "path";
1849
1691
  import process19 from "process";
1850
1692
 
1851
1693
  // src/repos-scan.ts
1852
- import { existsSync as existsSync7 } from "fs";
1694
+ import { existsSync as existsSync6 } from "fs";
1853
1695
  import { readdir as readdir2 } from "fs/promises";
1854
1696
  import { basename, join as join9 } from "path";
1855
1697
  import process18 from "process";
@@ -1874,7 +1716,7 @@ function reasonsOf(repo) {
1874
1716
  return reasons;
1875
1717
  }
1876
1718
  async function findRepos2(root, skip) {
1877
- if (existsSync7(join9(root, ".git")))
1719
+ if (existsSync6(join9(root, ".git")))
1878
1720
  return [root];
1879
1721
  const found = [];
1880
1722
  async function walk(dir, depth) {
@@ -1888,7 +1730,7 @@ async function findRepos2(root, skip) {
1888
1730
  if (!entry.isDirectory() || entry.name === "node_modules" || entry.name.startsWith(".") || skip.has(entry.name))
1889
1731
  continue;
1890
1732
  const path = join9(dir, entry.name);
1891
- if (existsSync7(join9(path, ".git")))
1733
+ if (existsSync6(join9(path, ".git")))
1892
1734
  found.push(path);
1893
1735
  else if (depth < MAX_DEPTH2)
1894
1736
  await walk(path, depth + 1);
@@ -1918,7 +1760,7 @@ async function packageReleases(path) {
1918
1760
  names.add(name);
1919
1761
  }
1920
1762
  const releases = await pool([...names].toSorted(), PACKAGE_CONCURRENCY, async (name) => {
1921
- const folder = [join9("packages", name), name].find((candidate) => existsSync7(join9(path, candidate)));
1763
+ const folder = [join9("packages", name), name].find((candidate) => existsSync6(join9(path, candidate)));
1922
1764
  const tag = folder === undefined ? undefined : await read(path, ["describe", "--tags", "--abbrev=0", "--match", `${name}-v*`]);
1923
1765
  return folder !== undefined && tag !== undefined && tag !== "" ? { name, tag, unreleased: await commitsSince(path, tag, folder) } : undefined;
1924
1766
  });
@@ -2005,7 +1847,7 @@ var OPTIONS2 = {
2005
1847
  };
2006
1848
  async function skipped() {
2007
1849
  const file = userConfigReadPath("repos");
2008
- if (!existsSync8(file))
1850
+ if (!existsSync7(file))
2009
1851
  return new Set;
2010
1852
  try {
2011
1853
  const config = await Bun.file(file).json();
@@ -2056,11 +1898,11 @@ async function repos(args) {
2056
1898
  if (values.watch !== undefined)
2057
1899
  return watching(values.watch, async () => repos(withoutWatch(args)));
2058
1900
  const root = workspaceRoot({ given: positionals[0] });
2059
- if (!existsSync8(root) || !statSync3(root).isDirectory())
1901
+ if (!existsSync7(root) || !statSync3(root).isDirectory())
2060
1902
  fail(`no folder ${root}`);
2061
1903
  const only = values.only === undefined ? undefined : oneOf(values.only, "only", REASONS);
2062
1904
  const paths = await findRepos2(root, await skipped());
2063
- const states = await pool(paths, CONCURRENCY2, async (path) => inspect(path, values.fetch === true || values.pull === true));
1905
+ const states = await pool(paths, configuredNumber("repos", "concurrency", CONCURRENCY2), async (path) => inspect(path, values.fetch === true || values.pull === true));
2064
1906
  const keeps = (repo) => {
2065
1907
  const reasons = reasonsOf(repo);
2066
1908
  return only === undefined ? values.all === true || reasons.length > 0 || repo.unreadable : reasons.includes(only);
@@ -2110,7 +1952,7 @@ async function repos(args) {
2110
1952
  }
2111
1953
 
2112
1954
  // src/sweep.ts
2113
- import { existsSync as existsSync11, statSync as statSync4 } from "fs";
1955
+ import { existsSync as existsSync10, statSync as statSync4 } from "fs";
2114
1956
  import { homedir as homedir6 } from "os";
2115
1957
  import { relative as relative3 } from "path";
2116
1958
 
@@ -2125,7 +1967,9 @@ var NONE = Number.NEGATIVE_INFINITY;
2125
1967
  var IS_CONTROL = /[\x00-\x1F\x7F-\x9F]/;
2126
1968
  var PASTE_START = "\x1B[200~";
2127
1969
  var PASTE_END = "\x1B[201~";
2128
- var KEY_SEQUENCES = /\x1B\[[0-9;]*[A-Z~]|\x1BO[A-Z]|\x1B[\s\S]|[\s\S]/gu;
1970
+ var KEY_SEQUENCES = /\x1B\[<[0-9;]*[A-Za-z]|\x1B\[[0-9;]*[A-Z~]|\x1BO[A-Z]|\x1B[\s\S]|[\s\S]/gu;
1971
+ var MOUSE = /^\x1B\[<(\d+);\d+;\d+[a-z]$/i;
1972
+ var WHEEL_LINES = 3;
2129
1973
  var KEYS = {
2130
1974
  "\x1B[A": "up",
2131
1975
  "\x1BOA": "up",
@@ -2154,9 +1998,15 @@ var KEYS = {
2154
1998
  "\x1BOP": "help",
2155
1999
  "\x1B[11~": "help"
2156
2000
  };
2001
+ function repeat(value, count) {
2002
+ return Array.from({ length: count }).fill(value);
2003
+ }
2157
2004
  function parseKeys(input, paste = { active: false }, ctrls = []) {
2158
2005
  const codes = new Map(ctrls.map((name) => [String.fromCharCode(name.codePointAt(name.length - 1) - 96), name]));
2159
2006
  return (input.match(KEY_SEQUENCES) ?? []).flatMap((sequence) => {
2007
+ const wheel = MOUSE.exec(sequence)?.[1];
2008
+ if (wheel !== undefined)
2009
+ return repeat(wheel === "64" ? "up" : "down", wheel === "64" || wheel === "65" ? WHEEL_LINES : 0);
2160
2010
  const named = codes.get(sequence);
2161
2011
  const key = named === undefined ? KEYS[sequence] : { ctrl: named };
2162
2012
  if (sequence === PASTE_START || sequence === PASTE_END) {
@@ -2204,16 +2054,13 @@ async function ask(question, { hint, terminal = process20 }, render, press) {
2204
2054
  if (!isInteractive(terminal))
2205
2055
  fail(`cannot ask "${question}" off a terminal`, 2, hint);
2206
2056
  const colors = paint(stderr);
2207
- let drawn = [];
2208
2057
  let current = "asking";
2209
2058
  let outcome;
2210
2059
  const columns = () => stderr.columns || 80;
2211
- const draw = (state) => {
2060
+ const draw = (state, last = false) => {
2212
2061
  const frame = render(colors, state, { columns: columns(), rows: stderr.rows || 24 });
2213
- const rows = drawn.reduce((sum, line) => sum + Math.max(1, Math.ceil(Bun.stringWidth(line) / columns())), 0);
2214
- stderr.write(`${rows > 1 ? `\x1B[${rows - 1}A` : ""}\r\x1B[0J${frame.join(`
2215
- `)}`);
2216
- drawn = frame;
2062
+ stderr.write(`\r\x1B[0J${frame.join(`
2063
+ `)}${last || frame.length < 2 ? "" : `\x1B[${frame.length - 1}A`}${last ? "" : "\r"}`);
2217
2064
  current = state;
2218
2065
  };
2219
2066
  const redraw = () => draw(current);
@@ -2249,7 +2096,7 @@ async function ask(question, { hint, terminal = process20 }, render, press) {
2249
2096
  });
2250
2097
  } finally {
2251
2098
  stderr.off?.("resize", redraw);
2252
- draw(outcome ?? "cancel");
2099
+ draw(outcome ?? "cancel", true);
2253
2100
  stderr.write(`
2254
2101
  \x1B[?25h\x1B[?2004l`);
2255
2102
  stdin.setRawMode(false);
@@ -2258,12 +2105,12 @@ async function ask(question, { hint, terminal = process20 }, render, press) {
2258
2105
  }
2259
2106
 
2260
2107
  // src/apply.ts
2261
- import { existsSync as existsSync10 } from "fs";
2108
+ import { existsSync as existsSync9 } from "fs";
2262
2109
  import { lstat as lstat3, rm } from "fs/promises";
2263
2110
  import { basename as basename4, join as join12 } from "path";
2264
2111
 
2265
2112
  // src/sweep-scan.ts
2266
- import { existsSync as existsSync9 } from "fs";
2113
+ import { existsSync as existsSync8 } from "fs";
2267
2114
  import { lstat as lstat2, readdir as readdir4, realpath } from "fs/promises";
2268
2115
  import { homedir as homedir5 } from "os";
2269
2116
  import { basename as basename3, dirname as dirname5, join as join11 } from "path";
@@ -2389,7 +2236,7 @@ async function findCandidates(root, home = homedir5(), withGlobal = true) {
2389
2236
  }
2390
2237
  continue;
2391
2238
  }
2392
- if (FOLDER_NAMES.has(entry.name) && (entry.name !== "target" || existsSync9(join11(dir, "Cargo.toml")))) {
2239
+ if (FOLDER_NAMES.has(entry.name) && (entry.name !== "target" || existsSync8(join11(dir, "Cargo.toml")))) {
2393
2240
  if (entry.isSymbolicLink()) {
2394
2241
  found.skipped.push({ path, reason: "symlink" });
2395
2242
  } else if (entry.isDirectory()) {
@@ -2475,7 +2322,7 @@ async function judgeFolder(path, kind, inside) {
2475
2322
  const located = await toplevelOf(parent);
2476
2323
  if (located === "failed")
2477
2324
  return { skip: "git failed" };
2478
- if (existsSync9(join11(path, ".git")))
2325
+ if (existsSync8(join11(path, ".git")))
2479
2326
  return { skip: "holds a git repository" };
2480
2327
  if (located === "none")
2481
2328
  return name === "node_modules" || inside !== undefined ? { entry: { path, kind, committedAt: undefined, action: "remove", inside } } : { skip: "not in a git repository" };
@@ -2543,7 +2390,7 @@ async function removeFolder(entry) {
2543
2390
  const stat = await lstat3(entry.path);
2544
2391
  if (stat.isSymbolicLink() || !stat.isDirectory() || !(FOLDER_NAMES.has(basename4(entry.path)) || entry.kind === "cache" && isCachePath(entry.path)))
2545
2392
  return { path: entry.path, removed: false, error: "no longer a plain folder" };
2546
- if (existsSync10(join12(entry.path, ".git")))
2393
+ if (existsSync9(join12(entry.path, ".git")))
2547
2394
  return { path: entry.path, removed: false, error: "holds a git repository" };
2548
2395
  await rm(entry.path, { recursive: true, force: true });
2549
2396
  return { path: entry.path, removed: true };
@@ -2606,7 +2453,7 @@ async function sweep(args) {
2606
2453
  if (positionals.length > 1)
2607
2454
  badUsage("give one root");
2608
2455
  const root = workspaceRoot({ given: positionals[0] });
2609
- if (!existsSync11(root) || !statSync4(root).isDirectory())
2456
+ if (!existsSync10(root) || !statSync4(root).isDirectory())
2610
2457
  fail(`${root} is not a folder`);
2611
2458
  if (values.only !== undefined && !Object.hasOwn(ONLY_KINDS, values.only))
2612
2459
  badUsage(`--only takes worktrees, folders or caches, not ${values.only}`);
@@ -2626,7 +2473,7 @@ async function sweep(args) {
2626
2473
  if (values.apply === true && removable.length > 0 && values.yes !== true) {
2627
2474
  if (!json)
2628
2475
  print(root, entries, skipped.length, reclaimable, now);
2629
- const agreed = await confirm(`Delete ${removable.length} ${removable.length === 1 ? "entry" : "entries"} (${$e(reclaimable)})?`, { default: false, hint: "pass --yes to skip the confirm" });
2476
+ const agreed = await confirm(`Delete ${removable.length} ${removable.length === 1 ? "entry" : "entries"} (${tt(reclaimable)})?`, { default: false, hint: "pass --yes to skip the confirm" });
2630
2477
  if (agreed !== true) {
2631
2478
  if (json)
2632
2479
  fail("nothing deleted: the confirm was declined", 1, "pass --yes to skip the confirm");
@@ -2634,7 +2481,7 @@ async function sweep(args) {
2634
2481
  return 1;
2635
2482
  }
2636
2483
  }
2637
- const outcomes = values.apply === true ? await applyAll(removable, (outcome) => report(root, outcome, json)) : undefined;
2484
+ const outcomes = values.apply === true ? await applyAll(removable, (outcome) => report2(root, outcome, json)) : undefined;
2638
2485
  const failed = outcomes?.filter((outcome) => !outcome.removed).length ?? 0;
2639
2486
  if (json) {
2640
2487
  printJson({ root, entries: entries.map((entry) => ({ path: entry.path, kind: entry.kind, bytes: entry.bytes, committedAt: entry.committedAt === undefined ? null : new Date(entry.committedAt).toISOString(), action: entry.action, reason: entry.reason ?? null })), skipped, reclaimable, docker: docker ?? null, ...outcomes === undefined ? {} : { removed: outcomes } });
@@ -2646,7 +2493,7 @@ async function sweep(args) {
2646
2493
  console.log("dry run, pass --apply to delete");
2647
2494
  } else {
2648
2495
  const bytes = new Map(removable.map((entry) => [entry.path, entry.bytes]));
2649
- note(`freed ${$e(outcomes.reduce((sum, outcome) => sum + (outcome.removed ? bytes.get(outcome.path) ?? 0 : 0), 0))}`);
2496
+ note(`freed ${tt(outcomes.reduce((sum, outcome) => sum + (outcome.removed ? bytes.get(outcome.path) ?? 0 : 0), 0))}`);
2650
2497
  }
2651
2498
  if (docker !== undefined)
2652
2499
  console.log(`
@@ -2654,7 +2501,7 @@ docker (left to dclean):
2654
2501
  ${docker}`);
2655
2502
  return failed === 0 ? 0 : 1;
2656
2503
  }
2657
- function report(root, outcome, json) {
2504
+ function report2(root, outcome, json) {
2658
2505
  if (json)
2659
2506
  return;
2660
2507
  if (outcome.removed)
@@ -2671,12 +2518,12 @@ function print(root, entries, skipped, reclaimable, now) {
2671
2518
  const path = role("path", process.stdout);
2672
2519
  const sized = (bytes) => {
2673
2520
  if (bytes >= BIG)
2674
- return colors.red($e(bytes));
2675
- return bytes >= LARGE ? colors.yellow($e(bytes)) : $e(bytes);
2521
+ return colors.red(tt(bytes));
2522
+ return bytes >= LARGE ? colors.yellow(tt(bytes)) : tt(bytes);
2676
2523
  };
2677
2524
  console.log(table([["size", "age", "what", "path", "note"], ...entries.map((entry) => [sized(entry.bytes), entry.committedAt === undefined ? colors.dim("-") : colors.dim(formatAge(entry.committedAt, now)), entry.kind, path(relative3(root, entry.path)), entry.action === "keep" ? colors.dim(`kept: ${entry.reason}`) : ""])], { header: true, align: ["right", "right", "left", "left", "left"] }));
2678
2525
  console.log(`
2679
- ${$e(reclaimable)} reclaimable${skipped === 0 ? "" : `, ${skipped} skipped (symlinks, tracked or not ignored by git)`}`);
2526
+ ${tt(reclaimable)} reclaimable${skipped === 0 ? "" : `, ${skipped} skipped (symlinks, tracked or not ignored by git)`}`);
2680
2527
  }
2681
2528
 
2682
2529
  // src/cli.ts