@vltpkg/cli-sdk 1.0.0-rc.3 → 1.0.0-rc.31

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 (210) hide show
  1. package/dist/commands/access.d.ts +22 -0
  2. package/dist/commands/access.js +246 -0
  3. package/dist/commands/bugs.d.ts +17 -0
  4. package/dist/commands/bugs.js +163 -0
  5. package/dist/{esm/commands → commands}/build.d.ts +0 -1
  6. package/dist/{esm/commands → commands}/build.js +0 -1
  7. package/dist/{esm/commands → commands}/cache.d.ts +0 -1
  8. package/dist/{esm/commands → commands}/cache.js +0 -1
  9. package/dist/{esm/commands → commands}/ci.d.ts +0 -1
  10. package/dist/{esm/commands → commands}/ci.js +11 -3
  11. package/dist/{esm/commands → commands}/config.d.ts +0 -1
  12. package/dist/{esm/commands → commands}/config.js +6 -1
  13. package/dist/commands/create.d.ts +8 -0
  14. package/dist/commands/create.js +102 -0
  15. package/dist/commands/deprecate.d.ts +13 -0
  16. package/dist/commands/deprecate.js +139 -0
  17. package/dist/commands/dist-tag.d.ts +21 -0
  18. package/dist/commands/dist-tag.js +177 -0
  19. package/dist/{esm/commands → commands}/docs.d.ts +0 -1
  20. package/dist/{esm/commands → commands}/docs.js +2 -3
  21. package/dist/{esm/commands → commands}/exec-cache.d.ts +0 -1
  22. package/dist/{esm/commands → commands}/exec-cache.js +0 -1
  23. package/dist/{esm/commands → commands}/exec-local.d.ts +0 -1
  24. package/dist/{esm/commands → commands}/exec-local.js +23 -1
  25. package/dist/{esm/commands → commands}/exec.d.ts +0 -1
  26. package/dist/{esm/commands → commands}/exec.js +84 -10
  27. package/dist/{esm/commands → commands}/help.d.ts +0 -1
  28. package/dist/{esm/commands → commands}/help.js +5 -1
  29. package/dist/{esm/commands → commands}/init.d.ts +0 -1
  30. package/dist/{esm/commands → commands}/init.js +31 -10
  31. package/dist/{esm/commands → commands}/install/reporter.d.ts +0 -1
  32. package/dist/{esm/commands → commands}/install/reporter.js +0 -1
  33. package/dist/{esm/commands → commands}/install.d.ts +21 -3
  34. package/dist/commands/install.js +140 -0
  35. package/dist/{esm/commands → commands}/list.d.ts +4 -2
  36. package/dist/{esm/commands → commands}/list.js +8 -10
  37. package/dist/{esm/commands → commands}/login.d.ts +0 -1
  38. package/dist/{esm/commands → commands}/login.js +10 -1
  39. package/dist/{esm/commands/token.d.ts → commands/logout.d.ts} +0 -1
  40. package/dist/{esm/commands → commands}/logout.js +10 -1
  41. package/dist/{esm/commands → commands}/pack.d.ts +0 -1
  42. package/dist/{esm/commands → commands}/pack.js +90 -32
  43. package/dist/commands/ping.d.ts +17 -0
  44. package/dist/commands/ping.js +114 -0
  45. package/dist/{esm/commands → commands}/pkg.d.ts +0 -1
  46. package/dist/{esm/commands → commands}/pkg.js +27 -1
  47. package/dist/commands/profile.d.ts +13 -0
  48. package/dist/commands/profile.js +104 -0
  49. package/dist/{esm/commands → commands}/publish.d.ts +1 -2
  50. package/dist/{esm/commands → commands}/publish.js +63 -12
  51. package/dist/{esm/commands → commands}/query.d.ts +4 -2
  52. package/dist/{esm/commands → commands}/query.js +12 -10
  53. package/dist/commands/repo.d.ts +17 -0
  54. package/dist/commands/repo.js +157 -0
  55. package/dist/{esm/commands → commands}/run-exec.d.ts +0 -1
  56. package/dist/commands/run-exec.js +40 -0
  57. package/dist/{esm/commands → commands}/run.d.ts +0 -1
  58. package/dist/{esm/commands → commands}/run.js +27 -1
  59. package/dist/commands/token.d.ts +31 -0
  60. package/dist/commands/token.js +186 -0
  61. package/dist/{esm/commands → commands}/uninstall.d.ts +0 -1
  62. package/dist/{esm/commands → commands}/uninstall.js +16 -3
  63. package/dist/commands/unpublish.d.ts +15 -0
  64. package/dist/commands/unpublish.js +200 -0
  65. package/dist/{esm/commands → commands}/update.d.ts +0 -1
  66. package/dist/{esm/commands → commands}/update.js +6 -1
  67. package/dist/{esm/commands → commands}/version.d.ts +0 -1
  68. package/dist/{esm/commands → commands}/version.js +27 -1
  69. package/dist/commands/view.d.ts +22 -0
  70. package/dist/commands/view.js +334 -0
  71. package/dist/{esm/commands → commands}/whoami.d.ts +0 -1
  72. package/dist/{esm/commands → commands}/whoami.js +10 -1
  73. package/dist/{esm/config → config}/definition.d.ts +39 -19
  74. package/dist/{esm/config → config}/definition.js +74 -39
  75. package/dist/{esm/config → config}/index.d.ts +0 -1
  76. package/dist/{esm/config → config}/index.js +37 -2
  77. package/dist/{esm/config → config}/merge.d.ts +0 -1
  78. package/dist/{esm/config → config}/merge.js +0 -1
  79. package/dist/{esm/config → config}/usage.d.ts +0 -1
  80. package/dist/{esm/config → config}/usage.js +0 -1
  81. package/dist/{esm/custom-help.d.ts → custom-help.d.ts} +0 -1
  82. package/dist/{esm/custom-help.js → custom-help.js} +35 -9
  83. package/dist/{esm/exec-command.d.ts → exec-command.d.ts} +0 -1
  84. package/dist/{esm/exec-command.js → exec-command.js} +14 -8
  85. package/dist/{esm/index.d.ts → index.d.ts} +0 -1
  86. package/dist/{esm/index.js → index.js} +1 -2
  87. package/dist/{esm/load-command.d.ts → load-command.d.ts} +0 -1
  88. package/dist/{esm/load-command.js → load-command.js} +0 -1
  89. package/dist/mermaid-image-view.d.ts +18 -0
  90. package/dist/mermaid-image-view.js +36 -0
  91. package/dist/{esm/output.d.ts → output.d.ts} +2 -2
  92. package/dist/{esm/output.js → output.js} +55 -2
  93. package/dist/{esm/pack-tarball.d.ts → pack-tarball.d.ts} +15 -1
  94. package/dist/{esm/pack-tarball.js → pack-tarball.js} +133 -91
  95. package/dist/{esm/parse-add-remove-args.d.ts → parse-add-remove-args.d.ts} +9 -3
  96. package/dist/{esm/parse-add-remove-args.js → parse-add-remove-args.js} +43 -11
  97. package/dist/{esm/print-err.d.ts → print-err.d.ts} +0 -1
  98. package/dist/{esm/print-err.js → print-err.js} +18 -3
  99. package/dist/query-diff-files.d.ts +17 -0
  100. package/dist/query-diff-files.js +63 -0
  101. package/dist/{esm/query-host-contexts.d.ts → query-host-contexts.d.ts} +0 -1
  102. package/dist/{esm/query-host-contexts.js → query-host-contexts.js} +8 -7
  103. package/dist/{esm/read-password.d.ts → read-password.d.ts} +0 -1
  104. package/dist/{esm/read-password.js → read-password.js} +0 -1
  105. package/dist/read-project-folders.d.ts +17 -0
  106. package/dist/read-project-folders.js +100 -0
  107. package/dist/reload-config.d.ts +2 -0
  108. package/dist/reload-config.js +11 -0
  109. package/dist/render-mermaid.d.ts +22 -0
  110. package/dist/render-mermaid.js +68 -0
  111. package/dist/telemetry.d.ts +58 -0
  112. package/dist/telemetry.js +170 -0
  113. package/dist/{esm/view.d.ts → view.d.ts} +0 -1
  114. package/dist/{esm/view.js → view.js} +1 -2
  115. package/package.json +69 -83
  116. package/dist/esm/commands/build.d.ts.map +0 -1
  117. package/dist/esm/commands/build.js.map +0 -1
  118. package/dist/esm/commands/cache.d.ts.map +0 -1
  119. package/dist/esm/commands/cache.js.map +0 -1
  120. package/dist/esm/commands/ci.d.ts.map +0 -1
  121. package/dist/esm/commands/ci.js.map +0 -1
  122. package/dist/esm/commands/config.d.ts.map +0 -1
  123. package/dist/esm/commands/config.js.map +0 -1
  124. package/dist/esm/commands/docs.d.ts.map +0 -1
  125. package/dist/esm/commands/docs.js.map +0 -1
  126. package/dist/esm/commands/exec-cache.d.ts.map +0 -1
  127. package/dist/esm/commands/exec-cache.js.map +0 -1
  128. package/dist/esm/commands/exec-local.d.ts.map +0 -1
  129. package/dist/esm/commands/exec-local.js.map +0 -1
  130. package/dist/esm/commands/exec.d.ts.map +0 -1
  131. package/dist/esm/commands/exec.js.map +0 -1
  132. package/dist/esm/commands/help.d.ts.map +0 -1
  133. package/dist/esm/commands/help.js.map +0 -1
  134. package/dist/esm/commands/init.d.ts.map +0 -1
  135. package/dist/esm/commands/init.js.map +0 -1
  136. package/dist/esm/commands/install/reporter.d.ts.map +0 -1
  137. package/dist/esm/commands/install/reporter.js.map +0 -1
  138. package/dist/esm/commands/install.d.ts.map +0 -1
  139. package/dist/esm/commands/install.js +0 -45
  140. package/dist/esm/commands/install.js.map +0 -1
  141. package/dist/esm/commands/list.d.ts.map +0 -1
  142. package/dist/esm/commands/list.js.map +0 -1
  143. package/dist/esm/commands/login.d.ts.map +0 -1
  144. package/dist/esm/commands/login.js.map +0 -1
  145. package/dist/esm/commands/logout.d.ts +0 -4
  146. package/dist/esm/commands/logout.d.ts.map +0 -1
  147. package/dist/esm/commands/logout.js.map +0 -1
  148. package/dist/esm/commands/pack.d.ts.map +0 -1
  149. package/dist/esm/commands/pack.js.map +0 -1
  150. package/dist/esm/commands/pkg.d.ts.map +0 -1
  151. package/dist/esm/commands/pkg.js.map +0 -1
  152. package/dist/esm/commands/publish.d.ts.map +0 -1
  153. package/dist/esm/commands/publish.js.map +0 -1
  154. package/dist/esm/commands/query.d.ts.map +0 -1
  155. package/dist/esm/commands/query.js.map +0 -1
  156. package/dist/esm/commands/run-exec.d.ts.map +0 -1
  157. package/dist/esm/commands/run-exec.js +0 -14
  158. package/dist/esm/commands/run-exec.js.map +0 -1
  159. package/dist/esm/commands/run.d.ts.map +0 -1
  160. package/dist/esm/commands/run.js.map +0 -1
  161. package/dist/esm/commands/serve.d.ts +0 -14
  162. package/dist/esm/commands/serve.d.ts.map +0 -1
  163. package/dist/esm/commands/serve.js +0 -103
  164. package/dist/esm/commands/serve.js.map +0 -1
  165. package/dist/esm/commands/token.d.ts.map +0 -1
  166. package/dist/esm/commands/token.js +0 -30
  167. package/dist/esm/commands/token.js.map +0 -1
  168. package/dist/esm/commands/uninstall.d.ts.map +0 -1
  169. package/dist/esm/commands/uninstall.js.map +0 -1
  170. package/dist/esm/commands/update.d.ts.map +0 -1
  171. package/dist/esm/commands/update.js.map +0 -1
  172. package/dist/esm/commands/version.d.ts.map +0 -1
  173. package/dist/esm/commands/version.js.map +0 -1
  174. package/dist/esm/commands/whoami.d.ts.map +0 -1
  175. package/dist/esm/commands/whoami.js.map +0 -1
  176. package/dist/esm/config/definition.d.ts.map +0 -1
  177. package/dist/esm/config/definition.js.map +0 -1
  178. package/dist/esm/config/index.d.ts.map +0 -1
  179. package/dist/esm/config/index.js.map +0 -1
  180. package/dist/esm/config/merge.d.ts.map +0 -1
  181. package/dist/esm/config/merge.js.map +0 -1
  182. package/dist/esm/config/usage.d.ts.map +0 -1
  183. package/dist/esm/config/usage.js.map +0 -1
  184. package/dist/esm/custom-help.d.ts.map +0 -1
  185. package/dist/esm/custom-help.js.map +0 -1
  186. package/dist/esm/exec-command.d.ts.map +0 -1
  187. package/dist/esm/exec-command.js.map +0 -1
  188. package/dist/esm/index.d.ts.map +0 -1
  189. package/dist/esm/index.js.map +0 -1
  190. package/dist/esm/load-command.d.ts.map +0 -1
  191. package/dist/esm/load-command.js.map +0 -1
  192. package/dist/esm/output.d.ts.map +0 -1
  193. package/dist/esm/output.js.map +0 -1
  194. package/dist/esm/pack-tarball.d.ts.map +0 -1
  195. package/dist/esm/pack-tarball.js.map +0 -1
  196. package/dist/esm/package.json +0 -3
  197. package/dist/esm/parse-add-remove-args.d.ts.map +0 -1
  198. package/dist/esm/parse-add-remove-args.js.map +0 -1
  199. package/dist/esm/print-err.d.ts.map +0 -1
  200. package/dist/esm/print-err.js.map +0 -1
  201. package/dist/esm/query-host-contexts.d.ts.map +0 -1
  202. package/dist/esm/query-host-contexts.js.map +0 -1
  203. package/dist/esm/read-password.d.ts.map +0 -1
  204. package/dist/esm/read-password.js.map +0 -1
  205. package/dist/esm/start-gui.d.ts +0 -10
  206. package/dist/esm/start-gui.d.ts.map +0 -1
  207. package/dist/esm/start-gui.js +0 -60
  208. package/dist/esm/start-gui.js.map +0 -1
  209. package/dist/esm/view.d.ts.map +0 -1
  210. package/dist/esm/view.js.map +0 -1
@@ -0,0 +1,13 @@
1
+ import type { JSONField } from '@vltpkg/types';
2
+ import type { CommandFn, CommandUsage } from '../index.ts';
3
+ export declare const usage: CommandUsage;
4
+ export type ProfileData = Record<string, JSONField>;
5
+ export type ProfileResult = ProfileData | {
6
+ property: string;
7
+ value: JSONField;
8
+ };
9
+ export declare const views: {
10
+ readonly human: (result: ProfileResult) => string;
11
+ readonly json: (r: ProfileResult) => ProfileResult;
12
+ };
13
+ export declare const command: CommandFn<ProfileResult>;
@@ -0,0 +1,104 @@
1
+ import { error } from '@vltpkg/error-cause';
2
+ import { RegistryClient } from '@vltpkg/registry-client';
3
+ import { commandUsage } from "../config/usage.js";
4
+ export const usage = () => commandUsage({
5
+ command: 'profile',
6
+ usage: '<command> [<args>]',
7
+ description: `Get or set profile properties for the authenticated user
8
+ on the configured registry.`,
9
+ subcommands: {
10
+ get: {
11
+ usage: '[<property>]',
12
+ description: 'Display profile information. Optionally pass a property name to get a single value.',
13
+ },
14
+ set: {
15
+ usage: '<property> <value>',
16
+ description: 'Set a profile property to the given value.',
17
+ },
18
+ },
19
+ options: {
20
+ registry: {
21
+ value: '<url>',
22
+ description: 'Registry URL to query for profile info.',
23
+ },
24
+ identity: {
25
+ value: '<name>',
26
+ description: 'Identity namespace used to look up auth tokens.',
27
+ },
28
+ otp: {
29
+ description: 'Provide an OTP to use when updating profile properties.',
30
+ value: '<otp>',
31
+ },
32
+ },
33
+ });
34
+ const stringify = (v) => typeof v === 'string' ? v
35
+ : typeof v === 'number' || typeof v === 'boolean' ? `${v}`
36
+ : v === null ? 'null'
37
+ : JSON.stringify(v);
38
+ export const views = {
39
+ human: result => {
40
+ if ('property' in result) {
41
+ return stringify(result.value);
42
+ }
43
+ return Object.entries(result)
44
+ .map(([k, v]) => `${k}: ${stringify(v)}`)
45
+ .join('\n');
46
+ },
47
+ json: r => r,
48
+ };
49
+ export const command = async (conf) => {
50
+ const [sub, ...args] = conf.positionals;
51
+ switch (sub) {
52
+ case 'get':
53
+ return getProfile(conf, args);
54
+ case 'set':
55
+ return setProfile(conf, args);
56
+ default: {
57
+ throw error('Invalid profile subcommand', {
58
+ found: sub,
59
+ validOptions: ['get', 'set'],
60
+ code: 'EUSAGE',
61
+ });
62
+ }
63
+ }
64
+ };
65
+ const getProfile = async (conf, args) => {
66
+ const rc = new RegistryClient(conf.options);
67
+ const registryUrl = new URL(conf.options.registry);
68
+ const url = new URL('-/npm/v1/user', registryUrl);
69
+ const response = await rc.request(url, { useCache: false });
70
+ const data = response.json();
71
+ const [property] = args;
72
+ if (property) {
73
+ if (!(property in data)) {
74
+ throw error('Property not found in profile', {
75
+ found: property,
76
+ validOptions: Object.keys(data),
77
+ code: 'EUSAGE',
78
+ });
79
+ }
80
+ return { property, value: data[property] };
81
+ }
82
+ return data;
83
+ };
84
+ const setProfile = async (conf, args) => {
85
+ const [property, ...rest] = args;
86
+ const value = rest.join(' ');
87
+ if (!property || !value) {
88
+ throw error('set requires a property name and value', {
89
+ code: 'EUSAGE',
90
+ });
91
+ }
92
+ const rc = new RegistryClient(conf.options);
93
+ const registryUrl = new URL(conf.options.registry);
94
+ const url = new URL('-/npm/v1/user', registryUrl);
95
+ const response = await rc.request(url, {
96
+ method: 'POST',
97
+ headers: { 'content-type': 'application/json' },
98
+ body: JSON.stringify({ [property]: value }),
99
+ otp: conf.options.otp,
100
+ useCache: false,
101
+ });
102
+ const data = response.json();
103
+ return { property, value: data[property] };
104
+ };
@@ -9,7 +9,7 @@ export type CommandResultSingle = {
9
9
  shasum?: string;
10
10
  integrity?: string;
11
11
  size: number;
12
- access: string;
12
+ access?: string;
13
13
  unpackedSize: number;
14
14
  files: string[];
15
15
  };
@@ -19,4 +19,3 @@ export declare const views: {
19
19
  readonly json: (r: CommandResult) => CommandResult;
20
20
  };
21
21
  export declare const command: CommandFn<CommandResult>;
22
- //# sourceMappingURL=publish.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { error } from '@vltpkg/error-cause';
2
- import { RegistryClient } from '@vltpkg/registry-client';
2
+ import { RegistryClient, oidc, registryBase, } from '@vltpkg/registry-client';
3
3
  import { run } from '@vltpkg/run';
4
4
  import { commandUsage } from "../config/usage.js";
5
5
  import { packTarball } from "../pack-tarball.js";
@@ -10,6 +10,7 @@ import prettyBytes from 'pretty-bytes';
10
10
  import { actual } from '@vltpkg/graph';
11
11
  import { Query } from '@vltpkg/query';
12
12
  import { createHostContextsMap } from "../query-host-contexts.js";
13
+ import { minimatch } from 'minimatch';
13
14
  export const usage = () => commandUsage({
14
15
  command: 'publish',
15
16
  usage: '',
@@ -35,6 +36,24 @@ export const usage = () => commandUsage({
35
36
  The directory must exist and nothing will be copied to it.`,
36
37
  value: '<path>',
37
38
  },
39
+ 'dry-run': {
40
+ description: 'Show what would be published without actually publishing.',
41
+ },
42
+ scope: {
43
+ value: '<query>',
44
+ description: 'Filter packages to publish using a DSS query selector.',
45
+ },
46
+ workspace: {
47
+ value: '<path|glob>',
48
+ description: 'Limit publish targets to matching workspaces.',
49
+ },
50
+ 'workspace-group': {
51
+ value: '<name>',
52
+ description: 'Limit publish targets to workspace groups.',
53
+ },
54
+ recursive: {
55
+ description: 'Publish all workspaces in the monorepo.',
56
+ },
38
57
  },
39
58
  });
40
59
  export const views = {
@@ -102,6 +121,15 @@ export const command = async (conf) => {
102
121
  }
103
122
  else if (paths?.length || groups?.length || recursive) {
104
123
  for (const workspace of options.monorepo ?? []) {
124
+ if (paths?.length) {
125
+ const matches = paths.some((p) => workspace.path === p ||
126
+ workspace.name === p ||
127
+ workspace.fullpath === p ||
128
+ resolve(projectRoot, p) === workspace.fullpath ||
129
+ minimatch(workspace.path, p));
130
+ if (!matches)
131
+ continue;
132
+ }
105
133
  locations.push(workspace.fullpath);
106
134
  }
107
135
  }
@@ -118,14 +146,26 @@ export const command = async (conf) => {
118
146
  }
119
147
  return results;
120
148
  };
149
+ const getPublishConfig = (manifest) => {
150
+ const pc = manifest
151
+ .publishConfig;
152
+ if (pc && typeof pc === 'object') {
153
+ return pc;
154
+ }
155
+ return undefined;
156
+ };
121
157
  const commandSingle = async (location, conf) => {
122
158
  const manifestPath = conf.options.packageJson.find(location);
123
159
  assert(manifestPath, 'No package.json found');
124
160
  const manifestDir = dirname(manifestPath);
125
161
  const manifest = conf.options.packageJson.read(manifestDir);
126
162
  assert(!manifest.private, error('Package has been marked as private'));
127
- const { tag = 'latest', access, registry, 'dry-run': dry = false, otp, } = conf.options;
128
- const registryUrl = new URL(registry);
163
+ const { 'dry-run': dry = false, otp } = conf.options;
164
+ const publishConfig = getPublishConfig(manifest);
165
+ const tag = publishConfig?.tag ?? conf.options.tag;
166
+ const access = publishConfig?.access ?? conf.options.access;
167
+ const registry = publishConfig?.registry ?? conf.options.registry;
168
+ const registryUrl = new URL(registryBase(registry));
129
169
  const runOptions = {
130
170
  cwd: manifestDir,
131
171
  projectRoot: conf.projectRoot,
@@ -150,7 +190,11 @@ const commandSingle = async (location, conf) => {
150
190
  ...runOptions,
151
191
  arg0: 'prepare',
152
192
  });
153
- const { name, version, tarballName, tarballData, unpackedSize, files, integrity, shasum, } = await packTarball(manifest, manifestDir, conf);
193
+ // Re-read the manifest after lifecycle scripts, which may have modified package.json.
194
+ const updatedManifest = conf.options.packageJson.read(manifestDir, {
195
+ reload: true,
196
+ });
197
+ const { name, version, tarballName, tarballData, unpackedSize, files, integrity, shasum, resolvedManifest, } = await packTarball(updatedManifest, manifestDir, conf);
154
198
  await run({
155
199
  ...runOptions,
156
200
  arg0: 'postpack',
@@ -162,17 +206,17 @@ const commandSingle = async (location, conf) => {
162
206
  const publishMetadata = {
163
207
  _id: name,
164
208
  name,
165
- description: manifest.description || '',
209
+ description: resolvedManifest.description || '',
166
210
  'dist-tags': {
167
211
  [tag]: version,
168
212
  },
169
213
  versions: {
170
214
  [version]: {
171
- ...manifest,
215
+ ...resolvedManifest,
172
216
  _id: `${name}@${version}`,
173
217
  _nodeVersion: process.versions.node,
174
218
  dist: {
175
- ...manifest.dist,
219
+ ...resolvedManifest.dist,
176
220
  integrity,
177
221
  shasum,
178
222
  tarball: new URL(`${name}/-/${tarballName}`, registryUrl)
@@ -180,7 +224,7 @@ const commandSingle = async (location, conf) => {
180
224
  },
181
225
  },
182
226
  },
183
- access,
227
+ ...(access ? { access } : {}),
184
228
  _attachments: {
185
229
  [tarballName]: {
186
230
  content_type: 'application/octet-stream',
@@ -190,6 +234,12 @@ const commandSingle = async (location, conf) => {
190
234
  },
191
235
  };
192
236
  const rc = new RegistryClient(conf.options);
237
+ // Attempt OIDC token exchange for CI environments (GitHub Actions, GitLab, CircleCI).
238
+ // This is always optional — failures are silent and won't affect local publishing.
239
+ await oidc({
240
+ packageName: name,
241
+ registry: registryUrl.href,
242
+ });
193
243
  const publishUrl = new URL(name.startsWith('@') ? name.replace('/', '%2F') : name, registryUrl);
194
244
  if (!dry) {
195
245
  let response;
@@ -213,8 +263,10 @@ const commandSingle = async (location, conf) => {
213
263
  }
214
264
  if (response.statusCode !== 200 && response.statusCode !== 201) {
215
265
  let extraMsg = '';
216
- // special case 404 errors to provide a better hint to the user
217
- if (response.statusCode === 404) {
266
+ if (response.statusCode === 409) {
267
+ extraMsg = `.\n⚠️ ${name}@${version} already exists in the registry. Bump the version and try again.`;
268
+ }
269
+ else if (response.statusCode === 404) {
218
270
  extraMsg =
219
271
  ".\n⚠️ Make sure you're logged in and have access to publish the package.";
220
272
  }
@@ -233,7 +285,7 @@ const commandSingle = async (location, conf) => {
233
285
  name,
234
286
  version,
235
287
  tag,
236
- access,
288
+ ...(access ? { access } : {}),
237
289
  registry: registryUrl.origin,
238
290
  integrity,
239
291
  shasum,
@@ -242,4 +294,3 @@ const commandSingle = async (location, conf) => {
242
294
  files,
243
295
  };
244
296
  };
245
- //# sourceMappingURL=publish.js.map
@@ -1,5 +1,6 @@
1
1
  import { humanReadableOutput, jsonOutput, mermaidOutput } from '@vltpkg/graph';
2
2
  import type { HumanReadableOutputGraph, JSONOutputGraph, MermaidOutputGraph } from '@vltpkg/graph';
3
+ import { MermaidImageView } from '../mermaid-image-view.ts';
3
4
  import type { CommandFn, CommandUsage } from '../index.ts';
4
5
  export declare const usage: CommandUsage;
5
6
  type QueryResult = JSONOutputGraph & MermaidOutputGraph & HumanReadableOutputGraph & {
@@ -9,8 +10,9 @@ export declare const views: {
9
10
  readonly json: typeof jsonOutput;
10
11
  readonly mermaid: typeof mermaidOutput;
11
12
  readonly human: typeof humanReadableOutput;
12
- readonly gui: ({ queryString }: QueryResult, _: import("../view.ts").ViewOptions, conf: import("../config/index.ts").ParsedConfig) => Promise<void>;
13
+ readonly count: (result: QueryResult) => number;
14
+ readonly svg: typeof MermaidImageView;
15
+ readonly png: typeof MermaidImageView;
13
16
  };
14
17
  export declare const command: CommandFn<QueryResult>;
15
18
  export {};
16
- //# sourceMappingURL=query.d.ts.map
@@ -1,18 +1,18 @@
1
1
  import { actual, asNode, humanReadableOutput, jsonOutput, mermaidOutput, GraphModifier, } from '@vltpkg/graph';
2
2
  import { error } from '@vltpkg/error-cause';
3
- import LZString from 'lz-string';
4
3
  import { Query } from '@vltpkg/query';
4
+ import { createDiffFilesProvider } from "../query-diff-files.js";
5
5
  import { SecurityArchive } from '@vltpkg/security-archive';
6
- import { startGUI } from "../start-gui.js";
7
6
  import { commandUsage } from "../config/usage.js";
8
7
  import { createHostContextsMap } from "../query-host-contexts.js";
8
+ import { MermaidImageView } from "../mermaid-image-view.js";
9
9
  export const usage = () => commandUsage({
10
10
  command: 'query',
11
11
  usage: [
12
12
  '',
13
- '<query> --view=<human | json | mermaid | gui>',
13
+ '<query> --view=<human | json | mermaid | svg | png | count>',
14
14
  '<query> --expect-results=<comparison string>',
15
- '--target=<query> --view=<human | json | mermaid | gui>',
15
+ '--target=<query> --view=<human | json | mermaid | svg | png | count>',
16
16
  ],
17
17
  description: `List installed dependencies matching the provided query.
18
18
 
@@ -68,8 +68,8 @@ export const usage = () => commandUsage({
68
68
  description: 'Query selector to filter packages using DSS syntax.',
69
69
  },
70
70
  view: {
71
- value: '[human | json | mermaid | gui]',
72
- description: 'Output format. Defaults to human-readable or json if no tty.',
71
+ value: '[human | json | mermaid | svg | png | count]',
72
+ description: 'Output format. Defaults to human-readable or json if no tty. Use svg or png to render the dependency graph as an image and open it. Count outputs the number of dependency relationships in the result.',
73
73
  },
74
74
  },
75
75
  });
@@ -96,9 +96,9 @@ export const views = {
96
96
  json: jsonOutput,
97
97
  mermaid: mermaidOutput,
98
98
  human: humanReadableOutput,
99
- gui: async ({ queryString }, _, conf) => {
100
- await startGUI(conf, `/explore/${LZString.compressToEncodedURIComponent(queryString)}/overview`);
101
- },
99
+ count: (result) => result.edges.length,
100
+ svg: MermaidImageView,
101
+ png: MermaidImageView,
102
102
  };
103
103
  export const command = async (conf) => {
104
104
  const modifiers = GraphModifier.maybeLoad(conf.options);
@@ -127,6 +127,7 @@ export const command = async (conf) => {
127
127
  const scopeQueryString = conf.get('scope');
128
128
  const queryString = targetQueryString || positionalQueryString;
129
129
  const hostContexts = await createHostContextsMap(conf);
130
+ const diffFiles = createDiffFilesProvider(conf.options.projectRoot);
130
131
  const importers = new Set();
131
132
  const scopeIDs = [];
132
133
  // Handle --scope option to add scope nodes as importers
@@ -146,6 +147,7 @@ export const command = async (conf) => {
146
147
  importers,
147
148
  securityArchive,
148
149
  hostContexts,
150
+ diffFiles,
149
151
  });
150
152
  const { nodes: resultNodes } = await scopeQuery.search(scopeQueryString, {
151
153
  signal: new AbortController().signal,
@@ -185,6 +187,7 @@ export const command = async (conf) => {
185
187
  importers: importers_,
186
188
  securityArchive,
187
189
  hostContexts,
190
+ diffFiles,
188
191
  });
189
192
  const query = queryString ||
190
193
  (graph ? defaultProjectQueryString : defaultLocalScopeQueryString);
@@ -211,4 +214,3 @@ export const command = async (conf) => {
211
214
  : defaultLocalScopeQueryString),
212
215
  };
213
216
  };
214
- //# sourceMappingURL=query.js.map
@@ -0,0 +1,17 @@
1
+ import type { CommandFn, CommandUsage } from '../index.ts';
2
+ export declare const usage: CommandUsage;
3
+ type CommandResultSingle = {
4
+ url: string;
5
+ name: string;
6
+ };
7
+ type CommandResultMultiple = {
8
+ url: string;
9
+ name: string;
10
+ }[];
11
+ export type CommandResult = CommandResultSingle | CommandResultMultiple;
12
+ export declare const views: {
13
+ readonly human: (r: CommandResult) => string;
14
+ readonly json: (r: CommandResult) => CommandResult;
15
+ };
16
+ export declare const command: CommandFn<CommandResult>;
17
+ export {};
@@ -0,0 +1,157 @@
1
+ import { error } from '@vltpkg/error-cause';
2
+ import { PackageInfoClient } from '@vltpkg/package-info';
3
+ import { Spec } from '@vltpkg/spec';
4
+ import { urlOpen } from '@vltpkg/url-open';
5
+ import { actual } from '@vltpkg/graph';
6
+ import { Query } from '@vltpkg/query';
7
+ import { SecurityArchive } from '@vltpkg/security-archive';
8
+ import { createHostContextsMap } from "../query-host-contexts.js";
9
+ import { commandUsage } from "../config/usage.js";
10
+ import hostedGitInfo from 'hosted-git-info';
11
+ const { fromUrl: hostedGitInfoFromUrl } = hostedGitInfo;
12
+ export const usage = () => commandUsage({
13
+ command: 'repo',
14
+ usage: ['[<spec>]', '[--target=<query>]'],
15
+ description: `Open repository page for a package in a web browser.
16
+ Reads repository information from package.json or fetches
17
+ manifest data for the specified package.`,
18
+ options: {
19
+ target: {
20
+ value: '<query>',
21
+ description: 'Query selector to filter packages using DSS syntax.',
22
+ },
23
+ },
24
+ examples: {
25
+ '': {
26
+ description: 'Open repo for the current package (reads local package.json)',
27
+ },
28
+ 'abbrev@2.0.0': {
29
+ description: 'Open repo for a specific package version',
30
+ },
31
+ '--target=":root > *"': {
32
+ description: 'List repository URLs for all direct dependencies',
33
+ },
34
+ },
35
+ });
36
+ export const views = {
37
+ human: r => {
38
+ if (Array.isArray(r)) {
39
+ let msg = 'Multiple package repositories found:\n';
40
+ msg += r.map(item => `• ${item.name}: ${item.url}`).join('\n');
41
+ return msg;
42
+ }
43
+ return '';
44
+ },
45
+ json: r => r,
46
+ };
47
+ const getUrlFromManifest = (manifest) => {
48
+ const { name, repository, homepage } = manifest;
49
+ if (!name) {
50
+ throw error('No package name found');
51
+ }
52
+ let url;
53
+ // Check repository field first
54
+ if (repository) {
55
+ const repoUrl = typeof repository === 'string' ? repository
56
+ : typeof repository === 'object' && 'url' in repository ?
57
+ repository.url
58
+ : /* c8 ignore next */ undefined;
59
+ if (repoUrl) {
60
+ const info = hostedGitInfoFromUrl(repoUrl.replace(/^git\+/, ''));
61
+ if (info?.browse && typeof info.browse === 'function') {
62
+ url = info.browse();
63
+ }
64
+ else {
65
+ // Use the raw URL if hosted-git-info can't parse it
66
+ url = repoUrl.replace(/^git\+/, '');
67
+ }
68
+ }
69
+ }
70
+ // Fall back to homepage
71
+ if (!url && homepage) {
72
+ url = homepage;
73
+ }
74
+ // Fallback to vlt.io package page
75
+ if (!url) {
76
+ url = `https://vlt.io/explore/npm/${name}/overview`;
77
+ }
78
+ return url;
79
+ };
80
+ export const command = async (conf) => {
81
+ const { projectRoot, packageJson } = conf.options;
82
+ const targetOption = conf.get('target');
83
+ // Handle --target query
84
+ if (targetOption) {
85
+ const mainManifest = packageJson.maybeRead(projectRoot);
86
+ if (!mainManifest) {
87
+ throw error('No package.json found in project root', {
88
+ path: projectRoot,
89
+ });
90
+ }
91
+ const graph = actual.load({
92
+ ...conf.options,
93
+ mainManifest,
94
+ monorepo: conf.options.monorepo,
95
+ loadManifests: true,
96
+ });
97
+ const securityArchive = Query.hasSecuritySelectors(targetOption) ?
98
+ await SecurityArchive.start({
99
+ nodes: [...graph.nodes.values()],
100
+ })
101
+ : undefined;
102
+ const hostContexts = await createHostContextsMap(conf);
103
+ const query = new Query({
104
+ nodes: new Set(graph.nodes.values()),
105
+ edges: graph.edges,
106
+ importers: graph.importers,
107
+ securityArchive,
108
+ hostContexts,
109
+ });
110
+ const { nodes } = await query.search(targetOption, {
111
+ signal: new AbortController().signal,
112
+ });
113
+ const results = [];
114
+ for (const node of nodes) {
115
+ if (!node.manifest)
116
+ continue;
117
+ const url = getUrlFromManifest(node.manifest);
118
+ results.push({
119
+ url,
120
+ name: node.name /* c8 ignore next */ ?? '(unknown)',
121
+ });
122
+ }
123
+ if (results.length === 0) {
124
+ throw error('No packages found matching target query', {
125
+ found: targetOption,
126
+ });
127
+ }
128
+ // If single result, open it
129
+ if (results.length === 1) {
130
+ const result = results[0];
131
+ /* c8 ignore next 3 */
132
+ if (!result) {
133
+ throw error('Unexpected empty result');
134
+ }
135
+ await urlOpen(result.url);
136
+ return result;
137
+ }
138
+ // Multiple results, return the list
139
+ return results;
140
+ }
141
+ // read the package spec from a positional argument or local package.json
142
+ const specArg = conf.positionals[0];
143
+ const manifest = conf.positionals.length === 0 ? packageJson.read(projectRoot)
144
+ : specArg ?
145
+ await new PackageInfoClient(conf.options).manifest(Spec.parseArgs(specArg, conf.options))
146
+ : /* c8 ignore next */ packageJson.read(projectRoot);
147
+ const url = getUrlFromManifest(manifest);
148
+ const { name } = manifest;
149
+ /* c8 ignore start - getUrlFromManifest already validates name */
150
+ if (!name) {
151
+ throw error('No package name found');
152
+ }
153
+ /* c8 ignore stop */
154
+ // Open the URL
155
+ await urlOpen(url);
156
+ return { url, name };
157
+ };
@@ -3,4 +3,3 @@ import type { CommandFn, CommandUsage } from '../index.ts';
3
3
  export { views } from '../exec-command.ts';
4
4
  export declare const usage: CommandUsage;
5
5
  export declare const command: CommandFn<ExecResult>;
6
- //# sourceMappingURL=run-exec.d.ts.map
@@ -0,0 +1,40 @@
1
+ import { runExec, runExecFG } from '@vltpkg/run';
2
+ import { commandUsage } from "../config/usage.js";
3
+ import { ExecCommand } from "../exec-command.js";
4
+ export { views } from "../exec-command.js";
5
+ export const usage = () => commandUsage({
6
+ command: 'run-exec',
7
+ usage: '[command ...]',
8
+ description: `If the first argument is a defined script in package.json, then this is
9
+ equivalent to \`vlt run\`.
10
+
11
+ If not, then this is equivalent to \`vlt exec\`.`,
12
+ options: {
13
+ scope: {
14
+ value: '<query>',
15
+ description: 'Filter execution targets using a DSS query.',
16
+ },
17
+ workspace: {
18
+ value: '<path|glob>',
19
+ description: 'Limit execution to matching workspace paths or globs.',
20
+ },
21
+ 'workspace-group': {
22
+ value: '<name>',
23
+ description: 'Limit execution to named workspace groups.',
24
+ },
25
+ recursive: {
26
+ description: 'Run across all selected workspaces.',
27
+ },
28
+ 'if-present': {
29
+ description: 'When running across multiple packages, only include packages with matching scripts.',
30
+ },
31
+ bail: {
32
+ description: 'When running across multiple workspaces, stop on first failure.',
33
+ },
34
+ 'script-shell': {
35
+ value: '<program>',
36
+ description: 'Shell to use when executing package.json scripts.',
37
+ },
38
+ },
39
+ });
40
+ export const command = async (conf) => await new ExecCommand(conf, runExec, runExecFG).run();
@@ -3,4 +3,3 @@ import type { CommandFn, CommandUsage } from '../index.ts';
3
3
  export { views } from '../exec-command.ts';
4
4
  export declare const usage: CommandUsage;
5
5
  export declare const command: CommandFn<ExecResult>;
6
- //# sourceMappingURL=run.d.ts.map
@@ -9,6 +9,33 @@ export const usage = () => commandUsage({
9
9
  arguments. Note that vlt config values must be specified *before*
10
10
  the script name, because everything after that is handed off to
11
11
  the script process.`,
12
+ options: {
13
+ scope: {
14
+ value: '<query>',
15
+ description: 'Filter execution targets using a DSS query.',
16
+ },
17
+ workspace: {
18
+ value: '<path|glob>',
19
+ description: 'Limit execution to matching workspace paths or globs.',
20
+ },
21
+ 'workspace-group': {
22
+ value: '<name>',
23
+ description: 'Limit execution to named workspace groups.',
24
+ },
25
+ recursive: {
26
+ description: 'Run across all selected workspaces.',
27
+ },
28
+ 'if-present': {
29
+ description: 'When running across multiple packages, only include packages with matching scripts.',
30
+ },
31
+ bail: {
32
+ description: 'When running across multiple workspaces, stop on first failure.',
33
+ },
34
+ 'script-shell': {
35
+ value: '<program>',
36
+ description: 'Shell to use when executing package.json scripts.',
37
+ },
38
+ },
12
39
  });
13
40
  class RunCommand extends ExecCommand {
14
41
  constructor(conf) {
@@ -33,4 +60,3 @@ class RunCommand extends ExecCommand {
33
60
  }
34
61
  }
35
62
  export const command = async (conf) => await new RunCommand(conf).run();
36
- //# sourceMappingURL=run.js.map