@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.
- package/dist/index.js +1627 -1285
- 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+
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
58
|
-
}
|
|
59
|
-
return { options:
|
|
60
|
-
}
|
|
61
|
-
function
|
|
62
|
-
if (
|
|
63
|
-
let
|
|
64
|
-
if (
|
|
65
|
-
throw new
|
|
66
|
-
return
|
|
67
|
-
}
|
|
68
|
-
if (
|
|
69
|
-
return
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
|
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
|
|
102
|
-
if (
|
|
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
|
|
105
|
-
for (let [
|
|
106
|
-
let
|
|
107
|
-
if (
|
|
108
|
-
|
|
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
|
-
|
|
213
|
+
Q[Z] = P(B, `--${Z}`);
|
|
112
214
|
}
|
|
113
|
-
return
|
|
215
|
+
return Q;
|
|
114
216
|
}
|
|
115
|
-
function
|
|
116
|
-
if (!
|
|
217
|
+
function D(H, K) {
|
|
218
|
+
if (!H)
|
|
117
219
|
return;
|
|
118
|
-
for (let [
|
|
119
|
-
if (
|
|
120
|
-
if (
|
|
121
|
-
throw new
|
|
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
|
|
125
|
-
if (!
|
|
226
|
+
function b(H, K) {
|
|
227
|
+
if (!H)
|
|
126
228
|
return {};
|
|
127
|
-
let
|
|
128
|
-
for (let
|
|
129
|
-
let { name:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
244
|
+
z[Z] = P(Q, B);
|
|
137
245
|
}
|
|
138
|
-
return
|
|
246
|
+
return z;
|
|
139
247
|
}
|
|
140
|
-
function
|
|
141
|
-
if (!
|
|
248
|
+
function v(H, K, z) {
|
|
249
|
+
if (!K)
|
|
142
250
|
return;
|
|
143
|
-
for (let
|
|
144
|
-
if (
|
|
251
|
+
for (let $ of H) {
|
|
252
|
+
if ($ === "--")
|
|
145
253
|
return;
|
|
146
|
-
if (
|
|
254
|
+
if (!$.startsWith("--no-"))
|
|
147
255
|
continue;
|
|
148
|
-
let
|
|
149
|
-
if (!
|
|
256
|
+
let Q = $.indexOf("="), Z = Q === -1 ? $.slice(5) : $.slice(5, Q);
|
|
257
|
+
if (!Z)
|
|
150
258
|
continue;
|
|
151
|
-
let
|
|
152
|
-
if (!
|
|
259
|
+
let B = z[Z];
|
|
260
|
+
if (!B)
|
|
153
261
|
continue;
|
|
154
|
-
if (
|
|
262
|
+
if (B === Z)
|
|
155
263
|
continue;
|
|
156
|
-
if (
|
|
264
|
+
if (K[B]?.type !== "boolean")
|
|
157
265
|
continue;
|
|
158
|
-
throw new
|
|
266
|
+
throw new Y("PARSE", `Cannot negate alias "--no-${Z}"; use "--no-${B}" instead`);
|
|
159
267
|
}
|
|
160
268
|
}
|
|
161
|
-
function
|
|
162
|
-
let { args:
|
|
163
|
-
|
|
164
|
-
let
|
|
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
|
-
|
|
167
|
-
} catch (
|
|
168
|
-
if (
|
|
169
|
-
let
|
|
170
|
-
if (
|
|
171
|
-
throw new
|
|
172
|
-
}
|
|
173
|
-
throw new
|
|
174
|
-
}
|
|
175
|
-
let
|
|
176
|
-
if (
|
|
177
|
-
let
|
|
178
|
-
for (let
|
|
179
|
-
if (
|
|
180
|
-
|
|
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 (
|
|
184
|
-
(
|
|
293
|
+
if (q.kind === "positional")
|
|
294
|
+
(U ? W : X).push(q.value ?? "");
|
|
185
295
|
}
|
|
186
296
|
} else
|
|
187
|
-
|
|
188
|
-
let
|
|
189
|
-
return { args:
|
|
190
|
-
}
|
|
191
|
-
function
|
|
192
|
-
let { args:
|
|
193
|
-
if (
|
|
194
|
-
for (let
|
|
195
|
-
let { name:
|
|
196
|
-
if (
|
|
197
|
-
if (
|
|
198
|
-
if (!Array.isArray(
|
|
199
|
-
throw new
|
|
200
|
-
} else if (
|
|
201
|
-
throw new
|
|
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
|
-
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
|
241
|
-
let
|
|
242
|
-
for (let [
|
|
243
|
-
if (
|
|
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 (
|
|
246
|
-
|
|
372
|
+
if (K.push(`--${Q}`), Z.type !== "boolean")
|
|
373
|
+
K.push(j(Z));
|
|
247
374
|
}
|
|
248
|
-
let
|
|
249
|
-
if (
|
|
250
|
-
for (let
|
|
251
|
-
if (
|
|
375
|
+
let $ = H.args;
|
|
376
|
+
if ($)
|
|
377
|
+
for (let Q of $) {
|
|
378
|
+
if (Q.required !== true || Q.default !== undefined)
|
|
252
379
|
continue;
|
|
253
|
-
|
|
380
|
+
K.push(j(Q));
|
|
254
381
|
}
|
|
255
|
-
return
|
|
382
|
+
return K;
|
|
256
383
|
}
|
|
257
|
-
function
|
|
258
|
-
let
|
|
259
|
-
while (
|
|
260
|
-
let
|
|
261
|
-
if (
|
|
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:
|
|
264
|
-
if (
|
|
390
|
+
let { command: Q, path: Z } = $;
|
|
391
|
+
if (z.has(Q))
|
|
265
392
|
continue;
|
|
266
|
-
|
|
393
|
+
z.add(Q);
|
|
267
394
|
try {
|
|
268
|
-
let
|
|
269
|
-
|
|
270
|
-
} catch (
|
|
271
|
-
let
|
|
272
|
-
throw new
|
|
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
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
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.
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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
|
|
303
|
-
if (!
|
|
470
|
+
let G2 = Z[0];
|
|
471
|
+
if (!G2 || G2.startsWith("-"))
|
|
304
472
|
break;
|
|
305
|
-
if (
|
|
306
|
-
Q =
|
|
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
|
-
|
|
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:
|
|
486
|
+
return { command: Q, argv: Z, commandPath: q };
|
|
315
487
|
}
|
|
316
|
-
function
|
|
317
|
-
for (let [
|
|
318
|
-
if (
|
|
319
|
-
let Q =
|
|
320
|
-
throw new
|
|
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 (
|
|
323
|
-
throw new
|
|
324
|
-
if (
|
|
325
|
-
for (let Q of
|
|
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
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
var
|
|
332
|
-
var
|
|
333
|
-
var
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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
|
|
347
|
-
if (!(
|
|
519
|
+
function L2(j2) {
|
|
520
|
+
if (!(j2 instanceof Error))
|
|
348
521
|
return false;
|
|
349
|
-
return
|
|
350
|
-
}
|
|
351
|
-
function
|
|
352
|
-
|
|
353
|
-
for (let
|
|
354
|
-
|
|
355
|
-
}
|
|
356
|
-
function y(
|
|
357
|
-
return { addFlag(
|
|
358
|
-
if (
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
}, addSubCommand(
|
|
362
|
-
if (!
|
|
363
|
-
throw new
|
|
364
|
-
if (
|
|
365
|
-
|
|
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
|
-
|
|
548
|
+
h2(Q, J2.effectiveFlags), J2.subCommands[q] = Q;
|
|
369
549
|
} };
|
|
370
550
|
}
|
|
371
|
-
async function
|
|
372
|
-
for (let Q of
|
|
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(
|
|
555
|
+
await Q.setup(J2, q);
|
|
376
556
|
}
|
|
377
557
|
}
|
|
378
|
-
async function
|
|
379
|
-
let Q =
|
|
380
|
-
if (
|
|
381
|
-
throw new
|
|
382
|
-
if (
|
|
383
|
-
await
|
|
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[
|
|
566
|
+
let H = Q[G2];
|
|
387
567
|
if (!H)
|
|
388
|
-
throw new
|
|
389
|
-
await H(
|
|
568
|
+
throw new Y("DEFINITION", "Plugin middleware stack is invalid");
|
|
569
|
+
await H(J2, () => $(G2 + 1));
|
|
390
570
|
};
|
|
391
|
-
await
|
|
392
|
-
}
|
|
393
|
-
function
|
|
394
|
-
let
|
|
395
|
-
for (let
|
|
396
|
-
|
|
397
|
-
return
|
|
398
|
-
}
|
|
399
|
-
function
|
|
400
|
-
let
|
|
401
|
-
for (let [
|
|
402
|
-
|
|
403
|
-
return
|
|
404
|
-
}
|
|
405
|
-
function
|
|
406
|
-
let
|
|
407
|
-
for (let [
|
|
408
|
-
|
|
409
|
-
return { meta: { ...
|
|
410
|
-
}
|
|
411
|
-
function
|
|
412
|
-
if (Object.freeze(
|
|
413
|
-
Object.freeze(
|
|
414
|
-
for (let
|
|
415
|
-
|
|
416
|
-
Object.freeze(
|
|
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
|
|
599
|
+
class M {
|
|
420
600
|
_node;
|
|
421
601
|
_inheritedFlags;
|
|
422
|
-
constructor(
|
|
423
|
-
if (!
|
|
424
|
-
throw new
|
|
425
|
-
this._node =
|
|
426
|
-
}
|
|
427
|
-
static _createChild(
|
|
428
|
-
let
|
|
429
|
-
return
|
|
430
|
-
}
|
|
431
|
-
_clone(
|
|
432
|
-
let
|
|
433
|
-
return
|
|
434
|
-
}
|
|
435
|
-
meta(
|
|
436
|
-
return this._clone({ meta: { ...this._node.meta, ...
|
|
437
|
-
}
|
|
438
|
-
flags(
|
|
439
|
-
|
|
440
|
-
let
|
|
441
|
-
for (let [
|
|
442
|
-
|
|
443
|
-
return this._clone({ localFlags:
|
|
444
|
-
}
|
|
445
|
-
args(
|
|
446
|
-
let
|
|
447
|
-
return this._clone({ args:
|
|
448
|
-
}
|
|
449
|
-
run(
|
|
450
|
-
return this._clone({ run:
|
|
451
|
-
}
|
|
452
|
-
preRun(
|
|
453
|
-
return this._clone({ preRun:
|
|
454
|
-
}
|
|
455
|
-
postRun(
|
|
456
|
-
return this._clone({ postRun:
|
|
457
|
-
}
|
|
458
|
-
use(
|
|
459
|
-
return this._clone({ plugins: [...this._node.plugins,
|
|
460
|
-
}
|
|
461
|
-
sub(
|
|
462
|
-
if (!
|
|
463
|
-
throw new
|
|
464
|
-
let
|
|
465
|
-
return
|
|
466
|
-
}
|
|
467
|
-
command(
|
|
468
|
-
if (typeof
|
|
469
|
-
let
|
|
470
|
-
if (!
|
|
471
|
-
throw new
|
|
472
|
-
if (
|
|
473
|
-
throw new
|
|
474
|
-
if (this._node.subCommands[
|
|
475
|
-
throw new
|
|
476
|
-
let
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
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
|
|
663
|
+
throw new Y("DEFINITION", "Subcommand name must be a non-empty string");
|
|
482
664
|
if (this._node.subCommands[Q])
|
|
483
|
-
throw new
|
|
484
|
-
|
|
485
|
-
|
|
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(
|
|
488
|
-
let
|
|
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
|
|
491
|
-
} catch (
|
|
492
|
-
if (
|
|
493
|
-
throw
|
|
494
|
-
if (
|
|
495
|
-
throw
|
|
496
|
-
if (
|
|
497
|
-
throw
|
|
498
|
-
throw new
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
let { validateCommandTree:
|
|
502
|
-
return
|
|
503
|
-
}
|
|
504
|
-
async execute(
|
|
505
|
-
let
|
|
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
|
|
508
|
-
} catch (
|
|
509
|
-
if (
|
|
510
|
-
process.exitCode =
|
|
690
|
+
await F2(Q, G2, H);
|
|
691
|
+
} catch (W) {
|
|
692
|
+
if (L2(W)) {
|
|
693
|
+
process.exitCode = x;
|
|
511
694
|
return;
|
|
512
695
|
}
|
|
513
|
-
if (
|
|
514
|
-
console.error(`Error: ${
|
|
696
|
+
if (W instanceof Y) {
|
|
697
|
+
console.error(`Error: ${W.message}`), process.exitCode = 1;
|
|
515
698
|
return;
|
|
516
699
|
}
|
|
517
|
-
let
|
|
518
|
-
console.error(`Error: ${
|
|
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 (
|
|
522
|
-
let
|
|
704
|
+
if (_2(q), process.env[N2] === "1") {
|
|
705
|
+
let W = (async () => {
|
|
523
706
|
try {
|
|
524
|
-
let { validateCommandTree:
|
|
525
|
-
|
|
526
|
-
for (let
|
|
527
|
-
console.warn(`Warning: ${
|
|
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 (
|
|
530
|
-
let
|
|
531
|
-
return console.error(
|
|
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
|
-
|
|
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
|
|
537
|
-
console.warn(`Warning: ${
|
|
538
|
-
let
|
|
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
|
|
725
|
+
let W, U;
|
|
541
726
|
try {
|
|
542
|
-
let
|
|
543
|
-
|
|
544
|
-
} catch (
|
|
545
|
-
await
|
|
546
|
-
throw
|
|
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
|
|
551
|
-
if (
|
|
735
|
+
await A2(Q, z, async () => {
|
|
736
|
+
if (A(W, U), !W.run)
|
|
552
737
|
return;
|
|
553
|
-
let
|
|
738
|
+
let Y2 = { args: U.args, flags: U.flags, rawArgs: U.rawArgs, command: W }, R2;
|
|
554
739
|
try {
|
|
555
|
-
if (
|
|
556
|
-
await
|
|
557
|
-
await
|
|
558
|
-
} catch (
|
|
559
|
-
|
|
740
|
+
if (W.preRun)
|
|
741
|
+
await W.preRun(Y2);
|
|
742
|
+
await W.run(Y2);
|
|
743
|
+
} catch (V2) {
|
|
744
|
+
R2 = V2;
|
|
560
745
|
}
|
|
561
|
-
if (
|
|
746
|
+
if (W.postRun)
|
|
562
747
|
try {
|
|
563
|
-
await
|
|
564
|
-
} catch (
|
|
565
|
-
if (!
|
|
566
|
-
|
|
748
|
+
await W.postRun(Y2);
|
|
749
|
+
} catch (V2) {
|
|
750
|
+
if (!R2)
|
|
751
|
+
R2 = V2;
|
|
567
752
|
else
|
|
568
|
-
console.error(`Error in postRun: ${
|
|
753
|
+
console.error(`Error in postRun: ${V2 instanceof Error ? V2.message : String(V2)}`);
|
|
569
754
|
}
|
|
570
|
-
if (
|
|
571
|
-
throw
|
|
755
|
+
if (R2)
|
|
756
|
+
throw R2;
|
|
572
757
|
});
|
|
573
|
-
} catch (
|
|
574
|
-
if (
|
|
575
|
-
process.exitCode =
|
|
758
|
+
} catch (W) {
|
|
759
|
+
if (L2(W)) {
|
|
760
|
+
process.exitCode = x;
|
|
576
761
|
return;
|
|
577
762
|
}
|
|
578
|
-
if (
|
|
579
|
-
console.error(`Error: ${
|
|
763
|
+
if (W instanceof Y) {
|
|
764
|
+
console.error(`Error: ${W.message}`), process.exitCode = 1;
|
|
580
765
|
return;
|
|
581
766
|
}
|
|
582
|
-
if (
|
|
583
|
-
let
|
|
584
|
-
console.error(`Error: ${
|
|
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(
|
|
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.
|
|
593
|
-
|
|
594
|
-
function
|
|
595
|
-
return { meta: { name:
|
|
596
|
-
}
|
|
597
|
-
function
|
|
598
|
-
let
|
|
599
|
-
for (let [Q,
|
|
600
|
-
if (
|
|
601
|
-
|
|
602
|
-
for (let [Q,
|
|
603
|
-
|
|
604
|
-
return
|
|
605
|
-
}
|
|
606
|
-
function
|
|
607
|
-
let
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
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
|
|
613
|
-
if (!
|
|
807
|
+
let G2 = Z[0];
|
|
808
|
+
if (!G2 || G2.startsWith("-"))
|
|
614
809
|
break;
|
|
615
|
-
if (
|
|
616
|
-
Q =
|
|
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
|
-
|
|
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:
|
|
823
|
+
return { command: Q, argv: Z, commandPath: q };
|
|
625
824
|
}
|
|
626
|
-
function
|
|
627
|
-
for (let [
|
|
628
|
-
if (
|
|
629
|
-
let Q =
|
|
630
|
-
throw new
|
|
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 (
|
|
633
|
-
throw new
|
|
634
|
-
if (
|
|
635
|
-
for (let Q of
|
|
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
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
var
|
|
642
|
-
var
|
|
643
|
-
var
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
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
|
|
657
|
-
if (!(
|
|
856
|
+
function L3(j2) {
|
|
857
|
+
if (!(j2 instanceof Error))
|
|
658
858
|
return false;
|
|
659
|
-
return
|
|
660
|
-
}
|
|
661
|
-
function
|
|
662
|
-
|
|
663
|
-
for (let
|
|
664
|
-
|
|
665
|
-
}
|
|
666
|
-
function y2(
|
|
667
|
-
return { addFlag(
|
|
668
|
-
if (
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
}, addSubCommand(
|
|
672
|
-
if (!
|
|
673
|
-
throw new
|
|
674
|
-
if (
|
|
675
|
-
|
|
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
|
-
|
|
885
|
+
h3(Q, J2.effectiveFlags), J2.subCommands[q] = Q;
|
|
679
886
|
} };
|
|
680
887
|
}
|
|
681
|
-
async function
|
|
682
|
-
for (let Q of
|
|
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(
|
|
892
|
+
await Q.setup(J2, q);
|
|
686
893
|
}
|
|
687
894
|
}
|
|
688
|
-
async function
|
|
689
|
-
let Q =
|
|
690
|
-
if (
|
|
691
|
-
throw new
|
|
692
|
-
if (
|
|
693
|
-
await
|
|
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[
|
|
903
|
+
let H = Q[G2];
|
|
697
904
|
if (!H)
|
|
698
|
-
throw new
|
|
699
|
-
await H(
|
|
905
|
+
throw new Y("DEFINITION", "Plugin middleware stack is invalid");
|
|
906
|
+
await H(J2, () => $(G2 + 1));
|
|
700
907
|
};
|
|
701
|
-
await
|
|
702
|
-
}
|
|
703
|
-
function
|
|
704
|
-
let
|
|
705
|
-
for (let
|
|
706
|
-
|
|
707
|
-
return
|
|
708
|
-
}
|
|
709
|
-
function
|
|
710
|
-
let
|
|
711
|
-
for (let [
|
|
712
|
-
|
|
713
|
-
return
|
|
714
|
-
}
|
|
715
|
-
function
|
|
716
|
-
let
|
|
717
|
-
for (let [
|
|
718
|
-
|
|
719
|
-
return { meta: { ...
|
|
720
|
-
}
|
|
721
|
-
function
|
|
722
|
-
if (Object.freeze(
|
|
723
|
-
Object.freeze(
|
|
724
|
-
for (let
|
|
725
|
-
|
|
726
|
-
Object.freeze(
|
|
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
|
|
936
|
+
class M2 {
|
|
730
937
|
_node;
|
|
731
938
|
_inheritedFlags;
|
|
732
|
-
constructor(
|
|
733
|
-
if (!
|
|
734
|
-
throw new
|
|
735
|
-
this._node =
|
|
736
|
-
}
|
|
737
|
-
static _createChild(
|
|
738
|
-
let
|
|
739
|
-
return
|
|
740
|
-
}
|
|
741
|
-
_clone(
|
|
742
|
-
let
|
|
743
|
-
return
|
|
744
|
-
}
|
|
745
|
-
meta(
|
|
746
|
-
return this._clone({ meta: { ...this._node.meta, ...
|
|
747
|
-
}
|
|
748
|
-
flags(
|
|
749
|
-
|
|
750
|
-
let
|
|
751
|
-
for (let [
|
|
752
|
-
|
|
753
|
-
return this._clone({ localFlags:
|
|
754
|
-
}
|
|
755
|
-
args(
|
|
756
|
-
let
|
|
757
|
-
return this._clone({ args:
|
|
758
|
-
}
|
|
759
|
-
run(
|
|
760
|
-
return this._clone({ run:
|
|
761
|
-
}
|
|
762
|
-
preRun(
|
|
763
|
-
return this._clone({ preRun:
|
|
764
|
-
}
|
|
765
|
-
postRun(
|
|
766
|
-
return this._clone({ postRun:
|
|
767
|
-
}
|
|
768
|
-
use(
|
|
769
|
-
return this._clone({ plugins: [...this._node.plugins,
|
|
770
|
-
}
|
|
771
|
-
sub(
|
|
772
|
-
if (!
|
|
773
|
-
throw new
|
|
774
|
-
let
|
|
775
|
-
return
|
|
776
|
-
}
|
|
777
|
-
command(
|
|
778
|
-
if (typeof
|
|
779
|
-
let
|
|
780
|
-
if (!
|
|
781
|
-
throw new
|
|
782
|
-
if (
|
|
783
|
-
throw new
|
|
784
|
-
if (this._node.subCommands[
|
|
785
|
-
throw new
|
|
786
|
-
let
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
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
|
|
1000
|
+
throw new Y("DEFINITION", "Subcommand name must be a non-empty string");
|
|
792
1001
|
if (this._node.subCommands[Q])
|
|
793
|
-
throw new
|
|
794
|
-
|
|
795
|
-
|
|
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(
|
|
798
|
-
let
|
|
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
|
|
801
|
-
} catch (
|
|
802
|
-
if (
|
|
803
|
-
throw
|
|
804
|
-
if (
|
|
805
|
-
throw
|
|
806
|
-
if (
|
|
807
|
-
throw
|
|
808
|
-
throw new
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
let { validateCommandTree:
|
|
812
|
-
return
|
|
813
|
-
}
|
|
814
|
-
async execute(
|
|
815
|
-
let
|
|
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
|
|
818
|
-
} catch (
|
|
819
|
-
if (
|
|
820
|
-
process.exitCode =
|
|
1027
|
+
await F3(Q, G2, H);
|
|
1028
|
+
} catch (W) {
|
|
1029
|
+
if (L3(W)) {
|
|
1030
|
+
process.exitCode = x2;
|
|
821
1031
|
return;
|
|
822
1032
|
}
|
|
823
|
-
if (
|
|
824
|
-
console.error(`Error: ${
|
|
1033
|
+
if (W instanceof Y) {
|
|
1034
|
+
console.error(`Error: ${W.message}`), process.exitCode = 1;
|
|
825
1035
|
return;
|
|
826
1036
|
}
|
|
827
|
-
let
|
|
828
|
-
console.error(`Error: ${
|
|
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 (
|
|
832
|
-
let
|
|
1041
|
+
if (_3(q), process.env[N3] === "1") {
|
|
1042
|
+
let W = (async () => {
|
|
833
1043
|
try {
|
|
834
|
-
let { validateCommandTree:
|
|
835
|
-
|
|
836
|
-
for (let
|
|
837
|
-
console.warn(`Warning: ${
|
|
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 (
|
|
840
|
-
let
|
|
841
|
-
return console.error(
|
|
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
|
-
|
|
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
|
|
847
|
-
console.warn(`Warning: ${
|
|
848
|
-
let
|
|
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
|
|
1062
|
+
let W, U;
|
|
851
1063
|
try {
|
|
852
|
-
let
|
|
853
|
-
|
|
854
|
-
} catch (
|
|
855
|
-
await
|
|
856
|
-
throw
|
|
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
|
|
861
|
-
if (
|
|
1072
|
+
await A3(Q, z, async () => {
|
|
1073
|
+
if (A(W, U), !W.run)
|
|
862
1074
|
return;
|
|
863
|
-
let
|
|
1075
|
+
let Y2 = { args: U.args, flags: U.flags, rawArgs: U.rawArgs, command: W }, R2;
|
|
864
1076
|
try {
|
|
865
|
-
if (
|
|
866
|
-
await
|
|
867
|
-
await
|
|
868
|
-
} catch (
|
|
869
|
-
|
|
1077
|
+
if (W.preRun)
|
|
1078
|
+
await W.preRun(Y2);
|
|
1079
|
+
await W.run(Y2);
|
|
1080
|
+
} catch (V2) {
|
|
1081
|
+
R2 = V2;
|
|
870
1082
|
}
|
|
871
|
-
if (
|
|
1083
|
+
if (W.postRun)
|
|
872
1084
|
try {
|
|
873
|
-
await
|
|
874
|
-
} catch (
|
|
875
|
-
if (!
|
|
876
|
-
|
|
1085
|
+
await W.postRun(Y2);
|
|
1086
|
+
} catch (V2) {
|
|
1087
|
+
if (!R2)
|
|
1088
|
+
R2 = V2;
|
|
877
1089
|
else
|
|
878
|
-
console.error(`Error in postRun: ${
|
|
1090
|
+
console.error(`Error in postRun: ${V2 instanceof Error ? V2.message : String(V2)}`);
|
|
879
1091
|
}
|
|
880
|
-
if (
|
|
881
|
-
throw
|
|
1092
|
+
if (R2)
|
|
1093
|
+
throw R2;
|
|
882
1094
|
});
|
|
883
|
-
} catch (
|
|
884
|
-
if (
|
|
885
|
-
process.exitCode =
|
|
1095
|
+
} catch (W) {
|
|
1096
|
+
if (L3(W)) {
|
|
1097
|
+
process.exitCode = x2;
|
|
886
1098
|
return;
|
|
887
1099
|
}
|
|
888
|
-
if (
|
|
889
|
-
console.error(`Error: ${
|
|
1100
|
+
if (W instanceof Y) {
|
|
1101
|
+
console.error(`Error: ${W.message}`), process.exitCode = 1;
|
|
890
1102
|
return;
|
|
891
1103
|
}
|
|
892
|
-
if (
|
|
893
|
-
let
|
|
894
|
-
console.error(`Error: ${
|
|
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(
|
|
1109
|
+
console.error(`Error: ${String(W)}`), process.exitCode = 1;
|
|
898
1110
|
}
|
|
899
1111
|
}
|
|
900
1112
|
}
|
|
901
1113
|
|
|
902
|
-
// ../../node_modules/.bun/@crustjs+style@0.
|
|
903
|
-
var
|
|
904
|
-
var
|
|
905
|
-
function
|
|
906
|
-
this[
|
|
907
|
-
}
|
|
908
|
-
var
|
|
909
|
-
for (var
|
|
910
|
-
|
|
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
|
|
913
|
-
|
|
914
|
-
function
|
|
915
|
-
return { open: `\x1B[${
|
|
916
|
-
}
|
|
917
|
-
var
|
|
918
|
-
var
|
|
919
|
-
var
|
|
920
|
-
var
|
|
921
|
-
var
|
|
922
|
-
var
|
|
923
|
-
var
|
|
924
|
-
var
|
|
925
|
-
var
|
|
926
|
-
var
|
|
927
|
-
var
|
|
928
|
-
var
|
|
929
|
-
var
|
|
930
|
-
var
|
|
931
|
-
var
|
|
932
|
-
var
|
|
933
|
-
var
|
|
934
|
-
var
|
|
935
|
-
var
|
|
936
|
-
var
|
|
937
|
-
var
|
|
938
|
-
var
|
|
939
|
-
var
|
|
940
|
-
var
|
|
941
|
-
var
|
|
942
|
-
var
|
|
943
|
-
var
|
|
944
|
-
var
|
|
945
|
-
var
|
|
946
|
-
var
|
|
947
|
-
var
|
|
948
|
-
var
|
|
949
|
-
var
|
|
950
|
-
var
|
|
951
|
-
var
|
|
952
|
-
var
|
|
953
|
-
var
|
|
954
|
-
var
|
|
955
|
-
var
|
|
956
|
-
var
|
|
957
|
-
function
|
|
958
|
-
return
|
|
959
|
-
}
|
|
960
|
-
function
|
|
961
|
-
let
|
|
962
|
-
for (let
|
|
963
|
-
let
|
|
964
|
-
if (
|
|
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
|
-
|
|
1178
|
+
Z += BZ(Q) ? 2 : 1;
|
|
967
1179
|
}
|
|
968
|
-
return
|
|
1180
|
+
return Z;
|
|
969
1181
|
}
|
|
970
|
-
function
|
|
971
|
-
|
|
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
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
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
|
|
988
|
-
|
|
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 (
|
|
1231
|
+
if (V2 === "never")
|
|
991
1232
|
return false;
|
|
992
|
-
return
|
|
1233
|
+
return v4($);
|
|
993
1234
|
}
|
|
994
|
-
function
|
|
995
|
-
if (
|
|
1235
|
+
function gV(V2, $) {
|
|
1236
|
+
if (V2 === "always")
|
|
996
1237
|
return true;
|
|
997
|
-
if (
|
|
998
|
-
return false;
|
|
999
|
-
if (!M3(F3, Y))
|
|
1238
|
+
if (V2 === "never")
|
|
1000
1239
|
return false;
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
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
|
|
1013
|
-
if (
|
|
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
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
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
|
-
|
|
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=${
|
|
1088
|
-
}
|
|
1089
|
-
function
|
|
1090
|
-
|
|
1091
|
-
let
|
|
1092
|
-
return { open: `${
|
|
1093
|
-
}
|
|
1094
|
-
function
|
|
1095
|
-
return
|
|
1096
|
-
}
|
|
1097
|
-
function
|
|
1098
|
-
let { reset:
|
|
1099
|
-
return
|
|
1100
|
-
}
|
|
1101
|
-
var
|
|
1102
|
-
var
|
|
1103
|
-
function
|
|
1104
|
-
return
|
|
1105
|
-
}
|
|
1106
|
-
var
|
|
1107
|
-
var
|
|
1108
|
-
function
|
|
1109
|
-
return
|
|
1110
|
-
}
|
|
1111
|
-
var
|
|
1112
|
-
function
|
|
1113
|
-
return
|
|
1114
|
-
}
|
|
1115
|
-
function
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
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 (
|
|
1441
|
+
if (uZ(X3) ? !Z : !z)
|
|
1124
1442
|
continue;
|
|
1125
|
-
|
|
1443
|
+
Q = L4(Q, zZ(X3));
|
|
1126
1444
|
}
|
|
1127
|
-
return
|
|
1445
|
+
return Q;
|
|
1128
1446
|
}
|
|
1129
|
-
function
|
|
1130
|
-
let
|
|
1131
|
-
function
|
|
1132
|
-
return
|
|
1133
|
-
}
|
|
1134
|
-
function
|
|
1135
|
-
let
|
|
1136
|
-
if (
|
|
1137
|
-
return
|
|
1138
|
-
let
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
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
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
return
|
|
1153
|
-
}
|
|
1154
|
-
function
|
|
1155
|
-
let
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
return
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
return
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
return
|
|
1173
|
-
|
|
1174
|
-
return
|
|
1175
|
-
}
|
|
1176
|
-
var
|
|
1177
|
-
var
|
|
1178
|
-
function
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
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
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
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
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
var
|
|
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
|
|
1213
|
-
import * as
|
|
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.
|
|
1216
|
-
var
|
|
1217
|
-
var
|
|
1218
|
-
var J2 = `${
|
|
1219
|
-
var
|
|
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
|
|
1222
|
-
var b5 = { prefix:
|
|
1223
|
-
var
|
|
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 (!
|
|
1610
|
+
if (!u2 && !J3)
|
|
1226
1611
|
return b5;
|
|
1227
|
-
return { ...b5, ...
|
|
1612
|
+
return { ...b5, ...u2, ...J3 };
|
|
1228
1613
|
}
|
|
1229
|
-
var
|
|
1230
|
-
function
|
|
1231
|
-
return { [
|
|
1614
|
+
var a2 = Symbol("submit");
|
|
1615
|
+
function H(J3) {
|
|
1616
|
+
return { [a2]: J3 };
|
|
1232
1617
|
}
|
|
1233
|
-
var
|
|
1234
|
-
var
|
|
1235
|
-
var
|
|
1236
|
-
var
|
|
1237
|
-
var qJ = `${
|
|
1238
|
-
function
|
|
1239
|
-
return J3 > 0 ? `${
|
|
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
|
|
1626
|
+
function QJ(J3, Q2) {
|
|
1242
1627
|
let Z = J3.split(`
|
|
1243
1628
|
`), W2 = 0;
|
|
1244
|
-
for (let
|
|
1245
|
-
let $ =
|
|
1246
|
-
W2 += $ === 0 ? 1 : Math.ceil($ /
|
|
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
|
|
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
|
|
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
|
|
1649
|
+
function _4() {
|
|
1265
1650
|
return !!process.stdin.isTTY;
|
|
1266
1651
|
}
|
|
1267
|
-
function
|
|
1268
|
-
if (!
|
|
1269
|
-
throw new
|
|
1652
|
+
function $J() {
|
|
1653
|
+
if (!_4())
|
|
1654
|
+
throw new s2;
|
|
1270
1655
|
}
|
|
1271
|
-
function
|
|
1272
|
-
return typeof J3 === "object" && J3 !== null &&
|
|
1656
|
+
function DJ(J3) {
|
|
1657
|
+
return typeof J3 === "object" && J3 !== null && a2 in J3;
|
|
1273
1658
|
}
|
|
1274
1659
|
function D4(J3) {
|
|
1275
|
-
let { render:
|
|
1276
|
-
return new Promise((K,
|
|
1277
|
-
if (
|
|
1278
|
-
|
|
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
|
-
|
|
1283
|
-
} catch (
|
|
1284
|
-
|
|
1667
|
+
$J();
|
|
1668
|
+
} catch (A4) {
|
|
1669
|
+
j3(A4);
|
|
1285
1670
|
return;
|
|
1286
1671
|
}
|
|
1287
|
-
|
|
1288
|
-
let
|
|
1289
|
-
function
|
|
1290
|
-
if (
|
|
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 (
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
}
|
|
1296
|
-
function
|
|
1297
|
-
let T3 =
|
|
1298
|
-
if (
|
|
1299
|
-
|
|
1300
|
-
for (let
|
|
1301
|
-
if (
|
|
1302
|
-
|
|
1303
|
-
if (
|
|
1304
|
-
|
|
1305
|
-
|
|
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
|
-
|
|
1692
|
+
z.write(A4), X3 = QJ(A4, T3);
|
|
1308
1693
|
}
|
|
1309
|
-
let
|
|
1310
|
-
function
|
|
1311
|
-
if (
|
|
1694
|
+
let P4 = Promise.resolve(), O4 = null;
|
|
1695
|
+
function k5() {
|
|
1696
|
+
if (O4 !== null)
|
|
1312
1697
|
return;
|
|
1313
|
-
|
|
1314
|
-
if (
|
|
1315
|
-
|
|
1698
|
+
O4 = setTimeout(() => {
|
|
1699
|
+
if (O4 = null, !F5)
|
|
1700
|
+
q(Q2(Y2, G2));
|
|
1316
1701
|
}, 0);
|
|
1317
1702
|
}
|
|
1318
|
-
function
|
|
1319
|
-
if (
|
|
1320
|
-
clearTimeout(
|
|
1703
|
+
function x4() {
|
|
1704
|
+
if (O4 !== null)
|
|
1705
|
+
clearTimeout(O4), O4 = null;
|
|
1321
1706
|
}
|
|
1322
|
-
function
|
|
1707
|
+
function p3(A4, T3) {
|
|
1323
1708
|
if (T3?.ctrl && T3.name === "c") {
|
|
1324
|
-
|
|
1325
|
-
`),
|
|
1709
|
+
x4(), z.write(`
|
|
1710
|
+
`), N5(), j3(new t2);
|
|
1326
1711
|
return;
|
|
1327
1712
|
}
|
|
1328
|
-
let
|
|
1329
|
-
|
|
1330
|
-
if (
|
|
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
|
|
1334
|
-
if (
|
|
1335
|
-
|
|
1336
|
-
let
|
|
1718
|
+
let h5 = await Z(d2, Y2);
|
|
1719
|
+
if (DJ(h5)) {
|
|
1720
|
+
x4();
|
|
1721
|
+
let e2 = h5[a2];
|
|
1337
1722
|
if ($)
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
`),
|
|
1723
|
+
q($(Y2, e2, G2));
|
|
1724
|
+
z.write(`
|
|
1725
|
+
`), N5(), K(e2);
|
|
1341
1726
|
} else
|
|
1342
|
-
|
|
1343
|
-
} catch (
|
|
1344
|
-
|
|
1727
|
+
Y2 = h5, k5();
|
|
1728
|
+
} catch (h5) {
|
|
1729
|
+
x4(), N5(), j3(h5);
|
|
1345
1730
|
}
|
|
1346
1731
|
});
|
|
1347
1732
|
}
|
|
1348
1733
|
try {
|
|
1349
|
-
|
|
1350
|
-
let
|
|
1351
|
-
|
|
1352
|
-
let T3 =
|
|
1353
|
-
|
|
1354
|
-
} catch (
|
|
1355
|
-
|
|
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
|
|
1360
|
-
var
|
|
1361
|
-
function
|
|
1362
|
-
if (
|
|
1363
|
-
return `${J3} ${
|
|
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
|
|
1751
|
+
function U2(J3, Q2, Z) {
|
|
1367
1752
|
let W2 = [J3];
|
|
1368
|
-
if (
|
|
1369
|
-
W2.push(
|
|
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
|
|
1375
|
-
let
|
|
1376
|
-
if (
|
|
1377
|
-
return `${
|
|
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 `${
|
|
1764
|
+
return `${G2}${$} ${Z}`;
|
|
1380
1765
|
}
|
|
1381
|
-
function
|
|
1766
|
+
function UJ(J3, Q2) {
|
|
1382
1767
|
if (J3.name === "return")
|
|
1383
|
-
return
|
|
1768
|
+
return H(Q2.value);
|
|
1384
1769
|
if (J3.name === "left" || J3.name === "right")
|
|
1385
|
-
return { 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: !
|
|
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
|
|
1781
|
+
return Q2;
|
|
1397
1782
|
}
|
|
1398
|
-
var
|
|
1399
|
-
function
|
|
1400
|
-
let $ =
|
|
1401
|
-
return
|
|
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
|
|
1404
|
-
let K = Z.success(
|
|
1405
|
-
return
|
|
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
|
|
1792
|
+
async function VJ(J3) {
|
|
1408
1793
|
if (J3.initial !== undefined)
|
|
1409
1794
|
return J3.initial;
|
|
1410
|
-
if (!
|
|
1795
|
+
if (!_4() && J3.default !== undefined)
|
|
1411
1796
|
return J3.default;
|
|
1412
|
-
let
|
|
1413
|
-
return D4({ initialState: $, theme:
|
|
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.
|
|
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
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
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.
|
|
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
|
-
|
|
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((
|
|
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((
|
|
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((
|
|
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 (
|
|
2367
|
-
throw new Error(`Cannot read ${file}: ${
|
|
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 (
|
|
2372
|
-
throw new Error(`Invalid JSON in ${file}: ${
|
|
2373
|
-
cause:
|
|
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 (
|
|
2481
|
-
throw new MarkerFileError(
|
|
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((
|
|
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((
|
|
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((
|
|
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((
|
|
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
|
|
2624
|
-
const hasComponent =
|
|
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:
|
|
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
|
|
2739
|
-
if (
|
|
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
|
|
2807
|
-
if (
|
|
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
|
|
2840
|
-
if (
|
|
3181
|
+
const t3 = line.trim();
|
|
3182
|
+
if (t3 === "-") {
|
|
2841
3183
|
arr.push(null);
|
|
2842
|
-
} else if (
|
|
2843
|
-
arr.push(coerceYamlValue(
|
|
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
|
|
2853
|
-
if (
|
|
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(
|
|
3204
|
+
const ci = mappingColonIndex(t3);
|
|
2863
3205
|
if (ci === -1) {
|
|
2864
3206
|
continue;
|
|
2865
3207
|
}
|
|
2866
|
-
const
|
|
2867
|
-
const val =
|
|
2868
|
-
map[
|
|
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 = (
|
|
3014
|
-
skippedPaths.push(
|
|
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
|
|
3074
|
-
while (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((
|
|
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((
|
|
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((
|
|
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((
|
|
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((
|
|
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((
|
|
3707
|
+
if (types.every((t3) => t3 === "remote")) {
|
|
3366
3708
|
return "remote";
|
|
3367
3709
|
}
|
|
3368
|
-
if (types.every((
|
|
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
|
|
3824
|
+
const m4 = new Map;
|
|
3483
3825
|
for (const s3 of skills) {
|
|
3484
|
-
const
|
|
3485
|
-
const list =
|
|
3826
|
+
const k5 = keyOf(s3);
|
|
3827
|
+
const list = m4.get(k5) ?? [];
|
|
3486
3828
|
list.push(s3);
|
|
3487
|
-
|
|
3829
|
+
m4.set(k5, list);
|
|
3488
3830
|
}
|
|
3489
|
-
return
|
|
3831
|
+
return m4;
|
|
3490
3832
|
}
|
|
3491
3833
|
function passesGateBounds(groups, total) {
|
|
3492
|
-
return groups.length >= MIN_K && groups.length <= MAX_K && !groups.some((
|
|
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((
|
|
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
|
|
3518
|
-
for (const
|
|
3519
|
-
const lead =
|
|
3520
|
-
const list =
|
|
3521
|
-
list.push(...
|
|
3522
|
-
|
|
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 [...
|
|
3866
|
+
return [...m4].map(([key, skills]) => ({ key, skills }));
|
|
3525
3867
|
}
|
|
3526
3868
|
function appendToMisc(keep, extra) {
|
|
3527
|
-
const existingMisc = keep.find((
|
|
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((
|
|
3881
|
+
return appendToMisc(keep, toMerge.flatMap((g3) => g3.skills));
|
|
3540
3882
|
}
|
|
3541
3883
|
function coalesceTiny(groups, minSize) {
|
|
3542
|
-
const tiny = groups.filter((
|
|
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((
|
|
3547
|
-
return appendToMisc(big, tiny.flatMap((
|
|
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((
|
|
3551
|
-
return groups.map((
|
|
3552
|
-
slug: slugs[i3] ??
|
|
3553
|
-
skills: [...
|
|
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((
|
|
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((
|
|
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((
|
|
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
|
|
3597
|
-
const norm = normalizePath2(
|
|
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(
|
|
3943
|
+
unmatched.push(p3);
|
|
3602
3944
|
continue;
|
|
3603
3945
|
}
|
|
3604
3946
|
if (exact === undefined) {
|
|
3605
|
-
fuzzyMatched.push(
|
|
3947
|
+
fuzzyMatched.push(p3);
|
|
3606
3948
|
}
|
|
3607
3949
|
if (assigned.has(s3.dir)) {
|
|
3608
|
-
duplicates.push(
|
|
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(
|
|
3624
|
-
return
|
|
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((
|
|
3887
|
-
if (
|
|
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((
|
|
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
|
|
3979
|
-
if (
|
|
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
|
|
3988
|
-
const list = map.get(
|
|
3989
|
-
list.push(
|
|
3990
|
-
map.set(
|
|
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((
|
|
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((
|
|
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((
|
|
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,
|
|
4089
|
-
const inner =
|
|
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((
|
|
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((
|
|
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
|
|
4166
|
-
add(readJsonFile(join10(path,
|
|
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((
|
|
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 (
|
|
4292
|
-
resolve2({ error:
|
|
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
|
|
4346
|
-
clearTimeout(
|
|
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
|
|
4357
|
-
|
|
4358
|
-
timers.push(
|
|
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
|
|
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 (
|
|
4572
|
-
if (
|
|
4573
|
-
throw
|
|
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) =>
|
|
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
|
|
4726
|
-
console.error(` ${
|
|
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((
|
|
5114
|
+
const current = new Set(entries.map((e2) => `${e2.name}.json`));
|
|
4773
5115
|
const expectedUrl = sourceRepoUrl(sourceRepo);
|
|
4774
|
-
const stale = readdirSync4(outDir).filter((
|
|
5116
|
+
const stale = readdirSync4(outDir).filter((f5) => f5.endsWith(".json") && !current.has(f5)).filter((f5) => {
|
|
4775
5117
|
try {
|
|
4776
|
-
return entryReferencesUrl(readJsonFile(join12(outDir,
|
|
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
|
|
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
|
|
5154
|
+
var app = new M("ccpluginizer").meta({ description: "Pluginize non-plugin Claude Code repos" }).command(scanCommand).command(validateCommand);
|
|
4813
5155
|
await app.execute();
|