@vltpkg/cli-js 1.4.0 → 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.
Files changed (98) hide show
  1. package/{access-422UGEWN.js → access-QPX4QXV4.js} +13 -12
  2. package/{bugs-RED7Y33Q.js → bugs-TLOECXEM.js} +28 -25
  3. package/{build-IHMPBWRO.js → build-IQOS3LKO.js} +28 -19
  4. package/{cache-FJP2RZJX.js → cache-O5IBYYSB.js} +17 -17
  5. package/cache-unzip-src-unzip.js +35 -11
  6. package/{chunk-OVPHE4O7.js → chunk-2U4PVHP4.js} +5232 -10882
  7. package/{chunk-OAJ3PO3Z.js → chunk-35EG6T3J.js} +7 -7
  8. package/{chunk-GIIAODRI.js → chunk-3S3W7QEM.js} +7 -5
  9. package/{chunk-UGCKF5ZE.js → chunk-43EJ4Q42.js} +1 -1
  10. package/{chunk-5Y4SYLJ2.js → chunk-4TSHLSRK.js} +1 -1
  11. package/chunk-4UH3KMTD.js +6444 -0
  12. package/{chunk-SR2VOY5J.js → chunk-5KW6AOTT.js} +1 -1
  13. package/{chunk-FLH4YC6W.js → chunk-6LZM3I4Q.js} +35 -11
  14. package/{chunk-X4FVR4R5.js → chunk-6W5XMVIZ.js} +12 -10
  15. package/{chunk-TPRK6IDA.js → chunk-7UWRR6EE.js} +2 -2
  16. package/{chunk-ASLX43R3.js → chunk-ARE7FKDG.js} +6 -4
  17. package/chunk-B6RIGNEO.js +626 -0
  18. package/{chunk-I7UMHYZX.js → chunk-C6ZVVEFV.js} +111 -1186
  19. package/{chunk-WF6KLKRN.js → chunk-CMLDLZZ3.js} +47 -1
  20. package/{chunk-ISE4IRHF.js → chunk-CS6AYPY5.js} +6 -6
  21. package/{chunk-LHPEBLOU.js → chunk-CW56EJIL.js} +1 -1
  22. package/{chunk-PLG3OYCX.js → chunk-F7NPYSI2.js} +3 -2
  23. package/{chunk-ZJMJ7MCT.js → chunk-G3FZ2ZJK.js} +1 -1
  24. package/chunk-GUP55DM6.js +59 -0
  25. package/chunk-HOF7LEIC.js +24 -0
  26. package/chunk-IFEZ6BFV.js +1111 -0
  27. package/{chunk-7T3XAYP4.js → chunk-IJUVVD7E.js} +1 -1
  28. package/{chunk-DNRR3XMG.js → chunk-ISAMD2FE.js} +1 -1
  29. package/{chunk-PHJJPY5G.js → chunk-LH7J5BDU.js} +5 -5
  30. package/{chunk-5IJTPZXP.js → chunk-LUVDMEW4.js} +1 -1
  31. package/{chunk-C23TDXRG.js → chunk-MYX4JCIJ.js} +1 -1
  32. package/{chunk-APMYKJI2.js → chunk-QNHBAGXQ.js} +1 -1
  33. package/{chunk-5TNXLRW2.js → chunk-SMXXFQPI.js} +50 -12
  34. package/chunk-SUU2WETN.js +268 -0
  35. package/chunk-T2VBCUF5.js +77 -0
  36. package/{chunk-MKWPTN3C.js → chunk-T5EP7QEF.js} +2 -2
  37. package/{chunk-THSYN5EK.js → chunk-UZ6ICZE3.js} +1 -1
  38. package/{chunk-TO23PR7J.js → chunk-VR7NRWAD.js} +14 -12
  39. package/chunk-W4T5CGCO.js +52 -0
  40. package/{chunk-FZUYGJZU.js → chunk-WHWPAYZY.js} +117 -19
  41. package/{chunk-QCSUWACA.js → chunk-X6JKMIOU.js} +5 -1
  42. package/{chunk-5RHABCYI.js → chunk-XCQCYB6G.js} +8 -8
  43. package/{chunk-2AMOC4DN.js → chunk-XCSNI6AO.js} +4 -4
  44. package/{chunk-4UCADW6S.js → chunk-XD5KUDXX.js} +7 -7
  45. package/{chunk-HZXJ423P.js → chunk-Z5D5KODU.js} +1 -1
  46. package/{ci-YSKNNO5M.js → ci-ESVUMOZO.js} +31 -13
  47. package/cli-package.json +1 -1
  48. package/{config-CSPCDMR3.js → config-TMB2X6DW.js} +11 -9
  49. package/{config-HO7GY3QT.js → config-ZVVLFKR7.js} +15 -13
  50. package/{create-2TJT3AHJ.js → create-BLTNKSBQ.js} +28 -26
  51. package/{deprecate-7FRJI2RL.js → deprecate-VA6PGHYL.js} +17 -15
  52. package/{dist-tag-WCFF5OEG.js → dist-tag-OYJREFO2.js} +13 -12
  53. package/{docs-JMBPTU23.js → docs-6OC3OQNM.js} +28 -25
  54. package/{exec-FBOUKZZ2.js → exec-AZPGFVRY.js} +28 -26
  55. package/{exec-cache-X3ZWM5S3.js → exec-cache-D75UY2WI.js} +24 -22
  56. package/{exec-local-Y3KQC22N.js → exec-local-E2JKB4X4.js} +22 -20
  57. package/{help-PUKVH5X7.js → help-UPW77X5N.js} +5 -5
  58. package/{init-GOKAQXXZ.js → init-SNO6QL7C.js} +14 -11
  59. package/{install-XFN4UFOC.js → install-TEJM2YVX.js} +67 -28
  60. package/{list-43JFFG5D.js → list-NHCC2RNB.js} +33 -27
  61. package/{login-RSTZKNKN.js → login-XNZXCGFD.js} +18 -16
  62. package/{logout-4576FFXZ.js → logout-YCM7O36Q.js} +13 -12
  63. package/{outdated-ACQ5A2Y7.js → outdated-4LA7N63W.js} +26 -22
  64. package/{pack-QQVJ3G25.js → pack-RC4CZSWF.js} +22 -18
  65. package/package.json +1 -1
  66. package/{ping-QCDQQRO5.js → ping-RLVAZGDL.js} +13 -12
  67. package/{pkg-CSOJV7UC.js → pkg-FED5C6TP.js} +18 -14
  68. package/{profile-VL4HPW3N.js → profile-DJZNLQPG.js} +13 -12
  69. package/{publish-2YBO6ZXE.js → publish-54AMVMTQ.js} +56 -45
  70. package/{query-IHHFMJRT.js → query-ZQLMSJ7O.js} +35 -29
  71. package/{registry-W7BRZZZ2.js → registry-6HKQYSZX.js} +7 -7
  72. package/registry-client-src-revalidate.js +36 -12
  73. package/{repo-L3BXAAWS.js → repo-ITA4BLZ4.js} +28 -25
  74. package/{reporter-5NYOHBO7.js → reporter-UYVR2WMB.js} +72 -14
  75. package/{run-AMUUVLTI.js → run-TP2HTJRN.js} +22 -20
  76. package/{run-exec-5W3XWQZA.js → run-exec-UGCC53DV.js} +22 -20
  77. package/security-archive-src-update-expired.js +43 -17
  78. package/{setup-TFM4GJF7.js → setup-XPAM5U3Z.js} +22 -21
  79. package/skills-LR6GXW3X.js +413 -0
  80. package/skills-YD2TB2VD.js +495 -0
  81. package/{src-4CYCUWZL.js → src-34D4DOOH.js} +23 -18
  82. package/{src-I3GMULFP.js → src-H6DFCAPH.js} +9 -8
  83. package/{src-LUTN2ODD.js → src-LHDC4NJO.js} +2 -2
  84. package/{token-OANOBE3G.js → token-OF63PFTQ.js} +13 -12
  85. package/{uninstall-YXTQ4AIZ.js → uninstall-B54FQ5KQ.js} +20 -15
  86. package/{unpublish-SZXYMYIU.js → unpublish-CSHIGMDQ.js} +31 -16
  87. package/{update-FHLMWGIM.js → update-HS4VJ5ZG.js} +50 -25
  88. package/{version-ZWFCTU5V.js → version-L7S3DHUS.js} +19 -14
  89. package/{view-NFNJXMLV.js → view-NWKKWFVA.js} +17 -15
  90. package/vlr.js +1 -1
  91. package/vlrx.js +1 -1
  92. package/vlt.js +1 -1
  93. package/vlx.js +1 -1
  94. package/vlxl.js +1 -1
  95. package/{whoami-O7GOSGCI.js → whoami-65K35VGW.js} +13 -12
  96. package/chunk-G2YT2GWF.js +0 -120
  97. package/chunk-T6FBP4OU.js +0 -76
  98. package/chunk-U7TEQCBN.js +0 -880
@@ -11,38 +11,39 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  stdout
14
- } from "./chunk-FZUYGJZU.js";
15
- import "./chunk-QCSUWACA.js";
16
- import "./chunk-G2YT2GWF.js";
17
- import "./chunk-5Y4SYLJ2.js";
14
+ } from "./chunk-WHWPAYZY.js";
15
+ import "./chunk-X6JKMIOU.js";
16
+ import "./chunk-4TSHLSRK.js";
17
+ import {
18
+ commandUsage
19
+ } from "./chunk-CW56EJIL.js";
18
20
  import {
19
21
  configWriteTarget,
20
22
  registrySelectionFields
21
- } from "./chunk-5RHABCYI.js";
22
- import "./chunk-TO23PR7J.js";
23
+ } from "./chunk-XCQCYB6G.js";
24
+ import "./chunk-VR7NRWAD.js";
23
25
  import "./chunk-SRWDPPLX.js";
26
+ import "./chunk-IFEZ6BFV.js";
27
+ import "./chunk-C6ZVVEFV.js";
28
+ import "./chunk-4KCU2KZL.js";
24
29
  import "./chunk-WGDTG44V.js";
25
30
  import {
26
31
  normalizeRegistryURL
27
- } from "./chunk-THSYN5EK.js";
28
- import {
29
- commandUsage
30
- } from "./chunk-LHPEBLOU.js";
31
- import "./chunk-I7UMHYZX.js";
32
- import "./chunk-4KCU2KZL.js";
33
- import "./chunk-PLG3OYCX.js";
34
- import "./chunk-5IJTPZXP.js";
35
- import "./chunk-WF6KLKRN.js";
32
+ } from "./chunk-UZ6ICZE3.js";
33
+ import "./chunk-CMLDLZZ3.js";
34
+ import "./chunk-F7NPYSI2.js";
35
+ import "./chunk-LUVDMEW4.js";
36
36
  import "./chunk-HTOTG4TS.js";
37
37
  import {
38
38
  RegistryClient,
39
39
  getKC,
40
40
  normalizeRegistryKey
41
- } from "./chunk-OAJ3PO3Z.js";
42
- import "./chunk-APMYKJI2.js";
43
- import "./chunk-SR2VOY5J.js";
44
- import "./chunk-ZJMJ7MCT.js";
45
- import "./chunk-U7TEQCBN.js";
41
+ } from "./chunk-35EG6T3J.js";
42
+ import "./chunk-QNHBAGXQ.js";
43
+ import "./chunk-G3FZ2ZJK.js";
44
+ import "./chunk-5KW6AOTT.js";
45
+ import "./chunk-SUU2WETN.js";
46
+ import "./chunk-B6RIGNEO.js";
46
47
  import "./chunk-XNLSTHDK.js";
47
48
  import "./chunk-6IF3RJND.js";
48
49
  import "./chunk-PDWPFR5T.js";
@@ -52,7 +53,7 @@ import {
52
53
  defaultRegistries,
53
54
  isErrorWithCause,
54
55
  isObject
55
- } from "./chunk-FLH4YC6W.js";
56
+ } from "./chunk-6LZM3I4Q.js";
56
57
  import {
57
58
  error
58
59
  } from "./chunk-WZWDS3W4.js";
@@ -0,0 +1,413 @@
1
+ var global = globalThis;
2
+ import {Buffer} from "node:buffer";
3
+ import {setTimeout as _vlt_setTimeout,clearTimeout as _vlt_clearTimeout,setImmediate as _vlt_setImmediate,clearImmediate as _vlt_clearImmediate,setInterval as _vlt_setInterval,clearInterval as _vlt_clearInterval} from "node:timers";
4
+ globalThis.setTimeout = _vlt_setTimeout;
5
+ globalThis.clearTimeout = _vlt_clearTimeout;
6
+ globalThis.setImmediate = _vlt_setImmediate;
7
+ globalThis.clearImmediate = _vlt_clearImmediate;
8
+ globalThis.setInterval = _vlt_setInterval;
9
+ globalThis.clearInterval = _vlt_clearInterval;
10
+ import {createRequire as _vlt_createRequire} from "node:module";
11
+ var require = _vlt_createRequire(import.meta.filename);
12
+ import {
13
+ mermaidOutput
14
+ } from "./chunk-4UH3KMTD.js";
15
+ import {
16
+ assertQuery,
17
+ linkSkills,
18
+ listSkills
19
+ } from "./chunk-2U4PVHP4.js";
20
+ import "./chunk-SMXXFQPI.js";
21
+ import {
22
+ styleTextStdout
23
+ } from "./chunk-WHWPAYZY.js";
24
+ import "./chunk-X6JKMIOU.js";
25
+ import "./chunk-4TSHLSRK.js";
26
+ import {
27
+ commandUsage
28
+ } from "./chunk-CW56EJIL.js";
29
+ import {
30
+ configLabel,
31
+ savedLine,
32
+ storedAllowSkills,
33
+ unmatchedLines,
34
+ unscannedLines
35
+ } from "./chunk-W4T5CGCO.js";
36
+ import {
37
+ configWriteTarget
38
+ } from "./chunk-XCQCYB6G.js";
39
+ import "./chunk-VR7NRWAD.js";
40
+ import "./chunk-SRWDPPLX.js";
41
+ import "./chunk-IFEZ6BFV.js";
42
+ import "./chunk-C6ZVVEFV.js";
43
+ import "./chunk-4KCU2KZL.js";
44
+ import "./chunk-WGDTG44V.js";
45
+ import "./chunk-UZ6ICZE3.js";
46
+ import "./chunk-CMLDLZZ3.js";
47
+ import "./chunk-F7NPYSI2.js";
48
+ import "./chunk-LUVDMEW4.js";
49
+ import "./chunk-HTOTG4TS.js";
50
+ import "./chunk-G3FZ2ZJK.js";
51
+ import "./chunk-5KW6AOTT.js";
52
+ import "./chunk-SUU2WETN.js";
53
+ import "./chunk-B6RIGNEO.js";
54
+ import "./chunk-XNLSTHDK.js";
55
+ import "./chunk-6IF3RJND.js";
56
+ import "./chunk-PDWPFR5T.js";
57
+ import "./chunk-Y5PA7DVK.js";
58
+ import {
59
+ asError
60
+ } from "./chunk-6LZM3I4Q.js";
61
+ import {
62
+ error
63
+ } from "./chunk-WZWDS3W4.js";
64
+ import "./chunk-PZLD7RTK.js";
65
+
66
+ // ../../src/cli-sdk/src/commands/skills.ts
67
+ import { styleText } from "node:util";
68
+
69
+ // ../../src/cli-sdk/src/skills-prompt.ts
70
+ import { createInterface } from "node:readline/promises";
71
+ var interactive = () => process.stdin.isTTY;
72
+ var open = (s) => {
73
+ const rl = createInterface({
74
+ input: s.input ?? process.stdin,
75
+ output: s.output ?? process.stdout,
76
+ // prefill and line editing
77
+ terminal: true
78
+ });
79
+ rl.on("SIGINT", () => rl.close());
80
+ let done = false;
81
+ const closed = new Promise(
82
+ (r) => rl.once("close", () => {
83
+ done = true;
84
+ r(void 0);
85
+ })
86
+ );
87
+ const ask = async (query, prefill) => {
88
+ if (done) return void 0;
89
+ const q = rl.question(query).catch(() => void 0);
90
+ if (prefill) rl.write(prefill);
91
+ return Promise.race([q, closed]);
92
+ };
93
+ return { rl, ask };
94
+ };
95
+ var confirm = async (question, s = {}) => {
96
+ const { rl, ask } = open(s);
97
+ try {
98
+ const a = await ask(question);
99
+ return a === void 0 ? void 0 : /^y(es)?$/i.test(a.trim());
100
+ } finally {
101
+ rl.close();
102
+ }
103
+ };
104
+ var editQuery = async ({
105
+ current,
106
+ prefill,
107
+ check,
108
+ ...s
109
+ }) => {
110
+ const output = s.output ?? process.stdout;
111
+ if (current !== void 0) {
112
+ output.write(
113
+ "\n\u26A0\uFE0F The new allow-skills replaces the current one. Make sure it still\nselects every skill you want: skills it no longer selects are unlinked.\n\n" + styleTextStdout(
114
+ "yellow",
115
+ `Current allow-skills: ${current}`
116
+ ) + "\n"
117
+ );
118
+ }
119
+ const prompt = styleTextStdout("cyan", "New allow-skills: ");
120
+ const { rl, ask } = open(s);
121
+ try {
122
+ let fill = prefill;
123
+ for (; ; ) {
124
+ const a = (await ask(prompt, fill))?.trim();
125
+ if (!a) return void 0;
126
+ try {
127
+ await check(a);
128
+ return a;
129
+ } catch (e) {
130
+ output.write(`${asError(e).message}
131
+ `);
132
+ fill = a;
133
+ }
134
+ }
135
+ } finally {
136
+ rl.close();
137
+ }
138
+ };
139
+
140
+ // ../../src/cli-sdk/src/commands/skills.ts
141
+ var needsRegistry = true;
142
+ var usage = () => commandUsage({
143
+ command: "skills",
144
+ usage: ["", "list [<query>]", "link [<query>]"],
145
+ description: `Manage the agent skills shipped by installed packages.
146
+
147
+ A skill is a folder with a \`SKILL.md\` file
148
+ (https://agentskills.io/specification). Packages ship them as a
149
+ root \`SKILL.md\`, or at \`<name>/SKILL.md\` in \`skills/\`,
150
+ \`dist/skills/\` or \`.agents/skills/\`: the first skill of a name
151
+ wins.
152
+
153
+ Skills are linked into the project's agent skill dirs:
154
+ \`.agents/skills\`, plus \`<folder>/skills\` for each agent folder
155
+ at the project root (e.g. \`.claude/\`), or the \`skills-dir\`
156
+ config. When packages ship skills with the same name, one is
157
+ linked and the others are reported. Only links made by vlt
158
+ (pointing into \`node_modules/.vlt\`) are ever replaced or
159
+ removed; anything else in the way is skipped.
160
+
161
+ Use --target or a query after the subcommand to select packages
162
+ using DSS query syntax. End a selector with
163
+ \`:skill(<name>, \u2026)\` to pick single skills, e.g.
164
+ \`#skills:skill(find-skills)\`. Use
165
+ \`vlt install --allow-skills=<query>\` to link skills on install.`,
166
+ subcommands: {
167
+ list: {
168
+ usage: "[<query>]",
169
+ description: `List the skills of installed packages. The default.
170
+ Selects all packages (\`*\`) by default. Applies
171
+ \`:skill()\`: preview a query before \`link\` saves
172
+ it.`
173
+ },
174
+ link: {
175
+ usage: "[<query>]",
176
+ description: `Set, save and apply \`allow-skills\`: link what the
177
+ query selects and remove vlt links to other skills.
178
+ With no query: the stored one, or
179
+ \`:not(:malware)\`. Asks before replacing or editing
180
+ a stored query (-y skips). Saves to the project
181
+ vlt.json, or the user one with --config=user.`
182
+ }
183
+ },
184
+ options: {
185
+ target: {
186
+ value: "<query>",
187
+ description: "Query selector to filter packages using DSS syntax."
188
+ },
189
+ yes: {
190
+ description: "Skip the prompts: replace or keep the stored allow-skills without asking."
191
+ },
192
+ config: {
193
+ value: "user|project",
194
+ description: "vlt.json to save allow-skills to (default: project)."
195
+ },
196
+ view: {
197
+ value: "[human | json | mermaid]",
198
+ description: "Output format. mermaid: list only."
199
+ }
200
+ }
201
+ });
202
+ var plural = (n, s) => `${n} ${s}${n === 1 ? "" : "s"}`;
203
+ var lines = (header, items) => [header, ...items.map((i) => ` ${i}`)].join("\n");
204
+ var notes = (r) => [
205
+ ...r.skipped ? [`\u26A0\uFE0F Skipped ${r.skipped.join(", ")}`] : [],
206
+ ...r.gitignore ? [`\u26A0\uFE0F Could not update ${r.gitignore.join(", ")}`] : [],
207
+ ...unscannedLines(r)
208
+ ];
209
+ var pkgLabel = (s) => {
210
+ const pkg = s.version ? `${s.name}@${s.version}` : s.name;
211
+ return s.alias ? `${s.alias} (${pkg})` : pkg;
212
+ };
213
+ var linkedSuffix = (s, dirs) => dirs.length && dirs.every((d) => s.linked.includes(d)) ? " (linked)" : s.linked.length ? ` (linked in ${s.linked.join(", ")})` : "";
214
+ var row = (s, dirs) => `${s.skill} (${pkgLabel(s)})${linkedSuffix(s, dirs)}`;
215
+ var listNotes = (r) => [
216
+ ...!r.dirs.length && !r.skipped ? ["No agent skill dirs: skills-dir is empty"] : [],
217
+ ...notes(r)
218
+ ];
219
+ var humanList = (r, { colors } = {}) => {
220
+ const style = (format) => (s) => colors ? styleText(format, s, { validateStream: false }) : s;
221
+ const yellow = style("yellow");
222
+ const rows = r.skills.map((s) => {
223
+ const x = row(s, r.dirs);
224
+ return s.linked.length ? yellow(x) : x;
225
+ });
226
+ const last = rows.length - 1;
227
+ return [
228
+ ...rows.length ? [
229
+ style("reset")(
230
+ [
231
+ r.project,
232
+ ...rows.map(
233
+ (x, i) => `${i === last ? "\u2514\u2500\u2500" : "\u251C\u2500\u2500"} ${x}`
234
+ )
235
+ ].join("\n")
236
+ )
237
+ ] : ["No agent skills found in installed packages."],
238
+ ...listNotes(r)
239
+ ].join("\n");
240
+ };
241
+ var mermaidList = (r) => {
242
+ const children = /* @__PURE__ */ new Map();
243
+ for (const s of r.skills) {
244
+ const list = children.get(s.id) ?? [];
245
+ list.push({
246
+ edge: pkgLabel(s),
247
+ label: `${s.skill}${linkedSuffix(s, r.dirs)}`
248
+ });
249
+ children.set(s.id, list);
250
+ }
251
+ const { graph } = r;
252
+ return [
253
+ mermaidOutput({
254
+ edges: [],
255
+ importers: /* @__PURE__ */ new Set([graph.mainImporter]),
256
+ nodes: [...graph.nodes.values()].filter(
257
+ (n) => n === graph.mainImporter || children.has(n.id)
258
+ ),
259
+ children
260
+ }),
261
+ ...listNotes(r).map((n) => `%% ${n}`)
262
+ ].join("\n");
263
+ };
264
+ var jsonSkill = ({
265
+ skill,
266
+ name,
267
+ alias,
268
+ version,
269
+ id,
270
+ description,
271
+ ...rest
272
+ }) => ({
273
+ name: skill,
274
+ description,
275
+ "dependency-name": alias ?? name,
276
+ "package-id": id,
277
+ ...rest
278
+ });
279
+ var count = (rows) => new Set(rows.map((r) => `${r.id}\0${r.skill}`)).size;
280
+ var humanLink = (r) => {
281
+ const out = [];
282
+ if (r.linked.length) {
283
+ out.push(
284
+ lines(
285
+ `\u{1F517} Linked ${plural(count(r.linked), "agent skill")}:`,
286
+ r.linked.map((s) => s.mount)
287
+ )
288
+ );
289
+ } else if (r.unchanged.length) {
290
+ out.push(
291
+ `${plural(count(r.unchanged), "agent skill")} already linked.`
292
+ );
293
+ }
294
+ if (r.removed.length) {
295
+ out.push(
296
+ lines(
297
+ `\u{1F9F9} Removed ${plural(r.removed.length, "skill link")}:`,
298
+ r.removed
299
+ )
300
+ );
301
+ }
302
+ if (r.conflicts.length) {
303
+ out.push(
304
+ lines(
305
+ `\u26A0\uFE0F Skipped ${plural(r.conflicts.length, "skill")}, path in use or taken by another package:`,
306
+ r.conflicts
307
+ )
308
+ );
309
+ }
310
+ out.push(...notes(r));
311
+ return out.join("\n") || "No agent skills found to link.";
312
+ };
313
+ var human = (r, o) => r.action === "list" ? humanList(r, o) : r.action === "unchanged" ? "No changes made." : [
314
+ humanLink(r),
315
+ ...unmatchedLines(r.unmatched),
316
+ ...r.saved ? [savedLine(r.query, r.saved)] : []
317
+ ].join("\n");
318
+ var views = {
319
+ human,
320
+ json: (r) => {
321
+ if (r.action !== "list") return r;
322
+ const { project, graph, ...rest } = r;
323
+ return { ...rest, skills: rest.skills.map(jsonSkill) };
324
+ },
325
+ mermaid: (r) => r.action === "list" ? mermaidList(r) : human(r)
326
+ };
327
+ var defaultQuery = ":not(:malware)";
328
+ var where = (which) => which === "user" ? "in the user vlt.json" : "for this project (vlt.json)";
329
+ var pickQuery = async (conf, given) => {
330
+ const check = (q) => assertQuery(q, "allow-skills", ["skill"]);
331
+ const stored = storedAllowSkills(conf);
332
+ const yes = !!conf.get("yes");
333
+ const tty = interactive();
334
+ if (given) {
335
+ await check(given);
336
+ if (!stored || stored.query === given || yes) return given;
337
+ if (!tty) {
338
+ throw error(
339
+ `allow-skills is already set (${configLabel(stored.which)}): "${stored.query}"; pass -y to replace it`,
340
+ { code: "EUSAGE", found: given, wanted: stored.query }
341
+ );
342
+ }
343
+ if (!await confirm(
344
+ `allow-skills is already set ${where(stored.which)}: "${stored.query}". Replace it? [y/N] `
345
+ )) {
346
+ return void 0;
347
+ }
348
+ return editQuery({ current: stored.query, prefill: given, check });
349
+ }
350
+ if (stored) {
351
+ if (yes || !tty) return stored.query;
352
+ const edit = await confirm(
353
+ `allow-skills is set ${where(stored.which)}: "${stored.query}". Edit it? [y/N] `
354
+ );
355
+ if (edit === void 0) return void 0;
356
+ return edit ? editQuery({
357
+ current: stored.query,
358
+ prefill: stored.query,
359
+ check
360
+ }) : stored.query;
361
+ }
362
+ if (yes || !tty) return defaultQuery;
363
+ return editQuery({ prefill: defaultQuery, check });
364
+ };
365
+ var command = async (conf) => {
366
+ const [sub = "list", query] = conf.positionals;
367
+ const target = conf.get("target") || query;
368
+ const opts = {
369
+ ...conf.options,
370
+ projectRoot: conf.projectRoot,
371
+ skillsDirs: conf.get("skills-dir")
372
+ };
373
+ switch (sub) {
374
+ case "list":
375
+ case "ls":
376
+ return {
377
+ action: "list",
378
+ ...await listSkills({ ...opts, target })
379
+ };
380
+ case "link": {
381
+ const query2 = await pickQuery(conf, target);
382
+ if (query2 === void 0) return { action: "unchanged" };
383
+ const res = await linkSkills({
384
+ ...opts,
385
+ target: query2,
386
+ apply: true
387
+ });
388
+ let saved;
389
+ if (storedAllowSkills(conf)?.query !== query2) {
390
+ saved = configWriteTarget(conf, "project");
391
+ await conf.addConfigToFile(saved, { "allow-skills": query2 });
392
+ }
393
+ return {
394
+ action: "link",
395
+ query: query2,
396
+ ...saved && { saved },
397
+ ...res
398
+ };
399
+ }
400
+ default:
401
+ throw error("Unknown skills subcommand", {
402
+ code: "EUSAGE",
403
+ found: sub,
404
+ validOptions: ["list", "ls", "link"]
405
+ });
406
+ }
407
+ };
408
+ export {
409
+ command,
410
+ needsRegistry,
411
+ usage,
412
+ views
413
+ };