@ccpluginizer/ccpluginizer 0.6.0 → 0.6.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.
Files changed (2) hide show
  1. package/dist/index.js +1627 -1285
  2. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -16,1401 +16,1786 @@ var __export = (target, all) => {
16
16
  };
17
17
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
18
18
 
19
- // ../../node_modules/.bun/@crustjs+core@0.0.16+7524df1edfed9f02/node_modules/@crustjs/core/dist/shared/chunk-vt64gs69.js
20
- import { parseArgs as U } from "util";
21
- function q(B) {
22
- let J = {}, G = {};
23
- if (!B)
24
- return { options: J, aliasToName: G };
25
- let z = new Map;
26
- for (let j of Object.keys(B))
27
- z.set(j, j);
28
- for (let [j, H] of Object.entries(B)) {
29
- if (j.startsWith("no-")) {
30
- let L = j.slice(3);
31
- throw new W("DEFINITION", `Flag "--${j}" must not use "no-" prefix; define "${L}" and negate with "--no-${L}"`);
32
- }
33
- let K = H.type === "boolean" ? "boolean" : "string", Q = { type: K };
34
- if (H.multiple)
35
- Q.multiple = true;
36
- if (H.short) {
37
- if (H.short.startsWith("no-"))
38
- throw new W("DEFINITION", `Short alias "-${H.short}" on "--${j}" must not use "no-" prefix (reserved for negation)`);
39
- let L = z.get(H.short);
40
- if (L)
41
- throw new W("DEFINITION", `Alias collision: "-${H.short}" is used by both "--${L}" and "--${j}"`);
42
- z.set(H.short, j), G[H.short] = j, Q.short = H.short;
43
- }
44
- if (H.aliases)
45
- for (let L of H.aliases) {
46
- if (L.startsWith("no-"))
47
- throw new W("DEFINITION", `Alias "--${L}" on "--${j}" must not use "no-" prefix (reserved for negation)`);
48
- let X = z.get(L);
49
- if (X)
50
- throw new W("DEFINITION", `Alias collision: "${L.length === 1 ? "-" : "--"}${L}" is used by both "--${X}" and "--${j}"`);
51
- z.set(L, j), G[L] = j;
52
- let $ = { type: K };
53
- if (H.multiple)
54
- $.multiple = true;
55
- J[L] = $;
19
+ // ../../node_modules/.bun/@crustjs+utils@0.0.3+328ed37f40d3034a/node_modules/@crustjs/utils/dist/index.js
20
+ function C(N) {
21
+ let O = Number(N);
22
+ return Number.isNaN(O) ? undefined : O;
23
+ }
24
+ function G(N) {
25
+ return N === "true" || N === "1";
26
+ }
27
+ var init_dist = () => {};
28
+
29
+ // ../../node_modules/.bun/@crustjs+core@0.0.19+328ed37f40d3034a/node_modules/@crustjs/core/dist/shared/chunk-q8y07jw2.js
30
+ import { parseArgs as L } from "util";
31
+ import { homedir as k } from "os";
32
+ import { resolve as T } from "path";
33
+ function R(H) {
34
+ try {
35
+ return new URL(H);
36
+ } catch {
37
+ let z = /^[a-z][a-z0-9+.-]*:/i.test(H) ? "" : " (missing protocol — e.g. https://example.com)";
38
+ throw new Y("PARSE", `Invalid URL "${H}"${z}`);
39
+ }
40
+ }
41
+ function J(H) {
42
+ if (H === "")
43
+ throw new Y("PARSE", "Path cannot be empty");
44
+ let K = H.replace(/^~(?=\/|$)/, k());
45
+ return T(process.cwd(), K);
46
+ }
47
+ function O(H) {
48
+ try {
49
+ return JSON.parse(H);
50
+ } catch (K) {
51
+ let z = K instanceof Error ? K.message : String(K);
52
+ throw new Y("PARSE", `Invalid JSON: ${z}. Tip: wrap JSON in single quotes on the command line, e.g. --flag '{"k":1}'`);
53
+ }
54
+ }
55
+ function w(H) {
56
+ let K = {}, z = {};
57
+ if (!H)
58
+ return { options: K, aliasToName: z };
59
+ let $ = new Map;
60
+ for (let Q of Object.keys(H))
61
+ $.set(Q, Q);
62
+ for (let [Q, Z] of Object.entries(H)) {
63
+ if (Q.startsWith("no-")) {
64
+ let X = Q.slice(3);
65
+ throw new Y("DEFINITION", `Flag "--${Q}" must not use "no-" prefix; define "${X}" and negate with "--no-${X}"`);
66
+ }
67
+ if (!E.has(Z.type))
68
+ throw new Y("DEFINITION", `Flag "--${Q}" must declare a parser type ("string", "number", "boolean", "url", "path", or "json")`);
69
+ let B = Z.type === "boolean" ? "boolean" : "string", W = { type: B };
70
+ if (Z.multiple)
71
+ W.multiple = true;
72
+ if (Z.short) {
73
+ if (Z.short.startsWith("no-"))
74
+ throw new Y("DEFINITION", `Short alias "-${Z.short}" on "--${Q}" must not use "no-" prefix (reserved for negation)`);
75
+ let X = $.get(Z.short);
76
+ if (X)
77
+ throw new Y("DEFINITION", `Alias collision: "-${Z.short}" is used by both "--${X}" and "--${Q}"`);
78
+ $.set(Z.short, Q), z[Z.short] = Q, W.short = Z.short;
79
+ }
80
+ if (Z.aliases)
81
+ for (let X of Z.aliases) {
82
+ if (X.startsWith("no-"))
83
+ throw new Y("DEFINITION", `Alias "--${X}" on "--${Q}" must not use "no-" prefix (reserved for negation)`);
84
+ let G2 = $.get(X);
85
+ if (G2)
86
+ throw new Y("DEFINITION", `Alias collision: "${X.length === 1 ? "-" : "--"}${X}" is used by both "--${G2}" and "--${Q}"`);
87
+ $.set(X, Q), z[X] = Q;
88
+ let M = { type: B };
89
+ if (Z.multiple)
90
+ M.multiple = true;
91
+ K[X] = M;
56
92
  }
57
- J[j] = Q;
58
- }
59
- return { options: J, aliasToName: G };
60
- }
61
- function _(B, J, G) {
62
- if (J === "number") {
63
- let z = Number(B);
64
- if (Number.isNaN(z))
65
- throw new W("PARSE", `Expected number for ${G}, got "${B}"`);
66
- return z;
67
- }
68
- if (J === "boolean")
69
- return B === "true" || B === "1";
70
- return B;
71
- }
72
- function I(B, J, G) {
73
- let z = `--${B}`;
74
- if (J.multiple && Array.isArray(G))
75
- return J.type === "boolean" ? G.filter((j) => typeof j === "boolean") : G.map((j) => _(j, J.type, z));
76
- if (J.type === "boolean") {
77
- if (typeof G === "boolean")
78
- return G;
79
- throw new W("PARSE", `Expected boolean value for flag "${z}", got ${typeof G}`);
80
- }
81
- if (typeof G === "string")
82
- return _(G, J.type, z);
83
- if (G === true)
84
- return J.default ?? undefined;
85
- return G;
86
- }
87
- function M(B, J, G) {
88
- let z = {};
89
- for (let j in B) {
90
- let H = J[j] ?? j;
91
- if (!(H in G))
92
- continue;
93
- let K = B[j], Q = z[H];
94
- if (Q !== undefined && Array.isArray(Q) && Array.isArray(K))
95
- Q.push(...K);
93
+ K[Q] = W;
94
+ }
95
+ return { options: K, aliasToName: z };
96
+ }
97
+ function F(H, K, z) {
98
+ if (K === "number") {
99
+ let $ = C(H);
100
+ if ($ === undefined)
101
+ throw new Y("PARSE", `Expected number for ${z}, got "${H}"`);
102
+ return $;
103
+ }
104
+ if (K === "boolean")
105
+ return G(H);
106
+ if (K === "url")
107
+ return R(H);
108
+ if (K === "path")
109
+ return J(H);
110
+ if (K === "json")
111
+ return O(H);
112
+ return H;
113
+ }
114
+ function I(H, K, z) {
115
+ if (!K.includes(H))
116
+ throw new Y("PARSE", `Invalid value "${H}" for ${z}. Expected one of: ${K.join(", ")}`);
117
+ }
118
+ function _(H, K, z, $) {
119
+ try {
120
+ return H(K);
121
+ } catch (Q) {
122
+ let Z = $ === undefined ? z : `${z} element [${$}]`, B = Q instanceof Error ? Q.message : String(Q);
123
+ throw new Y("PARSE", `Failed to parse ${Z}: ${B}`).withCause(Q);
124
+ }
125
+ }
126
+ function P(H, K) {
127
+ let { default: z, choices: $, parse: Q } = H;
128
+ if (z === undefined)
129
+ return;
130
+ if ($)
131
+ if (Array.isArray(z))
132
+ for (let Z of z)
133
+ I(String(Z), $, K);
96
134
  else
97
- z[H] = K;
135
+ I(String(z), $, K);
136
+ if (Q) {
137
+ if (Array.isArray(z))
138
+ return z.map((Z, B) => _(Q, String(Z), K, B));
139
+ return _(Q, String(z), K);
140
+ }
141
+ if (H.type === "path") {
142
+ if (Array.isArray(z))
143
+ return z.map((Z) => J(String(Z)));
144
+ return J(String(z));
98
145
  }
99
146
  return z;
100
147
  }
101
- function h(B, J, G) {
102
- if (!B)
148
+ function N(H, K) {
149
+ if (H)
150
+ for (let [z, $] of Object.entries(H)) {
151
+ let Q = $.parse;
152
+ if (Q && Q.constructor.name === "AsyncFunction")
153
+ throw new Y("CONFIG", `Async parse not supported for flag --${z}. Use a sync parser; do async work in run().`);
154
+ }
155
+ if (K)
156
+ for (let z of K) {
157
+ let $ = z.parse;
158
+ if ($ && $.constructor.name === "AsyncFunction")
159
+ throw new Y("CONFIG", `Async parse not supported for argument <${z.name}>. Use a sync parser; do async work in run().`);
160
+ }
161
+ }
162
+ function h(H, K, z) {
163
+ let $ = `--${H}`, Q = K.choices, Z = K.parse;
164
+ if (K.multiple && Array.isArray(z)) {
165
+ if (K.type === "boolean")
166
+ return z.filter((B) => typeof B === "boolean");
167
+ return z.map((B, W) => {
168
+ if (Q)
169
+ I(B, Q, $);
170
+ if (Z)
171
+ return _(Z, B, $, W);
172
+ return F(B, K.type, $);
173
+ });
174
+ }
175
+ if (K.type === "boolean") {
176
+ if (typeof z === "boolean")
177
+ return z;
178
+ throw new Y("PARSE", `Expected boolean value for flag "${$}", got ${typeof z}`);
179
+ }
180
+ if (typeof z === "string") {
181
+ if (Q)
182
+ I(z, Q, $);
183
+ if (Z)
184
+ return _(Z, z, $);
185
+ return F(z, K.type, $);
186
+ }
187
+ throw new Y("PARSE", `Internal: unexpected value shape for flag "${$}" (got ${typeof z})`);
188
+ }
189
+ function C2(H, K, z) {
190
+ let $ = {};
191
+ for (let Q in H) {
192
+ let Z = K[Q] ?? Q;
193
+ if (!(Z in z))
194
+ continue;
195
+ let B = H[Q], W = $[Z];
196
+ if (W !== undefined && Array.isArray(W) && Array.isArray(B))
197
+ W.push(...B);
198
+ else
199
+ $[Z] = B;
200
+ }
201
+ return $;
202
+ }
203
+ function V(H, K, z) {
204
+ if (!H)
103
205
  return {};
104
- let z = M(J, G, B), j = {};
105
- for (let [H, K] of Object.entries(B)) {
106
- let Q = z[H];
107
- if (Q !== undefined) {
108
- j[H] = I(H, K, Q);
206
+ let $ = C2(K, z, H), Q = {};
207
+ for (let [Z, B] of Object.entries(H)) {
208
+ let W = $[Z];
209
+ if (W !== undefined) {
210
+ Q[Z] = h(Z, B, W);
109
211
  continue;
110
212
  }
111
- j[H] = K.default ?? undefined;
213
+ Q[Z] = P(B, `--${Z}`);
112
214
  }
113
- return j;
215
+ return Q;
114
216
  }
115
- function O(B, J) {
116
- if (!B)
217
+ function D(H, K) {
218
+ if (!H)
117
219
  return;
118
- for (let [G, z] of Object.entries(B))
119
- if (z.required === true && z.default === undefined) {
120
- if (J[G] === undefined)
121
- throw new W("VALIDATION", `Missing required flag "--${G}"`);
220
+ for (let [z, $] of Object.entries(H))
221
+ if ($.required === true && $.default === undefined) {
222
+ if (K[z] === undefined)
223
+ throw new Y("VALIDATION", `Missing required flag "--${z}"`);
122
224
  }
123
225
  }
124
- function P(B, J) {
125
- if (!B)
226
+ function b(H, K) {
227
+ if (!H)
126
228
  return {};
127
- let G = {}, z = 0;
128
- for (let j of B) {
129
- let { name: H } = j;
130
- if (j.variadic) {
131
- let K = J.slice(z);
132
- G[H] = j.type === "string" ? K : K.map((Q) => _(Q, j.type, `<${H}>`)), z = J.length;
133
- } else if (z < J.length)
134
- G[H] = _(J[z], j.type, `<${H}>`), z++;
229
+ let z = {}, $ = 0;
230
+ for (let Q of H) {
231
+ let { name: Z } = Q, B = `<${Z}>`, W = Q.choices, X = Q.parse, G2 = (M, U) => {
232
+ if (W)
233
+ I(M, W, B);
234
+ if (X)
235
+ return _(X, M, B, U);
236
+ return Q.type === undefined ? M : F(M, Q.type, B);
237
+ };
238
+ if (Q.variadic) {
239
+ let M = K.slice($);
240
+ z[Z] = M.map((U, q) => G2(U, q)), $ = K.length;
241
+ } else if ($ < K.length)
242
+ z[Z] = G2(K[$]), $++;
135
243
  else
136
- G[H] = j.default ?? undefined;
244
+ z[Z] = P(Q, B);
137
245
  }
138
- return G;
246
+ return z;
139
247
  }
140
- function S(B, J, G) {
141
- if (!J)
248
+ function v(H, K, z) {
249
+ if (!K)
142
250
  return;
143
- for (let z of B) {
144
- if (z === "--")
251
+ for (let $ of H) {
252
+ if ($ === "--")
145
253
  return;
146
- if (!z.startsWith("--no-"))
254
+ if (!$.startsWith("--no-"))
147
255
  continue;
148
- let j = z.indexOf("="), H = j === -1 ? z.slice(5) : z.slice(5, j);
149
- if (!H)
256
+ let Q = $.indexOf("="), Z = Q === -1 ? $.slice(5) : $.slice(5, Q);
257
+ if (!Z)
150
258
  continue;
151
- let K = G[H];
152
- if (!K)
259
+ let B = z[Z];
260
+ if (!B)
153
261
  continue;
154
- if (K === H)
262
+ if (B === Z)
155
263
  continue;
156
- if (J[K]?.type !== "boolean")
264
+ if (K[B]?.type !== "boolean")
157
265
  continue;
158
- throw new W("PARSE", `Cannot negate alias "--no-${H}"; use "--no-${K}" instead`);
266
+ throw new Y("PARSE", `Cannot negate alias "--no-${Z}"; use "--no-${B}" instead`);
159
267
  }
160
268
  }
161
- function b(B, J) {
162
- let { args: G, effectiveFlags: z } = B, { options: j, aliasToName: H } = q(z);
163
- S(J, z, H);
164
- let K;
269
+ function S(H, K) {
270
+ let { args: z, effectiveFlags: $ } = H;
271
+ N($, z);
272
+ let { options: Q, aliasToName: Z } = w($);
273
+ v(K, $, Z);
274
+ let B;
165
275
  try {
166
- K = U({ args: J, options: j, strict: true, allowPositionals: true, allowNegative: true, tokens: true });
167
- } catch (Y) {
168
- if (Y instanceof Error) {
169
- let Z = Y.message.match(/Unknown option '(.+?)'/);
170
- if (Z)
171
- throw new W("PARSE", `Unknown flag "${Z[1]}"`).withCause(Y);
172
- }
173
- throw new W("PARSE", "Failed to parse command arguments").withCause(Y);
174
- }
175
- let Q = [], L = [];
176
- if (K.tokens) {
177
- let Y = false;
178
- for (let Z of K.tokens) {
179
- if (Z.kind === "option-terminator") {
180
- Y = true;
276
+ B = L({ args: K, options: Q, strict: true, allowPositionals: true, allowNegative: true, tokens: true });
277
+ } catch (U) {
278
+ if (U instanceof Error) {
279
+ let q = U.message.match(/Unknown option '(.+?)'/);
280
+ if (q)
281
+ throw new Y("PARSE", `Unknown flag "${q[1]}"`).withCause(U);
282
+ }
283
+ throw new Y("PARSE", "Failed to parse command arguments").withCause(U);
284
+ }
285
+ let W = [], X = [];
286
+ if (B.tokens) {
287
+ let U = false;
288
+ for (let q of B.tokens) {
289
+ if (q.kind === "option-terminator") {
290
+ U = true;
181
291
  continue;
182
292
  }
183
- if (Z.kind === "positional")
184
- (Y ? Q : L).push(Z.value ?? "");
293
+ if (q.kind === "positional")
294
+ (U ? W : X).push(q.value ?? "");
185
295
  }
186
296
  } else
187
- L.push(...K.positionals);
188
- let X = h(z, K.values, H);
189
- return { args: P(G, L), flags: X, rawArgs: Q };
190
- }
191
- function E(B, J) {
192
- let { args: G, effectiveFlags: z } = B, j = J.args, H = J.flags;
193
- if (G)
194
- for (let K of G) {
195
- let { name: Q } = K, L = `argument "<${Q}>"`, X = j[Q];
196
- if (K.required === true && K.default === undefined) {
197
- if (K.variadic) {
198
- if (!Array.isArray(X) || X.length === 0)
199
- throw new W("VALIDATION", `Missing required ${L}`);
200
- } else if (X === undefined)
201
- throw new W("VALIDATION", `Missing required ${L}`);
297
+ X.push(...B.positionals);
298
+ let G2 = V($, B.values, Z);
299
+ return { args: b(z, X), flags: G2, rawArgs: W };
300
+ }
301
+ function A(H, K) {
302
+ let { args: z, effectiveFlags: $ } = H, Q = K.args, Z = K.flags;
303
+ if (z)
304
+ for (let B of z) {
305
+ let { name: W } = B, X = `argument "<${W}>"`, G2 = Q[W];
306
+ if (B.required === true && B.default === undefined) {
307
+ if (B.variadic) {
308
+ if (!Array.isArray(G2) || G2.length === 0)
309
+ throw new Y("VALIDATION", `Missing required ${X}`);
310
+ } else if (G2 === undefined)
311
+ throw new Y("VALIDATION", `Missing required ${X}`);
202
312
  }
203
313
  }
204
- O(z, H);
205
- }
206
- var W;
207
- var init_chunk_vt64gs69 = __esm(() => {
208
- W = class W extends Error {
209
- code;
210
- details;
211
- cause;
212
- constructor(B, J, ...G) {
213
- super(J);
214
- this.name = "CrustError", this.code = B, this.details = G[0];
215
- }
216
- is(B) {
217
- return this.code === B;
218
- }
219
- withCause(B) {
220
- return this.cause = B, this;
314
+ D($, Z);
315
+ }
316
+ function p(H, K, z) {
317
+ if (typeof H !== "string" || H.length === 0)
318
+ throw new Y("DEFINITION", `Subcommand "${z}" has an invalid alias: must be a non-empty string`);
319
+ if (/\s/.test(H))
320
+ throw new Y("DEFINITION", `Subcommand "${z}" alias "${H}" must not contain whitespace`);
321
+ if (H.startsWith("-"))
322
+ throw new Y("DEFINITION", `Subcommand "${z}" alias "${H}" must not start with "-" (reserved for flags)`);
323
+ if (H === K)
324
+ throw new Y("DEFINITION", `Subcommand "${z}" alias "${H}" must not equal its own canonical name`);
325
+ }
326
+ function g(H, K, z) {
327
+ let { canonicalName: $, aliases: Q } = H;
328
+ if (Q) {
329
+ let Z = new Set;
330
+ for (let B of Q) {
331
+ if (p(B, $, z), Z.has(B))
332
+ throw new Y("DEFINITION", `Subcommand "${z}" lists alias "${B}" more than once`);
333
+ Z.add(B);
334
+ }
335
+ }
336
+ for (let [Z, B] of Object.entries(K)) {
337
+ let W = B.meta.aliases;
338
+ if (W?.includes($))
339
+ throw new Y("DEFINITION", `Subcommand "${z}" canonical name "${$}" collides with alias of sibling "${Z}"`);
340
+ if (!Q)
341
+ continue;
342
+ for (let X of Q) {
343
+ if (X === Z)
344
+ throw new Y("DEFINITION", `Subcommand "${z}" alias "${X}" collides with sibling canonical name "${Z}"`);
345
+ if (W?.includes(X))
346
+ throw new Y("DEFINITION", `Subcommand "${z}" alias "${X}" collides with alias of sibling "${Z}"`);
221
347
  }
222
- };
223
- });
224
-
225
- // ../../node_modules/.bun/@crustjs+core@0.0.16+7524df1edfed9f02/node_modules/@crustjs/core/dist/shared/chunk-5apf3vnv.js
226
- var exports_chunk_5apf3vnv = {};
227
- __export(exports_chunk_5apf3vnv, {
228
- validateCommandTree: () => _2
229
- });
230
- function M2(B) {
231
- switch (B.type) {
348
+ }
349
+ }
350
+ function j(H) {
351
+ let K = H.choices;
352
+ if (K !== undefined && K.length > 0)
353
+ return K[0];
354
+ switch (H.type) {
232
355
  case "number":
233
356
  return "1";
234
357
  case "boolean":
235
358
  return "true";
359
+ case "url":
360
+ return "https://example.com";
361
+ case "json":
362
+ return "null";
236
363
  default:
237
364
  return "sample";
238
365
  }
239
366
  }
240
- function X(B) {
241
- let z = [], K = B.effectiveFlags;
242
- for (let [j, G] of Object.entries(K)) {
243
- if (G.required !== true || G.default !== undefined)
367
+ function m(H) {
368
+ let K = [], z = H.effectiveFlags;
369
+ for (let [Q, Z] of Object.entries(z)) {
370
+ if (Z.required !== true || Z.default !== undefined)
244
371
  continue;
245
- if (z.push(`--${j}`), G.type !== "boolean")
246
- z.push(M2(G));
372
+ if (K.push(`--${Q}`), Z.type !== "boolean")
373
+ K.push(j(Z));
247
374
  }
248
- let J = B.args;
249
- if (J)
250
- for (let j of J) {
251
- if (j.required !== true || j.default !== undefined)
375
+ let $ = H.args;
376
+ if ($)
377
+ for (let Q of $) {
378
+ if (Q.required !== true || Q.default !== undefined)
252
379
  continue;
253
- z.push(M2(j));
380
+ K.push(j(Q));
254
381
  }
255
- return z;
382
+ return K;
256
383
  }
257
- function _2(B) {
258
- let z = [{ command: B, path: [B.meta.name] }], K = new Set;
259
- while (z.length > 0) {
260
- let J = z.pop();
261
- if (!J)
384
+ function Hz(H) {
385
+ let K = [{ command: H, path: [H.meta.name] }], z = new Set;
386
+ while (K.length > 0) {
387
+ let $ = K.pop();
388
+ if (!$)
262
389
  break;
263
- let { command: j, path: G } = J;
264
- if (K.has(j))
390
+ let { command: Q, path: Z } = $;
391
+ if (z.has(Q))
265
392
  continue;
266
- K.add(j);
393
+ z.add(Q);
267
394
  try {
268
- let H = b(j, X(j));
269
- E(j, H);
270
- } catch (H) {
271
- let L = H instanceof Error ? H.message : "Unknown validation error";
272
- throw new W("DEFINITION", `Command "${G.join(" ")}" failed runtime validation: ${L}`).withCause(H);
395
+ let W = S(Q, m(Q));
396
+ A(Q, W);
397
+ } catch (W) {
398
+ let X = W instanceof Error ? W.message : "Unknown validation error";
399
+ throw new Y("DEFINITION", `Command "${Z.join(" ")}" failed runtime validation: ${X}`).withCause(W);
400
+ }
401
+ let B = {};
402
+ for (let [W, X] of Object.entries(Q.subCommands))
403
+ g({ canonicalName: W, aliases: X.meta.aliases }, B, [...Z, W].join(" ")), B[W] = X;
404
+ for (let [W, X] of Object.entries(Q.subCommands))
405
+ K.push({ command: X, path: [...Z, W] });
406
+ }
407
+ }
408
+ var Y, E;
409
+ var init_chunk_q8y07jw2 = __esm(() => {
410
+ init_dist();
411
+ Y = class Y extends Error {
412
+ code;
413
+ details;
414
+ cause;
415
+ constructor(H, K, ...z) {
416
+ super(K);
417
+ this.name = "CrustError", this.code = H, this.details = z[0];
273
418
  }
274
- for (let [H, L] of Object.entries(j.subCommands))
275
- z.push({ command: L, path: [...G, H] });
276
- }
277
- }
278
- var init_chunk_5apf3vnv = __esm(() => {
279
- init_chunk_vt64gs69();
419
+ is(H) {
420
+ return this.code === H;
421
+ }
422
+ withCause(H) {
423
+ return this.cause = H, this;
424
+ }
425
+ };
426
+ E = new Set(["string", "number", "boolean", "url", "path", "json"]);
280
427
  });
281
428
 
282
- // ../../node_modules/.bun/@crustjs+core@0.0.16+7524df1edfed9f02/node_modules/@crustjs/core/dist/index.js
283
- init_chunk_vt64gs69();
284
- function T(j) {
285
- return { meta: { name: j }, localFlags: {}, effectiveFlags: {}, args: undefined, subCommands: {}, plugins: [], preRun: undefined, run: undefined, postRun: undefined };
286
- }
287
- function z(j, q2) {
288
- let J = {};
289
- for (let [Q, $] of Object.entries(j))
290
- if ($.inherit === true)
291
- J[Q] = $;
292
- for (let [Q, $] of Object.entries(q2))
293
- J[Q] = $;
294
- return J;
295
- }
296
- function D(j, q2) {
297
- let J = [j.meta.name], Q = j, $ = q2;
298
- while ($.length > 0) {
299
- let K = Q.subCommands;
300
- if (!K || Object.keys(K).length === 0)
429
+ // ../../node_modules/.bun/@crustjs+core@0.0.19+328ed37f40d3034a/node_modules/@crustjs/core/dist/shared/chunk-1670njz2.js
430
+ var exports_chunk_1670njz2 = {};
431
+ __export(exports_chunk_1670njz2, {
432
+ validateIncomingAliases: () => g,
433
+ validateCommandTree: () => Hz,
434
+ validateAliasString: () => p
435
+ });
436
+ var init_chunk_1670njz2 = __esm(() => {
437
+ init_chunk_q8y07jw2();
438
+ });
439
+
440
+ // ../../node_modules/.bun/@crustjs+core@0.0.19+328ed37f40d3034a/node_modules/@crustjs/core/dist/index.js
441
+ init_chunk_q8y07jw2();
442
+ function P2(j2) {
443
+ return { meta: { name: j2 }, localFlags: {}, effectiveFlags: {}, args: undefined, subCommands: {}, plugins: [], preRun: undefined, run: undefined, postRun: undefined };
444
+ }
445
+ function X(j2, J2) {
446
+ let q = {};
447
+ for (let [Q, Z] of Object.entries(j2))
448
+ if (Z.inherit === true)
449
+ q[Q] = Z;
450
+ for (let [Q, Z] of Object.entries(J2))
451
+ q[Q] = Z;
452
+ return q;
453
+ }
454
+ function E2(j2, J2) {
455
+ for (let [q, Q] of Object.entries(j2)) {
456
+ let Z = Q.meta.aliases;
457
+ if (!Z)
458
+ continue;
459
+ if (Z.includes(J2))
460
+ return { canonicalName: q, node: Q };
461
+ }
462
+ return null;
463
+ }
464
+ function D2(j2, J2) {
465
+ let q = [j2.meta.name], Q = j2, Z = J2;
466
+ while (Z.length > 0) {
467
+ let $ = Q.subCommands;
468
+ if (!$ || Object.keys($).length === 0)
301
469
  break;
302
- let Z = $[0];
303
- if (!Z || Z.startsWith("-"))
470
+ let G2 = Z[0];
471
+ if (!G2 || G2.startsWith("-"))
304
472
  break;
305
- if (Z in K && K[Z]) {
306
- Q = K[Z], J.push(Z), $ = $.slice(1);
473
+ if (G2 in $ && $[G2]) {
474
+ Q = $[G2], q.push(G2), Z = Z.slice(1);
475
+ continue;
476
+ }
477
+ let H = E2($, G2);
478
+ if (H) {
479
+ Q = H.node, q.push(H.canonicalName), Z = Z.slice(1);
307
480
  continue;
308
481
  }
309
482
  if (Q.run)
310
483
  break;
311
- let H = Object.keys(K);
312
- throw new W("COMMAND_NOT_FOUND", `Unknown command "${Z}".`, { input: Z, available: H, commandPath: [...J], parentCommand: Q });
484
+ throw new Y("COMMAND_NOT_FOUND", `Unknown command "${G2}".`, { input: G2, available: Object.keys($), commandPath: [...q], parentCommand: Q });
313
485
  }
314
- return { command: Q, argv: $, commandPath: J };
486
+ return { command: Q, argv: Z, commandPath: q };
315
487
  }
316
- function N(j) {
317
- for (let [q2, J] of Object.entries(j)) {
318
- if (q2.startsWith("no-")) {
319
- let Q = q2.slice(3);
320
- throw new W("DEFINITION", `Flag "--${q2}" must not use "no-" prefix; define "${Q}" and negate with "--no-${Q}"`);
488
+ function f2(j2) {
489
+ for (let [J2, q] of Object.entries(j2)) {
490
+ if (J2.startsWith("no-")) {
491
+ let Q = J2.slice(3);
492
+ throw new Y("DEFINITION", `Flag "--${J2}" must not use "no-" prefix; define "${Q}" and negate with "--no-${Q}"`);
321
493
  }
322
- if (J.short?.startsWith("no-"))
323
- throw new W("DEFINITION", `Short alias "-${J.short}" on "--${q2}" must not use "no-" prefix (reserved for negation)`);
324
- if (J.aliases) {
325
- for (let Q of J.aliases)
494
+ if (q.short?.startsWith("no-"))
495
+ throw new Y("DEFINITION", `Short alias "-${q.short}" on "--${J2}" must not use "no-" prefix (reserved for negation)`);
496
+ if (q.aliases) {
497
+ for (let Q of q.aliases)
326
498
  if (Q.startsWith("no-"))
327
- throw new W("DEFINITION", `Alias "--${Q}" on "--${q2}" must not use "no-" prefix (reserved for negation)`);
328
- }
329
- }
330
- }
331
- var w = "CRUST_INTERNAL_VALIDATE_ONLY";
332
- var P2 = 130;
333
- var v = "__CRUST_VALIDATE_RESULT__";
334
- function x() {
335
- let j = new Map;
336
- return { get(q2) {
337
- return j.get(q2);
338
- }, has(q2) {
339
- return j.has(q2);
340
- }, set(q2, J) {
341
- j.set(q2, J);
342
- }, delete(q2) {
343
- return j.delete(q2);
499
+ throw new Y("DEFINITION", `Alias "--${Q}" on "--${J2}" must not use "no-" prefix (reserved for negation)`);
500
+ }
501
+ }
502
+ }
503
+ var N2 = "CRUST_INTERNAL_VALIDATE_ONLY";
504
+ var b2 = "CRUST_INTERNAL_VALIDATE_FORCE_EXIT";
505
+ var x = 130;
506
+ var C3 = "__CRUST_VALIDATE_RESULT__";
507
+ function k2() {
508
+ let j2 = new Map;
509
+ return { get(J2) {
510
+ return j2.get(J2);
511
+ }, has(J2) {
512
+ return j2.has(J2);
513
+ }, set(J2, q) {
514
+ j2.set(J2, q);
515
+ }, delete(J2) {
516
+ return j2.delete(J2);
344
517
  } };
345
518
  }
346
- function B(j) {
347
- if (!(j instanceof Error))
519
+ function L2(j2) {
520
+ if (!(j2 instanceof Error))
348
521
  return false;
349
- return j.name === "CancelledError";
350
- }
351
- function b2(j, q2) {
352
- j.effectiveFlags = z(q2, j.localFlags);
353
- for (let J of Object.values(j.subCommands))
354
- b2(J, j.effectiveFlags);
355
- }
356
- function y(j) {
357
- return { addFlag(q2, J, Q) {
358
- if (J in q2.effectiveFlags)
359
- j?.push(`Plugin flag "--${J}" on "${q2.meta.name}" overrides existing flag`);
360
- q2.effectiveFlags[J] = Q;
361
- }, addSubCommand(q2, J, Q) {
362
- if (!J.trim())
363
- throw new W("DEFINITION", "addSubCommand: name must be a non-empty string");
364
- if (q2.subCommands[J]) {
365
- j?.push(`Plugin subcommand "${J}" on "${q2.meta.name}" skipped (already exists)`);
522
+ return j2.name === "CancelledError";
523
+ }
524
+ function h2(j2, J2) {
525
+ j2.effectiveFlags = X(J2, j2.localFlags);
526
+ for (let q of Object.values(j2.subCommands))
527
+ h2(q, j2.effectiveFlags);
528
+ }
529
+ function y(j2) {
530
+ return { addFlag(J2, q, Q) {
531
+ if (q in J2.effectiveFlags)
532
+ j2?.push(`Plugin flag "--${q}" on "${J2.meta.name}" overrides existing flag`);
533
+ J2.effectiveFlags[q] = Q;
534
+ }, addSubCommand(J2, q, Q) {
535
+ if (!q.trim())
536
+ throw new Y("DEFINITION", "addSubCommand: name must be a non-empty string");
537
+ if (J2.subCommands[q]) {
538
+ j2?.push(`Plugin subcommand "${q}" on "${J2.meta.name}" skipped (already exists)`);
539
+ return;
540
+ }
541
+ try {
542
+ g({ canonicalName: q, aliases: Q.meta.aliases }, J2.subCommands, q);
543
+ } catch (Z) {
544
+ let $ = Z instanceof Error ? Z.message : String(Z);
545
+ j2?.push(`Plugin subcommand "${q}" on "${J2.meta.name}" skipped: ${$}`);
366
546
  return;
367
547
  }
368
- b2(Q, q2.effectiveFlags), q2.subCommands[J] = Q;
548
+ h2(Q, J2.effectiveFlags), J2.subCommands[q] = Q;
369
549
  } };
370
550
  }
371
- async function A2(j, q2, J) {
372
- for (let Q of j) {
551
+ async function F2(j2, J2, q) {
552
+ for (let Q of j2) {
373
553
  if (!Q.setup)
374
554
  continue;
375
- await Q.setup(q2, J);
555
+ await Q.setup(J2, q);
376
556
  }
377
557
  }
378
- async function F(j, q2, J) {
379
- let Q = j.map((Z) => Z.middleware).filter((Z) => Boolean(Z)), $ = -1, K = async (Z) => {
380
- if (Z <= $)
381
- throw new W("DEFINITION", "Plugin middleware called next() multiple times");
382
- if ($ = Z, Z === Q.length) {
383
- await J();
558
+ async function A2(j2, J2, q) {
559
+ let Q = j2.map((G2) => G2.middleware).filter((G2) => Boolean(G2)), Z = -1, $ = async (G2) => {
560
+ if (G2 <= Z)
561
+ throw new Y("DEFINITION", "Plugin middleware called next() multiple times");
562
+ if (Z = G2, G2 === Q.length) {
563
+ await q();
384
564
  return;
385
565
  }
386
- let H = Q[Z];
566
+ let H = Q[G2];
387
567
  if (!H)
388
- throw new W("DEFINITION", "Plugin middleware stack is invalid");
389
- await H(q2, () => K(Z + 1));
568
+ throw new Y("DEFINITION", "Plugin middleware stack is invalid");
569
+ await H(J2, () => $(G2 + 1));
390
570
  };
391
- await K(0);
392
- }
393
- function I2(j) {
394
- let q2 = [...j.plugins];
395
- for (let J of Object.values(j.subCommands))
396
- q2.push(...I2(J));
397
- return q2;
398
- }
399
- function k(j) {
400
- let q2 = {};
401
- for (let [J, Q] of Object.entries(j))
402
- q2[J] = { ...Q, aliases: Q.aliases ? [...Q.aliases] : undefined };
403
- return q2;
404
- }
405
- function h2(j) {
406
- let q2 = {};
407
- for (let [J, Q] of Object.entries(j.subCommands))
408
- q2[J] = h2(Q);
409
- return { meta: { ...j.meta }, localFlags: k(j.localFlags), effectiveFlags: k(j.effectiveFlags), args: j.args ? j.args.map((J) => ({ ...J })) : undefined, subCommands: q2, plugins: [...j.plugins], preRun: j.preRun, run: j.run, postRun: j.postRun };
410
- }
411
- function _3(j) {
412
- if (Object.freeze(j), Object.freeze(j.localFlags), Object.freeze(j.effectiveFlags), Object.freeze(j.meta), Object.freeze(j.plugins), j.args)
413
- Object.freeze(j.args);
414
- for (let q2 of Object.values(j.subCommands))
415
- _3(q2);
416
- Object.freeze(j.subCommands);
571
+ await $(0);
572
+ }
573
+ function S2(j2) {
574
+ let J2 = [...j2.plugins];
575
+ for (let q of Object.values(j2.subCommands))
576
+ J2.push(...S2(q));
577
+ return J2;
578
+ }
579
+ function w2(j2) {
580
+ let J2 = {};
581
+ for (let [q, Q] of Object.entries(j2))
582
+ J2[q] = { ...Q, aliases: Q.aliases ? [...Q.aliases] : undefined };
583
+ return J2;
584
+ }
585
+ function v2(j2) {
586
+ let J2 = {};
587
+ for (let [q, Q] of Object.entries(j2.subCommands))
588
+ J2[q] = v2(Q);
589
+ return { meta: { ...j2.meta }, localFlags: w2(j2.localFlags), effectiveFlags: w2(j2.effectiveFlags), args: j2.args ? j2.args.map((q) => ({ ...q })) : undefined, subCommands: J2, plugins: [...j2.plugins], preRun: j2.preRun, run: j2.run, postRun: j2.postRun };
590
+ }
591
+ function _2(j2) {
592
+ if (Object.freeze(j2), Object.freeze(j2.localFlags), Object.freeze(j2.effectiveFlags), Object.freeze(j2.meta), Object.freeze(j2.plugins), j2.args)
593
+ Object.freeze(j2.args);
594
+ for (let J2 of Object.values(j2.subCommands))
595
+ _2(J2);
596
+ Object.freeze(j2.subCommands);
417
597
  }
418
598
 
419
- class R {
599
+ class M {
420
600
  _node;
421
601
  _inheritedFlags;
422
- constructor(j) {
423
- if (!j.trim())
424
- throw new W("DEFINITION", "meta.name must be a non-empty string");
425
- this._node = T(j), this._inheritedFlags = {};
426
- }
427
- static _createChild(j, q2) {
428
- let J = new R(j);
429
- return J._inheritedFlags = q2, J;
430
- }
431
- _clone(j) {
432
- let q2 = Object.create(Object.getPrototypeOf(this)), J = { ...this._node, localFlags: { ...this._node.localFlags }, effectiveFlags: { ...this._node.effectiveFlags }, subCommands: { ...this._node.subCommands }, plugins: [...this._node.plugins], meta: { ...this._node.meta }, args: this._node.args ? [...this._node.args] : undefined, ...j };
433
- return q2._node = J, q2._inheritedFlags = this._inheritedFlags, q2;
434
- }
435
- meta(j) {
436
- return this._clone({ meta: { ...this._node.meta, ...j } });
437
- }
438
- flags(j) {
439
- N(j);
440
- let q2 = {};
441
- for (let [J, Q] of Object.entries(j))
442
- q2[J] = { ...Q };
443
- return this._clone({ localFlags: q2, effectiveFlags: z(this._inheritedFlags, q2) });
444
- }
445
- args(j) {
446
- let q2 = j.map((J) => ({ ...J }));
447
- return this._clone({ args: q2 });
448
- }
449
- run(j) {
450
- return this._clone({ run: j });
451
- }
452
- preRun(j) {
453
- return this._clone({ preRun: j });
454
- }
455
- postRun(j) {
456
- return this._clone({ postRun: j });
457
- }
458
- use(j) {
459
- return this._clone({ plugins: [...this._node.plugins, j] });
460
- }
461
- sub(j) {
462
- if (!j.trim())
463
- throw new W("DEFINITION", "Subcommand name must be a non-empty string");
464
- let q2 = z(this._inheritedFlags, this._node.localFlags);
465
- return R._createChild(j, q2);
466
- }
467
- command(j, q2) {
468
- if (typeof j === "string") {
469
- let K = j;
470
- if (!q2)
471
- throw new W("DEFINITION", "command(name, cb) requires a callback");
472
- if (!K.trim())
473
- throw new W("DEFINITION", "Subcommand name must be a non-empty string");
474
- if (this._node.subCommands[K])
475
- throw new W("DEFINITION", `Subcommand "${K}" is already registered`);
476
- let Z = z(this._inheritedFlags, this._node.localFlags), H = R._createChild(K, Z), X2 = q2(H), W2 = { ...X2._node, effectiveFlags: z(X2._inheritedFlags, X2._node.localFlags) };
477
- return this._clone({ subCommands: { ...this._node.subCommands, [K]: W2 } });
478
- }
479
- let J = j, Q = J._node.meta.name;
602
+ constructor(j2) {
603
+ if (!j2.trim())
604
+ throw new Y("DEFINITION", "meta.name must be a non-empty string");
605
+ this._node = P2(j2), this._inheritedFlags = {};
606
+ }
607
+ static _createChild(j2, J2) {
608
+ let q = new M(j2);
609
+ return q._inheritedFlags = J2, q;
610
+ }
611
+ _clone(j2) {
612
+ let J2 = Object.create(Object.getPrototypeOf(this)), q = { ...this._node, localFlags: { ...this._node.localFlags }, effectiveFlags: { ...this._node.effectiveFlags }, subCommands: { ...this._node.subCommands }, plugins: [...this._node.plugins], meta: { ...this._node.meta }, args: this._node.args ? [...this._node.args] : undefined, ...j2 };
613
+ return J2._node = q, J2._inheritedFlags = this._inheritedFlags, J2;
614
+ }
615
+ meta(j2) {
616
+ return this._clone({ meta: { ...this._node.meta, ...j2 } });
617
+ }
618
+ flags(j2) {
619
+ f2(j2);
620
+ let J2 = {};
621
+ for (let [q, Q] of Object.entries(j2))
622
+ J2[q] = { ...Q };
623
+ return this._clone({ localFlags: J2, effectiveFlags: X(this._inheritedFlags, J2) });
624
+ }
625
+ args(j2) {
626
+ let J2 = j2.map((q) => ({ ...q }));
627
+ return this._clone({ args: J2 });
628
+ }
629
+ run(j2) {
630
+ return this._clone({ run: j2 });
631
+ }
632
+ preRun(j2) {
633
+ return this._clone({ preRun: j2 });
634
+ }
635
+ postRun(j2) {
636
+ return this._clone({ postRun: j2 });
637
+ }
638
+ use(j2) {
639
+ return this._clone({ plugins: [...this._node.plugins, j2] });
640
+ }
641
+ sub(j2) {
642
+ if (!j2.trim())
643
+ throw new Y("DEFINITION", "Subcommand name must be a non-empty string");
644
+ let J2 = X(this._inheritedFlags, this._node.localFlags);
645
+ return M._createChild(j2, J2);
646
+ }
647
+ command(j2, J2) {
648
+ if (typeof j2 === "string") {
649
+ let $ = j2;
650
+ if (!J2)
651
+ throw new Y("DEFINITION", "command(name, cb) requires a callback");
652
+ if (!$.trim())
653
+ throw new Y("DEFINITION", "Subcommand name must be a non-empty string");
654
+ if (this._node.subCommands[$])
655
+ throw new Y("DEFINITION", `Subcommand "${$}" is already registered`);
656
+ let G2 = X(this._inheritedFlags, this._node.localFlags), H = M._createChild($, G2), z = J2(H);
657
+ g({ canonicalName: $, aliases: z._node.meta.aliases }, this._node.subCommands, $);
658
+ let W = { ...z._node, effectiveFlags: X(z._inheritedFlags, z._node.localFlags) };
659
+ return this._clone({ subCommands: { ...this._node.subCommands, [$]: W } });
660
+ }
661
+ let q = j2, Q = q._node.meta.name;
480
662
  if (!Q.trim())
481
- throw new W("DEFINITION", "Subcommand name must be a non-empty string");
663
+ throw new Y("DEFINITION", "Subcommand name must be a non-empty string");
482
664
  if (this._node.subCommands[Q])
483
- throw new W("DEFINITION", `Subcommand "${Q}" is already registered`);
484
- let $ = { ...J._node, effectiveFlags: z(J._inheritedFlags, J._node.localFlags) };
485
- return this._clone({ subCommands: { ...this._node.subCommands, [Q]: $ } });
665
+ throw new Y("DEFINITION", `Subcommand "${Q}" is already registered`);
666
+ g({ canonicalName: Q, aliases: q._node.meta.aliases }, this._node.subCommands, Q);
667
+ let Z = { ...q._node, effectiveFlags: X(q._inheritedFlags, q._node.localFlags) };
668
+ return this._clone({ subCommands: { ...this._node.subCommands, [Q]: Z } });
486
669
  }
487
- async prepareCommandTree(j) {
488
- let q2 = j?.argv ?? [], J = h2(this._node), Q = I2(J), $ = [], K = x(), Z = { argv: [...q2], rootCommand: J, state: K }, H = y($);
670
+ async prepareCommandTree(j2) {
671
+ let J2 = j2?.argv ?? [], q = v2(this._node), Q = S2(q), Z = [], $ = k2(), G2 = { argv: [...J2], rootCommand: q, state: $ }, H = y(Z);
489
672
  try {
490
- await A2(Q, Z, H);
491
- } catch (W2) {
492
- if (B(W2))
493
- throw W2;
494
- if (W2 instanceof W)
495
- throw W2;
496
- if (W2 instanceof Error)
497
- throw W2;
498
- throw new W("DEFINITION", String(W2));
499
- }
500
- _3(J);
501
- let { validateCommandTree: X2 } = await Promise.resolve().then(() => (init_chunk_5apf3vnv(), exports_chunk_5apf3vnv));
502
- return X2(J), { root: J, warnings: $ };
503
- }
504
- async execute(j) {
505
- let q2 = j?.argv ?? process.argv.slice(2), J = this._node, Q = I2(J), $ = [], K = x(), Z = { argv: [...q2], rootCommand: J, state: K }, H = y($);
673
+ await F2(Q, G2, H);
674
+ } catch (W) {
675
+ if (L2(W))
676
+ throw W;
677
+ if (W instanceof Y)
678
+ throw W;
679
+ if (W instanceof Error)
680
+ throw W;
681
+ throw new Y("DEFINITION", String(W));
682
+ }
683
+ _2(q);
684
+ let { validateCommandTree: z } = await Promise.resolve().then(() => (init_chunk_1670njz2(), exports_chunk_1670njz2));
685
+ return z(q), { root: q, warnings: Z };
686
+ }
687
+ async execute(j2) {
688
+ let J2 = j2?.argv ?? process.argv.slice(2), q = this._node, Q = S2(q), Z = [], $ = k2(), G2 = { argv: [...J2], rootCommand: q, state: $ }, H = y(Z);
506
689
  try {
507
- await A2(Q, Z, H);
508
- } catch (W2) {
509
- if (B(W2)) {
510
- process.exitCode = P2;
690
+ await F2(Q, G2, H);
691
+ } catch (W) {
692
+ if (L2(W)) {
693
+ process.exitCode = x;
511
694
  return;
512
695
  }
513
- if (W2 instanceof W) {
514
- console.error(`Error: ${W2.message}`), process.exitCode = 1;
696
+ if (W instanceof Y) {
697
+ console.error(`Error: ${W.message}`), process.exitCode = 1;
515
698
  return;
516
699
  }
517
- let U2 = W2 instanceof Error ? W2.message : String(W2);
518
- console.error(`Error: ${U2}`), process.exitCode = 1;
700
+ let U = W instanceof Error ? W.message : String(W);
701
+ console.error(`Error: ${U}`), process.exitCode = 1;
519
702
  return;
520
703
  }
521
- if (_3(J), process.env[w] === "1") {
522
- let W2 = (async () => {
704
+ if (_2(q), process.env[N2] === "1") {
705
+ let W = (async () => {
523
706
  try {
524
- let { validateCommandTree: U2 } = await Promise.resolve().then(() => (init_chunk_5apf3vnv(), exports_chunk_5apf3vnv));
525
- U2(J);
526
- for (let Y of $)
527
- console.warn(`Warning: ${Y}`);
707
+ let { validateCommandTree: U } = await Promise.resolve().then(() => (init_chunk_1670njz2(), exports_chunk_1670njz2));
708
+ U(q);
709
+ for (let Y2 of Z)
710
+ console.warn(`Warning: ${Y2}`);
528
711
  return { ok: true };
529
- } catch (U2) {
530
- let Y = U2 instanceof Error ? U2.message : String(U2);
531
- return console.error(Y), process.exitCode = 1, { ok: false, error: U2 };
712
+ } catch (U) {
713
+ let Y2 = U instanceof Error ? U.message : String(U);
714
+ return console.error(Y2), process.exitCode = 1, { ok: false, error: U };
532
715
  }
533
716
  })();
534
- return globalThis[v] = W2, await W2, process.exit(process.exitCode ?? 0);
717
+ if (globalThis[C3] = W, await W, process.env[b2] === "1")
718
+ return process.exit(process.exitCode ?? 0);
719
+ return;
535
720
  }
536
- for (let W2 of $)
537
- console.warn(`Warning: ${W2}`);
538
- let X2 = { argv: [...q2], rootCommand: J, state: K, route: null, input: null };
721
+ for (let W of Z)
722
+ console.warn(`Warning: ${W}`);
723
+ let z = { argv: [...J2], rootCommand: q, state: $, route: null, input: null };
539
724
  try {
540
- let W2, U2;
725
+ let W, U;
541
726
  try {
542
- let Y = D(J, [...q2]);
543
- X2.route = Y, W2 = Y.command, U2 = b(W2, Y.argv), X2.input = U2;
544
- } catch (Y) {
545
- await F(Q, X2, async () => {
546
- throw Y;
727
+ let Y2 = D2(q, [...J2]);
728
+ z.route = Y2, W = Y2.command, U = S(W, Y2.argv), z.input = U;
729
+ } catch (Y2) {
730
+ await A2(Q, z, async () => {
731
+ throw Y2;
547
732
  });
548
733
  return;
549
734
  }
550
- await F(Q, X2, async () => {
551
- if (E(W2, U2), !W2.run)
735
+ await A2(Q, z, async () => {
736
+ if (A(W, U), !W.run)
552
737
  return;
553
- let Y = { args: U2.args, flags: U2.flags, rawArgs: U2.rawArgs, command: W2 }, V;
738
+ let Y2 = { args: U.args, flags: U.flags, rawArgs: U.rawArgs, command: W }, R2;
554
739
  try {
555
- if (W2.preRun)
556
- await W2.preRun(Y);
557
- await W2.run(Y);
558
- } catch (M3) {
559
- V = M3;
740
+ if (W.preRun)
741
+ await W.preRun(Y2);
742
+ await W.run(Y2);
743
+ } catch (V2) {
744
+ R2 = V2;
560
745
  }
561
- if (W2.postRun)
746
+ if (W.postRun)
562
747
  try {
563
- await W2.postRun(Y);
564
- } catch (M3) {
565
- if (!V)
566
- V = M3;
748
+ await W.postRun(Y2);
749
+ } catch (V2) {
750
+ if (!R2)
751
+ R2 = V2;
567
752
  else
568
- console.error(`Error in postRun: ${M3 instanceof Error ? M3.message : String(M3)}`);
753
+ console.error(`Error in postRun: ${V2 instanceof Error ? V2.message : String(V2)}`);
569
754
  }
570
- if (V)
571
- throw V;
755
+ if (R2)
756
+ throw R2;
572
757
  });
573
- } catch (W2) {
574
- if (B(W2)) {
575
- process.exitCode = P2;
758
+ } catch (W) {
759
+ if (L2(W)) {
760
+ process.exitCode = x;
576
761
  return;
577
762
  }
578
- if (W2 instanceof W) {
579
- console.error(`Error: ${W2.message}`), process.exitCode = 1;
763
+ if (W instanceof Y) {
764
+ console.error(`Error: ${W.message}`), process.exitCode = 1;
580
765
  return;
581
766
  }
582
- if (W2 instanceof Error) {
583
- let U2 = new W("EXECUTION", W2.message).withCause(W2);
584
- console.error(`Error: ${U2.message}`), process.exitCode = 1;
767
+ if (W instanceof Error) {
768
+ let U = new Y("EXECUTION", W.message).withCause(W);
769
+ console.error(`Error: ${U.message}`), process.exitCode = 1;
585
770
  return;
586
771
  }
587
- console.error(`Error: ${String(W2)}`), process.exitCode = 1;
772
+ console.error(`Error: ${String(W)}`), process.exitCode = 1;
588
773
  }
589
774
  }
590
775
  }
591
776
 
592
- // ../../node_modules/.bun/@crustjs+core@0.0.16+7524df1edfed9f02/node_modules/@crustjs/core/dist/index.js
593
- init_chunk_vt64gs69();
594
- function T2(j) {
595
- return { meta: { name: j }, localFlags: {}, effectiveFlags: {}, args: undefined, subCommands: {}, plugins: [], preRun: undefined, run: undefined, postRun: undefined };
596
- }
597
- function z2(j, q2) {
598
- let J = {};
599
- for (let [Q, $] of Object.entries(j))
600
- if ($.inherit === true)
601
- J[Q] = $;
602
- for (let [Q, $] of Object.entries(q2))
603
- J[Q] = $;
604
- return J;
605
- }
606
- function D2(j, q2) {
607
- let J = [j.meta.name], Q = j, $ = q2;
608
- while ($.length > 0) {
609
- let K = Q.subCommands;
610
- if (!K || Object.keys(K).length === 0)
777
+ // ../../node_modules/.bun/@crustjs+core@0.0.19+328ed37f40d3034a/node_modules/@crustjs/core/dist/index.js
778
+ init_chunk_q8y07jw2();
779
+ function P3(j2) {
780
+ return { meta: { name: j2 }, localFlags: {}, effectiveFlags: {}, args: undefined, subCommands: {}, plugins: [], preRun: undefined, run: undefined, postRun: undefined };
781
+ }
782
+ function X2(j2, J2) {
783
+ let q = {};
784
+ for (let [Q, Z] of Object.entries(j2))
785
+ if (Z.inherit === true)
786
+ q[Q] = Z;
787
+ for (let [Q, Z] of Object.entries(J2))
788
+ q[Q] = Z;
789
+ return q;
790
+ }
791
+ function E3(j2, J2) {
792
+ for (let [q, Q] of Object.entries(j2)) {
793
+ let Z = Q.meta.aliases;
794
+ if (!Z)
795
+ continue;
796
+ if (Z.includes(J2))
797
+ return { canonicalName: q, node: Q };
798
+ }
799
+ return null;
800
+ }
801
+ function D3(j2, J2) {
802
+ let q = [j2.meta.name], Q = j2, Z = J2;
803
+ while (Z.length > 0) {
804
+ let $ = Q.subCommands;
805
+ if (!$ || Object.keys($).length === 0)
611
806
  break;
612
- let Z = $[0];
613
- if (!Z || Z.startsWith("-"))
807
+ let G2 = Z[0];
808
+ if (!G2 || G2.startsWith("-"))
614
809
  break;
615
- if (Z in K && K[Z]) {
616
- Q = K[Z], J.push(Z), $ = $.slice(1);
810
+ if (G2 in $ && $[G2]) {
811
+ Q = $[G2], q.push(G2), Z = Z.slice(1);
812
+ continue;
813
+ }
814
+ let H = E3($, G2);
815
+ if (H) {
816
+ Q = H.node, q.push(H.canonicalName), Z = Z.slice(1);
617
817
  continue;
618
818
  }
619
819
  if (Q.run)
620
820
  break;
621
- let H = Object.keys(K);
622
- throw new W("COMMAND_NOT_FOUND", `Unknown command "${Z}".`, { input: Z, available: H, commandPath: [...J], parentCommand: Q });
821
+ throw new Y("COMMAND_NOT_FOUND", `Unknown command "${G2}".`, { input: G2, available: Object.keys($), commandPath: [...q], parentCommand: Q });
623
822
  }
624
- return { command: Q, argv: $, commandPath: J };
823
+ return { command: Q, argv: Z, commandPath: q };
625
824
  }
626
- function N2(j) {
627
- for (let [q2, J] of Object.entries(j)) {
628
- if (q2.startsWith("no-")) {
629
- let Q = q2.slice(3);
630
- throw new W("DEFINITION", `Flag "--${q2}" must not use "no-" prefix; define "${Q}" and negate with "--no-${Q}"`);
825
+ function f3(j2) {
826
+ for (let [J2, q] of Object.entries(j2)) {
827
+ if (J2.startsWith("no-")) {
828
+ let Q = J2.slice(3);
829
+ throw new Y("DEFINITION", `Flag "--${J2}" must not use "no-" prefix; define "${Q}" and negate with "--no-${Q}"`);
631
830
  }
632
- if (J.short?.startsWith("no-"))
633
- throw new W("DEFINITION", `Short alias "-${J.short}" on "--${q2}" must not use "no-" prefix (reserved for negation)`);
634
- if (J.aliases) {
635
- for (let Q of J.aliases)
831
+ if (q.short?.startsWith("no-"))
832
+ throw new Y("DEFINITION", `Short alias "-${q.short}" on "--${J2}" must not use "no-" prefix (reserved for negation)`);
833
+ if (q.aliases) {
834
+ for (let Q of q.aliases)
636
835
  if (Q.startsWith("no-"))
637
- throw new W("DEFINITION", `Alias "--${Q}" on "--${q2}" must not use "no-" prefix (reserved for negation)`);
638
- }
639
- }
640
- }
641
- var w2 = "CRUST_INTERNAL_VALIDATE_ONLY";
642
- var P3 = 130;
643
- var v2 = "__CRUST_VALIDATE_RESULT__";
644
- function x2() {
645
- let j = new Map;
646
- return { get(q2) {
647
- return j.get(q2);
648
- }, has(q2) {
649
- return j.has(q2);
650
- }, set(q2, J) {
651
- j.set(q2, J);
652
- }, delete(q2) {
653
- return j.delete(q2);
836
+ throw new Y("DEFINITION", `Alias "--${Q}" on "--${J2}" must not use "no-" prefix (reserved for negation)`);
837
+ }
838
+ }
839
+ }
840
+ var N3 = "CRUST_INTERNAL_VALIDATE_ONLY";
841
+ var b3 = "CRUST_INTERNAL_VALIDATE_FORCE_EXIT";
842
+ var x2 = 130;
843
+ var C4 = "__CRUST_VALIDATE_RESULT__";
844
+ function k3() {
845
+ let j2 = new Map;
846
+ return { get(J2) {
847
+ return j2.get(J2);
848
+ }, has(J2) {
849
+ return j2.has(J2);
850
+ }, set(J2, q) {
851
+ j2.set(J2, q);
852
+ }, delete(J2) {
853
+ return j2.delete(J2);
654
854
  } };
655
855
  }
656
- function B2(j) {
657
- if (!(j instanceof Error))
856
+ function L3(j2) {
857
+ if (!(j2 instanceof Error))
658
858
  return false;
659
- return j.name === "CancelledError";
660
- }
661
- function b3(j, q2) {
662
- j.effectiveFlags = z2(q2, j.localFlags);
663
- for (let J of Object.values(j.subCommands))
664
- b3(J, j.effectiveFlags);
665
- }
666
- function y2(j) {
667
- return { addFlag(q2, J, Q) {
668
- if (J in q2.effectiveFlags)
669
- j?.push(`Plugin flag "--${J}" on "${q2.meta.name}" overrides existing flag`);
670
- q2.effectiveFlags[J] = Q;
671
- }, addSubCommand(q2, J, Q) {
672
- if (!J.trim())
673
- throw new W("DEFINITION", "addSubCommand: name must be a non-empty string");
674
- if (q2.subCommands[J]) {
675
- j?.push(`Plugin subcommand "${J}" on "${q2.meta.name}" skipped (already exists)`);
859
+ return j2.name === "CancelledError";
860
+ }
861
+ function h3(j2, J2) {
862
+ j2.effectiveFlags = X2(J2, j2.localFlags);
863
+ for (let q of Object.values(j2.subCommands))
864
+ h3(q, j2.effectiveFlags);
865
+ }
866
+ function y2(j2) {
867
+ return { addFlag(J2, q, Q) {
868
+ if (q in J2.effectiveFlags)
869
+ j2?.push(`Plugin flag "--${q}" on "${J2.meta.name}" overrides existing flag`);
870
+ J2.effectiveFlags[q] = Q;
871
+ }, addSubCommand(J2, q, Q) {
872
+ if (!q.trim())
873
+ throw new Y("DEFINITION", "addSubCommand: name must be a non-empty string");
874
+ if (J2.subCommands[q]) {
875
+ j2?.push(`Plugin subcommand "${q}" on "${J2.meta.name}" skipped (already exists)`);
876
+ return;
877
+ }
878
+ try {
879
+ g({ canonicalName: q, aliases: Q.meta.aliases }, J2.subCommands, q);
880
+ } catch (Z) {
881
+ let $ = Z instanceof Error ? Z.message : String(Z);
882
+ j2?.push(`Plugin subcommand "${q}" on "${J2.meta.name}" skipped: ${$}`);
676
883
  return;
677
884
  }
678
- b3(Q, q2.effectiveFlags), q2.subCommands[J] = Q;
885
+ h3(Q, J2.effectiveFlags), J2.subCommands[q] = Q;
679
886
  } };
680
887
  }
681
- async function A3(j, q2, J) {
682
- for (let Q of j) {
888
+ async function F3(j2, J2, q) {
889
+ for (let Q of j2) {
683
890
  if (!Q.setup)
684
891
  continue;
685
- await Q.setup(q2, J);
892
+ await Q.setup(J2, q);
686
893
  }
687
894
  }
688
- async function F2(j, q2, J) {
689
- let Q = j.map((Z) => Z.middleware).filter((Z) => Boolean(Z)), $ = -1, K = async (Z) => {
690
- if (Z <= $)
691
- throw new W("DEFINITION", "Plugin middleware called next() multiple times");
692
- if ($ = Z, Z === Q.length) {
693
- await J();
895
+ async function A3(j2, J2, q) {
896
+ let Q = j2.map((G2) => G2.middleware).filter((G2) => Boolean(G2)), Z = -1, $ = async (G2) => {
897
+ if (G2 <= Z)
898
+ throw new Y("DEFINITION", "Plugin middleware called next() multiple times");
899
+ if (Z = G2, G2 === Q.length) {
900
+ await q();
694
901
  return;
695
902
  }
696
- let H = Q[Z];
903
+ let H = Q[G2];
697
904
  if (!H)
698
- throw new W("DEFINITION", "Plugin middleware stack is invalid");
699
- await H(q2, () => K(Z + 1));
905
+ throw new Y("DEFINITION", "Plugin middleware stack is invalid");
906
+ await H(J2, () => $(G2 + 1));
700
907
  };
701
- await K(0);
702
- }
703
- function I3(j) {
704
- let q2 = [...j.plugins];
705
- for (let J of Object.values(j.subCommands))
706
- q2.push(...I3(J));
707
- return q2;
708
- }
709
- function k2(j) {
710
- let q2 = {};
711
- for (let [J, Q] of Object.entries(j))
712
- q2[J] = { ...Q, aliases: Q.aliases ? [...Q.aliases] : undefined };
713
- return q2;
714
- }
715
- function h3(j) {
716
- let q2 = {};
717
- for (let [J, Q] of Object.entries(j.subCommands))
718
- q2[J] = h3(Q);
719
- return { meta: { ...j.meta }, localFlags: k2(j.localFlags), effectiveFlags: k2(j.effectiveFlags), args: j.args ? j.args.map((J) => ({ ...J })) : undefined, subCommands: q2, plugins: [...j.plugins], preRun: j.preRun, run: j.run, postRun: j.postRun };
720
- }
721
- function _4(j) {
722
- if (Object.freeze(j), Object.freeze(j.localFlags), Object.freeze(j.effectiveFlags), Object.freeze(j.meta), Object.freeze(j.plugins), j.args)
723
- Object.freeze(j.args);
724
- for (let q2 of Object.values(j.subCommands))
725
- _4(q2);
726
- Object.freeze(j.subCommands);
908
+ await $(0);
909
+ }
910
+ function S3(j2) {
911
+ let J2 = [...j2.plugins];
912
+ for (let q of Object.values(j2.subCommands))
913
+ J2.push(...S3(q));
914
+ return J2;
915
+ }
916
+ function w3(j2) {
917
+ let J2 = {};
918
+ for (let [q, Q] of Object.entries(j2))
919
+ J2[q] = { ...Q, aliases: Q.aliases ? [...Q.aliases] : undefined };
920
+ return J2;
921
+ }
922
+ function v3(j2) {
923
+ let J2 = {};
924
+ for (let [q, Q] of Object.entries(j2.subCommands))
925
+ J2[q] = v3(Q);
926
+ return { meta: { ...j2.meta }, localFlags: w3(j2.localFlags), effectiveFlags: w3(j2.effectiveFlags), args: j2.args ? j2.args.map((q) => ({ ...q })) : undefined, subCommands: J2, plugins: [...j2.plugins], preRun: j2.preRun, run: j2.run, postRun: j2.postRun };
927
+ }
928
+ function _3(j2) {
929
+ if (Object.freeze(j2), Object.freeze(j2.localFlags), Object.freeze(j2.effectiveFlags), Object.freeze(j2.meta), Object.freeze(j2.plugins), j2.args)
930
+ Object.freeze(j2.args);
931
+ for (let J2 of Object.values(j2.subCommands))
932
+ _3(J2);
933
+ Object.freeze(j2.subCommands);
727
934
  }
728
935
 
729
- class R2 {
936
+ class M2 {
730
937
  _node;
731
938
  _inheritedFlags;
732
- constructor(j) {
733
- if (!j.trim())
734
- throw new W("DEFINITION", "meta.name must be a non-empty string");
735
- this._node = T2(j), this._inheritedFlags = {};
736
- }
737
- static _createChild(j, q2) {
738
- let J = new R2(j);
739
- return J._inheritedFlags = q2, J;
740
- }
741
- _clone(j) {
742
- let q2 = Object.create(Object.getPrototypeOf(this)), J = { ...this._node, localFlags: { ...this._node.localFlags }, effectiveFlags: { ...this._node.effectiveFlags }, subCommands: { ...this._node.subCommands }, plugins: [...this._node.plugins], meta: { ...this._node.meta }, args: this._node.args ? [...this._node.args] : undefined, ...j };
743
- return q2._node = J, q2._inheritedFlags = this._inheritedFlags, q2;
744
- }
745
- meta(j) {
746
- return this._clone({ meta: { ...this._node.meta, ...j } });
747
- }
748
- flags(j) {
749
- N2(j);
750
- let q2 = {};
751
- for (let [J, Q] of Object.entries(j))
752
- q2[J] = { ...Q };
753
- return this._clone({ localFlags: q2, effectiveFlags: z2(this._inheritedFlags, q2) });
754
- }
755
- args(j) {
756
- let q2 = j.map((J) => ({ ...J }));
757
- return this._clone({ args: q2 });
758
- }
759
- run(j) {
760
- return this._clone({ run: j });
761
- }
762
- preRun(j) {
763
- return this._clone({ preRun: j });
764
- }
765
- postRun(j) {
766
- return this._clone({ postRun: j });
767
- }
768
- use(j) {
769
- return this._clone({ plugins: [...this._node.plugins, j] });
770
- }
771
- sub(j) {
772
- if (!j.trim())
773
- throw new W("DEFINITION", "Subcommand name must be a non-empty string");
774
- let q2 = z2(this._inheritedFlags, this._node.localFlags);
775
- return R2._createChild(j, q2);
776
- }
777
- command(j, q2) {
778
- if (typeof j === "string") {
779
- let K = j;
780
- if (!q2)
781
- throw new W("DEFINITION", "command(name, cb) requires a callback");
782
- if (!K.trim())
783
- throw new W("DEFINITION", "Subcommand name must be a non-empty string");
784
- if (this._node.subCommands[K])
785
- throw new W("DEFINITION", `Subcommand "${K}" is already registered`);
786
- let Z = z2(this._inheritedFlags, this._node.localFlags), H = R2._createChild(K, Z), X2 = q2(H), W2 = { ...X2._node, effectiveFlags: z2(X2._inheritedFlags, X2._node.localFlags) };
787
- return this._clone({ subCommands: { ...this._node.subCommands, [K]: W2 } });
788
- }
789
- let J = j, Q = J._node.meta.name;
939
+ constructor(j2) {
940
+ if (!j2.trim())
941
+ throw new Y("DEFINITION", "meta.name must be a non-empty string");
942
+ this._node = P3(j2), this._inheritedFlags = {};
943
+ }
944
+ static _createChild(j2, J2) {
945
+ let q = new M2(j2);
946
+ return q._inheritedFlags = J2, q;
947
+ }
948
+ _clone(j2) {
949
+ let J2 = Object.create(Object.getPrototypeOf(this)), q = { ...this._node, localFlags: { ...this._node.localFlags }, effectiveFlags: { ...this._node.effectiveFlags }, subCommands: { ...this._node.subCommands }, plugins: [...this._node.plugins], meta: { ...this._node.meta }, args: this._node.args ? [...this._node.args] : undefined, ...j2 };
950
+ return J2._node = q, J2._inheritedFlags = this._inheritedFlags, J2;
951
+ }
952
+ meta(j2) {
953
+ return this._clone({ meta: { ...this._node.meta, ...j2 } });
954
+ }
955
+ flags(j2) {
956
+ f3(j2);
957
+ let J2 = {};
958
+ for (let [q, Q] of Object.entries(j2))
959
+ J2[q] = { ...Q };
960
+ return this._clone({ localFlags: J2, effectiveFlags: X2(this._inheritedFlags, J2) });
961
+ }
962
+ args(j2) {
963
+ let J2 = j2.map((q) => ({ ...q }));
964
+ return this._clone({ args: J2 });
965
+ }
966
+ run(j2) {
967
+ return this._clone({ run: j2 });
968
+ }
969
+ preRun(j2) {
970
+ return this._clone({ preRun: j2 });
971
+ }
972
+ postRun(j2) {
973
+ return this._clone({ postRun: j2 });
974
+ }
975
+ use(j2) {
976
+ return this._clone({ plugins: [...this._node.plugins, j2] });
977
+ }
978
+ sub(j2) {
979
+ if (!j2.trim())
980
+ throw new Y("DEFINITION", "Subcommand name must be a non-empty string");
981
+ let J2 = X2(this._inheritedFlags, this._node.localFlags);
982
+ return M2._createChild(j2, J2);
983
+ }
984
+ command(j2, J2) {
985
+ if (typeof j2 === "string") {
986
+ let $ = j2;
987
+ if (!J2)
988
+ throw new Y("DEFINITION", "command(name, cb) requires a callback");
989
+ if (!$.trim())
990
+ throw new Y("DEFINITION", "Subcommand name must be a non-empty string");
991
+ if (this._node.subCommands[$])
992
+ throw new Y("DEFINITION", `Subcommand "${$}" is already registered`);
993
+ let G2 = X2(this._inheritedFlags, this._node.localFlags), H = M2._createChild($, G2), z = J2(H);
994
+ g({ canonicalName: $, aliases: z._node.meta.aliases }, this._node.subCommands, $);
995
+ let W = { ...z._node, effectiveFlags: X2(z._inheritedFlags, z._node.localFlags) };
996
+ return this._clone({ subCommands: { ...this._node.subCommands, [$]: W } });
997
+ }
998
+ let q = j2, Q = q._node.meta.name;
790
999
  if (!Q.trim())
791
- throw new W("DEFINITION", "Subcommand name must be a non-empty string");
1000
+ throw new Y("DEFINITION", "Subcommand name must be a non-empty string");
792
1001
  if (this._node.subCommands[Q])
793
- throw new W("DEFINITION", `Subcommand "${Q}" is already registered`);
794
- let $ = { ...J._node, effectiveFlags: z2(J._inheritedFlags, J._node.localFlags) };
795
- return this._clone({ subCommands: { ...this._node.subCommands, [Q]: $ } });
1002
+ throw new Y("DEFINITION", `Subcommand "${Q}" is already registered`);
1003
+ g({ canonicalName: Q, aliases: q._node.meta.aliases }, this._node.subCommands, Q);
1004
+ let Z = { ...q._node, effectiveFlags: X2(q._inheritedFlags, q._node.localFlags) };
1005
+ return this._clone({ subCommands: { ...this._node.subCommands, [Q]: Z } });
796
1006
  }
797
- async prepareCommandTree(j) {
798
- let q2 = j?.argv ?? [], J = h3(this._node), Q = I3(J), $ = [], K = x2(), Z = { argv: [...q2], rootCommand: J, state: K }, H = y2($);
1007
+ async prepareCommandTree(j2) {
1008
+ let J2 = j2?.argv ?? [], q = v3(this._node), Q = S3(q), Z = [], $ = k3(), G2 = { argv: [...J2], rootCommand: q, state: $ }, H = y2(Z);
799
1009
  try {
800
- await A3(Q, Z, H);
801
- } catch (W2) {
802
- if (B2(W2))
803
- throw W2;
804
- if (W2 instanceof W)
805
- throw W2;
806
- if (W2 instanceof Error)
807
- throw W2;
808
- throw new W("DEFINITION", String(W2));
809
- }
810
- _4(J);
811
- let { validateCommandTree: X2 } = await Promise.resolve().then(() => (init_chunk_5apf3vnv(), exports_chunk_5apf3vnv));
812
- return X2(J), { root: J, warnings: $ };
813
- }
814
- async execute(j) {
815
- let q2 = j?.argv ?? process.argv.slice(2), J = this._node, Q = I3(J), $ = [], K = x2(), Z = { argv: [...q2], rootCommand: J, state: K }, H = y2($);
1010
+ await F3(Q, G2, H);
1011
+ } catch (W) {
1012
+ if (L3(W))
1013
+ throw W;
1014
+ if (W instanceof Y)
1015
+ throw W;
1016
+ if (W instanceof Error)
1017
+ throw W;
1018
+ throw new Y("DEFINITION", String(W));
1019
+ }
1020
+ _3(q);
1021
+ let { validateCommandTree: z } = await Promise.resolve().then(() => (init_chunk_1670njz2(), exports_chunk_1670njz2));
1022
+ return z(q), { root: q, warnings: Z };
1023
+ }
1024
+ async execute(j2) {
1025
+ let J2 = j2?.argv ?? process.argv.slice(2), q = this._node, Q = S3(q), Z = [], $ = k3(), G2 = { argv: [...J2], rootCommand: q, state: $ }, H = y2(Z);
816
1026
  try {
817
- await A3(Q, Z, H);
818
- } catch (W2) {
819
- if (B2(W2)) {
820
- process.exitCode = P3;
1027
+ await F3(Q, G2, H);
1028
+ } catch (W) {
1029
+ if (L3(W)) {
1030
+ process.exitCode = x2;
821
1031
  return;
822
1032
  }
823
- if (W2 instanceof W) {
824
- console.error(`Error: ${W2.message}`), process.exitCode = 1;
1033
+ if (W instanceof Y) {
1034
+ console.error(`Error: ${W.message}`), process.exitCode = 1;
825
1035
  return;
826
1036
  }
827
- let U2 = W2 instanceof Error ? W2.message : String(W2);
828
- console.error(`Error: ${U2}`), process.exitCode = 1;
1037
+ let U = W instanceof Error ? W.message : String(W);
1038
+ console.error(`Error: ${U}`), process.exitCode = 1;
829
1039
  return;
830
1040
  }
831
- if (_4(J), process.env[w2] === "1") {
832
- let W2 = (async () => {
1041
+ if (_3(q), process.env[N3] === "1") {
1042
+ let W = (async () => {
833
1043
  try {
834
- let { validateCommandTree: U2 } = await Promise.resolve().then(() => (init_chunk_5apf3vnv(), exports_chunk_5apf3vnv));
835
- U2(J);
836
- for (let Y of $)
837
- console.warn(`Warning: ${Y}`);
1044
+ let { validateCommandTree: U } = await Promise.resolve().then(() => (init_chunk_1670njz2(), exports_chunk_1670njz2));
1045
+ U(q);
1046
+ for (let Y2 of Z)
1047
+ console.warn(`Warning: ${Y2}`);
838
1048
  return { ok: true };
839
- } catch (U2) {
840
- let Y = U2 instanceof Error ? U2.message : String(U2);
841
- return console.error(Y), process.exitCode = 1, { ok: false, error: U2 };
1049
+ } catch (U) {
1050
+ let Y2 = U instanceof Error ? U.message : String(U);
1051
+ return console.error(Y2), process.exitCode = 1, { ok: false, error: U };
842
1052
  }
843
1053
  })();
844
- return globalThis[v2] = W2, await W2, process.exit(process.exitCode ?? 0);
1054
+ if (globalThis[C4] = W, await W, process.env[b3] === "1")
1055
+ return process.exit(process.exitCode ?? 0);
1056
+ return;
845
1057
  }
846
- for (let W2 of $)
847
- console.warn(`Warning: ${W2}`);
848
- let X2 = { argv: [...q2], rootCommand: J, state: K, route: null, input: null };
1058
+ for (let W of Z)
1059
+ console.warn(`Warning: ${W}`);
1060
+ let z = { argv: [...J2], rootCommand: q, state: $, route: null, input: null };
849
1061
  try {
850
- let W2, U2;
1062
+ let W, U;
851
1063
  try {
852
- let Y = D2(J, [...q2]);
853
- X2.route = Y, W2 = Y.command, U2 = b(W2, Y.argv), X2.input = U2;
854
- } catch (Y) {
855
- await F2(Q, X2, async () => {
856
- throw Y;
1064
+ let Y2 = D3(q, [...J2]);
1065
+ z.route = Y2, W = Y2.command, U = S(W, Y2.argv), z.input = U;
1066
+ } catch (Y2) {
1067
+ await A3(Q, z, async () => {
1068
+ throw Y2;
857
1069
  });
858
1070
  return;
859
1071
  }
860
- await F2(Q, X2, async () => {
861
- if (E(W2, U2), !W2.run)
1072
+ await A3(Q, z, async () => {
1073
+ if (A(W, U), !W.run)
862
1074
  return;
863
- let Y = { args: U2.args, flags: U2.flags, rawArgs: U2.rawArgs, command: W2 }, V;
1075
+ let Y2 = { args: U.args, flags: U.flags, rawArgs: U.rawArgs, command: W }, R2;
864
1076
  try {
865
- if (W2.preRun)
866
- await W2.preRun(Y);
867
- await W2.run(Y);
868
- } catch (M3) {
869
- V = M3;
1077
+ if (W.preRun)
1078
+ await W.preRun(Y2);
1079
+ await W.run(Y2);
1080
+ } catch (V2) {
1081
+ R2 = V2;
870
1082
  }
871
- if (W2.postRun)
1083
+ if (W.postRun)
872
1084
  try {
873
- await W2.postRun(Y);
874
- } catch (M3) {
875
- if (!V)
876
- V = M3;
1085
+ await W.postRun(Y2);
1086
+ } catch (V2) {
1087
+ if (!R2)
1088
+ R2 = V2;
877
1089
  else
878
- console.error(`Error in postRun: ${M3 instanceof Error ? M3.message : String(M3)}`);
1090
+ console.error(`Error in postRun: ${V2 instanceof Error ? V2.message : String(V2)}`);
879
1091
  }
880
- if (V)
881
- throw V;
1092
+ if (R2)
1093
+ throw R2;
882
1094
  });
883
- } catch (W2) {
884
- if (B2(W2)) {
885
- process.exitCode = P3;
1095
+ } catch (W) {
1096
+ if (L3(W)) {
1097
+ process.exitCode = x2;
886
1098
  return;
887
1099
  }
888
- if (W2 instanceof W) {
889
- console.error(`Error: ${W2.message}`), process.exitCode = 1;
1100
+ if (W instanceof Y) {
1101
+ console.error(`Error: ${W.message}`), process.exitCode = 1;
890
1102
  return;
891
1103
  }
892
- if (W2 instanceof Error) {
893
- let U2 = new W("EXECUTION", W2.message).withCause(W2);
894
- console.error(`Error: ${U2.message}`), process.exitCode = 1;
1104
+ if (W instanceof Error) {
1105
+ let U = new Y("EXECUTION", W.message).withCause(W);
1106
+ console.error(`Error: ${U.message}`), process.exitCode = 1;
895
1107
  return;
896
1108
  }
897
- console.error(`Error: ${String(W2)}`), process.exitCode = 1;
1109
+ console.error(`Error: ${String(W)}`), process.exitCode = 1;
898
1110
  }
899
1111
  }
900
1112
  }
901
1113
 
902
- // ../../node_modules/.bun/@crustjs+style@0.1.0+7524df1edfed9f02/node_modules/@crustjs/style/dist/index.js
903
- var rF = Object.defineProperty;
904
- var sF = (F3) => F3;
905
- function aF(F3, Y) {
906
- this[F3] = sF.bind(null, Y);
907
- }
908
- var oF = (F3, Y) => {
909
- for (var B3 in Y)
910
- rF(F3, B3, { get: Y[B3], enumerable: true, configurable: true, set: aF.bind(Y, B3) });
1114
+ // ../../node_modules/.bun/@crustjs+style@0.2.0+7524df1edfed9f02/node_modules/@crustjs/style/dist/index.js
1115
+ var YZ = Object.defineProperty;
1116
+ var jZ = (V2) => V2;
1117
+ function UZ(V2, $) {
1118
+ this[V2] = jZ.bind(null, $);
1119
+ }
1120
+ var HZ = (V2, $) => {
1121
+ for (var Z in $)
1122
+ YZ(V2, Z, { get: $[Z], enumerable: true, configurable: true, set: UZ.bind($, Z) });
911
1123
  };
912
- var E2 = {};
913
- oF(E2, { yellow: () => o, white: () => FF, underline: () => c, strikethrough: () => d, reset: () => p, red: () => s, magenta: () => t, italic: () => h4, inverse: () => n, hidden: () => l, green: () => a, gray: () => BF, dim: () => m, cyan: () => e, brightYellow: () => ZF, brightWhite: () => JF, brightRed: () => YF, brightMagenta: () => zF, brightGreen: () => VF, brightCyan: () => QF, brightBlue: () => $F, bold: () => u, blue: () => i, black: () => r, bgYellow: () => GF, bgWhite: () => OF, bgRed: () => KF, bgMagenta: () => HF, bgGreen: () => jF, bgCyan: () => _F, bgBrightYellow: () => AF, bgBrightWhite: () => TF, bgBrightRed: () => qF, bgBrightMagenta: () => MF, bgBrightGreen: () => RF, bgBrightCyan: () => IF, bgBrightBlue: () => LF, bgBrightBlack: () => DF, bgBlue: () => UF, bgBlack: () => XF });
914
- function J(F3, Y) {
915
- return { open: `\x1B[${F3}m`, close: `\x1B[${Y}m` };
916
- }
917
- var p = J(0, 0);
918
- var u = J(1, 22);
919
- var m = J(2, 22);
920
- var h4 = J(3, 23);
921
- var c = J(4, 24);
922
- var n = J(7, 27);
923
- var l = J(8, 28);
924
- var d = J(9, 29);
925
- var r = J(30, 39);
926
- var s = J(31, 39);
927
- var a = J(32, 39);
928
- var o = J(33, 39);
929
- var i = J(34, 39);
930
- var t = J(35, 39);
931
- var e = J(36, 39);
932
- var FF = J(37, 39);
933
- var BF = J(90, 39);
934
- var YF = J(91, 39);
935
- var VF = J(92, 39);
936
- var ZF = J(93, 39);
937
- var $F = J(94, 39);
938
- var zF = J(95, 39);
939
- var QF = J(96, 39);
940
- var JF = J(97, 39);
941
- var XF = J(40, 49);
942
- var KF = J(41, 49);
943
- var jF = J(42, 49);
944
- var GF = J(43, 49);
945
- var UF = J(44, 49);
946
- var HF = J(45, 49);
947
- var _F = J(46, 49);
948
- var OF = J(47, 49);
949
- var DF = J(100, 49);
950
- var qF = J(101, 49);
951
- var RF = J(102, 49);
952
- var AF = J(103, 49);
953
- var LF = J(104, 49);
954
- var MF = J(105, 49);
955
- var IF = J(106, 49);
956
- var TF = J(107, 49);
957
- function iF(F3) {
958
- return F3 >= 19968 && F3 <= 40959 || F3 >= 13312 && F3 <= 19903 || F3 >= 131072 && F3 <= 173791 || F3 >= 63744 && F3 <= 64255 || F3 >= 65281 && F3 <= 65376 || F3 >= 65504 && F3 <= 65510 || F3 >= 11904 && F3 <= 12031 || F3 >= 12032 && F3 <= 12255 || F3 >= 12288 && F3 <= 12351 || F3 >= 12352 && F3 <= 12447 || F3 >= 12448 && F3 <= 12543 || F3 >= 12544 && F3 <= 12591 || F3 >= 12592 && F3 <= 12687 || F3 >= 12800 && F3 <= 13055 || F3 >= 13056 && F3 <= 13311 || F3 >= 44032 && F3 <= 55215 || F3 >= 65072 && F3 <= 65103;
959
- }
960
- function O2(F3) {
961
- let Y = Bun.stripANSI(F3), B3 = 0;
962
- for (let V of Y) {
963
- let Z = V.codePointAt(0);
964
- if (Z === undefined)
1124
+ var f4 = {};
1125
+ HZ(f4, { yellow: () => XV, white: () => UV, underline: () => e, strikethrough: () => $V, reset: () => qZ, red: () => QV, magenta: () => YV, italic: () => t, inverse: () => VV, hidden: () => ZV, green: () => JV, gray: () => HV, dim: () => i, cyan: () => jV, brightYellow: () => GV, brightWhite: () => DV, brightRed: () => qV, brightMagenta: () => AV, brightGreen: () => BV, brightCyan: () => LV, brightBlue: () => _V, bold: () => r, blue: () => KV, black: () => zV, bgYellow: () => OV, bgWhite: () => FV, bgRed: () => MV, bgMagenta: () => TV, bgGreen: () => RV, bgCyan: () => EV, bgBrightYellow: () => fV, bgBrightWhite: () => yV, bgBrightRed: () => kV, bgBrightMagenta: () => CV, bgBrightGreen: () => SV, bgBrightCyan: () => PV, bgBrightBlue: () => wV, bgBrightBlack: () => IV, bgBlue: () => WV, bgBlack: () => NV });
1126
+ function U(V2, $) {
1127
+ return { open: `\x1B[${V2}m`, close: `\x1B[${$}m` };
1128
+ }
1129
+ var qZ = U(0, 0);
1130
+ var r = U(1, 22);
1131
+ var i = U(2, 22);
1132
+ var t = U(3, 23);
1133
+ var e = U(4, 24);
1134
+ var VV = U(7, 27);
1135
+ var ZV = U(8, 28);
1136
+ var $V = U(9, 29);
1137
+ var zV = U(30, 39);
1138
+ var QV = U(31, 39);
1139
+ var JV = U(32, 39);
1140
+ var XV = U(33, 39);
1141
+ var KV = U(34, 39);
1142
+ var YV = U(35, 39);
1143
+ var jV = U(36, 39);
1144
+ var UV = U(37, 39);
1145
+ var HV = U(90, 39);
1146
+ var qV = U(91, 39);
1147
+ var BV = U(92, 39);
1148
+ var GV = U(93, 39);
1149
+ var _V = U(94, 39);
1150
+ var AV = U(95, 39);
1151
+ var LV = U(96, 39);
1152
+ var DV = U(97, 39);
1153
+ var NV = U(40, 49);
1154
+ var MV = U(41, 49);
1155
+ var RV = U(42, 49);
1156
+ var OV = U(43, 49);
1157
+ var WV = U(44, 49);
1158
+ var TV = U(45, 49);
1159
+ var EV = U(46, 49);
1160
+ var FV = U(47, 49);
1161
+ var IV = U(100, 49);
1162
+ var kV = U(101, 49);
1163
+ var SV = U(102, 49);
1164
+ var fV = U(103, 49);
1165
+ var wV = U(104, 49);
1166
+ var CV = U(105, 49);
1167
+ var PV = U(106, 49);
1168
+ var yV = U(107, 49);
1169
+ function BZ(V2) {
1170
+ return V2 >= 19968 && V2 <= 40959 || V2 >= 13312 && V2 <= 19903 || V2 >= 131072 && V2 <= 173791 || V2 >= 63744 && V2 <= 64255 || V2 >= 65281 && V2 <= 65376 || V2 >= 65504 && V2 <= 65510 || V2 >= 11904 && V2 <= 12031 || V2 >= 12032 && V2 <= 12255 || V2 >= 12288 && V2 <= 12351 || V2 >= 12352 && V2 <= 12447 || V2 >= 12448 && V2 <= 12543 || V2 >= 12544 && V2 <= 12591 || V2 >= 12592 && V2 <= 12687 || V2 >= 12800 && V2 <= 13055 || V2 >= 13056 && V2 <= 13311 || V2 >= 44032 && V2 <= 55215 || V2 >= 65072 && V2 <= 65103;
1171
+ }
1172
+ function M3(V2) {
1173
+ let $ = Bun.stripANSI(V2), Z = 0;
1174
+ for (let z of $) {
1175
+ let Q = z.codePointAt(0);
1176
+ if (Q === undefined)
965
1177
  continue;
966
- B3 += iF(Z) ? 2 : 1;
1178
+ Z += BZ(Q) ? 2 : 1;
967
1179
  }
968
- return B3;
1180
+ return Z;
969
1181
  }
970
- function M3(F3, Y) {
971
- if (F3 === "always")
972
- return true;
973
- if (F3 === "never")
974
- return false;
975
- let V = Y !== undefined && "isTTY" in Y ? Y.isTTY ?? false : process.stdout?.isTTY ?? false, z3 = Y !== undefined && "noColor" in Y ? Y.noColor : process.env.NO_COLOR;
976
- if (z3 !== undefined && z3 !== "")
977
- return false;
978
- return V;
1182
+ function v4(V2) {
1183
+ return V2 !== undefined && "isTTY" in V2 ? V2.isTTY ?? false : process.stdout?.isTTY ?? false;
979
1184
  }
980
- function NF(F3, Y) {
981
- if (F3 === "always")
982
- return true;
983
- if (F3 === "never")
984
- return false;
985
- return Y !== undefined && "isTTY" in Y ? Y.isTTY ?? false : process.stdout?.isTTY ?? false;
1185
+ function RZ(V2) {
1186
+ return V2 !== undefined && "noColor" in V2 ? V2.noColor : process.env.NO_COLOR;
1187
+ }
1188
+ function OZ(V2) {
1189
+ return V2 !== undefined && "colorTerm" in V2 ? V2.colorTerm : process.env.COLORTERM;
986
1190
  }
987
- function kF(F3, Y) {
988
- if (F3 === "always")
1191
+ function WZ(V2) {
1192
+ return V2 !== undefined && "term" in V2 ? V2.term : process.env.TERM;
1193
+ }
1194
+ function TZ(V2) {
1195
+ let $ = V2.toLowerCase();
1196
+ return $.includes("24bit") || $.includes("truecolor") || $.endsWith("-direct");
1197
+ }
1198
+ function EZ(V2, $) {
1199
+ if (V2 !== undefined) {
1200
+ let Z = V2.toLowerCase();
1201
+ if (Z === "truecolor" || Z === "24bit")
1202
+ return true;
1203
+ }
1204
+ return $ !== undefined && TZ($);
1205
+ }
1206
+ function x3(V2, $) {
1207
+ if (V2 === "never")
1208
+ return "none";
1209
+ if (V2 === "always")
1210
+ return "truecolor";
1211
+ if (!v4($))
1212
+ return "none";
1213
+ let z = RZ($);
1214
+ if (z !== undefined && z !== "")
1215
+ return "none";
1216
+ let Q = OZ($), J2 = WZ($);
1217
+ if (EZ(Q, J2))
1218
+ return "truecolor";
1219
+ if (J2 !== undefined) {
1220
+ let X3 = J2.toLowerCase();
1221
+ if (X3 === "dumb")
1222
+ return "none";
1223
+ if (X3.includes("256color"))
1224
+ return "256";
1225
+ }
1226
+ return "16";
1227
+ }
1228
+ function xV(V2, $) {
1229
+ if (V2 === "always")
989
1230
  return true;
990
- if (F3 === "never")
1231
+ if (V2 === "never")
991
1232
  return false;
992
- return Y !== undefined && "isTTY" in Y ? Y.isTTY ?? false : process.stdout?.isTTY ?? false;
1233
+ return v4($);
993
1234
  }
994
- function S2(F3, Y) {
995
- if (F3 === "always")
1235
+ function gV(V2, $) {
1236
+ if (V2 === "always")
996
1237
  return true;
997
- if (F3 === "never")
998
- return false;
999
- if (!M3(F3, Y))
1238
+ if (V2 === "never")
1000
1239
  return false;
1001
- let Z = (Y !== undefined && "colorTerm" in Y ? Y.colorTerm : process.env.COLORTERM)?.toLowerCase();
1002
- if (Z === "truecolor" || Z === "24bit")
1003
- return true;
1004
- let $ = Y !== undefined && "term" in Y ? Y.term : process.env.TERM;
1005
- if ($ !== undefined) {
1006
- let K = $.toLowerCase();
1007
- if (K.includes("24bit") || K.includes("truecolor") || K.endsWith("-direct"))
1008
- return true;
1009
- }
1010
- return false;
1240
+ return v4($);
1241
+ }
1242
+ function L4(V2, $) {
1243
+ if (V2 == null)
1244
+ return "";
1245
+ if (typeof V2 !== "string")
1246
+ V2 = String(V2);
1247
+ if (V2 === "")
1248
+ return "";
1249
+ let { open: Z, close: z } = $;
1250
+ if (V2.includes(z))
1251
+ V2 = V2.replaceAll(z, z + Z);
1252
+ return Z + V2 + z;
1253
+ }
1254
+ var m2 = "\x1B[39m";
1255
+ var b4 = "\x1B[49m";
1256
+ var g2 = "\x1B[38;";
1257
+ var mV = "\x1B[48;";
1258
+ function bV(V2) {
1259
+ if (typeof V2 === "string" || V2 !== null && typeof V2 === "object")
1260
+ try {
1261
+ return JSON.stringify(V2);
1262
+ } catch {
1263
+ return String(V2);
1264
+ }
1265
+ return String(V2);
1266
+ }
1267
+ function uV(V2) {
1268
+ let $ = Bun.color(V2, "[rgb]");
1269
+ if ($ === null)
1270
+ throw TypeError(`Invalid color input: ${bV(V2)}`);
1271
+ return $;
1272
+ }
1273
+ function hV(V2, $, Z) {
1274
+ let z = Math.max(V2, $, Z), Q = Math.round(z / 127.5);
1275
+ if (Q === 0)
1276
+ return 30;
1277
+ let J2 = 30 + ((Math.round(Z / 255) << 2 | Math.round($ / 255) << 1 | Math.round(V2 / 255)) & 7);
1278
+ if (Q === 2)
1279
+ J2 += 60;
1280
+ return J2;
1281
+ }
1282
+ function O2(V2, $) {
1283
+ if ($ === "16") {
1284
+ let [Q, J2, X3] = uV(V2);
1285
+ return `\x1B[${hV(Q, J2, X3)}m`;
1286
+ }
1287
+ let Z = $ === "truecolor" ? "ansi-16m" : "ansi-256", z = Bun.color(V2, Z);
1288
+ if (z === null)
1289
+ throw TypeError(`Invalid color input: ${bV(V2)}`);
1290
+ return z;
1011
1291
  }
1012
- function D3(F3, Y) {
1013
- if (F3 === "")
1292
+ function u(V2, $) {
1293
+ if ($ === "16") {
1294
+ let [z, Q, J2] = uV(V2);
1295
+ return `\x1B[${hV(z, Q, J2) + 10}m`;
1296
+ }
1297
+ let Z = O2(V2, $);
1298
+ return Z.startsWith(g2) ? mV + Z.slice(g2.length) : Z.replace(g2, mV);
1299
+ }
1300
+ function h4(V2, $) {
1301
+ if ($ === "none")
1302
+ return O2(V2, "truecolor"), { open: "", close: "" };
1303
+ return { open: O2(V2, $), close: m2 };
1304
+ }
1305
+ function p2(V2, $) {
1306
+ if ($ === "none")
1307
+ return O2(V2, "truecolor"), { open: "", close: "" };
1308
+ return { open: u(V2, $), close: b4 };
1309
+ }
1310
+ function I2(V2, $, Z = "truecolor") {
1311
+ let z = $;
1312
+ if (Z === "none")
1313
+ return O2(z, "truecolor"), V2 === "" ? "" : V2;
1314
+ let Q = O2(z, Z);
1315
+ if (V2 === "")
1014
1316
  return "";
1015
- let { open: B3, close: V } = Y;
1016
- if (F3.includes(V))
1017
- F3 = F3.replaceAll(V, V + B3);
1018
- return B3 + F3 + V;
1019
- }
1020
- function f(F3, Y) {
1021
- if (!Number.isInteger(F3) || F3 < 0 || F3 > 255)
1022
- throw RangeError(`Invalid ${Y} value: ${String(F3)}. Must be an integer between 0 and 255.`);
1023
- }
1024
- function gF(F3, Y, B3) {
1025
- f(F3, "red"), f(Y, "green"), f(B3, "blue");
1026
- }
1027
- var zB = /^#([0-9a-f]{3})$/i;
1028
- var QB = /^#([0-9a-f]{6})$/i;
1029
- function y3(F3) {
1030
- let Y = zB.exec(F3);
1031
- if (Y) {
1032
- let V = Y[1], Z = V.charAt(0), z3 = V.charAt(1), $ = V.charAt(2);
1033
- return [Number.parseInt(Z + Z, 16), Number.parseInt(z3 + z3, 16), Number.parseInt($ + $, 16)];
1034
- }
1035
- let B3 = QB.exec(F3);
1036
- if (B3) {
1037
- let V = B3[1];
1038
- return [Number.parseInt(V.slice(0, 2), 16), Number.parseInt(V.slice(2, 4), 16), Number.parseInt(V.slice(4, 6), 16)];
1039
- }
1040
- throw TypeError(`Invalid hex color: "${F3}". Expected format: "#RGB" or "#RRGGBB".`);
1041
- }
1042
- function w3(F3, Y, B3) {
1043
- return gF(F3, Y, B3), { open: `\x1B[38;2;${F3};${Y};${B3}m`, close: "\x1B[39m" };
1044
- }
1045
- function C(F3, Y, B3) {
1046
- return gF(F3, Y, B3), { open: `\x1B[48;2;${F3};${Y};${B3}m`, close: "\x1B[49m" };
1047
- }
1048
- function WF(F3) {
1049
- let [Y, B3, V] = y3(F3);
1050
- return w3(Y, B3, V);
1051
- }
1052
- function SF(F3) {
1053
- let [Y, B3, V] = y3(F3);
1054
- return C(Y, B3, V);
1055
- }
1056
- function fF(F3, Y, B3, V) {
1057
- return D3(F3, w3(Y, B3, V));
1058
- }
1059
- function yF(F3, Y, B3, V) {
1060
- return D3(F3, C(Y, B3, V));
1061
- }
1062
- function wF(F3, Y) {
1063
- return D3(F3, WF(Y));
1064
- }
1065
- function CF(F3, Y) {
1066
- return D3(F3, SF(Y));
1067
- }
1068
- var xF = "\x1B]";
1069
- var bF = "\x1B\\";
1070
- var JB = `${xF}8;;${bF}`;
1071
- var XB = /^[\x20-\x7e]*$/;
1072
- var KB = /^[\x21-\x7e]*$/;
1073
- function jB(F3, Y) {
1074
- if (!XB.test(F3))
1075
- throw TypeError(`Invalid ${Y}: must contain only printable ASCII characters.`);
1076
- }
1077
- function GB(F3, Y) {
1078
- if (!KB.test(F3))
1079
- throw TypeError(`Invalid ${Y}: must contain only printable ASCII characters without spaces.`);
1080
- }
1081
- function UB(F3) {
1082
- let Y = F3?.id;
1083
- if (Y === undefined || Y === "")
1317
+ return L4(V2, { open: Q, close: m2 });
1318
+ }
1319
+ function k4(V2, $, Z = "truecolor") {
1320
+ let z = $;
1321
+ if (Z === "none")
1322
+ return O2(z, "truecolor"), V2 === "" ? "" : V2;
1323
+ let Q = u(z, Z);
1324
+ if (V2 === "")
1084
1325
  return "";
1085
- if (jB(Y, "hyperlink id"), Y.includes(":") || Y.includes(";"))
1326
+ return L4(V2, { open: Q, close: b4 });
1327
+ }
1328
+ function c(V2, $) {
1329
+ if (!Number.isInteger(V2) || V2 < 0 || V2 > 255)
1330
+ throw RangeError(`Invalid ${$} value: ${String(V2)}. Must be an integer between 0 and 255.`);
1331
+ }
1332
+ function pV(V2, $, Z) {
1333
+ c(V2, "red"), c($, "green"), c(Z, "blue");
1334
+ }
1335
+ var SZ = /^#([0-9a-f]{3})$/i;
1336
+ var fZ = /^#([0-9a-f]{6})$/i;
1337
+ function d(V2) {
1338
+ let $ = SZ.exec(V2);
1339
+ if ($) {
1340
+ let z = $[1], Q = z.charAt(0), J2 = z.charAt(1), X3 = z.charAt(2);
1341
+ return [Number.parseInt(Q + Q, 16), Number.parseInt(J2 + J2, 16), Number.parseInt(X3 + X3, 16)];
1342
+ }
1343
+ let Z = fZ.exec(V2);
1344
+ if (Z) {
1345
+ let z = Z[1];
1346
+ return [Number.parseInt(z.slice(0, 2), 16), Number.parseInt(z.slice(2, 4), 16), Number.parseInt(z.slice(4, 6), 16)];
1347
+ }
1348
+ throw TypeError(`Invalid hex color: "${V2}". Expected format: "#RGB" or "#RRGGBB".`);
1349
+ }
1350
+ function l(V2, $, Z) {
1351
+ return pV(V2, $, Z), { open: `\x1B[38;2;${V2};${$};${Z}m`, close: "\x1B[39m" };
1352
+ }
1353
+ function s(V2, $, Z) {
1354
+ return pV(V2, $, Z), { open: `\x1B[48;2;${V2};${$};${Z}m`, close: "\x1B[49m" };
1355
+ }
1356
+ function cV(V2) {
1357
+ let [$, Z, z] = d(V2);
1358
+ return l($, Z, z);
1359
+ }
1360
+ function dV(V2) {
1361
+ let [$, Z, z] = d(V2);
1362
+ return s($, Z, z);
1363
+ }
1364
+ function lV(V2, $, Z, z) {
1365
+ return L4(V2, l($, Z, z));
1366
+ }
1367
+ function sV(V2, $, Z, z) {
1368
+ return L4(V2, s($, Z, z));
1369
+ }
1370
+ function nV(V2, $) {
1371
+ return L4(V2, cV($));
1372
+ }
1373
+ function aV(V2, $) {
1374
+ return L4(V2, dV($));
1375
+ }
1376
+ var oV = "\x1B]";
1377
+ var rV = "\x1B\\";
1378
+ var wZ = `${oV}8;;${rV}`;
1379
+ var CZ = /^[\x20-\x7e]*$/;
1380
+ var PZ = /^[\x21-\x7e]*$/;
1381
+ function yZ(V2, $) {
1382
+ if (!CZ.test(V2))
1383
+ throw TypeError(`Invalid ${$}: ${JSON.stringify(V2)} must contain only printable ASCII characters.`);
1384
+ }
1385
+ function vZ(V2, $) {
1386
+ if (!PZ.test(V2))
1387
+ throw TypeError(`Invalid ${$}: ${JSON.stringify(V2)} must contain only printable ASCII characters without spaces.`);
1388
+ }
1389
+ function xZ(V2) {
1390
+ let $ = V2?.id;
1391
+ if ($ === undefined || $ === "")
1392
+ return "";
1393
+ if (yZ($, "hyperlink id"), $.includes(":") || $.includes(";"))
1086
1394
  throw TypeError('Invalid hyperlink id: ":" and ";" are reserved by the OSC 8 format.');
1087
- return `id=${Y}`;
1088
- }
1089
- function PF(F3, Y) {
1090
- GB(F3, "hyperlink URL");
1091
- let B3 = UB(Y);
1092
- return { open: `${xF}8;${B3};${F3}${bF}`, close: JB };
1093
- }
1094
- function vF(F3, Y, B3) {
1095
- return D3(F3, PF(Y, B3));
1096
- }
1097
- function HB() {
1098
- let { reset: F3, ...Y } = E2;
1099
- return Y;
1100
- }
1101
- var x3 = Object.freeze(HB());
1102
- var I4 = Object.freeze(Object.keys(x3));
1103
- function pF(F3) {
1104
- return x3[F3];
1105
- }
1106
- var uF = Object.freeze(["bold", "dim", "italic", "underline", "inverse", "hidden", "strikethrough"]);
1107
- var _B = new Set(uF);
1108
- function mF(F3) {
1109
- return _B.has(F3);
1110
- }
1111
- var OB = new Set(uF.map((F3) => x3[F3]));
1112
- function hF(F3) {
1113
- return OB.has(F3);
1114
- }
1115
- function DB(F3, Y, B3, V) {
1116
- if (F3 === "")
1117
- return F3;
1118
- let Z = F3;
1119
- for (let z3 = Y.length - 1;z3 >= 0; z3--) {
1120
- let $ = Y[z3];
1121
- if ($ === undefined)
1395
+ return `id=${$}`;
1396
+ }
1397
+ function S4(V2, $) {
1398
+ vZ(V2, "hyperlink URL");
1399
+ let Z = xZ($);
1400
+ return { open: `${oV}8;${Z};${V2}${rV}`, close: wZ };
1401
+ }
1402
+ function iV(V2, $, Z) {
1403
+ return L4(V2, S4($, Z));
1404
+ }
1405
+ function gZ() {
1406
+ let { reset: V2, ...$ } = f4;
1407
+ return $;
1408
+ }
1409
+ var n = Object.freeze(gZ());
1410
+ var E4 = Object.freeze(Object.keys(n));
1411
+ function a(V2) {
1412
+ return n[V2];
1413
+ }
1414
+ var tV = Object.freeze(["bold", "dim", "italic", "underline", "inverse", "hidden", "strikethrough"]);
1415
+ var mZ = new Set(tV);
1416
+ function eV(V2) {
1417
+ return mZ.has(V2);
1418
+ }
1419
+ var bZ = new Set(tV.map((V2) => n[V2]));
1420
+ function VZ(V2) {
1421
+ return bZ.has(V2);
1422
+ }
1423
+ function uZ(V2) {
1424
+ return V2.kind === "named" ? eV(V2.name) : V2.isModifier;
1425
+ }
1426
+ function zZ(V2) {
1427
+ return V2.kind === "named" ? a(V2.name) : V2.pair;
1428
+ }
1429
+ function ZZ(V2, $, Z, z) {
1430
+ if (V2 == null)
1431
+ return "";
1432
+ if (typeof V2 !== "string")
1433
+ V2 = String(V2);
1434
+ if (V2 === "")
1435
+ return V2;
1436
+ let Q = V2;
1437
+ for (let J2 = $.length - 1;J2 >= 0; J2--) {
1438
+ let X3 = $[J2];
1439
+ if (X3 === undefined)
1122
1440
  continue;
1123
- if (mF($) ? !B3 : !V)
1441
+ if (uZ(X3) ? !Z : !z)
1124
1442
  continue;
1125
- Z = D3(Z, pF($));
1443
+ Q = L4(Q, zZ(X3));
1126
1444
  }
1127
- return Z;
1445
+ return Q;
1128
1446
  }
1129
- function qB(F3, Y) {
1130
- let B3 = new Map;
1131
- function V(z3) {
1132
- return z3.join("|");
1133
- }
1134
- function Z(z3) {
1135
- let $ = V(z3), K = B3.get($);
1136
- if (K)
1137
- return K;
1138
- let j = (U2) => DB(U2, z3, F3, Y);
1139
- B3.set($, j);
1140
- for (let U2 of I4)
1141
- Object.defineProperty(j, U2, { configurable: false, enumerable: true, get() {
1142
- return Z([...z3, U2]);
1447
+ function hZ(V2, $, Z) {
1448
+ let z = new Map;
1449
+ function Q(X3) {
1450
+ return X3.map((H) => H.kind === "named" ? H.name : `~${H.pair.open}`).join("|");
1451
+ }
1452
+ function J2(X3) {
1453
+ let H = Q(X3), q = z.get(H);
1454
+ if (q)
1455
+ return q;
1456
+ let G2 = (K, ...B) => {
1457
+ if (Array.isArray(K) && "raw" in K && Array.isArray(K.raw)) {
1458
+ let N4 = K, D4 = "";
1459
+ for (let A4 = 0;A4 < N4.length; A4++)
1460
+ if (D4 += N4[A4] ?? "", A4 < B.length)
1461
+ D4 += String(B[A4]);
1462
+ return ZZ(D4, X3, V2, $);
1463
+ }
1464
+ return ZZ(K, X3, V2, $);
1465
+ };
1466
+ z.set(H, G2);
1467
+ for (let K of E4)
1468
+ Object.defineProperty(G2, K, { configurable: false, enumerable: true, get() {
1469
+ return J2([...X3, { kind: "named", name: K }]);
1143
1470
  } });
1144
- return Object.freeze(j);
1145
- }
1146
- return Z;
1147
- }
1148
- function RB(F3) {
1149
- let Y = {};
1150
- for (let B3 of I4)
1151
- Y[B3] = F3([B3]);
1152
- return Y;
1153
- }
1154
- function A4(F3) {
1155
- let Y = F3?.mode ?? "auto", B3 = NF(Y, F3?.overrides), V = M3(Y, F3?.overrides), Z = kF(Y, F3?.overrides), z3 = B3 || V, $ = S2(Y, F3?.overrides), K = qB(B3, V), j = RB(K), U2 = { enabled: z3, colorsEnabled: V, trueColorEnabled: $, apply: (X2, G) => {
1156
- return (hF(G) ? B3 : V) ? D3(X2, G) : X2;
1157
- }, link: Z ? (X2, G, _5) => vF(X2, G, _5) : (X2, G) => X2, rgb: $ ? (X2, G, _5, H) => fF(X2, G, _5, H) : (X2, G, _5, H) => X2, bgRgb: $ ? (X2, G, _5, H) => yF(X2, G, _5, H) : (X2, G, _5, H) => X2, hex: $ ? (X2, G) => wF(X2, G) : (X2, G) => X2, bgHex: $ ? (X2, G) => CF(X2, G) : (X2, G) => X2, ...j };
1158
- return Object.freeze(U2);
1159
- }
1160
- var L;
1161
- var cF = new Map;
1162
- function MB() {
1163
- if (L === "always")
1164
- return A4({ mode: "always" });
1165
- if (L === "never")
1166
- return A4({ mode: "auto", overrides: { isTTY: true, noColor: "1" } });
1167
- return A4({ mode: "auto" });
1168
- }
1169
- function b4() {
1170
- let F3 = `${L ?? "auto"}|${process.stdout?.isTTY ?? false}|${process.env.NO_COLOR ?? ""}`, Y = cF.get(F3);
1171
- if (Y)
1172
- return Y;
1173
- let B3 = MB();
1174
- return cF.set(F3, B3), B3;
1175
- }
1176
- var IB = ["apply", "link", "rgb", "bgRgb", "hex", "bgHex"];
1177
- var TB = ["enabled", "colorsEnabled", "trueColorEnabled"];
1178
- function EB() {
1179
- let F3 = {};
1180
- for (let Y of TB)
1181
- Object.defineProperty(F3, Y, { configurable: false, enumerable: true, get() {
1182
- return b4()[Y];
1471
+ Object.defineProperty(G2, "fg", { configurable: false, enumerable: true, value: (K) => J2([...X3, { kind: "pair", pair: h4(K, Z), isModifier: false }]), writable: false }), Object.defineProperty(G2, "bg", { configurable: false, enumerable: true, value: (K) => J2([...X3, { kind: "pair", pair: p2(K, Z), isModifier: false }]), writable: false });
1472
+ let _4 = "", Y2 = "";
1473
+ for (let K of X3) {
1474
+ let B = zZ(K);
1475
+ _4 += B.open, Y2 = B.close + Y2;
1476
+ }
1477
+ return Object.defineProperty(G2, "open", { value: _4, writable: false, configurable: false, enumerable: true }), Object.defineProperty(G2, "close", { value: Y2, writable: false, configurable: false, enumerable: true }), Object.freeze(G2);
1478
+ }
1479
+ return J2;
1480
+ }
1481
+ function pZ(V2) {
1482
+ let $ = {};
1483
+ for (let Z of E4)
1484
+ $[Z] = V2([{ kind: "named", name: Z }]);
1485
+ return $;
1486
+ }
1487
+ function T2(V2) {
1488
+ let $ = V2?.mode ?? "auto", Z = xV($, V2?.overrides), z = x3($, V2?.overrides), Q = z !== "none", J2 = z === "truecolor", X3 = gV($, V2?.overrides), H = Z || Q, q = hZ(Z, Q, z), G2 = pZ(q), _4 = { enabled: H, colorsEnabled: Q, trueColorEnabled: J2, colorDepth: z, apply: (Y2, K) => {
1489
+ return (VZ(K) ? Z : Q) ? L4(Y2, K) : Y2;
1490
+ }, link: X3 ? (Y2, K, B) => iV(Y2, K, B) : (Y2, K, B) => {
1491
+ return S4(K, B), Y2;
1492
+ }, fg: (Y2, K) => {
1493
+ if (K === undefined)
1494
+ return q([{ kind: "pair", pair: h4(Y2, z), isModifier: false }]);
1495
+ return I2(Y2, K, z);
1496
+ }, bg: (Y2, K) => {
1497
+ if (K === undefined)
1498
+ return q([{ kind: "pair", pair: p2(Y2, z), isModifier: false }]);
1499
+ return k4(Y2, K, z);
1500
+ }, rgb: J2 ? (Y2, K, B, N4) => lV(Y2, K, B, N4) : (Y2, K, B, N4) => Y2, bgRgb: J2 ? (Y2, K, B, N4) => sV(Y2, K, B, N4) : (Y2, K, B, N4) => Y2, hex: J2 ? (Y2, K) => nV(Y2, K) : (Y2, K) => Y2, bgHex: J2 ? (Y2, K) => aV(Y2, K) : (Y2, K) => Y2, ...G2 };
1501
+ return Object.freeze(_4);
1502
+ }
1503
+ var F4;
1504
+ var $Z = new Map;
1505
+ function lZ() {
1506
+ if (F4 === "always")
1507
+ return T2({ mode: "always" });
1508
+ if (F4 === "never")
1509
+ return T2({ mode: "auto", overrides: { isTTY: true, noColor: "1" } });
1510
+ return T2({ mode: "auto" });
1511
+ }
1512
+ function W() {
1513
+ let V2 = [F4 ?? "auto", process.stdout?.isTTY ?? false, process.env.NO_COLOR ?? "", process.env.COLORTERM ?? "", process.env.TERM ?? ""].join("|"), $ = $Z.get(V2);
1514
+ if ($)
1515
+ return $;
1516
+ let Z = lZ();
1517
+ return $Z.set(V2, Z), Z;
1518
+ }
1519
+ var sZ = ["apply", "link", "fg", "bg", "rgb", "bgRgb", "hex", "bgHex"];
1520
+ var nZ = ["enabled", "colorsEnabled", "trueColorEnabled", "colorDepth"];
1521
+ function j2(V2) {
1522
+ let $ = (...z) => W()[V2](...z);
1523
+ for (let z of E4)
1524
+ Object.defineProperty($, z, { configurable: false, enumerable: true, get() {
1525
+ return W()[V2][z];
1183
1526
  } });
1184
- for (let Y of IB)
1185
- Object.defineProperty(F3, Y, { configurable: false, enumerable: true, value: (...B3) => {
1186
- return b4()[Y](...B3);
1187
- }, writable: false });
1188
- for (let Y of I4)
1189
- Object.defineProperty(F3, Y, { configurable: false, enumerable: true, get() {
1190
- return b4()[Y];
1527
+ Object.defineProperty($, "fg", { configurable: false, enumerable: true, value: (z) => W()[V2].fg(z), writable: false }), Object.defineProperty($, "bg", { configurable: false, enumerable: true, value: (z) => W()[V2].bg(z), writable: false });
1528
+ let Z = a(V2);
1529
+ return Object.defineProperty($, "open", { value: Z.open, writable: false, configurable: false, enumerable: true }), Object.defineProperty($, "close", { value: Z.close, writable: false, configurable: false, enumerable: true }), Object.freeze($);
1530
+ }
1531
+ function aZ() {
1532
+ let V2 = {};
1533
+ for (let $ of nZ)
1534
+ Object.defineProperty(V2, $, { configurable: false, enumerable: true, get() {
1535
+ return W()[$];
1191
1536
  } });
1192
- return Object.freeze(F3);
1193
- }
1194
- var Q = EB();
1195
- var kB = (F3) => Q.red(F3);
1196
- var gB = (F3) => Q.green(F3);
1197
- var yB = (F3) => Q.cyan(F3);
1198
- var ZY = (F3) => Q.bold(F3);
1199
- var $Y = (F3) => Q.dim(F3);
1200
- function P4(F3) {
1201
- return Object.freeze({ heading1: (B3) => F3.bold(F3.underline(B3)), heading2: (B3) => F3.bold(B3), heading3: (B3) => F3.bold(F3.yellow(B3)), heading4: (B3) => F3.yellow(B3), heading5: (B3) => F3.dim(F3.yellow(B3)), heading6: (B3) => F3.dim(B3), text: (B3) => B3, emphasis: (B3) => F3.italic(B3), strong: (B3) => F3.bold(B3), strongEmphasis: (B3) => F3.bold(F3.italic(B3)), strikethrough: (B3) => F3.strikethrough(B3), inlineCode: (B3) => F3.cyan(B3), linkText: (B3) => F3.blue(F3.underline(B3)), linkUrl: (B3) => F3.dim(F3.underline(B3)), autolink: (B3) => F3.blue(F3.underline(B3)), blockquoteMarker: (B3) => F3.dim(F3.green(B3)), blockquoteText: (B3) => F3.italic(B3), listMarker: (B3) => F3.dim(B3), orderedListMarker: (B3) => F3.dim(B3), taskChecked: (B3) => F3.green(B3), taskUnchecked: (B3) => F3.dim(B3), codeFence: (B3) => F3.dim(B3), codeInfo: (B3) => F3.dim(F3.italic(B3)), codeText: (B3) => F3.cyan(B3), thematicBreak: (B3) => F3.dim(B3), tableHeader: (B3) => F3.bold(B3), tableCell: (B3) => B3, tableBorder: (B3) => F3.dim(B3), imageAltText: (B3) => F3.italic(F3.magenta(B3)), imageUrl: (B3) => F3.dim(F3.underline(B3)) });
1202
- }
1203
- function nF(F3) {
1204
- let Y = A4(F3?.style), B3 = P4(Y), V = F3?.overrides;
1205
- if (!V)
1206
- return B3;
1207
- let Z = { heading1: V.heading1 ?? B3.heading1, heading2: V.heading2 ?? B3.heading2, heading3: V.heading3 ?? B3.heading3, heading4: V.heading4 ?? B3.heading4, heading5: V.heading5 ?? B3.heading5, heading6: V.heading6 ?? B3.heading6, text: V.text ?? B3.text, emphasis: V.emphasis ?? B3.emphasis, strong: V.strong ?? B3.strong, strongEmphasis: V.strongEmphasis ?? B3.strongEmphasis, strikethrough: V.strikethrough ?? B3.strikethrough, inlineCode: V.inlineCode ?? B3.inlineCode, linkText: V.linkText ?? B3.linkText, linkUrl: V.linkUrl ?? B3.linkUrl, autolink: V.autolink ?? B3.autolink, blockquoteMarker: V.blockquoteMarker ?? B3.blockquoteMarker, blockquoteText: V.blockquoteText ?? B3.blockquoteText, listMarker: V.listMarker ?? B3.listMarker, orderedListMarker: V.orderedListMarker ?? B3.orderedListMarker, taskChecked: V.taskChecked ?? B3.taskChecked, taskUnchecked: V.taskUnchecked ?? B3.taskUnchecked, codeFence: V.codeFence ?? B3.codeFence, codeInfo: V.codeInfo ?? B3.codeInfo, codeText: V.codeText ?? B3.codeText, thematicBreak: V.thematicBreak ?? B3.thematicBreak, tableHeader: V.tableHeader ?? B3.tableHeader, tableCell: V.tableCell ?? B3.tableCell, tableBorder: V.tableBorder ?? B3.tableBorder, imageAltText: V.imageAltText ?? B3.imageAltText, imageUrl: V.imageUrl ?? B3.imageUrl };
1208
- return Object.freeze(Z);
1209
- }
1210
- var MY = nF();
1537
+ for (let $ of sZ)
1538
+ Object.defineProperty(V2, $, { configurable: false, enumerable: true, value: (...Z) => {
1539
+ return W()[$](...Z);
1540
+ }, writable: false });
1541
+ for (let $ of E4)
1542
+ Object.defineProperty(V2, $, { configurable: false, enumerable: true, value: j2($), writable: false });
1543
+ return Object.freeze(V2);
1544
+ }
1545
+ var R2 = aZ();
1546
+ var oZ = j2("black");
1547
+ var rZ = j2("red");
1548
+ var iZ = j2("green");
1549
+ var tZ = j2("yellow");
1550
+ var eZ = j2("blue");
1551
+ var V$ = j2("magenta");
1552
+ var Z$ = j2("cyan");
1553
+ var $$ = j2("white");
1554
+ var z$ = j2("gray");
1555
+ var Q$ = j2("brightRed");
1556
+ var J$ = j2("brightGreen");
1557
+ var X$ = j2("brightYellow");
1558
+ var K$ = j2("brightBlue");
1559
+ var Y$ = j2("brightMagenta");
1560
+ var j$ = j2("brightCyan");
1561
+ var U$ = j2("brightWhite");
1562
+ var H$ = j2("bgBlack");
1563
+ var q$ = j2("bgRed");
1564
+ var B$ = j2("bgGreen");
1565
+ var G$ = j2("bgYellow");
1566
+ var _$ = j2("bgBlue");
1567
+ var A$ = j2("bgMagenta");
1568
+ var L$ = j2("bgCyan");
1569
+ var D$ = j2("bgWhite");
1570
+ var N$ = j2("bgBrightBlack");
1571
+ var M$ = j2("bgBrightRed");
1572
+ var R$ = j2("bgBrightGreen");
1573
+ var O$ = j2("bgBrightYellow");
1574
+ var W$ = j2("bgBrightBlue");
1575
+ var T$ = j2("bgBrightMagenta");
1576
+ var E$ = j2("bgBrightCyan");
1577
+ var F$ = j2("bgBrightWhite");
1578
+ var I$ = j2("bold");
1579
+ var k$ = j2("dim");
1580
+ var S$ = j2("italic");
1581
+ var f$ = j2("underline");
1582
+ var w$ = j2("inverse");
1583
+ var C$ = j2("hidden");
1584
+ var P$ = j2("strikethrough");
1585
+ function QZ(V2) {
1586
+ return Object.freeze({ heading1: (Z) => V2.bold(V2.underline(Z)), heading2: (Z) => V2.bold(Z), heading3: (Z) => V2.bold(V2.yellow(Z)), heading4: (Z) => V2.yellow(Z), heading5: (Z) => V2.dim(V2.yellow(Z)), heading6: (Z) => V2.dim(Z), text: (Z) => Z, emphasis: (Z) => V2.italic(Z), strong: (Z) => V2.bold(Z), strongEmphasis: (Z) => V2.bold(V2.italic(Z)), strikethrough: (Z) => V2.strikethrough(Z), inlineCode: (Z) => V2.cyan(Z), linkText: (Z) => V2.blue(V2.underline(Z)), linkUrl: (Z) => V2.dim(V2.underline(Z)), autolink: (Z) => V2.blue(V2.underline(Z)), blockquoteMarker: (Z) => V2.dim(V2.green(Z)), blockquoteText: (Z) => V2.italic(Z), listMarker: (Z) => V2.dim(Z), orderedListMarker: (Z) => V2.dim(Z), taskChecked: (Z) => V2.green(Z), taskUnchecked: (Z) => V2.dim(Z), codeFence: (Z) => V2.dim(Z), codeInfo: (Z) => V2.dim(V2.italic(Z)), codeText: (Z) => V2.cyan(Z), thematicBreak: (Z) => V2.dim(Z), tableHeader: (Z) => V2.bold(Z), tableCell: (Z) => Z, tableBorder: (Z) => V2.dim(Z), imageAltText: (Z) => V2.italic(V2.magenta(Z)), imageUrl: (Z) => V2.dim(V2.underline(Z)) });
1587
+ }
1588
+ function JZ(V2) {
1589
+ let $ = T2(V2?.style), Z = QZ($), z = V2?.overrides;
1590
+ if (!z)
1591
+ return Z;
1592
+ let Q = { heading1: z.heading1 ?? Z.heading1, heading2: z.heading2 ?? Z.heading2, heading3: z.heading3 ?? Z.heading3, heading4: z.heading4 ?? Z.heading4, heading5: z.heading5 ?? Z.heading5, heading6: z.heading6 ?? Z.heading6, text: z.text ?? Z.text, emphasis: z.emphasis ?? Z.emphasis, strong: z.strong ?? Z.strong, strongEmphasis: z.strongEmphasis ?? Z.strongEmphasis, strikethrough: z.strikethrough ?? Z.strikethrough, inlineCode: z.inlineCode ?? Z.inlineCode, linkText: z.linkText ?? Z.linkText, linkUrl: z.linkUrl ?? Z.linkUrl, autolink: z.autolink ?? Z.autolink, blockquoteMarker: z.blockquoteMarker ?? Z.blockquoteMarker, blockquoteText: z.blockquoteText ?? Z.blockquoteText, listMarker: z.listMarker ?? Z.listMarker, orderedListMarker: z.orderedListMarker ?? Z.orderedListMarker, taskChecked: z.taskChecked ?? Z.taskChecked, taskUnchecked: z.taskUnchecked ?? Z.taskUnchecked, codeFence: z.codeFence ?? Z.codeFence, codeInfo: z.codeInfo ?? Z.codeInfo, codeText: z.codeText ?? Z.codeText, thematicBreak: z.thematicBreak ?? Z.thematicBreak, tableHeader: z.tableHeader ?? Z.tableHeader, tableCell: z.tableCell ?? Z.tableCell, tableBorder: z.tableBorder ?? Z.tableBorder, imageAltText: z.imageAltText ?? Z.imageAltText, imageUrl: z.imageUrl ?? Z.imageUrl };
1593
+ return Object.freeze(Q);
1594
+ }
1595
+ var n$ = JZ();
1211
1596
 
1212
- // ../../node_modules/.bun/@crustjs+prompts@0.0.13+7524df1edfed9f02/node_modules/@crustjs/prompts/dist/index.js
1213
- import * as QJ from "readline";
1597
+ // ../../node_modules/.bun/@crustjs+prompts@0.1.0+7524df1edfed9f02/node_modules/@crustjs/prompts/dist/index.js
1598
+ import * as ZJ from "readline";
1214
1599
 
1215
- // ../../node_modules/.bun/@crustjs+progress@0.0.3+7524df1edfed9f02/node_modules/@crustjs/progress/dist/index.js
1216
- var Q2 = "\x1B[";
1217
- var N3 = `${Q2}?25l`;
1218
- var J2 = `${Q2}?25h`;
1219
- var V = `${Q2}2K`;
1600
+ // ../../node_modules/.bun/@crustjs+progress@0.0.4+7524df1edfed9f02/node_modules/@crustjs/progress/dist/index.js
1601
+ var Q = "\x1B[";
1602
+ var N4 = `${Q}?25l`;
1603
+ var J2 = `${Q}?25h`;
1604
+ var V2 = `${Q}2K`;
1220
1605
 
1221
- // ../../node_modules/.bun/@crustjs+prompts@0.0.13+7524df1edfed9f02/node_modules/@crustjs/prompts/dist/index.js
1222
- var b5 = { prefix: yB, message: ZY, placeholder: $Y, cursor: yB, selected: yB, unselected: $Y, error: kB, success: gB, hint: $Y, filterMatch: yB };
1223
- var h5;
1606
+ // ../../node_modules/.bun/@crustjs+prompts@0.1.0+7524df1edfed9f02/node_modules/@crustjs/prompts/dist/index.js
1607
+ var b5 = { prefix: Z$, message: I$, placeholder: k$, cursor: Z$, selected: Z$, unselected: k$, error: rZ, success: iZ, hint: k$, filterMatch: Z$ };
1608
+ var u2;
1224
1609
  function w4(J3) {
1225
- if (!h5 && !J3)
1610
+ if (!u2 && !J3)
1226
1611
  return b5;
1227
- return { ...b5, ...h5, ...J3 };
1612
+ return { ...b5, ...u2, ...J3 };
1228
1613
  }
1229
- var i2 = Symbol("submit");
1230
- function M4(J3) {
1231
- return { [i2]: J3 };
1614
+ var a2 = Symbol("submit");
1615
+ function H(J3) {
1616
+ return { [a2]: J3 };
1232
1617
  }
1233
- var o2 = false;
1234
- var u2 = "\x1B[";
1235
- var zJ = `${u2}?25l`;
1236
- var NJ = `${u2}?25h`;
1237
- var qJ = `${u2}2K`;
1238
- function e2(J3) {
1239
- return J3 > 0 ? `${u2}${J3}A` : "";
1618
+ var i2 = false;
1619
+ var c2 = "\x1B[";
1620
+ var HJ = `${c2}?25l`;
1621
+ var MJ = `${c2}?25h`;
1622
+ var qJ = `${c2}2K`;
1623
+ function JJ(J3) {
1624
+ return J3 > 0 ? `${c2}${J3}A` : "";
1240
1625
  }
1241
- function JJ(J3, Q3) {
1626
+ function QJ(J3, Q2) {
1242
1627
  let Z = J3.split(`
1243
1628
  `), W2 = 0;
1244
- for (let G of Z) {
1245
- let $ = O2(G);
1246
- W2 += $ === 0 ? 1 : Math.ceil($ / Q3);
1629
+ for (let G2 of Z) {
1630
+ let $ = M3(G2);
1631
+ W2 += $ === 0 ? 1 : Math.ceil($ / Q2);
1247
1632
  }
1248
1633
  return W2;
1249
1634
  }
1250
1635
 
1251
- class a2 extends Error {
1636
+ class s2 extends Error {
1252
1637
  constructor(J3) {
1253
1638
  super(J3 ?? "Prompts require an interactive terminal (TTY).");
1254
1639
  this.name = "NonInteractiveError";
1255
1640
  }
1256
1641
  }
1257
1642
 
1258
- class s2 extends Error {
1643
+ class t2 extends Error {
1259
1644
  constructor(J3) {
1260
1645
  super(J3 ?? "Prompt was cancelled.");
1261
1646
  this.name = "CancelledError";
1262
1647
  }
1263
1648
  }
1264
- function _5() {
1649
+ function _4() {
1265
1650
  return !!process.stdin.isTTY;
1266
1651
  }
1267
- function ZJ() {
1268
- if (!_5())
1269
- throw new a2;
1652
+ function $J() {
1653
+ if (!_4())
1654
+ throw new s2;
1270
1655
  }
1271
- function HJ(J3) {
1272
- return typeof J3 === "object" && J3 !== null && i2 in J3;
1656
+ function DJ(J3) {
1657
+ return typeof J3 === "object" && J3 !== null && a2 in J3;
1273
1658
  }
1274
1659
  function D4(J3) {
1275
- let { render: Q3, handleKey: Z, initialState: W2, theme: G, renderSubmitted: $ } = J3;
1276
- return new Promise((K, Y) => {
1277
- if (o2) {
1278
- Y(Error("Cannot run multiple prompts concurrently. Await each prompt before starting the next."));
1660
+ let { render: Q2, handleKey: Z, initialState: W2, theme: G2, renderSubmitted: $ } = J3;
1661
+ return new Promise((K, j3) => {
1662
+ if (i2) {
1663
+ j3(Error("Cannot run multiple prompts concurrently. Await each prompt before starting the next."));
1279
1664
  return;
1280
1665
  }
1281
1666
  try {
1282
- ZJ();
1283
- } catch (U2) {
1284
- Y(U2);
1667
+ $J();
1668
+ } catch (A4) {
1669
+ j3(A4);
1285
1670
  return;
1286
1671
  }
1287
- o2 = true;
1288
- let j = W2, X2 = 0, F3 = false, B3 = process.stdin, z3 = process.stderr;
1289
- function N4() {
1290
- if (F3)
1672
+ i2 = true;
1673
+ let Y2 = W2, X3 = 0, F5 = false, B = process.stdin, z = process.stderr;
1674
+ function N5() {
1675
+ if (F5)
1291
1676
  return;
1292
- if (F3 = true, o2 = false, B3.removeListener("keypress", x4), B3.isTTY && B3.isRaw)
1293
- B3.setRawMode(false);
1294
- B3.pause(), z3.write(NJ);
1295
- }
1296
- function H(U2) {
1297
- let T3 = z3.columns || 80;
1298
- if (X2 > 0) {
1299
- z3.write(`${e2(X2 - 1)}\r`);
1300
- for (let p2 = 0;p2 < X2; p2++)
1301
- if (z3.write(qJ), p2 < X2 - 1)
1302
- z3.write(`${u2}1B`);
1303
- if (X2 > 1)
1304
- z3.write(e2(X2 - 1));
1305
- z3.write("\r");
1677
+ if (F5 = true, i2 = false, B.removeListener("keypress", p3), B.isTTY && B.isRaw)
1678
+ B.setRawMode(false);
1679
+ B.pause(), z.write(MJ);
1680
+ }
1681
+ function q(A4) {
1682
+ let T3 = z.columns || 80;
1683
+ if (X3 > 0) {
1684
+ z.write(`${JJ(X3 - 1)}\r`);
1685
+ for (let d2 = 0;d2 < X3; d2++)
1686
+ if (z.write(qJ), d2 < X3 - 1)
1687
+ z.write(`${c2}1B`);
1688
+ if (X3 > 1)
1689
+ z.write(JJ(X3 - 1));
1690
+ z.write("\r");
1306
1691
  }
1307
- z3.write(U2), X2 = JJ(U2, T3);
1692
+ z.write(A4), X3 = QJ(A4, T3);
1308
1693
  }
1309
- let P5 = Promise.resolve(), R3 = null;
1310
- function I5() {
1311
- if (R3 !== null)
1694
+ let P4 = Promise.resolve(), O4 = null;
1695
+ function k5() {
1696
+ if (O4 !== null)
1312
1697
  return;
1313
- R3 = setTimeout(() => {
1314
- if (R3 = null, !F3)
1315
- H(Q3(j, G));
1698
+ O4 = setTimeout(() => {
1699
+ if (O4 = null, !F5)
1700
+ q(Q2(Y2, G2));
1316
1701
  }, 0);
1317
1702
  }
1318
- function y4() {
1319
- if (R3 !== null)
1320
- clearTimeout(R3), R3 = null;
1703
+ function x4() {
1704
+ if (O4 !== null)
1705
+ clearTimeout(O4), O4 = null;
1321
1706
  }
1322
- function x4(U2, T3) {
1707
+ function p3(A4, T3) {
1323
1708
  if (T3?.ctrl && T3.name === "c") {
1324
- y4(), z3.write(`
1325
- `), N4(), Y(new s2);
1709
+ x4(), z.write(`
1710
+ `), N5(), j3(new t2);
1326
1711
  return;
1327
1712
  }
1328
- let p2 = { char: U2 ?? "", name: T3?.name ?? "", ctrl: T3?.ctrl ?? false, meta: T3?.meta ?? false, shift: T3?.shift ?? false };
1329
- P5 = P5.then(async () => {
1330
- if (F3)
1713
+ let d2 = { char: A4 ?? "", name: T3?.name ?? "", ctrl: T3?.ctrl ?? false, meta: T3?.meta ?? false, shift: T3?.shift ?? false };
1714
+ P4 = P4.then(async () => {
1715
+ if (F5)
1331
1716
  return;
1332
1717
  try {
1333
- let d2 = await Z(p2, j);
1334
- if (HJ(d2)) {
1335
- y4();
1336
- let t2 = d2[i2];
1718
+ let h5 = await Z(d2, Y2);
1719
+ if (DJ(h5)) {
1720
+ x4();
1721
+ let e2 = h5[a2];
1337
1722
  if ($)
1338
- H($(j, t2, G));
1339
- z3.write(`
1340
- `), N4(), K(t2);
1723
+ q($(Y2, e2, G2));
1724
+ z.write(`
1725
+ `), N5(), K(e2);
1341
1726
  } else
1342
- j = d2, I5();
1343
- } catch (d2) {
1344
- y4(), N4(), Y(d2);
1727
+ Y2 = h5, k5();
1728
+ } catch (h5) {
1729
+ x4(), N5(), j3(h5);
1345
1730
  }
1346
1731
  });
1347
1732
  }
1348
1733
  try {
1349
- QJ.emitKeypressEvents(B3), B3.setRawMode(true), B3.resume(), z3.write(zJ);
1350
- let U2 = Q3(j, G);
1351
- z3.write(U2);
1352
- let T3 = z3.columns || 80;
1353
- X2 = JJ(U2, T3), B3.on("keypress", x4);
1354
- } catch (U2) {
1355
- N4(), Y(U2);
1734
+ ZJ.emitKeypressEvents(B), B.setRawMode(true), B.resume(), z.write(HJ);
1735
+ let A4 = Q2(Y2, G2);
1736
+ z.write(A4);
1737
+ let T3 = z.columns || 80;
1738
+ X3 = QJ(A4, T3), B.on("keypress", p3);
1739
+ } catch (A4) {
1740
+ N5(), j3(A4);
1356
1741
  }
1357
1742
  });
1358
1743
  }
1359
- var V2 = "┃";
1360
- var E3 = "✓";
1361
- function c2(J3, Q3) {
1362
- if (Q3)
1363
- return `${J3} ${Q3}`;
1744
+ var V3 = "┃";
1745
+ var E5 = "✓";
1746
+ function m3(J3, Q2) {
1747
+ if (Q2)
1748
+ return `${J3} ${Q2}`;
1364
1749
  return J3;
1365
1750
  }
1366
- function A5(J3, Q3, Z) {
1751
+ function U2(J3, Q2, Z) {
1367
1752
  let W2 = [J3];
1368
- if (Q3)
1369
- W2.push(Q3);
1753
+ if (Q2)
1754
+ W2.push(Q2);
1370
1755
  if (Z)
1371
1756
  W2.push(Z);
1372
1757
  return W2.join(" ");
1373
1758
  }
1374
- function L2(J3, Q3, Z, W2) {
1375
- let G = c2(J3, Q3), $ = W2 ?? "";
1376
- if (Q3)
1377
- return `${G}${$}
1759
+ function R3(J3, Q2, Z, W2) {
1760
+ let G2 = m3(J3, Q2), $ = W2 ?? "";
1761
+ if (Q2)
1762
+ return `${G2}${$}
1378
1763
  ${Z}`;
1379
- return `${G}${$} ${Z}`;
1764
+ return `${G2}${$} ${Z}`;
1380
1765
  }
1381
- function MJ(J3, Q3) {
1766
+ function UJ(J3, Q2) {
1382
1767
  if (J3.name === "return")
1383
- return M4(Q3.value);
1768
+ return H(Q2.value);
1384
1769
  if (J3.name === "left" || J3.name === "right")
1385
- return { value: !Q3.value };
1770
+ return { value: !Q2.value };
1386
1771
  if (J3.name === "h")
1387
1772
  return { value: true };
1388
1773
  if (J3.name === "l")
1389
1774
  return { value: false };
1390
1775
  if (J3.name === "tab")
1391
- return { value: !Q3.value };
1776
+ return { value: !Q2.value };
1392
1777
  if (J3.char === "y" || J3.char === "Y")
1393
1778
  return { value: true };
1394
1779
  if (J3.char === "n" || J3.char === "N")
1395
1780
  return { value: false };
1396
- return Q3;
1781
+ return Q2;
1397
1782
  }
1398
- var DJ = " · ";
1399
- function AJ(J3, Q3, Z, W2, G) {
1400
- let $ = Q3.prefix(V2), K = Q3.message(Z ?? "Are you sure?"), Y = J3.value ? `${Q3.selected("●")} ${Q3.selected(W2)}` : `${Q3.unselected("○")} ${Q3.unselected(W2)}`, j = J3.value ? `${Q3.unselected("○")} ${Q3.unselected(G)}` : `${Q3.selected("●")} ${Q3.selected(G)}`, X2 = `${Y}${DJ}${j}`;
1401
- return L2($, K, X2);
1783
+ var AJ = " · ";
1784
+ function wJ(J3, Q2, Z, W2, G2) {
1785
+ let $ = Q2.prefix(V3), K = Q2.message(Z ?? "Are you sure?"), j3 = J3.value ? `${Q2.selected("●")} ${Q2.selected(W2)}` : `${Q2.unselected("○")} ${Q2.unselected(W2)}`, Y2 = J3.value ? `${Q2.unselected("○")} ${Q2.unselected(G2)}` : `${Q2.selected("●")} ${Q2.selected(G2)}`, X3 = `${j3}${AJ}${Y2}`;
1786
+ return R3($, K, X3);
1402
1787
  }
1403
- function UJ(J3, Q3, Z, W2, G, $) {
1404
- let K = Z.success(E3), Y = Z.message(W2 ?? "Are you sure?"), j = Q3 ? G : $;
1405
- return A5(K, Y, Z.success(j));
1788
+ function _J(J3, Q2, Z, W2, G2, $) {
1789
+ let K = Z.success(E5), j3 = Z.message(W2 ?? "Are you sure?"), Y2 = Q2 ? G2 : $;
1790
+ return U2(K, j3, Z.success(Y2));
1406
1791
  }
1407
- async function wJ(J3) {
1792
+ async function VJ(J3) {
1408
1793
  if (J3.initial !== undefined)
1409
1794
  return J3.initial;
1410
- if (!_5() && J3.default !== undefined)
1795
+ if (!_4() && J3.default !== undefined)
1411
1796
  return J3.default;
1412
- let Q3 = w4(J3.theme), Z = J3.active ?? "Yes", W2 = J3.inactive ?? "No", $ = { value: J3.default ?? true };
1413
- return D4({ initialState: $, theme: Q3, render: (K, Y) => AJ(K, Y, J3.message, Z, W2), handleKey: MJ, renderSubmitted: (K, Y, j) => UJ(K, Y, j, J3.message, Z, W2) });
1797
+ let Q2 = w4(J3.theme), Z = J3.active ?? "Yes", W2 = J3.inactive ?? "No", $ = { value: J3.default ?? true };
1798
+ return D4({ initialState: $, theme: Q2, render: (K, j3) => wJ(K, j3, J3.message, Z, W2), handleKey: UJ, renderSubmitted: (K, j3, Y2) => _J(K, j3, Y2, J3.message, Z, W2) });
1414
1799
  }
1415
1800
 
1416
1801
  // src/commands/scan.ts
@@ -1513,9 +1898,17 @@ async function resolveSource(input) {
1513
1898
  return resolveGithub(parsed.repo);
1514
1899
  }
1515
1900
 
1516
- // ../../node_modules/.bun/valibot@1.3.1+7524df1edfed9f02/node_modules/valibot/dist/index.mjs
1901
+ // ../../node_modules/.bun/valibot@1.4.1+7524df1edfed9f02/node_modules/valibot/dist/index.mjs
1517
1902
  var store$4;
1903
+ var DEFAULT_CONFIG = {
1904
+ lang: undefined,
1905
+ message: undefined,
1906
+ abortEarly: undefined,
1907
+ abortPipeEarly: undefined
1908
+ };
1518
1909
  function getGlobalConfig(config$1) {
1910
+ if (!config$1 && !store$4)
1911
+ return DEFAULT_CONFIG;
1519
1912
  return {
1520
1913
  lang: config$1?.lang ?? store$4?.lang,
1521
1914
  message: config$1?.message,
@@ -1574,17 +1967,23 @@ function _addIssue(context, label, dataset, config$1, other) {
1574
1967
  else
1575
1968
  dataset.issues = [issue];
1576
1969
  }
1970
+ var _standardCache = /* @__PURE__ */ new WeakMap;
1577
1971
  function _getStandardProps(context) {
1578
- return {
1579
- version: 1,
1580
- vendor: "valibot",
1581
- validate(value$1) {
1582
- return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
1583
- }
1584
- };
1972
+ let cached = _standardCache.get(context);
1973
+ if (!cached) {
1974
+ cached = {
1975
+ version: 1,
1976
+ vendor: "valibot",
1977
+ validate(value$1) {
1978
+ return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
1979
+ }
1980
+ };
1981
+ _standardCache.set(context, cached);
1982
+ }
1983
+ return cached;
1585
1984
  }
1586
1985
  function _isValidObjectKey(object$1, key) {
1587
- return Object.hasOwn(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
1986
+ return Object.prototype.hasOwnProperty.call(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
1588
1987
  }
1589
1988
  function _joinExpects(values$1, separator) {
1590
1989
  const list = [...new Set(values$1)];
@@ -1659,64 +2058,6 @@ function transform(operation) {
1659
2058
  }
1660
2059
  };
1661
2060
  }
1662
- var _LruCache = class {
1663
- constructor(config$1) {
1664
- this.refCount = 0;
1665
- this.maxSize = config$1?.maxSize ?? 1000;
1666
- this.maxAge = config$1?.maxAge ?? Infinity;
1667
- this.hasMaxAge = isFinite(this.maxAge);
1668
- }
1669
- #stringify(input) {
1670
- const type = typeof input;
1671
- if (type === "string")
1672
- return `"${input}"`;
1673
- if (type === "number" || type === "boolean")
1674
- return `${input}`;
1675
- if (type === "bigint")
1676
- return `${input}n`;
1677
- if (type === "object" || type === "function") {
1678
- if (input) {
1679
- this.refIds ??= /* @__PURE__ */ new WeakMap;
1680
- let id = this.refIds.get(input);
1681
- if (!id) {
1682
- id = ++this.refCount;
1683
- this.refIds.set(input, id);
1684
- }
1685
- return `#${id}`;
1686
- }
1687
- return "null";
1688
- }
1689
- return type;
1690
- }
1691
- key(input, config$1 = {}) {
1692
- return `${this.#stringify(input)}|${this.#stringify(config$1.lang)}|${this.#stringify(config$1.message)}|${this.#stringify(config$1.abortEarly)}|${this.#stringify(config$1.abortPipeEarly)}`;
1693
- }
1694
- get(key) {
1695
- if (!this.store)
1696
- return;
1697
- const entry = this.store.get(key);
1698
- if (!entry)
1699
- return;
1700
- if (this.hasMaxAge && Date.now() - entry[1] > this.maxAge) {
1701
- this.store.delete(key);
1702
- return;
1703
- }
1704
- this.store.delete(key);
1705
- this.store.set(key, entry);
1706
- return entry[0];
1707
- }
1708
- set(key, value$1) {
1709
- this.store ??= /* @__PURE__ */ new Map;
1710
- this.store.delete(key);
1711
- const timestamp = this.hasMaxAge ? Date.now() : 0;
1712
- this.store.set(key, [value$1, timestamp]);
1713
- if (this.store.size > this.maxSize)
1714
- this.store.delete(this.store.keys().next().value);
1715
- }
1716
- clear() {
1717
- this.store?.clear();
1718
- }
1719
- };
1720
2061
  function getFallback(schema, dataset, config$1) {
1721
2062
  return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
1722
2063
  }
@@ -2141,7 +2482,8 @@ function _subIssues(datasets) {
2141
2482
  if (datasets)
2142
2483
  for (const dataset of datasets)
2143
2484
  if (issues)
2144
- issues.push(...dataset.issues);
2485
+ for (const issue of dataset.issues)
2486
+ issues.push(issue);
2145
2487
  else
2146
2488
  issues = dataset.issues;
2147
2489
  return issues;
@@ -2300,10 +2642,10 @@ function makeDirLister(onSkip) {
2300
2642
  };
2301
2643
  }
2302
2644
  function dirContainsFile(list, dir, name) {
2303
- return list(dir).some((e3) => e3.isFile && e3.name === name);
2645
+ return list(dir).some((e2) => e2.isFile && e2.name === name);
2304
2646
  }
2305
2647
  function dirContainsDir(list, dir, name) {
2306
- return list(dir).some((e3) => e3.isDirectory && e3.name === name);
2648
+ return list(dir).some((e2) => e2.isDirectory && e2.name === name);
2307
2649
  }
2308
2650
  function walkTree(root, options) {
2309
2651
  const list = options.list ?? makeDirLister();
@@ -2320,7 +2662,7 @@ function walkTree(root, options) {
2320
2662
  };
2321
2663
  const walkInto = (dir) => {
2322
2664
  options.onDir?.(dir);
2323
- const entries = list(dir).filter((e3) => !options.skipDirs.has(e3.name));
2665
+ const entries = list(dir).filter((e2) => !options.skipDirs.has(e2.name));
2324
2666
  for (const entry of entries) {
2325
2667
  if (entry.isFile) {
2326
2668
  options.onFile?.(join3(dir, entry.name));
@@ -2363,14 +2705,14 @@ function readJsonFile(file) {
2363
2705
  let raw;
2364
2706
  try {
2365
2707
  raw = readFileSync(file, "utf8");
2366
- } catch (e3) {
2367
- throw new Error(`Cannot read ${file}: ${e3 instanceof Error ? e3.message : String(e3)}`, { cause: e3 });
2708
+ } catch (e2) {
2709
+ throw new Error(`Cannot read ${file}: ${e2 instanceof Error ? e2.message : String(e2)}`, { cause: e2 });
2368
2710
  }
2369
2711
  try {
2370
2712
  return JSON.parse(raw);
2371
- } catch (e3) {
2372
- throw new Error(`Invalid JSON in ${file}: ${e3 instanceof Error ? e3.message : String(e3)}`, {
2373
- cause: e3
2713
+ } catch (e2) {
2714
+ throw new Error(`Invalid JSON in ${file}: ${e2 instanceof Error ? e2.message : String(e2)}`, {
2715
+ cause: e2
2374
2716
  });
2375
2717
  }
2376
2718
  }
@@ -2477,8 +2819,8 @@ function detectMarkerFile(repoRoot) {
2477
2819
  let parsed;
2478
2820
  try {
2479
2821
  parsed = readJsonFile(markerPath);
2480
- } catch (e3) {
2481
- throw new MarkerFileError(e3 instanceof Error ? e3.message : String(e3), []);
2822
+ } catch (e2) {
2823
+ throw new MarkerFileError(e2 instanceof Error ? e2.message : String(e2), []);
2482
2824
  }
2483
2825
  const result = safeParse(MarkerFileSchema, parsed);
2484
2826
  if (!result.success) {
@@ -2521,7 +2863,7 @@ function scanRoot(repoRoot, prefix, list) {
2521
2863
  continue;
2522
2864
  }
2523
2865
  const folderPath = join5(baseDir, folder);
2524
- const entries = list(folderPath).map((e3) => e3.name);
2866
+ const entries = list(folderPath).map((e2) => e2.name);
2525
2867
  if (emit === "directory") {
2526
2868
  findings.push({
2527
2869
  kind,
@@ -2530,11 +2872,11 @@ function scanRoot(repoRoot, prefix, list) {
2530
2872
  source: "convention"
2531
2873
  });
2532
2874
  } else {
2533
- const files = entries.filter((e3) => e3.endsWith(emit.enumerateFiles));
2875
+ const files = entries.filter((e2) => e2.endsWith(emit.enumerateFiles));
2534
2876
  if (files.length > 0) {
2535
2877
  findings.push({
2536
2878
  kind,
2537
- paths: files.map((f2) => `${pathPrefix}${folder}/${f2}`),
2879
+ paths: files.map((f5) => `${pathPrefix}${folder}/${f5}`),
2538
2880
  confidence: "high",
2539
2881
  source: "convention"
2540
2882
  });
@@ -2545,7 +2887,7 @@ function scanRoot(repoRoot, prefix, list) {
2545
2887
  const parts = file.split("/");
2546
2888
  const fileName = parts[parts.length - 1] ?? file;
2547
2889
  const fileDir = parts.length > 1 ? join5(baseDir, ...parts.slice(0, -1)) : baseDir;
2548
- if (list(fileDir).some((e3) => e3.isFile && e3.name === fileName)) {
2890
+ if (list(fileDir).some((e2) => e2.isFile && e2.name === fileName)) {
2549
2891
  findings.push({
2550
2892
  kind,
2551
2893
  paths: [`${pathPrefix}${file}`],
@@ -2620,12 +2962,12 @@ function detectNonStandardManifest(repoRoot) {
2620
2962
  if (!result.success) {
2621
2963
  continue;
2622
2964
  }
2623
- const m2 = result.output;
2624
- const hasComponent = m2.skills !== undefined || m2.agents !== undefined || m2.commands !== undefined || m2.hooks !== undefined || m2.mcpServers !== undefined;
2965
+ const m4 = result.output;
2966
+ const hasComponent = m4.skills !== undefined || m4.agents !== undefined || m4.commands !== undefined || m4.hooks !== undefined || m4.mcpServers !== undefined;
2625
2967
  if (!hasComponent) {
2626
2968
  continue;
2627
2969
  }
2628
- return { filename: entry, manifest: m2 };
2970
+ return { filename: entry, manifest: m4 };
2629
2971
  }
2630
2972
  return null;
2631
2973
  }
@@ -2735,8 +3077,8 @@ function collectPlainContinuation(lines, start) {
2735
3077
  function dedentCommonIndent(lines) {
2736
3078
  let minIndent = Infinity;
2737
3079
  for (const line of lines) {
2738
- const t2 = line.trim();
2739
- if (t2 === "" || t2.startsWith("#")) {
3080
+ const t3 = line.trim();
3081
+ if (t3 === "" || t3.startsWith("#")) {
2740
3082
  continue;
2741
3083
  }
2742
3084
  minIndent = Math.min(minIndent, leadingSpaces(line));
@@ -2803,8 +3145,8 @@ function collectBlockScalar(lines, start, baseIndent, indicator) {
2803
3145
  function collectNested(lines, start, baseIndent) {
2804
3146
  let peek = start;
2805
3147
  while (peek < lines.length) {
2806
- const t2 = (lines[peek] ?? "").trim();
2807
- if (t2 !== "" && !t2.startsWith("#")) {
3148
+ const t3 = (lines[peek] ?? "").trim();
3149
+ if (t3 !== "" && !t3.startsWith("#")) {
2808
3150
  break;
2809
3151
  }
2810
3152
  peek++;
@@ -2836,11 +3178,11 @@ function collectNested(lines, start, baseIndent) {
2836
3178
  if (leadingSpaces(line) > childIndent) {
2837
3179
  continue;
2838
3180
  }
2839
- const t2 = line.trim();
2840
- if (t2 === "-") {
3181
+ const t3 = line.trim();
3182
+ if (t3 === "-") {
2841
3183
  arr.push(null);
2842
- } else if (t2.startsWith("- ")) {
2843
- arr.push(coerceYamlValue(t2.slice(2).trim()));
3184
+ } else if (t3.startsWith("- ")) {
3185
+ arr.push(coerceYamlValue(t3.slice(2).trim()));
2844
3186
  }
2845
3187
  }
2846
3188
  return { value: arr, next: i4 };
@@ -2849,8 +3191,8 @@ function collectNested(lines, start, baseIndent) {
2849
3191
  let i3 = start;
2850
3192
  for (;i3 < lines.length; i3++) {
2851
3193
  const line = lines[i3] ?? "";
2852
- const t2 = line.trim();
2853
- if (t2 === "" || t2.startsWith("#")) {
3194
+ const t3 = line.trim();
3195
+ if (t3 === "" || t3.startsWith("#")) {
2854
3196
  continue;
2855
3197
  }
2856
3198
  if (leadingSpaces(line) <= baseIndent) {
@@ -2859,13 +3201,13 @@ function collectNested(lines, start, baseIndent) {
2859
3201
  if (leadingSpaces(line) > childIndent) {
2860
3202
  continue;
2861
3203
  }
2862
- const ci = mappingColonIndex(t2);
3204
+ const ci = mappingColonIndex(t3);
2863
3205
  if (ci === -1) {
2864
3206
  continue;
2865
3207
  }
2866
- const k3 = t2.slice(0, ci).trim();
2867
- const val = t2.slice(ci + 1).trim();
2868
- map[k3] = val === "" || isBlockScalarIndicator(val) ? null : coerceYamlValue(val);
3208
+ const k5 = t3.slice(0, ci).trim();
3209
+ const val = t3.slice(ci + 1).trim();
3210
+ map[k5] = val === "" || isBlockScalarIndicator(val) ? null : coerceYamlValue(val);
2869
3211
  }
2870
3212
  return { value: map, next: i3 };
2871
3213
  }
@@ -3010,8 +3352,8 @@ function detectContentSniff(repoRoot, caches = {}) {
3010
3352
  // src/detector/caches.ts
3011
3353
  function makeScanCaches() {
3012
3354
  const skippedPaths = [];
3013
- const onSkip = (p2) => {
3014
- skippedPaths.push(p2);
3355
+ const onSkip = (p3) => {
3356
+ skippedPaths.push(p3);
3015
3357
  };
3016
3358
  return {
3017
3359
  list: makeDirLister(onSkip),
@@ -3070,8 +3412,8 @@ function stripCommonPrefix(keys) {
3070
3412
  return [...keys];
3071
3413
  }
3072
3414
  let prefix = keys[0] ?? "";
3073
- for (const k3 of keys.slice(1)) {
3074
- while (prefix !== "" && !k3.startsWith(prefix)) {
3415
+ for (const k5 of keys.slice(1)) {
3416
+ while (prefix !== "" && !k5.startsWith(prefix)) {
3075
3417
  prefix = prefix.slice(0, -1);
3076
3418
  }
3077
3419
  if (prefix === "") {
@@ -3083,7 +3425,7 @@ function stripCommonPrefix(keys) {
3083
3425
  return [...keys];
3084
3426
  }
3085
3427
  const cut = lastHyphen + 1;
3086
- const stripped = keys.map((k3) => k3.slice(cut));
3428
+ const stripped = keys.map((k5) => k5.slice(cut));
3087
3429
  if (stripped.some((s3) => s3 === "")) {
3088
3430
  return [...keys];
3089
3431
  }
@@ -3114,7 +3456,7 @@ function uniqueSlugs(slugs) {
3114
3456
  import { join as join8 } from "node:path";
3115
3457
  function enumerateSkills(containerDir, list = makeDirLister(), readFm = readFrontmatter) {
3116
3458
  const out = [];
3117
- const children = list(containerDir).filter((e3) => e3.isDirectory).map((e3) => e3.name).sort();
3459
+ const children = list(containerDir).filter((e2) => e2.isDirectory).map((e2) => e2.name).sort();
3118
3460
  for (const dir of children) {
3119
3461
  const skillPath = join8(containerDir, dir);
3120
3462
  if (!dirContainsFile(list, skillPath, "SKILL.md")) {
@@ -3138,7 +3480,7 @@ function toMeta(dir, fm) {
3138
3480
  };
3139
3481
  }
3140
3482
  function countSkillMdDirs(containerDir, list = makeDirLister(), skipDirs) {
3141
- return list(containerDir).filter((e3) => e3.isDirectory && !(skipDirs?.has(e3.name) ?? false) && dirContainsFile(list, join8(containerDir, e3.name), "SKILL.md")).length;
3483
+ return list(containerDir).filter((e2) => e2.isDirectory && !(skipDirs?.has(e2.name) ?? false) && dirContainsFile(list, join8(containerDir, e2.name), "SKILL.md")).length;
3142
3484
  }
3143
3485
 
3144
3486
  // src/detector/sourceLayout.ts
@@ -3255,7 +3597,7 @@ function shallowerThenCodeUnit(a3, b6) {
3255
3597
  }
3256
3598
  function resolveAgentsContainer(repoRoot, dirs, list, readFm) {
3257
3599
  const score = (absDir) => {
3258
- const files = list(absDir).filter((e3) => e3.isFile && e3.name.endsWith(".md") && e3.name !== "SKILL.md").map((e3) => e3.name).filter((f2) => isAgentFile(join9(absDir, f2), readFm)).sort();
3600
+ const files = list(absDir).filter((e2) => e2.isFile && e2.name.endsWith(".md") && e2.name !== "SKILL.md").map((e2) => e2.name).filter((f5) => isAgentFile(join9(absDir, f5), readFm)).sort();
3259
3601
  return {
3260
3602
  absDir,
3261
3603
  relPath: toRel(repoRoot, absDir),
@@ -3349,7 +3691,7 @@ function extractServers(parsed) {
3349
3691
  if (entries.length === 0) {
3350
3692
  return null;
3351
3693
  }
3352
- if (!hasWrapper && !entries.every((e3) => e3 !== null && typeof e3 === "object")) {
3694
+ if (!hasWrapper && !entries.every((e2) => e2 !== null && typeof e2 === "object")) {
3353
3695
  return null;
3354
3696
  }
3355
3697
  return servers;
@@ -3362,10 +3704,10 @@ function classifyServers(servers) {
3362
3704
  if (types.includes("repo-local")) {
3363
3705
  return "repo-local";
3364
3706
  }
3365
- if (types.every((t2) => t2 === "remote")) {
3707
+ if (types.every((t3) => t3 === "remote")) {
3366
3708
  return "remote";
3367
3709
  }
3368
- if (types.every((t2) => t2 === "remote" || t2 === "package")) {
3710
+ if (types.every((t3) => t3 === "remote" || t3 === "package")) {
3369
3711
  return "package";
3370
3712
  }
3371
3713
  return "unknown";
@@ -3479,17 +3821,17 @@ function dropTrailingLanguage(name) {
3479
3821
  return parts.join("-");
3480
3822
  }
3481
3823
  function groupByKey(skills, keyOf) {
3482
- const m2 = new Map;
3824
+ const m4 = new Map;
3483
3825
  for (const s3 of skills) {
3484
- const k3 = keyOf(s3);
3485
- const list = m2.get(k3) ?? [];
3826
+ const k5 = keyOf(s3);
3827
+ const list = m4.get(k5) ?? [];
3486
3828
  list.push(s3);
3487
- m2.set(k3, list);
3829
+ m4.set(k5, list);
3488
3830
  }
3489
- return m2;
3831
+ return m4;
3490
3832
  }
3491
3833
  function passesGateBounds(groups, total) {
3492
- return groups.length >= MIN_K && groups.length <= MAX_K && !groups.some((g) => g.skills.length > MAX_FRACTION * total);
3834
+ return groups.length >= MIN_K && groups.length <= MAX_K && !groups.some((g3) => g3.skills.length > MAX_FRACTION * total);
3493
3835
  }
3494
3836
  function normalizeAndGate(rawByKey, total) {
3495
3837
  let groups = [...rawByKey].map(([key, skills]) => ({ key, skills }));
@@ -3501,7 +3843,7 @@ function normalizeAndGate(rawByKey, total) {
3501
3843
  if (!passesGateBounds(groups, total)) {
3502
3844
  return null;
3503
3845
  }
3504
- return finalizeGroups(groups.map((g) => ({ slug: slugify(g.key), skills: g.skills })));
3846
+ return finalizeGroups(groups.map((g3) => ({ slug: slugify(g3.key), skills: g3.skills })));
3505
3847
  }
3506
3848
  function collapseToFit(groups, maxK) {
3507
3849
  if (groups.length <= maxK) {
@@ -3514,17 +3856,17 @@ function collapseToFit(groups, maxK) {
3514
3856
  return mergeSmallestIntoMisc(collapsed, maxK);
3515
3857
  }
3516
3858
  function collapseByLeadingSegment(groups) {
3517
- const m2 = new Map;
3518
- for (const g of groups) {
3519
- const lead = g.key.split("-")[0] ?? g.key;
3520
- const list = m2.get(lead) ?? [];
3521
- list.push(...g.skills);
3522
- m2.set(lead, list);
3859
+ const m4 = new Map;
3860
+ for (const g3 of groups) {
3861
+ const lead = g3.key.split("-")[0] ?? g3.key;
3862
+ const list = m4.get(lead) ?? [];
3863
+ list.push(...g3.skills);
3864
+ m4.set(lead, list);
3523
3865
  }
3524
- return [...m2].map(([key, skills]) => ({ key, skills }));
3866
+ return [...m4].map(([key, skills]) => ({ key, skills }));
3525
3867
  }
3526
3868
  function appendToMisc(keep, extra) {
3527
- const existingMisc = keep.find((g) => g.key === MISC);
3869
+ const existingMisc = keep.find((g3) => g3.key === MISC);
3528
3870
  if (existingMisc !== undefined) {
3529
3871
  existingMisc.skills.push(...extra);
3530
3872
  return [...keep];
@@ -3536,28 +3878,28 @@ function mergeSmallestIntoMisc(groups, maxK) {
3536
3878
  const removeCount = groups.length - maxK + 1;
3537
3879
  const toMerge = sorted.slice(0, removeCount);
3538
3880
  const keep = sorted.slice(removeCount);
3539
- return appendToMisc(keep, toMerge.flatMap((g) => g.skills));
3881
+ return appendToMisc(keep, toMerge.flatMap((g3) => g3.skills));
3540
3882
  }
3541
3883
  function coalesceTiny(groups, minSize) {
3542
- const tiny = groups.filter((g) => g.skills.length < minSize);
3884
+ const tiny = groups.filter((g3) => g3.skills.length < minSize);
3543
3885
  if (tiny.length === 0) {
3544
3886
  return [...groups];
3545
3887
  }
3546
- const big = groups.filter((g) => g.skills.length >= minSize);
3547
- return appendToMisc(big, tiny.flatMap((g) => g.skills));
3888
+ const big = groups.filter((g3) => g3.skills.length >= minSize);
3889
+ return appendToMisc(big, tiny.flatMap((g3) => g3.skills));
3548
3890
  }
3549
3891
  function finalizeGroups(groups) {
3550
- const slugs = uniqueSlugs(groups.map((g) => g.slug));
3551
- return groups.map((g, i3) => ({
3552
- slug: slugs[i3] ?? g.slug,
3553
- skills: [...g.skills].sort((a3, b6) => byCodeUnit(a3.dir, b6.dir))
3892
+ const slugs = uniqueSlugs(groups.map((g3) => g3.slug));
3893
+ return groups.map((g3, i3) => ({
3894
+ slug: slugs[i3] ?? g3.slug,
3895
+ skills: [...g3.skills].sort((a3, b6) => byCodeUnit(a3.dir, b6.dir))
3554
3896
  })).sort((a3, b6) => byCodeUnit(a3.slug, b6.slug));
3555
3897
  }
3556
3898
  function acceptRawGroups(groups, total) {
3557
3899
  if (!passesGateBounds(groups, total)) {
3558
3900
  return null;
3559
3901
  }
3560
- const covered = groups.flatMap((g) => g.skills.map((s3) => s3.dir));
3902
+ const covered = groups.flatMap((g3) => g3.skills.map((s3) => s3.dir));
3561
3903
  if (new Set(covered).size !== covered.length) {
3562
3904
  return null;
3563
3905
  }
@@ -3570,7 +3912,7 @@ function mapRawGroups(skills, raw) {
3570
3912
  const byDir = new Map(skills.map((s3) => [s3.dir, s3]));
3571
3913
  const out = [];
3572
3914
  for (const item of raw) {
3573
- const gs = item.members.map((m2) => byDir.get(m2)).filter((s3) => s3 !== undefined);
3915
+ const gs = item.members.map((m4) => byDir.get(m4)).filter((s3) => s3 !== undefined);
3574
3916
  if (gs.length > 0) {
3575
3917
  out.push({ slug: slugify(item.slug), skills: gs });
3576
3918
  }
@@ -3578,7 +3920,7 @@ function mapRawGroups(skills, raw) {
3578
3920
  return out;
3579
3921
  }
3580
3922
  function validRawItems(raw) {
3581
- return raw.filter((g) => safeParse(RawGroupSchema, g).success);
3923
+ return raw.filter((g3) => safeParse(RawGroupSchema, g3).success);
3582
3924
  }
3583
3925
  function gateRaw(skills, raw) {
3584
3926
  return acceptRawGroups(mapRawGroups(skills, raw), skills.length);
@@ -3593,19 +3935,19 @@ function matchMarkerGroups(skills, markerGroups) {
3593
3935
  const fuzzyMatched = [];
3594
3936
  for (const mg of markerGroups) {
3595
3937
  const gs = [];
3596
- for (const p2 of mg.skills) {
3597
- const norm = normalizePath2(p2);
3938
+ for (const p3 of mg.skills) {
3939
+ const norm = normalizePath2(p3);
3598
3940
  const exact = byPath.get(norm);
3599
3941
  const s3 = exact ?? byDir.get(basename2(norm));
3600
3942
  if (s3 === undefined) {
3601
- unmatched.push(p2);
3943
+ unmatched.push(p3);
3602
3944
  continue;
3603
3945
  }
3604
3946
  if (exact === undefined) {
3605
- fuzzyMatched.push(p2);
3947
+ fuzzyMatched.push(p3);
3606
3948
  }
3607
3949
  if (assigned.has(s3.dir)) {
3608
- duplicates.push(p2);
3950
+ duplicates.push(p3);
3609
3951
  continue;
3610
3952
  }
3611
3953
  gs.push(s3);
@@ -3620,8 +3962,8 @@ function matchMarkerGroups(skills, markerGroups) {
3620
3962
  function preview(items) {
3621
3963
  return items.slice(0, 3).join(", ") + (items.length > 3 ? ", …" : "");
3622
3964
  }
3623
- function normalizePath2(p2) {
3624
- return p2.endsWith("/") ? p2 : `${p2}/`;
3965
+ function normalizePath2(p3) {
3966
+ return p3.endsWith("/") ? p3 : `${p3}/`;
3625
3967
  }
3626
3968
  var deterministicFns = {
3627
3969
  metadata: partitionByMetadata,
@@ -3883,8 +4225,8 @@ function synthesizeEntryFromDetection(input, caches) {
3883
4225
  if (manifestResult !== null) {
3884
4226
  addManifestFindings(findings, manifestResult.manifest, manifestKindsWithFindings);
3885
4227
  }
3886
- let mergedFindings = findings.filter((f2) => {
3887
- if (f2.source === "convention" && manifestKindsWithFindings.has(f2.kind)) {
4228
+ let mergedFindings = findings.filter((f5) => {
4229
+ if (f5.source === "convention" && manifestKindsWithFindings.has(f5.kind)) {
3888
4230
  return false;
3889
4231
  }
3890
4232
  return true;
@@ -3961,7 +4303,7 @@ function buildEntryFromFindings(findings, repoRoot, sourceRepo) {
3961
4303
  const byKind = groupByKind(findings);
3962
4304
  const componentEntries = {};
3963
4305
  for (const [kind, kindFindings] of byKind) {
3964
- const allPaths = kindFindings.flatMap((f2) => f2.paths);
4306
+ const allPaths = kindFindings.flatMap((f5) => f5.paths);
3965
4307
  const { kept } = normalizePathsAgainstRepo(repoRoot, allPaths);
3966
4308
  if (kept.length > 0) {
3967
4309
  componentEntries[kind] = kept;
@@ -3975,8 +4317,8 @@ function buildEntryFromFindings(findings, repoRoot, sourceRepo) {
3975
4317
  };
3976
4318
  }
3977
4319
  function hasKind(findings, kind) {
3978
- for (const f2 of findings) {
3979
- if (f2.kind === kind) {
4320
+ for (const f5 of findings) {
4321
+ if (f5.kind === kind) {
3980
4322
  return true;
3981
4323
  }
3982
4324
  }
@@ -3984,10 +4326,10 @@ function hasKind(findings, kind) {
3984
4326
  }
3985
4327
  function groupByKind(findings) {
3986
4328
  const map = new Map;
3987
- for (const f2 of findings) {
3988
- const list = map.get(f2.kind) ?? [];
3989
- list.push(f2);
3990
- map.set(f2.kind, list);
4329
+ for (const f5 of findings) {
4330
+ const list = map.get(f5.kind) ?? [];
4331
+ list.push(f5);
4332
+ map.set(f5.kind, list);
3991
4333
  }
3992
4334
  return map;
3993
4335
  }
@@ -4032,7 +4374,7 @@ function buildSplitEntries(groups, layout, skillsContainer, sourceRepo, options)
4032
4374
  entries.push(core.entry);
4033
4375
  }
4034
4376
  const reservedSlugs = core.entry !== null ? ["core"] : [];
4035
- const slugs = uniqueSlugs([...reservedSlugs, ...groups.map((g) => g.slug)]).slice(reservedSlugs.length);
4377
+ const slugs = uniqueSlugs([...reservedSlugs, ...groups.map((g3) => g3.slug)]).slice(reservedSlugs.length);
4036
4378
  const markerGroups = [];
4037
4379
  groups.forEach((group, i3) => {
4038
4380
  const slug = slugs[i3] ?? group.slug;
@@ -4064,7 +4406,7 @@ function buildUmbrellaEntry(base, groups, layout, skillsContainer, sourceRepo) {
4064
4406
  };
4065
4407
  }
4066
4408
  const artifact = (kind) => layout.artifacts.find((a3) => a3.kind === kind)?.relPath;
4067
- const skills = groups.flatMap((g) => g.skills).map((s3) => repoRelPath(skillsContainer.relPath, s3.path)).sort(byCodeUnit);
4409
+ const skills = groups.flatMap((g3) => g3.skills).map((s3) => repoRelPath(skillsContainer.relPath, s3.path)).sort(byCodeUnit);
4068
4410
  const agents = layout.agentsContainer;
4069
4411
  const hooks = artifact("hooks");
4070
4412
  const commands = artifact("commands");
@@ -4076,7 +4418,7 @@ function buildUmbrellaEntry(base, groups, layout, skillsContainer, sourceRepo) {
4076
4418
  source: makeGitSubdirSource(sourceRepo, "."),
4077
4419
  strict: false,
4078
4420
  ...skills.length > 0 ? { skills } : {},
4079
- ...agents !== null ? { agents: agents.files.map((f2) => repoRelPath(agents.relPath, f2)) } : {},
4421
+ ...agents !== null ? { agents: agents.files.map((f5) => repoRelPath(agents.relPath, f5)) } : {},
4080
4422
  ...layout.mcp !== null ? { mcpServers: layout.mcp.servers } : {},
4081
4423
  ...hooks !== undefined ? { hooks: `./${hooks}` } : {},
4082
4424
  ...commands !== undefined ? { commands: [`./${commands}/`] } : {},
@@ -4085,8 +4427,8 @@ function buildUmbrellaEntry(base, groups, layout, skillsContainer, sourceRepo) {
4085
4427
  ...monitors !== undefined ? { monitors: `./${monitors}` } : {}
4086
4428
  };
4087
4429
  }
4088
- function repoRelPath(containerRel, p2) {
4089
- const inner = p2.startsWith("./") ? p2.slice(2) : p2;
4430
+ function repoRelPath(containerRel, p3) {
4431
+ const inner = p3.startsWith("./") ? p3.slice(2) : p3;
4090
4432
  return containerRel === "." ? `./${inner}` : `./${containerRel}/${inner}`;
4091
4433
  }
4092
4434
  function buildCoreEntry(name, layout, skillsContainer, sourceRepo) {
@@ -4105,7 +4447,7 @@ function buildCoreEntry(name, layout, skillsContainer, sourceRepo) {
4105
4447
  name,
4106
4448
  source: makeGitSubdirSource(sourceRepo, rootPath),
4107
4449
  strict: false,
4108
- ...carriesAgents ? { agents: agents.files.map((f2) => `./${f2}`) } : {},
4450
+ ...carriesAgents ? { agents: agents.files.map((f5) => `./${f5}`) } : {},
4109
4451
  ...mcp !== null ? { mcpServers: mcp.servers } : {}
4110
4452
  },
4111
4453
  agentsDropped: agents !== null && !carriesAgents
@@ -4158,12 +4500,12 @@ function collectEntries(path, options = {}) {
4158
4500
  });
4159
4501
  };
4160
4502
  if (statSync3(path).isDirectory()) {
4161
- const files = readdirSync3(path).filter((f2) => f2.endsWith(".json")).sort();
4503
+ const files = readdirSync3(path).filter((f5) => f5.endsWith(".json")).sort();
4162
4504
  if (files.length === 0 && options.allowEmptyDir !== true) {
4163
4505
  throw new Error(`No entry JSON files (*.json) found in directory: ${path}`);
4164
4506
  }
4165
- for (const f2 of files) {
4166
- add(readJsonFile(join10(path, f2)), f2);
4507
+ for (const f5 of files) {
4508
+ add(readJsonFile(join10(path, f5)), f5);
4167
4509
  }
4168
4510
  } else {
4169
4511
  add(readJsonFile(path), basename3(path));
@@ -4231,7 +4573,7 @@ function parseClusterResponse(text, validDirs) {
4231
4573
  if (!r2.success) {
4232
4574
  continue;
4233
4575
  }
4234
- const members = r2.output.members.filter((m2) => validDirs.has(m2));
4576
+ const members = r2.output.members.filter((m4) => validDirs.has(m4));
4235
4577
  if (members.length > 0) {
4236
4578
  groups.push({ slug: r2.output.slug, members });
4237
4579
  }
@@ -4288,8 +4630,8 @@ function spawnGroupRun(command, args, options) {
4288
4630
  detached: !win,
4289
4631
  windowsVerbatimArguments: win
4290
4632
  });
4291
- } catch (e3) {
4292
- resolve2({ error: e3 instanceof Error ? e3 : new Error(String(e3)), signal: null, status: null, stdout: null });
4633
+ } catch (e2) {
4634
+ resolve2({ error: e2 instanceof Error ? e2 : new Error(String(e2)), signal: null, status: null, stdout: null });
4293
4635
  return;
4294
4636
  }
4295
4637
  let stdout = "";
@@ -4342,8 +4684,8 @@ function spawnGroupRun(command, args, options) {
4342
4684
  return;
4343
4685
  }
4344
4686
  settled = true;
4345
- for (const t2 of timers) {
4346
- clearTimeout(t2);
4687
+ for (const t3 of timers) {
4688
+ clearTimeout(t3);
4347
4689
  }
4348
4690
  if (!win || timedOut || overflowed || viaExitGrace || result.error !== undefined) {
4349
4691
  killTree("SIGKILL");
@@ -4353,9 +4695,9 @@ function spawnGroupRun(command, args, options) {
4353
4695
  resolve2(result);
4354
4696
  };
4355
4697
  const schedule = (fn, ms) => {
4356
- const t2 = setTimeout(fn, ms);
4357
- t2.unref();
4358
- timers.push(t2);
4698
+ const t3 = setTimeout(fn, ms);
4699
+ t3.unref();
4700
+ timers.push(t3);
4359
4701
  };
4360
4702
  schedule(() => {
4361
4703
  timedOut = true;
@@ -4531,7 +4873,7 @@ function writeCacheFile(file, groups) {
4531
4873
  }
4532
4874
 
4533
4875
  // src/commands/scan.ts
4534
- var scanCommand = new R2("scan").meta({ description: "Scan a non-plugin repo and emit a marketplace entry (auto-splits bloated plugins)" }).args([{ name: "repo", type: "string", required: true, description: "owner/repo, URL, or local path" }]).flags({
4876
+ var scanCommand = new M2("scan").meta({ description: "Scan a non-plugin repo and emit a marketplace entry (auto-splits bloated plugins)" }).args([{ name: "repo", type: "string", required: true, description: "owner/repo, URL, or local path" }]).flags({
4535
4877
  output: { type: "string", short: "o", description: "Write the entry/entries JSON to a single file" },
4536
4878
  outDir: { type: "string", aliases: ["out-dir"], description: "Write one JSON file per entry into this directory" },
4537
4879
  split: { type: "boolean", default: true, description: "Auto-split bloated plugins (use --no-split to force one entry)" },
@@ -4568,9 +4910,9 @@ var scanCommand = new R2("scan").meta({ description: "Scan a non-plugin repo and
4568
4910
  try {
4569
4911
  lstatSync(outputFlags.outDir);
4570
4912
  throw new Error(`--out-dir "${outputFlags.outDir}" is a dangling symlink`);
4571
- } catch (e3) {
4572
- if (e3 instanceof Error && e3.message.includes("dangling symlink")) {
4573
- throw e3;
4913
+ } catch (e2) {
4914
+ if (e2 instanceof Error && e2.message.includes("dangling symlink")) {
4915
+ throw e2;
4574
4916
  }
4575
4917
  }
4576
4918
  }
@@ -4717,13 +5059,13 @@ function printNoSplitNotice(requestedCluster, llmFailure) {
4717
5059
  const reason = llmFailure !== undefined ? `${llmFailureReason(llmFailure)}, and no clean deterministic partition` : "no clean deterministic partition";
4718
5060
  console.error(`ccpluginizer: --cluster=${requestedCluster} produced no split — ${reason}; emitting a single entry.`);
4719
5061
  }
4720
- async function reviewSplit(result, ctx, confirmFn = (opts) => wJ(opts)) {
5062
+ async function reviewSplit(result, ctx, confirmFn = (opts) => VJ(opts)) {
4721
5063
  if (result.split === null || result.provenance.kind === "none" || result.provenance.kind === "skipped") {
4722
5064
  return result;
4723
5065
  }
4724
5066
  console.error(`ccpluginizer: proposed split — ${describeProvenance(result.provenance)}`);
4725
- for (const g of result.marker?.groups ?? []) {
4726
- console.error(` ${g.slug}: ${String(g.skills.length)} skills`);
5067
+ for (const g3 of result.marker?.groups ?? []) {
5068
+ console.error(` ${g3.slug}: ${String(g3.skills.length)} skills`);
4727
5069
  }
4728
5070
  const proceed = await confirmFn({
4729
5071
  message: `Emit this ${String(result.split.groupCount)}-way split?`,
@@ -4769,11 +5111,11 @@ function warnAboutStaleEntries(entries, outDir, sourceRepo) {
4769
5111
  if (sourceRepo.startsWith("local/")) {
4770
5112
  return;
4771
5113
  }
4772
- const current = new Set(entries.map((e3) => `${e3.name}.json`));
5114
+ const current = new Set(entries.map((e2) => `${e2.name}.json`));
4773
5115
  const expectedUrl = sourceRepoUrl(sourceRepo);
4774
- const stale = readdirSync4(outDir).filter((f2) => f2.endsWith(".json") && !current.has(f2)).filter((f2) => {
5116
+ const stale = readdirSync4(outDir).filter((f5) => f5.endsWith(".json") && !current.has(f5)).filter((f5) => {
4775
5117
  try {
4776
- return entryReferencesUrl(readJsonFile(join12(outDir, f2)), expectedUrl);
5118
+ return entryReferencesUrl(readJsonFile(join12(outDir, f5)), expectedUrl);
4777
5119
  } catch {
4778
5120
  return false;
4779
5121
  }
@@ -4793,7 +5135,7 @@ function entryReferencesUrl(parsed, url) {
4793
5135
  }
4794
5136
 
4795
5137
  // src/commands/validate.ts
4796
- var validateCommand = new R2("validate").meta({ description: "Validate marketplace entries against the schema (file, JSON array, or directory)" }).args([
5138
+ var validateCommand = new M2("validate").meta({ description: "Validate marketplace entries against the schema (file, JSON array, or directory)" }).args([
4797
5139
  { name: "entryFile", type: "string", required: true, description: "Path to an entry JSON file, a JSON array, or a directory of entries" }
4798
5140
  ]).run(({ args }) => {
4799
5141
  const { items, sources } = collectEntries(args.entryFile);
@@ -4809,5 +5151,5 @@ var validateCommand = new R2("validate").meta({ description: "Validate marketpla
4809
5151
  });
4810
5152
 
4811
5153
  // src/index.ts
4812
- var app = new R("ccpluginizer").meta({ description: "Pluginize non-plugin Claude Code repos" }).command(scanCommand).command(validateCommand);
5154
+ var app = new M("ccpluginizer").meta({ description: "Pluginize non-plugin Claude Code repos" }).command(scanCommand).command(validateCommand);
4813
5155
  await app.execute();