@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.
- package/{access-422UGEWN.js → access-QPX4QXV4.js} +13 -12
- package/{bugs-RED7Y33Q.js → bugs-TLOECXEM.js} +28 -25
- package/{build-IHMPBWRO.js → build-IQOS3LKO.js} +28 -19
- package/{cache-FJP2RZJX.js → cache-O5IBYYSB.js} +17 -17
- package/cache-unzip-src-unzip.js +35 -11
- package/{chunk-OVPHE4O7.js → chunk-2U4PVHP4.js} +5232 -10882
- package/{chunk-OAJ3PO3Z.js → chunk-35EG6T3J.js} +7 -7
- package/{chunk-GIIAODRI.js → chunk-3S3W7QEM.js} +7 -5
- package/{chunk-UGCKF5ZE.js → chunk-43EJ4Q42.js} +1 -1
- package/{chunk-5Y4SYLJ2.js → chunk-4TSHLSRK.js} +1 -1
- package/chunk-4UH3KMTD.js +6444 -0
- package/{chunk-SR2VOY5J.js → chunk-5KW6AOTT.js} +1 -1
- package/{chunk-FLH4YC6W.js → chunk-6LZM3I4Q.js} +35 -11
- package/{chunk-X4FVR4R5.js → chunk-6W5XMVIZ.js} +12 -10
- package/{chunk-TPRK6IDA.js → chunk-7UWRR6EE.js} +2 -2
- package/{chunk-ASLX43R3.js → chunk-ARE7FKDG.js} +6 -4
- package/chunk-B6RIGNEO.js +626 -0
- package/{chunk-I7UMHYZX.js → chunk-C6ZVVEFV.js} +111 -1186
- package/{chunk-WF6KLKRN.js → chunk-CMLDLZZ3.js} +47 -1
- package/{chunk-ISE4IRHF.js → chunk-CS6AYPY5.js} +6 -6
- package/{chunk-LHPEBLOU.js → chunk-CW56EJIL.js} +1 -1
- package/{chunk-PLG3OYCX.js → chunk-F7NPYSI2.js} +3 -2
- package/{chunk-ZJMJ7MCT.js → chunk-G3FZ2ZJK.js} +1 -1
- package/chunk-GUP55DM6.js +59 -0
- package/chunk-HOF7LEIC.js +24 -0
- package/chunk-IFEZ6BFV.js +1111 -0
- package/{chunk-7T3XAYP4.js → chunk-IJUVVD7E.js} +1 -1
- package/{chunk-DNRR3XMG.js → chunk-ISAMD2FE.js} +1 -1
- package/{chunk-PHJJPY5G.js → chunk-LH7J5BDU.js} +5 -5
- package/{chunk-5IJTPZXP.js → chunk-LUVDMEW4.js} +1 -1
- package/{chunk-C23TDXRG.js → chunk-MYX4JCIJ.js} +1 -1
- package/{chunk-APMYKJI2.js → chunk-QNHBAGXQ.js} +1 -1
- package/{chunk-5TNXLRW2.js → chunk-SMXXFQPI.js} +50 -12
- package/chunk-SUU2WETN.js +268 -0
- package/chunk-T2VBCUF5.js +77 -0
- package/{chunk-MKWPTN3C.js → chunk-T5EP7QEF.js} +2 -2
- package/{chunk-THSYN5EK.js → chunk-UZ6ICZE3.js} +1 -1
- package/{chunk-TO23PR7J.js → chunk-VR7NRWAD.js} +14 -12
- package/chunk-W4T5CGCO.js +52 -0
- package/{chunk-FZUYGJZU.js → chunk-WHWPAYZY.js} +117 -19
- package/{chunk-QCSUWACA.js → chunk-X6JKMIOU.js} +5 -1
- package/{chunk-5RHABCYI.js → chunk-XCQCYB6G.js} +8 -8
- package/{chunk-2AMOC4DN.js → chunk-XCSNI6AO.js} +4 -4
- package/{chunk-4UCADW6S.js → chunk-XD5KUDXX.js} +7 -7
- package/{chunk-HZXJ423P.js → chunk-Z5D5KODU.js} +1 -1
- package/{ci-YSKNNO5M.js → ci-ESVUMOZO.js} +31 -13
- package/cli-package.json +1 -1
- package/{config-CSPCDMR3.js → config-TMB2X6DW.js} +11 -9
- package/{config-HO7GY3QT.js → config-ZVVLFKR7.js} +15 -13
- package/{create-2TJT3AHJ.js → create-BLTNKSBQ.js} +28 -26
- package/{deprecate-7FRJI2RL.js → deprecate-VA6PGHYL.js} +17 -15
- package/{dist-tag-WCFF5OEG.js → dist-tag-OYJREFO2.js} +13 -12
- package/{docs-JMBPTU23.js → docs-6OC3OQNM.js} +28 -25
- package/{exec-FBOUKZZ2.js → exec-AZPGFVRY.js} +28 -26
- package/{exec-cache-X3ZWM5S3.js → exec-cache-D75UY2WI.js} +24 -22
- package/{exec-local-Y3KQC22N.js → exec-local-E2JKB4X4.js} +22 -20
- package/{help-PUKVH5X7.js → help-UPW77X5N.js} +5 -5
- package/{init-GOKAQXXZ.js → init-SNO6QL7C.js} +14 -11
- package/{install-XFN4UFOC.js → install-TEJM2YVX.js} +67 -28
- package/{list-43JFFG5D.js → list-NHCC2RNB.js} +33 -27
- package/{login-RSTZKNKN.js → login-XNZXCGFD.js} +18 -16
- package/{logout-4576FFXZ.js → logout-YCM7O36Q.js} +13 -12
- package/{outdated-ACQ5A2Y7.js → outdated-4LA7N63W.js} +26 -22
- package/{pack-QQVJ3G25.js → pack-RC4CZSWF.js} +22 -18
- package/package.json +1 -1
- package/{ping-QCDQQRO5.js → ping-RLVAZGDL.js} +13 -12
- package/{pkg-CSOJV7UC.js → pkg-FED5C6TP.js} +18 -14
- package/{profile-VL4HPW3N.js → profile-DJZNLQPG.js} +13 -12
- package/{publish-2YBO6ZXE.js → publish-54AMVMTQ.js} +56 -45
- package/{query-IHHFMJRT.js → query-ZQLMSJ7O.js} +35 -29
- package/{registry-W7BRZZZ2.js → registry-6HKQYSZX.js} +7 -7
- package/registry-client-src-revalidate.js +36 -12
- package/{repo-L3BXAAWS.js → repo-ITA4BLZ4.js} +28 -25
- package/{reporter-5NYOHBO7.js → reporter-UYVR2WMB.js} +72 -14
- package/{run-AMUUVLTI.js → run-TP2HTJRN.js} +22 -20
- package/{run-exec-5W3XWQZA.js → run-exec-UGCC53DV.js} +22 -20
- package/security-archive-src-update-expired.js +43 -17
- package/{setup-TFM4GJF7.js → setup-XPAM5U3Z.js} +22 -21
- package/skills-LR6GXW3X.js +413 -0
- package/skills-YD2TB2VD.js +495 -0
- package/{src-4CYCUWZL.js → src-34D4DOOH.js} +23 -18
- package/{src-I3GMULFP.js → src-H6DFCAPH.js} +9 -8
- package/{src-LUTN2ODD.js → src-LHDC4NJO.js} +2 -2
- package/{token-OANOBE3G.js → token-OF63PFTQ.js} +13 -12
- package/{uninstall-YXTQ4AIZ.js → uninstall-B54FQ5KQ.js} +20 -15
- package/{unpublish-SZXYMYIU.js → unpublish-CSHIGMDQ.js} +31 -16
- package/{update-FHLMWGIM.js → update-HS4VJ5ZG.js} +50 -25
- package/{version-ZWFCTU5V.js → version-L7S3DHUS.js} +19 -14
- package/{view-NFNJXMLV.js → view-NWKKWFVA.js} +17 -15
- package/vlr.js +1 -1
- package/vlrx.js +1 -1
- package/vlt.js +1 -1
- package/vlx.js +1 -1
- package/vlxl.js +1 -1
- package/{whoami-O7GOSGCI.js → whoami-65K35VGW.js} +13 -12
- package/chunk-G2YT2GWF.js +0 -120
- package/chunk-T6FBP4OU.js +0 -76
- package/chunk-U7TEQCBN.js +0 -880
|
@@ -0,0 +1,495 @@
|
|
|
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
|
+
filterNodesByQueryParts,
|
|
14
|
+
load2 as load,
|
|
15
|
+
lstat,
|
|
16
|
+
mountSkill,
|
|
17
|
+
norm,
|
|
18
|
+
packageKey,
|
|
19
|
+
readMounts,
|
|
20
|
+
realOr,
|
|
21
|
+
samePath,
|
|
22
|
+
skillsDirs,
|
|
23
|
+
unmountSkill,
|
|
24
|
+
unshare
|
|
25
|
+
} from "./chunk-2U4PVHP4.js";
|
|
26
|
+
import "./chunk-SMXXFQPI.js";
|
|
27
|
+
import "./chunk-C6ZVVEFV.js";
|
|
28
|
+
import {
|
|
29
|
+
splitDepID
|
|
30
|
+
} from "./chunk-F7NPYSI2.js";
|
|
31
|
+
import "./chunk-LUVDMEW4.js";
|
|
32
|
+
import "./chunk-HTOTG4TS.js";
|
|
33
|
+
import "./chunk-G3FZ2ZJK.js";
|
|
34
|
+
import "./chunk-B6RIGNEO.js";
|
|
35
|
+
import "./chunk-XNLSTHDK.js";
|
|
36
|
+
import "./chunk-Y5PA7DVK.js";
|
|
37
|
+
import {
|
|
38
|
+
parse
|
|
39
|
+
} from "./chunk-6LZM3I4Q.js";
|
|
40
|
+
import "./chunk-WZWDS3W4.js";
|
|
41
|
+
import "./chunk-PZLD7RTK.js";
|
|
42
|
+
|
|
43
|
+
// ../../src/graph/src/skills/index.ts
|
|
44
|
+
import { existsSync } from "node:fs";
|
|
45
|
+
|
|
46
|
+
// ../../src/graph/src/skills/discover.ts
|
|
47
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
48
|
+
import { resolve } from "node:path";
|
|
49
|
+
var skillDirName = /^[a-z0-9][a-z0-9._-]*$/i;
|
|
50
|
+
var specName = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
51
|
+
var topKey = /^([A-Za-z0-9_-]+):/;
|
|
52
|
+
var blockIndicator = /^[>|][-+1-9]*$/;
|
|
53
|
+
var fold = (inline, more) => {
|
|
54
|
+
let value = [blockIndicator.test(inline) ? "" : inline, ...more].filter(Boolean).join(" ");
|
|
55
|
+
const q = value[0];
|
|
56
|
+
if (value.length > 1 && (q === '"' || q === "'") && value.endsWith(q)) {
|
|
57
|
+
value = value.slice(1, -1).trim();
|
|
58
|
+
}
|
|
59
|
+
return value || void 0;
|
|
60
|
+
};
|
|
61
|
+
var readFrontmatter = (file) => {
|
|
62
|
+
let text;
|
|
63
|
+
try {
|
|
64
|
+
text = readFileSync(file, "utf8");
|
|
65
|
+
} catch {
|
|
66
|
+
return {};
|
|
67
|
+
}
|
|
68
|
+
const lines = text.split(/\r?\n/);
|
|
69
|
+
if (lines[0]?.trim() !== "---") return {};
|
|
70
|
+
const end = lines.findIndex((l, i) => i > 0 && l.trim() === "---");
|
|
71
|
+
if (end === -1) return {};
|
|
72
|
+
const fm = {};
|
|
73
|
+
let key;
|
|
74
|
+
let inline = "";
|
|
75
|
+
let more = [];
|
|
76
|
+
const flush = () => {
|
|
77
|
+
if (key) fm[key] = fold(inline, more);
|
|
78
|
+
key = void 0;
|
|
79
|
+
};
|
|
80
|
+
for (const line of lines.slice(1, end)) {
|
|
81
|
+
if (!line.trim()) continue;
|
|
82
|
+
const m = topKey.exec(line);
|
|
83
|
+
if (m) {
|
|
84
|
+
flush();
|
|
85
|
+
const k = m[1];
|
|
86
|
+
if (k === "name" || k === "description") {
|
|
87
|
+
key = k;
|
|
88
|
+
inline = line.slice(k.length + 1).trim();
|
|
89
|
+
const hash = inline.search(/(?:^|\s)#/);
|
|
90
|
+
if (hash !== -1 && !/^["']/.test(inline)) {
|
|
91
|
+
inline = inline.slice(0, hash).trim();
|
|
92
|
+
}
|
|
93
|
+
more = [];
|
|
94
|
+
}
|
|
95
|
+
} else if (/^\s/.test(line)) {
|
|
96
|
+
if (key) more.push(line.trim());
|
|
97
|
+
} else {
|
|
98
|
+
flush();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
flush();
|
|
102
|
+
return fm;
|
|
103
|
+
};
|
|
104
|
+
var sanitize = (s) => {
|
|
105
|
+
const clean = s?.replace(/\p{Cc}/gu, " ").replace(/\s+/g, " ").trim();
|
|
106
|
+
return clean ? clean.slice(0, 1024) : void 0;
|
|
107
|
+
};
|
|
108
|
+
var lc = (s) => s.toLowerCase();
|
|
109
|
+
var isDir = (path) => !!lstat(path)?.isDirectory();
|
|
110
|
+
var isFile = (path) => !!lstat(path)?.isFile();
|
|
111
|
+
var isSkillMd = (name) => name.toLowerCase() === "skill.md";
|
|
112
|
+
var shipDirs = ["skills", "dist/skills", ".agents/skills"];
|
|
113
|
+
var subdir = (dir, sub) => {
|
|
114
|
+
let path = dir;
|
|
115
|
+
for (const seg of sub.split("/")) {
|
|
116
|
+
path = resolve(path, seg);
|
|
117
|
+
if (!isDir(path)) return void 0;
|
|
118
|
+
}
|
|
119
|
+
return path;
|
|
120
|
+
};
|
|
121
|
+
var scan = (dir, pkgName) => {
|
|
122
|
+
const found = [];
|
|
123
|
+
const has = (skill) => found.some((f) => lc(f.skill) === lc(skill));
|
|
124
|
+
const root = resolve(dir, "SKILL.md");
|
|
125
|
+
if (isFile(root)) {
|
|
126
|
+
const { name, description } = readFrontmatter(root);
|
|
127
|
+
const skill = name && name.length <= 64 && specName.test(name) ? name : pkgName.slice(pkgName.lastIndexOf("/") + 1);
|
|
128
|
+
if (skillDirName.test(skill) && !isSkillMd(skill)) {
|
|
129
|
+
found.push({ skill, path: dir, name, description });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
for (const sub of shipDirs) {
|
|
133
|
+
const skillsDir = subdir(dir, sub);
|
|
134
|
+
if (!skillsDir) continue;
|
|
135
|
+
for (const d of readdirSync(skillsDir).sort()) {
|
|
136
|
+
if (!skillDirName.test(d) || isSkillMd(d) || has(d)) continue;
|
|
137
|
+
const path = resolve(skillsDir, d);
|
|
138
|
+
const file = resolve(path, "SKILL.md");
|
|
139
|
+
if (!isDir(path) || !isFile(file)) continue;
|
|
140
|
+
const { name, description } = readFrontmatter(file);
|
|
141
|
+
found.push({ skill: d, path, name, description });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return found;
|
|
145
|
+
};
|
|
146
|
+
var rank = (node) => {
|
|
147
|
+
let r = 2;
|
|
148
|
+
for (const { from } of node.edgesIn) {
|
|
149
|
+
if (from.mainImporter) return 0;
|
|
150
|
+
if (from.importer) r = 1;
|
|
151
|
+
}
|
|
152
|
+
return r;
|
|
153
|
+
};
|
|
154
|
+
var ver = (node) => node.version ? parse(node.version) : void 0;
|
|
155
|
+
var byVersion = (a, b) => {
|
|
156
|
+
const va = ver(a);
|
|
157
|
+
const vb = ver(b);
|
|
158
|
+
return va && vb ? vb.compare(va) : 0;
|
|
159
|
+
};
|
|
160
|
+
var compare = (a, b) => rank(a) - rank(b) || byVersion(a, b) || a.id.localeCompare(b.id, "en");
|
|
161
|
+
var aliasOf = (node) => {
|
|
162
|
+
const edges = [...node.edgesIn];
|
|
163
|
+
const n = (edges.find((e) => e.from.mainImporter) ?? edges.find((e) => e.from.importer))?.name;
|
|
164
|
+
return n === node.name ? void 0 : n;
|
|
165
|
+
};
|
|
166
|
+
var scannable = (node) => !node.importer && node.inVltStore() && splitDepID(node.id)[0] !== "file";
|
|
167
|
+
var shipsSkills = (node) => scannable(node) && scan(realOr(resolve(node.projectRoot, node.location)), node.name).length > 0;
|
|
168
|
+
var discoverSkills = (nodes, scurry, mounts = []) => {
|
|
169
|
+
const key = (name, path) => `${lc(name)}\0${norm(path)}`;
|
|
170
|
+
const linkedIn = /* @__PURE__ */ new Map();
|
|
171
|
+
for (const m of mounts) {
|
|
172
|
+
const k = key(m.name, realOr(m.target));
|
|
173
|
+
const dirs = linkedIn.get(k) ?? [];
|
|
174
|
+
if (!dirs.includes(m.dir.dir)) dirs.push(m.dir.dir);
|
|
175
|
+
linkedIn.set(k, dirs);
|
|
176
|
+
}
|
|
177
|
+
const scanned = /* @__PURE__ */ new Map();
|
|
178
|
+
const byPkg = /* @__PURE__ */ new Map();
|
|
179
|
+
for (const node of nodes) {
|
|
180
|
+
if (!scannable(node)) continue;
|
|
181
|
+
const found = scan(
|
|
182
|
+
realOr(node.resolvedLocation(scurry)),
|
|
183
|
+
node.name
|
|
184
|
+
);
|
|
185
|
+
scanned.set(
|
|
186
|
+
node.id,
|
|
187
|
+
found.map(({ skill, path }) => ({ skill, path }))
|
|
188
|
+
);
|
|
189
|
+
const key2 = packageKey(node.id);
|
|
190
|
+
const list = byPkg.get(key2) ?? [];
|
|
191
|
+
list.push({ node, found });
|
|
192
|
+
byPkg.set(key2, list);
|
|
193
|
+
}
|
|
194
|
+
const rows = [];
|
|
195
|
+
for (const list of byPkg.values()) {
|
|
196
|
+
const { node, found } = list.reduce(
|
|
197
|
+
(a, b) => compare(a.node, b.node) <= 0 ? a : b
|
|
198
|
+
);
|
|
199
|
+
for (const { skill, path, name, description } of found) {
|
|
200
|
+
const fm = sanitize(name);
|
|
201
|
+
rows.push([
|
|
202
|
+
{
|
|
203
|
+
name: node.name,
|
|
204
|
+
alias: aliasOf(node),
|
|
205
|
+
version: node.version,
|
|
206
|
+
id: node.id,
|
|
207
|
+
skill,
|
|
208
|
+
...fm && lc(fm) !== lc(skill) && { frontmatterName: fm },
|
|
209
|
+
description: sanitize(description),
|
|
210
|
+
path,
|
|
211
|
+
linked: linkedIn.get(key(skill, path)) ?? []
|
|
212
|
+
},
|
|
213
|
+
rank(node)
|
|
214
|
+
]);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const skills = rows.sort(
|
|
218
|
+
([a, ra], [b, rb]) => lc(a.skill).localeCompare(lc(b.skill), "en") || ra - rb || a.id.localeCompare(b.id, "en")
|
|
219
|
+
).map(([s]) => s);
|
|
220
|
+
return { skills, scanned };
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// ../../src/graph/src/skills/gitignore.ts
|
|
224
|
+
import { lstatSync, readFileSync as readFileSync2, writeFileSync } from "node:fs";
|
|
225
|
+
import { join } from "node:path";
|
|
226
|
+
var GITIGNORE_BEGIN = "# >>> vlt agent skills (links into node_modules)";
|
|
227
|
+
var GITIGNORE_END = "# <<< vlt agent skills";
|
|
228
|
+
var sorted = (names) => [...names].sort((a, b) => a.localeCompare(b, "en")).map((n) => `/${n}`);
|
|
229
|
+
var update = (file, { add, remove }) => {
|
|
230
|
+
const st = lstatSync(file, { throwIfNoEntry: false });
|
|
231
|
+
if (st && !st.isFile()) return "refused";
|
|
232
|
+
const text = st ? readFileSync2(file, "utf8") : "";
|
|
233
|
+
const eol = text.includes("\r\n") ? "\r\n" : "\n";
|
|
234
|
+
const lines = text.split(eol);
|
|
235
|
+
const begin = lines.findIndex((l) => l.trim() === GITIGNORE_BEGIN);
|
|
236
|
+
const end = lines.findIndex(
|
|
237
|
+
(l, i) => begin !== -1 && i > begin && l.trim() === GITIGNORE_END
|
|
238
|
+
);
|
|
239
|
+
let out;
|
|
240
|
+
if (end === -1) {
|
|
241
|
+
if (!add.length) return "ok";
|
|
242
|
+
out = (text && !text.endsWith(eol) ? text + eol : text) + [GITIGNORE_BEGIN, ...sorted(add), GITIGNORE_END].join(eol) + eol;
|
|
243
|
+
} else {
|
|
244
|
+
const rm = new Set(sorted(remove));
|
|
245
|
+
const block = lines.slice(begin + 1, end).filter((l) => !rm.has(l.trim()));
|
|
246
|
+
const have = new Set(block.map((l) => l.trim()));
|
|
247
|
+
lines.splice(
|
|
248
|
+
begin + 1,
|
|
249
|
+
end - begin - 1,
|
|
250
|
+
...block,
|
|
251
|
+
...sorted(add).filter((l) => !have.has(l))
|
|
252
|
+
);
|
|
253
|
+
out = lines.join(eol);
|
|
254
|
+
}
|
|
255
|
+
if (out !== text) writeFileSync(file, out);
|
|
256
|
+
return "ok";
|
|
257
|
+
};
|
|
258
|
+
var editGitignore = (dir, edit) => {
|
|
259
|
+
try {
|
|
260
|
+
return update(join(dir, ".gitignore"), edit);
|
|
261
|
+
} catch {
|
|
262
|
+
return "refused";
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// ../../src/graph/src/skills/mask.ts
|
|
267
|
+
var escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
268
|
+
var globRegExp = (pattern) => new RegExp(`^${pattern.split("*").map(escape).join(".*")}$`, "i");
|
|
269
|
+
var matches = (re, s) => re.test(s.skill) || !!s.frontmatterName && re.test(s.frontmatterName);
|
|
270
|
+
var maskSkills = (skills, parts) => {
|
|
271
|
+
const compiled = parts.map((p) => ({
|
|
272
|
+
keys: new Set([...p.ids].map(packageKey)),
|
|
273
|
+
patterns: p.patterns?.map((pattern) => ({
|
|
274
|
+
pattern,
|
|
275
|
+
re: globRegExp(pattern)
|
|
276
|
+
}))
|
|
277
|
+
}));
|
|
278
|
+
const picked = skills.filter(
|
|
279
|
+
(s) => compiled.some(
|
|
280
|
+
(p) => p.keys.has(packageKey(s.id)) && (!p.patterns || p.patterns.some(({ re }) => matches(re, s)))
|
|
281
|
+
)
|
|
282
|
+
);
|
|
283
|
+
const unmatched = [];
|
|
284
|
+
for (const p of compiled) {
|
|
285
|
+
if (!p.patterns) continue;
|
|
286
|
+
const own = skills.filter((s) => p.keys.has(packageKey(s.id)));
|
|
287
|
+
for (const { pattern, re } of p.patterns) {
|
|
288
|
+
if (own.some((s) => matches(re, s))) continue;
|
|
289
|
+
unmatched.push({
|
|
290
|
+
pattern,
|
|
291
|
+
...p.keys.size > 0 && {
|
|
292
|
+
skills: [...new Set(own.map((s) => s.skill))].sort(
|
|
293
|
+
(a, b) => a.localeCompare(b, "en")
|
|
294
|
+
)
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return { skills: picked, unmatched };
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
// ../../src/graph/src/skills/index.ts
|
|
303
|
+
var lc2 = (s) => s.toLowerCase();
|
|
304
|
+
var selectNodes = async (o) => {
|
|
305
|
+
const graph = o.graph ?? load({ ...o, loadManifests: true });
|
|
306
|
+
const { ids, parts, unscanned } = await filterNodesByQueryParts(
|
|
307
|
+
graph,
|
|
308
|
+
o.target ?? "*"
|
|
309
|
+
);
|
|
310
|
+
const nodes = [...graph.nodes.values()].filter((n) => ids.has(n.id));
|
|
311
|
+
return { graph, nodes, parts, unscanned };
|
|
312
|
+
};
|
|
313
|
+
var dirsOf = (o, create = false) => skillsDirs({
|
|
314
|
+
projectRoot: o.projectRoot,
|
|
315
|
+
configured: o.skillsDirs,
|
|
316
|
+
env: o.env,
|
|
317
|
+
create
|
|
318
|
+
});
|
|
319
|
+
var liveOwners = (mounts) => mounts.flatMap(
|
|
320
|
+
(m) => m.owner && existsSync(m.target) ? [m.owner] : []
|
|
321
|
+
);
|
|
322
|
+
var unshareSkills = async (graph, ids, scurry) => {
|
|
323
|
+
for (const id of new Set(ids)) {
|
|
324
|
+
const node = graph.nodes.get(id);
|
|
325
|
+
if (node?.inVltStore())
|
|
326
|
+
await unshare(node.resolvedLocation(scurry));
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
var label = (s) => {
|
|
330
|
+
const pkg = s.version ? `${s.name}@${s.version}` : s.name;
|
|
331
|
+
return s.alias ? `${s.alias} (${pkg})` : pkg;
|
|
332
|
+
};
|
|
333
|
+
var pick = (found, parts, unscanned) => {
|
|
334
|
+
const { skills: masked, unmatched } = maskSkills(found, parts);
|
|
335
|
+
const ok = (s) => !unscanned?.ids.has(s.id);
|
|
336
|
+
const picked = masked.filter(ok);
|
|
337
|
+
const names = new Set(picked.map((s) => lc2(s.skill)));
|
|
338
|
+
const dropped = masked.filter(
|
|
339
|
+
(s) => !ok(s) && !names.has(lc2(s.skill))
|
|
340
|
+
);
|
|
341
|
+
return { skills: found.filter(ok), picked, unmatched, dropped };
|
|
342
|
+
};
|
|
343
|
+
var report = (dropped, unscanned) => unscanned && dropped.length ? {
|
|
344
|
+
unscanned: dropped.map((s) => `${s.skill} (${label(s)})`),
|
|
345
|
+
unscannedReason: unscanned.reason
|
|
346
|
+
} : {};
|
|
347
|
+
var listSkills = async (o) => {
|
|
348
|
+
const { graph, nodes, parts, unscanned } = await selectNodes(o);
|
|
349
|
+
const { targets, scan: scan2, skipped } = dirsOf(o);
|
|
350
|
+
const { skills } = discoverSkills(nodes, o.scurry, readMounts(scan2));
|
|
351
|
+
const { picked, dropped } = pick(skills, parts, unscanned);
|
|
352
|
+
return {
|
|
353
|
+
project: graph.mainImporter.name,
|
|
354
|
+
graph,
|
|
355
|
+
skills: picked,
|
|
356
|
+
dirs: targets.map((d) => d.dir),
|
|
357
|
+
...skipped.length ? { skipped } : null,
|
|
358
|
+
...report(dropped, unscanned)
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
var linkSkills = async (o) => {
|
|
362
|
+
const { graph, nodes, parts, unscanned } = await selectNodes(o);
|
|
363
|
+
const { skills: found, scanned } = discoverSkills(nodes, o.scurry);
|
|
364
|
+
const { skills, picked, unmatched, dropped } = pick(
|
|
365
|
+
found,
|
|
366
|
+
parts,
|
|
367
|
+
unscanned
|
|
368
|
+
);
|
|
369
|
+
const inMask = new Set(picked);
|
|
370
|
+
const { targets, scan: scan2, skipped } = dirsOf(o, picked.length > 0);
|
|
371
|
+
const res = {
|
|
372
|
+
linked: [],
|
|
373
|
+
unchanged: [],
|
|
374
|
+
removed: [],
|
|
375
|
+
conflicts: [],
|
|
376
|
+
dirs: targets.map((d) => d.dir)
|
|
377
|
+
};
|
|
378
|
+
const mounts = readMounts(scan2);
|
|
379
|
+
const byName = new Map(
|
|
380
|
+
mounts.map((m) => [`${m.dir.dir}\0${lc2(m.name)}`, m])
|
|
381
|
+
);
|
|
382
|
+
const stale = (m) => !m.owner || !graph.nodes.has(m.owner) || !existsSync(m.target) || scanned.get(m.owner)?.some(
|
|
383
|
+
(f) => lc2(f.skill) === lc2(m.name) && samePath(f.path, m.target)
|
|
384
|
+
) === false;
|
|
385
|
+
const groups = /* @__PURE__ */ new Map();
|
|
386
|
+
for (const s of skills) {
|
|
387
|
+
const k = lc2(s.skill);
|
|
388
|
+
groups.set(k, [...groups.get(k) ?? [], s]);
|
|
389
|
+
}
|
|
390
|
+
const at = (dir, k, group) => {
|
|
391
|
+
const m = byName.get(`${dir.dir}\0${k}`);
|
|
392
|
+
const key = m?.owner && packageKey(m.owner);
|
|
393
|
+
return { m, own: group.find((s) => packageKey(s.id) === key) };
|
|
394
|
+
};
|
|
395
|
+
const cands = (group) => group.filter((s) => inMask.has(s));
|
|
396
|
+
const first = new Map(
|
|
397
|
+
[...groups].map(([k, group]) => {
|
|
398
|
+
const c = cands(group);
|
|
399
|
+
return [
|
|
400
|
+
k,
|
|
401
|
+
targets.map((d) => at(d, k, c).own).find((s) => !!s) ?? c[0]
|
|
402
|
+
];
|
|
403
|
+
})
|
|
404
|
+
);
|
|
405
|
+
const isTarget = new Set(targets);
|
|
406
|
+
const picks = [];
|
|
407
|
+
for (const dir of scan2) {
|
|
408
|
+
for (const [k, group] of groups) {
|
|
409
|
+
const { m, own } = at(dir, k, group);
|
|
410
|
+
if (isTarget.has(dir)) {
|
|
411
|
+
const winner = o.apply ? first.get(k) : own ?? (m && !stale(m) ? void 0 : first.get(k));
|
|
412
|
+
picks.push({
|
|
413
|
+
dir,
|
|
414
|
+
winner,
|
|
415
|
+
losers: cands(group).filter((s) => s !== winner),
|
|
416
|
+
m
|
|
417
|
+
});
|
|
418
|
+
} else if (own && !o.apply) {
|
|
419
|
+
picks.push({ dir, winner: own, losers: [], m });
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
await unshareSkills(
|
|
424
|
+
graph,
|
|
425
|
+
[
|
|
426
|
+
...picks.flatMap(({ winner }) => winner ? [winner.id] : []),
|
|
427
|
+
...liveOwners(mounts)
|
|
428
|
+
],
|
|
429
|
+
o.scurry
|
|
430
|
+
);
|
|
431
|
+
const gone = [];
|
|
432
|
+
const foreign = [];
|
|
433
|
+
const kept = /* @__PURE__ */ new Set();
|
|
434
|
+
const where = /* @__PURE__ */ new Map();
|
|
435
|
+
for (const { dir, winner, losers, m } of picks) {
|
|
436
|
+
if (winner) {
|
|
437
|
+
if (m && m.name !== winner.skill) {
|
|
438
|
+
unmountSkill(m);
|
|
439
|
+
gone.push(m);
|
|
440
|
+
}
|
|
441
|
+
const mount = `${dir.dir}/${winner.skill}`;
|
|
442
|
+
const r = mountSkill(winner, dir);
|
|
443
|
+
if (r === "conflict") {
|
|
444
|
+
res.conflicts.push(mount);
|
|
445
|
+
foreign.push({ dir, name: winner.skill });
|
|
446
|
+
} else {
|
|
447
|
+
const k = `${winner.id}\0${winner.skill}`;
|
|
448
|
+
const linked = where.get(k) ?? [];
|
|
449
|
+
linked.push(dir.dir);
|
|
450
|
+
where.set(k, linked);
|
|
451
|
+
res[r].push({ ...winner, linked, dir: dir.dir, mount });
|
|
452
|
+
kept.add(mount);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
for (const s of losers)
|
|
456
|
+
res.conflicts.push(`${dir.dir}/${s.skill} (${label(s)})`);
|
|
457
|
+
}
|
|
458
|
+
const after = readMounts(scan2);
|
|
459
|
+
const present = [];
|
|
460
|
+
for (const m of after) {
|
|
461
|
+
if (o.apply ? kept.has(m.mount) : !stale(m)) {
|
|
462
|
+
present.push(m);
|
|
463
|
+
continue;
|
|
464
|
+
}
|
|
465
|
+
unmountSkill(m);
|
|
466
|
+
gone.push(m);
|
|
467
|
+
res.removed.push(m.mount);
|
|
468
|
+
}
|
|
469
|
+
const gitignore = [];
|
|
470
|
+
for (const dir of scan2) {
|
|
471
|
+
const add = present.filter((m) => m.dir === dir).map((m) => m.name);
|
|
472
|
+
const remove = [...gone, ...foreign].filter((m) => m.dir === dir && !add.includes(m.name)).map((m) => m.name);
|
|
473
|
+
if ((add.length || remove.length) && editGitignore(dir.real, { add, remove }) === "refused") {
|
|
474
|
+
gitignore.push(`${dir.dir}/.gitignore`);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
if (skipped.length) res.skipped = skipped;
|
|
478
|
+
if (gitignore.length) res.gitignore = gitignore;
|
|
479
|
+
if (unmatched.length) res.unmatched = unmatched;
|
|
480
|
+
const left = dropped.filter(
|
|
481
|
+
(s) => !targets.every(
|
|
482
|
+
(d) => present.some(
|
|
483
|
+
(m) => m.dir === d && m.owner === s.id && lc2(m.name) === lc2(s.skill)
|
|
484
|
+
)
|
|
485
|
+
)
|
|
486
|
+
);
|
|
487
|
+
return Object.assign(res, report(left, unscanned));
|
|
488
|
+
};
|
|
489
|
+
export {
|
|
490
|
+
discoverSkills,
|
|
491
|
+
linkSkills,
|
|
492
|
+
listSkills,
|
|
493
|
+
readFrontmatter,
|
|
494
|
+
shipsSkills
|
|
495
|
+
};
|
|
@@ -11,44 +11,47 @@ import {createRequire as _vlt_createRequire} from "node:module";
|
|
|
11
11
|
var require = _vlt_createRequire(import.meta.filename);
|
|
12
12
|
import {
|
|
13
13
|
loadCommand
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-T2VBCUF5.js";
|
|
15
15
|
import {
|
|
16
16
|
flushAndExit,
|
|
17
17
|
indent,
|
|
18
18
|
outputCommand,
|
|
19
19
|
stderr,
|
|
20
20
|
stdout
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-WHWPAYZY.js";
|
|
22
22
|
import {
|
|
23
23
|
loadPackageJson
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-G2YT2GWF.js";
|
|
24
|
+
} from "./chunk-X6JKMIOU.js";
|
|
26
25
|
import {
|
|
27
26
|
asRootError,
|
|
28
27
|
findRootError
|
|
29
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-4TSHLSRK.js";
|
|
30
29
|
import {
|
|
31
30
|
Config
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import "./chunk-
|
|
31
|
+
} from "./chunk-XCQCYB6G.js";
|
|
32
|
+
import "./chunk-VR7NRWAD.js";
|
|
34
33
|
import "./chunk-SRWDPPLX.js";
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import
|
|
37
|
-
|
|
34
|
+
import "./chunk-IFEZ6BFV.js";
|
|
35
|
+
import {
|
|
36
|
+
setVltJsonOnly
|
|
37
|
+
} from "./chunk-C6ZVVEFV.js";
|
|
38
38
|
import "./chunk-4KCU2KZL.js";
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-WGDTG44V.js";
|
|
40
|
+
import "./chunk-UZ6ICZE3.js";
|
|
41
41
|
import {
|
|
42
42
|
getSortedCliOptions,
|
|
43
43
|
getSortedKeys
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-CMLDLZZ3.js";
|
|
45
|
+
import "./chunk-F7NPYSI2.js";
|
|
46
|
+
import "./chunk-LUVDMEW4.js";
|
|
45
47
|
import "./chunk-HTOTG4TS.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
48
|
+
import "./chunk-5KW6AOTT.js";
|
|
49
|
+
import "./chunk-SUU2WETN.js";
|
|
50
|
+
import "./chunk-B6RIGNEO.js";
|
|
48
51
|
import "./chunk-XNLSTHDK.js";
|
|
49
52
|
import "./chunk-6IF3RJND.js";
|
|
50
53
|
import "./chunk-Y5PA7DVK.js";
|
|
51
|
-
import "./chunk-
|
|
54
|
+
import "./chunk-6LZM3I4Q.js";
|
|
52
55
|
import "./chunk-WZWDS3W4.js";
|
|
53
56
|
import "./chunk-PZLD7RTK.js";
|
|
54
57
|
|
|
@@ -100,6 +103,7 @@ var run = async () => {
|
|
|
100
103
|
if (vlt.get("version")) {
|
|
101
104
|
return stdout(version);
|
|
102
105
|
}
|
|
106
|
+
setVltJsonOnly(vlt.command === "ci");
|
|
103
107
|
const { monorepo } = vlt.options;
|
|
104
108
|
if (vlt.get("workspace") === void 0) {
|
|
105
109
|
const ws = monorepo?.get(cwd);
|
|
@@ -109,8 +113,9 @@ var run = async () => {
|
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
115
|
if (vlt.command !== "init" && (vlt.get("workspace") || vlt.get("workspace-group")) && ![...monorepo?.values() ?? []].length) {
|
|
116
|
+
const where = vlt.command === "ci" ? "the vlt.json config (vlt ci ignores package.json and pnpm-workspace.yaml)" : 'the vlt.json config, the "workspaces" field of the root package.json, or the "packages" list of pnpm-workspace.yaml';
|
|
112
117
|
stderr(
|
|
113
|
-
`Error: No matching workspaces found. Make sure
|
|
118
|
+
`Error: No matching workspaces found. Make sure ${where} contains the correct workspaces.`
|
|
114
119
|
);
|
|
115
120
|
if (vlt.get("workspace")) {
|
|
116
121
|
stderr(indent(`Workspace: ${format(vlt.get("workspace"))}`));
|
|
@@ -125,7 +130,7 @@ var run = async () => {
|
|
|
125
130
|
return flushAndExit(process.exitCode || 1);
|
|
126
131
|
}
|
|
127
132
|
if (vlt.command === "registry") {
|
|
128
|
-
const { dispatchRegistry } = await import("./registry-
|
|
133
|
+
const { dispatchRegistry } = await import("./registry-6HKQYSZX.js");
|
|
129
134
|
await dispatchRegistry(vlt);
|
|
130
135
|
}
|
|
131
136
|
const command = await loadCommand(vlt.command);
|
|
@@ -28,22 +28,23 @@ import {
|
|
|
28
28
|
runtimeTokens,
|
|
29
29
|
setRuntimeToken,
|
|
30
30
|
setToken
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
} from "./chunk-35EG6T3J.js";
|
|
32
|
+
import "./chunk-QNHBAGXQ.js";
|
|
33
|
+
import {
|
|
34
|
+
userAgent
|
|
35
|
+
} from "./chunk-G3FZ2ZJK.js";
|
|
33
36
|
import {
|
|
34
37
|
assertOk,
|
|
35
38
|
registryErrorMessage,
|
|
36
39
|
requestError,
|
|
37
40
|
storeRoot
|
|
38
|
-
} from "./chunk-
|
|
39
|
-
import
|
|
40
|
-
|
|
41
|
-
} from "./chunk-ZJMJ7MCT.js";
|
|
42
|
-
import "./chunk-U7TEQCBN.js";
|
|
41
|
+
} from "./chunk-5KW6AOTT.js";
|
|
42
|
+
import "./chunk-SUU2WETN.js";
|
|
43
|
+
import "./chunk-B6RIGNEO.js";
|
|
43
44
|
import "./chunk-XNLSTHDK.js";
|
|
44
45
|
import "./chunk-PDWPFR5T.js";
|
|
45
46
|
import "./chunk-Y5PA7DVK.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-6LZM3I4Q.js";
|
|
47
48
|
import "./chunk-WZWDS3W4.js";
|
|
48
49
|
import "./chunk-PZLD7RTK.js";
|
|
49
50
|
export {
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
unpackSync,
|
|
29
29
|
unpackToStoreSync,
|
|
30
30
|
verifyStoreEntry
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-ISAMD2FE.js";
|
|
32
32
|
import {
|
|
33
33
|
cloneAvailable,
|
|
34
34
|
cloneDir
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
rimrafSync
|
|
38
38
|
} from "./chunk-PDWPFR5T.js";
|
|
39
39
|
import "./chunk-Y5PA7DVK.js";
|
|
40
|
-
import "./chunk-
|
|
40
|
+
import "./chunk-6LZM3I4Q.js";
|
|
41
41
|
import "./chunk-WZWDS3W4.js";
|
|
42
42
|
import "./chunk-PZLD7RTK.js";
|
|
43
43
|
|
|
@@ -9,14 +9,14 @@ globalThis.setInterval = _vlt_setInterval;
|
|
|
9
9
|
globalThis.clearInterval = _vlt_clearInterval;
|
|
10
10
|
import {createRequire as _vlt_createRequire} from "node:module";
|
|
11
11
|
var require = _vlt_createRequire(import.meta.filename);
|
|
12
|
-
import {
|
|
13
|
-
requireRegistry
|
|
14
|
-
} from "./chunk-THSYN5EK.js";
|
|
15
12
|
import {
|
|
16
13
|
commandUsage
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import
|
|
19
|
-
|
|
14
|
+
} from "./chunk-CW56EJIL.js";
|
|
15
|
+
import {
|
|
16
|
+
requireRegistry
|
|
17
|
+
} from "./chunk-UZ6ICZE3.js";
|
|
18
|
+
import "./chunk-CMLDLZZ3.js";
|
|
19
|
+
import "./chunk-LUVDMEW4.js";
|
|
20
20
|
import {
|
|
21
21
|
RegistryClient,
|
|
22
22
|
deleteToken,
|
|
@@ -25,15 +25,16 @@ import {
|
|
|
25
25
|
normalizeRegistryKey,
|
|
26
26
|
registryBase,
|
|
27
27
|
setToken
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-35EG6T3J.js";
|
|
29
|
+
import "./chunk-QNHBAGXQ.js";
|
|
30
|
+
import "./chunk-G3FZ2ZJK.js";
|
|
31
|
+
import "./chunk-5KW6AOTT.js";
|
|
32
|
+
import "./chunk-SUU2WETN.js";
|
|
33
|
+
import "./chunk-B6RIGNEO.js";
|
|
33
34
|
import "./chunk-XNLSTHDK.js";
|
|
34
35
|
import "./chunk-PDWPFR5T.js";
|
|
35
36
|
import "./chunk-Y5PA7DVK.js";
|
|
36
|
-
import "./chunk-
|
|
37
|
+
import "./chunk-6LZM3I4Q.js";
|
|
37
38
|
import {
|
|
38
39
|
error
|
|
39
40
|
} from "./chunk-WZWDS3W4.js";
|