@kaynooo/cli-workspace 0.9.0 → 0.10.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/audit-cli.js +89 -269
- package/dist/cli.js +118 -284
- package/dist/repos-cli.js +89 -269
- package/dist/sweep-cli.js +118 -284
- package/package.json +2 -2
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,36 @@ 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
|
+
// ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-rxztfxgv.js
|
|
36
|
+
var N = new Map;
|
|
37
|
+
var Nt = /\s+\S*$/;
|
|
38
|
+
var Y = /\s/;
|
|
39
|
+
function ko(t, e, r = "...") {
|
|
40
|
+
let { suffix: n = "...", includeSuffix: s = false, wordBoundary: o = false } = typeof r === "string" ? { suffix: r } : r;
|
|
41
|
+
if (t.length <= e)
|
|
42
|
+
return t;
|
|
43
|
+
let l = Math.max(0, e), c = t.substring(0, Math.max(0, s ? l - n.length : l));
|
|
44
|
+
if (o && !Y.test(t[c.length] ?? " "))
|
|
45
|
+
c = c.replace(Nt, "") || c;
|
|
46
|
+
if (o)
|
|
47
|
+
c = c.trimEnd();
|
|
48
|
+
return s ? (c + n).slice(0, l) : c + n;
|
|
49
|
+
}
|
|
50
|
+
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));
|
|
51
|
+
var z = new Map;
|
|
22
52
|
// ../kit/src/mode.ts
|
|
23
53
|
import process2 from "process";
|
|
24
54
|
var MODES = new Set(["terminal", "ci", "agent", "pipe"]);
|
|
@@ -43,266 +73,60 @@ function isInteractive(streams = process2) {
|
|
|
43
73
|
// ../kit/src/style.ts
|
|
44
74
|
import process6 from "process";
|
|
45
75
|
|
|
46
|
-
// ../../node_modules/.bun/@kaynooo+utils@
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
76
|
+
// ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
|
|
77
|
+
var G2 = /^[a-f0-9]+$/i;
|
|
78
|
+
function b(r) {
|
|
79
|
+
let e = r.startsWith("#") ? r.slice(1) : r;
|
|
80
|
+
if (!G2.test(e))
|
|
50
81
|
return [0, 0, 0];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
let
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (
|
|
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")
|
|
82
|
+
if (e.length === 3 || e.length === 4)
|
|
83
|
+
return [Number.parseInt(e[0] + e[0], 16), Number.parseInt(e[1] + e[1], 16), Number.parseInt(e[2] + e[2], 16)];
|
|
84
|
+
if (e.length !== 6 && e.length !== 8)
|
|
85
|
+
throw Error(`Invalid hex color length: ${e.length}`);
|
|
86
|
+
return [Number.parseInt(e.slice(0, 2), 16), Number.parseInt(e.slice(2, 4), 16), Number.parseInt(e.slice(4, 6), 16)];
|
|
87
|
+
}
|
|
88
|
+
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") => {
|
|
89
|
+
let [l, n, c] = b(r);
|
|
90
|
+
return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
|
|
91
|
+
}, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
|
|
92
|
+
var h = new Set(["", "1", "2", "3", "true"]);
|
|
93
|
+
function C(r, e = globalThis.process?.env ?? {}) {
|
|
94
|
+
if (e.FORCE_COLOR !== undefined)
|
|
95
|
+
return h.has(e.FORCE_COLOR);
|
|
96
|
+
if (e.NO_COLOR !== undefined || e.NODE_DISABLE_COLORS !== undefined || e.TERM === "dumb")
|
|
279
97
|
return false;
|
|
280
|
-
return
|
|
281
|
-
}
|
|
282
|
-
function
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
if (
|
|
296
|
-
return
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
98
|
+
return r?.isTTY === true;
|
|
99
|
+
}
|
|
100
|
+
function f2(r, e = []) {
|
|
101
|
+
let l = "", n = "";
|
|
102
|
+
for (let t = 0, i = e.length;t < i; t++)
|
|
103
|
+
l += `\x1B[${e[t][0]}m`, n = `\x1B[${e[t][1]}m${n}`;
|
|
104
|
+
let c = (t) => C(r.stream ?? globalThis.process?.stdout, r.env) ? l + t + n : t, g = new Map;
|
|
105
|
+
return new Proxy(c, { get(t, i) {
|
|
106
|
+
let a = B2[i];
|
|
107
|
+
if (Array.isArray(a)) {
|
|
108
|
+
let s = g.get(i);
|
|
109
|
+
if (s === undefined)
|
|
110
|
+
s = f2(r, [...e, a]), g.set(i, s);
|
|
111
|
+
return s;
|
|
112
|
+
}
|
|
113
|
+
if (typeof a === "function")
|
|
114
|
+
return (...s) => {
|
|
115
|
+
let y = `${i}:${s.join(",")}`, u = g.get(y);
|
|
116
|
+
if (u === undefined) {
|
|
117
|
+
if (g.size >= 64)
|
|
118
|
+
g.clear();
|
|
119
|
+
u = f2(r, [...e, a(...s)]), g.set(y, u);
|
|
120
|
+
}
|
|
121
|
+
return u;
|
|
122
|
+
};
|
|
123
|
+
throw Error(`Unknown style: ${String(i)}`);
|
|
300
124
|
} });
|
|
301
125
|
}
|
|
302
|
-
function
|
|
303
|
-
return
|
|
126
|
+
function Fe2(r = {}) {
|
|
127
|
+
return f2(r);
|
|
304
128
|
}
|
|
305
|
-
var
|
|
129
|
+
var o2 = Fe2();
|
|
306
130
|
|
|
307
131
|
// ../kit/src/theme.ts
|
|
308
132
|
import { existsSync as existsSync3, readFileSync, statSync } from "fs";
|
|
@@ -346,19 +170,21 @@ function userConfigReadPath(bin, legacy = [], where = {}) {
|
|
|
346
170
|
}
|
|
347
171
|
|
|
348
172
|
// ../kit/src/theme.ts
|
|
173
|
+
var ENDS = new Map;
|
|
349
174
|
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" },
|
|
175
|
+
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" },
|
|
176
|
+
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
177
|
accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
|
|
353
|
-
bins: {}
|
|
178
|
+
bins: {},
|
|
179
|
+
gradient: ["#c084fc", "#67e8f9"]
|
|
354
180
|
};
|
|
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: "+" };
|
|
181
|
+
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" };
|
|
182
|
+
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" };
|
|
183
|
+
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", plan: "?", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
|
|
358
184
|
var PRESETS = {
|
|
359
185
|
default: {},
|
|
360
|
-
"high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
|
|
361
|
-
mono: { colors: MONO, accents: ["bold"] },
|
|
186
|
+
"high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
|
|
187
|
+
mono: { colors: MONO, accents: ["bold"], gradient: undefined },
|
|
362
188
|
ascii: { glyphs: ASCII }
|
|
363
189
|
};
|
|
364
190
|
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"]);
|
|
@@ -429,6 +255,8 @@ function applyPreset(theme, name, warn, where) {
|
|
|
429
255
|
Object.assign(theme.glyphs, preset.glyphs);
|
|
430
256
|
if (preset.accents !== undefined)
|
|
431
257
|
theme.accents = [...preset.accents];
|
|
258
|
+
if (Object.hasOwn(preset, "gradient"))
|
|
259
|
+
theme.gradient = preset.gradient;
|
|
432
260
|
return name;
|
|
433
261
|
}
|
|
434
262
|
function applyFile(theme, file, where, warn) {
|
|
@@ -456,6 +284,12 @@ function applyFile(theme, file, where, warn) {
|
|
|
456
284
|
theme.accents = [...file.accents];
|
|
457
285
|
else if (file.accents !== undefined)
|
|
458
286
|
warn(`${where}: accents must be a non-empty list of colours`);
|
|
287
|
+
if (file.gradient === null)
|
|
288
|
+
theme.gradient = undefined;
|
|
289
|
+
else if (Array.isArray(file.gradient) && file.gradient.length === 2 && file.gradient.every((end) => typeof end === "string" && HEX.test(end)))
|
|
290
|
+
theme.gradient = [file.gradient[0], file.gradient[1]];
|
|
291
|
+
else if (file.gradient !== undefined)
|
|
292
|
+
warn(`${where}: gradient must be two \`#rrggbb\` colours, or null for none`);
|
|
459
293
|
if (isRecord(file.bins)) {
|
|
460
294
|
for (const [bin, value] of Object.entries(file.bins)) {
|
|
461
295
|
if (isColorSpec(value))
|
|
@@ -479,7 +313,7 @@ function isPath(chosen) {
|
|
|
479
313
|
return chosen.includes("/") || chosen.endsWith(".json");
|
|
480
314
|
}
|
|
481
315
|
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) };
|
|
316
|
+
const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null), gradient: DEFAULT.gradient };
|
|
483
317
|
const sources = [];
|
|
484
318
|
const chosen = env.KIT_THEME ?? "";
|
|
485
319
|
const wanted = chosen === "" ? [userConfigPath("theme", { home, xdg: env.XDG_CONFIG_HOME }), findUp(join3(".kaynooo", "theme.json"), from, endsWalk(home))] : [];
|
|
@@ -517,12 +351,12 @@ function activeTheme() {
|
|
|
517
351
|
}
|
|
518
352
|
|
|
519
353
|
// ../kit/src/style.ts
|
|
520
|
-
var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:" };
|
|
354
|
+
var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:", plan: "would:" };
|
|
521
355
|
function takesControlCodes(stream, env = process6.env) {
|
|
522
356
|
return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
|
|
523
357
|
}
|
|
524
358
|
function paint(stream, env = process6.env) {
|
|
525
|
-
return
|
|
359
|
+
return Fe2({ stream: { isTTY: takesControlCodes(stream, env) }, env });
|
|
526
360
|
}
|
|
527
361
|
function marked(mark, text, stream, detail, env = process6.env) {
|
|
528
362
|
const colors = paint(stream, env);
|
|
@@ -569,16 +403,16 @@ function printHeader(bin, context, stream = process6.stdout, env = process6.env)
|
|
|
569
403
|
if (line !== "")
|
|
570
404
|
console.log(line);
|
|
571
405
|
}
|
|
572
|
-
// ../../node_modules/.bun/@kaynooo+utils@
|
|
573
|
-
function
|
|
574
|
-
let
|
|
575
|
-
if (Math.abs(
|
|
576
|
-
return `${
|
|
577
|
-
let
|
|
406
|
+
// ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-knqbxp56.js
|
|
407
|
+
function tt2(i, { units: r = "iec", dp: t = 1, locale: n } = {}) {
|
|
408
|
+
let e = r === "si" ? 1000 : 1024;
|
|
409
|
+
if (Math.abs(i) < e)
|
|
410
|
+
return `${i} B`;
|
|
411
|
+
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
412
|
do
|
|
579
|
-
|
|
580
|
-
while (Math.round(Math.abs(
|
|
581
|
-
return `${t.toFixed(
|
|
413
|
+
i /= e, ++o;
|
|
414
|
+
while (Math.round(Math.abs(i) * a) / a >= e && o < s.length - 1);
|
|
415
|
+
return `${n ? y(n, { minimumFractionDigits: t, maximumFractionDigits: t }).format(i) : i.toFixed(t)} ${s[o]}`;
|
|
582
416
|
}
|
|
583
417
|
|
|
584
418
|
// ../kit/src/format.ts
|
|
@@ -611,7 +445,7 @@ function formatAge(date, now = Date.now()) {
|
|
|
611
445
|
return seconds < 60 ? "just now" : `${upTo(formatSeconds(seconds), " ")} ago`;
|
|
612
446
|
}
|
|
613
447
|
function truncate(text, width) {
|
|
614
|
-
return text
|
|
448
|
+
return ko(text, width, { suffix: "\u2026", includeSuffix: true });
|
|
615
449
|
}
|
|
616
450
|
var LINE_BREAKS = /\s*\n\s*/g;
|
|
617
451
|
var ESCAPE = String.fromCharCode(27);
|
|
@@ -2626,7 +2460,7 @@ async function sweep(args) {
|
|
|
2626
2460
|
if (values.apply === true && removable.length > 0 && values.yes !== true) {
|
|
2627
2461
|
if (!json)
|
|
2628
2462
|
print(root, entries, skipped.length, reclaimable, now);
|
|
2629
|
-
const agreed = await confirm(`Delete ${removable.length} ${removable.length === 1 ? "entry" : "entries"} (${
|
|
2463
|
+
const agreed = await confirm(`Delete ${removable.length} ${removable.length === 1 ? "entry" : "entries"} (${tt2(reclaimable)})?`, { default: false, hint: "pass --yes to skip the confirm" });
|
|
2630
2464
|
if (agreed !== true) {
|
|
2631
2465
|
if (json)
|
|
2632
2466
|
fail("nothing deleted: the confirm was declined", 1, "pass --yes to skip the confirm");
|
|
@@ -2634,7 +2468,7 @@ async function sweep(args) {
|
|
|
2634
2468
|
return 1;
|
|
2635
2469
|
}
|
|
2636
2470
|
}
|
|
2637
|
-
const outcomes = values.apply === true ? await applyAll(removable, (outcome) =>
|
|
2471
|
+
const outcomes = values.apply === true ? await applyAll(removable, (outcome) => report2(root, outcome, json)) : undefined;
|
|
2638
2472
|
const failed = outcomes?.filter((outcome) => !outcome.removed).length ?? 0;
|
|
2639
2473
|
if (json) {
|
|
2640
2474
|
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 +2480,7 @@ async function sweep(args) {
|
|
|
2646
2480
|
console.log("dry run, pass --apply to delete");
|
|
2647
2481
|
} else {
|
|
2648
2482
|
const bytes = new Map(removable.map((entry) => [entry.path, entry.bytes]));
|
|
2649
|
-
note(`freed ${
|
|
2483
|
+
note(`freed ${tt2(outcomes.reduce((sum, outcome) => sum + (outcome.removed ? bytes.get(outcome.path) ?? 0 : 0), 0))}`);
|
|
2650
2484
|
}
|
|
2651
2485
|
if (docker !== undefined)
|
|
2652
2486
|
console.log(`
|
|
@@ -2654,7 +2488,7 @@ docker (left to dclean):
|
|
|
2654
2488
|
${docker}`);
|
|
2655
2489
|
return failed === 0 ? 0 : 1;
|
|
2656
2490
|
}
|
|
2657
|
-
function
|
|
2491
|
+
function report2(root, outcome, json) {
|
|
2658
2492
|
if (json)
|
|
2659
2493
|
return;
|
|
2660
2494
|
if (outcome.removed)
|
|
@@ -2671,12 +2505,12 @@ function print(root, entries, skipped, reclaimable, now) {
|
|
|
2671
2505
|
const path = role("path", process.stdout);
|
|
2672
2506
|
const sized = (bytes) => {
|
|
2673
2507
|
if (bytes >= BIG)
|
|
2674
|
-
return colors.red(
|
|
2675
|
-
return bytes >= LARGE ? colors.yellow(
|
|
2508
|
+
return colors.red(tt2(bytes));
|
|
2509
|
+
return bytes >= LARGE ? colors.yellow(tt2(bytes)) : tt2(bytes);
|
|
2676
2510
|
};
|
|
2677
2511
|
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
2512
|
console.log(`
|
|
2679
|
-
${
|
|
2513
|
+
${tt2(reclaimable)} reclaimable${skipped === 0 ? "" : `, ${skipped} skipped (symlinks, tracked or not ignored by git)`}`);
|
|
2680
2514
|
}
|
|
2681
2515
|
|
|
2682
2516
|
// src/cli.ts
|