@vltpkg/cli-js 1.3.8 → 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-WLKANIOE.js → access-QPX4QXV4.js} +13 -12
- package/{bugs-5Q3QSTWP.js → bugs-TLOECXEM.js} +28 -25
- package/{build-XSFR63AW.js → build-IQOS3LKO.js} +28 -19
- package/{cache-UVPK5J5A.js → cache-O5IBYYSB.js} +35 -23
- package/cache-unzip-src-unzip.js +56 -12
- package/{chunk-NWHKSRO3.js → chunk-2U4PVHP4.js} +5270 -10837
- package/{chunk-5KOLUYXH.js → chunk-35EG6T3J.js} +61 -15
- package/{chunk-PJJCFMLW.js → chunk-3S3W7QEM.js} +7 -5
- package/chunk-43EJ4Q42.js +57 -0
- package/{chunk-IHXJVKAE.js → chunk-4TSHLSRK.js} +2 -1
- package/chunk-4UH3KMTD.js +6444 -0
- package/{chunk-6D54UN4T.js → chunk-5KW6AOTT.js} +1 -1
- package/chunk-6IF3RJND.js +81 -0
- package/{chunk-IBGFQR23.js → chunk-6LZM3I4Q.js} +56 -11
- package/{chunk-FIUUAQGC.js → chunk-6W5XMVIZ.js} +29 -22
- package/{chunk-OWMR2EDW.js → chunk-7UWRR6EE.js} +2 -2
- package/{chunk-WHLYMMI2.js → chunk-ARE7FKDG.js} +6 -4
- package/chunk-B6RIGNEO.js +626 -0
- package/{chunk-CB65DPZ2.js → chunk-C6ZVVEFV.js} +239 -1190
- package/{chunk-SE2FSMBR.js → chunk-CMLDLZZ3.js} +73 -11
- package/{chunk-6P5CFJR7.js → chunk-CS6AYPY5.js} +6 -6
- package/{chunk-TLY4VGMH.js → chunk-CW56EJIL.js} +1 -1
- package/{chunk-SV4WK3KX.js → chunk-F7NPYSI2.js} +3 -2
- package/{chunk-6BQKR2FM.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-3U6QWN62.js → chunk-IJUVVD7E.js} +1 -1
- package/{chunk-H77JYU7F.js → chunk-ISAMD2FE.js} +12 -3
- package/{chunk-WKA5UYNA.js → chunk-LH7J5BDU.js} +5 -5
- package/{chunk-GZ5MYMBT.js → chunk-LUVDMEW4.js} +1 -1
- package/{chunk-OAP2ROTL.js → chunk-MYX4JCIJ.js} +1 -1
- package/{chunk-APMYKJI2.js → chunk-QNHBAGXQ.js} +1 -1
- package/{chunk-XCDLOQZZ.js → chunk-SMXXFQPI.js} +80 -29
- package/chunk-SUU2WETN.js +268 -0
- package/chunk-T2VBCUF5.js +77 -0
- package/{chunk-EL4GVZK5.js → chunk-T5EP7QEF.js} +2 -2
- package/{chunk-A2TSRXZD.js → chunk-UZ6ICZE3.js} +1 -1
- package/{chunk-DL3H4EMY.js → chunk-VR7NRWAD.js} +29 -20
- package/chunk-W4T5CGCO.js +52 -0
- package/{chunk-XDSZO74H.js → chunk-WHWPAYZY.js} +118 -20
- package/{chunk-KMOOTBHM.js → chunk-X6JKMIOU.js} +5 -1
- package/{chunk-43HNQWPQ.js → chunk-XCQCYB6G.js} +78 -13
- package/{chunk-IUL6MPP6.js → chunk-XCSNI6AO.js} +4 -4
- package/{chunk-BGA3WB7H.js → chunk-XD5KUDXX.js} +7 -7
- package/{chunk-QNDM4DVO.js → chunk-Z5D5KODU.js} +1 -1
- package/{ci-EDRETPUF.js → ci-ESVUMOZO.js} +31 -13
- package/cli-package.json +1 -1
- package/{config-MVNXGEOQ.js → config-TMB2X6DW.js} +12 -9
- package/{config-OKBXU7TU.js → config-ZVVLFKR7.js} +16 -13
- package/{create-R7BXYJSU.js → create-BLTNKSBQ.js} +28 -25
- package/{deprecate-YSUKBKQM.js → deprecate-VA6PGHYL.js} +17 -15
- package/{dist-tag-MIGYSR4F.js → dist-tag-OYJREFO2.js} +13 -12
- package/{docs-4WVIN75H.js → docs-6OC3OQNM.js} +28 -25
- package/{exec-IXHDQLAM.js → exec-AZPGFVRY.js} +28 -25
- package/{exec-cache-EA7GHIK7.js → exec-cache-D75UY2WI.js} +24 -22
- package/{exec-local-GM4LH56M.js → exec-local-E2JKB4X4.js} +22 -19
- package/{help-TCXGBICU.js → help-UPW77X5N.js} +5 -5
- package/{init-MWZDWQHM.js → init-SNO6QL7C.js} +14 -11
- package/{install-HPI5HU3C.js → install-TEJM2YVX.js} +165 -26
- package/{list-2CX6REPJ.js → list-NHCC2RNB.js} +33 -27
- package/{login-RAY23CVG.js → login-XNZXCGFD.js} +19 -16
- package/{logout-ICB5OMGY.js → logout-YCM7O36Q.js} +13 -12
- package/{outdated-FYHPXRMT.js → outdated-4LA7N63W.js} +26 -22
- package/{pack-E5MNPQXK.js → pack-RC4CZSWF.js} +25 -18
- package/package.json +1 -1
- package/{ping-REQ2KSAR.js → ping-RLVAZGDL.js} +13 -12
- package/{pkg-YB4GSRII.js → pkg-FED5C6TP.js} +23 -14
- package/{profile-GKBW6GRI.js → profile-DJZNLQPG.js} +13 -12
- package/{publish-4ZQJYYLF.js → publish-54AMVMTQ.js} +61 -45
- package/{query-SKXBF3MJ.js → query-ZQLMSJ7O.js} +35 -29
- package/{registry-MQJJCWJY.js → registry-6HKQYSZX.js} +7 -7
- package/registry-client-src-revalidate.js +110 -20
- package/{repo-ACPTZI2C.js → repo-ITA4BLZ4.js} +28 -25
- package/{reporter-4KK2JNGO.js → reporter-UYVR2WMB.js} +73 -14
- package/{run-YW3ITX2A.js → run-TP2HTJRN.js} +22 -19
- package/{run-exec-7VQX3OFG.js → run-exec-UGCC53DV.js} +22 -19
- package/security-archive-src-update-expired.js +88 -28
- package/{setup-PLEKCMXN.js → setup-XPAM5U3Z.js} +23 -21
- package/skills-LR6GXW3X.js +413 -0
- package/skills-YD2TB2VD.js +495 -0
- package/{src-XQ7KVUVN.js → src-34D4DOOH.js} +37 -27
- package/{src-PXDFMQ6W.js → src-H6DFCAPH.js} +9 -8
- package/{src-GP7VLT7P.js → src-LHDC4NJO.js} +58 -9
- package/{token-GB7RPE5J.js → token-OF63PFTQ.js} +13 -12
- package/{uninstall-RLCECX37.js → uninstall-B54FQ5KQ.js} +20 -15
- package/{unpublish-3ZXEAVHF.js → unpublish-CSHIGMDQ.js} +31 -16
- package/{update-VDZP6EZN.js → update-HS4VJ5ZG.js} +51 -25
- package/{version-MRELJPOK.js → version-L7S3DHUS.js} +24 -14
- package/{view-LCXMTGCJ.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-PNRDBS45.js → whoami-65K35VGW.js} +13 -12
- package/chunk-4JAZZRKR.js +0 -76
- package/chunk-G2YT2GWF.js +0 -120
- package/chunk-U7TEQCBN.js +0 -880
|
@@ -13,24 +13,26 @@ import {
|
|
|
13
13
|
Qn
|
|
14
14
|
} from "./chunk-SRWDPPLX.js";
|
|
15
15
|
import {
|
|
16
|
-
Monorepo,
|
|
17
|
-
PackageJson,
|
|
18
16
|
clone,
|
|
19
17
|
pickManifest,
|
|
20
18
|
resolve,
|
|
21
19
|
revs
|
|
22
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-IFEZ6BFV.js";
|
|
21
|
+
import {
|
|
22
|
+
Monorepo,
|
|
23
|
+
PackageJson
|
|
24
|
+
} from "./chunk-C6ZVVEFV.js";
|
|
23
25
|
import {
|
|
24
26
|
Spec
|
|
25
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-LUVDMEW4.js";
|
|
26
28
|
import {
|
|
27
29
|
registryErrorMessage,
|
|
28
30
|
storeRoot,
|
|
29
31
|
tokenRefusalAdvice
|
|
30
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-5KW6AOTT.js";
|
|
31
33
|
import {
|
|
32
34
|
logRequest
|
|
33
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-B6RIGNEO.js";
|
|
34
36
|
import {
|
|
35
37
|
XDG
|
|
36
38
|
} from "./chunk-XNLSTHDK.js";
|
|
@@ -39,7 +41,7 @@ import {
|
|
|
39
41
|
brotliTarballUrl,
|
|
40
42
|
integrityHex,
|
|
41
43
|
tarballFormat
|
|
42
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-6LZM3I4Q.js";
|
|
43
45
|
import {
|
|
44
46
|
error
|
|
45
47
|
} from "./chunk-WZWDS3W4.js";
|
|
@@ -226,7 +228,12 @@ var isStableSelector = (f) => {
|
|
|
226
228
|
if (!range) return false;
|
|
227
229
|
return !range.isAny && !range.raw.includes("-");
|
|
228
230
|
};
|
|
229
|
-
var storeLinkers = /* @__PURE__ */ new Set([
|
|
231
|
+
var storeLinkers = /* @__PURE__ */ new Set([
|
|
232
|
+
"auto",
|
|
233
|
+
"hardlink",
|
|
234
|
+
"clone",
|
|
235
|
+
"copy"
|
|
236
|
+
]);
|
|
230
237
|
var storedIntegrity = (response) => !response.fromCache ? response.integrityActual : !response.contentType ? void 0 : response.integrity ?? (response.isGzip ? response.integrityActual : void 0);
|
|
231
238
|
var PackageInfoClient = class {
|
|
232
239
|
#registryClient;
|
|
@@ -243,18 +250,19 @@ var PackageInfoClient = class {
|
|
|
243
250
|
#cachePath;
|
|
244
251
|
#storeRoot;
|
|
245
252
|
#storeLinker;
|
|
246
|
-
#storeHits = { link: 0, copy: 0 };
|
|
253
|
+
#storeHits = { link: 0, clone: 0, copy: 0 };
|
|
247
254
|
#storeMisses = 0;
|
|
248
255
|
#storeHitRateLogged = false;
|
|
249
256
|
#logStoreHitRate = () => {
|
|
250
|
-
const { link, copy } = this.#storeHits;
|
|
251
|
-
const n = Math.max(1, link + copy + this.#storeMisses);
|
|
257
|
+
const { link, clone: clone2, copy } = this.#storeHits;
|
|
258
|
+
const n = Math.max(1, link + clone2 + copy + this.#storeMisses);
|
|
252
259
|
debug(
|
|
253
|
-
"global store: linked=%d copied=%d missed=%d hit rate=%s%%",
|
|
260
|
+
"global store: linked=%d cloned=%d copied=%d missed=%d hit rate=%s%%",
|
|
254
261
|
link,
|
|
262
|
+
clone2,
|
|
255
263
|
copy,
|
|
256
264
|
this.#storeMisses,
|
|
257
|
-
((link + copy) / n * 100).toFixed(1)
|
|
265
|
+
((link + clone2 + copy) / n * 100).toFixed(1)
|
|
258
266
|
);
|
|
259
267
|
};
|
|
260
268
|
// In-flight coalescing key is `${registry}${name}` — no representation
|
|
@@ -330,7 +338,7 @@ var PackageInfoClient = class {
|
|
|
330
338
|
}
|
|
331
339
|
async getRegistryClient() {
|
|
332
340
|
if (this.#registryClient) return this.#registryClient;
|
|
333
|
-
this.#registryClientPromise ??= import("./src-
|
|
341
|
+
this.#registryClientPromise ??= import("./src-H6DFCAPH.js").then(({ RegistryClient }) => {
|
|
334
342
|
this.#registryClient = new RegistryClient(this.options);
|
|
335
343
|
return this.#registryClient;
|
|
336
344
|
});
|
|
@@ -369,7 +377,7 @@ var PackageInfoClient = class {
|
|
|
369
377
|
}
|
|
370
378
|
async getTarPool() {
|
|
371
379
|
if (this.#tarPool) return this.#tarPool;
|
|
372
|
-
this.#tarPoolPromise ??= import("./src-
|
|
380
|
+
this.#tarPoolPromise ??= import("./src-LHDC4NJO.js").then(
|
|
373
381
|
({ Pool }) => {
|
|
374
382
|
this.#tarPool = new Pool();
|
|
375
383
|
return this.#tarPool;
|
|
@@ -462,6 +470,7 @@ var PackageInfoClient = class {
|
|
|
462
470
|
const format = tarballFormat(r.resolved);
|
|
463
471
|
const storeOn = f.type === "registry" && this.#storeLinker !== "unpack";
|
|
464
472
|
const copy = this.#storeLinker === "copy";
|
|
473
|
+
const clone2 = this.#storeLinker === "clone";
|
|
465
474
|
const hex = !storeOn ? void 0 : r.integrity ? integrityHex(r.integrity) : integrityHex(
|
|
466
475
|
(await this.getRegistryClient()).cachedIntegrity(
|
|
467
476
|
r.resolved
|
|
@@ -475,12 +484,12 @@ var PackageInfoClient = class {
|
|
|
475
484
|
const linked = await pool.linkFromStore(
|
|
476
485
|
pathResolve(this.#storeRoot, hex),
|
|
477
486
|
target,
|
|
478
|
-
{ copy }
|
|
487
|
+
{ copy, clone: clone2 }
|
|
479
488
|
);
|
|
480
489
|
if (linked) {
|
|
481
490
|
const { how, index } = linked;
|
|
482
491
|
this.#storeHits[how]++;
|
|
483
|
-
logRequest(r.resolved, how === "
|
|
492
|
+
logRequest(r.resolved, how === "copy" ? "cache" : "store");
|
|
484
493
|
return {
|
|
485
494
|
...r,
|
|
486
495
|
manifest: index.manifest,
|
|
@@ -584,7 +593,7 @@ var PackageInfoClient = class {
|
|
|
584
593
|
}
|
|
585
594
|
case "remote": {
|
|
586
595
|
const rc = await this.getRegistryClient();
|
|
587
|
-
const { CacheEntry: Entry, cacheKey } = await import("./src-
|
|
596
|
+
const { CacheEntry: Entry, cacheKey } = await import("./src-H6DFCAPH.js");
|
|
588
597
|
const key = cacheKey("GET", new URL(r.resolved));
|
|
589
598
|
const unzipped = (entry) => {
|
|
590
599
|
try {
|
|
@@ -649,7 +658,7 @@ var PackageInfoClient = class {
|
|
|
649
658
|
r.integrity = found;
|
|
650
659
|
const buf = response.buffer();
|
|
651
660
|
try {
|
|
652
|
-
await (await this.getTarPool()).unpack(buf, target);
|
|
661
|
+
await (await this.getTarPool()).unpack(buf, target, tarballFormat(r.resolved));
|
|
653
662
|
} catch (er) {
|
|
654
663
|
throw this.#resolveError(
|
|
655
664
|
spec,
|
|
@@ -1192,7 +1201,7 @@ var PackageInfoClient = class {
|
|
|
1192
1201
|
const buf = response.buffer();
|
|
1193
1202
|
const integrity = storedIntegrity(response);
|
|
1194
1203
|
try {
|
|
1195
|
-
await (await this.getTarPool()).unpack(buf, dir);
|
|
1204
|
+
await (await this.getTarPool()).unpack(buf, dir, tarballFormat(remoteURL));
|
|
1196
1205
|
} catch (er) {
|
|
1197
1206
|
throw this.#resolveError(
|
|
1198
1207
|
s,
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
|
|
13
|
+
// ../../src/cli-sdk/src/allow-skills.ts
|
|
14
|
+
var storedAllowSkills = (conf) => {
|
|
15
|
+
const { project, user } = conf.layers;
|
|
16
|
+
const p = project?.["allow-skills"];
|
|
17
|
+
if (p) return { query: p, which: "project" };
|
|
18
|
+
if (project && "allow-skills" in project) return void 0;
|
|
19
|
+
const u = user?.["allow-skills"];
|
|
20
|
+
return u ? { query: u, which: "user" } : void 0;
|
|
21
|
+
};
|
|
22
|
+
var configLabel = (which) => which === "user" ? "user vlt.json" : "vlt.json";
|
|
23
|
+
var saveAllowSkills = async (conf) => {
|
|
24
|
+
const query = conf.explicit["allow-skills"];
|
|
25
|
+
if (!query || query === ":not(*)") return void 0;
|
|
26
|
+
const stored = storedAllowSkills(conf);
|
|
27
|
+
if (stored?.query === query) return void 0;
|
|
28
|
+
if (stored) return { query, stored };
|
|
29
|
+
await conf.addConfigToFile("project", { "allow-skills": query });
|
|
30
|
+
return { query };
|
|
31
|
+
};
|
|
32
|
+
var unmatchedLines = (unmatched = []) => unmatched.map(
|
|
33
|
+
({ pattern, skills }) => `\u26A0\uFE0F No skill matches "${pattern}"; ${!skills ? "no installed package matches its selector" : skills.length ? `the selected packages ship: ${skills.join(", ")}` : "the selected packages ship no skills"}`
|
|
34
|
+
);
|
|
35
|
+
var unscannedLines = ({
|
|
36
|
+
unscanned = [],
|
|
37
|
+
unscannedReason
|
|
38
|
+
}) => unscanned.length ? [
|
|
39
|
+
`\u23F3 ${unscanned.length} skill${unscanned.length === 1 ? "" : "s"} left out, ${unscannedReason === "timeout" ? "security data timed out" : "Socket has not scanned their packages yet"}: ${unscanned.join(", ")}. Try again later.`
|
|
40
|
+
] : [];
|
|
41
|
+
var savedLine = (query, which) => `Saved allow-skills="${query}" to ${configLabel(which)}`;
|
|
42
|
+
var keptLine = (s) => `allow-skills is already set (${configLabel(s.which)}): "${s.query}"; not replaced. Run vlt skills link to change it, or edit ${configLabel(s.which)}`;
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
storedAllowSkills,
|
|
46
|
+
configLabel,
|
|
47
|
+
saveAllowSkills,
|
|
48
|
+
unmatchedLines,
|
|
49
|
+
unscannedLines,
|
|
50
|
+
savedLine,
|
|
51
|
+
keptLine
|
|
52
|
+
};
|
|
@@ -12,43 +12,38 @@ var require = _vlt_createRequire(import.meta.filename);
|
|
|
12
12
|
import {
|
|
13
13
|
generateDefaultHelp,
|
|
14
14
|
generateFullHelp
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import {
|
|
17
|
-
flush,
|
|
18
|
-
trackCommand,
|
|
19
|
-
trackError
|
|
20
|
-
} from "./chunk-G2YT2GWF.js";
|
|
15
|
+
} from "./chunk-X6JKMIOU.js";
|
|
21
16
|
import {
|
|
22
17
|
parseError
|
|
23
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4TSHLSRK.js";
|
|
19
|
+
import {
|
|
20
|
+
isLazyView,
|
|
21
|
+
isViewClass,
|
|
22
|
+
loadLazyView
|
|
23
|
+
} from "./chunk-4KCU2KZL.js";
|
|
24
24
|
import {
|
|
25
25
|
hasConfiguredRegistry,
|
|
26
26
|
hasNpmRegistry,
|
|
27
27
|
missingNpmRegistryError,
|
|
28
28
|
missingRegistryError
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-UZ6ICZE3.js";
|
|
30
30
|
import {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
loadLazyView
|
|
34
|
-
} from "./chunk-4KCU2KZL.js";
|
|
31
|
+
defaultView
|
|
32
|
+
} from "./chunk-CMLDLZZ3.js";
|
|
35
33
|
import {
|
|
36
34
|
isGraphRunError,
|
|
37
35
|
splitDepID
|
|
38
|
-
} from "./chunk-
|
|
39
|
-
import {
|
|
40
|
-
defaultView
|
|
41
|
-
} from "./chunk-SE2FSMBR.js";
|
|
36
|
+
} from "./chunk-F7NPYSI2.js";
|
|
42
37
|
import {
|
|
43
38
|
emitter
|
|
44
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-B6RIGNEO.js";
|
|
45
40
|
import {
|
|
46
41
|
XDG
|
|
47
42
|
} from "./chunk-XNLSTHDK.js";
|
|
48
43
|
import {
|
|
49
44
|
isErrorWithCause,
|
|
50
45
|
isObject
|
|
51
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-6LZM3I4Q.js";
|
|
52
47
|
|
|
53
48
|
// ../../src/cli-sdk/src/print-err.ts
|
|
54
49
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -265,8 +260,11 @@ var printCode = (err, usage, stderr2, format) => {
|
|
|
265
260
|
return {};
|
|
266
261
|
}
|
|
267
262
|
case "ECONFIG": {
|
|
268
|
-
const { found, wanted, validOptions } = err.cause;
|
|
263
|
+
const { found, wanted, validOptions, from } = err.cause;
|
|
269
264
|
stderr2(`Config Error: ${err.message}`);
|
|
265
|
+
if (from) {
|
|
266
|
+
stderr2(indent(`From: ${format(from)}`));
|
|
267
|
+
}
|
|
270
268
|
if (found) {
|
|
271
269
|
stderr2(indent(`Found: ${format(found)}`));
|
|
272
270
|
}
|
|
@@ -281,6 +279,105 @@ var printCode = (err, usage, stderr2, format) => {
|
|
|
281
279
|
}
|
|
282
280
|
};
|
|
283
281
|
|
|
282
|
+
// ../../src/cli-sdk/src/telemetry.ts
|
|
283
|
+
import { randomUUID } from "node:crypto";
|
|
284
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
285
|
+
import { createRequire } from "node:module";
|
|
286
|
+
var POSTHOG_API_KEY = "phc_k9xCAgC6sPIBLb5UhjhnGWpt1mos0hLV4mmEhZTGPpO";
|
|
287
|
+
var POSTHOG_HOST = "https://us.i.posthog.com";
|
|
288
|
+
var SHUTDOWN_TIMEOUT_MS = 2e3;
|
|
289
|
+
var xdg = new XDG("vlt");
|
|
290
|
+
var isOptedOut = () => process.env.DO_NOT_TRACK === "1" || process.env.VLT_TELEMETRY === "0";
|
|
291
|
+
var getAnonymousId = () => {
|
|
292
|
+
const dir = xdg.data();
|
|
293
|
+
const file = xdg.data("telemetry-id");
|
|
294
|
+
try {
|
|
295
|
+
const existing = readFileSync2(file, "utf8").trim();
|
|
296
|
+
if (existing) return existing;
|
|
297
|
+
} catch {
|
|
298
|
+
}
|
|
299
|
+
const id = randomUUID();
|
|
300
|
+
try {
|
|
301
|
+
mkdirSync2(dir, { recursive: true });
|
|
302
|
+
writeFileSync2(file, id + "\n");
|
|
303
|
+
} catch {
|
|
304
|
+
}
|
|
305
|
+
return id;
|
|
306
|
+
};
|
|
307
|
+
var _posthog;
|
|
308
|
+
var _initFailed = false;
|
|
309
|
+
var getClient = () => {
|
|
310
|
+
if (_posthog) return _posthog;
|
|
311
|
+
if (_initFailed) return void 0;
|
|
312
|
+
try {
|
|
313
|
+
const req = createRequire(import.meta.url);
|
|
314
|
+
const { PostHog } = req("posthog-node");
|
|
315
|
+
_posthog = new PostHog(POSTHOG_API_KEY, {
|
|
316
|
+
host: POSTHOG_HOST,
|
|
317
|
+
// Buffer up to 20 events and flush every 10 s — but we always
|
|
318
|
+
// call shutdown at the end so this is just a safety net.
|
|
319
|
+
flushAt: 20,
|
|
320
|
+
flushInterval: 1e4
|
|
321
|
+
});
|
|
322
|
+
return _posthog;
|
|
323
|
+
} catch {
|
|
324
|
+
_initFailed = true;
|
|
325
|
+
return void 0;
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
var trackCommand = (ev, telemetryFlag) => {
|
|
329
|
+
if (telemetryFlag === false || isOptedOut()) return;
|
|
330
|
+
const ph = getClient();
|
|
331
|
+
if (!ph) return;
|
|
332
|
+
try {
|
|
333
|
+
ph.capture({
|
|
334
|
+
distinctId: getAnonymousId(),
|
|
335
|
+
event: "cli_command",
|
|
336
|
+
properties: { ...ev }
|
|
337
|
+
});
|
|
338
|
+
} catch {
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
var trackInstall = (ev, telemetryFlag) => {
|
|
342
|
+
if (telemetryFlag === false || isOptedOut()) return;
|
|
343
|
+
const ph = getClient();
|
|
344
|
+
if (!ph) return;
|
|
345
|
+
try {
|
|
346
|
+
ph.capture({
|
|
347
|
+
distinctId: getAnonymousId(),
|
|
348
|
+
event: "cli_install",
|
|
349
|
+
properties: { ...ev }
|
|
350
|
+
});
|
|
351
|
+
} catch {
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
var trackError = (ev, telemetryFlag) => {
|
|
355
|
+
if (telemetryFlag === false || isOptedOut()) return;
|
|
356
|
+
const ph = getClient();
|
|
357
|
+
if (!ph) return;
|
|
358
|
+
try {
|
|
359
|
+
ph.capture({
|
|
360
|
+
distinctId: getAnonymousId(),
|
|
361
|
+
event: "cli_error",
|
|
362
|
+
properties: { ...ev }
|
|
363
|
+
});
|
|
364
|
+
} catch {
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
var flush = () => {
|
|
368
|
+
const ph = _posthog;
|
|
369
|
+
if (!ph) return Promise.resolve();
|
|
370
|
+
_posthog = void 0;
|
|
371
|
+
return Promise.race([
|
|
372
|
+
ph.shutdown().catch(() => {
|
|
373
|
+
}),
|
|
374
|
+
new Promise((r) => {
|
|
375
|
+
const t = setTimeout(r, SHUTDOWN_TIMEOUT_MS);
|
|
376
|
+
if (typeof t === "object" && "unref" in t) t.unref();
|
|
377
|
+
})
|
|
378
|
+
]);
|
|
379
|
+
};
|
|
380
|
+
|
|
284
381
|
// ../../src/cli-sdk/src/output.ts
|
|
285
382
|
import {
|
|
286
383
|
formatWithOptions as formatWithOptions2,
|
|
@@ -635,12 +732,13 @@ var outputCommand = async (cliCommand, conf, { start, vltVersion } = {
|
|
|
635
732
|
...formatOptions,
|
|
636
733
|
colors: stderrColor
|
|
637
734
|
});
|
|
638
|
-
|
|
735
|
+
conf.abort();
|
|
639
736
|
}
|
|
640
737
|
};
|
|
641
738
|
|
|
642
739
|
export {
|
|
643
740
|
indent,
|
|
741
|
+
trackInstall,
|
|
644
742
|
stdout,
|
|
645
743
|
stderr,
|
|
646
744
|
flushAndExit,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-WGDTG44V.js";
|
|
15
15
|
import {
|
|
16
16
|
commandAliases
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-CMLDLZZ3.js";
|
|
18
18
|
|
|
19
19
|
// ../../node_modules/.vlt/~npm~package-json-from-dist@1.0.1/node_modules/package-json-from-dist/dist/esm/index.js
|
|
20
20
|
import { readFileSync } from "node:fs";
|
|
@@ -227,6 +227,10 @@ var commandHelp = {
|
|
|
227
227
|
desc: "Configure your vlt.io account registries",
|
|
228
228
|
defaultOrder: 0
|
|
229
229
|
},
|
|
230
|
+
skills: {
|
|
231
|
+
args: "[list|link]",
|
|
232
|
+
desc: "Manage agent skills from installed packages"
|
|
233
|
+
},
|
|
230
234
|
token: {
|
|
231
235
|
args: "[add|rm]",
|
|
232
236
|
desc: "Manage authentication tokens"
|
|
@@ -11,15 +11,12 @@ import {createRequire as _vlt_createRequire} from "node:module";
|
|
|
11
11
|
var require = _vlt_createRequire(import.meta.filename);
|
|
12
12
|
import {
|
|
13
13
|
PackageInfoClient
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VR7NRWAD.js";
|
|
15
15
|
import {
|
|
16
16
|
Monorepo,
|
|
17
17
|
PackageJson,
|
|
18
18
|
PathScurry
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import {
|
|
21
|
-
resetCaches
|
|
22
|
-
} from "./chunk-SV4WK3KX.js";
|
|
19
|
+
} from "./chunk-C6ZVVEFV.js";
|
|
23
20
|
import {
|
|
24
21
|
commands,
|
|
25
22
|
defaultValues,
|
|
@@ -28,7 +25,10 @@ import {
|
|
|
28
25
|
isRecordField,
|
|
29
26
|
recordFields,
|
|
30
27
|
storeLinkers
|
|
31
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-CMLDLZZ3.js";
|
|
29
|
+
import {
|
|
30
|
+
resetCaches
|
|
31
|
+
} from "./chunk-F7NPYSI2.js";
|
|
32
32
|
import {
|
|
33
33
|
find,
|
|
34
34
|
load,
|
|
@@ -37,14 +37,21 @@ import {
|
|
|
37
37
|
} from "./chunk-HTOTG4TS.js";
|
|
38
38
|
import {
|
|
39
39
|
storeRoot
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-5KW6AOTT.js";
|
|
41
|
+
import {
|
|
42
|
+
cloneAvailable
|
|
43
|
+
} from "./chunk-6IF3RJND.js";
|
|
41
44
|
import {
|
|
42
45
|
assertRecordStringString,
|
|
43
46
|
assertRecordStringT,
|
|
47
|
+
builtinProtocols,
|
|
48
|
+
defaultGitHosts,
|
|
49
|
+
defaultJsrRegistries,
|
|
50
|
+
defaultRegistries,
|
|
44
51
|
getOptions,
|
|
45
52
|
isObject,
|
|
46
53
|
isRecordStringString
|
|
47
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-6LZM3I4Q.js";
|
|
48
55
|
import {
|
|
49
56
|
error
|
|
50
57
|
} from "./chunk-WZWDS3W4.js";
|
|
@@ -133,6 +140,54 @@ var mergeLayers = (layers) => {
|
|
|
133
140
|
return result;
|
|
134
141
|
};
|
|
135
142
|
|
|
143
|
+
// ../../src/cli-sdk/src/config/spec-aliases.ts
|
|
144
|
+
var builtins = {
|
|
145
|
+
registries: defaultRegistries,
|
|
146
|
+
"jsr-registries": defaultJsrRegistries,
|
|
147
|
+
"git-hosts": defaultGitHosts
|
|
148
|
+
};
|
|
149
|
+
var fields = Object.keys(builtins);
|
|
150
|
+
var assertSpecAliases = (values) => {
|
|
151
|
+
const owners = /* @__PURE__ */ new Map();
|
|
152
|
+
for (const field of fields) {
|
|
153
|
+
for (const key of Object.keys(builtins[field])) {
|
|
154
|
+
if (values[field]?.[key] === void 0) {
|
|
155
|
+
owners.set(key, { field, builtin: true });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
for (const field of fields) {
|
|
160
|
+
for (const key of Object.keys(values[field] ?? {})) {
|
|
161
|
+
const name = `${field}.${key}`;
|
|
162
|
+
if (builtinProtocols.has(key)) {
|
|
163
|
+
throw error(
|
|
164
|
+
`${name} shadows the built-in \`${key}:\` protocol`,
|
|
165
|
+
{
|
|
166
|
+
code: "ECONFIG",
|
|
167
|
+
name,
|
|
168
|
+
found: key,
|
|
169
|
+
wanted: "a name that is not a built-in protocol"
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
const owner = owners.get(key);
|
|
174
|
+
if (owner) {
|
|
175
|
+
const where = `${owner.field}.${key}${owner.builtin ? " (built-in)" : ""}`;
|
|
176
|
+
throw error(
|
|
177
|
+
`\`${key}:\` spec prefix defined in both ${where} and ${name}`,
|
|
178
|
+
{
|
|
179
|
+
code: "ECONFIG",
|
|
180
|
+
name,
|
|
181
|
+
found: key,
|
|
182
|
+
wanted: `a ${field} name not used by ${owner.field}`
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
owners.set(key, { field, builtin: false });
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
136
191
|
// ../../src/cli-sdk/src/config/index.ts
|
|
137
192
|
var kCustomInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
138
193
|
var reducePairs = (pairs) => {
|
|
@@ -240,6 +295,7 @@ var Config = class _Config {
|
|
|
240
295
|
const asRecords = pairsToRecords(this.parse().values);
|
|
241
296
|
const extras = {
|
|
242
297
|
projectRoot: this.projectRoot,
|
|
298
|
+
signal: this.#abort.signal,
|
|
243
299
|
storeRoot: storeRoot(asRecords.cache),
|
|
244
300
|
scurry,
|
|
245
301
|
packageJson,
|
|
@@ -279,7 +335,7 @@ var Config = class _Config {
|
|
|
279
335
|
[kCustomInspect]() {
|
|
280
336
|
return Object.fromEntries(
|
|
281
337
|
Object.entries(options).filter(
|
|
282
|
-
([k]) => k !== "monorepo" && k !== "scurry" && k !== "packageJson" && k !== "packageInfo"
|
|
338
|
+
([k]) => k !== "monorepo" && k !== "scurry" && k !== "packageJson" && k !== "packageInfo" && k !== "signal"
|
|
283
339
|
)
|
|
284
340
|
);
|
|
285
341
|
}
|
|
@@ -297,6 +353,11 @@ var Config = class _Config {
|
|
|
297
353
|
}
|
|
298
354
|
// memoized options() getter value
|
|
299
355
|
#options;
|
|
356
|
+
#abort = new AbortController();
|
|
357
|
+
/** Abort requests still in flight */
|
|
358
|
+
abort() {
|
|
359
|
+
this.#abort.abort();
|
|
360
|
+
}
|
|
300
361
|
/**
|
|
301
362
|
* positional arguments to the vlt process
|
|
302
363
|
*/
|
|
@@ -355,8 +416,9 @@ var Config = class _Config {
|
|
|
355
416
|
if (cmdSpecific) this.jack.setConfigValues(cmdPairs);
|
|
356
417
|
this.jack.applyDefaults(p);
|
|
357
418
|
if (p.values["store-linker"] === "auto" && process.platform !== "linux") {
|
|
358
|
-
|
|
359
|
-
|
|
419
|
+
const linker = cloneAvailable() ? "clone" : "unpack";
|
|
420
|
+
p.values["store-linker"] = linker;
|
|
421
|
+
envValues["store-linker"] = linker;
|
|
360
422
|
}
|
|
361
423
|
const values = p.values;
|
|
362
424
|
const explicit = {};
|
|
@@ -382,6 +444,9 @@ var Config = class _Config {
|
|
|
382
444
|
const base = (k in cmdPairs ? cmdPairs[k] : fileValues[k]) ?? [];
|
|
383
445
|
values[k] = dedupePairs([...base, ...pairs]);
|
|
384
446
|
}
|
|
447
|
+
if (cmdOrFallback !== "config") {
|
|
448
|
+
assertSpecAliases(pairsToRecords(p.values));
|
|
449
|
+
}
|
|
385
450
|
this.jack.writeEnv(p);
|
|
386
451
|
process.env[kParentEnv] = JSON.stringify({
|
|
387
452
|
explicit,
|
|
@@ -585,11 +650,11 @@ var Config = class _Config {
|
|
|
585
650
|
* Deletes the specified config fields from the named file
|
|
586
651
|
* Returns `true` if anything was changed.
|
|
587
652
|
*/
|
|
588
|
-
async deleteConfigKeys(which,
|
|
653
|
+
async deleteConfigKeys(which, fields2) {
|
|
589
654
|
const data = await this.#maybeLoadConfigFile(which);
|
|
590
655
|
if (!data) return false;
|
|
591
656
|
let didSomething = false;
|
|
592
|
-
for (const f of
|
|
657
|
+
for (const f of fields2) {
|
|
593
658
|
const [key, ...sk] = f.split(".");
|
|
594
659
|
const subs = sk.join(".");
|
|
595
660
|
const k = key;
|
|
@@ -15,14 +15,14 @@ import {
|
|
|
15
15
|
pairsToRecords,
|
|
16
16
|
registrySelectionFields,
|
|
17
17
|
registrySelectors
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-XCQCYB6G.js";
|
|
19
19
|
import {
|
|
20
20
|
normalizeRegistryURL
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-UZ6ICZE3.js";
|
|
22
22
|
import {
|
|
23
23
|
getCommand,
|
|
24
24
|
isRecordField
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-CMLDLZZ3.js";
|
|
26
26
|
import {
|
|
27
27
|
find
|
|
28
28
|
} from "./chunk-HTOTG4TS.js";
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
defaultRegistries,
|
|
34
34
|
defaultRegistryName,
|
|
35
35
|
isObject
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-6LZM3I4Q.js";
|
|
37
37
|
import {
|
|
38
38
|
error
|
|
39
39
|
} from "./chunk-WZWDS3W4.js";
|
|
@@ -9,21 +9,21 @@ 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
|
-
PackageInfoClient
|
|
14
|
-
} from "./chunk-DL3H4EMY.js";
|
|
15
12
|
import {
|
|
16
13
|
RollbackRemove,
|
|
17
14
|
cmdShim,
|
|
18
15
|
findCmdShimIfExists,
|
|
19
16
|
install
|
|
20
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4UH3KMTD.js";
|
|
18
|
+
import {
|
|
19
|
+
PackageInfoClient
|
|
20
|
+
} from "./chunk-VR7NRWAD.js";
|
|
21
21
|
import {
|
|
22
22
|
PathScurry
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-C6ZVVEFV.js";
|
|
24
24
|
import {
|
|
25
25
|
Spec
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-LUVDMEW4.js";
|
|
27
27
|
import {
|
|
28
28
|
walkUp
|
|
29
29
|
} from "./chunk-HTOTG4TS.js";
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
} from "./chunk-XNLSTHDK.js";
|
|
33
33
|
import {
|
|
34
34
|
parseScope
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-6LZM3I4Q.js";
|
|
36
36
|
import {
|
|
37
37
|
error
|
|
38
38
|
} from "./chunk-WZWDS3W4.js";
|