bfi-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,471 @@
1
+ import { o, r } from "./args-pathspec.mjs";
2
+ function* U(e, t) {
3
+ const n = t === "global";
4
+ for (const o of e) o.isGlobal === n && (yield o);
5
+ }
6
+ const k = /* @__PURE__ */ new Set([
7
+ "--add",
8
+ "--edit",
9
+ "--remove-section",
10
+ "--rename-section",
11
+ "--replace-all",
12
+ "--unset",
13
+ "--unset-all",
14
+ "-e"
15
+ ]);
16
+ const S = /* @__PURE__ */ new Set([
17
+ "--get",
18
+ "--get-all",
19
+ "--get-color",
20
+ "--get-colorbool",
21
+ "--get-regexp",
22
+ "--get-urlmatch",
23
+ "--list",
24
+ "-l"
25
+ ]);
26
+ const P = /* @__PURE__ */ new Set([
27
+ "edit",
28
+ "remove-section",
29
+ "rename-section",
30
+ "set",
31
+ "unset"
32
+ ]);
33
+ const E = /* @__PURE__ */ new Set([
34
+ "get",
35
+ "get-color",
36
+ "get-colorbool",
37
+ "list"
38
+ ]);
39
+ function F(e, t) {
40
+ for (const { name: o } of U(e, "task")) {
41
+ if (k.has(o)) return p(!0, t);
42
+ if (S.has(o)) return p(!1, t);
43
+ }
44
+ const n = t.at(0)?.toLowerCase();
45
+ return n === void 0 ? null : P.has(n) ? p(!0, t.slice(1)) : E.has(n) ? p(!1, t.slice(1)) : t.length === 1 ? p(!1, t) : p(!0, t);
46
+ }
47
+ function p(e = !1, t = []) {
48
+ const n = t.at(0)?.toLowerCase();
49
+ return n === void 0 ? null : {
50
+ isWrite: e,
51
+ isRead: !e,
52
+ key: n,
53
+ value: t.at(1)
54
+ };
55
+ }
56
+ function A(e, t) {
57
+ return t.isWrite && t.value !== void 0 ? {
58
+ key: t.key,
59
+ value: t.value,
60
+ scope: e
61
+ } : {
62
+ key: t.key,
63
+ scope: e
64
+ };
65
+ }
66
+ function M(e) {
67
+ const t = e?.indexOf("=") || -1;
68
+ return !e || t < 0 ? null : {
69
+ key: e.slice(0, t).trim().toLowerCase(),
70
+ value: e.slice(t + 1)
71
+ };
72
+ }
73
+ function N(e) {
74
+ for (const { name: t } of U(e, "task")) switch (t) {
75
+ case "--global": return "global";
76
+ case "--system": return "system";
77
+ case "--worktree": return "worktree";
78
+ case "--local": return "local";
79
+ case "--file":
80
+ case "-f": return "file";
81
+ }
82
+ return "local";
83
+ }
84
+ function G({ name: e }) {
85
+ if (e === "-c" || e === "--config") return "inline";
86
+ if (e === "--config-env") return "env";
87
+ }
88
+ function* O(e) {
89
+ for (const t of e) {
90
+ const n = G(t), o = n && M(t.value);
91
+ o && (yield {
92
+ ...o,
93
+ scope: n
94
+ });
95
+ }
96
+ }
97
+ function L(e, t, n) {
98
+ const o = {
99
+ read: [],
100
+ write: [...O(t)]
101
+ };
102
+ return e === "config" && $(o, N(t), F(t, n)), o;
103
+ }
104
+ function $(e, t, n) {
105
+ if (n === null) return;
106
+ const o = A(t, n);
107
+ n.isWrite ? e.write.push(o) : e.read.push(o);
108
+ }
109
+ const x = { short: /* @__PURE__ */ new Map([["c", !0]]) };
110
+ const D = {
111
+ short: new Map([
112
+ ["C", !0],
113
+ ["P", !1],
114
+ ["h", !1],
115
+ ["p", !1],
116
+ ["v", !1],
117
+ ...x.short.entries()
118
+ ]),
119
+ long: /* @__PURE__ */ new Set([
120
+ "attr-source",
121
+ "config-env",
122
+ "exec-path",
123
+ "git-dir",
124
+ "list-cmds",
125
+ "namespace",
126
+ "super-prefix",
127
+ "work-tree"
128
+ ])
129
+ };
130
+ const R = {
131
+ clone: {
132
+ short: /* @__PURE__ */ new Map([
133
+ ["b", !0],
134
+ ["j", !0],
135
+ ["l", !1],
136
+ ["n", !1],
137
+ ["o", !0],
138
+ ["q", !1],
139
+ ["s", !1],
140
+ ["u", !0]
141
+ ]),
142
+ long: /* @__PURE__ */ new Set([
143
+ "branch",
144
+ "config",
145
+ "jobs",
146
+ "origin",
147
+ "upload-pack",
148
+ "u",
149
+ "template"
150
+ ])
151
+ },
152
+ commit: {
153
+ short: /* @__PURE__ */ new Map([
154
+ ["C", !0],
155
+ ["F", !0],
156
+ ["c", !0],
157
+ ["m", !0],
158
+ ["t", !0]
159
+ ]),
160
+ long: /* @__PURE__ */ new Set([
161
+ "file",
162
+ "message",
163
+ "reedit-message",
164
+ "reuse-message",
165
+ "template"
166
+ ])
167
+ },
168
+ config: {
169
+ short: /* @__PURE__ */ new Map([
170
+ ["e", !1],
171
+ ["f", !0],
172
+ ["l", !1]
173
+ ]),
174
+ long: /* @__PURE__ */ new Set([
175
+ "blob",
176
+ "comment",
177
+ "default",
178
+ "file",
179
+ "type",
180
+ "value"
181
+ ])
182
+ },
183
+ fetch: {
184
+ short: /* @__PURE__ */ new Map(),
185
+ long: /* @__PURE__ */ new Set(["upload-pack"])
186
+ },
187
+ init: {
188
+ short: /* @__PURE__ */ new Map(),
189
+ long: /* @__PURE__ */ new Set(["template"])
190
+ },
191
+ pull: {
192
+ short: /* @__PURE__ */ new Map(),
193
+ long: /* @__PURE__ */ new Set(["upload-pack"])
194
+ },
195
+ push: {
196
+ short: /* @__PURE__ */ new Map(),
197
+ long: /* @__PURE__ */ new Set(["exec", "receive-pack"])
198
+ }
199
+ };
200
+ const T = {
201
+ short: /* @__PURE__ */ new Map(),
202
+ long: /* @__PURE__ */ new Set()
203
+ };
204
+ function I(e) {
205
+ const t = R[e ?? ""] ?? T;
206
+ return {
207
+ short: new Map([...x.short.entries(), ...t.short.entries()]),
208
+ long: t.long
209
+ };
210
+ }
211
+ function b(e, t = D) {
212
+ if (e.startsWith("--")) {
213
+ const n = e.indexOf("=");
214
+ if (n > 2) return [{
215
+ name: e.slice(0, n),
216
+ value: e.slice(n + 1),
217
+ needsNext: !1
218
+ }];
219
+ const o = e.slice(2);
220
+ return [{
221
+ name: e,
222
+ needsNext: t.long.has(o)
223
+ }];
224
+ }
225
+ if (e.length === 2) {
226
+ const n = e.charAt(1);
227
+ return [{
228
+ name: e,
229
+ needsNext: t.short.get(n) === !0
230
+ }];
231
+ }
232
+ return W(e, t.short);
233
+ }
234
+ function W(e, t) {
235
+ const n = e.slice(1).split(""), o = [];
236
+ for (let s = 0; s < n.length; s++) {
237
+ const r = n[s], l = t.get(r);
238
+ if (l === void 0) return [{
239
+ name: e,
240
+ needsNext: !1
241
+ }];
242
+ if (l) {
243
+ const a = n.slice(s + 1).join("");
244
+ if (a && ![...a].every((w) => t.has(w))) return o.push({
245
+ name: `-${r}`,
246
+ value: a,
247
+ needsNext: !1
248
+ }), o;
249
+ }
250
+ o.push({
251
+ name: `-${r}`,
252
+ needsNext: l
253
+ });
254
+ }
255
+ return o;
256
+ }
257
+ function j(e, t = []) {
258
+ let n = 0;
259
+ for (; n < e.length;) {
260
+ const o = String(e[n]);
261
+ if (!o.startsWith("-") || o.length < 2) break;
262
+ const s = b(o);
263
+ let r = n + 1;
264
+ for (const l of s) {
265
+ const a = {
266
+ name: l.name,
267
+ value: l.value,
268
+ absorbedNext: !1,
269
+ isGlobal: !0
270
+ };
271
+ l.needsNext && a.value === void 0 && r < e.length && (a.value = String(e[r]), a.absorbedNext = !0, r++), t.push(a);
272
+ }
273
+ n = r;
274
+ }
275
+ return {
276
+ flags: t,
277
+ taskIndex: n
278
+ };
279
+ }
280
+ function B(e, t, n = []) {
281
+ const o$1 = I(t), s = [], r$1 = [];
282
+ let l = 0;
283
+ for (; l < e.length;) {
284
+ const a = e[l];
285
+ if (r(a)) {
286
+ r$1.push(...o(a)), l++;
287
+ continue;
288
+ }
289
+ const f = String(a);
290
+ if (f === "--") {
291
+ for (let g = l + 1; g < e.length; g++) {
292
+ const u = e[g];
293
+ r(u) ? r$1.push(...o(u)) : r$1.push(String(u));
294
+ }
295
+ break;
296
+ }
297
+ if (!f.startsWith("-") || f.length < 2) {
298
+ s.push(f), l++;
299
+ continue;
300
+ }
301
+ const w = b(f, o$1);
302
+ let d = l + 1;
303
+ for (const g of w) {
304
+ const u = {
305
+ name: g.name,
306
+ value: g.value,
307
+ absorbedNext: !1,
308
+ isGlobal: !1
309
+ };
310
+ g.needsNext && u.value === void 0 && d < e.length && !r(e[d]) && (u.value = String(e[d]), u.absorbedNext = !0, d++), n.push(u);
311
+ }
312
+ l = d;
313
+ }
314
+ return {
315
+ flags: n,
316
+ positionals: s,
317
+ pathspecs: r$1
318
+ };
319
+ }
320
+ function* V({ write: e }) {
321
+ for (const t of e) for (const n of q) {
322
+ const o = n(t.key);
323
+ o && (yield o);
324
+ }
325
+ }
326
+ function c(e, t, n = String(e)) {
327
+ const o = typeof e == "string" ? new RegExp(`\\s*${e.toLowerCase()}`) : e;
328
+ return function(r) {
329
+ if (o.test(r)) return {
330
+ category: t,
331
+ message: `Configuring ${n} is not permitted without enabling ${t}`
332
+ };
333
+ };
334
+ }
335
+ function i(e, t) {
336
+ return c(new RegExp(`\\s*${e.toLowerCase().replace(/\./g, "(..+)?.")}`), t, e);
337
+ }
338
+ const q = [
339
+ c("alias", "allowUnsafeAlias"),
340
+ c("core.askPass", "allowUnsafeAskPass"),
341
+ c("core.editor", "allowUnsafeEditor"),
342
+ c("core.fsmonitor", "allowUnsafeFsMonitor"),
343
+ c("core.gitProxy", "allowUnsafeGitProxy"),
344
+ c("core.hooksPath", "allowUnsafeHooksPath"),
345
+ c("core.pager", "allowUnsafePager"),
346
+ c("core.sshCommand", "allowUnsafeSshCommand"),
347
+ i("credential.helper", "allowUnsafeCredentialHelper"),
348
+ i("diff.command", "allowUnsafeDiffExternal"),
349
+ c("diff.external", "allowUnsafeDiffExternal"),
350
+ i("diff.textconv", "allowUnsafeDiffTextConv"),
351
+ i("filter.clean", "allowUnsafeFilter"),
352
+ i("filter.smudge", "allowUnsafeFilter"),
353
+ i("gpg.program", "allowUnsafeGpgProgram"),
354
+ c("init.templateDir", "allowUnsafeTemplateDir"),
355
+ i("merge.driver", "allowUnsafeMergeDriver"),
356
+ i("mergetool.path", "allowUnsafeMergeDriver"),
357
+ i("mergetool.cmd", "allowUnsafeMergeDriver"),
358
+ i("protocol.allow", "allowUnsafeProtocolOverride"),
359
+ i("remote.receivepack", "allowUnsafePack"),
360
+ i("remote.uploadpack", "allowUnsafePack"),
361
+ c("sequence.editor", "allowUnsafeEditor")
362
+ ];
363
+ function* K(e, t) {
364
+ for (const n of t) for (const o of H) {
365
+ const s = o(e, n.name);
366
+ s && (yield s);
367
+ }
368
+ }
369
+ function h(e, t, n, o = String(t)) {
370
+ const s = typeof t == "string" ? new RegExp(`\\s*${t.toLowerCase()}`) : t, r = `Use of ${e ? `${e} with option ` : ""}${o} is not permitted without enabling ${n}`;
371
+ return function(a, f) {
372
+ if ((!e || a === e) && s.test(f)) return {
373
+ category: n,
374
+ message: r
375
+ };
376
+ };
377
+ }
378
+ const H = [
379
+ h(null, /--(upload|receive)-pack/, "allowUnsafePack", "--upload-pack or --receive-pack"),
380
+ h("clone", /^-\w*u/, "allowUnsafePack"),
381
+ h("clone", "--u", "allowUnsafePack"),
382
+ h("push", "--exec", "allowUnsafePack"),
383
+ h(null, "--template", "allowUnsafeTemplateDir")
384
+ ];
385
+ function C(e, t, n) {
386
+ return [...K(e, t), ...V(n)];
387
+ }
388
+ function Y(...e) {
389
+ const { flags: t, taskIndex: n } = j(e), o = n < e.length ? String(e[n]).toLowerCase() : null, { positionals: r, pathspecs: l } = B(o !== null ? e.slice(n + 1) : [], o, t), a = L(o, t, r);
390
+ return {
391
+ task: o,
392
+ flags: t.map(J),
393
+ paths: l,
394
+ config: a,
395
+ vulnerabilities: z(C(o, t, a))
396
+ };
397
+ }
398
+ function z(e) {
399
+ return Object.defineProperty(e, "vulnerabilities", { value: e });
400
+ }
401
+ function J({ value: e, name: t }) {
402
+ return e !== void 0 ? {
403
+ name: t,
404
+ value: e
405
+ } : { name: t };
406
+ }
407
+ const y = {
408
+ editor: "allowUnsafeEditor",
409
+ git_askpass: "allowUnsafeAskPass",
410
+ git_config_global: "allowUnsafeConfigPaths",
411
+ git_config_system: "allowUnsafeConfigPaths",
412
+ git_config_count: "allowUnsafeConfigEnvCount",
413
+ git_config: "allowUnsafeConfigPaths",
414
+ git_editor: "allowUnsafeEditor",
415
+ git_exec_path: "allowUnsafeConfigPaths",
416
+ git_external_diff: "allowUnsafeDiffExternal",
417
+ git_pager: "allowUnsafePager",
418
+ git_proxy_command: "allowUnsafeGitProxy",
419
+ git_template_dir: "allowUnsafeTemplateDir",
420
+ git_sequence_editor: "allowUnsafeEditor",
421
+ git_ssh: "allowUnsafeSshCommand",
422
+ git_ssh_command: "allowUnsafeSshCommand",
423
+ pager: "allowUnsafePager",
424
+ prefix: "allowUnsafeConfigPaths",
425
+ ssh_askpass: "allowUnsafeAskPass"
426
+ };
427
+ function* Q(e) {
428
+ const t = parseInt(e.git_config_count ?? "0", 10);
429
+ for (let n = 0; n < t; n++) {
430
+ const o = e[`git_config_key_${n}`], s = e[`git_config_value_${n}`];
431
+ o !== void 0 && (yield {
432
+ key: o.toLowerCase().trim(),
433
+ value: s,
434
+ scope: "env"
435
+ });
436
+ }
437
+ }
438
+ function* X(e) {
439
+ for (const t of Object.keys(e)) if (_(t)) {
440
+ const n = y[t];
441
+ yield {
442
+ category: n,
443
+ message: `Use of "${t.toUpperCase()}" is not permitted without enabling ${n}`
444
+ };
445
+ }
446
+ }
447
+ function _(e) {
448
+ return Object.hasOwn(y, e);
449
+ }
450
+ function Z(e) {
451
+ const t = {};
452
+ for (const [n, o] of Object.entries(e)) {
453
+ const s = n.toLowerCase().trim();
454
+ (_(s) || s.startsWith("git")) && (t[s] = String(o));
455
+ }
456
+ return t;
457
+ }
458
+ function ee(e) {
459
+ const t = Z(e), n = {
460
+ read: [],
461
+ write: [...Q(t)]
462
+ };
463
+ return {
464
+ config: n,
465
+ vulnerabilities: [...X(t), ...C(null, [], n)]
466
+ };
467
+ }
468
+ function ne(e, t) {
469
+ return [...Y(...e).vulnerabilities, ...ee(t).vulnerabilities];
470
+ }
471
+ export { ne };
@@ -0,0 +1,70 @@
1
+ import { __commonJSMin } from "../rolldown-runtime.mjs";
2
+ var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3
+ let p = process || {};
4
+ let argv = p.argv || [];
5
+ let env = p.env || {};
6
+ let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
7
+ let formatter = (open, close, replace = open) => (input) => {
8
+ let string = "" + input, index = string.indexOf(close, open.length);
9
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
10
+ };
11
+ let replaceClose = (string, close, replace, index) => {
12
+ let result = "", cursor = 0;
13
+ do {
14
+ result += string.substring(cursor, index) + replace;
15
+ cursor = index + close.length;
16
+ index = string.indexOf(close, cursor);
17
+ } while (~index);
18
+ return result + string.substring(cursor);
19
+ };
20
+ let createColors = (enabled = isColorSupported) => {
21
+ let f = enabled ? formatter : () => String;
22
+ return {
23
+ isColorSupported: enabled,
24
+ reset: f("\x1B[0m", "\x1B[0m"),
25
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
26
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
27
+ italic: f("\x1B[3m", "\x1B[23m"),
28
+ underline: f("\x1B[4m", "\x1B[24m"),
29
+ inverse: f("\x1B[7m", "\x1B[27m"),
30
+ hidden: f("\x1B[8m", "\x1B[28m"),
31
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
32
+ black: f("\x1B[30m", "\x1B[39m"),
33
+ red: f("\x1B[31m", "\x1B[39m"),
34
+ green: f("\x1B[32m", "\x1B[39m"),
35
+ yellow: f("\x1B[33m", "\x1B[39m"),
36
+ blue: f("\x1B[34m", "\x1B[39m"),
37
+ magenta: f("\x1B[35m", "\x1B[39m"),
38
+ cyan: f("\x1B[36m", "\x1B[39m"),
39
+ white: f("\x1B[37m", "\x1B[39m"),
40
+ gray: f("\x1B[90m", "\x1B[39m"),
41
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
42
+ bgRed: f("\x1B[41m", "\x1B[49m"),
43
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
44
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
45
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
46
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
47
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
48
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
49
+ blackBright: f("\x1B[90m", "\x1B[39m"),
50
+ redBright: f("\x1B[91m", "\x1B[39m"),
51
+ greenBright: f("\x1B[92m", "\x1B[39m"),
52
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
53
+ blueBright: f("\x1B[94m", "\x1B[39m"),
54
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
55
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
56
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
57
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
58
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
59
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
60
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
61
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
62
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
63
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
64
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
65
+ };
66
+ };
67
+ module.exports = createColors();
68
+ module.exports.createColors = createColors;
69
+ }));
70
+ export { require_picocolors };