@vltpkg/cli-js 1.4.0 → 1.6.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-AJ654YKY.js} +13 -12
- package/{bugs-RED7Y33Q.js → bugs-N73DVYHD.js} +32 -25
- package/{build-IHMPBWRO.js → build-VZ3EZKMM.js} +65 -21
- package/{cache-FJP2RZJX.js → cache-VROEWG2C.js} +20 -17
- package/cache-unzip-src-unzip.js +58 -15
- package/{chunk-TPRK6IDA.js → chunk-22LZBDEC.js} +2 -2
- package/chunk-36UIE654.js +6248 -0
- package/{chunk-UGCKF5ZE.js → chunk-3JIN46K5.js} +1 -1
- package/{chunk-OAJ3PO3Z.js → chunk-44AWMA4F.js} +25 -13
- package/chunk-4E65BBTM.js +77 -0
- package/{chunk-SR2VOY5J.js → chunk-4GMNWW4C.js} +1 -1
- package/{chunk-5IJTPZXP.js → chunk-6D3QAFNZ.js} +1 -1
- package/{chunk-X4FVR4R5.js → chunk-75HGJVNG.js} +12 -10
- package/{chunk-THSYN5EK.js → chunk-7M2VTFLP.js} +12 -1
- package/{chunk-2AMOC4DN.js → chunk-ANW36H4T.js} +4 -4
- package/chunk-B6RIGNEO.js +626 -0
- package/{chunk-FLH4YC6W.js → chunk-BF5DRGRZ.js} +60 -15
- package/chunk-BH5CVXNY.js +115 -0
- package/{chunk-PLG3OYCX.js → chunk-CAV7FKWQ.js} +3 -2
- package/{chunk-C23TDXRG.js → chunk-CYK6I4M6.js} +1 -1
- package/chunk-DXED4ARV.js +436 -0
- package/chunk-E74WGW5C.js +49 -0
- package/{chunk-WF6KLKRN.js → chunk-EFHOWRKU.js} +103 -1
- package/chunk-EMTGRCSE.js +1111 -0
- package/{chunk-5Y4SYLJ2.js → chunk-EYGOEAJM.js} +1 -1
- package/{chunk-OVPHE4O7.js → chunk-F5LZMLAQ.js} +5335 -10902
- package/{chunk-HZXJ423P.js → chunk-FXD3IV2S.js} +4 -2
- package/chunk-GCTREKA4.js +115 -0
- package/{chunk-ZJMJ7MCT.js → chunk-GEQFMH5M.js} +1 -1
- package/{chunk-ISE4IRHF.js → chunk-GZVI75KX.js} +7 -14
- package/chunk-HOF7LEIC.js +24 -0
- package/{chunk-LHPEBLOU.js → chunk-HT6FS4VB.js} +1 -1
- package/{chunk-PHJJPY5G.js → chunk-IXAMCWIT.js} +5 -5
- package/{chunk-ASLX43R3.js → chunk-JCNI6ZHH.js} +7 -5
- package/chunk-JV5XR5JQ.js +349 -0
- package/{chunk-7T3XAYP4.js → chunk-KD5ZK72K.js} +1 -1
- package/{chunk-FZUYGJZU.js → chunk-KVWGMSPW.js} +137 -19
- package/{chunk-TO23PR7J.js → chunk-LCLRP64K.js} +14 -12
- package/{chunk-QCSUWACA.js → chunk-LGQVZTYR.js} +8 -36
- package/{chunk-5RHABCYI.js → chunk-LP3ORD3D.js} +143 -17
- package/chunk-MCDLJZXT.js +82 -0
- package/{chunk-DNRR3XMG.js → chunk-N6HV7JWC.js} +1 -1
- package/chunk-O6MQ7NN6.js +1155 -0
- package/{chunk-GIIAODRI.js → chunk-PC2HOBAQ.js} +7 -5
- package/{chunk-APMYKJI2.js → chunk-QNHBAGXQ.js} +1 -1
- package/chunk-RBQO54TG.js +59 -0
- package/chunk-SUU2WETN.js +268 -0
- package/{chunk-I7UMHYZX.js → chunk-TQQO2F56.js} +113 -1187
- package/{chunk-4UCADW6S.js → chunk-TWDSXQPN.js} +9 -7
- package/{chunk-MKWPTN3C.js → chunk-VLVMLSIF.js} +2 -2
- package/chunk-W4T5CGCO.js +52 -0
- package/{chunk-5TNXLRW2.js → chunk-YTDABXPD.js} +50 -12
- package/{ci-YSKNNO5M.js → ci-3BVMVQIT.js} +35 -13
- package/cli-package.json +3 -1
- package/{config-HO7GY3QT.js → config-2KQV7N5A.js} +16 -13
- package/{config-CSPCDMR3.js → config-EKHBW6I5.js} +12 -9
- package/{create-2TJT3AHJ.js → create-QVHNOIV3.js} +35 -29
- package/{deprecate-7FRJI2RL.js → deprecate-E254QBH6.js} +17 -15
- package/{dist-tag-WCFF5OEG.js → dist-tag-SITRFD7O.js} +13 -12
- package/{docs-JMBPTU23.js → docs-IDL2P7CA.js} +32 -25
- package/{exec-FBOUKZZ2.js → exec-7BK2W2WL.js} +35 -29
- package/{exec-cache-X3ZWM5S3.js → exec-cache-VY46L7DR.js} +27 -21
- package/{exec-local-Y3KQC22N.js → exec-local-D7R5T3DF.js} +26 -20
- package/{help-PUKVH5X7.js → help-RMRIEJQL.js} +6 -5
- package/{init-GOKAQXXZ.js → init-BGW4HJ6V.js} +15 -11
- package/{install-XFN4UFOC.js → install-U5GATZ2N.js} +144 -49
- package/{list-43JFFG5D.js → list-3VG4M2XL.js} +41 -28
- package/{login-RSTZKNKN.js → login-PHQWI6S6.js} +19 -16
- package/{logout-4576FFXZ.js → logout-DJCOGRFF.js} +13 -12
- package/{outdated-ACQ5A2Y7.js → outdated-JH3O6R3Y.js} +27 -22
- package/{pack-QQVJ3G25.js → pack-U5W5YWHK.js} +23 -18
- package/package.json +1 -1
- package/{ping-QCDQQRO5.js → ping-EKX43AOW.js} +13 -12
- package/{pkg-CSOJV7UC.js → pkg-SW5GMERT.js} +19 -14
- package/{profile-VL4HPW3N.js → profile-UGDRDMQ6.js} +13 -12
- package/{publish-2YBO6ZXE.js → publish-HTWKK3NN.js} +60 -45
- package/{query-IHHFMJRT.js → query-YE3FUVGG.js} +43 -30
- package/{registry-W7BRZZZ2.js → registry-ZGGWVLBM.js} +7 -7
- package/registry-client-src-revalidate.js +76 -22
- package/{repo-L3BXAAWS.js → repo-WDOCU6SE.js} +32 -25
- package/{reporter-5NYOHBO7.js → reporter-N5PAXB26.js} +121 -17
- package/{run-AMUUVLTI.js → run-IPARVIIQ.js} +26 -20
- package/{run-exec-5W3XWQZA.js → run-exec-C4RTREEW.js} +26 -20
- package/security-archive-src-update-expired.js +66 -21
- package/{setup-TFM4GJF7.js → setup-SYYUEHZL.js} +212 -32
- package/skills-KA2VR5Q5.js +480 -0
- package/skills-UBBMSBDQ.js +416 -0
- package/{src-4CYCUWZL.js → src-FUSTSM4J.js} +33 -22
- package/{src-I3GMULFP.js → src-QO5G2S4O.js} +11 -8
- package/{src-LUTN2ODD.js → src-W2VQULRG.js} +2 -2
- package/{token-OANOBE3G.js → token-UQNABECH.js} +15 -13
- package/{uninstall-YXTQ4AIZ.js → uninstall-FHBJ3OUV.js} +59 -18
- package/{unpublish-SZXYMYIU.js → unpublish-APJTEUBA.js} +31 -16
- package/{update-FHLMWGIM.js → update-NWZTL4S7.js} +52 -25
- package/{version-ZWFCTU5V.js → version-EMKKTL77.js} +20 -14
- package/{view-NFNJXMLV.js → view-BUUI33RV.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-F6BSXGQ2.js} +13 -12
- package/chunk-G2YT2GWF.js +0 -120
- package/chunk-T6FBP4OU.js +0 -76
- package/chunk-U7TEQCBN.js +0 -880
|
@@ -12,43 +12,47 @@ 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-LGQVZTYR.js";
|
|
21
16
|
import {
|
|
22
17
|
parseError
|
|
23
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-EYGOEAJM.js";
|
|
19
|
+
import {
|
|
20
|
+
isLazyView,
|
|
21
|
+
isViewClass,
|
|
22
|
+
loadLazyView
|
|
23
|
+
} from "./chunk-4KCU2KZL.js";
|
|
24
|
+
import {
|
|
25
|
+
sweepPendingRemove
|
|
26
|
+
} from "./chunk-GCTREKA4.js";
|
|
27
|
+
import {
|
|
28
|
+
globalCommands
|
|
29
|
+
} from "./chunk-MCDLJZXT.js";
|
|
24
30
|
import {
|
|
25
31
|
hasConfiguredRegistry,
|
|
26
32
|
hasNpmRegistry,
|
|
27
33
|
missingNpmRegistryError,
|
|
28
34
|
missingRegistryError
|
|
29
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-7M2VTFLP.js";
|
|
30
36
|
import {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
loadLazyView
|
|
34
|
-
} from "./chunk-4KCU2KZL.js";
|
|
37
|
+
defaultView
|
|
38
|
+
} from "./chunk-EFHOWRKU.js";
|
|
35
39
|
import {
|
|
36
40
|
isGraphRunError,
|
|
37
41
|
splitDepID
|
|
38
|
-
} from "./chunk-
|
|
39
|
-
import {
|
|
40
|
-
defaultView
|
|
41
|
-
} from "./chunk-WF6KLKRN.js";
|
|
42
|
+
} from "./chunk-CAV7FKWQ.js";
|
|
42
43
|
import {
|
|
43
44
|
emitter
|
|
44
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-B6RIGNEO.js";
|
|
45
46
|
import {
|
|
46
47
|
XDG
|
|
47
48
|
} from "./chunk-XNLSTHDK.js";
|
|
48
49
|
import {
|
|
49
50
|
isErrorWithCause,
|
|
50
51
|
isObject
|
|
51
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-BF5DRGRZ.js";
|
|
53
|
+
import {
|
|
54
|
+
error
|
|
55
|
+
} from "./chunk-WZWDS3W4.js";
|
|
52
56
|
|
|
53
57
|
// ../../src/cli-sdk/src/print-err.ts
|
|
54
58
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -265,8 +269,11 @@ var printCode = (err, usage, stderr2, format) => {
|
|
|
265
269
|
return {};
|
|
266
270
|
}
|
|
267
271
|
case "ECONFIG": {
|
|
268
|
-
const { found, wanted, validOptions } = err.cause;
|
|
272
|
+
const { found, wanted, validOptions, from } = err.cause;
|
|
269
273
|
stderr2(`Config Error: ${err.message}`);
|
|
274
|
+
if (from) {
|
|
275
|
+
stderr2(indent(`From: ${format(from)}`));
|
|
276
|
+
}
|
|
270
277
|
if (found) {
|
|
271
278
|
stderr2(indent(`Found: ${format(found)}`));
|
|
272
279
|
}
|
|
@@ -281,6 +288,105 @@ var printCode = (err, usage, stderr2, format) => {
|
|
|
281
288
|
}
|
|
282
289
|
};
|
|
283
290
|
|
|
291
|
+
// ../../src/cli-sdk/src/telemetry.ts
|
|
292
|
+
import { randomUUID } from "node:crypto";
|
|
293
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
294
|
+
import { createRequire } from "node:module";
|
|
295
|
+
var POSTHOG_API_KEY = "phc_k9xCAgC6sPIBLb5UhjhnGWpt1mos0hLV4mmEhZTGPpO";
|
|
296
|
+
var POSTHOG_HOST = "https://us.i.posthog.com";
|
|
297
|
+
var SHUTDOWN_TIMEOUT_MS = 2e3;
|
|
298
|
+
var xdg = new XDG("vlt");
|
|
299
|
+
var isOptedOut = () => process.env.DO_NOT_TRACK === "1" || process.env.VLT_TELEMETRY === "0";
|
|
300
|
+
var getAnonymousId = () => {
|
|
301
|
+
const dir = xdg.data();
|
|
302
|
+
const file = xdg.data("telemetry-id");
|
|
303
|
+
try {
|
|
304
|
+
const existing = readFileSync2(file, "utf8").trim();
|
|
305
|
+
if (existing) return existing;
|
|
306
|
+
} catch {
|
|
307
|
+
}
|
|
308
|
+
const id = randomUUID();
|
|
309
|
+
try {
|
|
310
|
+
mkdirSync2(dir, { recursive: true });
|
|
311
|
+
writeFileSync2(file, id + "\n");
|
|
312
|
+
} catch {
|
|
313
|
+
}
|
|
314
|
+
return id;
|
|
315
|
+
};
|
|
316
|
+
var _posthog;
|
|
317
|
+
var _initFailed = false;
|
|
318
|
+
var getClient = () => {
|
|
319
|
+
if (_posthog) return _posthog;
|
|
320
|
+
if (_initFailed) return void 0;
|
|
321
|
+
try {
|
|
322
|
+
const req = createRequire(import.meta.url);
|
|
323
|
+
const { PostHog } = req("posthog-node");
|
|
324
|
+
_posthog = new PostHog(POSTHOG_API_KEY, {
|
|
325
|
+
host: POSTHOG_HOST,
|
|
326
|
+
// Buffer up to 20 events and flush every 10 s — but we always
|
|
327
|
+
// call shutdown at the end so this is just a safety net.
|
|
328
|
+
flushAt: 20,
|
|
329
|
+
flushInterval: 1e4
|
|
330
|
+
});
|
|
331
|
+
return _posthog;
|
|
332
|
+
} catch {
|
|
333
|
+
_initFailed = true;
|
|
334
|
+
return void 0;
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
var trackCommand = (ev, telemetryFlag) => {
|
|
338
|
+
if (telemetryFlag === false || isOptedOut()) return;
|
|
339
|
+
const ph = getClient();
|
|
340
|
+
if (!ph) return;
|
|
341
|
+
try {
|
|
342
|
+
ph.capture({
|
|
343
|
+
distinctId: getAnonymousId(),
|
|
344
|
+
event: "cli_command",
|
|
345
|
+
properties: { ...ev }
|
|
346
|
+
});
|
|
347
|
+
} catch {
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
var trackInstall = (ev, telemetryFlag) => {
|
|
351
|
+
if (telemetryFlag === false || isOptedOut()) return;
|
|
352
|
+
const ph = getClient();
|
|
353
|
+
if (!ph) return;
|
|
354
|
+
try {
|
|
355
|
+
ph.capture({
|
|
356
|
+
distinctId: getAnonymousId(),
|
|
357
|
+
event: "cli_install",
|
|
358
|
+
properties: { ...ev }
|
|
359
|
+
});
|
|
360
|
+
} catch {
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
var trackError = (ev, telemetryFlag) => {
|
|
364
|
+
if (telemetryFlag === false || isOptedOut()) return;
|
|
365
|
+
const ph = getClient();
|
|
366
|
+
if (!ph) return;
|
|
367
|
+
try {
|
|
368
|
+
ph.capture({
|
|
369
|
+
distinctId: getAnonymousId(),
|
|
370
|
+
event: "cli_error",
|
|
371
|
+
properties: { ...ev }
|
|
372
|
+
});
|
|
373
|
+
} catch {
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
var flush = () => {
|
|
377
|
+
const ph = _posthog;
|
|
378
|
+
if (!ph) return Promise.resolve();
|
|
379
|
+
_posthog = void 0;
|
|
380
|
+
return Promise.race([
|
|
381
|
+
ph.shutdown().catch(() => {
|
|
382
|
+
}),
|
|
383
|
+
new Promise((r) => {
|
|
384
|
+
const t = setTimeout(r, SHUTDOWN_TIMEOUT_MS);
|
|
385
|
+
if (typeof t === "object" && "unref" in t) t.unref();
|
|
386
|
+
})
|
|
387
|
+
]);
|
|
388
|
+
};
|
|
389
|
+
|
|
284
390
|
// ../../src/cli-sdk/src/output.ts
|
|
285
391
|
import {
|
|
286
392
|
formatWithOptions as formatWithOptions2,
|
|
@@ -568,6 +674,16 @@ var outputCommand = async (cliCommand, conf, { start, vltVersion } = {
|
|
|
568
674
|
const telemetryEnabled = conf.values.telemetry;
|
|
569
675
|
const commandName = conf.command;
|
|
570
676
|
try {
|
|
677
|
+
if (conf.explicit.global && !conf.globalRoot) {
|
|
678
|
+
throw error(
|
|
679
|
+
`\`vlt ${conf.command}\` does not support --global`,
|
|
680
|
+
{
|
|
681
|
+
code: "EUSAGE",
|
|
682
|
+
found: conf.command,
|
|
683
|
+
validOptions: [...globalCommands]
|
|
684
|
+
}
|
|
685
|
+
);
|
|
686
|
+
}
|
|
571
687
|
if (needsRegistry && !hasConfiguredRegistry(conf)) {
|
|
572
688
|
throw missingRegistryError();
|
|
573
689
|
}
|
|
@@ -576,6 +692,7 @@ var outputCommand = async (cliCommand, conf, { start, vltVersion } = {
|
|
|
576
692
|
conf.options["default-registry-alias"]
|
|
577
693
|
);
|
|
578
694
|
}
|
|
695
|
+
if (conf.globalRoot) await sweepPendingRemove(conf.globalRoot);
|
|
579
696
|
const output = await onDone(await command(conf));
|
|
580
697
|
stopRequestLog();
|
|
581
698
|
const duration_ms = Date.now() - start;
|
|
@@ -641,6 +758,7 @@ var outputCommand = async (cliCommand, conf, { start, vltVersion } = {
|
|
|
641
758
|
|
|
642
759
|
export {
|
|
643
760
|
indent,
|
|
761
|
+
trackInstall,
|
|
644
762
|
stdout,
|
|
645
763
|
stderr,
|
|
646
764
|
flushAndExit,
|
|
@@ -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-EMTGRCSE.js";
|
|
21
|
+
import {
|
|
22
|
+
Monorepo,
|
|
23
|
+
PackageJson
|
|
24
|
+
} from "./chunk-TQQO2F56.js";
|
|
23
25
|
import {
|
|
24
26
|
Spec
|
|
25
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-6D3QAFNZ.js";
|
|
26
28
|
import {
|
|
27
29
|
registryErrorMessage,
|
|
28
30
|
storeRoot,
|
|
29
31
|
tokenRefusalAdvice
|
|
30
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-4GMNWW4C.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-BF5DRGRZ.js";
|
|
43
45
|
import {
|
|
44
46
|
error
|
|
45
47
|
} from "./chunk-WZWDS3W4.js";
|
|
@@ -336,7 +338,7 @@ var PackageInfoClient = class {
|
|
|
336
338
|
}
|
|
337
339
|
async getRegistryClient() {
|
|
338
340
|
if (this.#registryClient) return this.#registryClient;
|
|
339
|
-
this.#registryClientPromise ??= import("./src-
|
|
341
|
+
this.#registryClientPromise ??= import("./src-QO5G2S4O.js").then(({ RegistryClient }) => {
|
|
340
342
|
this.#registryClient = new RegistryClient(this.options);
|
|
341
343
|
return this.#registryClient;
|
|
342
344
|
});
|
|
@@ -375,7 +377,7 @@ var PackageInfoClient = class {
|
|
|
375
377
|
}
|
|
376
378
|
async getTarPool() {
|
|
377
379
|
if (this.#tarPool) return this.#tarPool;
|
|
378
|
-
this.#tarPoolPromise ??= import("./src-
|
|
380
|
+
this.#tarPoolPromise ??= import("./src-W2VQULRG.js").then(
|
|
379
381
|
({ Pool }) => {
|
|
380
382
|
this.#tarPool = new Pool();
|
|
381
383
|
return this.#tarPool;
|
|
@@ -591,7 +593,7 @@ var PackageInfoClient = class {
|
|
|
591
593
|
}
|
|
592
594
|
case "remote": {
|
|
593
595
|
const rc = await this.getRegistryClient();
|
|
594
|
-
const { CacheEntry: Entry, cacheKey } = await import("./src-
|
|
596
|
+
const { CacheEntry: Entry, cacheKey } = await import("./src-QO5G2S4O.js");
|
|
595
597
|
const key = cacheKey("GET", new URL(r.resolved));
|
|
596
598
|
const unzipped = (entry) => {
|
|
597
599
|
try {
|
|
@@ -656,7 +658,7 @@ var PackageInfoClient = class {
|
|
|
656
658
|
r.integrity = found;
|
|
657
659
|
const buf = response.buffer();
|
|
658
660
|
try {
|
|
659
|
-
await (await this.getTarPool()).unpack(buf, target);
|
|
661
|
+
await (await this.getTarPool()).unpack(buf, target, tarballFormat(r.resolved));
|
|
660
662
|
} catch (er) {
|
|
661
663
|
throw this.#resolveError(
|
|
662
664
|
spec,
|
|
@@ -1199,7 +1201,7 @@ var PackageInfoClient = class {
|
|
|
1199
1201
|
const buf = response.buffer();
|
|
1200
1202
|
const integrity = storedIntegrity(response);
|
|
1201
1203
|
try {
|
|
1202
|
-
await (await this.getTarPool()).unpack(buf, dir);
|
|
1204
|
+
await (await this.getTarPool()).unpack(buf, dir, tarballFormat(remoteURL));
|
|
1203
1205
|
} catch (er) {
|
|
1204
1206
|
throw this.#resolveError(
|
|
1205
1207
|
s,
|
|
@@ -12,43 +12,12 @@ var require = _vlt_createRequire(import.meta.filename);
|
|
|
12
12
|
import {
|
|
13
13
|
source_default
|
|
14
14
|
} from "./chunk-WGDTG44V.js";
|
|
15
|
+
import {
|
|
16
|
+
loadPackageJson
|
|
17
|
+
} from "./chunk-E74WGW5C.js";
|
|
15
18
|
import {
|
|
16
19
|
commandAliases
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
|
|
19
|
-
// ../../node_modules/.vlt/~npm~package-json-from-dist@1.0.1/node_modules/package-json-from-dist/dist/esm/index.js
|
|
20
|
-
import { readFileSync } from "node:fs";
|
|
21
|
-
import { dirname, resolve, sep } from "node:path";
|
|
22
|
-
import { fileURLToPath } from "node:url";
|
|
23
|
-
var NM = `${sep}node_modules${sep}`;
|
|
24
|
-
var STORE = `.store${sep}`;
|
|
25
|
-
var PKG = `${sep}package${sep}`;
|
|
26
|
-
var DIST = `${sep}dist${sep}`;
|
|
27
|
-
var findPackageJson = (from, pathFromSrc = "../package.json") => {
|
|
28
|
-
const f = typeof from === "object" || from.startsWith("file://") ? fileURLToPath(from) : from;
|
|
29
|
-
const __dirname = dirname(f);
|
|
30
|
-
const nms = __dirname.lastIndexOf(NM);
|
|
31
|
-
if (nms !== -1) {
|
|
32
|
-
const nm = __dirname.substring(0, nms + NM.length);
|
|
33
|
-
const pkgDir = __dirname.substring(nms + NM.length);
|
|
34
|
-
if (pkgDir.startsWith(STORE)) {
|
|
35
|
-
const pkg = pkgDir.indexOf(PKG, STORE.length);
|
|
36
|
-
if (pkg) {
|
|
37
|
-
return resolve(nm, pkgDir.substring(0, pkg + PKG.length), "package.json");
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const pkgName = pkgDir.startsWith("@") ? pkgDir.split(sep, 2).join(sep) : String(pkgDir.split(sep)[0]);
|
|
41
|
-
return resolve(nm, pkgName, "package.json");
|
|
42
|
-
} else {
|
|
43
|
-
const d = __dirname.lastIndexOf(DIST);
|
|
44
|
-
if (d !== -1) {
|
|
45
|
-
return resolve(__dirname.substring(0, d), "package.json");
|
|
46
|
-
} else {
|
|
47
|
-
return resolve(__dirname, pathFromSrc);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
var loadPackageJson = (from, pathFromSrc = "../package.json") => JSON.parse(readFileSync(findPackageJson(from, pathFromSrc), "utf8"));
|
|
20
|
+
} from "./chunk-EFHOWRKU.js";
|
|
52
21
|
|
|
53
22
|
// ../../src/cli-sdk/src/custom-help.ts
|
|
54
23
|
var { version } = loadPackageJson(
|
|
@@ -227,6 +196,10 @@ var commandHelp = {
|
|
|
227
196
|
desc: "Configure your vlt.io account registries",
|
|
228
197
|
defaultOrder: 0
|
|
229
198
|
},
|
|
199
|
+
skills: {
|
|
200
|
+
args: "[list|link]",
|
|
201
|
+
desc: "Manage agent skills from installed packages"
|
|
202
|
+
},
|
|
230
203
|
token: {
|
|
231
204
|
args: "[add|rm]",
|
|
232
205
|
desc: "Manage authentication tokens"
|
|
@@ -403,7 +376,6 @@ ${s("dim", `Run \`vlt help <command>\` for detailed information about a specific
|
|
|
403
376
|
};
|
|
404
377
|
|
|
405
378
|
export {
|
|
406
|
-
loadPackageJson,
|
|
407
379
|
generateDefaultHelp,
|
|
408
380
|
generateFullHelp
|
|
409
381
|
};
|
|
@@ -11,15 +11,17 @@ 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-LCLRP64K.js";
|
|
15
15
|
import {
|
|
16
16
|
Monorepo,
|
|
17
17
|
PackageJson,
|
|
18
|
-
PathScurry
|
|
19
|
-
|
|
18
|
+
PathScurry,
|
|
19
|
+
workspaceCache
|
|
20
|
+
} from "./chunk-TQQO2F56.js";
|
|
20
21
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
ensureGlobalProject,
|
|
23
|
+
globalCommands
|
|
24
|
+
} from "./chunk-MCDLJZXT.js";
|
|
23
25
|
import {
|
|
24
26
|
commands,
|
|
25
27
|
defaultValues,
|
|
@@ -28,16 +30,20 @@ import {
|
|
|
28
30
|
isRecordField,
|
|
29
31
|
recordFields,
|
|
30
32
|
storeLinkers
|
|
31
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-EFHOWRKU.js";
|
|
34
|
+
import {
|
|
35
|
+
resetCaches
|
|
36
|
+
} from "./chunk-CAV7FKWQ.js";
|
|
32
37
|
import {
|
|
33
38
|
find,
|
|
34
39
|
load,
|
|
35
40
|
reload,
|
|
36
|
-
save
|
|
41
|
+
save,
|
|
42
|
+
unload
|
|
37
43
|
} from "./chunk-HTOTG4TS.js";
|
|
38
44
|
import {
|
|
39
45
|
storeRoot
|
|
40
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-4GMNWW4C.js";
|
|
41
47
|
import {
|
|
42
48
|
cloneAvailable
|
|
43
49
|
} from "./chunk-6IF3RJND.js";
|
|
@@ -51,14 +57,15 @@ import {
|
|
|
51
57
|
getOptions,
|
|
52
58
|
isObject,
|
|
53
59
|
isRecordStringString
|
|
54
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-BF5DRGRZ.js";
|
|
55
61
|
import {
|
|
56
62
|
error
|
|
57
63
|
} from "./chunk-WZWDS3W4.js";
|
|
58
64
|
|
|
59
65
|
// ../../src/cli-sdk/src/config/index.ts
|
|
60
66
|
import { readFile, rm, writeFile } from "node:fs/promises";
|
|
61
|
-
import {
|
|
67
|
+
import { homedir } from "node:os";
|
|
68
|
+
import { dirname, isAbsolute, resolve } from "node:path";
|
|
62
69
|
|
|
63
70
|
// ../../src/cli-sdk/src/config/merge.ts
|
|
64
71
|
var merge = (base, add) => Object.fromEntries(
|
|
@@ -252,6 +259,7 @@ var recordsToPairs = (obj) => {
|
|
|
252
259
|
};
|
|
253
260
|
var kRecord = /* @__PURE__ */ Symbol("parsed key=value record");
|
|
254
261
|
var envKey = (k) => `VLT_${k.replace(/[^a-zA-Z0-9]+/g, "_").toUpperCase()}`;
|
|
262
|
+
var expandHome = (p) => p.replace(/^~(?=$|[\\/])/, homedir());
|
|
255
263
|
var kParentEnv = "__VLT_INTERNAL_EXPLICIT";
|
|
256
264
|
var parentEnv = () => {
|
|
257
265
|
try {
|
|
@@ -292,7 +300,9 @@ var Config = class _Config {
|
|
|
292
300
|
if (this.#options) return this.#options;
|
|
293
301
|
const scurry = new PathScurry(this.projectRoot);
|
|
294
302
|
const packageJson = new PackageJson();
|
|
295
|
-
const asRecords = pairsToRecords(
|
|
303
|
+
const { path: _, ...asRecords } = pairsToRecords(
|
|
304
|
+
this.parse().values
|
|
305
|
+
);
|
|
296
306
|
const extras = {
|
|
297
307
|
projectRoot: this.projectRoot,
|
|
298
308
|
signal: this.#abort.signal,
|
|
@@ -350,6 +360,7 @@ var Config = class _Config {
|
|
|
350
360
|
this.projectRoot = projectRoot;
|
|
351
361
|
this.#options = void 0;
|
|
352
362
|
resetCaches();
|
|
363
|
+
workspaceCache.clear();
|
|
353
364
|
}
|
|
354
365
|
// memoized options() getter value
|
|
355
366
|
#options;
|
|
@@ -376,6 +387,28 @@ var Config = class _Config {
|
|
|
376
387
|
* `~/projects/xyz`, then the highest dir it will check is `~/projects`
|
|
377
388
|
*/
|
|
378
389
|
projectRoot;
|
|
390
|
+
/**
|
|
391
|
+
* Global project root, set when `--global` switched to it.
|
|
392
|
+
*/
|
|
393
|
+
globalRoot;
|
|
394
|
+
/**
|
|
395
|
+
* `--global-bin-dir` from cli, env or user config, set with
|
|
396
|
+
* `globalRoot`.
|
|
397
|
+
*/
|
|
398
|
+
globalBinDir;
|
|
399
|
+
// the global project of the `setup` wizard, not switched to
|
|
400
|
+
#setupGlobal;
|
|
401
|
+
/**
|
|
402
|
+
* The global project (`--global-dir`, `--global-bin-dir`: cli > env >
|
|
403
|
+
* user config, never a project `vlt.json`): the one switched to by
|
|
404
|
+
* `--global`, or the one `vlt setup` offers PATH setup for.
|
|
405
|
+
*/
|
|
406
|
+
globalProject() {
|
|
407
|
+
if (this.globalRoot) {
|
|
408
|
+
return { root: this.globalRoot, binDir: this.globalBinDir };
|
|
409
|
+
}
|
|
410
|
+
return this.#setupGlobal;
|
|
411
|
+
}
|
|
379
412
|
/**
|
|
380
413
|
* `Record<alias, canonical name>` to dereference command aliases.
|
|
381
414
|
*/
|
|
@@ -399,6 +432,10 @@ var Config = class _Config {
|
|
|
399
432
|
const badLinker = process.env.VLT_STORE_LINKER;
|
|
400
433
|
const fixLinker = badLinker !== void 0 && !storeLinkers.includes(badLinker);
|
|
401
434
|
if (fixLinker) process.env.VLT_STORE_LINKER = "unpack";
|
|
435
|
+
const noModifyPath = process.env.VLT_NO_MODIFY_PATH;
|
|
436
|
+
if (noModifyPath !== void 0) {
|
|
437
|
+
process.env.VLT_NO_MODIFY_PATH = noModifyPath === "" || noModifyPath === "0" ? "0" : "1";
|
|
438
|
+
}
|
|
402
439
|
const envKeys = Object.keys(defaultValues).filter(
|
|
403
440
|
(k) => process.env[envKey(k)] !== void 0
|
|
404
441
|
);
|
|
@@ -447,7 +484,20 @@ var Config = class _Config {
|
|
|
447
484
|
if (cmdOrFallback !== "config") {
|
|
448
485
|
assertSpecAliases(pairsToRecords(p.values));
|
|
449
486
|
}
|
|
487
|
+
const binDirKey = envKey("global-bin-dir");
|
|
488
|
+
const keepBinDir = !this.globalRoot && !cliKeys.includes("global-bin-dir");
|
|
489
|
+
const binDirEnv = process.env[binDirKey];
|
|
450
490
|
this.jack.writeEnv(p);
|
|
491
|
+
delete process.env[envKey("global")];
|
|
492
|
+
if (this.globalRoot) {
|
|
493
|
+
process.env[envKey("global-dir")] = this.globalRoot;
|
|
494
|
+
if (this.globalBinDir)
|
|
495
|
+
process.env[binDirKey] = this.globalBinDir;
|
|
496
|
+
else delete process.env[binDirKey];
|
|
497
|
+
} else if (keepBinDir) {
|
|
498
|
+
if (binDirEnv === void 0) delete process.env[binDirKey];
|
|
499
|
+
else process.env[binDirKey] = binDirEnv;
|
|
500
|
+
}
|
|
451
501
|
process.env[kParentEnv] = JSON.stringify({
|
|
452
502
|
explicit,
|
|
453
503
|
env: Object.fromEntries(
|
|
@@ -724,13 +774,89 @@ var Config = class _Config {
|
|
|
724
774
|
/**
|
|
725
775
|
* Find the local config file and load both it and the user-level config in
|
|
726
776
|
* the XDG config home.
|
|
777
|
+
*
|
|
778
|
+
* When `args` select a `--global` command, the global project is used
|
|
779
|
+
* instead of the current one.
|
|
727
780
|
*/
|
|
728
|
-
async loadConfigFile() {
|
|
781
|
+
async loadConfigFile(args) {
|
|
729
782
|
await this.#maybeLoadConfigFile("user");
|
|
783
|
+
const g = args && this.#globalProject(args);
|
|
784
|
+
if (g?.switch) {
|
|
785
|
+
const { root } = g;
|
|
786
|
+
try {
|
|
787
|
+
ensureGlobalProject(root);
|
|
788
|
+
} catch (cause) {
|
|
789
|
+
throw error("Could not create the global project", {
|
|
790
|
+
code: "ECONFIG",
|
|
791
|
+
found: root,
|
|
792
|
+
cause
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
this.globalBinDir = g.binDir;
|
|
796
|
+
unload("project");
|
|
797
|
+
this.globalRoot = this.projectRoot = root;
|
|
798
|
+
} else if (g) {
|
|
799
|
+
this.#setupGlobal = { root: g.root, binDir: g.binDir };
|
|
800
|
+
}
|
|
730
801
|
this.projectRoot = dirname(find("project", this.projectRoot));
|
|
731
802
|
await this.#maybeLoadConfigFile("project");
|
|
732
803
|
return this;
|
|
733
804
|
}
|
|
805
|
+
// global project if `args` run a global command with --global, or
|
|
806
|
+
// `setup`. cli > env > user config, project config is not loaded yet.
|
|
807
|
+
// `switch`: use it as the project (not for the setup wizard)
|
|
808
|
+
#globalProject(args) {
|
|
809
|
+
const { values, positionals } = this.jack.parseRaw(args);
|
|
810
|
+
const cmd = getCommand(positionals[0]);
|
|
811
|
+
if (values.help || !cmd) return;
|
|
812
|
+
const setup = cmd === "setup";
|
|
813
|
+
if (!setup && !globalCommands.has(cmd)) return;
|
|
814
|
+
if (!setup) {
|
|
815
|
+
const env = process.env[envKey("global")];
|
|
816
|
+
const global = values.global ?? (env !== void 0 ? env === "1" : this.#defaults().global === true);
|
|
817
|
+
if (!global) return;
|
|
818
|
+
}
|
|
819
|
+
return {
|
|
820
|
+
root: this.#globalDir(values["global-dir"]),
|
|
821
|
+
binDir: this.#globalBinDir(args),
|
|
822
|
+
switch: !setup || values.path === true
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
#globalDir(cli) {
|
|
826
|
+
const dir = cli || process.env[envKey("global-dir")];
|
|
827
|
+
if (dir) return resolve(expandHome(dir));
|
|
828
|
+
const user = expandHome(
|
|
829
|
+
String(
|
|
830
|
+
this.#defaults()["global-dir"] || defaultValues["global-dir"]
|
|
831
|
+
)
|
|
832
|
+
);
|
|
833
|
+
if (!isAbsolute(user)) {
|
|
834
|
+
throw error("global-dir in the user config must be absolute", {
|
|
835
|
+
code: "ECONFIG",
|
|
836
|
+
found: user
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
return resolve(user);
|
|
840
|
+
}
|
|
841
|
+
// cli > env > user config, like `#globalProject`
|
|
842
|
+
#globalBinDir(args) {
|
|
843
|
+
const { values } = this.jack.parseRaw(args);
|
|
844
|
+
const dir = values["global-bin-dir"] || process.env[envKey("global-bin-dir")];
|
|
845
|
+
if (dir) return resolve(expandHome(dir));
|
|
846
|
+
const user = this.#defaults()["global-bin-dir"];
|
|
847
|
+
if (typeof user !== "string" || !user) return;
|
|
848
|
+
const p = expandHome(user);
|
|
849
|
+
if (!isAbsolute(p)) {
|
|
850
|
+
throw error(
|
|
851
|
+
"global-bin-dir in the user config must be absolute",
|
|
852
|
+
{
|
|
853
|
+
code: "ECONFIG",
|
|
854
|
+
found: p
|
|
855
|
+
}
|
|
856
|
+
);
|
|
857
|
+
}
|
|
858
|
+
return resolve(p);
|
|
859
|
+
}
|
|
734
860
|
/**
|
|
735
861
|
* Clear cached config values to force re-reading from updated files.
|
|
736
862
|
* @internal
|
|
@@ -748,9 +874,9 @@ var Config = class _Config {
|
|
|
748
874
|
this.values = void 0;
|
|
749
875
|
this.positionals = void 0;
|
|
750
876
|
this.command = void 0;
|
|
751
|
-
const { unload } = await import("./src-JC3ZUYWO.js");
|
|
752
|
-
|
|
753
|
-
|
|
877
|
+
const { unload: unload2 } = await import("./src-JC3ZUYWO.js");
|
|
878
|
+
unload2("user");
|
|
879
|
+
unload2("project");
|
|
754
880
|
await this.#maybeLoadConfigFile("user");
|
|
755
881
|
await this.#maybeLoadConfigFile("project");
|
|
756
882
|
this.parse(this.#originalArgs);
|
|
@@ -763,10 +889,10 @@ var Config = class _Config {
|
|
|
763
889
|
* Load the configuration and return a Promise to a
|
|
764
890
|
* {@link Config} object
|
|
765
891
|
*/
|
|
766
|
-
static async load(projectRoot = process.cwd(), argv = process.argv, reload2 = false) {
|
|
892
|
+
static async load(projectRoot = process.cwd(), argv = process.argv, reload2 = false, allowGlobal = true) {
|
|
767
893
|
if (this.#loaded && !reload2) return this.#loaded;
|
|
768
894
|
const a = new _Config(definition, projectRoot);
|
|
769
|
-
const b = await a.loadConfigFile();
|
|
895
|
+
const b = await a.loadConfigFile(allowGlobal ? argv : void 0);
|
|
770
896
|
this.#loaded = b.parse(argv);
|
|
771
897
|
return this.#loaded;
|
|
772
898
|
}
|