@vltpkg/cli-sdk 1.0.0-rc.9 → 1.0.2

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 (227) hide show
  1. package/dist/commands/access.d.ts +23 -0
  2. package/dist/commands/access.js +251 -0
  3. package/dist/{esm/commands → commands}/bugs.d.ts +0 -1
  4. package/dist/{esm/commands → commands}/bugs.js +0 -1
  5. package/dist/{esm/commands → commands}/build.d.ts +1 -1
  6. package/dist/{esm/commands → commands}/build.js +1 -1
  7. package/dist/{esm/commands → commands}/cache.d.ts +1 -1
  8. package/dist/{esm/commands → commands}/cache.js +1 -1
  9. package/dist/{esm/commands → commands}/ci.d.ts +1 -1
  10. package/dist/{esm/commands → commands}/ci.js +12 -3
  11. package/dist/{esm/commands → commands}/config.d.ts +0 -1
  12. package/dist/{esm/commands → commands}/config.js +6 -1
  13. package/dist/commands/create.d.ts +9 -0
  14. package/dist/commands/create.js +103 -0
  15. package/dist/commands/deprecate.d.ts +14 -0
  16. package/dist/commands/deprecate.js +142 -0
  17. package/dist/commands/dist-tag.d.ts +22 -0
  18. package/dist/commands/dist-tag.js +179 -0
  19. package/dist/{esm/commands → commands}/docs.d.ts +0 -1
  20. package/dist/{esm/commands → commands}/docs.js +0 -1
  21. package/dist/{esm/commands → commands}/exec-cache.d.ts +1 -1
  22. package/dist/{esm/commands → commands}/exec-cache.js +1 -1
  23. package/dist/{esm/commands/run-exec.d.ts → commands/exec-local.d.ts} +0 -1
  24. package/dist/{esm/commands → commands}/exec-local.js +23 -1
  25. package/dist/{esm/commands → commands}/exec.d.ts +1 -1
  26. package/dist/{esm/commands → commands}/exec.js +85 -10
  27. package/dist/{esm/commands → commands}/help.d.ts +0 -1
  28. package/dist/{esm/commands → commands}/help.js +5 -1
  29. package/dist/{esm/commands → commands}/init.d.ts +0 -1
  30. package/dist/{esm/commands → commands}/init.js +31 -10
  31. package/dist/{esm/commands → commands}/install/reporter.d.ts +0 -1
  32. package/dist/{esm/commands → commands}/install/reporter.js +0 -1
  33. package/dist/{esm/commands → commands}/install.d.ts +22 -3
  34. package/dist/commands/install.js +152 -0
  35. package/dist/{esm/commands → commands}/list.d.ts +5 -2
  36. package/dist/{esm/commands → commands}/list.js +9 -10
  37. package/dist/{esm/commands → commands}/login.d.ts +0 -1
  38. package/dist/commands/login.js +35 -0
  39. package/dist/{esm/commands → commands}/logout.d.ts +1 -1
  40. package/dist/commands/logout.js +27 -0
  41. package/dist/{esm/commands → commands}/pack.d.ts +1 -1
  42. package/dist/{esm/commands → commands}/pack.js +91 -32
  43. package/dist/commands/ping.d.ts +18 -0
  44. package/dist/commands/ping.js +117 -0
  45. package/dist/{esm/commands → commands}/pkg.d.ts +0 -1
  46. package/dist/{esm/commands → commands}/pkg.js +27 -1
  47. package/dist/commands/profile.d.ts +14 -0
  48. package/dist/commands/profile.js +106 -0
  49. package/dist/{esm/commands → commands}/publish.d.ts +2 -2
  50. package/dist/{esm/commands → commands}/publish.js +70 -16
  51. package/dist/{esm/commands → commands}/query.d.ts +5 -2
  52. package/dist/{esm/commands → commands}/query.js +54 -11
  53. package/dist/commands/registry.d.ts +26 -0
  54. package/dist/commands/registry.js +99 -0
  55. package/dist/commands/repo.d.ts +17 -0
  56. package/dist/commands/repo.js +157 -0
  57. package/dist/{esm/commands/exec-local.d.ts → commands/run-exec.d.ts} +1 -1
  58. package/dist/commands/run-exec.js +41 -0
  59. package/dist/{esm/commands → commands}/run.d.ts +0 -1
  60. package/dist/{esm/commands → commands}/run.js +27 -1
  61. package/dist/commands/setup.d.ts +25 -0
  62. package/dist/commands/setup.js +155 -0
  63. package/dist/commands/token.d.ts +32 -0
  64. package/dist/commands/token.js +193 -0
  65. package/dist/{esm/commands → commands}/uninstall.d.ts +1 -1
  66. package/dist/{esm/commands → commands}/uninstall.js +15 -1
  67. package/dist/commands/unpublish.d.ts +16 -0
  68. package/dist/commands/unpublish.js +203 -0
  69. package/dist/{esm/commands → commands}/update.d.ts +1 -1
  70. package/dist/{esm/commands → commands}/update.js +7 -1
  71. package/dist/{esm/commands → commands}/version.d.ts +0 -1
  72. package/dist/{esm/commands → commands}/version.js +27 -1
  73. package/dist/commands/view.d.ts +23 -0
  74. package/dist/commands/view.js +335 -0
  75. package/dist/{esm/commands → commands}/whoami.d.ts +1 -1
  76. package/dist/commands/whoami.js +33 -0
  77. package/dist/{esm/config → config}/definition.d.ts +72 -19
  78. package/dist/{esm/config → config}/definition.js +157 -50
  79. package/dist/{esm/config → config}/index.d.ts +0 -1
  80. package/dist/{esm/config → config}/index.js +43 -2
  81. package/dist/{esm/config → config}/merge.d.ts +0 -1
  82. package/dist/{esm/config → config}/merge.js +0 -1
  83. package/dist/{esm/config → config}/usage.d.ts +0 -1
  84. package/dist/{esm/config → config}/usage.js +0 -1
  85. package/dist/{esm/custom-help.d.ts → custom-help.d.ts} +0 -1
  86. package/dist/{esm/custom-help.js → custom-help.js} +95 -120
  87. package/dist/{esm/exec-command.d.ts → exec-command.d.ts} +0 -1
  88. package/dist/{esm/exec-command.js → exec-command.js} +14 -8
  89. package/dist/{esm/index.d.ts → index.d.ts} +0 -1
  90. package/dist/{esm/index.js → index.js} +5 -2
  91. package/dist/{esm/load-command.d.ts → load-command.d.ts} +6 -1
  92. package/dist/{esm/load-command.js → load-command.js} +0 -1
  93. package/dist/mermaid-image-view.d.ts +18 -0
  94. package/dist/mermaid-image-view.js +36 -0
  95. package/dist/{esm/output.d.ts → output.d.ts} +2 -2
  96. package/dist/{esm/output.js → output.js} +70 -3
  97. package/dist/{esm/pack-tarball.d.ts → pack-tarball.d.ts} +15 -1
  98. package/dist/{esm/pack-tarball.js → pack-tarball.js} +133 -91
  99. package/dist/{esm/parse-add-remove-args.d.ts → parse-add-remove-args.d.ts} +0 -1
  100. package/dist/{esm/parse-add-remove-args.js → parse-add-remove-args.js} +65 -12
  101. package/dist/{esm/print-err.d.ts → print-err.d.ts} +0 -1
  102. package/dist/{esm/print-err.js → print-err.js} +28 -4
  103. package/dist/query-diff-files.d.ts +17 -0
  104. package/dist/query-diff-files.js +63 -0
  105. package/dist/{esm/query-host-contexts.d.ts → query-host-contexts.d.ts} +0 -1
  106. package/dist/{esm/query-host-contexts.js → query-host-contexts.js} +8 -7
  107. package/dist/{esm/read-password.d.ts → read-password.d.ts} +0 -1
  108. package/dist/{esm/read-password.js → read-password.js} +0 -1
  109. package/dist/read-project-folders.d.ts +17 -0
  110. package/dist/read-project-folders.js +100 -0
  111. package/dist/registry-error-message.d.ts +2 -0
  112. package/dist/registry-error-message.js +29 -0
  113. package/dist/reload-config.d.ts +2 -0
  114. package/dist/reload-config.js +11 -0
  115. package/dist/render-mermaid.d.ts +22 -0
  116. package/dist/render-mermaid.js +68 -0
  117. package/dist/require-registry.d.ts +48 -0
  118. package/dist/require-registry.js +122 -0
  119. package/dist/select-registry.d.ts +23 -0
  120. package/dist/select-registry.js +40 -0
  121. package/dist/telemetry.d.ts +58 -0
  122. package/dist/telemetry.js +170 -0
  123. package/dist/verbose-log.d.ts +31 -0
  124. package/dist/verbose-log.js +62 -0
  125. package/dist/{esm/view.d.ts → view.d.ts} +0 -1
  126. package/dist/{esm/view.js → view.js} +1 -2
  127. package/package.json +75 -82
  128. package/dist/esm/commands/bugs.d.ts.map +0 -1
  129. package/dist/esm/commands/bugs.js.map +0 -1
  130. package/dist/esm/commands/build.d.ts.map +0 -1
  131. package/dist/esm/commands/build.js.map +0 -1
  132. package/dist/esm/commands/cache.d.ts.map +0 -1
  133. package/dist/esm/commands/cache.js.map +0 -1
  134. package/dist/esm/commands/ci.d.ts.map +0 -1
  135. package/dist/esm/commands/ci.js.map +0 -1
  136. package/dist/esm/commands/config.d.ts.map +0 -1
  137. package/dist/esm/commands/config.js.map +0 -1
  138. package/dist/esm/commands/docs.d.ts.map +0 -1
  139. package/dist/esm/commands/docs.js.map +0 -1
  140. package/dist/esm/commands/exec-cache.d.ts.map +0 -1
  141. package/dist/esm/commands/exec-cache.js.map +0 -1
  142. package/dist/esm/commands/exec-local.d.ts.map +0 -1
  143. package/dist/esm/commands/exec-local.js.map +0 -1
  144. package/dist/esm/commands/exec.d.ts.map +0 -1
  145. package/dist/esm/commands/exec.js.map +0 -1
  146. package/dist/esm/commands/help.d.ts.map +0 -1
  147. package/dist/esm/commands/help.js.map +0 -1
  148. package/dist/esm/commands/init.d.ts.map +0 -1
  149. package/dist/esm/commands/init.js.map +0 -1
  150. package/dist/esm/commands/install/reporter.d.ts.map +0 -1
  151. package/dist/esm/commands/install/reporter.js.map +0 -1
  152. package/dist/esm/commands/install.d.ts.map +0 -1
  153. package/dist/esm/commands/install.js +0 -46
  154. package/dist/esm/commands/install.js.map +0 -1
  155. package/dist/esm/commands/list.d.ts.map +0 -1
  156. package/dist/esm/commands/list.js.map +0 -1
  157. package/dist/esm/commands/login.d.ts.map +0 -1
  158. package/dist/esm/commands/login.js +0 -13
  159. package/dist/esm/commands/login.js.map +0 -1
  160. package/dist/esm/commands/logout.d.ts.map +0 -1
  161. package/dist/esm/commands/logout.js +0 -13
  162. package/dist/esm/commands/logout.js.map +0 -1
  163. package/dist/esm/commands/pack.d.ts.map +0 -1
  164. package/dist/esm/commands/pack.js.map +0 -1
  165. package/dist/esm/commands/pkg.d.ts.map +0 -1
  166. package/dist/esm/commands/pkg.js.map +0 -1
  167. package/dist/esm/commands/publish.d.ts.map +0 -1
  168. package/dist/esm/commands/publish.js.map +0 -1
  169. package/dist/esm/commands/query.d.ts.map +0 -1
  170. package/dist/esm/commands/query.js.map +0 -1
  171. package/dist/esm/commands/run-exec.d.ts.map +0 -1
  172. package/dist/esm/commands/run-exec.js +0 -14
  173. package/dist/esm/commands/run-exec.js.map +0 -1
  174. package/dist/esm/commands/run.d.ts.map +0 -1
  175. package/dist/esm/commands/run.js.map +0 -1
  176. package/dist/esm/commands/serve.d.ts +0 -14
  177. package/dist/esm/commands/serve.d.ts.map +0 -1
  178. package/dist/esm/commands/serve.js +0 -103
  179. package/dist/esm/commands/serve.js.map +0 -1
  180. package/dist/esm/commands/token.d.ts +0 -4
  181. package/dist/esm/commands/token.d.ts.map +0 -1
  182. package/dist/esm/commands/token.js +0 -30
  183. package/dist/esm/commands/token.js.map +0 -1
  184. package/dist/esm/commands/uninstall.d.ts.map +0 -1
  185. package/dist/esm/commands/uninstall.js.map +0 -1
  186. package/dist/esm/commands/update.d.ts.map +0 -1
  187. package/dist/esm/commands/update.js.map +0 -1
  188. package/dist/esm/commands/version.d.ts.map +0 -1
  189. package/dist/esm/commands/version.js.map +0 -1
  190. package/dist/esm/commands/whoami.d.ts.map +0 -1
  191. package/dist/esm/commands/whoami.js +0 -19
  192. package/dist/esm/commands/whoami.js.map +0 -1
  193. package/dist/esm/config/definition.d.ts.map +0 -1
  194. package/dist/esm/config/definition.js.map +0 -1
  195. package/dist/esm/config/index.d.ts.map +0 -1
  196. package/dist/esm/config/index.js.map +0 -1
  197. package/dist/esm/config/merge.d.ts.map +0 -1
  198. package/dist/esm/config/merge.js.map +0 -1
  199. package/dist/esm/config/usage.d.ts.map +0 -1
  200. package/dist/esm/config/usage.js.map +0 -1
  201. package/dist/esm/custom-help.d.ts.map +0 -1
  202. package/dist/esm/custom-help.js.map +0 -1
  203. package/dist/esm/exec-command.d.ts.map +0 -1
  204. package/dist/esm/exec-command.js.map +0 -1
  205. package/dist/esm/index.d.ts.map +0 -1
  206. package/dist/esm/index.js.map +0 -1
  207. package/dist/esm/load-command.d.ts.map +0 -1
  208. package/dist/esm/load-command.js.map +0 -1
  209. package/dist/esm/output.d.ts.map +0 -1
  210. package/dist/esm/output.js.map +0 -1
  211. package/dist/esm/pack-tarball.d.ts.map +0 -1
  212. package/dist/esm/pack-tarball.js.map +0 -1
  213. package/dist/esm/package.json +0 -3
  214. package/dist/esm/parse-add-remove-args.d.ts.map +0 -1
  215. package/dist/esm/parse-add-remove-args.js.map +0 -1
  216. package/dist/esm/print-err.d.ts.map +0 -1
  217. package/dist/esm/print-err.js.map +0 -1
  218. package/dist/esm/query-host-contexts.d.ts.map +0 -1
  219. package/dist/esm/query-host-contexts.js.map +0 -1
  220. package/dist/esm/read-password.d.ts.map +0 -1
  221. package/dist/esm/read-password.js.map +0 -1
  222. package/dist/esm/start-gui.d.ts +0 -10
  223. package/dist/esm/start-gui.d.ts.map +0 -1
  224. package/dist/esm/start-gui.js +0 -60
  225. package/dist/esm/start-gui.js.map +0 -1
  226. package/dist/esm/view.d.ts.map +0 -1
  227. package/dist/esm/view.js.map +0 -1
@@ -0,0 +1,23 @@
1
+ import type { CommandFn, CommandUsage } from '../index.ts';
2
+ export declare const needsRegistry = true;
3
+ export declare const usage: CommandUsage;
4
+ export type AccessResult = {
5
+ package: string;
6
+ access: string;
7
+ } | {
8
+ packages: Record<string, string>;
9
+ } | {
10
+ granted: {
11
+ team: string;
12
+ permissions: string;
13
+ };
14
+ } | {
15
+ revoked: {
16
+ team: string;
17
+ };
18
+ };
19
+ export declare const views: {
20
+ readonly human: (result: AccessResult) => string;
21
+ readonly json: (r: AccessResult) => AccessResult;
22
+ };
23
+ export declare const command: CommandFn<AccessResult>;
@@ -0,0 +1,251 @@
1
+ import { error } from '@vltpkg/error-cause';
2
+ import { RegistryClient } from '@vltpkg/registry-client';
3
+ import { commandUsage } from "../config/usage.js";
4
+ import { resolveRegistry } from "../require-registry.js";
5
+ export const needsRegistry = true;
6
+ export const usage = () => commandUsage({
7
+ command: 'access',
8
+ usage: '<command> [<args>]',
9
+ description: `Set or get access levels for published packages
10
+ and manage team-based package permissions.
11
+
12
+ Target a specific configured registry by alias with
13
+ \`vlt registry <alias> access <subcommand>\`.`,
14
+ subcommands: {
15
+ 'list packages': {
16
+ usage: '[<scope|user|org>]',
17
+ description: 'List packages with access info for a scope, user, or org.',
18
+ },
19
+ 'get status': {
20
+ usage: '<package>',
21
+ description: 'Get the access/visibility status of a package.',
22
+ },
23
+ 'set status': {
24
+ usage: '<package>',
25
+ description: `Set the access/visibility of a package. Use --access to specify the level.`,
26
+ },
27
+ grant: {
28
+ usage: '<read-only|read-write> <scope:team> [<package>]',
29
+ description: 'Grant access to a scope:team for a package.',
30
+ },
31
+ revoke: {
32
+ usage: '<scope:team> [<package>]',
33
+ description: 'Revoke access from a scope:team for a package.',
34
+ },
35
+ },
36
+ options: {
37
+ registry: {
38
+ value: '<url>',
39
+ description: 'Registry URL to manage access on.',
40
+ },
41
+ otp: {
42
+ description: 'Provide an OTP for access changes.',
43
+ value: '<otp>',
44
+ },
45
+ },
46
+ });
47
+ export const views = {
48
+ human: (result) => {
49
+ if ('packages' in result) {
50
+ const entries = Object.entries(result.packages);
51
+ if (entries.length === 0)
52
+ return 'No packages found.';
53
+ return entries
54
+ .map(([name, access]) => `${name}: ${access}`)
55
+ .join('\n');
56
+ }
57
+ if ('granted' in result) {
58
+ return `Granted ${result.granted.permissions} access to ${result.granted.team}.`;
59
+ }
60
+ if ('revoked' in result) {
61
+ return `Revoked access from ${result.revoked.team}.`;
62
+ }
63
+ return `${result.package}: ${result.access}`;
64
+ },
65
+ json: (r) => r,
66
+ };
67
+ export const command = async (conf) => {
68
+ const [sub, ...args] = conf.positionals;
69
+ switch (sub) {
70
+ case 'list':
71
+ return listPackages(conf, args);
72
+ case 'get':
73
+ return getStatus(conf, args);
74
+ case 'set':
75
+ return setStatus(conf, args);
76
+ case 'grant':
77
+ return grant(conf, args);
78
+ case 'revoke':
79
+ return revoke(conf, args);
80
+ default: {
81
+ throw error('Invalid access subcommand', {
82
+ found: sub,
83
+ validOptions: ['list', 'get', 'set', 'grant', 'revoke'],
84
+ code: 'EUSAGE',
85
+ });
86
+ }
87
+ }
88
+ };
89
+ const encodePkgName = (name) => name.startsWith('@') ?
90
+ `@${encodeURIComponent(name.slice(1))}`
91
+ : encodeURIComponent(name);
92
+ const listPackages = async (conf, args) => {
93
+ const [keyword, entity] = args;
94
+ if (keyword !== 'packages') {
95
+ throw error('Expected `list packages [<scope|user|org>]`', {
96
+ found: keyword,
97
+ code: 'EUSAGE',
98
+ });
99
+ }
100
+ const rc = new RegistryClient(conf.options);
101
+ const registryUrl = new URL(await resolveRegistry(conf));
102
+ // Determine who to list for — use entity arg or fall back to scope from package.json
103
+ const scope = entity ?? getDefaultScope(conf);
104
+ const url = new URL(`-/org/${encodeURIComponent(scope)}/package`, registryUrl);
105
+ const response = await rc.request(url, { useCache: false });
106
+ const data = response.json();
107
+ return { packages: data };
108
+ };
109
+ const getStatus = async (conf, args) => {
110
+ const [keyword, pkg] = args;
111
+ if (keyword !== 'status') {
112
+ throw error('Expected `get status <package>`', {
113
+ found: keyword,
114
+ code: 'EUSAGE',
115
+ });
116
+ }
117
+ if (!pkg) {
118
+ throw error('Package name is required for `get status`', {
119
+ code: 'EUSAGE',
120
+ });
121
+ }
122
+ const rc = new RegistryClient(conf.options);
123
+ const registryUrl = new URL(await resolveRegistry(conf));
124
+ const url = new URL(`-/package/${encodePkgName(pkg)}/access`, registryUrl);
125
+ const response = await rc.request(url, { useCache: false });
126
+ const data = response.json();
127
+ return { package: pkg, access: data.access };
128
+ };
129
+ const setStatus = async (conf, args) => {
130
+ // vlt access set status=<public|restricted> <package>
131
+ const [statusArg, pkg] = args;
132
+ if (!statusArg?.startsWith('status=')) {
133
+ throw error('Expected `set status=<public|restricted> <package>`', { found: statusArg, code: 'EUSAGE' });
134
+ }
135
+ const accessLevel = statusArg.slice('status='.length);
136
+ if (accessLevel !== 'public' && accessLevel !== 'restricted') {
137
+ throw error('Access level must be `public` or `restricted`', {
138
+ found: accessLevel,
139
+ validOptions: ['public', 'restricted'],
140
+ code: 'EUSAGE',
141
+ });
142
+ }
143
+ if (!pkg) {
144
+ throw error('Package name is required for `set status`', {
145
+ code: 'EUSAGE',
146
+ });
147
+ }
148
+ const rc = new RegistryClient(conf.options);
149
+ const registryUrl = new URL(await resolveRegistry(conf));
150
+ const url = new URL(`-/package/${encodePkgName(pkg)}/access`, registryUrl);
151
+ await rc.request(url, {
152
+ method: 'PUT',
153
+ headers: { 'content-type': 'application/json' },
154
+ body: JSON.stringify({ access: accessLevel }),
155
+ otp: conf.options.otp,
156
+ useCache: false,
157
+ });
158
+ return { package: pkg, access: accessLevel };
159
+ };
160
+ const grant = async (conf, args) => {
161
+ // vlt access grant <read-only|read-write> <scope:team> [<package>]
162
+ const [permissions, scopeTeam, pkg] = args;
163
+ if (permissions !== 'read-only' && permissions !== 'read-write') {
164
+ throw error('Permissions must be `read-only` or `read-write`', {
165
+ found: permissions,
166
+ validOptions: ['read-only', 'read-write'],
167
+ code: 'EUSAGE',
168
+ });
169
+ }
170
+ if (!scopeTeam?.includes(':')) {
171
+ throw error('Team must be in the format `<scope>:<team>`', {
172
+ found: scopeTeam,
173
+ code: 'EUSAGE',
174
+ });
175
+ }
176
+ const [scope, team] = scopeTeam.split(':');
177
+ if (!scope || !team) {
178
+ throw error('Team must be in the format `<scope>:<team>`', {
179
+ found: scopeTeam,
180
+ code: 'EUSAGE',
181
+ });
182
+ }
183
+ const pkgName = pkg ?? getDefaultPkgName(conf);
184
+ const rc = new RegistryClient(conf.options);
185
+ const registryUrl = new URL(await resolveRegistry(conf));
186
+ const url = new URL(`-/team/${encodeURIComponent(scope)}/${encodeURIComponent(team)}/package`, registryUrl);
187
+ await rc.request(url, {
188
+ method: 'PUT',
189
+ headers: { 'content-type': 'application/json' },
190
+ body: JSON.stringify({
191
+ package: pkgName,
192
+ permissions,
193
+ }),
194
+ otp: conf.options.otp,
195
+ useCache: false,
196
+ });
197
+ return {
198
+ granted: {
199
+ team: `${scope}:${team}`,
200
+ permissions,
201
+ },
202
+ };
203
+ };
204
+ const revoke = async (conf, args) => {
205
+ // vlt access revoke <scope:team> [<package>]
206
+ const [scopeTeam, pkg] = args;
207
+ if (!scopeTeam?.includes(':')) {
208
+ throw error('Team must be in the format `<scope>:<team>`', {
209
+ found: scopeTeam,
210
+ code: 'EUSAGE',
211
+ });
212
+ }
213
+ const [scope, team] = scopeTeam.split(':');
214
+ if (!scope || !team) {
215
+ throw error('Team must be in the format `<scope>:<team>`', {
216
+ found: scopeTeam,
217
+ code: 'EUSAGE',
218
+ });
219
+ }
220
+ const pkgName = pkg ?? getDefaultPkgName(conf);
221
+ const rc = new RegistryClient(conf.options);
222
+ const registryUrl = new URL(await resolveRegistry(conf));
223
+ const url = new URL(`-/team/${encodeURIComponent(scope)}/${encodeURIComponent(team)}/package`, registryUrl);
224
+ await rc.request(url, {
225
+ method: 'DELETE',
226
+ headers: { 'content-type': 'application/json' },
227
+ body: JSON.stringify({ package: pkgName }),
228
+ otp: conf.options.otp,
229
+ useCache: false,
230
+ });
231
+ return {
232
+ revoked: {
233
+ team: `${scope}:${team}`,
234
+ },
235
+ };
236
+ };
237
+ const getDefaultScope = (conf) => {
238
+ const name = conf.options.packageJson.maybeRead(conf.projectRoot)?.name;
239
+ if (name?.startsWith('@')) {
240
+ const scope = name.split('/')[0];
241
+ if (scope)
242
+ return scope;
243
+ }
244
+ throw error('Could not determine scope. Provide a scope, user, or org.', { code: 'EUSAGE' });
245
+ };
246
+ const getDefaultPkgName = (conf) => {
247
+ const name = conf.options.packageJson.maybeRead(conf.projectRoot)?.name;
248
+ if (name)
249
+ return name;
250
+ throw error('Could not determine package name. Provide a package name or run from a package directory.', { code: 'EUSAGE' });
251
+ };
@@ -15,4 +15,3 @@ export declare const views: {
15
15
  };
16
16
  export declare const command: CommandFn<CommandResult>;
17
17
  export {};
18
- //# sourceMappingURL=bugs.d.ts.map
@@ -161,4 +161,3 @@ export const command = async (conf) => {
161
161
  await urlOpen(url);
162
162
  return { url, name };
163
163
  };
164
- //# sourceMappingURL=bugs.js.map
@@ -16,10 +16,10 @@ export declare const views: {
16
16
  message: string;
17
17
  };
18
18
  };
19
+ export declare const needsRegistry = true;
19
20
  export declare const usage: CommandUsage;
20
21
  /**
21
22
  * Build command implementation. Runs any required "postinstall"
22
23
  * lifecycle scripts and binary linking.
23
24
  */
24
25
  export declare const command: CommandFn<BuildResult>;
25
- //# sourceMappingURL=build.d.ts.map
@@ -38,6 +38,7 @@ export const views = {
38
38
  };
39
39
  },
40
40
  };
41
+ export const needsRegistry = true;
41
42
  export const usage = () => commandUsage({
42
43
  command: 'build',
43
44
  usage: ['[query]', '[--target=<query>]'],
@@ -99,4 +100,3 @@ export const command = async (conf) => {
99
100
  throw error('Build failed', { cause });
100
101
  }
101
102
  };
102
- //# sourceMappingURL=build.js.map
@@ -59,7 +59,7 @@ declare const usageDef: {
59
59
  };
60
60
  };
61
61
  };
62
+ export declare const needsRegistry = true;
62
63
  export declare const usage: CommandUsage;
63
64
  export declare const command: CommandFn<void | CacheMap>;
64
65
  export {};
65
- //# sourceMappingURL=cache.d.ts.map
@@ -80,6 +80,7 @@ const usageDef = {
80
80
  },
81
81
  },
82
82
  };
83
+ export const needsRegistry = true;
83
84
  export const usage = () => commandUsage(usageDef);
84
85
  export const command = async (conf) => {
85
86
  const [sub, ...args] = conf.positionals;
@@ -254,4 +255,3 @@ const add = async (conf, specs, view) => {
254
255
  }
255
256
  await Promise.all(promises);
256
257
  };
257
- //# sourceMappingURL=cache.js.map
@@ -2,10 +2,10 @@ import { InstallReporter } from './install/reporter.ts';
2
2
  import type { CommandFn, CommandUsage } from '../index.ts';
3
3
  import type { InstallResult } from './install.ts';
4
4
  export type CIResult = Omit<InstallResult, 'buildQueue'>;
5
+ export declare const needsRegistry = true;
5
6
  export declare const usage: CommandUsage;
6
7
  export declare const views: {
7
8
  readonly json: (i: CIResult) => import("@vltpkg/graph").LockfileData;
8
9
  readonly human: typeof InstallReporter;
9
10
  };
10
11
  export declare const command: CommandFn<CIResult>;
11
- //# sourceMappingURL=ci.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import { install } from '@vltpkg/graph';
2
2
  import { commandUsage } from "../config/usage.js";
3
3
  import { InstallReporter } from "./install/reporter.js";
4
+ export const needsRegistry = true;
4
5
  export const usage = () => commandUsage({
5
6
  command: 'ci',
6
7
  usage: '',
@@ -11,6 +12,15 @@ export const usage = () => commandUsage({
11
12
  examples: {
12
13
  '': { description: 'Clean install from lockfile' },
13
14
  },
15
+ options: {
16
+ 'allow-scripts': {
17
+ value: '<query>',
18
+ description: 'Filter which packages are allowed to run lifecycle scripts using DSS query syntax.',
19
+ },
20
+ 'lockfile-only': {
21
+ description: 'Only update lockfile and package.json files; skip node_modules operations.',
22
+ },
23
+ },
14
24
  });
15
25
  export const views = {
16
26
  json: i => i.graph.toJSON(),
@@ -19,8 +29,8 @@ export const views = {
19
29
  export const command = async (conf) => {
20
30
  const ciOptions = {
21
31
  ...conf.options,
22
- // allow all scripts by default on ci (unless user specifies a filter)
23
- allowScripts: conf.get('allow-scripts') ?? '*',
32
+ // allow scripts but filter out malware via security archive
33
+ allowScripts: conf.get('allow-scripts') ?? ':scripts:not(:malware)',
24
34
  expectLockfile: true,
25
35
  frozenLockfile: true,
26
36
  cleanInstall: true,
@@ -29,4 +39,3 @@ export const command = async (conf) => {
29
39
  const { graph } = await install(ciOptions);
30
40
  return { graph };
31
41
  };
32
- //# sourceMappingURL=ci.js.map
@@ -3,4 +3,3 @@ import type { Views } from '../view.ts';
3
3
  export declare const views: Views;
4
4
  export declare const usage: CommandUsage;
5
5
  export declare const command: CommandFn;
6
- //# sourceMappingURL=config.d.ts.map
@@ -18,6 +18,12 @@ export const usage = () => commandUsage({
18
18
  command: 'config',
19
19
  usage: '[<command>] [<args>]',
20
20
  description: 'Get or manipulate vlt configuration values',
21
+ options: {
22
+ config: {
23
+ value: '<all | user | project>',
24
+ description: 'Specify which configuration to show or operate on.',
25
+ },
26
+ },
21
27
  subcommands: {
22
28
  get: {
23
29
  usage: '[<key>] [--config=<all | user | project>]',
@@ -421,4 +427,3 @@ const configLocation = (conf) => {
421
427
  const configPath = find(effectiveConfig);
422
428
  return configPath;
423
429
  };
424
- //# sourceMappingURL=config.js.map
@@ -0,0 +1,9 @@
1
+ import type { PromptFn } from '@vltpkg/vlx';
2
+ import type { ExecResult } from '../exec-command.ts';
3
+ import type { CommandFn, CommandUsage } from '../index.ts';
4
+ export { views } from '../exec-command.ts';
5
+ export declare const needsRegistry = true;
6
+ export declare const usage: CommandUsage;
7
+ export declare const prettyPath: (path: string) => string;
8
+ export declare const promptFn: PromptFn;
9
+ export declare const command: CommandFn<ExecResult>;
@@ -0,0 +1,103 @@
1
+ import { exec, execFG } from '@vltpkg/run';
2
+ import * as vlx from '@vltpkg/vlx';
3
+ import { homedir } from 'node:os';
4
+ import { createInterface } from 'node:readline/promises';
5
+ import { commandUsage } from "../config/usage.js";
6
+ import { ExecCommand } from "../exec-command.js";
7
+ import { styleTextStdout } from "../output.js";
8
+ export { views } from "../exec-command.js";
9
+ export const needsRegistry = true;
10
+ export const usage = () => commandUsage({
11
+ command: 'create',
12
+ usage: '<initializer> [args...]',
13
+ description: `Initialize a new project from a template package.
14
+
15
+ Works like \`npm create\` and \`bun create\`, automatically
16
+ prepending "create-" to the package name and executing it.
17
+
18
+ For example, \`vlt create react-app my-app\` will fetch and
19
+ execute the \`create-react-app\` package with the arguments
20
+ \`my-app\`.
21
+
22
+ If a satisfying instance of the create package exists in the
23
+ local \`node_modules\` folder, then that will be used.
24
+
25
+ At no point will \`vlt create\` change the locally installed
26
+ dependencies. Any installs it performs is done in vlt's XDG
27
+ data directory.
28
+ `,
29
+ examples: {
30
+ 'react-app my-app': {
31
+ description: 'Create a new React app using create-react-app',
32
+ },
33
+ 'vite my-project': {
34
+ description: 'Create a new Vite project using create-vite',
35
+ },
36
+ '@scope/template my-app': {
37
+ description: 'Create a new project using @scope/create-template',
38
+ },
39
+ },
40
+ options: {
41
+ 'allow-scripts': {
42
+ value: '<query>',
43
+ description: 'Filter which packages are allowed to run lifecycle scripts using DSS query syntax.',
44
+ },
45
+ yes: {
46
+ description: 'Skip interactive prompts and accept defaults.',
47
+ },
48
+ },
49
+ });
50
+ const HOME = homedir();
51
+ export const prettyPath = (path) => path.startsWith(HOME) ? `~${path.substring(HOME.length)}` : path;
52
+ export const promptFn = async (pkgSpec, path, resolution) => {
53
+ const response = await createInterface(process.stdin, process.stdout).question(`About to install: ${styleTextStdout(['bgWhiteBright', 'black', 'bold'], String(pkgSpec))}
54
+ from: ${styleTextStdout(['bgWhiteBright', 'black', 'bold'], resolution)}
55
+ into: ${styleTextStdout(['bgWhiteBright', 'black', 'bold'], prettyPath(path))}
56
+ Is this ok? (y) `);
57
+ process.stdin.pause();
58
+ return response;
59
+ };
60
+ export const command = async (conf) => {
61
+ const [initializer, ...args] = conf.positionals;
62
+ if (!initializer) {
63
+ throw new Error('Missing required argument: <initializer>\n\nUsage: vlt create <initializer> [args...]');
64
+ }
65
+ // Transform the initializer to a create-* package name
66
+ // e.g., "react-app" -> "create-react-app"
67
+ // or "@scope/template" -> "@scope/create-template"
68
+ let packageName;
69
+ if (initializer.startsWith('@')) {
70
+ // Handle scoped packages: @scope/name -> @scope/create-name
71
+ const [scope, name] = initializer.split('/');
72
+ packageName = name ? `${scope}/create-${name}` : `${scope}/create`;
73
+ }
74
+ else {
75
+ // Handle regular packages: name -> create-name
76
+ packageName = `create-${initializer}`;
77
+ }
78
+ /* c8 ignore start */
79
+ const allowScripts = conf.get('allow-scripts') ?
80
+ String(conf.get('allow-scripts'))
81
+ : ':not(*)';
82
+ /* c8 ignore stop */
83
+ const yesFlag = conf.get('yes');
84
+ // Resolve the create-* package using vlx. We pass the package name as
85
+ // a synthetic positional so vlx treats it as the command to resolve —
86
+ // NOT the user's args (like "app"). Without this, vlx would mistake
87
+ // the first user arg as the executable to spawn.
88
+ const arg0 = await vlx.resolve([packageName], {
89
+ ...conf.options,
90
+ query: undefined,
91
+ allowScripts,
92
+ }, yesFlag ? async () => 'y' : promptFn);
93
+ // Set positionals to the resolved executable and the user's args
94
+ if (arg0) {
95
+ conf.positionals = [arg0, ...args];
96
+ }
97
+ else {
98
+ throw new Error(`Could not resolve executable for package "${packageName}"`);
99
+ }
100
+ // Execute the create package
101
+ delete conf.options['script-shell'];
102
+ return await new ExecCommand(conf, exec, execFG).run();
103
+ };
@@ -0,0 +1,14 @@
1
+ import type { CommandFn, CommandUsage } from '../index.ts';
2
+ export declare const needsRegistry = true;
3
+ export declare const usage: CommandUsage;
4
+ export type CommandResult = {
5
+ name: string;
6
+ version: string;
7
+ message: string;
8
+ versions: string[];
9
+ };
10
+ export declare const views: {
11
+ readonly human: (result: CommandResult) => string;
12
+ readonly json: (r: CommandResult) => CommandResult;
13
+ };
14
+ export declare const command: CommandFn<CommandResult>;