@vltpkg/cli-sdk 0.0.0-10

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 (132) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +23 -0
  3. package/dist/esm/commands/cache.d.ts +65 -0
  4. package/dist/esm/commands/cache.d.ts.map +1 -0
  5. package/dist/esm/commands/cache.js +256 -0
  6. package/dist/esm/commands/cache.js.map +1 -0
  7. package/dist/esm/commands/config.d.ts +5 -0
  8. package/dist/esm/commands/config.d.ts.map +1 -0
  9. package/dist/esm/commands/config.js +153 -0
  10. package/dist/esm/commands/config.js.map +1 -0
  11. package/dist/esm/commands/exec-cache.d.ts +49 -0
  12. package/dist/esm/commands/exec-cache.d.ts.map +1 -0
  13. package/dist/esm/commands/exec-cache.js +125 -0
  14. package/dist/esm/commands/exec-cache.js.map +1 -0
  15. package/dist/esm/commands/exec-local.d.ts +6 -0
  16. package/dist/esm/commands/exec-local.d.ts.map +1 -0
  17. package/dist/esm/commands/exec-local.js +24 -0
  18. package/dist/esm/commands/exec-local.js.map +1 -0
  19. package/dist/esm/commands/exec.d.ts +9 -0
  20. package/dist/esm/commands/exec.d.ts.map +1 -0
  21. package/dist/esm/commands/exec.js +78 -0
  22. package/dist/esm/commands/exec.js.map +1 -0
  23. package/dist/esm/commands/gui.d.ts +6 -0
  24. package/dist/esm/commands/gui.d.ts.map +1 -0
  25. package/dist/esm/commands/gui.js +13 -0
  26. package/dist/esm/commands/gui.js.map +1 -0
  27. package/dist/esm/commands/help.d.ts +4 -0
  28. package/dist/esm/commands/help.d.ts.map +1 -0
  29. package/dist/esm/commands/help.js +10 -0
  30. package/dist/esm/commands/help.js.map +1 -0
  31. package/dist/esm/commands/init.d.ts +8 -0
  32. package/dist/esm/commands/init.d.ts.map +1 -0
  33. package/dist/esm/commands/init.js +25 -0
  34. package/dist/esm/commands/init.js.map +1 -0
  35. package/dist/esm/commands/install/reporter.d.ts +10 -0
  36. package/dist/esm/commands/install/reporter.d.ts.map +1 -0
  37. package/dist/esm/commands/install/reporter.js +67 -0
  38. package/dist/esm/commands/install/reporter.js.map +1 -0
  39. package/dist/esm/commands/install.d.ts +10 -0
  40. package/dist/esm/commands/install.d.ts.map +1 -0
  41. package/dist/esm/commands/install.js +21 -0
  42. package/dist/esm/commands/install.js.map +1 -0
  43. package/dist/esm/commands/list.d.ts +15 -0
  44. package/dist/esm/commands/list.d.ts.map +1 -0
  45. package/dist/esm/commands/list.js +109 -0
  46. package/dist/esm/commands/list.js.map +1 -0
  47. package/dist/esm/commands/login.d.ts +4 -0
  48. package/dist/esm/commands/login.d.ts.map +1 -0
  49. package/dist/esm/commands/login.js +13 -0
  50. package/dist/esm/commands/login.js.map +1 -0
  51. package/dist/esm/commands/logout.d.ts +4 -0
  52. package/dist/esm/commands/logout.d.ts.map +1 -0
  53. package/dist/esm/commands/logout.js +13 -0
  54. package/dist/esm/commands/logout.js.map +1 -0
  55. package/dist/esm/commands/pkg.d.ts +7 -0
  56. package/dist/esm/commands/pkg.d.ts.map +1 -0
  57. package/dist/esm/commands/pkg.js +123 -0
  58. package/dist/esm/commands/pkg.js.map +1 -0
  59. package/dist/esm/commands/query.d.ts +16 -0
  60. package/dist/esm/commands/query.d.ts.map +1 -0
  61. package/dist/esm/commands/query.js +124 -0
  62. package/dist/esm/commands/query.js.map +1 -0
  63. package/dist/esm/commands/run-exec.d.ts +6 -0
  64. package/dist/esm/commands/run-exec.d.ts.map +1 -0
  65. package/dist/esm/commands/run-exec.js +14 -0
  66. package/dist/esm/commands/run-exec.js.map +1 -0
  67. package/dist/esm/commands/run.d.ts +6 -0
  68. package/dist/esm/commands/run.d.ts.map +1 -0
  69. package/dist/esm/commands/run.js +37 -0
  70. package/dist/esm/commands/run.js.map +1 -0
  71. package/dist/esm/commands/token.d.ts +4 -0
  72. package/dist/esm/commands/token.d.ts.map +1 -0
  73. package/dist/esm/commands/token.js +30 -0
  74. package/dist/esm/commands/token.js.map +1 -0
  75. package/dist/esm/commands/uninstall.d.ts +10 -0
  76. package/dist/esm/commands/uninstall.d.ts.map +1 -0
  77. package/dist/esm/commands/uninstall.js +21 -0
  78. package/dist/esm/commands/uninstall.js.map +1 -0
  79. package/dist/esm/commands/whoami.d.ts +13 -0
  80. package/dist/esm/commands/whoami.d.ts.map +1 -0
  81. package/dist/esm/commands/whoami.js +19 -0
  82. package/dist/esm/commands/whoami.js.map +1 -0
  83. package/dist/esm/config/definition.d.ts +306 -0
  84. package/dist/esm/config/definition.d.ts.map +1 -0
  85. package/dist/esm/config/definition.js +517 -0
  86. package/dist/esm/config/definition.js.map +1 -0
  87. package/dist/esm/config/index.d.ts +206 -0
  88. package/dist/esm/config/index.d.ts.map +1 -0
  89. package/dist/esm/config/index.js +489 -0
  90. package/dist/esm/config/index.js.map +1 -0
  91. package/dist/esm/config/merge.d.ts +2 -0
  92. package/dist/esm/config/merge.d.ts.map +1 -0
  93. package/dist/esm/config/merge.js +23 -0
  94. package/dist/esm/config/merge.js.map +1 -0
  95. package/dist/esm/config/usage.d.ts +19 -0
  96. package/dist/esm/config/usage.d.ts.map +1 -0
  97. package/dist/esm/config/usage.js +40 -0
  98. package/dist/esm/config/usage.js.map +1 -0
  99. package/dist/esm/exec-command.d.ts +51 -0
  100. package/dist/esm/exec-command.d.ts.map +1 -0
  101. package/dist/esm/exec-command.js +199 -0
  102. package/dist/esm/exec-command.js.map +1 -0
  103. package/dist/esm/index.d.ts +17 -0
  104. package/dist/esm/index.d.ts.map +1 -0
  105. package/dist/esm/index.js +47 -0
  106. package/dist/esm/index.js.map +1 -0
  107. package/dist/esm/output.d.ts +21 -0
  108. package/dist/esm/output.d.ts.map +1 -0
  109. package/dist/esm/output.js +121 -0
  110. package/dist/esm/output.js.map +1 -0
  111. package/dist/esm/package.json +3 -0
  112. package/dist/esm/parse-add-remove-args.d.ts +22 -0
  113. package/dist/esm/parse-add-remove-args.d.ts.map +1 -0
  114. package/dist/esm/parse-add-remove-args.js +71 -0
  115. package/dist/esm/parse-add-remove-args.js.map +1 -0
  116. package/dist/esm/print-err.d.ts +7 -0
  117. package/dist/esm/print-err.d.ts.map +1 -0
  118. package/dist/esm/print-err.js +115 -0
  119. package/dist/esm/print-err.js.map +1 -0
  120. package/dist/esm/read-password.d.ts +8 -0
  121. package/dist/esm/read-password.d.ts.map +1 -0
  122. package/dist/esm/read-password.js +33 -0
  123. package/dist/esm/read-password.js.map +1 -0
  124. package/dist/esm/start-gui.d.ts +9 -0
  125. package/dist/esm/start-gui.d.ts.map +1 -0
  126. package/dist/esm/start-gui.js +40 -0
  127. package/dist/esm/start-gui.js.map +1 -0
  128. package/dist/esm/view.d.ts +30 -0
  129. package/dist/esm/view.d.ts.map +1 -0
  130. package/dist/esm/view.js +31 -0
  131. package/dist/esm/view.js.map +1 -0
  132. package/package.json +125 -0
@@ -0,0 +1,517 @@
1
+ import { XDG } from '@vltpkg/xdg';
2
+ import { jack } from 'jackspeak';
3
+ export const defaultView = process.stdout.isTTY ? 'human' : 'json';
4
+ const canonicalCommands = {
5
+ cache: 'cache',
6
+ config: 'config',
7
+ exec: 'exec',
8
+ 'exec-local': 'exec-local',
9
+ gui: 'gui',
10
+ help: 'help',
11
+ init: 'init',
12
+ install: 'install',
13
+ login: 'login',
14
+ logout: 'logout',
15
+ list: 'list',
16
+ ls: 'ls',
17
+ pkg: 'pkg',
18
+ query: 'query',
19
+ 'run-exec': 'run-exec',
20
+ run: 'run',
21
+ token: 'token',
22
+ uninstall: 'uninstall',
23
+ 'exec-cache': 'exec-cache',
24
+ whoami: 'whoami',
25
+ };
26
+ const aliases = {
27
+ i: 'install',
28
+ add: 'install',
29
+ rm: 'uninstall',
30
+ u: 'uninstall',
31
+ r: 'run',
32
+ 'run-script': 'run',
33
+ rx: 'run-exec',
34
+ x: 'exec',
35
+ xl: 'exec-local',
36
+ h: 'help',
37
+ '?': 'help',
38
+ conf: 'config',
39
+ ls: 'list',
40
+ xc: 'exec-cache',
41
+ };
42
+ /**
43
+ * Command aliases mapped to their canonical names
44
+ */
45
+ export const commands = {
46
+ ...canonicalCommands,
47
+ ...aliases,
48
+ };
49
+ /**
50
+ * Canonical command names mapped to an array of its aliases
51
+ */
52
+ export const commandAliases = Object.entries(aliases).reduce((acc, [alias, canonical]) => {
53
+ const commandAliases = acc.get(canonical);
54
+ if (commandAliases) {
55
+ commandAliases.push(alias);
56
+ }
57
+ else {
58
+ acc.set(canonical, [alias]);
59
+ }
60
+ return acc;
61
+ }, new Map());
62
+ export const getCommand = (s) => s && s in commands ? commands[s] : undefined;
63
+ const xdg = new XDG('vlt');
64
+ const cacheDir = xdg.cache();
65
+ /**
66
+ * Fields that are parsed as a set of key=value pairs
67
+ */
68
+ export const recordFields = [
69
+ 'git-hosts',
70
+ 'registries',
71
+ 'git-host-archives',
72
+ 'scope-registries',
73
+ ];
74
+ export const isRecordField = (s) => recordFields.includes(s);
75
+ const stopParsingCommands = [
76
+ 'run',
77
+ 'run-exec',
78
+ 'exec-local',
79
+ 'exec',
80
+ ];
81
+ let stopParsing = undefined;
82
+ const j = jack({
83
+ envPrefix: 'VLT',
84
+ allowPositionals: true,
85
+ usage: `vlt [<options>] [<cmd> [<args> ...]]`,
86
+ stopAtPositionalTest: arg => {
87
+ if (stopParsing)
88
+ return true;
89
+ const a = arg;
90
+ // we stop parsing AFTER the thing, so you can do
91
+ // vlt run --vlt --configs scriptName --args --for --script
92
+ // or
93
+ // vlt exec --vlt --configs command --args --for --command
94
+ if (stopParsingCommands.includes(commands[a])) {
95
+ stopParsing = true;
96
+ }
97
+ return false;
98
+ },
99
+ })
100
+ .heading('vlt')
101
+ .description(`More documentation available at <https://docs.vlt.sh>`)
102
+ .heading('Subcommands');
103
+ j.description(Object.keys(canonicalCommands).join(', '), {
104
+ pre: true,
105
+ }).description('Run `vlt <cmd> --help` for more information about a specific command');
106
+ export const definition = j
107
+ /**
108
+ * Definition of all configuration values used by vlt.
109
+ */
110
+ .heading('Configuration')
111
+ .description(`If a \`vlt.json\` file is present in the root of the current project,
112
+ then that will be used as a source of configuration information.
113
+
114
+ Next, the \`vlt.json\` file in the XDG specified config directory
115
+ will be checked, and loaded for any fields not set in the local project.
116
+
117
+ Object type values will be merged together. Set a field to \`null\` in
118
+ the JSON configuration to explicitly remove it.
119
+
120
+ Command-specific fields may be set in a nested \`command\` object that
121
+ overrides any options defined at the top level.
122
+ `)
123
+ .flag({
124
+ color: {
125
+ short: 'c',
126
+ description: 'Use colors (Default for TTY)',
127
+ },
128
+ 'no-color': {
129
+ short: 'C',
130
+ description: 'Do not use colors (Default for non-TTY)',
131
+ },
132
+ })
133
+ .opt({
134
+ registry: {
135
+ hint: 'url',
136
+ default: 'https://registry.npmjs.org/',
137
+ description: `Sets the registry for fetching packages, when no registry
138
+ is explicitly set on a specifier.
139
+
140
+ For example, \`express@latest\` will be resolved by looking
141
+ up the metadata from this registry.
142
+
143
+ Note that alias specifiers starting with \`npm:\` will
144
+ still map to \`https://registry.npmjs.org/\` if this is
145
+ changed, unless the a new mapping is created via the
146
+ \`--registries\` option.
147
+ `,
148
+ },
149
+ })
150
+ .optList({
151
+ registries: {
152
+ hint: 'name=url',
153
+ description: `Specify named registry hosts by their prefix. To set the
154
+ default registry used for non-namespaced specifiers,
155
+ use the \`--registry\` option.
156
+
157
+ Prefixes can be used as a package alias. For example:
158
+
159
+ \`\`\`
160
+ vlt --registries loc=http://reg.local install foo@loc:foo@1.x
161
+ \`\`\`
162
+
163
+ By default, the public npm registry is registered to the
164
+ \`npm:\` prefix. It is not recommended to change this
165
+ mapping in most cases.
166
+ `,
167
+ },
168
+ 'scope-registries': {
169
+ hint: '@scope=url',
170
+ description: `Map package name scopes to registry URLs.
171
+
172
+ For example,
173
+ \`--scope-registries @acme=https://registry.acme/\`
174
+ would tell vlt to fetch any packages named
175
+ \`@acme/...\` from the \`https://registry.acme/\`
176
+ registry.
177
+
178
+ Note: this way of specifying registries is more ambiguous,
179
+ compared with using the \`--registries\` field and explicit
180
+ prefixes, because instead of failing when the configuration
181
+ is absent, it will instead attempt to fetch from the
182
+ default registry.
183
+
184
+ By comparison, using
185
+ \`--registries acme=https://registry.acme/\` and then
186
+ specifying dependencies such as \`"foo": "acme:foo@1.x"\`
187
+ means that regardless of the name, the package will be
188
+ fetched from the explicitly named registry, or fail if
189
+ no registry is defined with that name.
190
+
191
+ However, custom registry aliases are not supported by other
192
+ package managers.`,
193
+ },
194
+ 'git-hosts': {
195
+ hint: `name=template`,
196
+ short: 'G',
197
+ description: `Map a shorthand name to a git remote URL template.
198
+
199
+ The \`template\` may contain placeholders, which will be
200
+ swapped with the relevant values.
201
+
202
+ \`$1\`, \`$2\`, etc. are replaced with the appropriate
203
+ n-th path portion. For example, \`github:user/project\`
204
+ would replace the \`$1\` in the template with \`user\`,
205
+ and \`$2\` with \`project\`.`,
206
+ },
207
+ 'git-host-archives': {
208
+ hint: `name=template`,
209
+ short: 'A',
210
+ description: `Similar to the \`--git-host <name>=<template>\` option,
211
+ this option can define a template string that will be
212
+ expanded to provide the URL to download a pre-built
213
+ tarball of the git repository.
214
+
215
+ In addition to the n-th path portion expansions performed
216
+ by \`--git-host\`, this field will also expand the
217
+ string \`$committish\` in the template, replacing it with
218
+ the resolved git committish value to be fetched.`,
219
+ },
220
+ })
221
+ .opt({
222
+ cache: {
223
+ hint: 'path',
224
+ description: `
225
+ Location of the vlt on-disk cache. Defaults to the platform-specific
226
+ directory recommended by the XDG specification.
227
+ `,
228
+ default: cacheDir,
229
+ },
230
+ tag: {
231
+ description: `Default \`dist-tag\` to install`,
232
+ default: 'latest',
233
+ },
234
+ before: {
235
+ hint: 'date',
236
+ description: `Do not install any packages published after this date`,
237
+ },
238
+ os: {
239
+ description: `The operating system to use as the selector when choosing
240
+ packages based on their \`os\` value.`,
241
+ default: process.platform,
242
+ },
243
+ arch: {
244
+ description: `CPU architecture to use as the selector when choosing
245
+ packages based on their \`cpu\` value.`,
246
+ default: process.arch,
247
+ },
248
+ 'node-version': {
249
+ hint: 'version',
250
+ description: `Node version to use when choosing packages based on
251
+ their \`engines.node\` value.`,
252
+ default: process.version,
253
+ },
254
+ })
255
+ .flag({
256
+ 'git-shallow': {
257
+ description: `Set to force \`--depth=1\` on all git clone actions.
258
+ When set explicitly to false with --no-git-shallow,
259
+ then \`--depth=1\` will not be used.
260
+
261
+ When not set explicitly, \`--depth=1\` will be used for
262
+ git hosts known to support this behavior.`,
263
+ },
264
+ })
265
+ .num({
266
+ 'fetch-retries': {
267
+ hint: 'n',
268
+ description: `Number of retries to perform when encountering network
269
+ errors or likely-transient errors from git hosts.`,
270
+ default: 3,
271
+ },
272
+ 'fetch-retry-factor': {
273
+ hint: 'n',
274
+ description: `The exponential backoff factor to use when retrying
275
+ requests due to network issues.`,
276
+ default: 2,
277
+ },
278
+ 'fetch-retry-mintimeout': {
279
+ hint: 'n',
280
+ description: `Number of milliseconds before starting first retry`,
281
+ default: 0,
282
+ },
283
+ 'fetch-retry-maxtimeout': {
284
+ hint: 'n',
285
+ description: `Maximum number of milliseconds between two retries`,
286
+ default: 30_000,
287
+ },
288
+ 'stale-while-revalidate-factor': {
289
+ hint: 'n',
290
+ default: 60,
291
+ description: `If the server does not serve a \`stale-while-revalidate\`
292
+ value in the \`cache-control\` header, then this multiplier
293
+ is applied to the \`max-age\` or \`s-maxage\` values.
294
+
295
+ By default, this is \`60\`, so for example a response that
296
+ is cacheable for 5 minutes will allow a stale response
297
+ while revalidating for up to 5 hours.
298
+
299
+ If the server *does* provide a \`stale-while-revalidate\`
300
+ value, then that is always used.
301
+
302
+ Set to 0 to prevent any \`stale-while-revalidate\` behavior
303
+ unless explicitly allowed by the server's \`cache-control\`
304
+ header.
305
+ `,
306
+ },
307
+ })
308
+ .opt({
309
+ identity: {
310
+ short: 'i',
311
+ validate: (v) => typeof v === 'string' && /^[a-z0-9]*$/.test(v),
312
+ hint: 'name',
313
+ default: '',
314
+ description: `Provide a string to define an identity for storing auth
315
+ information when logging into registries.
316
+
317
+ Authentication tokens will be stored in the XDG data
318
+ directory, in \`vlt/auth/$\{identity}/keychain.json\`.
319
+
320
+ If no identity is provided, then the default \`''\` will
321
+ be used, storing the file at \`vlt/auth/keychain.json\`.
322
+
323
+ May only contain lowercase alphanumeric characters.
324
+ `,
325
+ },
326
+ })
327
+ .optList({
328
+ workspace: {
329
+ hint: 'ws',
330
+ short: 'w',
331
+ description: `Set to limit the spaces being worked on when working on
332
+ workspaces.
333
+
334
+ Can be paths or glob patterns matching paths.
335
+
336
+ Specifying workspaces by package.json name is not
337
+ supported.`,
338
+ },
339
+ 'workspace-group': {
340
+ short: 'g',
341
+ description: `Specify named workspace group names to load and operate on
342
+ when doing recursive operations on workspaces.`,
343
+ },
344
+ })
345
+ .flag({
346
+ recursive: {
347
+ short: 'r',
348
+ description: `Run an operation across multiple workspaces.
349
+
350
+ No effect when used in non-monorepo projects.
351
+
352
+ Implied by setting --workspace or --workspace-group. If
353
+ not set, then the action is run on the project root.`,
354
+ },
355
+ bail: {
356
+ short: 'b',
357
+ description: `When running scripts across multiple workspaces, stop
358
+ on the first failure.`,
359
+ default: true,
360
+ },
361
+ 'no-bail': {
362
+ short: 'B',
363
+ description: `When running scripts across multiple workspaces, continue
364
+ on failure, running the script for all workspaces.`,
365
+ },
366
+ })
367
+ .opt({
368
+ config: {
369
+ hint: 'user | project',
370
+ description: `Specify whether to operate on user-level or project-level
371
+ configuration files when running \`vlt config\` commands.`,
372
+ validOptions: ['user', 'project'],
373
+ default: 'project',
374
+ },
375
+ editor: {
376
+ hint: 'program',
377
+ description: `The blocking editor to use for \`vlt config edit\` and
378
+ any other cases where a file should be opened for
379
+ editing.
380
+
381
+ Defaults to the \`EDITOR\` or \`VISUAL\` env if set, or
382
+ \`notepad.exe\` on Windows, or \`vi\` elsewhere.`,
383
+ default: process.env.EDITOR ||
384
+ process.env.VISUAL ||
385
+ (process.platform === 'win32' ?
386
+ `${process.env.SYSTEMROOT}\\notepad.exe`
387
+ : 'vi'),
388
+ },
389
+ 'script-shell': {
390
+ hint: 'program',
391
+ description: `The shell to use when executing \`package.json#scripts\`.
392
+
393
+ For \`vlt exec\` and \`vlt exec-local\`, this is never set,
394
+ meaning that command arguments are run exactly as provided.
395
+
396
+ For \`vlt run\` (and other things that run lifecycle
397
+ scripts in \`package.json#scripts\`), the entire command
398
+ with all arguments is provided as a single string, meaning
399
+ that some value must be provided for shell interpretation,
400
+ and so for these contexts, the \`script-shell\` value will
401
+ default to \`/bin/sh\` on POSIX systems or \`cmd.exe\` on
402
+ Windows.
403
+ `,
404
+ },
405
+ 'fallback-command': {
406
+ hint: 'command',
407
+ description: `The command to run when the first argument doesn't
408
+ match any known commands.
409
+
410
+ For pnpm-style behavior, set this to 'run-exec'. e.g:
411
+ \`\`\`
412
+ vlt config set fallback-command=run-exec
413
+ \`\`\``,
414
+ default: 'help',
415
+ validOptions: Object.keys(canonicalCommands),
416
+ },
417
+ })
418
+ .opt({
419
+ package: {
420
+ hint: 'p',
421
+ description: `When running \`vlt exec\`, this allows you to explicitly
422
+ set the package to search for bins. If not provided, then
423
+ vlt will interpret the first argument as the package, and
424
+ attempt to run the default executable.`,
425
+ },
426
+ })
427
+ .opt({
428
+ view: {
429
+ hint: 'output',
430
+ default: defaultView,
431
+ description: `Configures the output format for commands.
432
+
433
+ Defaults to \`human\` if stdout is a TTY, or \`json\`
434
+ if it is not.
435
+
436
+ - human: Maximally ergonomic output reporting for human
437
+ consumption.
438
+ - json: Parseable JSON output for machines.
439
+ - inspect: Output results with \`util.inspect\`.
440
+ - gui: Start a local web server and opens a browser to
441
+ explore the results. (Only relevant for certain
442
+ commands.)
443
+ - mermaid: Output mermaid diagramming syntax. (Only
444
+ relevant for certain commands.)
445
+
446
+ If the requested view format is not supported for the
447
+ current command, or if no option is provided, then it
448
+ will fall back to the default.
449
+ `,
450
+ validOptions: [
451
+ 'human',
452
+ 'json',
453
+ 'mermaid',
454
+ 'gui',
455
+ 'inspect',
456
+ ],
457
+ },
458
+ })
459
+ .optList({
460
+ 'dashboard-root': {
461
+ hint: 'path',
462
+ description: `The root directory to use for the dashboard GUI.
463
+ If not set, the user home directory is used.`,
464
+ },
465
+ })
466
+ .flag({
467
+ 'save-dev': {
468
+ short: 'D',
469
+ description: `Save installed packages to a package.json file as
470
+ devDependencies`,
471
+ },
472
+ 'save-optional': {
473
+ short: 'O',
474
+ description: `Save installed packages to a package.json file as
475
+ optionalDependencies`,
476
+ },
477
+ 'save-peer': {
478
+ description: `Save installed packages to a package.json file as
479
+ peerDependencies`,
480
+ },
481
+ 'save-prod': {
482
+ short: 'P',
483
+ description: `Save installed packages into dependencies specifically.
484
+ This is useful if a package already exists in
485
+ devDependencies or optionalDependencies, but you want to
486
+ move it to be a non-optional production dependency.`,
487
+ },
488
+ })
489
+ .opt({
490
+ 'expect-results': {
491
+ hint: 'value',
492
+ validate: (v) => typeof v === 'string' && /^([<>]=?)?[0-9]+$/.test(v),
493
+ description: `When running \`vlt query\`, this option allows you to
494
+ set a expected number of resulting items.
495
+
496
+ Accepted values are numbers and strings.
497
+
498
+ Strings starting with \`>\`, \`<\`, \`>=\` or \`<=\`
499
+ followed by a number can be used to check if the result
500
+ is greater than or less than a specific number.`,
501
+ },
502
+ })
503
+ .flag({
504
+ yes: {
505
+ short: 'y',
506
+ description: `Automatically accept any confirmation prompts`,
507
+ },
508
+ version: {
509
+ short: 'v',
510
+ description: 'Print the version',
511
+ },
512
+ help: {
513
+ short: 'h',
514
+ description: 'Print helpful information',
515
+ },
516
+ });
517
+ //# sourceMappingURL=definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/config/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAA;AAElE,MAAM,iBAAi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AAmB;KACjC;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,GAAG;QACV,WAAW,EAAE,2BAA2B;KACzC;CACF,CAAC,CAAA","sourcesContent":["import { XDG } from '@vltpkg/xdg'\nimport { jack } from 'jackspeak'\n\nexport const defaultView = process.stdout.isTTY ? 'human' : 'json'\n\nconst canonicalCommands = {\n cache: 'cache',\n config: 'config',\n exec: 'exec',\n 'exec-local': 'exec-local',\n gui: 'gui',\n help: 'help',\n init: 'init',\n install: 'install',\n login: 'login',\n logout: 'logout',\n list: 'list',\n ls: 'ls',\n pkg: 'pkg',\n query: 'query',\n 'run-exec': 'run-exec',\n run: 'run',\n token: 'token',\n uninstall: 'uninstall',\n 'exec-cache': 'exec-cache',\n whoami: 'whoami',\n} as const\n\nconst aliases = {\n i: 'install',\n add: 'install',\n rm: 'uninstall',\n u: 'uninstall',\n r: 'run',\n 'run-script': 'run',\n rx: 'run-exec',\n x: 'exec',\n xl: 'exec-local',\n h: 'help',\n '?': 'help',\n conf: 'config',\n ls: 'list',\n xc: 'exec-cache',\n} as const\n\n/**\n * Command aliases mapped to their canonical names\n */\nexport const commands = {\n ...canonicalCommands,\n ...aliases,\n} as const\n\n/**\n * Canonical command names mapped to an array of its aliases\n */\nexport const commandAliases = Object.entries(aliases).reduce(\n (acc, [alias, canonical]) => {\n const commandAliases = acc.get(canonical)\n if (commandAliases) {\n commandAliases.push(alias)\n } else {\n acc.set(canonical, [alias])\n }\n return acc\n },\n new Map<string, string[]>(),\n)\n\nexport type Commands = typeof commands\n\nexport const getCommand = (\n s?: string,\n): Commands[keyof Commands] | undefined =>\n s && s in commands ? commands[s as keyof Commands] : undefined\n\nconst xdg = new XDG('vlt')\nconst cacheDir = xdg.cache()\n\n/**\n * Fields that are parsed as a set of key=value pairs\n */\nexport const recordFields = [\n 'git-hosts',\n 'registries',\n 'git-host-archives',\n 'scope-registries',\n] as const\n\nexport type RecordField = (typeof recordFields)[number]\n\nexport const isRecordField = (s: string): s is RecordField =>\n recordFields.includes(s as RecordField)\n\nconst stopParsingCommands: Commands[keyof Commands][] = [\n 'run',\n 'run-exec',\n 'exec-local',\n 'exec',\n]\n\nlet stopParsing: boolean | undefined = undefined\n\nconst j = jack({\n envPrefix: 'VLT',\n allowPositionals: true,\n usage: `vlt [<options>] [<cmd> [<args> ...]]`,\n stopAtPositionalTest: arg => {\n if (stopParsing) return true\n const a = arg as keyof Commands\n // we stop parsing AFTER the thing, so you can do\n // vlt run --vlt --configs scriptName --args --for --script\n // or\n // vlt exec --vlt --configs command --args --for --command\n if (stopParsingCommands.includes(commands[a])) {\n stopParsing = true\n }\n return false\n },\n})\n .heading('vlt')\n .description(\n `More documentation available at <https://docs.vlt.sh>`,\n )\n .heading('Subcommands')\n\nj.description(Object.keys(canonicalCommands).join(', '), {\n pre: true,\n}).description(\n 'Run `vlt <cmd> --help` for more information about a specific command',\n)\n\nexport const definition = j\n /**\n * Definition of all configuration values used by vlt.\n */\n .heading('Configuration')\n .description(\n `If a \\`vlt.json\\` file is present in the root of the current project,\n then that will be used as a source of configuration information.\n\n Next, the \\`vlt.json\\` file in the XDG specified config directory\n will be checked, and loaded for any fields not set in the local project.\n\n Object type values will be merged together. Set a field to \\`null\\` in\n the JSON configuration to explicitly remove it.\n\n Command-specific fields may be set in a nested \\`command\\` object that\n overrides any options defined at the top level.\n `,\n )\n\n .flag({\n color: {\n short: 'c',\n description: 'Use colors (Default for TTY)',\n },\n 'no-color': {\n short: 'C',\n description: 'Do not use colors (Default for non-TTY)',\n },\n })\n\n .opt({\n registry: {\n hint: 'url',\n default: 'https://registry.npmjs.org/',\n description: `Sets the registry for fetching packages, when no registry\n is explicitly set on a specifier.\n\n For example, \\`express@latest\\` will be resolved by looking\n up the metadata from this registry.\n\n Note that alias specifiers starting with \\`npm:\\` will\n still map to \\`https://registry.npmjs.org/\\` if this is\n changed, unless the a new mapping is created via the\n \\`--registries\\` option.\n `,\n },\n })\n\n .optList({\n registries: {\n hint: 'name=url',\n description: `Specify named registry hosts by their prefix. To set the\n default registry used for non-namespaced specifiers,\n use the \\`--registry\\` option.\n\n Prefixes can be used as a package alias. For example:\n\n \\`\\`\\`\n vlt --registries loc=http://reg.local install foo@loc:foo@1.x\n \\`\\`\\`\n\n By default, the public npm registry is registered to the\n \\`npm:\\` prefix. It is not recommended to change this\n mapping in most cases.\n `,\n },\n\n 'scope-registries': {\n hint: '@scope=url',\n description: `Map package name scopes to registry URLs.\n\n For example,\n \\`--scope-registries @acme=https://registry.acme/\\`\n would tell vlt to fetch any packages named\n \\`@acme/...\\` from the \\`https://registry.acme/\\`\n registry.\n\n Note: this way of specifying registries is more ambiguous,\n compared with using the \\`--registries\\` field and explicit\n prefixes, because instead of failing when the configuration\n is absent, it will instead attempt to fetch from the\n default registry.\n\n By comparison, using\n \\`--registries acme=https://registry.acme/\\` and then\n specifying dependencies such as \\`\"foo\": \"acme:foo@1.x\"\\`\n means that regardless of the name, the package will be\n fetched from the explicitly named registry, or fail if\n no registry is defined with that name.\n\n However, custom registry aliases are not supported by other\n package managers.`,\n },\n\n 'git-hosts': {\n hint: `name=template`,\n short: 'G',\n description: `Map a shorthand name to a git remote URL template.\n\n The \\`template\\` may contain placeholders, which will be\n swapped with the relevant values.\n\n \\`$1\\`, \\`$2\\`, etc. are replaced with the appropriate\n n-th path portion. For example, \\`github:user/project\\`\n would replace the \\`$1\\` in the template with \\`user\\`,\n and \\`$2\\` with \\`project\\`.`,\n },\n\n 'git-host-archives': {\n hint: `name=template`,\n short: 'A',\n description: `Similar to the \\`--git-host <name>=<template>\\` option,\n this option can define a template string that will be\n expanded to provide the URL to download a pre-built\n tarball of the git repository.\n\n In addition to the n-th path portion expansions performed\n by \\`--git-host\\`, this field will also expand the\n string \\`$committish\\` in the template, replacing it with\n the resolved git committish value to be fetched.`,\n },\n })\n\n .opt({\n cache: {\n hint: 'path',\n description: `\n Location of the vlt on-disk cache. Defaults to the platform-specific\n directory recommended by the XDG specification.\n `,\n default: cacheDir,\n },\n tag: {\n description: `Default \\`dist-tag\\` to install`,\n default: 'latest',\n },\n before: {\n hint: 'date',\n description: `Do not install any packages published after this date`,\n },\n os: {\n description: `The operating system to use as the selector when choosing\n packages based on their \\`os\\` value.`,\n default: process.platform,\n },\n arch: {\n description: `CPU architecture to use as the selector when choosing\n packages based on their \\`cpu\\` value.`,\n default: process.arch,\n },\n 'node-version': {\n hint: 'version',\n description: `Node version to use when choosing packages based on\n their \\`engines.node\\` value.`,\n default: process.version,\n },\n })\n\n .flag({\n 'git-shallow': {\n description: `Set to force \\`--depth=1\\` on all git clone actions.\n When set explicitly to false with --no-git-shallow,\n then \\`--depth=1\\` will not be used.\n\n When not set explicitly, \\`--depth=1\\` will be used for\n git hosts known to support this behavior.`,\n },\n })\n .num({\n 'fetch-retries': {\n hint: 'n',\n description: `Number of retries to perform when encountering network\n errors or likely-transient errors from git hosts.`,\n default: 3,\n },\n 'fetch-retry-factor': {\n hint: 'n',\n description: `The exponential backoff factor to use when retrying\n requests due to network issues.`,\n default: 2,\n },\n 'fetch-retry-mintimeout': {\n hint: 'n',\n description: `Number of milliseconds before starting first retry`,\n default: 0,\n },\n 'fetch-retry-maxtimeout': {\n hint: 'n',\n description: `Maximum number of milliseconds between two retries`,\n default: 30_000,\n },\n 'stale-while-revalidate-factor': {\n hint: 'n',\n default: 60,\n description: `If the server does not serve a \\`stale-while-revalidate\\`\n value in the \\`cache-control\\` header, then this multiplier\n is applied to the \\`max-age\\` or \\`s-maxage\\` values.\n\n By default, this is \\`60\\`, so for example a response that\n is cacheable for 5 minutes will allow a stale response\n while revalidating for up to 5 hours.\n\n If the server *does* provide a \\`stale-while-revalidate\\`\n value, then that is always used.\n\n Set to 0 to prevent any \\`stale-while-revalidate\\` behavior\n unless explicitly allowed by the server's \\`cache-control\\`\n header.\n `,\n },\n })\n\n .opt({\n identity: {\n short: 'i',\n validate: (v: unknown) =>\n typeof v === 'string' && /^[a-z0-9]*$/.test(v),\n hint: 'name',\n default: '',\n description: `Provide a string to define an identity for storing auth\n information when logging into registries.\n\n Authentication tokens will be stored in the XDG data\n directory, in \\`vlt/auth/$\\{identity}/keychain.json\\`.\n\n If no identity is provided, then the default \\`''\\` will\n be used, storing the file at \\`vlt/auth/keychain.json\\`.\n\n May only contain lowercase alphanumeric characters.\n `,\n },\n })\n\n .optList({\n workspace: {\n hint: 'ws',\n short: 'w',\n description: `Set to limit the spaces being worked on when working on\n workspaces.\n\n Can be paths or glob patterns matching paths.\n\n Specifying workspaces by package.json name is not\n supported.`,\n },\n 'workspace-group': {\n short: 'g',\n description: `Specify named workspace group names to load and operate on\n when doing recursive operations on workspaces.`,\n },\n })\n\n .flag({\n recursive: {\n short: 'r',\n description: `Run an operation across multiple workspaces.\n\n No effect when used in non-monorepo projects.\n\n Implied by setting --workspace or --workspace-group. If\n not set, then the action is run on the project root.`,\n },\n\n bail: {\n short: 'b',\n description: `When running scripts across multiple workspaces, stop\n on the first failure.`,\n default: true,\n },\n\n 'no-bail': {\n short: 'B',\n description: `When running scripts across multiple workspaces, continue\n on failure, running the script for all workspaces.`,\n },\n })\n\n .opt({\n config: {\n hint: 'user | project',\n description: `Specify whether to operate on user-level or project-level\n configuration files when running \\`vlt config\\` commands.`,\n validOptions: ['user', 'project'] as const,\n default: 'project',\n },\n\n editor: {\n hint: 'program',\n description: `The blocking editor to use for \\`vlt config edit\\` and\n any other cases where a file should be opened for\n editing.\n\n Defaults to the \\`EDITOR\\` or \\`VISUAL\\` env if set, or\n \\`notepad.exe\\` on Windows, or \\`vi\\` elsewhere.`,\n default:\n process.env.EDITOR ||\n process.env.VISUAL ||\n (process.platform === 'win32' ?\n `${process.env.SYSTEMROOT}\\\\notepad.exe`\n : 'vi'),\n },\n\n 'script-shell': {\n hint: 'program',\n description: `The shell to use when executing \\`package.json#scripts\\`.\n\n For \\`vlt exec\\` and \\`vlt exec-local\\`, this is never set,\n meaning that command arguments are run exactly as provided.\n\n For \\`vlt run\\` (and other things that run lifecycle\n scripts in \\`package.json#scripts\\`), the entire command\n with all arguments is provided as a single string, meaning\n that some value must be provided for shell interpretation,\n and so for these contexts, the \\`script-shell\\` value will\n default to \\`/bin/sh\\` on POSIX systems or \\`cmd.exe\\` on\n Windows.\n `,\n },\n\n 'fallback-command': {\n hint: 'command',\n description: `The command to run when the first argument doesn't\n match any known commands.\n\n For pnpm-style behavior, set this to 'run-exec'. e.g:\n \\`\\`\\`\n vlt config set fallback-command=run-exec\n \\`\\`\\``,\n default: 'help',\n validOptions: Object.keys(canonicalCommands),\n },\n })\n\n .opt({\n package: {\n hint: 'p',\n description: `When running \\`vlt exec\\`, this allows you to explicitly\n set the package to search for bins. If not provided, then\n vlt will interpret the first argument as the package, and\n attempt to run the default executable.`,\n },\n })\n\n .opt({\n view: {\n hint: 'output',\n default: defaultView,\n description: `Configures the output format for commands.\n\n Defaults to \\`human\\` if stdout is a TTY, or \\`json\\`\n if it is not.\n\n - human: Maximally ergonomic output reporting for human\n consumption.\n - json: Parseable JSON output for machines.\n - inspect: Output results with \\`util.inspect\\`.\n - gui: Start a local web server and opens a browser to\n explore the results. (Only relevant for certain\n commands.)\n - mermaid: Output mermaid diagramming syntax. (Only\n relevant for certain commands.)\n\n If the requested view format is not supported for the\n current command, or if no option is provided, then it\n will fall back to the default.\n `,\n validOptions: [\n 'human',\n 'json',\n 'mermaid',\n 'gui',\n 'inspect',\n ] as const,\n },\n })\n\n .optList({\n 'dashboard-root': {\n hint: 'path',\n description: `The root directory to use for the dashboard GUI.\n If not set, the user home directory is used.`,\n },\n })\n\n .flag({\n 'save-dev': {\n short: 'D',\n description: `Save installed packages to a package.json file as\n devDependencies`,\n },\n 'save-optional': {\n short: 'O',\n description: `Save installed packages to a package.json file as\n optionalDependencies`,\n },\n 'save-peer': {\n description: `Save installed packages to a package.json file as\n peerDependencies`,\n },\n 'save-prod': {\n short: 'P',\n description: `Save installed packages into dependencies specifically.\n This is useful if a package already exists in\n devDependencies or optionalDependencies, but you want to\n move it to be a non-optional production dependency.`,\n },\n })\n\n .opt({\n 'expect-results': {\n hint: 'value',\n validate: (v: unknown) =>\n typeof v === 'string' && /^([<>]=?)?[0-9]+$/.test(v),\n description: `When running \\`vlt query\\`, this option allows you to\n set a expected number of resulting items.\n\n Accepted values are numbers and strings.\n\n Strings starting with \\`>\\`, \\`<\\`, \\`>=\\` or \\`<=\\`\n followed by a number can be used to check if the result\n is greater than or less than a specific number.`,\n },\n })\n\n .flag({\n yes: {\n short: 'y',\n description: `Automatically accept any confirmation prompts`,\n },\n version: {\n short: 'v',\n description: 'Print the version',\n },\n help: {\n short: 'h',\n description: 'Print helpful information',\n },\n })\n"]}