@kaynooo/cli-pkg 0.11.0 → 0.13.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.
Files changed (2) hide show
  1. package/dist/cli.js +149 -278
  2. package/package.json +5 -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
  var __defProp = Object.defineProperty;
4
4
  var __returnValue = (v) => v;
@@ -38,6 +38,51 @@ var init_advisory = __esm(() => {
38
38
  SEVERITIES = ["low", "moderate", "high", "critical"];
39
39
  });
40
40
 
41
+ // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-rxztfxgv.js
42
+ function K(t, e, { plural: r, zero: n = "singular" } = {}) {
43
+ if (e === 1 || e === 0 && n === "singular")
44
+ return t;
45
+ if (r !== undefined)
46
+ return r;
47
+ if (t.endsWith("y") && !ct.test(t))
48
+ return `${t.slice(0, -1)}ies`;
49
+ if (t.endsWith("s") || t.endsWith("x") || t.endsWith("z") || t.endsWith("ch") || t.endsWith("sh"))
50
+ return `${t}es`;
51
+ if (Ot.test(t))
52
+ return `${t.slice(0, -1)}ves`;
53
+ return Gt.test(t) ? `${t.slice(0, -2)}ves` : `${t}s`;
54
+ }
55
+ function go(t, e, { zero: r = "plural", ...n } = {}) {
56
+ return `${t} ${K(e, t, { ...n, zero: r })}`;
57
+ }
58
+ function ko(t, e, r = "...") {
59
+ let { suffix: n = "...", includeSuffix: s = false, wordBoundary: o = false } = typeof r === "string" ? { suffix: r } : r;
60
+ if (t.length <= e)
61
+ return t;
62
+ let l = Math.max(0, e), c = t.substring(0, Math.max(0, s ? l - n.length : l));
63
+ if (o && !Y.test(t[c.length] ?? " "))
64
+ c = c.replace(Nt, "") || c;
65
+ if (o)
66
+ c = c.trimEnd();
67
+ return s ? (c + n).slice(0, l) : c + n;
68
+ }
69
+ var ct, N, Ot, Gt, Nt, Y, be, z;
70
+ var init_chunk_rxztfxgv = __esm(() => {
71
+ ct = /[aeiou]y$/;
72
+ N = new Map;
73
+ Ot = /(?:leaf|loaf|thief|wolf|half|calf|elf|sheaf|scarf|dwarf|hoof|wharf)$/;
74
+ Gt = /(?:knife|life|wife)$/;
75
+ Nt = /\s+\S*$/;
76
+ Y = /\s/;
77
+ 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));
78
+ z = new Map;
79
+ });
80
+
81
+ // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/index.js
82
+ var init_dist = __esm(() => {
83
+ init_chunk_rxztfxgv();
84
+ });
85
+
41
86
  // ../kit/src/mode.ts
42
87
  import process2 from "process";
43
88
  function isSet(value) {
@@ -62,270 +107,67 @@ var init_mode = __esm(() => {
62
107
  AGENT_VARIABLES = ["CLAUDECODE", "AI_AGENT"];
63
108
  });
64
109
 
65
- // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-mtetydvc.js
66
- function x(s) {
67
- let r = s.startsWith("#") ? s.slice(1).toLowerCase() : s.toLowerCase();
68
- if (!/^[a-f0-9]+$/.test(r))
110
+ // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
111
+ function b(r) {
112
+ let e = r.startsWith("#") ? r.slice(1) : r;
113
+ if (!G2.test(e))
69
114
  return [0, 0, 0];
70
- let t = r.length, n = (c) => Number.parseInt(c, 16);
71
- if (t === 3 || t === 4) {
72
- 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;
73
- return g !== undefined ? [c, u, h, g] : [c, u, h];
74
- }
75
- if (t !== 6 && t !== 8)
76
- throw Error(`Invalid hex color length: ${t}`);
77
- 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;
78
- if ([a, b, o].some(Number.isNaN) || y !== undefined && Number.isNaN(y))
79
- throw Error(`Invalid hex color value: ${s}`);
80
- return y !== undefined ? [a, b, o, y] : [a, b, o];
81
- }
82
- function A(s) {
83
- let [r, t, n, a] = s;
84
- if (a)
85
- return `#${(r << 24 | t << 16 | n << 8 | Math.round((a ?? 1) * 255)).toString(16).padStart(8, "0").toUpperCase()}`;
86
- return `#${(r << 16 | t << 8 | n).toString(16).padStart(6, "0").toUpperCase()}`;
87
- }
88
- function R(s, r, t) {
89
- s = (s % 360 + 360) % 360, t /= 100;
90
- let n = r * Math.min(t, 1 - t) / 100, a = (b) => {
91
- let o = (b + s / 30) % 12, y = t - n * Math.max(Math.min(o - 3, 9 - o, 1), -1);
92
- return Math.round(255 * y);
93
- };
94
- return [a(0), a(8), a(4)];
95
- }
96
- function k(s) {
97
- let [r, t, n] = s;
98
- r /= 255, t /= 255, n /= 255;
99
- let a = Math.max(r, t, n), b = Math.min(r, t, n), o = 0, y = 0, c = (a + b) / 2;
100
- if (a !== b) {
101
- let u = a - b;
102
- if (y = c > 0 && c < 1 ? u / (1 - Math.abs(2 * c - 1)) : 0, a === r)
103
- o = (t - n) / u + (t < n ? 6 : 0);
104
- else if (a === t)
105
- o = (n - r) / u + 2;
106
- else
107
- o = (r - t) / u + 4;
108
- o /= 6;
109
- }
110
- return [Math.round(o * 360), Math.round(y * 100), Math.round(c * 100)];
111
- }
112
- function H(s, r, t) {
113
- s = (s % 360 + 360) % 360, r /= 100, t /= 100;
114
- let n = (a) => {
115
- let b = (a + s / 60) % 6, o = t - t * r * Math.max(Math.min(b, 4 - b, 1), 0);
116
- return Math.round(255 * o);
117
- };
118
- return [n(5), n(3), n(1)];
119
- }
120
- function f(s) {
121
- let [r, t, n] = s;
122
- r /= 255, t /= 255, n /= 255;
123
- 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;
124
- if (o !== 0) {
125
- if (a === r)
126
- y = (t - n) / o + (t < n ? 6 : 0);
127
- else if (a === t)
128
- y = (n - r) / o + 2;
129
- else
130
- y = (r - t) / o + 4;
131
- y /= 6;
132
- }
133
- return [Math.round(y * 360), Math.round(c * 100), Math.round(u * 100)];
134
- }
135
- function O(s) {
136
- let r = s[0] / 255, t = s[1] / 255, n = s[2] / 255, a = 1 - Math.max(r, t, n);
137
- if (a === 1)
138
- return [0, 0, 0, 100];
139
- let b = (1 - r - a) / (1 - a), o = (1 - t - a) / (1 - a), y = (1 - n - a) / (1 - a);
140
- return [Math.round(b * 100), Math.round(o * 100), Math.round(y * 100), Math.round(a * 100)];
141
- }
142
- function v(s, r, t, n) {
143
- 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))];
144
- }
145
- function T(s) {
146
- 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);
147
- 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)];
148
- }
149
- function M(s, r, t) {
150
- 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)));
151
- return [u(o), u(y), u(c)];
152
- }
153
- function d(s) {
154
- let [r, t, n] = T(s), a = Math.sqrt(t * t + n * n), b = (Math.atan2(n, t) * 180 / Math.PI + 360) % 360;
155
- return [i(r, 4), i(a, 4), i(b, 2)];
156
- }
157
- function C(s, r, t) {
158
- let n = t * Math.PI / 180;
159
- return M(s, r * Math.cos(n), r * Math.sin(n));
160
- }
161
- function l(s) {
162
- let r = s / 255;
163
- return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
164
- }
165
-
166
- class e {
167
- r;
168
- g;
169
- b;
170
- a;
171
- constructor(s, r, t, n = 1) {
172
- this.r = s, this.g = r, this.b = t, this.a = n;
173
- }
174
- static from(s, r) {
175
- if (s === "hex") {
176
- let [t, n, a, b] = x(r);
177
- return new e(t, n, a, b);
178
- }
179
- if (s === "rgb") {
180
- if (Array.isArray(r)) {
181
- let [o, y, c, u] = r;
182
- return new e(o, y, c, u);
183
- }
184
- let { r: t, g: n, b: a, a: b } = r;
185
- return new e(t, n, a, b);
186
- }
187
- if (s === "hsl") {
188
- let t, n, a, b;
189
- if (Array.isArray(r))
190
- [t, n, a, b] = r;
191
- else
192
- ({ h: t, s: n, l: a, a: b } = r);
193
- let [o, y, c] = R(t, n, a);
194
- return new e(o, y, c, b);
195
- }
196
- if (s === "hsv") {
197
- let t, n, a, b;
198
- if (Array.isArray(r))
199
- [t, n, a, b] = r;
200
- else
201
- ({ h: t, s: n, v: a, a: b } = r);
202
- let [o, y, c] = H(t, n, a);
203
- return new e(o, y, c, b);
204
- }
205
- if (s === "cmyk") {
206
- let t, n, a, b, o;
207
- if (Array.isArray(r))
208
- [t, n, a, b, o] = r;
209
- else
210
- ({ c: t, m: n, y: a, k: b, a: o } = r);
211
- let [y, c, u] = v(t, n, a, b);
212
- return new e(y, c, u, o);
213
- }
214
- if (s === "oklch") {
215
- let t, n, a, b;
216
- if (Array.isArray(r))
217
- [t, n, a, b] = r;
218
- else
219
- ({ l: t, c: n, h: a, a: b } = r);
220
- let [o, y, c] = C(t, n, a);
221
- return new e(o, y, c, b);
222
- }
223
- if (s === "oklab") {
224
- let t, n, a, b;
225
- if (Array.isArray(r))
226
- [t, n, a, b] = r;
227
- else
228
- ({ l: t, a: n, b: a, alpha: b } = r);
229
- let [o, y, c] = M(t, n, a);
230
- return new e(o, y, c, b);
231
- }
232
- throw Error("Invalid input");
233
- }
234
- to(s) {
235
- switch (s) {
236
- case "rgb":
237
- return [this.r, this.g, this.b];
238
- case "rgba":
239
- return [this.r, this.g, this.b, this.a];
240
- case "hex":
241
- return A([this.r, this.g, this.b]);
242
- case "hexa":
243
- return A([this.r, this.g, this.b, this.a]);
244
- case "hsl":
245
- return k([this.r, this.g, this.b]);
246
- case "hsla":
247
- return [...k([this.r, this.g, this.b]), this.a];
248
- case "hsv":
249
- return f([this.r, this.g, this.b]);
250
- case "hsva":
251
- return [...f([this.r, this.g, this.b]), this.a];
252
- case "cmyk":
253
- return O([this.r, this.g, this.b]);
254
- case "cmyka":
255
- return [...O([this.r, this.g, this.b]), this.a];
256
- case "oklch":
257
- return d([this.r, this.g, this.b]);
258
- case "oklcha":
259
- return [...d([this.r, this.g, this.b]), this.a];
260
- case "oklab":
261
- return T([this.r, this.g, this.b]);
262
- case "oklaba":
263
- return [...T([this.r, this.g, this.b]), this.a];
264
- default:
265
- return [this.r, this.g, this.b];
266
- }
267
- }
268
- getLuminance() {
269
- let s = l(this.r), r = l(this.g), t = l(this.b);
270
- return 0.2126 * s + 0.7152 * r + 0.0722 * t;
271
- }
272
- contrastRatio(s) {
273
- let r = this.getLuminance(), t = s.getLuminance(), [n, a] = r >= t ? [r, t] : [t, r];
274
- return (n + 0.05) / (a + 0.05);
275
- }
276
- bestContrastForeground() {
277
- let s = new e(255, 255, 255, 1), r = new e(0, 0, 0, 1), t = this.contrastRatio(s), n = this.contrastRatio(r);
278
- return t >= n ? s : r;
279
- }
280
- }
281
- var m = (s) => s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4, p = (s) => s <= 0.0031308 ? 12.92 * s : 1.055 * s ** 0.4166666666666667 - 0.055, i = (s, r) => Math.round(s * 10 ** r) / 10 ** r;
282
- var init_chunk_mtetydvc = () => {};
283
-
284
- // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-y1msbssb.js
285
- function h(i, n = globalThis.process?.env ?? {}) {
286
- if (n.FORCE_COLOR !== undefined)
287
- return b.has(n.FORCE_COLOR);
288
- if (n.NO_COLOR !== undefined || n.NODE_DISABLE_COLORS !== undefined || n.TERM === "dumb")
115
+ if (e.length === 3 || e.length === 4)
116
+ return [Number.parseInt(e[0] + e[0], 16), Number.parseInt(e[1] + e[1], 16), Number.parseInt(e[2] + e[2], 16)];
117
+ if (e.length !== 6 && e.length !== 8)
118
+ throw Error(`Invalid hex color length: ${e.length}`);
119
+ return [Number.parseInt(e.slice(0, 2), 16), Number.parseInt(e.slice(2, 4), 16), Number.parseInt(e.slice(4, 6), 16)];
120
+ }
121
+ function C(r, e = globalThis.process?.env ?? {}) {
122
+ if (e.FORCE_COLOR !== undefined)
123
+ return h.has(e.FORCE_COLOR);
124
+ if (e.NO_COLOR !== undefined || e.NODE_DISABLE_COLORS !== undefined || e.TERM === "dumb")
289
125
  return false;
290
- return i?.isTTY === true;
291
- }
292
- function d2(i, n, a) {
293
- if (!h(a.stream ?? globalThis.process?.stdout, a.env))
294
- return n;
295
- let l = "", s = "";
296
- for (let g = 0, y = i.length;g < y; g++) {
297
- let [c, p] = i[g];
298
- l += `${f2}${c}m`, s = `${f2}${p}m${s}`;
299
- }
300
- return l + n + s;
301
- }
302
- function u(i, n = []) {
303
- return new Proxy((l) => d2(n, l, i), { get(l, s) {
304
- let g = C2[s];
305
- if (Array.isArray(g))
306
- return u(i, [...n, g]);
307
- if (typeof g === "function")
308
- return (...y) => u(i, [...n, g(...y)]);
309
- throw Error(`Unknown style: ${String(s)}`);
126
+ return r?.isTTY === true;
127
+ }
128
+ function f2(r, e = []) {
129
+ let l = "", n = "";
130
+ for (let t = 0, i = e.length;t < i; t++)
131
+ l += `\x1B[${e[t][0]}m`, n = `\x1B[${e[t][1]}m${n}`;
132
+ let c = (t) => C(r.stream ?? globalThis.process?.stdout, r.env) ? l + t + n : t, g = new Map;
133
+ return new Proxy(c, { get(t, i) {
134
+ let a = B2[i];
135
+ if (Array.isArray(a)) {
136
+ let s = g.get(i);
137
+ if (s === undefined)
138
+ s = f2(r, [...e, a]), g.set(i, s);
139
+ return s;
140
+ }
141
+ if (typeof a === "function")
142
+ return (...s) => {
143
+ let y = `${i}:${s.join(",")}`, u = g.get(y);
144
+ if (u === undefined) {
145
+ if (g.size >= 64)
146
+ g.clear();
147
+ u = f2(r, [...e, a(...s)]), g.set(y, u);
148
+ }
149
+ return u;
150
+ };
151
+ throw Error(`Unknown style: ${String(i)}`);
310
152
  } });
311
153
  }
312
- function le(i = {}) {
313
- return u(i);
314
- }
315
- var r = 39, o = 49, f2 = "\x1B[", C2, b, t;
316
- var init_chunk_y1msbssb = __esm(() => {
317
- init_chunk_mtetydvc();
318
- 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") => {
319
- let [a, l, s] = e.from("hex", i).to("rgb");
320
- return [`${n === "fg" ? 38 : 48};2;${a};${l};${s}`, n === "fg" ? r : o];
321
- }, ansi256: (i, n = "fg") => [`${n === "fg" ? 38 : 48};5;${i}`, n === "fg" ? r : o] };
322
- b = new Set(["", "1", "2", "3", "true"]);
323
- t = le();
154
+ function Fe2(r = {}) {
155
+ return f2(r);
156
+ }
157
+ var G2, B2, h, o2;
158
+ var init_chunk_x450vn3m = __esm(() => {
159
+ G2 = /^[a-f0-9]+$/i;
160
+ 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") => {
161
+ let [l, n, c] = b(r);
162
+ return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
163
+ }, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
164
+ h = new Set(["", "1", "2", "3", "true"]);
165
+ o2 = Fe2();
324
166
  });
325
167
 
326
- // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/tools/colors.js
168
+ // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/tools/colors.js
327
169
  var init_colors = __esm(() => {
328
- init_chunk_y1msbssb();
170
+ init_chunk_x450vn3m();
329
171
  });
330
172
 
331
173
  // ../kit/src/config.ts
@@ -434,6 +276,8 @@ function applyPreset(theme, name, warn, where) {
434
276
  Object.assign(theme.glyphs, preset.glyphs);
435
277
  if (preset.accents !== undefined)
436
278
  theme.accents = [...preset.accents];
279
+ if (Object.hasOwn(preset, "gradient"))
280
+ theme.gradient = preset.gradient;
437
281
  return name;
438
282
  }
439
283
  function applyFile(theme, file, where, warn) {
@@ -461,6 +305,12 @@ function applyFile(theme, file, where, warn) {
461
305
  theme.accents = [...file.accents];
462
306
  else if (file.accents !== undefined)
463
307
  warn(`${where}: accents must be a non-empty list of colours`);
308
+ if (file.gradient === null)
309
+ theme.gradient = undefined;
310
+ else if (Array.isArray(file.gradient) && file.gradient.length === 2 && file.gradient.every((end) => typeof end === "string" && HEX.test(end)))
311
+ theme.gradient = [file.gradient[0], file.gradient[1]];
312
+ else if (file.gradient !== undefined)
313
+ warn(`${where}: gradient must be two \`#rrggbb\` colours, or null for none`);
464
314
  if (isRecord(file.bins)) {
465
315
  for (const [bin, value] of Object.entries(file.bins)) {
466
316
  if (isColorSpec(value))
@@ -483,7 +333,7 @@ function isPath(chosen) {
483
333
  return chosen.includes("/") || chosen.endsWith(".json");
484
334
  }
485
335
  function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(), warn = warnOnce } = {}) {
486
- const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null) };
336
+ const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null), gradient: DEFAULT.gradient };
487
337
  const sources = [];
488
338
  const chosen = env.KIT_THEME ?? "";
489
339
  const wanted = chosen === "" ? [userConfigPath("theme", { home, xdg: env.XDG_CONFIG_HOME }), findUp(join3(".kaynooo", "theme.json"), from, endsWalk(home))] : [];
@@ -517,23 +367,25 @@ function activeTheme() {
517
367
  }
518
368
  return current;
519
369
  }
520
- var DEFAULT, BRIGHT, MONO, ASCII, PRESETS, STYLES, HEX, CONTROL, MAX_FILE_BYTES, SPACES, CUBE, warned, current, currentKey = "";
370
+ var ENDS, DEFAULT, BRIGHT, MONO, ASCII, PRESETS, STYLES, HEX, CONTROL, MAX_FILE_BYTES, SPACES, CUBE, warned, current, currentKey = "";
521
371
  var init_theme = __esm(() => {
522
372
  init_config();
523
373
  init_user_config();
374
+ ENDS = new Map;
524
375
  DEFAULT = {
525
- 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" },
526
- glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501" },
376
+ 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" },
377
+ 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" },
527
378
  accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
528
- bins: {}
379
+ bins: {},
380
+ gradient: ["#c084fc", "#67e8f9"]
529
381
  };
530
- 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" };
531
- 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" };
532
- ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#" };
382
+ 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" };
383
+ 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" };
384
+ ASCII = { ok: "+", warn: "!", problem: "x", note: ">", plan: "?", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
533
385
  PRESETS = {
534
386
  default: {},
535
- "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
536
- mono: { colors: MONO, accents: ["bold"] },
387
+ "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
388
+ mono: { colors: MONO, accents: ["bold"], gradient: undefined },
537
389
  ascii: { glyphs: ASCII }
538
390
  };
539
391
  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"]);
@@ -551,7 +403,7 @@ function takesControlCodes(stream, env = process6.env) {
551
403
  return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
552
404
  }
553
405
  function paint(stream, env = process6.env) {
554
- return le({ stream: { isTTY: takesControlCodes(stream, env) }, env });
406
+ return Fe2({ stream: { isTTY: takesControlCodes(stream, env) }, env });
555
407
  }
556
408
  function marked(mark, text, stream, detail, env = process6.env) {
557
409
  const colors = paint(stream, env);
@@ -579,7 +431,7 @@ var init_style = __esm(() => {
579
431
  init_colors();
580
432
  init_mode();
581
433
  init_theme();
582
- MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:" };
434
+ MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:", plan: "would:" };
583
435
  STATUS_WORDS = {
584
436
  passed: ["passed", "success", "succeeded", "ok"],
585
437
  failed: ["failed", "failure", "error", "errored"],
@@ -623,7 +475,7 @@ function formatAge(date, now = Date.now()) {
623
475
  return seconds < 60 ? "just now" : `${upTo(formatSeconds(seconds), " ")} ago`;
624
476
  }
625
477
  function truncate(text, width) {
626
- return text.length <= width ? text : `${text.slice(0, Math.max(0, width - 1))}\u2026`;
478
+ return ko(text, width, { suffix: "\u2026", includeSuffix: true });
627
479
  }
628
480
  function textWidth(text) {
629
481
  return Bun.stringWidth(text);
@@ -675,6 +527,7 @@ function printJson(value) {
675
527
  }
676
528
  var UNITS, LINE_BREAKS, ESCAPE;
677
529
  var init_format = __esm(() => {
530
+ init_dist();
678
531
  init_mode();
679
532
  init_style();
680
533
  UNITS = [["d", 86400], ["h", 3600], ["m", 60], ["s", 1]];
@@ -1303,6 +1156,7 @@ var init_progress = __esm(() => {
1303
1156
  init_format();
1304
1157
  init_process();
1305
1158
  init_style();
1159
+ init_theme();
1306
1160
  FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
1307
1161
  ESC = String.fromCharCode(27);
1308
1162
  ESCAPE_CODE = new RegExp(`${ESC}(?:\\[[\\x30-\\x3F]*[\\x20-\\x2F]*[\\x40-\\x7E]|\\][^\\u0007${ESC}]*(?:\\u0007|${ESC}\\\\))`, "y");
@@ -1322,6 +1176,7 @@ var init_ci = __esm(() => {
1322
1176
  init_args();
1323
1177
  init_format();
1324
1178
  init_progress();
1179
+ init_style();
1325
1180
  init_tool();
1326
1181
  });
1327
1182
 
@@ -1667,6 +1522,12 @@ var init_cli = __esm(() => {
1667
1522
  };
1668
1523
  TOP_OPTIONS = { ...LEVEL_OPTIONS, version: { type: "boolean", short: "v", description: "print the version" } };
1669
1524
  });
1525
+ // ../kit/src/folders.ts
1526
+ var SKIPPED_FOLDERS;
1527
+ var init_folders = __esm(() => {
1528
+ SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
1529
+ });
1530
+
1670
1531
  // ../kit/src/git.ts
1671
1532
  var init_git = __esm(() => {
1672
1533
  init_args();
@@ -1712,6 +1573,13 @@ async function pool(items, limit, task) {
1712
1573
  return results;
1713
1574
  }
1714
1575
 
1576
+ // ../kit/src/report.ts
1577
+ var init_report = __esm(() => {
1578
+ init_cli();
1579
+ init_style();
1580
+ init_text();
1581
+ });
1582
+
1715
1583
  // ../kit/src/secrets.ts
1716
1584
  var SECRET_WORDS;
1717
1585
  var init_secrets = __esm(() => {
@@ -1774,12 +1642,14 @@ var init_src = __esm(() => {
1774
1642
  init_ci();
1775
1643
  init_cli();
1776
1644
  init_config();
1645
+ init_folders();
1777
1646
  init_format();
1778
1647
  init_git();
1779
1648
  init_limit();
1780
1649
  init_logs();
1781
1650
  init_mode();
1782
1651
  init_process();
1652
+ init_report();
1783
1653
  init_secrets();
1784
1654
  init_sessions();
1785
1655
  init_size();
@@ -2541,7 +2411,7 @@ function ageDays(published, now) {
2541
2411
  return Number.isNaN(at) ? undefined : (now - at) / DAY;
2542
2412
  }
2543
2413
  function daysAgo(age) {
2544
- return age < 1 ? "less than a day" : `${Math.floor(age)} day${Math.floor(age) === 1 ? "" : "s"}`;
2414
+ return age < 1 ? "less than a day" : go(Math.floor(age), "day");
2545
2415
  }
2546
2416
  function installScriptsOf(version) {
2547
2417
  return Object.fromEntries(INSTALL_SCRIPTS.flatMap((name) => version?.scripts?.[name] === undefined ? [] : [[name, version.scripts[name]]]));
@@ -2617,6 +2487,7 @@ function analyze(input) {
2617
2487
  }
2618
2488
  var DEFAULT_MIN_AGE_DAYS = 14, DAY = 86400000, PUBLIC_HOST, INSTALL_SCRIPTS, GIT_PREFIX, VERSION_SEPARATOR;
2619
2489
  var init_analyze = __esm(() => {
2490
+ init_dist();
2620
2491
  init_advisories();
2621
2492
  init_licenses();
2622
2493
  init_nearmiss();
@@ -2879,7 +2750,7 @@ function packageFiles(dir, depth, found) {
2879
2750
  for (const entry of entries) {
2880
2751
  if (entry.isFile() && entry.name === "package.json")
2881
2752
  found.push(join8(dir, entry.name));
2882
- else if (entry.isDirectory() && depth < MAX_DEPTH && !entry.name.startsWith(".") && !SKIPPED.has(entry.name))
2753
+ else if (entry.isDirectory() && depth < MAX_DEPTH && !entry.name.startsWith(".") && !SKIPPED_FOLDERS.has(entry.name))
2883
2754
  packageFiles(join8(dir, entry.name), depth + 1, found);
2884
2755
  }
2885
2756
  return found;
@@ -2959,12 +2830,11 @@ function registryDependencies(text) {
2959
2830
  }
2960
2831
  return REGISTRY_KINDS.flatMap((kind) => Object.entries(manifest?.[kind] ?? {}).flatMap(([name, spec]) => typeof spec === "string" && !LOCAL_SPEC.test(spec) ? [{ name, kind, spec }] : []));
2961
2832
  }
2962
- var KINDS, SKIPPED, MAX_DEPTH = 5, LOCAL_SPEC, ALIAS, MIN_SIMILAR = 3, KIND_FLAGS, RANGE_PREFIX, REGISTRY_KINDS;
2833
+ var KINDS, MAX_DEPTH = 5, LOCAL_SPEC, ALIAS, MIN_SIMILAR = 3, KIND_FLAGS, RANGE_PREFIX, REGISTRY_KINDS;
2963
2834
  var init_consumers = __esm(() => {
2964
2835
  init_src();
2965
2836
  init_pin();
2966
2837
  KINDS = ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"];
2967
- SKIPPED = new Set(["node_modules", "dist", "build", "vendor", "target", "coverage"]);
2968
2838
  LOCAL_SPEC = /[:/]/;
2969
2839
  ALIAS = /^npm:(@[^@/]+\/[^@/]+|[^@/]+)@(.+)$/;
2970
2840
  KIND_FLAGS = { dependencies: [], devDependencies: ["--dev"], optionalDependencies: ["--optional"], peerDependencies: ["--peer"] };
@@ -3716,10 +3586,10 @@ async function bumpConsumers(name, version, settings) {
3716
3586
  const similar = similarDependencies(name, settings.root);
3717
3587
  note(`nothing under ${settings.root} depends on ${name}`, similar.length === 0 ? undefined : `did you mean ${similar.join(", ")}`);
3718
3588
  } else if (left > 0) {
3719
- note(`${left} folder${left === 1 ? "" : "s"} left out by --only or --except`);
3589
+ note(`${go(left, "folder")} left out by --only or --except`);
3720
3590
  }
3721
3591
  if (declined.size > 0)
3722
- note(`${declined.size} folder${declined.size === 1 ? "" : "s"} left out by your choice`);
3592
+ note(`${go(declined.size, "folder")} left out by your choice`);
3723
3593
  if (local > 0)
3724
3594
  note(`${local} non-registry dependenc${local === 1 ? "y" : "ies"} (workspace:, file:, git, URL, alias, catalog:)`, "left as they are");
3725
3595
  for (const consumer of consumers) {
@@ -3780,7 +3650,7 @@ async function choosePlan(name, version, settings, chooser = terminalChooser, ho
3780
3650
  const chosen = plans.filter((plan) => picked.has(plan.dir));
3781
3651
  for (const plan of chosen)
3782
3652
  note("plan", plan.line);
3783
- if (chosen.length === 0 || await chooser.confirm(`bump ${name} to ${version} in ${chosen.length} folder${chosen.length === 1 ? "" : "s"}?`) !== true)
3653
+ if (chosen.length === 0 || await chooser.confirm(`bump ${name} to ${version} in ${go(chosen.length, "folder")}?`) !== true)
3784
3654
  return { chosen: [], declined: plans.map((plan) => plan.dir) };
3785
3655
  const declined = plans.filter((plan) => !picked.has(plan.dir)).map((plan) => plan.dir);
3786
3656
  saveExcluded(name, [...excluded].filter((dir) => !plans.some((plan) => plan.dir === dir)).concat(declined), home);
@@ -3827,6 +3697,7 @@ var init_bump = __esm(() => {
3827
3697
  init_src();
3828
3698
  init_progress();
3829
3699
  init_prompt();
3700
+ init_dist();
3830
3701
  init_config2();
3831
3702
  init_consumers();
3832
3703
  init_excluded();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-pkg",
3
3
  "type": "module",
4
- "version": "0.11.0",
4
+ "version": "0.13.0",
5
5
  "description": "pkg: check an npm package before it is added, for a guessed name, a version under two weeks old and install scripts.",
6
6
  "author": "Kaynooo <contact@kaynooo.fr>",
7
7
  "license": "MIT",
@@ -29,7 +29,10 @@
29
29
  "popular": "$npm_execpath scripts/popular.ts",
30
30
  "record": "$npm_execpath scripts/record.ts"
31
31
  },
32
+ "dependencies": {
33
+ "@kaynooo/utils": "3.0.0"
34
+ },
32
35
  "devDependencies": {
33
- "@kaynooo/cli-kit": "0.26.0"
36
+ "@kaynooo/cli-kit": "0.36.0"
34
37
  }
35
38
  }