@vltpkg/cli-js 1.5.0 → 1.6.1

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 (99) hide show
  1. package/{access-QPX4QXV4.js → access-YSLEWR2C.js} +8 -8
  2. package/{bugs-TLOECXEM.js → bugs-S6CRUEA2.js} +23 -19
  3. package/{build-IQOS3LKO.js → build-SG3KPX3W.js} +49 -14
  4. package/{cache-O5IBYYSB.js → cache-HA77ROM7.js} +16 -13
  5. package/cache-unzip-src-unzip.js +23 -4
  6. package/{chunk-3S3W7QEM.js → chunk-3E3ISOYM.js} +10 -5
  7. package/{chunk-43EJ4Q42.js → chunk-3JIN46K5.js} +1 -1
  8. package/{chunk-5KW6AOTT.js → chunk-4GMNWW4C.js} +1 -1
  9. package/{chunk-6W5XMVIZ.js → chunk-4UAIPIAV.js} +7 -7
  10. package/{chunk-7UWRR6EE.js → chunk-5Q2HSLVV.js} +1 -1
  11. package/{chunk-LUVDMEW4.js → chunk-6D3QAFNZ.js} +1 -1
  12. package/{chunk-LH7J5BDU.js → chunk-6XVW7CWJ.js} +3 -3
  13. package/{chunk-UZ6ICZE3.js → chunk-7M2VTFLP.js} +12 -1
  14. package/{chunk-XCQCYB6G.js → chunk-AEVT3CHK.js} +142 -16
  15. package/{chunk-SMXXFQPI.js → chunk-AHLBPSGQ.js} +3 -3
  16. package/{chunk-6LZM3I4Q.js → chunk-BF5DRGRZ.js} +25 -4
  17. package/chunk-BH5CVXNY.js +115 -0
  18. package/{chunk-CS6AYPY5.js → chunk-BQMHDAYL.js} +6 -13
  19. package/{chunk-2U4PVHP4.js → chunk-C4RJ4NNS.js} +137 -47
  20. package/{chunk-F7NPYSI2.js → chunk-CAV7FKWQ.js} +2 -2
  21. package/chunk-DXED4ARV.js +436 -0
  22. package/chunk-E74WGW5C.js +49 -0
  23. package/{chunk-CMLDLZZ3.js → chunk-EFHOWRKU.js} +56 -0
  24. package/{chunk-IFEZ6BFV.js → chunk-EMTGRCSE.js} +2 -2
  25. package/{chunk-4TSHLSRK.js → chunk-EYGOEAJM.js} +1 -1
  26. package/{chunk-DBANBIL2.js → chunk-FZCPQWCJ.js} +1 -0
  27. package/chunk-GCTREKA4.js +115 -0
  28. package/{chunk-CW56EJIL.js → chunk-HT6FS4VB.js} +1 -1
  29. package/{chunk-VR7NRWAD.js → chunk-IHERL3TA.js} +17 -16
  30. package/chunk-JV5XR5JQ.js +349 -0
  31. package/{chunk-T5EP7QEF.js → chunk-JZXNHIQE.js} +28 -28
  32. package/{chunk-IJUVVD7E.js → chunk-KD5ZK72K.js} +1 -1
  33. package/{chunk-C6ZVVEFV.js → chunk-KURQHX54.js} +5 -3
  34. package/{chunk-GUP55DM6.js → chunk-L3ZF7OYM.js} +2 -2
  35. package/{chunk-X6JKMIOU.js → chunk-LGQVZTYR.js} +4 -36
  36. package/{chunk-G3FZ2ZJK.js → chunk-M242QVJS.js} +1 -1
  37. package/chunk-MCDLJZXT.js +82 -0
  38. package/{chunk-WHWPAYZY.js → chunk-MSWOR3FV.js} +35 -7
  39. package/chunk-N3V6EK5I.js +77 -0
  40. package/{chunk-ISAMD2FE.js → chunk-N6HV7JWC.js} +1 -1
  41. package/{chunk-MYX4JCIJ.js → chunk-NO53Y3QO.js} +1 -1
  42. package/chunk-O6MQ7NN6.js +1155 -0
  43. package/{chunk-XCSNI6AO.js → chunk-OWL5G4K4.js} +4 -4
  44. package/{chunk-35EG6T3J.js → chunk-Q2UEILN6.js} +21 -9
  45. package/{chunk-Z5D5KODU.js → chunk-VGPLFOJO.js} +4 -2
  46. package/{chunk-ARE7FKDG.js → chunk-W24SBFY5.js} +5 -5
  47. package/{chunk-XD5KUDXX.js → chunk-WMMKUVAT.js} +10 -8
  48. package/{chunk-4UH3KMTD.js → chunk-ZJE3OTP3.js} +258 -451
  49. package/{ci-ESVUMOZO.js → ci-GVLL72SS.js} +21 -17
  50. package/cli-package.json +3 -1
  51. package/{config-ZVVLFKR7.js → config-KH6AEMHI.js} +13 -12
  52. package/{config-TMB2X6DW.js → config-TIPKOPYS.js} +10 -9
  53. package/{create-BLTNKSBQ.js → create-SKNEZEZY.js} +28 -24
  54. package/{deprecate-VA6PGHYL.js → deprecate-RFRLJZVL.js} +12 -12
  55. package/{dist-tag-OYJREFO2.js → dist-tag-LVYOTJHJ.js} +8 -8
  56. package/{docs-6OC3OQNM.js → docs-INXRFEGY.js} +23 -19
  57. package/{exec-AZPGFVRY.js → exec-5MA5XRPZ.js} +28 -24
  58. package/{exec-cache-D75UY2WI.js → exec-cache-7GS4KLWJ.js} +24 -20
  59. package/{exec-local-E2JKB4X4.js → exec-local-RE4KVTMN.js} +22 -18
  60. package/{help-UPW77X5N.js → help-JHLP565L.js} +5 -4
  61. package/{init-SNO6QL7C.js → init-4UFHO67B.js} +13 -12
  62. package/{install-TEJM2YVX.js → install-Z33YVCDK.js} +108 -52
  63. package/{list-NHCC2RNB.js → list-XAMKR6TL.js} +29 -22
  64. package/{login-XNZXCGFD.js → login-6NXUO5FF.js} +14 -13
  65. package/{logout-YCM7O36Q.js → logout-6P7LWTAY.js} +8 -8
  66. package/{outdated-4LA7N63W.js → outdated-YNUSWZJD.js} +18 -17
  67. package/{pack-RC4CZSWF.js → pack-LMQYH75V.js} +15 -14
  68. package/package.json +1 -1
  69. package/{ping-RLVAZGDL.js → ping-VLFZ3WCY.js} +8 -8
  70. package/{pkg-FED5C6TP.js → pkg-JMPBHKSW.js} +16 -15
  71. package/{profile-DJZNLQPG.js → profile-PJJAA2YM.js} +8 -8
  72. package/{publish-54AMVMTQ.js → publish-33RFJ2HJ.js} +24 -20
  73. package/{query-ZQLMSJ7O.js → query-LUUOK57K.js} +29 -22
  74. package/{registry-6HKQYSZX.js → registry-ZGGWVLBM.js} +5 -5
  75. package/registry-client-src-revalidate.js +41 -11
  76. package/{repo-ITA4BLZ4.js → repo-VLHLQP2S.js} +23 -19
  77. package/{reporter-UYVR2WMB.js → reporter-SNSM2TDC.js} +61 -15
  78. package/{run-TP2HTJRN.js → run-USWK7R3N.js} +22 -18
  79. package/{run-exec-UGCC53DV.js → run-exec-PHE44AWW.js} +22 -18
  80. package/security-archive-src-update-expired.js +24 -5
  81. package/{setup-XPAM5U3Z.js → setup-JMY47ERY.js} +206 -27
  82. package/{skills-YD2TB2VD.js → skills-7PYMTDER.js} +41 -56
  83. package/{skills-LR6GXW3X.js → skills-YMMV6TMN.js} +24 -21
  84. package/{src-34D4DOOH.js → src-2ZS4VHJP.js} +25 -19
  85. package/{src-H6DFCAPH.js → src-A5ZJNOHN.js} +6 -4
  86. package/{src-LHDC4NJO.js → src-W2VQULRG.js} +2 -2
  87. package/{token-OF63PFTQ.js → token-YKHELNVQ.js} +10 -9
  88. package/{uninstall-B54FQ5KQ.js → uninstall-Q46HWR5S.js} +53 -17
  89. package/{unpublish-CSHIGMDQ.js → unpublish-LBANPSJ5.js} +8 -8
  90. package/{update-HS4VJ5ZG.js → update-B2EGLZHI.js} +19 -17
  91. package/{version-L7S3DHUS.js → version-IEOBL3NN.js} +14 -13
  92. package/{view-NWKKWFVA.js → view-JCA5VT6F.js} +13 -13
  93. package/vlr.js +1 -1
  94. package/vlrx.js +1 -1
  95. package/vlt.js +1 -1
  96. package/vlx.js +1 -1
  97. package/vlxl.js +1 -1
  98. package/{whoami-65K35VGW.js → whoami-OWJUPO3X.js} +8 -8
  99. package/chunk-T2VBCUF5.js +0 -77
@@ -12,39 +12,43 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  ExecCommand,
14
14
  views
15
- } from "./chunk-6W5XMVIZ.js";
16
- import "./chunk-43EJ4Q42.js";
15
+ } from "./chunk-4UAIPIAV.js";
16
+ import "./chunk-3JIN46K5.js";
17
17
  import "./chunk-RIYFGX27.js";
18
- import "./chunk-ARE7FKDG.js";
18
+ import "./chunk-W24SBFY5.js";
19
19
  import {
20
20
  run,
21
21
  runFG
22
- } from "./chunk-4UH3KMTD.js";
23
- import "./chunk-2U4PVHP4.js";
24
- import "./chunk-SMXXFQPI.js";
25
- import "./chunk-WHWPAYZY.js";
26
- import "./chunk-X6JKMIOU.js";
27
- import "./chunk-4TSHLSRK.js";
22
+ } from "./chunk-ZJE3OTP3.js";
23
+ import "./chunk-C4RJ4NNS.js";
24
+ import "./chunk-AHLBPSGQ.js";
25
+ import "./chunk-MSWOR3FV.js";
26
+ import "./chunk-LGQVZTYR.js";
27
+ import "./chunk-EYGOEAJM.js";
28
28
  import {
29
29
  commandUsage
30
- } from "./chunk-CW56EJIL.js";
30
+ } from "./chunk-HT6FS4VB.js";
31
31
  import "./chunk-VTEFO2FT.js";
32
- import "./chunk-IFEZ6BFV.js";
33
- import "./chunk-C6ZVVEFV.js";
32
+ import "./chunk-JV5XR5JQ.js";
33
+ import "./chunk-EMTGRCSE.js";
34
+ import "./chunk-KURQHX54.js";
34
35
  import "./chunk-4KCU2KZL.js";
35
36
  import "./chunk-WGDTG44V.js";
36
- import "./chunk-UZ6ICZE3.js";
37
- import "./chunk-CMLDLZZ3.js";
38
- import "./chunk-F7NPYSI2.js";
39
- import "./chunk-LUVDMEW4.js";
37
+ import "./chunk-E74WGW5C.js";
38
+ import "./chunk-GCTREKA4.js";
39
+ import "./chunk-MCDLJZXT.js";
40
+ import "./chunk-7M2VTFLP.js";
41
+ import "./chunk-EFHOWRKU.js";
42
+ import "./chunk-CAV7FKWQ.js";
43
+ import "./chunk-6D3QAFNZ.js";
40
44
  import "./chunk-HTOTG4TS.js";
41
- import "./chunk-G3FZ2ZJK.js";
45
+ import "./chunk-M242QVJS.js";
42
46
  import "./chunk-SUU2WETN.js";
43
47
  import "./chunk-B6RIGNEO.js";
44
48
  import "./chunk-XNLSTHDK.js";
45
49
  import "./chunk-PDWPFR5T.js";
46
50
  import "./chunk-Y5PA7DVK.js";
47
- import "./chunk-6LZM3I4Q.js";
51
+ import "./chunk-BF5DRGRZ.js";
48
52
  import "./chunk-WZWDS3W4.js";
49
53
  import "./chunk-PZLD7RTK.js";
50
54
 
@@ -12,39 +12,43 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  ExecCommand,
14
14
  views
15
- } from "./chunk-6W5XMVIZ.js";
16
- import "./chunk-43EJ4Q42.js";
15
+ } from "./chunk-4UAIPIAV.js";
16
+ import "./chunk-3JIN46K5.js";
17
17
  import "./chunk-RIYFGX27.js";
18
- import "./chunk-ARE7FKDG.js";
18
+ import "./chunk-W24SBFY5.js";
19
19
  import {
20
20
  runExec,
21
21
  runExecFG
22
- } from "./chunk-4UH3KMTD.js";
23
- import "./chunk-2U4PVHP4.js";
24
- import "./chunk-SMXXFQPI.js";
25
- import "./chunk-WHWPAYZY.js";
26
- import "./chunk-X6JKMIOU.js";
27
- import "./chunk-4TSHLSRK.js";
22
+ } from "./chunk-ZJE3OTP3.js";
23
+ import "./chunk-C4RJ4NNS.js";
24
+ import "./chunk-AHLBPSGQ.js";
25
+ import "./chunk-MSWOR3FV.js";
26
+ import "./chunk-LGQVZTYR.js";
27
+ import "./chunk-EYGOEAJM.js";
28
28
  import {
29
29
  commandUsage
30
- } from "./chunk-CW56EJIL.js";
30
+ } from "./chunk-HT6FS4VB.js";
31
31
  import "./chunk-VTEFO2FT.js";
32
- import "./chunk-IFEZ6BFV.js";
33
- import "./chunk-C6ZVVEFV.js";
32
+ import "./chunk-JV5XR5JQ.js";
33
+ import "./chunk-EMTGRCSE.js";
34
+ import "./chunk-KURQHX54.js";
34
35
  import "./chunk-4KCU2KZL.js";
35
36
  import "./chunk-WGDTG44V.js";
36
- import "./chunk-UZ6ICZE3.js";
37
- import "./chunk-CMLDLZZ3.js";
38
- import "./chunk-F7NPYSI2.js";
39
- import "./chunk-LUVDMEW4.js";
37
+ import "./chunk-E74WGW5C.js";
38
+ import "./chunk-GCTREKA4.js";
39
+ import "./chunk-MCDLJZXT.js";
40
+ import "./chunk-7M2VTFLP.js";
41
+ import "./chunk-EFHOWRKU.js";
42
+ import "./chunk-CAV7FKWQ.js";
43
+ import "./chunk-6D3QAFNZ.js";
40
44
  import "./chunk-HTOTG4TS.js";
41
- import "./chunk-G3FZ2ZJK.js";
45
+ import "./chunk-M242QVJS.js";
42
46
  import "./chunk-SUU2WETN.js";
43
47
  import "./chunk-B6RIGNEO.js";
44
48
  import "./chunk-XNLSTHDK.js";
45
49
  import "./chunk-PDWPFR5T.js";
46
50
  import "./chunk-Y5PA7DVK.js";
47
- import "./chunk-6LZM3I4Q.js";
51
+ import "./chunk-BF5DRGRZ.js";
48
52
  import "./chunk-WZWDS3W4.js";
49
53
  import "./chunk-PZLD7RTK.js";
50
54
 
@@ -1027,12 +1027,31 @@ var Comparator = class {
1027
1027
  );
1028
1028
  }
1029
1029
  #parseCaret(comp) {
1030
- const min = this.#xInclusiveMin(comp);
1031
- if (isAny(min)) {
1032
- this.tuples.push(min);
1030
+ const parsed = this.#parseX(comp);
1031
+ if (isXMajor(parsed)) {
1032
+ this.tuples.push(this.#getComparatorAny());
1033
1033
  return;
1034
1034
  }
1035
- const minv = min[1];
1035
+ const z = this.includePrerelease ? "0" : void 0;
1036
+ if (isXMinor(parsed)) {
1037
+ const [M2] = parsed;
1038
+ this.tuples.push(
1039
+ [">=", new Version(comp, M2, 0, 0, z, void 0)],
1040
+ ["<", new Version(comp, M2 + 1, 0, 0, "0", void 0)]
1041
+ );
1042
+ return;
1043
+ }
1044
+ if (isXPatch(parsed)) {
1045
+ const [M2, m2] = parsed;
1046
+ this.tuples.push(
1047
+ [">=", new Version(comp, M2, m2, 0, z, void 0)],
1048
+ M2 !== 0 ? ["<", new Version(comp, M2 + 1, 0, 0, "0", void 0)] : ["<", new Version(comp, 0, m2 + 1, 0, "0", void 0)]
1049
+ );
1050
+ return;
1051
+ }
1052
+ const [M, m, p, pr = z, build] = parsed;
1053
+ const minv = new Version(comp, M, m, p, pr, build);
1054
+ const min = [">=", minv];
1036
1055
  if (minv.major !== 0) {
1037
1056
  this.tuples.push(min, [
1038
1057
  "<",
@@ -2190,7 +2209,7 @@ var baseDepID = (id) => {
2190
2209
  var package_default = {
2191
2210
  name: "@vltpkg/user-agent",
2192
2211
  description: "The User-Agent string that vlt sends with every outbound request",
2193
- version: "1.5.0",
2212
+ version: "1.6.1",
2194
2213
  repository: {
2195
2214
  type: "git",
2196
2215
  url: "git+https://github.com/vltpkg/vltpkg.git",
@@ -11,37 +11,58 @@ 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-WHWPAYZY.js";
15
- import "./chunk-X6JKMIOU.js";
16
- import "./chunk-4TSHLSRK.js";
14
+ } from "./chunk-MSWOR3FV.js";
15
+ import "./chunk-LGQVZTYR.js";
16
+ import "./chunk-EYGOEAJM.js";
17
17
  import {
18
18
  commandUsage
19
- } from "./chunk-CW56EJIL.js";
19
+ } from "./chunk-HT6FS4VB.js";
20
20
  import {
21
21
  configWriteTarget,
22
22
  registrySelectionFields
23
- } from "./chunk-XCQCYB6G.js";
24
- import "./chunk-VR7NRWAD.js";
23
+ } from "./chunk-AEVT3CHK.js";
24
+ import "./chunk-IHERL3TA.js";
25
25
  import "./chunk-SRWDPPLX.js";
26
- import "./chunk-IFEZ6BFV.js";
27
- import "./chunk-C6ZVVEFV.js";
26
+ import {
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";
38
+ import {
39
+ detectShell,
40
+ prettyPath,
41
+ shellPathCommand
42
+ } from "./chunk-BH5CVXNY.js";
43
+ import "./chunk-JV5XR5JQ.js";
44
+ import "./chunk-EMTGRCSE.js";
45
+ import "./chunk-KURQHX54.js";
28
46
  import "./chunk-4KCU2KZL.js";
29
47
  import "./chunk-WGDTG44V.js";
48
+ import "./chunk-E74WGW5C.js";
49
+ import "./chunk-GCTREKA4.js";
50
+ import "./chunk-MCDLJZXT.js";
30
51
  import {
31
52
  normalizeRegistryURL
32
- } from "./chunk-UZ6ICZE3.js";
33
- import "./chunk-CMLDLZZ3.js";
34
- import "./chunk-F7NPYSI2.js";
35
- import "./chunk-LUVDMEW4.js";
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-35EG6T3J.js";
62
+ } from "./chunk-Q2UEILN6.js";
42
63
  import "./chunk-QNHBAGXQ.js";
43
- import "./chunk-G3FZ2ZJK.js";
44
- import "./chunk-5KW6AOTT.js";
64
+ import "./chunk-M242QVJS.js";
65
+ import "./chunk-4GMNWW4C.js";
45
66
  import "./chunk-SUU2WETN.js";
46
67
  import "./chunk-B6RIGNEO.js";
47
68
  import "./chunk-XNLSTHDK.js";
@@ -53,7 +74,7 @@ import {
53
74
  defaultRegistries,
54
75
  isErrorWithCause,
55
76
  isObject
56
- } from "./chunk-6LZM3I4Q.js";
77
+ } from "./chunk-BF5DRGRZ.js";
57
78
  import {
58
79
  error
59
80
  } from "./chunk-WZWDS3W4.js";
@@ -89,8 +110,43 @@ var accountAuthError = (account, er) => isErrorWithCause(er) && isObject(er.caus
89
110
  ].join("\n"),
90
111
  { code: "ECONFIG", cause: er }
91
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
+ };
92
147
  var views = {
93
148
  human: (result) => {
149
+ if (!("account" in result)) return pathView(result.path);
94
150
  const lines = [
95
151
  `Configured ${Object.keys(result.registries).length} registry ${Object.keys(result.registries).length === 1 ? "alias" : "aliases"} for "${result.account}" in ${result.which} config:`
96
152
  ];
@@ -105,6 +161,8 @@ var views = {
105
161
  "to configure this project instead."
106
162
  );
107
163
  }
164
+ const path = result.path && pathView(result.path, true);
165
+ if (path) lines.push("", path);
108
166
  lines.push(
109
167
  "",
110
168
  "You can now install packages, e.g.:",
@@ -115,7 +173,10 @@ var views = {
115
173
  };
116
174
  var usage = () => commandUsage({
117
175
  command: "setup",
118
- usage: "[<account>]",
176
+ usage: [
177
+ "[<account>]",
178
+ "--path [--yes] [--global-bin-dir=<path>]"
179
+ ],
119
180
  description: `Configure the registry aliases for your vlt.io account so
120
181
  that \`vlt install\` and \`vlx\` work out of the box.
121
182
 
@@ -123,7 +184,19 @@ var usage = () => commandUsage({
123
184
  authenticates against your account, stores the token
124
185
  for both the \`npm\` and \`main\` registries, and writes
125
186
  those aliases (and any additional aliases you add) to
126
- 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\`).`,
127
200
  options: {
128
201
  config: {
129
202
  value: "<user | project>",
@@ -134,15 +207,119 @@ var usage = () => commandUsage({
134
207
  description: "Additional registry aliases to stage non-interactively. Combine with `--yes` to run setup unattended."
135
208
  },
136
209
  yes: {
137
- 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."
138
218
  }
139
219
  }
140
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
+ };
141
316
  var command = async (conf) => {
317
+ const root = conf.globalRoot;
318
+ if (root) return setupPath(conf, root);
142
319
  const yes = !!conf.get("yes");
143
320
  const which = configWriteTarget(conf, "user");
144
321
  let rl;
145
- const ask = async (question) => {
322
+ const ask2 = async (question) => {
146
323
  rl ??= createInterface(process.stdin, process.stdout);
147
324
  return (await rl.question(question)).trim();
148
325
  };
@@ -158,7 +335,7 @@ var command = async (conf) => {
158
335
  { code: "ECONFIG" }
159
336
  );
160
337
  }
161
- account = await ask("vlt.io account or organization slug: ");
338
+ account = await ask2("vlt.io account or organization slug: ");
162
339
  if (!account) {
163
340
  throw error("No account slug provided.", { code: "ECONFIG" });
164
341
  }
@@ -181,7 +358,7 @@ var command = async (conf) => {
181
358
  }
182
359
  const rc = new RegistryClient(conf.options);
183
360
  if (!yes) {
184
- const doAuth = await ask(
361
+ const doAuth = await ask2(
185
362
  "Authenticate with your vlt.io account now? (Y/n) "
186
363
  );
187
364
  if (!/^n/i.test(doAuth)) {
@@ -201,9 +378,9 @@ var command = async (conf) => {
201
378
  }
202
379
  }
203
380
  for (; ; ) {
204
- const more = await ask("Add another registry alias? (y/N) ");
381
+ const more = await ask2("Add another registry alias? (y/N) ");
205
382
  if (!/^y/i.test(more)) break;
206
- const name = await ask(" alias name: ");
383
+ const name = await ask2(" alias name: ");
207
384
  if (!name) {
208
385
  stdout(" alias name is required, skipping.");
209
386
  continue;
@@ -212,14 +389,14 @@ var command = async (conf) => {
212
389
  stdout(` alias "${name}" is already staged, skipping.`);
213
390
  continue;
214
391
  }
215
- const url = await ask(" registry url: ");
392
+ const url = await ask2(" registry url: ");
216
393
  if (!url) {
217
394
  stdout(" registry url is required, skipping.");
218
395
  continue;
219
396
  }
220
397
  const normalized = normalizeRegistryURL(url);
221
398
  registries[name] = normalized;
222
- const auth = await ask(
399
+ const auth = await ask2(
223
400
  ` authenticate against "${name}" now? (y/N) `
224
401
  );
225
402
  if (/^y/i.test(auth)) {
@@ -232,11 +409,13 @@ var command = async (conf) => {
232
409
  const shadowedByProject = which === "user" && registrySelectionFields.some(
233
410
  (f) => f in (conf.layers.project ?? {})
234
411
  );
412
+ const path = await offerPath(conf, yes, ask2);
235
413
  return {
236
414
  account,
237
415
  which,
238
416
  registries,
239
- ...shadowedByProject ? { shadowedByProject } : void 0
417
+ ...shadowedByProject ? { shadowedByProject } : void 0,
418
+ ...path ? { path } : void 0
240
419
  };
241
420
  } finally {
242
421
  if (rl) {