@simple-git/argv-parser 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/LICENSE +20 -0
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.ts +2 -1
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.mjs +244 -194
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/src/args/parse-argv.d.ts +1 -0
  9. package/dist/src/args/parse-argv.d.ts.map +1 -0
  10. package/dist/src/args/parse-argv.types.d.ts +1 -0
  11. package/dist/src/args/parse-argv.types.d.ts.map +1 -0
  12. package/dist/src/config/analyse-config.d.ts +1 -0
  13. package/dist/src/config/analyse-config.d.ts.map +1 -0
  14. package/dist/src/config/config-operands.d.ts +1 -0
  15. package/dist/src/config/config-operands.d.ts.map +1 -0
  16. package/dist/src/config/config.types.d.ts +1 -0
  17. package/dist/src/config/config.types.d.ts.map +1 -0
  18. package/dist/src/config/detect-config-action.d.ts +1 -0
  19. package/dist/src/config/detect-config-action.d.ts.map +1 -0
  20. package/dist/src/env/parse-env.d.ts +24 -0
  21. package/dist/src/env/parse-env.d.ts.map +1 -0
  22. package/dist/src/flags/flags.helpers.d.ts +1 -0
  23. package/dist/src/flags/flags.helpers.d.ts.map +1 -0
  24. package/dist/src/flags/parse-global-flags.d.ts +1 -0
  25. package/dist/src/flags/parse-global-flags.d.ts.map +1 -0
  26. package/dist/src/flags/parse-task-flags.d.ts +1 -0
  27. package/dist/src/flags/parse-task-flags.d.ts.map +1 -0
  28. package/dist/src/tokens/flag-specs.d.ts +1 -0
  29. package/dist/src/tokens/flag-specs.d.ts.map +1 -0
  30. package/dist/src/tokens/token-expander.d.ts +1 -0
  31. package/dist/src/tokens/token-expander.d.ts.map +1 -0
  32. package/dist/src/vulnerabilities/detect-vulnerable-config-writes.d.ts +1 -0
  33. package/dist/src/vulnerabilities/detect-vulnerable-config-writes.d.ts.map +1 -0
  34. package/dist/src/vulnerabilities/detect-vulnerable-flags.d.ts +1 -0
  35. package/dist/src/vulnerabilities/detect-vulnerable-flags.d.ts.map +1 -0
  36. package/dist/src/vulnerabilities/vulnerability-analysis.d.ts +1 -0
  37. package/dist/src/vulnerabilities/vulnerability-analysis.d.ts.map +1 -0
  38. package/dist/src/vulnerabilities/vulnerability-check.d.ts +1 -0
  39. package/dist/src/vulnerabilities/vulnerability-check.d.ts.map +1 -0
  40. package/dist/src/vulnerabilities/vulnerability.types.d.ts +29 -0
  41. package/dist/src/vulnerabilities/vulnerability.types.d.ts.map +1 -0
  42. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { isPathSpec as m, toPaths as v } from "@simple-git/args-pathspec";
2
- function* U(e, t) {
3
- const n = t === "global";
1
+ import { isPathSpec as v, toPaths as U } from "@simple-git/args-pathspec";
2
+ function* x(e, n) {
3
+ const t = n === "global";
4
4
  for (const o of e)
5
- o.isGlobal === n && (yield o);
5
+ o.isGlobal === t && (yield o);
6
6
  }
7
- const y = /* @__PURE__ */ new Set([
7
+ const P = /* @__PURE__ */ new Set([
8
8
  "--add",
9
9
  "--edit",
10
10
  "--remove-section",
@@ -22,45 +22,45 @@ const y = /* @__PURE__ */ new Set([
22
22
  "--get-urlmatch",
23
23
  "--list",
24
24
  "-l"
25
- ]), P = /* @__PURE__ */ new Set([
25
+ ]), E = /* @__PURE__ */ new Set([
26
26
  "edit",
27
27
  "remove-section",
28
28
  "rename-section",
29
29
  "set",
30
30
  "unset"
31
- ]), E = /* @__PURE__ */ new Set(["get", "get-color", "get-colorbool", "list"]);
32
- function F(e, t) {
33
- for (const { name: o } of U(e, "task")) {
34
- if (y.has(o))
35
- return p(!0, t);
31
+ ]), F = /* @__PURE__ */ new Set(["get", "get-color", "get-colorbool", "list"]);
32
+ function A(e, n) {
33
+ for (const { name: o } of x(e, "task")) {
34
+ if (P.has(o))
35
+ return w(!0, n);
36
36
  if (S.has(o))
37
- return p(!1, t);
37
+ return w(!1, n);
38
38
  }
39
- const n = t.at(0)?.toLowerCase();
40
- 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);
39
+ const t = n.at(0)?.toLowerCase();
40
+ return t === void 0 ? null : E.has(t) ? w(!0, n.slice(1)) : F.has(t) ? w(!1, n.slice(1)) : n.length === 1 ? w(!1, n) : w(!0, n);
41
41
  }
42
- function p(e = !1, t = []) {
43
- const n = t.at(0)?.toLowerCase();
44
- return n === void 0 ? null : {
42
+ function w(e = !1, n = []) {
43
+ const t = n.at(0)?.toLowerCase();
44
+ return t === void 0 ? null : {
45
45
  isWrite: e,
46
46
  isRead: !e,
47
- key: n,
48
- value: t.at(1)
47
+ key: t,
48
+ value: n.at(1)
49
49
  };
50
50
  }
51
- function A(e, t) {
52
- return t.isWrite && t.value !== void 0 ? { key: t.key, value: t.value, scope: e } : { key: t.key, scope: e };
51
+ function O(e, n) {
52
+ return n.isWrite && n.value !== void 0 ? { key: n.key, value: n.value, scope: e } : { key: n.key, scope: e };
53
53
  }
54
- function M(e) {
55
- const t = e?.indexOf("=") || -1;
56
- return !e || t < 0 ? null : {
57
- key: e.slice(0, t).trim().toLowerCase(),
58
- value: e.slice(t + 1)
54
+ function G(e) {
55
+ const n = e?.indexOf("=") || -1;
56
+ return !e || n < 0 ? null : {
57
+ key: e.slice(0, n).trim().toLowerCase(),
58
+ value: e.slice(n + 1)
59
59
  };
60
60
  }
61
- function N(e) {
62
- for (const { name: t } of U(e, "task"))
63
- switch (t) {
61
+ function M(e) {
62
+ for (const { name: n } of x(e, "task"))
63
+ switch (n) {
64
64
  case "--global":
65
65
  return "global";
66
66
  case "--system":
@@ -75,44 +75,44 @@ function N(e) {
75
75
  }
76
76
  return "local";
77
77
  }
78
- function G({ name: e }) {
78
+ function N({ name: e }) {
79
79
  if (e === "-c" || e === "--config")
80
80
  return "inline";
81
81
  if (e === "--config-env")
82
82
  return "env";
83
83
  }
84
- function* O(e) {
85
- for (const t of e) {
86
- const n = G(t), o = n && M(t.value);
84
+ function* $(e) {
85
+ for (const n of e) {
86
+ const t = N(n), o = t && G(n.value);
87
87
  o && (yield {
88
88
  ...o,
89
- scope: n
89
+ scope: t
90
90
  });
91
91
  }
92
92
  }
93
- function $(e, t, n) {
93
+ function D(e, n, t) {
94
94
  const o = {
95
95
  read: [],
96
- write: [...O(t)]
96
+ write: [...$(n)]
97
97
  };
98
- return e === "config" && D(
98
+ return e === "config" && L(
99
99
  o,
100
- N(t),
101
- F(t, n)
100
+ M(n),
101
+ A(n, t)
102
102
  ), o;
103
103
  }
104
- function D(e, t, n) {
105
- if (n === null)
104
+ function L(e, n, t) {
105
+ if (t === null)
106
106
  return;
107
- const o = A(t, n);
108
- n.isWrite ? e.write.push(o) : e.read.push(o);
107
+ const o = O(n, t);
108
+ t.isWrite ? e.write.push(o) : e.read.push(o);
109
109
  }
110
- const x = {
110
+ const C = {
111
111
  short: /* @__PURE__ */ new Map([
112
112
  ["c", !0]
113
113
  // -c <k=v> set config key for this invocation
114
114
  ])
115
- }, L = {
115
+ }, I = {
116
116
  short: new Map([
117
117
  ["C", !0],
118
118
  // -C <path> change working directory
@@ -124,7 +124,7 @@ const x = {
124
124
  // -p paginate
125
125
  ["v", !1],
126
126
  // -v version
127
- ...x.short.entries()
127
+ ...C.short.entries()
128
128
  ]),
129
129
  long: /* @__PURE__ */ new Set([
130
130
  "attr-source",
@@ -199,202 +199,251 @@ const x = {
199
199
  push: {
200
200
  short: /* @__PURE__ */ new Map(),
201
201
  long: /* @__PURE__ */ new Set(["exec", "receive-pack"])
202
+ },
203
+ rebase: {
204
+ short: /* @__PURE__ */ new Map([
205
+ ["X", !0],
206
+ // -X <option> strategy option
207
+ ["f", !1],
208
+ // -f force-rebase
209
+ ["i", !1],
210
+ // -i interactive
211
+ ["k", !1],
212
+ // -k keep-base
213
+ ["m", !1],
214
+ // -m merge
215
+ ["n", !1],
216
+ // -n no-stat
217
+ ["q", !1],
218
+ // -q quiet
219
+ ["r", !1],
220
+ // -r rebase-merges
221
+ ["s", !0],
222
+ // -s <strategy>
223
+ ["v", !1],
224
+ // -v verbose
225
+ ["x", !0]
226
+ // -x <cmd> exec
227
+ ]),
228
+ long: /* @__PURE__ */ new Set(["exec", "onto", "strategy", "strategy-option"])
202
229
  }
203
230
  }, T = { short: /* @__PURE__ */ new Map(), long: /* @__PURE__ */ new Set() };
204
- function I(e) {
205
- const t = R[e ?? ""] ?? T;
231
+ function B(e) {
232
+ const n = R[e ?? ""] ?? T;
206
233
  return {
207
- short: new Map([...x.short.entries(), ...t.short.entries()]),
208
- long: t.long
234
+ short: new Map([...C.short.entries(), ...n.short.entries()]),
235
+ long: n.long
209
236
  };
210
237
  }
211
- function C(e, t = L) {
238
+ function b(e, n = I) {
212
239
  if (e.startsWith("--")) {
213
- const n = e.indexOf("=");
214
- if (n > 2)
215
- return [{ name: e.slice(0, n), value: e.slice(n + 1), needsNext: !1 }];
240
+ const t = e.indexOf("=");
241
+ if (t > 2)
242
+ return [{ name: e.slice(0, t), value: e.slice(t + 1), needsNext: !1 }];
216
243
  const o = e.slice(2);
217
- return [{ name: e, needsNext: t.long.has(o) }];
244
+ return [{ name: e, needsNext: n.long.has(o) }];
218
245
  }
219
246
  if (e.length === 2) {
220
- const n = e.charAt(1), o = t.short.get(n);
247
+ const t = e.charAt(1), o = n.short.get(t);
221
248
  return [{ name: e, needsNext: o === !0 }];
222
249
  }
223
- return W(e, t.short);
250
+ return j(e, n.short);
224
251
  }
225
- function W(e, t) {
226
- const n = e.slice(1).split(""), o = [];
227
- for (let s = 0; s < n.length; s++) {
228
- const l = n[s], r = t.get(l);
252
+ function j(e, n) {
253
+ const t = e.slice(1).split(""), o = [];
254
+ for (let a = 0; a < t.length; a++) {
255
+ const s = t[a], r = n.get(s);
229
256
  if (r === void 0)
230
257
  return [{ name: e, needsNext: !1 }];
231
258
  if (r) {
232
- const a = n.slice(s + 1).join("");
233
- if (a && ![...a].every((w) => t.has(w)))
234
- return o.push({ name: `-${l}`, value: a, needsNext: !1 }), o;
259
+ const i = t.slice(a + 1).join("");
260
+ if (i && ![...i].every((m) => n.has(m)))
261
+ return o.push({ name: `-${s}`, value: i, needsNext: !1 }), o;
235
262
  }
236
- o.push({ name: `-${l}`, needsNext: r });
263
+ o.push({ name: `-${s}`, needsNext: r });
237
264
  }
238
265
  return o;
239
266
  }
240
- function j(e, t = []) {
241
- let n = 0;
242
- for (; n < e.length; ) {
243
- const o = String(e[n]);
267
+ function W(e, n = []) {
268
+ let t = 0;
269
+ for (; t < e.length; ) {
270
+ const o = String(e[t]);
244
271
  if (!o.startsWith("-") || o.length < 2) break;
245
- const s = C(o);
246
- let l = n + 1;
247
- for (const r of s) {
248
- const a = {
272
+ const a = b(o);
273
+ let s = t + 1;
274
+ for (const r of a) {
275
+ const i = {
249
276
  name: r.name,
250
277
  value: r.value,
251
278
  absorbedNext: !1,
252
279
  isGlobal: !0
253
280
  };
254
- r.needsNext && a.value === void 0 && l < e.length && (a.value = String(e[l]), a.absorbedNext = !0, l++), t.push(a);
281
+ r.needsNext && i.value === void 0 && s < e.length && (i.value = String(e[s]), i.absorbedNext = !0, s++), n.push(i);
255
282
  }
256
- n = l;
283
+ t = s;
257
284
  }
258
- return { flags: t, taskIndex: n };
285
+ return { flags: n, taskIndex: t };
259
286
  }
260
- function B(e, t, n = []) {
261
- const o = I(t), s = [], l = [];
287
+ function V(e, n, t = []) {
288
+ const o = B(n), a = [], s = [];
262
289
  let r = 0;
263
290
  for (; r < e.length; ) {
264
- const a = e[r];
265
- if (m(a)) {
266
- l.push(...v(a)), r++;
291
+ const i = e[r];
292
+ if (v(i)) {
293
+ s.push(...U(i)), r++;
267
294
  continue;
268
295
  }
269
- const f = String(a);
270
- if (f === "--") {
271
- for (let g = r + 1; g < e.length; g++) {
272
- const u = e[g];
273
- m(u) ? l.push(...v(u)) : l.push(String(u));
296
+ const p = String(i);
297
+ if (p === "--") {
298
+ for (let d = r + 1; d < e.length; d++) {
299
+ const g = e[d];
300
+ v(g) ? s.push(...U(g)) : s.push(String(g));
274
301
  }
275
302
  break;
276
303
  }
277
- if (!f.startsWith("-") || f.length < 2) {
278
- s.push(f), r++;
304
+ if (!p.startsWith("-") || p.length < 2) {
305
+ a.push(p), r++;
279
306
  continue;
280
307
  }
281
- const w = C(f, o);
282
- let d = r + 1;
283
- for (const g of w) {
284
- const u = {
285
- name: g.name,
286
- value: g.value,
308
+ const m = b(p, o);
309
+ let u = r + 1;
310
+ for (const d of m) {
311
+ const g = {
312
+ name: d.name,
313
+ value: d.value,
287
314
  absorbedNext: !1,
288
315
  isGlobal: !1
289
316
  };
290
- g.needsNext && u.value === void 0 && d < e.length && !m(e[d]) && (u.value = String(e[d]), u.absorbedNext = !0, d++), n.push(u);
317
+ d.needsNext && g.value === void 0 && u < e.length && !v(e[u]) && (g.value = String(e[u]), g.absorbedNext = !0, u++), t.push(g);
291
318
  }
292
- r = d;
319
+ r = u;
293
320
  }
294
- return { flags: n, positionals: s, pathspecs: l };
321
+ return { flags: t, positionals: a, pathspecs: s };
295
322
  }
296
- function* V({
323
+ function* q({
297
324
  write: e
298
325
  }) {
299
- for (const t of e)
300
- for (const n of q) {
301
- const o = n(t.key);
326
+ for (const n of e)
327
+ for (const t of K) {
328
+ const o = t(n.key);
302
329
  o && (yield o);
303
330
  }
304
331
  }
305
- function c(e, t, n = String(e)) {
332
+ function f(e, n, t = String(e)) {
306
333
  const o = typeof e == "string" ? new RegExp(`\\s*${e.toLowerCase()}`) : e;
307
- return function(l) {
308
- if (o.test(l))
334
+ return function(s) {
335
+ if (o.test(s))
309
336
  return {
310
- category: t,
311
- message: `Configuring ${n} is not permitted without enabling ${t}`
337
+ category: n,
338
+ message: `Configuring ${t} is not permitted without enabling ${n}`
312
339
  };
313
340
  };
314
341
  }
315
- function i(e, t) {
316
- const n = new RegExp(`\\s*${e.toLowerCase().replace(/\./g, "(..+)?.")}`);
317
- return c(n, t, e);
342
+ function l(e, n) {
343
+ const t = new RegExp(`\\s*${e.toLowerCase().replace(/\./g, "(..+)?.")}`);
344
+ return f(t, n, e);
318
345
  }
319
- const q = [
320
- c("alias", "allowUnsafeAlias"),
321
- c("core.askPass", "allowUnsafeAskPass"),
322
- c("core.editor", "allowUnsafeEditor"),
323
- c("core.fsmonitor", "allowUnsafeFsMonitor"),
324
- c("core.gitProxy", "allowUnsafeGitProxy"),
325
- c("core.hooksPath", "allowUnsafeHooksPath"),
326
- c("core.pager", "allowUnsafePager"),
327
- c("core.sshCommand", "allowUnsafeSshCommand"),
328
- i("credential.helper", "allowUnsafeCredentialHelper"),
329
- i("diff.command", "allowUnsafeDiffExternal"),
330
- c("diff.external", "allowUnsafeDiffExternal"),
331
- i("diff.textconv", "allowUnsafeDiffTextConv"),
332
- i("filter.clean", "allowUnsafeFilter"),
333
- i("filter.smudge", "allowUnsafeFilter"),
334
- i("gpg.program", "allowUnsafeGpgProgram"),
335
- c("init.templateDir", "allowUnsafeTemplateDir"),
336
- i("merge.driver", "allowUnsafeMergeDriver"),
337
- i("mergetool.path", "allowUnsafeMergeDriver"),
338
- i("mergetool.cmd", "allowUnsafeMergeDriver"),
339
- i("protocol.allow", "allowUnsafeProtocolOverride"),
340
- i("remote.receivepack", "allowUnsafePack"),
341
- i("remote.uploadpack", "allowUnsafePack"),
342
- c("sequence.editor", "allowUnsafeEditor")
346
+ const K = [
347
+ f("alias", "allowUnsafeAlias"),
348
+ f("core.askPass", "allowUnsafeAskPass"),
349
+ f("core.editor", "allowUnsafeEditor"),
350
+ f("core.fsmonitor", "allowUnsafeFsMonitor"),
351
+ f("core.gitProxy", "allowUnsafeGitProxy"),
352
+ f("core.hooksPath", "allowUnsafeHooksPath"),
353
+ f("core.pager", "allowUnsafePager"),
354
+ f("core.sshCommand", "allowUnsafeSshCommand"),
355
+ l("credential.helper", "allowUnsafeCredentialHelper"),
356
+ l("diff.command", "allowUnsafeDiffExternal"),
357
+ f("diff.external", "allowUnsafeDiffExternal"),
358
+ l("difftool.cmd", "allowUnsafeDiffExternal"),
359
+ l("diff.textconv", "allowUnsafeDiffTextConv"),
360
+ l("filter.clean", "allowUnsafeFilter"),
361
+ l("filter.process", "allowUnsafeFilter"),
362
+ l("filter.smudge", "allowUnsafeFilter"),
363
+ l("gpg.program", "allowUnsafeGpgProgram"),
364
+ f("include.path", "allowUnsafeInclude"),
365
+ l("includeIf", "allowUnsafeInclude"),
366
+ f("init.templateDir", "allowUnsafeTemplateDir"),
367
+ l("pager.", "allowUnsafePager"),
368
+ l("merge.driver", "allowUnsafeMergeDriver"),
369
+ l("mergetool.path", "allowUnsafeMergeDriver"),
370
+ l("mergetool.cmd", "allowUnsafeMergeDriver"),
371
+ l("protocol.allow", "allowUnsafeProtocolOverride"),
372
+ l("remote.receivepack", "allowUnsafePack"),
373
+ l("remote.uploadpack", "allowUnsafePack"),
374
+ f("uploadpack.packObjectsHook", "allowUnsafePack"),
375
+ f("sequence.editor", "allowUnsafeEditor"),
376
+ l("submodule.update", "allowUnsafeSubmodule"),
377
+ l("tar.command", "allowUnsafeCommandBinaries"),
378
+ l("trailer.cmd", "allowUnsafeCommandBinaries"),
379
+ l("trailer.command", "allowUnsafeCommandBinaries"),
380
+ l("url.insteadOf", "allowUnsafeUrlRewrite")
343
381
  ];
344
- function* K(e, t) {
345
- for (const n of t)
346
- for (const o of H) {
347
- const s = o(e, n.name);
348
- s && (yield s);
382
+ function* H(e, n) {
383
+ for (const t of n)
384
+ for (const o of X) {
385
+ const a = o(e, t);
386
+ a && (yield a);
349
387
  }
350
388
  }
351
- function h(e, t, n, o = String(t)) {
352
- const s = typeof t == "string" ? new RegExp(`\\s*${t.toLowerCase()}`) : t, l = `Use of ${e ? `${e} with option ` : ""}${o} is not permitted without enabling ${n}`;
353
- return function(a, f) {
354
- if ((!e || a === e) && s.test(f))
389
+ function c(e, n, t, { name: o = String(n), globalOnly: a = !1, withValue: s = !1 } = {}) {
390
+ const r = typeof n == "string" ? new RegExp(`\\s*${n.toLowerCase()}`) : n, i = `Use of ${e ? `${e} with option ` : ""}${o} is not permitted without enabling ${t}`;
391
+ return function(m, u) {
392
+ if (!(e && m !== e) && !(a && !u.isGlobal) && !(s && u.value === void 0) && r.test(u.name))
355
393
  return {
356
- category: n,
357
- message: l
394
+ category: t,
395
+ message: i
358
396
  };
359
397
  };
360
398
  }
361
- const H = [
362
- h(
363
- null,
364
- /--(upload|receive)-pack/,
365
- "allowUnsafePack",
366
- "--upload-pack or --receive-pack"
367
- ),
368
- h("clone", /^-\w*u/, "allowUnsafePack"),
369
- h("clone", "--u", "allowUnsafePack"),
370
- h("push", "--exec", "allowUnsafePack"),
371
- h(null, "--template", "allowUnsafeTemplateDir")
399
+ const h = { globalOnly: !0, withValue: !0 }, X = [
400
+ c(null, /--(upload|receive)-pack/, "allowUnsafePack", {
401
+ name: "--upload-pack or --receive-pack"
402
+ }),
403
+ c("clone", /^-\w*u/, "allowUnsafePack"),
404
+ c("clone", "--u", "allowUnsafePack"),
405
+ c("push", /^--exec$/, "allowUnsafePack", { name: "--exec" }),
406
+ // `git` accepts unambiguous abbreviations of long options, so `--ex` and `--exe` are `--exec`
407
+ c("rebase", /^(-x|--ex(ec?)?)$/, "allowUnsafeExec", { name: "-x or --exec" }),
408
+ c(null, "--template", "allowUnsafeTemplateDir"),
409
+ c(null, "--exec-path", "allowUnsafeExec", h),
410
+ // `git` reads the configuration of whichever repository these name, so the
411
+ // directory alone is enough to deliver config the argv guards never see
412
+ c(null, "--git-dir", "allowUnsafeConfigPaths", h),
413
+ c(null, "--work-tree", "allowUnsafeConfigPaths", h),
414
+ c(null, /^-C$/, "allowUnsafeConfigPaths", { ...h, name: "-C" })
372
415
  ];
373
- function b(e, t, n) {
374
- return [...K(e, t), ...V(n)];
416
+ function k(e, n, t) {
417
+ return [...H(e, n), ...q(t)];
375
418
  }
376
419
  function Y(...e) {
377
- const { flags: t, taskIndex: n } = j(e), o = n < e.length ? String(e[n]).toLowerCase() : null, s = o !== null ? e.slice(n + 1) : [], { positionals: l, pathspecs: r } = B(s, o, t), a = $(o, t, l);
420
+ const { flags: n, taskIndex: t } = W(e), o = t < e.length ? String(e[t]).toLowerCase() : null, a = o !== null ? e.slice(t + 1) : [], { positionals: s, pathspecs: r } = V(a, o, n), i = D(o, n, s);
378
421
  return {
379
422
  task: o,
380
- flags: t.map(z),
423
+ flags: n.map(J),
381
424
  paths: r,
382
- config: a,
383
- vulnerabilities: b(o, t, a)
425
+ config: i,
426
+ vulnerabilities: z(k(o, n, i))
384
427
  };
385
428
  }
386
- function z({ value: e, name: t }) {
387
- return e !== void 0 ? { name: t, value: e } : { name: t };
429
+ function z(e) {
430
+ return Object.defineProperty(e, "vulnerabilities", {
431
+ value: e
432
+ });
433
+ }
434
+ function J({ value: e, name: n }) {
435
+ return e !== void 0 ? { name: n, value: e } : { name: n };
388
436
  }
389
- const _ = {
437
+ const y = {
390
438
  editor: "allowUnsafeEditor",
391
439
  git_askpass: "allowUnsafeAskPass",
392
440
  git_config_global: "allowUnsafeConfigPaths",
393
441
  git_config_system: "allowUnsafeConfigPaths",
394
442
  git_config_count: "allowUnsafeConfigEnvCount",
443
+ git_config_parameters: "allowUnsafeConfigEnvCount",
395
444
  git_config: "allowUnsafeConfigPaths",
396
445
  git_editor: "allowUnsafeEditor",
397
- git_exec_path: "allowUnsafeConfigPaths",
446
+ git_exec_path: "allowUnsafeExec",
398
447
  git_external_diff: "allowUnsafeDiffExternal",
399
448
  git_pager: "allowUnsafePager",
400
449
  git_proxy_command: "allowUnsafeGitProxy",
@@ -406,53 +455,54 @@ const _ = {
406
455
  prefix: "allowUnsafeConfigPaths",
407
456
  ssh_askpass: "allowUnsafeAskPass"
408
457
  };
409
- function* J(e) {
410
- const t = parseInt(e.git_config_count ?? "0", 10);
411
- for (let n = 0; n < t; n++) {
412
- const o = e[`git_config_key_${n}`], s = e[`git_config_value_${n}`];
413
- o !== void 0 && (yield { key: o.toLowerCase().trim(), value: s, scope: "env" });
458
+ function* Q(e) {
459
+ const n = parseInt(e.git_config_count ?? "0", 10);
460
+ for (let t = 0; t < n; t++) {
461
+ const o = e[`git_config_key_${t}`], a = e[`git_config_value_${t}`];
462
+ o !== void 0 && (yield { key: o.toLowerCase().trim(), value: a, scope: "env" });
414
463
  }
415
464
  }
416
- function* Q(e) {
417
- for (const t of Object.keys(e))
418
- if (k(t)) {
419
- const n = _[t];
465
+ function* Z(e) {
466
+ for (const n of Object.keys(e))
467
+ if (_(n)) {
468
+ const t = y[n];
420
469
  yield {
421
- category: n,
422
- message: `Use of "${t.toUpperCase()}" is not permitted without enabling ${n}`
470
+ category: t,
471
+ message: `Use of "${n.toUpperCase()}" is not permitted without enabling ${t}`
423
472
  };
424
473
  }
425
474
  }
426
- function k(e) {
427
- return Object.hasOwn(_, e);
475
+ function _(e) {
476
+ return Object.hasOwn(y, e);
428
477
  }
429
- function X(e) {
430
- const t = {};
431
- for (const [n, o] of Object.entries(e)) {
432
- const s = n.toLowerCase().trim();
433
- (k(s) || s.startsWith("git")) && (t[s] = String(o));
478
+ function ee(e) {
479
+ const n = {};
480
+ for (const [t, o] of Object.entries(e)) {
481
+ const a = t.toLowerCase().trim();
482
+ (_(a) || a.startsWith("git")) && (n[a] = String(o));
434
483
  }
435
- return t;
484
+ return n;
436
485
  }
437
- function Z(e) {
438
- const t = X(e), n = {
486
+ function ne(e) {
487
+ const n = ee(e), t = {
439
488
  read: [],
440
- write: [...J(t)]
489
+ write: [...Q(n)]
441
490
  }, o = [
442
- ...Q(t),
443
- ...b(null, [], n)
491
+ ...Z(n),
492
+ ...k(null, [], t)
444
493
  ];
445
494
  return {
446
- config: n,
495
+ config: t,
447
496
  vulnerabilities: o
448
497
  };
449
498
  }
450
- function te(e, t) {
451
- return [...Y(...e).vulnerabilities, ...Z(t).vulnerabilities];
499
+ function oe(e, n) {
500
+ return [...Y(...e).vulnerabilities, ...ne(n).vulnerabilities];
452
501
  }
453
502
  export {
503
+ _ as isGitEnvKey,
454
504
  Y as parseArgv,
455
- Z as parseEnv,
456
- te as vulnerabilityCheck
505
+ ne as parseEnv,
506
+ oe as vulnerabilityCheck
457
507
  };
458
508
  //# sourceMappingURL=index.mjs.map