@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.
Files changed (105) hide show
  1. package/{access-422UGEWN.js → access-AJ654YKY.js} +13 -12
  2. package/{bugs-RED7Y33Q.js → bugs-N73DVYHD.js} +32 -25
  3. package/{build-IHMPBWRO.js → build-VZ3EZKMM.js} +65 -21
  4. package/{cache-FJP2RZJX.js → cache-VROEWG2C.js} +20 -17
  5. package/cache-unzip-src-unzip.js +58 -15
  6. package/{chunk-TPRK6IDA.js → chunk-22LZBDEC.js} +2 -2
  7. package/chunk-36UIE654.js +6248 -0
  8. package/{chunk-UGCKF5ZE.js → chunk-3JIN46K5.js} +1 -1
  9. package/{chunk-OAJ3PO3Z.js → chunk-44AWMA4F.js} +25 -13
  10. package/chunk-4E65BBTM.js +77 -0
  11. package/{chunk-SR2VOY5J.js → chunk-4GMNWW4C.js} +1 -1
  12. package/{chunk-5IJTPZXP.js → chunk-6D3QAFNZ.js} +1 -1
  13. package/{chunk-X4FVR4R5.js → chunk-75HGJVNG.js} +12 -10
  14. package/{chunk-THSYN5EK.js → chunk-7M2VTFLP.js} +12 -1
  15. package/{chunk-2AMOC4DN.js → chunk-ANW36H4T.js} +4 -4
  16. package/chunk-B6RIGNEO.js +626 -0
  17. package/{chunk-FLH4YC6W.js → chunk-BF5DRGRZ.js} +60 -15
  18. package/chunk-BH5CVXNY.js +115 -0
  19. package/{chunk-PLG3OYCX.js → chunk-CAV7FKWQ.js} +3 -2
  20. package/{chunk-C23TDXRG.js → chunk-CYK6I4M6.js} +1 -1
  21. package/chunk-DXED4ARV.js +436 -0
  22. package/chunk-E74WGW5C.js +49 -0
  23. package/{chunk-WF6KLKRN.js → chunk-EFHOWRKU.js} +103 -1
  24. package/chunk-EMTGRCSE.js +1111 -0
  25. package/{chunk-5Y4SYLJ2.js → chunk-EYGOEAJM.js} +1 -1
  26. package/{chunk-OVPHE4O7.js → chunk-F5LZMLAQ.js} +5335 -10902
  27. package/{chunk-HZXJ423P.js → chunk-FXD3IV2S.js} +4 -2
  28. package/chunk-GCTREKA4.js +115 -0
  29. package/{chunk-ZJMJ7MCT.js → chunk-GEQFMH5M.js} +1 -1
  30. package/{chunk-ISE4IRHF.js → chunk-GZVI75KX.js} +7 -14
  31. package/chunk-HOF7LEIC.js +24 -0
  32. package/{chunk-LHPEBLOU.js → chunk-HT6FS4VB.js} +1 -1
  33. package/{chunk-PHJJPY5G.js → chunk-IXAMCWIT.js} +5 -5
  34. package/{chunk-ASLX43R3.js → chunk-JCNI6ZHH.js} +7 -5
  35. package/chunk-JV5XR5JQ.js +349 -0
  36. package/{chunk-7T3XAYP4.js → chunk-KD5ZK72K.js} +1 -1
  37. package/{chunk-FZUYGJZU.js → chunk-KVWGMSPW.js} +137 -19
  38. package/{chunk-TO23PR7J.js → chunk-LCLRP64K.js} +14 -12
  39. package/{chunk-QCSUWACA.js → chunk-LGQVZTYR.js} +8 -36
  40. package/{chunk-5RHABCYI.js → chunk-LP3ORD3D.js} +143 -17
  41. package/chunk-MCDLJZXT.js +82 -0
  42. package/{chunk-DNRR3XMG.js → chunk-N6HV7JWC.js} +1 -1
  43. package/chunk-O6MQ7NN6.js +1155 -0
  44. package/{chunk-GIIAODRI.js → chunk-PC2HOBAQ.js} +7 -5
  45. package/{chunk-APMYKJI2.js → chunk-QNHBAGXQ.js} +1 -1
  46. package/chunk-RBQO54TG.js +59 -0
  47. package/chunk-SUU2WETN.js +268 -0
  48. package/{chunk-I7UMHYZX.js → chunk-TQQO2F56.js} +113 -1187
  49. package/{chunk-4UCADW6S.js → chunk-TWDSXQPN.js} +9 -7
  50. package/{chunk-MKWPTN3C.js → chunk-VLVMLSIF.js} +2 -2
  51. package/chunk-W4T5CGCO.js +52 -0
  52. package/{chunk-5TNXLRW2.js → chunk-YTDABXPD.js} +50 -12
  53. package/{ci-YSKNNO5M.js → ci-3BVMVQIT.js} +35 -13
  54. package/cli-package.json +3 -1
  55. package/{config-HO7GY3QT.js → config-2KQV7N5A.js} +16 -13
  56. package/{config-CSPCDMR3.js → config-EKHBW6I5.js} +12 -9
  57. package/{create-2TJT3AHJ.js → create-QVHNOIV3.js} +35 -29
  58. package/{deprecate-7FRJI2RL.js → deprecate-E254QBH6.js} +17 -15
  59. package/{dist-tag-WCFF5OEG.js → dist-tag-SITRFD7O.js} +13 -12
  60. package/{docs-JMBPTU23.js → docs-IDL2P7CA.js} +32 -25
  61. package/{exec-FBOUKZZ2.js → exec-7BK2W2WL.js} +35 -29
  62. package/{exec-cache-X3ZWM5S3.js → exec-cache-VY46L7DR.js} +27 -21
  63. package/{exec-local-Y3KQC22N.js → exec-local-D7R5T3DF.js} +26 -20
  64. package/{help-PUKVH5X7.js → help-RMRIEJQL.js} +6 -5
  65. package/{init-GOKAQXXZ.js → init-BGW4HJ6V.js} +15 -11
  66. package/{install-XFN4UFOC.js → install-U5GATZ2N.js} +144 -49
  67. package/{list-43JFFG5D.js → list-3VG4M2XL.js} +41 -28
  68. package/{login-RSTZKNKN.js → login-PHQWI6S6.js} +19 -16
  69. package/{logout-4576FFXZ.js → logout-DJCOGRFF.js} +13 -12
  70. package/{outdated-ACQ5A2Y7.js → outdated-JH3O6R3Y.js} +27 -22
  71. package/{pack-QQVJ3G25.js → pack-U5W5YWHK.js} +23 -18
  72. package/package.json +1 -1
  73. package/{ping-QCDQQRO5.js → ping-EKX43AOW.js} +13 -12
  74. package/{pkg-CSOJV7UC.js → pkg-SW5GMERT.js} +19 -14
  75. package/{profile-VL4HPW3N.js → profile-UGDRDMQ6.js} +13 -12
  76. package/{publish-2YBO6ZXE.js → publish-HTWKK3NN.js} +60 -45
  77. package/{query-IHHFMJRT.js → query-YE3FUVGG.js} +43 -30
  78. package/{registry-W7BRZZZ2.js → registry-ZGGWVLBM.js} +7 -7
  79. package/registry-client-src-revalidate.js +76 -22
  80. package/{repo-L3BXAAWS.js → repo-WDOCU6SE.js} +32 -25
  81. package/{reporter-5NYOHBO7.js → reporter-N5PAXB26.js} +121 -17
  82. package/{run-AMUUVLTI.js → run-IPARVIIQ.js} +26 -20
  83. package/{run-exec-5W3XWQZA.js → run-exec-C4RTREEW.js} +26 -20
  84. package/security-archive-src-update-expired.js +66 -21
  85. package/{setup-TFM4GJF7.js → setup-SYYUEHZL.js} +212 -32
  86. package/skills-KA2VR5Q5.js +480 -0
  87. package/skills-UBBMSBDQ.js +416 -0
  88. package/{src-4CYCUWZL.js → src-FUSTSM4J.js} +33 -22
  89. package/{src-I3GMULFP.js → src-QO5G2S4O.js} +11 -8
  90. package/{src-LUTN2ODD.js → src-W2VQULRG.js} +2 -2
  91. package/{token-OANOBE3G.js → token-UQNABECH.js} +15 -13
  92. package/{uninstall-YXTQ4AIZ.js → uninstall-FHBJ3OUV.js} +59 -18
  93. package/{unpublish-SZXYMYIU.js → unpublish-APJTEUBA.js} +31 -16
  94. package/{update-FHLMWGIM.js → update-NWZTL4S7.js} +52 -25
  95. package/{version-ZWFCTU5V.js → version-EMKKTL77.js} +20 -14
  96. package/{view-NFNJXMLV.js → view-BUUI33RV.js} +17 -15
  97. package/vlr.js +1 -1
  98. package/vlrx.js +1 -1
  99. package/vlt.js +1 -1
  100. package/vlx.js +1 -1
  101. package/vlxl.js +1 -1
  102. package/{whoami-O7GOSGCI.js → whoami-F6BSXGQ2.js} +13 -12
  103. package/chunk-G2YT2GWF.js +0 -120
  104. package/chunk-T6FBP4OU.js +0 -76
  105. package/chunk-U7TEQCBN.js +0 -880
@@ -11,38 +11,60 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  stdout
14
- } from "./chunk-FZUYGJZU.js";
15
- import "./chunk-QCSUWACA.js";
16
- import "./chunk-G2YT2GWF.js";
17
- import "./chunk-5Y4SYLJ2.js";
14
+ } from "./chunk-KVWGMSPW.js";
15
+ import "./chunk-LGQVZTYR.js";
16
+ import "./chunk-EYGOEAJM.js";
17
+ import {
18
+ commandUsage
19
+ } from "./chunk-HT6FS4VB.js";
18
20
  import {
19
21
  configWriteTarget,
20
22
  registrySelectionFields
21
- } from "./chunk-5RHABCYI.js";
22
- import "./chunk-TO23PR7J.js";
23
+ } from "./chunk-LP3ORD3D.js";
24
+ import "./chunk-LCLRP64K.js";
23
25
  import "./chunk-SRWDPPLX.js";
24
- import "./chunk-WGDTG44V.js";
25
26
  import {
26
- normalizeRegistryURL
27
- } from "./chunk-THSYN5EK.js";
27
+ applyPathSetup,
28
+ ask,
29
+ editPathHint,
30
+ pathSetupChanged,
31
+ pathSetupFiles,
32
+ pathSetupLines,
33
+ planPathSetup,
34
+ rcList,
35
+ resolveGlobalBinDir,
36
+ sourceCommand
37
+ } from "./chunk-O6MQ7NN6.js";
28
38
  import {
29
- commandUsage
30
- } from "./chunk-LHPEBLOU.js";
31
- import "./chunk-I7UMHYZX.js";
39
+ detectShell,
40
+ prettyPath,
41
+ shellPathCommand
42
+ } from "./chunk-BH5CVXNY.js";
43
+ import "./chunk-JV5XR5JQ.js";
44
+ import "./chunk-EMTGRCSE.js";
45
+ import "./chunk-TQQO2F56.js";
32
46
  import "./chunk-4KCU2KZL.js";
33
- import "./chunk-PLG3OYCX.js";
34
- import "./chunk-5IJTPZXP.js";
35
- import "./chunk-WF6KLKRN.js";
47
+ import "./chunk-WGDTG44V.js";
48
+ import "./chunk-E74WGW5C.js";
49
+ import "./chunk-GCTREKA4.js";
50
+ import "./chunk-MCDLJZXT.js";
51
+ import {
52
+ normalizeRegistryURL
53
+ } from "./chunk-7M2VTFLP.js";
54
+ import "./chunk-EFHOWRKU.js";
55
+ import "./chunk-CAV7FKWQ.js";
56
+ import "./chunk-6D3QAFNZ.js";
36
57
  import "./chunk-HTOTG4TS.js";
37
58
  import {
38
59
  RegistryClient,
39
60
  getKC,
40
61
  normalizeRegistryKey
41
- } from "./chunk-OAJ3PO3Z.js";
42
- import "./chunk-APMYKJI2.js";
43
- import "./chunk-SR2VOY5J.js";
44
- import "./chunk-ZJMJ7MCT.js";
45
- import "./chunk-U7TEQCBN.js";
62
+ } from "./chunk-44AWMA4F.js";
63
+ import "./chunk-QNHBAGXQ.js";
64
+ import "./chunk-GEQFMH5M.js";
65
+ import "./chunk-4GMNWW4C.js";
66
+ import "./chunk-SUU2WETN.js";
67
+ import "./chunk-B6RIGNEO.js";
46
68
  import "./chunk-XNLSTHDK.js";
47
69
  import "./chunk-6IF3RJND.js";
48
70
  import "./chunk-PDWPFR5T.js";
@@ -52,7 +74,7 @@ import {
52
74
  defaultRegistries,
53
75
  isErrorWithCause,
54
76
  isObject
55
- } from "./chunk-FLH4YC6W.js";
77
+ } from "./chunk-BF5DRGRZ.js";
56
78
  import {
57
79
  error
58
80
  } from "./chunk-WZWDS3W4.js";
@@ -88,8 +110,43 @@ var accountAuthError = (account, er) => isErrorWithCause(er) && isObject(er.caus
88
110
  ].join("\n"),
89
111
  { code: "ECONFIG", cause: er }
90
112
  ) : asError(er);
113
+ var pathView = (r, wizard = false) => {
114
+ if (r.status === "failed") {
115
+ return `\u26A0\uFE0F Could not add the global bin folder to your PATH: ${r.message}`;
116
+ }
117
+ const dir = prettyPath(r.dir);
118
+ const rcs = rcList(r.files);
119
+ const keep = process.platform === "win32" ? [` To keep it: ${editPathHint}`] : [];
120
+ switch (r.status) {
121
+ case "added":
122
+ return pathSetupLines(r, r.source).join("\n");
123
+ case "unchanged":
124
+ return [
125
+ `\u2705 ${dir} is already added to your PATH in ${rcs}`,
126
+ ` Open a new terminal, or run: ${r.source}`
127
+ ].join("\n");
128
+ case "in-path":
129
+ return wizard ? "" : `\u2705 ${dir} is already on your PATH`;
130
+ case "disabled":
131
+ return [
132
+ `\u2139\uFE0F no-modify-path is set, so nothing was changed. To add ${dir} to your PATH, run:`,
133
+ ` ${r.command}`,
134
+ ...keep
135
+ ].join("\n");
136
+ case "cancelled":
137
+ if (wizard) {
138
+ return `\u2139\uFE0F Skipped. Run \`vlt setup --path\` later to add ${dir} to your PATH.`;
139
+ }
140
+ return [
141
+ `Nothing changed. To add ${dir} to your PATH, run:`,
142
+ ` ${r.command}`,
143
+ ...keep
144
+ ].join("\n");
145
+ }
146
+ };
91
147
  var views = {
92
148
  human: (result) => {
149
+ if (!("account" in result)) return pathView(result.path);
93
150
  const lines = [
94
151
  `Configured ${Object.keys(result.registries).length} registry ${Object.keys(result.registries).length === 1 ? "alias" : "aliases"} for "${result.account}" in ${result.which} config:`
95
152
  ];
@@ -104,6 +161,8 @@ var views = {
104
161
  "to configure this project instead."
105
162
  );
106
163
  }
164
+ const path = result.path && pathView(result.path, true);
165
+ if (path) lines.push("", path);
107
166
  lines.push(
108
167
  "",
109
168
  "You can now install packages, e.g.:",
@@ -114,7 +173,10 @@ var views = {
114
173
  };
115
174
  var usage = () => commandUsage({
116
175
  command: "setup",
117
- usage: "[<account>]",
176
+ usage: [
177
+ "[<account>]",
178
+ "--path [--yes] [--global-bin-dir=<path>]"
179
+ ],
118
180
  description: `Configure the registry aliases for your vlt.io account so
119
181
  that \`vlt install\` and \`vlx\` work out of the box.
120
182
 
@@ -122,7 +184,19 @@ var usage = () => commandUsage({
122
184
  authenticates against your account, stores the token
123
185
  for both the \`npm\` and \`main\` registries, and writes
124
186
  those aliases (and any additional aliases you add) to
125
- your user \`vlt.json\`.`,
187
+ your user \`vlt.json\`.
188
+
189
+ In a terminal, if the global bin folder isn't on
190
+ your \`PATH\` or set up yet, it ends by asking
191
+ \`Setup PATH for global installs? (Y/n)\`: yes adds
192
+ it (same as \`--path\`), no skips it. Run
193
+ \`vlt setup --path\` later to do just that step.
194
+
195
+ With \`--path\`, add the global bin folder
196
+ (\`--global-bin-dir\`) to your \`PATH\` instead: writes
197
+ \`<global-dir>/env\` and a marked section that loads
198
+ it into your shell config. On Windows it adds it to
199
+ your user \`Path\` (\`HKCU\\Environment\`).`,
126
200
  options: {
127
201
  config: {
128
202
  value: "<user | project>",
@@ -133,15 +207,119 @@ var usage = () => commandUsage({
133
207
  description: "Additional registry aliases to stage non-interactively. Combine with `--yes` to run setup unattended."
134
208
  },
135
209
  yes: {
136
- description: "Skip interactive prompts (requires <account> and does not open a browser for authentication)."
210
+ description: "Skip interactive prompts (requires <account> and does not open a browser for authentication). With --path: edit without asking. Without --path: skips the PATH prompt."
211
+ },
212
+ path: {
213
+ description: "Only add the global bin folder to your PATH via your shell config (user Path on Windows)."
214
+ },
215
+ "global-bin-dir": {
216
+ value: "<path>",
217
+ description: "The folder to add to your PATH."
137
218
  }
138
219
  }
139
220
  });
221
+ var runPathSetup = async (o) => {
222
+ const root = o.globalDir;
223
+ const bin = await resolveGlobalBinDir({
224
+ projectRoot: root,
225
+ globalBinDir: o.globalBinDir
226
+ });
227
+ const shell = detectShell();
228
+ const base = {
229
+ dir: bin.dir,
230
+ shell,
231
+ files: [],
232
+ backups: [],
233
+ command: shellPathCommand(shell, bin.dir),
234
+ source: sourceCommand(shell, root, bin.dir)
235
+ };
236
+ if (bin.inPath) {
237
+ return { ...base, status: "in-path" };
238
+ }
239
+ if (o.noModifyPath) {
240
+ return { ...base, status: "disabled" };
241
+ }
242
+ const opts = { globalDir: root, dir: bin.dir, shell };
243
+ let plan = await planPathSetup(opts);
244
+ const files = pathSetupFiles(plan);
245
+ if (!pathSetupChanged(plan)) {
246
+ return { ...base, status: "unchanged", files };
247
+ }
248
+ if (!o.yes) {
249
+ if (!process.stdin.isTTY) {
250
+ throw error(
251
+ "Not a terminal: pass --yes to add it to your PATH",
252
+ {
253
+ code: "EUSAGE"
254
+ }
255
+ );
256
+ }
257
+ const answer = await (o.ask ?? ask)(
258
+ o.question({ dir: prettyPath(bin.dir), rcs: rcList(files) })
259
+ ).catch((er) => {
260
+ if (asError(er).name !== "AbortError") throw er;
261
+ process.stdout.write("\n");
262
+ return "n";
263
+ });
264
+ if (/^n/i.test(answer)) {
265
+ return { ...base, status: "cancelled", files };
266
+ }
267
+ plan = await planPathSetup(opts);
268
+ }
269
+ const r = await applyPathSetup(plan);
270
+ return {
271
+ ...base,
272
+ status: "added",
273
+ files: r.files,
274
+ backups: r.backups
275
+ };
276
+ };
277
+ var setupPath = async (conf, root) => {
278
+ if (conf.positionals.length) {
279
+ throw error("`vlt setup --path` takes no arguments", {
280
+ code: "EUSAGE",
281
+ found: conf.positionals[0]
282
+ });
283
+ }
284
+ return {
285
+ path: await runPathSetup({
286
+ globalDir: root,
287
+ globalBinDir: conf.globalBinDir,
288
+ yes: !!conf.get("yes"),
289
+ noModifyPath: !!conf.get("no-modify-path"),
290
+ question: ({ dir, rcs }) => `Add ${dir} to your PATH in ${rcs}? (Y/n) `
291
+ })
292
+ };
293
+ };
294
+ var offerPath = async (conf, yes, ask2) => {
295
+ if (yes || !process.stdin.isTTY || conf.get("no-modify-path")) {
296
+ return;
297
+ }
298
+ const g = conf.globalProject();
299
+ if (!g) return;
300
+ try {
301
+ return await runPathSetup({
302
+ globalDir: g.root,
303
+ globalBinDir: g.binDir,
304
+ question: () => "Setup PATH for global installs? (Y/n) ",
305
+ ask: ask2
306
+ });
307
+ } catch (er) {
308
+ const e = asError(er);
309
+ const found = isErrorWithCause(e) && isObject(e.cause) && typeof e.cause.found === "string" ? prettyPath(e.cause.found) : void 0;
310
+ return {
311
+ status: "failed",
312
+ message: found && !e.message.includes(found) ? `${e.message}: ${found}` : e.message
313
+ };
314
+ }
315
+ };
140
316
  var command = async (conf) => {
317
+ const root = conf.globalRoot;
318
+ if (root) return setupPath(conf, root);
141
319
  const yes = !!conf.get("yes");
142
320
  const which = configWriteTarget(conf, "user");
143
321
  let rl;
144
- const ask = async (question) => {
322
+ const ask2 = async (question) => {
145
323
  rl ??= createInterface(process.stdin, process.stdout);
146
324
  return (await rl.question(question)).trim();
147
325
  };
@@ -157,7 +335,7 @@ var command = async (conf) => {
157
335
  { code: "ECONFIG" }
158
336
  );
159
337
  }
160
- account = await ask("vlt.io account or organization slug: ");
338
+ account = await ask2("vlt.io account or organization slug: ");
161
339
  if (!account) {
162
340
  throw error("No account slug provided.", { code: "ECONFIG" });
163
341
  }
@@ -180,7 +358,7 @@ var command = async (conf) => {
180
358
  }
181
359
  const rc = new RegistryClient(conf.options);
182
360
  if (!yes) {
183
- const doAuth = await ask(
361
+ const doAuth = await ask2(
184
362
  "Authenticate with your vlt.io account now? (Y/n) "
185
363
  );
186
364
  if (!/^n/i.test(doAuth)) {
@@ -200,9 +378,9 @@ var command = async (conf) => {
200
378
  }
201
379
  }
202
380
  for (; ; ) {
203
- const more = await ask("Add another registry alias? (y/N) ");
381
+ const more = await ask2("Add another registry alias? (y/N) ");
204
382
  if (!/^y/i.test(more)) break;
205
- const name = await ask(" alias name: ");
383
+ const name = await ask2(" alias name: ");
206
384
  if (!name) {
207
385
  stdout(" alias name is required, skipping.");
208
386
  continue;
@@ -211,14 +389,14 @@ var command = async (conf) => {
211
389
  stdout(` alias "${name}" is already staged, skipping.`);
212
390
  continue;
213
391
  }
214
- const url = await ask(" registry url: ");
392
+ const url = await ask2(" registry url: ");
215
393
  if (!url) {
216
394
  stdout(" registry url is required, skipping.");
217
395
  continue;
218
396
  }
219
397
  const normalized = normalizeRegistryURL(url);
220
398
  registries[name] = normalized;
221
- const auth = await ask(
399
+ const auth = await ask2(
222
400
  ` authenticate against "${name}" now? (y/N) `
223
401
  );
224
402
  if (/^y/i.test(auth)) {
@@ -231,11 +409,13 @@ var command = async (conf) => {
231
409
  const shadowedByProject = which === "user" && registrySelectionFields.some(
232
410
  (f) => f in (conf.layers.project ?? {})
233
411
  );
412
+ const path = await offerPath(conf, yes, ask2);
234
413
  return {
235
414
  account,
236
415
  which,
237
416
  registries,
238
- ...shadowedByProject ? { shadowedByProject } : void 0
417
+ ...shadowedByProject ? { shadowedByProject } : void 0,
418
+ ...path ? { path } : void 0
239
419
  };
240
420
  } finally {
241
421
  if (rl) {