@vltpkg/cli-sdk 0.0.0-9 → 1.0.0-rc.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 (149) hide show
  1. package/dist/esm/commands/build.d.ts +25 -0
  2. package/dist/esm/commands/build.d.ts.map +1 -0
  3. package/dist/esm/commands/build.js +102 -0
  4. package/dist/esm/commands/build.js.map +1 -0
  5. package/dist/esm/commands/cache.d.ts +18 -0
  6. package/dist/esm/commands/cache.d.ts.map +1 -1
  7. package/dist/esm/commands/cache.js +48 -2
  8. package/dist/esm/commands/cache.js.map +1 -1
  9. package/dist/esm/commands/ci.d.ts +11 -0
  10. package/dist/esm/commands/ci.d.ts.map +1 -0
  11. package/dist/esm/commands/ci.js +32 -0
  12. package/dist/esm/commands/ci.js.map +1 -0
  13. package/dist/esm/commands/config.d.ts +3 -2
  14. package/dist/esm/commands/config.d.ts.map +1 -1
  15. package/dist/esm/commands/config.js +372 -101
  16. package/dist/esm/commands/config.js.map +1 -1
  17. package/dist/esm/commands/docs.d.ts +18 -0
  18. package/dist/esm/commands/docs.d.ts.map +1 -0
  19. package/dist/esm/commands/docs.js +154 -0
  20. package/dist/esm/commands/docs.js.map +1 -0
  21. package/dist/esm/commands/exec-cache.d.ts +49 -0
  22. package/dist/esm/commands/exec-cache.d.ts.map +1 -0
  23. package/dist/esm/commands/exec-cache.js +146 -0
  24. package/dist/esm/commands/exec-cache.js.map +1 -0
  25. package/dist/esm/commands/exec-local.d.ts +1 -0
  26. package/dist/esm/commands/exec-local.d.ts.map +1 -1
  27. package/dist/esm/commands/exec-local.js +2 -0
  28. package/dist/esm/commands/exec-local.js.map +1 -1
  29. package/dist/esm/commands/exec.d.ts +6 -1
  30. package/dist/esm/commands/exec.d.ts.map +1 -1
  31. package/dist/esm/commands/exec.js +79 -5
  32. package/dist/esm/commands/exec.js.map +1 -1
  33. package/dist/esm/commands/help.d.ts +1 -1
  34. package/dist/esm/commands/help.d.ts.map +1 -1
  35. package/dist/esm/commands/help.js +32 -3
  36. package/dist/esm/commands/help.js.map +1 -1
  37. package/dist/esm/commands/init.d.ts +3 -3
  38. package/dist/esm/commands/init.d.ts.map +1 -1
  39. package/dist/esm/commands/init.js +95 -9
  40. package/dist/esm/commands/init.js.map +1 -1
  41. package/dist/esm/commands/install/reporter.d.ts +3 -2
  42. package/dist/esm/commands/install/reporter.d.ts.map +1 -1
  43. package/dist/esm/commands/install/reporter.js +42 -15
  44. package/dist/esm/commands/install/reporter.js.map +1 -1
  45. package/dist/esm/commands/install.d.ts +21 -3
  46. package/dist/esm/commands/install.d.ts.map +1 -1
  47. package/dist/esm/commands/install.js +27 -3
  48. package/dist/esm/commands/install.js.map +1 -1
  49. package/dist/esm/commands/list.d.ts +2 -2
  50. package/dist/esm/commands/list.d.ts.map +1 -1
  51. package/dist/esm/commands/list.js +149 -49
  52. package/dist/esm/commands/list.js.map +1 -1
  53. package/dist/esm/commands/pack.d.ts +32 -0
  54. package/dist/esm/commands/pack.d.ts.map +1 -0
  55. package/dist/esm/commands/pack.js +147 -0
  56. package/dist/esm/commands/pack.js.map +1 -0
  57. package/dist/esm/commands/pkg.d.ts +1 -2
  58. package/dist/esm/commands/pkg.d.ts.map +1 -1
  59. package/dist/esm/commands/pkg.js +123 -38
  60. package/dist/esm/commands/pkg.js.map +1 -1
  61. package/dist/esm/commands/publish.d.ts +22 -0
  62. package/dist/esm/commands/publish.d.ts.map +1 -0
  63. package/dist/esm/commands/publish.js +245 -0
  64. package/dist/esm/commands/publish.js.map +1 -0
  65. package/dist/esm/commands/query.d.ts +2 -3
  66. package/dist/esm/commands/query.d.ts.map +1 -1
  67. package/dist/esm/commands/query.js +132 -38
  68. package/dist/esm/commands/query.js.map +1 -1
  69. package/dist/esm/commands/run-exec.d.ts +1 -0
  70. package/dist/esm/commands/run-exec.d.ts.map +1 -1
  71. package/dist/esm/commands/run-exec.js +1 -0
  72. package/dist/esm/commands/run-exec.js.map +1 -1
  73. package/dist/esm/commands/run.d.ts +1 -0
  74. package/dist/esm/commands/run.d.ts.map +1 -1
  75. package/dist/esm/commands/run.js +13 -16
  76. package/dist/esm/commands/run.js.map +1 -1
  77. package/dist/esm/commands/serve.d.ts +14 -0
  78. package/dist/esm/commands/serve.d.ts.map +1 -0
  79. package/dist/esm/commands/serve.js +103 -0
  80. package/dist/esm/commands/serve.js.map +1 -0
  81. package/dist/esm/commands/uninstall.d.ts +8 -2
  82. package/dist/esm/commands/uninstall.d.ts.map +1 -1
  83. package/dist/esm/commands/uninstall.js +8 -3
  84. package/dist/esm/commands/uninstall.js.map +1 -1
  85. package/dist/esm/commands/update.d.ts +14 -0
  86. package/dist/esm/commands/update.d.ts.map +1 -0
  87. package/dist/esm/commands/update.js +41 -0
  88. package/dist/esm/commands/update.js.map +1 -0
  89. package/dist/esm/commands/version.d.ts +26 -0
  90. package/dist/esm/commands/version.d.ts.map +1 -0
  91. package/dist/esm/commands/version.js +226 -0
  92. package/dist/esm/commands/version.js.map +1 -0
  93. package/dist/esm/config/definition.d.ts +118 -15
  94. package/dist/esm/config/definition.d.ts.map +1 -1
  95. package/dist/esm/config/definition.js +185 -37
  96. package/dist/esm/config/definition.js.map +1 -1
  97. package/dist/esm/config/index.d.ts +41 -37
  98. package/dist/esm/config/index.d.ts.map +1 -1
  99. package/dist/esm/config/index.js +109 -172
  100. package/dist/esm/config/index.js.map +1 -1
  101. package/dist/esm/config/merge.d.ts +3 -1
  102. package/dist/esm/config/merge.d.ts.map +1 -1
  103. package/dist/esm/config/merge.js +11 -6
  104. package/dist/esm/config/merge.js.map +1 -1
  105. package/dist/esm/custom-help.d.ts +9 -0
  106. package/dist/esm/custom-help.d.ts.map +1 -0
  107. package/dist/esm/custom-help.js +400 -0
  108. package/dist/esm/custom-help.js.map +1 -0
  109. package/dist/esm/exec-command.d.ts +33 -14
  110. package/dist/esm/exec-command.d.ts.map +1 -1
  111. package/dist/esm/exec-command.js +213 -64
  112. package/dist/esm/exec-command.js.map +1 -1
  113. package/dist/esm/index.d.ts +1 -14
  114. package/dist/esm/index.d.ts.map +1 -1
  115. package/dist/esm/index.js +45 -19
  116. package/dist/esm/index.js.map +1 -1
  117. package/dist/esm/load-command.d.ts +16 -0
  118. package/dist/esm/load-command.d.ts.map +1 -0
  119. package/dist/esm/load-command.js +21 -0
  120. package/dist/esm/load-command.js.map +1 -0
  121. package/dist/esm/output.d.ts +6 -11
  122. package/dist/esm/output.d.ts.map +1 -1
  123. package/dist/esm/output.js +64 -27
  124. package/dist/esm/output.js.map +1 -1
  125. package/dist/esm/pack-tarball.d.ts +22 -0
  126. package/dist/esm/pack-tarball.d.ts.map +1 -0
  127. package/dist/esm/pack-tarball.js +249 -0
  128. package/dist/esm/pack-tarball.js.map +1 -0
  129. package/dist/esm/print-err.d.ts +9 -2
  130. package/dist/esm/print-err.d.ts.map +1 -1
  131. package/dist/esm/print-err.js +130 -46
  132. package/dist/esm/print-err.js.map +1 -1
  133. package/dist/esm/query-host-contexts.d.ts +16 -0
  134. package/dist/esm/query-host-contexts.d.ts.map +1 -0
  135. package/dist/esm/query-host-contexts.js +135 -0
  136. package/dist/esm/query-host-contexts.js.map +1 -0
  137. package/dist/esm/start-gui.d.ts +1 -0
  138. package/dist/esm/start-gui.d.ts.map +1 -1
  139. package/dist/esm/start-gui.js +28 -8
  140. package/dist/esm/start-gui.js.map +1 -1
  141. package/dist/esm/view.d.ts +2 -3
  142. package/dist/esm/view.d.ts.map +1 -1
  143. package/dist/esm/view.js +1 -1
  144. package/dist/esm/view.js.map +1 -1
  145. package/package.json +51 -37
  146. package/dist/esm/commands/gui.d.ts +0 -6
  147. package/dist/esm/commands/gui.d.ts.map +0 -1
  148. package/dist/esm/commands/gui.js +0 -13
  149. package/dist/esm/commands/gui.js.map +0 -1
@@ -1,12 +1,27 @@
1
+ import { error } from '@vltpkg/error-cause';
1
2
  import { XDG } from '@vltpkg/xdg';
2
3
  import { jack } from 'jackspeak';
3
- export const defaultView = process.stdout.isTTY ? 'human' : 'json';
4
+ export const defaultView =
5
+ // If stdout is a TTY, use human output
6
+ process.stdout.isTTY ? 'human'
7
+ // If its not a TTY but is a CI environment, use human output
8
+ // TODO: make a better view option for CI environments
9
+ : process.env.CI ? 'human'
10
+ // Otherwise, use json output
11
+ : 'json';
12
+ export const defaultEditor = () => process.env.EDITOR ||
13
+ process.env.VISUAL ||
14
+ (process.platform === 'win32' ?
15
+ `${process.env.SYSTEMROOT}\\notepad.exe`
16
+ : 'vi');
4
17
  const canonicalCommands = {
18
+ build: 'build',
5
19
  cache: 'cache',
20
+ ci: 'ci',
6
21
  config: 'config',
22
+ docs: 'docs',
7
23
  exec: 'exec',
8
24
  'exec-local': 'exec-local',
9
- gui: 'gui',
10
25
  help: 'help',
11
26
  init: 'init',
12
27
  install: 'install',
@@ -14,28 +29,39 @@ const canonicalCommands = {
14
29
  logout: 'logout',
15
30
  list: 'list',
16
31
  ls: 'ls',
32
+ pack: 'pack',
17
33
  pkg: 'pkg',
34
+ publish: 'publish',
18
35
  query: 'query',
19
36
  'run-exec': 'run-exec',
20
37
  run: 'run',
38
+ serve: 'serve',
21
39
  token: 'token',
22
40
  uninstall: 'uninstall',
41
+ update: 'update',
42
+ 'exec-cache': 'exec-cache',
43
+ version: 'version',
23
44
  whoami: 'whoami',
24
45
  };
25
46
  const aliases = {
26
47
  i: 'install',
27
48
  add: 'install',
28
49
  rm: 'uninstall',
29
- u: 'uninstall',
50
+ u: 'update',
51
+ p: 'pkg',
52
+ pub: 'publish',
53
+ q: 'query',
54
+ b: 'build',
30
55
  r: 'run',
31
56
  'run-script': 'run',
32
57
  rx: 'run-exec',
58
+ s: 'serve',
33
59
  x: 'exec',
34
60
  xl: 'exec-local',
35
61
  h: 'help',
36
62
  '?': 'help',
37
- conf: 'config',
38
63
  ls: 'list',
64
+ xc: 'exec-cache',
39
65
  };
40
66
  /**
41
67
  * Command aliases mapped to their canonical names
@@ -68,6 +94,7 @@ export const recordFields = [
68
94
  'registries',
69
95
  'git-host-archives',
70
96
  'scope-registries',
97
+ 'jsr-registries',
71
98
  ];
72
99
  export const isRecordField = (s) => recordFields.includes(s);
73
100
  const stopParsingCommands = [
@@ -189,6 +216,24 @@ export const definition = j
189
216
  However, custom registry aliases are not supported by other
190
217
  package managers.`,
191
218
  },
219
+ 'jsr-registries': {
220
+ hint: 'name=url',
221
+ description: `Map alias names to JSR.io registry urls.
222
+
223
+ For example,
224
+ \`--jsr-registries acme=https://jsr.acme.io/\` would
225
+ tell vlt to fetch any packages with the \`acme:\` registry
226
+ prefix from the \`https://jsr.acme.io/\` registry, using
227
+ the "npm Compatibility" translation. So for example,
228
+ the package \`acme:@foo/bar\` would fetch the
229
+ \`@jsr/foo__bar\` package from the \`jsr.acme.io\`
230
+ registry.
231
+
232
+ By default the \`jsr\` alias is always mapped to
233
+ \`https://npm.jsr.io/\`, so existing \`jsr:\` packages will
234
+ be fetched from the public \`jsr\` registry appropriately.
235
+ `,
236
+ },
192
237
  'git-hosts': {
193
238
  hint: `name=template`,
194
239
  short: 'G',
@@ -226,7 +271,7 @@ export const definition = j
226
271
  default: cacheDir,
227
272
  },
228
273
  tag: {
229
- description: `Default \`dist-tag\` to install`,
274
+ description: `Default \`dist-tag\` to install or publish`,
230
275
  default: 'latest',
231
276
  },
232
277
  before: {
@@ -339,6 +384,31 @@ export const definition = j
339
384
  description: `Specify named workspace group names to load and operate on
340
385
  when doing recursive operations on workspaces.`,
341
386
  },
387
+ })
388
+ .opt({
389
+ scope: {
390
+ short: 's',
391
+ hint: 'query',
392
+ description: 'Set to filter the scope of an operation using a DSS Query.',
393
+ },
394
+ target: {
395
+ short: 't',
396
+ hint: 'query',
397
+ description: 'Set to select packages using a DSS Query selector.',
398
+ },
399
+ })
400
+ .flag({
401
+ 'if-present': {
402
+ description: `When running scripts across multiple packages,
403
+ only include packages that have the script.
404
+
405
+ If this is not set, then the run will fail if any
406
+ packages do not have the script.
407
+
408
+ This will default to true if --scope, --workspace,
409
+ --workspace-group, or --recursive is set. Otherwise,
410
+ it will default to false.`,
411
+ },
342
412
  })
343
413
  .flag({
344
414
  recursive: {
@@ -364,11 +434,16 @@ export const definition = j
364
434
  })
365
435
  .opt({
366
436
  config: {
367
- hint: 'user | project',
368
- description: `Specify whether to operate on user-level or project-level
369
- configuration files when running \`vlt config\` commands.`,
370
- validOptions: ['user', 'project'],
371
- default: 'project',
437
+ hint: 'all | user | project',
438
+ description: `Specify which configuration to show or operate on when running
439
+ \`vlt config\` commands. For read operations (get, pick, list):
440
+ \`all\` shows merged configuration from both user and project
441
+ files (default). For write operations (set, delete, edit):
442
+ defaults to \`project\`. \`user\` shows/modifies only user-level
443
+ configuration, \`project\` shows/modifies only project-level
444
+ configuration.`,
445
+ validOptions: ['all', 'user', 'project'],
446
+ default: 'all',
372
447
  },
373
448
  editor: {
374
449
  hint: 'program',
@@ -378,23 +453,23 @@ export const definition = j
378
453
 
379
454
  Defaults to the \`EDITOR\` or \`VISUAL\` env if set, or
380
455
  \`notepad.exe\` on Windows, or \`vi\` elsewhere.`,
381
- default: process.env.EDITOR ||
382
- process.env.VISUAL ||
383
- (process.platform === 'win32' ?
384
- `${process.env.SYSTEMROOT}\\notepad.exe`
385
- : 'vi'),
456
+ default: defaultEditor(),
386
457
  },
387
458
  'script-shell': {
388
459
  hint: 'program',
389
- description: `The shell to use when executing \`package.json#scripts\`
390
- (either as lifecycle scripts or explicitly with
391
- \`vlt run\`) and \`vlt exec\`.
392
-
393
- If not set, defaults to \`/bin/sh\` on POSIX systems,
394
- and \`cmd.exe\` on Windows.
395
-
396
- When no argument is provided to \`vlt exec\`, the \`SHELL\`
397
- environment variable takes precedence if set.`,
460
+ description: `The shell to use when executing \`package.json#scripts\`.
461
+
462
+ For \`vlt exec\` and \`vlt exec-local\`, this is never set,
463
+ meaning that command arguments are run exactly as provided.
464
+
465
+ For \`vlt run\` (and other things that run lifecycle
466
+ scripts in \`package.json#scripts\`), the entire command
467
+ with all arguments is provided as a single string, meaning
468
+ that some value must be provided for shell interpretation,
469
+ and so for these contexts, the \`script-shell\` value will
470
+ default to \`/bin/sh\` on POSIX systems or \`cmd.exe\` on
471
+ Windows.
472
+ `,
398
473
  },
399
474
  'fallback-command': {
400
475
  hint: 'command',
@@ -436,6 +511,7 @@ export const definition = j
436
511
  commands.)
437
512
  - mermaid: Output mermaid diagramming syntax. (Only
438
513
  relevant for certain commands.)
514
+ - silent: Suppress all output to stdout.
439
515
 
440
516
  If the requested view format is not supported for the
441
517
  current command, or if no option is provided, then it
@@ -447,13 +523,14 @@ export const definition = j
447
523
  'mermaid',
448
524
  'gui',
449
525
  'inspect',
526
+ 'silent',
450
527
  ],
451
528
  },
452
529
  })
453
530
  .optList({
454
531
  'dashboard-root': {
455
532
  hint: 'path',
456
- description: `The root directory to use for the dashboard GUI.
533
+ description: `The root directory to use for the dashboard browser-based UI.
457
534
  If not set, the user home directory is used.`,
458
535
  },
459
536
  })
@@ -479,18 +556,6 @@ export const definition = j
479
556
  devDependencies or optionalDependencies, but you want to
480
557
  move it to be a non-optional production dependency.`,
481
558
  },
482
- })
483
- .flag({
484
- version: {
485
- short: 'v',
486
- description: 'Print the version',
487
- },
488
- })
489
- .flag({
490
- help: {
491
- short: 'h',
492
- description: 'Print helpful information',
493
- },
494
559
  })
495
560
  .opt({
496
561
  'expect-results': {
@@ -505,5 +570,88 @@ export const definition = j
505
570
  followed by a number can be used to check if the result
506
571
  is greater than or less than a specific number.`,
507
572
  },
573
+ })
574
+ .flag({
575
+ 'dry-run': {
576
+ description: 'Run command without making any changes',
577
+ },
578
+ 'expect-lockfile': {
579
+ description: 'Fail if lockfile is missing or out of date. Used by ci command to enforce lockfile integrity.',
580
+ },
581
+ 'frozen-lockfile': {
582
+ description: 'Fail if lockfile is missing or out of sync with package.json. Prevents any lockfile modifications.',
583
+ },
584
+ 'lockfile-only': {
585
+ description: 'Only update the lockfile (vlt-lock.json) and package.json files, skip all node_modules operations including package extraction and filesystem changes.',
586
+ },
587
+ })
588
+ .opt({
589
+ 'allow-scripts': {
590
+ hint: 'query',
591
+ description: `Filter which packages are allowed to run lifecycle scripts using DSS query syntax.
592
+ When provided, only packages matching the query will execute their
593
+ install, preinstall, postinstall, prepare, preprepare, and postprepare scripts.
594
+ Defaults to ':not(*)' which means no scripts will be run.
595
+
596
+ Example: --allow-scripts=":root > *, #my-package"
597
+ Runs scripts only for direct dependencies of the current project and any occurrences
598
+ of a specific dependency with the name "my-package" anywhere in the dependency graph.`,
599
+ },
600
+ })
601
+ .opt({
602
+ access: {
603
+ description: 'Set the access level of the package',
604
+ validOptions: ['public', 'restricted'],
605
+ default: 'public',
606
+ },
607
+ })
608
+ .opt({
609
+ otp: {
610
+ description: `Provide an OTP to use when publishing a package.`,
611
+ },
612
+ 'publish-directory': {
613
+ hint: 'path',
614
+ description: `Directory to use for pack and publish operations instead of the current directory.
615
+ The directory must exist and nothing will be copied to it.`,
616
+ },
617
+ port: {
618
+ hint: 'number',
619
+ description: `Port for the browser-based UI server when using vlt serve command (default: 8000).`,
620
+ },
621
+ 'registry-port': {
622
+ hint: 'number',
623
+ description: `Port for the VSR registry when using vlt serve command (default: 1337).`,
624
+ },
625
+ })
626
+ .flag({
627
+ yes: {
628
+ short: 'y',
629
+ description: `Automatically accept any confirmation prompts`,
630
+ },
631
+ version: {
632
+ short: 'v',
633
+ description: 'Print the version',
634
+ },
635
+ help: {
636
+ short: 'h',
637
+ description: 'Print helpful information',
638
+ },
639
+ all: {
640
+ short: 'a',
641
+ description: 'Show all commands, bins, and flags',
642
+ },
508
643
  });
644
+ export const getSortedCliOptions = () => {
645
+ const defs = definition.toJSON();
646
+ return getSortedKeys().map((k) => {
647
+ const def = defs[k];
648
+ /* c8 ignore next */
649
+ if (!def)
650
+ throw error('invalid key found', { found: k });
651
+ if (def.type === 'boolean')
652
+ return `--${k}`;
653
+ return `--${k}=<${def.hint ?? k}>`;
654
+ });
655
+ };
656
+ export const getSortedKeys = () => Object.keys(definition.toJSON()).sort((a, b) => a.localeCompare(b));
509
657
  //# sourceMappingURL=definition.js.map
@@ -1 +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,iBAAiB,GAAG;IACxB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,YAAY,EAAE,YAAY;IAC1B,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,UAAU;IACtB,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAA;AAEV,MAAM,OAAO,GAAG;IACd,CAAC,EAAE,SAAS;IACZ,GAAG,EAAE,SAAS;IACd,EAAE,EAAE,WAAW;IACf,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,KAAK;IACR,YAAY,EAAE,KAAK;IACnB,EAAE,EAAE,UAAU;IACd,CAAC,EAAE,MAAM;IACT,EAAE,EAAE,YAAY;IAChB,CAAC,EAAE,MAAM;IACT,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,QAAQ;IACd,EAAE,EAAE,MAAM;CACF,CAAA;AAEV;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG,iBAAiB;IACpB,GAAG,OAAO;CACF,CAAA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AED,IAAI,CAAC;IACJ,IAAI,EAAE;QACJ,KAAK,EAAE,GAAG;QACV,WAAW,EAAE,2BAA2B;KACzC;CACF,CAAC;KAED,GAAG,CAAC;IACH,gBAAgB,EAAE;QAChB,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,CAAC,CAAU,EAAE,EAAE,CACvB,OAAO,CAAC,KAAK,QAAQ,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;QACtD,WAAW,EAAE;;;;;;;oEAOiD;KAC/D;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 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} 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 (either as lifecycle scripts or explicitly with\n \\`vlt run\\`) and \\`vlt exec\\`.\n\n If not set, defaults to \\`/bin/sh\\` on POSIX systems,\n and \\`cmd.exe\\` on Windows.\n\n When no argument is provided to \\`vlt exec\\`, the \\`SHELL\\`\n environment variable takes precedence if set.`,\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 .flag({\n version: {\n short: 'v',\n description: 'Print the version',\n },\n })\n\n .flag({\n help: {\n short: 'h',\n description: 'Print helpful information',\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"]}
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/config/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,CAAC,MAAM,WAAW;AACtB,uCAAuC;AACvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO;IAC5B,6DAA6D;IAC7D,sDAAsD;IACxD,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO;QACxB,6BAA6B;QAC/B,CAAC,CAAC,MAAM,CAAA;AAEV,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAChC,OAAO,CAAC,GAAG,CAAC,MAAM;IAClB,OAAO,CAAC,GAAG,CAAC,MAAM;IAClB,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;QAC7B,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,eAAe;QAC1C,CAAC,CAAC,IAAI,CAAC,CAAA;AAET,MAAM,iBAAiB,GAAG;IACxB,KAAK,EAAE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AAE,GAAG;QACV,WAAW,EAAE,mBAAmB;KACjC;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,GAAG;QACV,WAAW,EAAE,2BAA2B;KACzC;IACD,GAAG,EAAE;QACH,KAAK,EAAE,GAAG;QACV,WAAW,EAAE,oCAAoC;KAClD;CACF,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,EAAE,CAAA;IAChC,OAAO,aAAa,EAAE,CAAC,GAAG,CAAC,CAAC,CAAoB,EAAE,EAAE;QAClD,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACnB,oBAAoB;QACpB,IAAI,CAAC,GAAG;YAAE,MAAM,KAAK,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAA;QACxD,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC,EAAE,CAAA;QAC3C,OAAO,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAA;IACpC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAChC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { XDG } from '@vltpkg/xdg'\nimport { jack } from 'jackspeak'\n\nexport const defaultView =\n // If stdout is a TTY, use human output\n process.stdout.isTTY ? 'human'\n // If its not a TTY but is a CI environment, use human output\n // TODO: make a better view option for CI environments\n : process.env.CI ? 'human'\n // Otherwise, use json output\n : 'json'\n\nexport const defaultEditor = () =>\n process.env.EDITOR ||\n process.env.VISUAL ||\n (process.platform === 'win32' ?\n `${process.env.SYSTEMROOT}\\\\notepad.exe`\n : 'vi')\n\nconst canonicalCommands = {\n build: 'build',\n cache: 'cache',\n ci: 'ci',\n config: 'config',\n docs: 'docs',\n exec: 'exec',\n 'exec-local': 'exec-local',\n help: 'help',\n init: 'init',\n install: 'install',\n login: 'login',\n logout: 'logout',\n list: 'list',\n ls: 'ls',\n pack: 'pack',\n pkg: 'pkg',\n publish: 'publish',\n query: 'query',\n 'run-exec': 'run-exec',\n run: 'run',\n serve: 'serve',\n token: 'token',\n uninstall: 'uninstall',\n update: 'update',\n 'exec-cache': 'exec-cache',\n version: 'version',\n whoami: 'whoami',\n} as const\n\nconst aliases = {\n i: 'install',\n add: 'install',\n rm: 'uninstall',\n u: 'update',\n p: 'pkg',\n pub: 'publish',\n q: 'query',\n b: 'build',\n r: 'run',\n 'run-script': 'run',\n rx: 'run-exec',\n s: 'serve',\n x: 'exec',\n xl: 'exec-local',\n h: 'help',\n '?': 'help',\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 'jsr-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 'jsr-registries': {\n hint: 'name=url',\n description: `Map alias names to JSR.io registry urls.\n\n For example,\n \\`--jsr-registries acme=https://jsr.acme.io/\\` would\n tell vlt to fetch any packages with the \\`acme:\\` registry\n prefix from the \\`https://jsr.acme.io/\\` registry, using\n the \"npm Compatibility\" translation. So for example,\n the package \\`acme:@foo/bar\\` would fetch the\n \\`@jsr/foo__bar\\` package from the \\`jsr.acme.io\\`\n registry.\n\n By default the \\`jsr\\` alias is always mapped to\n \\`https://npm.jsr.io/\\`, so existing \\`jsr:\\` packages will\n be fetched from the public \\`jsr\\` registry appropriately.\n `,\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 or publish`,\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 .opt({\n scope: {\n short: 's',\n hint: 'query',\n description:\n 'Set to filter the scope of an operation using a DSS Query.',\n },\n target: {\n short: 't',\n hint: 'query',\n description:\n 'Set to select packages using a DSS Query selector.',\n },\n })\n\n .flag({\n 'if-present': {\n description: `When running scripts across multiple packages,\n only include packages that have the script.\n\n If this is not set, then the run will fail if any\n packages do not have the script.\n\n This will default to true if --scope, --workspace,\n --workspace-group, or --recursive is set. Otherwise,\n it will default to false.`,\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: 'all | user | project',\n description: `Specify which configuration to show or operate on when running\n \\`vlt config\\` commands. For read operations (get, pick, list):\n \\`all\\` shows merged configuration from both user and project\n files (default). For write operations (set, delete, edit):\n defaults to \\`project\\`. \\`user\\` shows/modifies only user-level\n configuration, \\`project\\` shows/modifies only project-level\n configuration.`,\n validOptions: ['all', 'user', 'project'] as const,\n default: 'all',\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: defaultEditor(),\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 - silent: Suppress all output to stdout.\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 'silent',\n ] as const,\n },\n })\n\n .optList({\n 'dashboard-root': {\n hint: 'path',\n description: `The root directory to use for the dashboard browser-based UI.\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 'dry-run': {\n description: 'Run command without making any changes',\n },\n 'expect-lockfile': {\n description:\n 'Fail if lockfile is missing or out of date. Used by ci command to enforce lockfile integrity.',\n },\n 'frozen-lockfile': {\n description:\n 'Fail if lockfile is missing or out of sync with package.json. Prevents any lockfile modifications.',\n },\n 'lockfile-only': {\n description:\n 'Only update the lockfile (vlt-lock.json) and package.json files, skip all node_modules operations including package extraction and filesystem changes.',\n },\n })\n .opt({\n 'allow-scripts': {\n hint: 'query',\n description: `Filter which packages are allowed to run lifecycle scripts using DSS query syntax.\n When provided, only packages matching the query will execute their\n install, preinstall, postinstall, prepare, preprepare, and postprepare scripts.\n Defaults to ':not(*)' which means no scripts will be run.\n \n Example: --allow-scripts=\":root > *, #my-package\"\n Runs scripts only for direct dependencies of the current project and any occurrences\n of a specific dependency with the name \"my-package\" anywhere in the dependency graph.`,\n },\n })\n .opt({\n access: {\n description: 'Set the access level of the package',\n validOptions: ['public', 'restricted'] as const,\n default: 'public',\n },\n })\n .opt({\n otp: {\n description: `Provide an OTP to use when publishing a package.`,\n },\n 'publish-directory': {\n hint: 'path',\n description: `Directory to use for pack and publish operations instead of the current directory.\n The directory must exist and nothing will be copied to it.`,\n },\n port: {\n hint: 'number',\n description: `Port for the browser-based UI server when using vlt serve command (default: 8000).`,\n },\n 'registry-port': {\n hint: 'number',\n description: `Port for the VSR registry when using vlt serve command (default: 1337).`,\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 all: {\n short: 'a',\n description: 'Show all commands, bins, and flags',\n },\n })\n\nexport const getSortedCliOptions = () => {\n const defs = definition.toJSON()\n return getSortedKeys().map((k: keyof typeof defs) => {\n const def = defs[k]\n /* c8 ignore next */\n if (!def) throw error('invalid key found', { found: k })\n if (def.type === 'boolean') return `--${k}`\n return `--${k}=<${def.hint ?? k}>`\n })\n}\n\nexport const getSortedKeys = () =>\n Object.keys(definition.toJSON()).sort((a, b) => a.localeCompare(b))\n"]}
@@ -22,39 +22,52 @@
22
22
  */
23
23
  import { PackageInfoClient } from '@vltpkg/package-info';
24
24
  import { PackageJson } from '@vltpkg/package-json';
25
+ import type { SpecOptions } from '@vltpkg/spec';
26
+ import type { WhichConfig } from '@vltpkg/vlt-json';
25
27
  import { Monorepo } from '@vltpkg/workspaces';
26
28
  import type { Jack, OptionsResults, Unwrap } from 'jackspeak';
27
29
  import { PathScurry } from 'path-scurry';
28
- import { kIndent, kNewline } from 'polite-json';
29
30
  import type { Commands, RecordField } from './definition.ts';
30
31
  import { commands, definition, isRecordField, recordFields } from './definition.ts';
31
32
  export { commands, definition, isRecordField, recordFields, type Commands, };
32
33
  export declare const kCustomInspect: unique symbol;
33
34
  export type RecordPairs = Record<string, unknown>;
34
35
  export type RecordString = Record<string, string>;
35
- export type ConfigFiles = Record<string, ConfigFileData>;
36
- export type PairsAsRecords = Omit<ConfigOptions, 'projectRoot' | 'scurry' | 'packageJson' | 'monorepo' | 'packageInfo'> & {
37
- command?: Record<string, ConfigOptions>;
36
+ export type PairsAsRecords = ConfigOptionsNoExtras & {
37
+ command?: {
38
+ [k in keyof Commands]?: ConfigOptionsNoExtras;
39
+ };
38
40
  };
39
- export declare const pairsToRecords: (obj: ConfigFileData) => PairsAsRecords;
41
+ export declare const pairsToRecords: (obj: NonNullable<ConfigFileData> | OptionsResults<ConfigDefinitions>) => PairsAsRecords;
40
42
  export declare const recordsToPairs: (obj: RecordPairs) => RecordPairs;
43
+ export type ConfigDataNoCommand = {
44
+ [k in keyof OptionsResults<ConfigDefinitions>]?: OptionsResults<ConfigDefinitions>[k];
45
+ };
41
46
  /**
42
47
  * Config data can be any options, and also a 'command' field which
43
48
  * contains command names and override options for that command.
44
49
  */
45
- export type ConfigData = OptionsResults<ConfigDefinitions> & {
46
- command?: Record<string, OptionsResults<ConfigDefinitions>>;
50
+ export type ConfigData = ConfigDataNoCommand & {
51
+ command?: {
52
+ [k in keyof Commands]?: ConfigDataNoCommand;
53
+ };
54
+ };
55
+ export type ConfigFileDataNoCommand = {
56
+ [k in keyof ConfigDataNoCommand]: k extends (OptListKeys<ConfigDataNoCommand>) ? RecordString | string[] : ConfigDataNoCommand[k];
47
57
  };
48
58
  /**
49
- * Config data as it appears in config files, with kv pair lists
50
- * stored as `Record<string, string>`.
59
+ * Config data as it appears in the config field of the vlt.json, with kv pair
60
+ * lists stored as `Record<string, string>` and
51
61
  */
52
- export type ConfigFileData = {
53
- [k in keyof ConfigData]?: k extends OptListKeys<ConfigData> ? RecordString | string[] : k extends 'command' ? ConfigFiles : ConfigData[k];
62
+ export type ConfigFileData = ConfigFileDataNoCommand & {
63
+ command?: {
64
+ [k in keyof Commands]?: ConfigFileDataNoCommand;
65
+ };
66
+ };
67
+ export type ConfigOptionsNoExtras = {
68
+ [k in keyof OptionsResults<ConfigDefinitions>]: k extends (RecordField) ? RecordString : k extends 'command' ? never : OptionsResults<ConfigDefinitions>[k];
54
69
  };
55
- export type ConfigOptions = {
56
- [k in keyof ConfigData]: k extends RecordField ? RecordString : k extends 'command' ? never : ConfigData[k];
57
- } & {
70
+ export type ConfigOptions = ConfigOptionsNoExtras & Pick<SpecOptions, 'catalog' | 'catalogs'> & {
58
71
  packageJson: PackageJson;
59
72
  scurry: PathScurry;
60
73
  projectRoot: string;
@@ -81,11 +94,6 @@ export declare class Config {
81
94
  * representing vlt's configuration
82
95
  */
83
96
  jack: Jack<ConfigDefinitions>;
84
- stringifyOptions: {
85
- [kIndent]: string;
86
- [kNewline]: string;
87
- };
88
- configFiles: ConfigFiles;
89
97
  /**
90
98
  * Parsed values in effect
91
99
  */
@@ -110,7 +118,7 @@ export declare class Config {
110
118
  */
111
119
  positionals?: string[];
112
120
  /**
113
- * The root of the project where a vlt.json, vlt-workspaces.json,
121
+ * The root of the project where a vlt.json, vlt.json,
114
122
  * package.json, or .git was found. Not necessarily the `process.cwd()`,
115
123
  * though that is the default location.
116
124
  *
@@ -155,14 +163,17 @@ export declare class Config {
155
163
  /**
156
164
  * Write the config values to the user or project config file.
157
165
  */
158
- writeConfigFile(which: 'project' | 'user', values: ConfigFileData): Promise<ConfigFileData>;
166
+ writeConfigFile(this: LoadedConfig, which: WhichConfig, values: NonNullable<ConfigFileData>): Promise<void>;
159
167
  /**
160
168
  * Fold in the provided fields with the existing properties
161
169
  * in the config file.
162
170
  */
163
- addConfigToFile(which: 'project' | 'user', values: ConfigFileData): Promise<ConfigFileData>;
164
- getFilename(which?: 'project' | 'user'): string;
165
- deleteConfigKeys(which: 'project' | 'user', fields: string[]): Promise<boolean>;
171
+ addConfigToFile(this: LoadedConfig, which: WhichConfig, values: NonNullable<ConfigFileData>): Promise<void>;
172
+ /**
173
+ * Deletes the specified config fields from the named file
174
+ * Returns `true` if anything was changed.
175
+ */
176
+ deleteConfigKeys(this: LoadedConfig, which: WhichConfig, fields: string[]): Promise<boolean>;
166
177
  /**
167
178
  * Edit the user or project configuration file.
168
179
  *
@@ -173,23 +184,18 @@ export declare class Config {
173
184
  * file after editing, then it's restored to what it was before, which might
174
185
  * mean deleting the file.
175
186
  */
176
- editConfigFile(which: 'project' | 'user', edit: (file: string) => Promise<void> | void): Promise<void>;
187
+ editConfigFile(this: LoadedConfig, which: WhichConfig, edit: (file: string) => Promise<void> | void): Promise<void>;
177
188
  /**
178
189
  * Find the local config file and load both it and the user-level config in
179
190
  * the XDG config home.
180
- *
181
- * Note: if working in a workspaces monorepo, then the vlt.json file MUST
182
- * be in the same folder as the vlt-workspaces.json file, because we stop
183
- * looking when we find either one.
184
191
  */
185
192
  loadConfigFile(): Promise<this>;
186
193
  /**
187
- * Determine whether we should use colors in the output. Update
188
- * chalk appropriately.
189
- *
190
- * Implicitly calls this.parse() if it not parsed already.
194
+ * Force a complete reload of config files from disk.
195
+ * This clears all caches and re-reads config files.
196
+ * Useful for long-running processes that need to pick up config changes.
191
197
  */
192
- loadColor(): Promise<this & LoadedConfig>;
198
+ reloadFromDisk(): Promise<void>;
193
199
  /**
194
200
  * Load the configuration and return a Promise to a
195
201
  * {@link Config} object
@@ -209,7 +215,5 @@ export type ParsedConfig = Config & {
209
215
  /**
210
216
  * A fully loaded {@link Config} object
211
217
  */
212
- export type LoadedConfig = ParsedConfig & {
213
- get(k: 'color'): boolean;
214
- };
218
+ export type LoadedConfig = ParsedConfig;
215
219
  //#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