@rackerlabs/agent-skills-cli 1.5.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.
- package/README.md +603 -0
- package/ThirdPartyNoticeText.txt +125 -0
- package/bin/cli.mjs +14 -0
- package/dist/_chunks/libs/@clack/core.mjs +767 -0
- package/dist/_chunks/libs/@clack/prompts.mjs +334 -0
- package/dist/_chunks/libs/@kwsites/file-exists.mjs +562 -0
- package/dist/_chunks/libs/@kwsites/promise-deferred.mjs +37 -0
- package/dist/_chunks/libs/@simple-git/args-pathspec.mjs +12 -0
- package/dist/_chunks/libs/@simple-git/argv-parser.mjs +367 -0
- package/dist/_chunks/libs/esprima.mjs +5338 -0
- package/dist/_chunks/libs/extend-shallow.mjs +31 -0
- package/dist/_chunks/libs/gray-matter.mjs +2596 -0
- package/dist/_chunks/libs/simple-git.mjs +3560 -0
- package/dist/_chunks/libs/xdg-basedir.mjs +14 -0
- package/dist/_chunks/manifest-cli.mjs +73 -0
- package/dist/_chunks/manifest.mjs +49 -0
- package/dist/_chunks/registry-hashes.mjs +56 -0
- package/dist/_chunks/registry.mjs +47 -0
- package/dist/_chunks/rolldown-runtime.mjs +24 -0
- package/dist/_chunks/verify.mjs +170 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +4885 -0
- package/package.json +129 -0
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { n as o, r } from "./args-pathspec.mjs";
|
|
2
|
+
function* w(e, t) {
|
|
3
|
+
const n = t === "global";
|
|
4
|
+
for (const o of e) o.isGlobal === n && (yield o);
|
|
5
|
+
}
|
|
6
|
+
const x = /* @__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
|
+
]), k = /* @__PURE__ */ new Set([
|
|
25
|
+
"edit",
|
|
26
|
+
"remove-section",
|
|
27
|
+
"rename-section",
|
|
28
|
+
"set",
|
|
29
|
+
"unset"
|
|
30
|
+
]), y = /* @__PURE__ */ new Set([
|
|
31
|
+
"get",
|
|
32
|
+
"get-color",
|
|
33
|
+
"get-colorbool",
|
|
34
|
+
"list"
|
|
35
|
+
]);
|
|
36
|
+
function C(e, t) {
|
|
37
|
+
for (const { name: o } of w(e, "task")) {
|
|
38
|
+
if (x.has(o)) return f(!0, t);
|
|
39
|
+
if (S.has(o)) return f(!1, t);
|
|
40
|
+
}
|
|
41
|
+
const n = t.at(0)?.toLowerCase();
|
|
42
|
+
return n === void 0 ? null : k.has(n) ? f(!0, t.slice(1)) : y.has(n) ? f(!1, t.slice(1)) : t.length === 1 ? f(!1, t) : f(!0, t);
|
|
43
|
+
}
|
|
44
|
+
function f(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 N(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 P(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 U(e) {
|
|
71
|
+
for (const { name: t } of w(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 A({ name: e }) {
|
|
82
|
+
if (e === "-c" || e === "--config") return "inline";
|
|
83
|
+
if (e === "--config-env") return "env";
|
|
84
|
+
}
|
|
85
|
+
function* F(e) {
|
|
86
|
+
for (const t of e) {
|
|
87
|
+
const n = A(t), o = n && P(t.value);
|
|
88
|
+
o && (yield {
|
|
89
|
+
...o,
|
|
90
|
+
scope: n
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function M(e, t, n) {
|
|
95
|
+
const o = {
|
|
96
|
+
read: [],
|
|
97
|
+
write: [...F(t)]
|
|
98
|
+
};
|
|
99
|
+
return e === "config" && G(o, U(t), C(t, n)), o;
|
|
100
|
+
}
|
|
101
|
+
function G(e, t, n) {
|
|
102
|
+
if (n === null) return;
|
|
103
|
+
const o = N(t, n);
|
|
104
|
+
n.isWrite ? e.write.push(o) : e.read.push(o);
|
|
105
|
+
}
|
|
106
|
+
const v = { short: /* @__PURE__ */ new Map([["c", !0]]) }, O = {
|
|
107
|
+
short: new Map([
|
|
108
|
+
["C", !0],
|
|
109
|
+
["P", !1],
|
|
110
|
+
["h", !1],
|
|
111
|
+
["p", !1],
|
|
112
|
+
["v", !1],
|
|
113
|
+
...v.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
|
+
}, E = {
|
|
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
|
+
])
|
|
145
|
+
},
|
|
146
|
+
commit: {
|
|
147
|
+
short: /* @__PURE__ */ new Map([
|
|
148
|
+
["C", !0],
|
|
149
|
+
["F", !0],
|
|
150
|
+
["c", !0],
|
|
151
|
+
["m", !0],
|
|
152
|
+
["t", !0]
|
|
153
|
+
]),
|
|
154
|
+
long: /* @__PURE__ */ new Set([
|
|
155
|
+
"file",
|
|
156
|
+
"message",
|
|
157
|
+
"reedit-message",
|
|
158
|
+
"reuse-message",
|
|
159
|
+
"template"
|
|
160
|
+
])
|
|
161
|
+
},
|
|
162
|
+
config: {
|
|
163
|
+
short: /* @__PURE__ */ new Map([
|
|
164
|
+
["e", !1],
|
|
165
|
+
["f", !0],
|
|
166
|
+
["l", !1]
|
|
167
|
+
]),
|
|
168
|
+
long: /* @__PURE__ */ new Set([
|
|
169
|
+
"blob",
|
|
170
|
+
"comment",
|
|
171
|
+
"default",
|
|
172
|
+
"file",
|
|
173
|
+
"type",
|
|
174
|
+
"value"
|
|
175
|
+
])
|
|
176
|
+
},
|
|
177
|
+
fetch: {
|
|
178
|
+
short: /* @__PURE__ */ new Map(),
|
|
179
|
+
long: /* @__PURE__ */ new Set(["upload-pack"])
|
|
180
|
+
},
|
|
181
|
+
pull: {
|
|
182
|
+
short: /* @__PURE__ */ new Map(),
|
|
183
|
+
long: /* @__PURE__ */ new Set(["upload-pack"])
|
|
184
|
+
},
|
|
185
|
+
push: {
|
|
186
|
+
short: /* @__PURE__ */ new Map(),
|
|
187
|
+
long: /* @__PURE__ */ new Set(["exec", "receive-pack"])
|
|
188
|
+
}
|
|
189
|
+
}, I = {
|
|
190
|
+
short: /* @__PURE__ */ new Map(),
|
|
191
|
+
long: /* @__PURE__ */ new Set()
|
|
192
|
+
};
|
|
193
|
+
function L(e) {
|
|
194
|
+
const t = E[e ?? ""] ?? I;
|
|
195
|
+
return {
|
|
196
|
+
short: new Map([...v.short.entries(), ...t.short.entries()]),
|
|
197
|
+
long: t.long
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function b(e, t = O) {
|
|
201
|
+
if (e.startsWith("--")) {
|
|
202
|
+
const n = e.indexOf("=");
|
|
203
|
+
if (n > 2) return [{
|
|
204
|
+
name: e.slice(0, n),
|
|
205
|
+
value: e.slice(n + 1),
|
|
206
|
+
needsNext: !1
|
|
207
|
+
}];
|
|
208
|
+
const o = e.slice(2);
|
|
209
|
+
return [{
|
|
210
|
+
name: e,
|
|
211
|
+
needsNext: t.long.has(o)
|
|
212
|
+
}];
|
|
213
|
+
}
|
|
214
|
+
if (e.length === 2) {
|
|
215
|
+
const n = e.charAt(1);
|
|
216
|
+
return [{
|
|
217
|
+
name: e,
|
|
218
|
+
needsNext: t.short.get(n) === !0
|
|
219
|
+
}];
|
|
220
|
+
}
|
|
221
|
+
return R(e, t.short);
|
|
222
|
+
}
|
|
223
|
+
function R(e, t) {
|
|
224
|
+
const n = e.slice(1).split(""), o = [];
|
|
225
|
+
for (let a = 0; a < n.length; a++) {
|
|
226
|
+
const s = n[a], r = t.get(s);
|
|
227
|
+
if (r === void 0) return [{
|
|
228
|
+
name: e,
|
|
229
|
+
needsNext: !1
|
|
230
|
+
}];
|
|
231
|
+
if (r) {
|
|
232
|
+
const l = n.slice(a + 1).join("");
|
|
233
|
+
if (l && ![...l].every((h) => t.has(h))) return o.push({
|
|
234
|
+
name: `-${s}`,
|
|
235
|
+
value: l,
|
|
236
|
+
needsNext: !1
|
|
237
|
+
}), o;
|
|
238
|
+
}
|
|
239
|
+
o.push({
|
|
240
|
+
name: `-${s}`,
|
|
241
|
+
needsNext: r
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
return o;
|
|
245
|
+
}
|
|
246
|
+
function W(e, t = []) {
|
|
247
|
+
let n = 0;
|
|
248
|
+
for (; n < e.length;) {
|
|
249
|
+
const o = String(e[n]);
|
|
250
|
+
if (!o.startsWith("-") || o.length < 2) break;
|
|
251
|
+
const a = b(o);
|
|
252
|
+
let s = n + 1;
|
|
253
|
+
for (const r of a) {
|
|
254
|
+
const l = {
|
|
255
|
+
name: r.name,
|
|
256
|
+
value: r.value,
|
|
257
|
+
absorbedNext: !1,
|
|
258
|
+
isGlobal: !0
|
|
259
|
+
};
|
|
260
|
+
r.needsNext && l.value === void 0 && s < e.length && (l.value = String(e[s]), l.absorbedNext = !0, s++), t.push(l);
|
|
261
|
+
}
|
|
262
|
+
n = s;
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
flags: t,
|
|
266
|
+
taskIndex: n
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function _(e, t, n = []) {
|
|
270
|
+
const o$1 = L(t), a = [], s = [];
|
|
271
|
+
let r$1 = 0;
|
|
272
|
+
for (; r$1 < e.length;) {
|
|
273
|
+
const l = e[r$1];
|
|
274
|
+
if (r(l)) {
|
|
275
|
+
s.push(...o(l)), r$1++;
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
const u = String(l);
|
|
279
|
+
if (u === "--") {
|
|
280
|
+
for (let c = r$1 + 1; c < e.length; c++) {
|
|
281
|
+
const i = e[c];
|
|
282
|
+
r(i) ? s.push(...o(i)) : s.push(String(i));
|
|
283
|
+
}
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
if (!u.startsWith("-") || u.length < 2) {
|
|
287
|
+
a.push(u), r$1++;
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
const h = b(u, o$1);
|
|
291
|
+
let d = r$1 + 1;
|
|
292
|
+
for (const c of h) {
|
|
293
|
+
const i = {
|
|
294
|
+
name: c.name,
|
|
295
|
+
value: c.value,
|
|
296
|
+
absorbedNext: !1,
|
|
297
|
+
isGlobal: !1
|
|
298
|
+
};
|
|
299
|
+
c.needsNext && i.value === void 0 && d < e.length && !r(e[d]) && (i.value = String(e[d]), i.absorbedNext = !0, d++), n.push(i);
|
|
300
|
+
}
|
|
301
|
+
r$1 = d;
|
|
302
|
+
}
|
|
303
|
+
return {
|
|
304
|
+
flags: n,
|
|
305
|
+
positionals: a,
|
|
306
|
+
pathspecs: s
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function* T({ write: e }) {
|
|
310
|
+
for (const t of e) for (const n of $) {
|
|
311
|
+
const o = n(t.key);
|
|
312
|
+
o && (yield o);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function g(e, t, n = String(e)) {
|
|
316
|
+
const o = typeof e == "string" ? new RegExp(`\\s*${e}`, "i") : e;
|
|
317
|
+
return function(s) {
|
|
318
|
+
if (o.test(s)) return {
|
|
319
|
+
category: t,
|
|
320
|
+
message: `Configuring ${n} is not permitted without enabling ${t}`
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
const $ = [
|
|
325
|
+
g(/^\s*protocol(.[a-z]+)?.allow/i, "allowUnsafeProtocolOverride", "protocol.allow"),
|
|
326
|
+
g("core.sshCommand", "allowUnsafeSshCommand"),
|
|
327
|
+
g("core.fsmonitor", "allowUnsafeFsMonitor"),
|
|
328
|
+
g("core.gitProxy", "allowUnsafeGitProxy"),
|
|
329
|
+
g("core.hooksPath", "allowUnsafeHooksPath"),
|
|
330
|
+
g("diff.external", "allowUnsafeDiffExternal")
|
|
331
|
+
];
|
|
332
|
+
function* j(e, t) {
|
|
333
|
+
for (const n of t) /^--(upload|receive)-pack/.test(n.name) && (yield {
|
|
334
|
+
category: "allowUnsafePack",
|
|
335
|
+
message: "Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack"
|
|
336
|
+
}), e === "clone" && (/^-\w*u/.test(n.name) || n.name === "--u") && (yield {
|
|
337
|
+
category: "allowUnsafePack",
|
|
338
|
+
message: "Use of clone with option -u is not permitted without enabling allowUnsafePack"
|
|
339
|
+
}), e === "push" && /^--exec/.test(n.name) && (yield {
|
|
340
|
+
category: "allowUnsafePack",
|
|
341
|
+
message: "Use of push with option --exec is not permitted without enabling allowUnsafePack"
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
function B(e, t, n) {
|
|
345
|
+
const o = [...j(e, t), ...T(n)];
|
|
346
|
+
return {
|
|
347
|
+
categories: o.reduce((s, r) => s.add(r.category), /* @__PURE__ */ new Set()),
|
|
348
|
+
vulnerabilities: o
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function V(...e) {
|
|
352
|
+
const { flags: t, taskIndex: n } = W(e), o = n < e.length ? String(e[n]).toLowerCase() : null, { positionals: s, pathspecs: r } = _(o !== null ? e.slice(n + 1) : [], o, t), l = M(o, t, s);
|
|
353
|
+
return {
|
|
354
|
+
task: o,
|
|
355
|
+
flags: t.map(D),
|
|
356
|
+
paths: r,
|
|
357
|
+
config: l,
|
|
358
|
+
vulnerabilities: B(o, t, l)
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function D({ value: e, name: t }) {
|
|
362
|
+
return e !== void 0 ? {
|
|
363
|
+
name: t,
|
|
364
|
+
value: e
|
|
365
|
+
} : { name: t };
|
|
366
|
+
}
|
|
367
|
+
export { V as t };
|