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