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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/dist/commands/access.d.ts +23 -0
  2. package/dist/commands/access.js +251 -0
  3. package/dist/{esm/commands → commands}/bugs.d.ts +0 -1
  4. package/dist/{esm/commands → commands}/bugs.js +0 -1
  5. package/dist/{esm/commands → commands}/build.d.ts +1 -1
  6. package/dist/{esm/commands → commands}/build.js +1 -1
  7. package/dist/{esm/commands → commands}/cache.d.ts +1 -1
  8. package/dist/{esm/commands → commands}/cache.js +1 -1
  9. package/dist/{esm/commands → commands}/ci.d.ts +1 -1
  10. package/dist/{esm/commands → commands}/ci.js +12 -3
  11. package/dist/{esm/commands → commands}/config.d.ts +0 -1
  12. package/dist/{esm/commands → commands}/config.js +6 -1
  13. package/dist/commands/create.d.ts +9 -0
  14. package/dist/commands/create.js +103 -0
  15. package/dist/commands/deprecate.d.ts +14 -0
  16. package/dist/commands/deprecate.js +142 -0
  17. package/dist/commands/dist-tag.d.ts +22 -0
  18. package/dist/commands/dist-tag.js +179 -0
  19. package/dist/{esm/commands → commands}/docs.d.ts +0 -1
  20. package/dist/{esm/commands → commands}/docs.js +0 -1
  21. package/dist/{esm/commands → commands}/exec-cache.d.ts +1 -1
  22. package/dist/{esm/commands → commands}/exec-cache.js +1 -1
  23. package/dist/{esm/commands/run-exec.d.ts → commands/exec-local.d.ts} +0 -1
  24. package/dist/{esm/commands → commands}/exec-local.js +23 -1
  25. package/dist/{esm/commands → commands}/exec.d.ts +1 -1
  26. package/dist/{esm/commands → commands}/exec.js +85 -10
  27. package/dist/{esm/commands → commands}/help.d.ts +0 -1
  28. package/dist/{esm/commands → commands}/help.js +5 -1
  29. package/dist/{esm/commands → commands}/init.d.ts +0 -1
  30. package/dist/{esm/commands → commands}/init.js +31 -10
  31. package/dist/{esm/commands → commands}/install/reporter.d.ts +0 -1
  32. package/dist/{esm/commands → commands}/install/reporter.js +0 -1
  33. package/dist/{esm/commands → commands}/install.d.ts +22 -3
  34. package/dist/commands/install.js +152 -0
  35. package/dist/{esm/commands → commands}/list.d.ts +5 -2
  36. package/dist/{esm/commands → commands}/list.js +9 -10
  37. package/dist/{esm/commands → commands}/login.d.ts +0 -1
  38. package/dist/commands/login.js +35 -0
  39. package/dist/{esm/commands → commands}/logout.d.ts +1 -1
  40. package/dist/commands/logout.js +27 -0
  41. package/dist/{esm/commands → commands}/pack.d.ts +1 -1
  42. package/dist/{esm/commands → commands}/pack.js +91 -32
  43. package/dist/commands/ping.d.ts +18 -0
  44. package/dist/commands/ping.js +117 -0
  45. package/dist/{esm/commands → commands}/pkg.d.ts +0 -1
  46. package/dist/{esm/commands → commands}/pkg.js +27 -1
  47. package/dist/commands/profile.d.ts +14 -0
  48. package/dist/commands/profile.js +106 -0
  49. package/dist/{esm/commands → commands}/publish.d.ts +2 -2
  50. package/dist/{esm/commands → commands}/publish.js +70 -16
  51. package/dist/{esm/commands → commands}/query.d.ts +5 -2
  52. package/dist/{esm/commands → commands}/query.js +54 -11
  53. package/dist/commands/registry.d.ts +26 -0
  54. package/dist/commands/registry.js +99 -0
  55. package/dist/commands/repo.d.ts +17 -0
  56. package/dist/commands/repo.js +157 -0
  57. package/dist/{esm/commands/exec-local.d.ts → commands/run-exec.d.ts} +1 -1
  58. package/dist/commands/run-exec.js +41 -0
  59. package/dist/{esm/commands → commands}/run.d.ts +0 -1
  60. package/dist/{esm/commands → commands}/run.js +27 -1
  61. package/dist/commands/setup.d.ts +25 -0
  62. package/dist/commands/setup.js +142 -0
  63. package/dist/commands/token.d.ts +32 -0
  64. package/dist/commands/token.js +193 -0
  65. package/dist/{esm/commands → commands}/uninstall.d.ts +1 -1
  66. package/dist/{esm/commands → commands}/uninstall.js +15 -1
  67. package/dist/commands/unpublish.d.ts +16 -0
  68. package/dist/commands/unpublish.js +203 -0
  69. package/dist/{esm/commands → commands}/update.d.ts +1 -1
  70. package/dist/{esm/commands → commands}/update.js +7 -1
  71. package/dist/{esm/commands → commands}/version.d.ts +0 -1
  72. package/dist/{esm/commands → commands}/version.js +27 -1
  73. package/dist/commands/view.d.ts +23 -0
  74. package/dist/commands/view.js +335 -0
  75. package/dist/{esm/commands → commands}/whoami.d.ts +1 -1
  76. package/dist/commands/whoami.js +33 -0
  77. package/dist/{esm/config → config}/definition.d.ts +72 -19
  78. package/dist/{esm/config → config}/definition.js +157 -50
  79. package/dist/{esm/config → config}/index.d.ts +0 -1
  80. package/dist/{esm/config → config}/index.js +43 -2
  81. package/dist/{esm/config → config}/merge.d.ts +0 -1
  82. package/dist/{esm/config → config}/merge.js +0 -1
  83. package/dist/{esm/config → config}/usage.d.ts +0 -1
  84. package/dist/{esm/config → config}/usage.js +0 -1
  85. package/dist/{esm/custom-help.d.ts → custom-help.d.ts} +0 -1
  86. package/dist/{esm/custom-help.js → custom-help.js} +95 -120
  87. package/dist/{esm/exec-command.d.ts → exec-command.d.ts} +0 -1
  88. package/dist/{esm/exec-command.js → exec-command.js} +14 -8
  89. package/dist/{esm/index.d.ts → index.d.ts} +0 -1
  90. package/dist/{esm/index.js → index.js} +5 -2
  91. package/dist/{esm/load-command.d.ts → load-command.d.ts} +6 -1
  92. package/dist/{esm/load-command.js → load-command.js} +0 -1
  93. package/dist/mermaid-image-view.d.ts +18 -0
  94. package/dist/mermaid-image-view.js +36 -0
  95. package/dist/{esm/output.d.ts → output.d.ts} +2 -2
  96. package/dist/{esm/output.js → output.js} +70 -3
  97. package/dist/{esm/pack-tarball.d.ts → pack-tarball.d.ts} +15 -1
  98. package/dist/{esm/pack-tarball.js → pack-tarball.js} +133 -91
  99. package/dist/{esm/parse-add-remove-args.d.ts → parse-add-remove-args.d.ts} +0 -1
  100. package/dist/{esm/parse-add-remove-args.js → parse-add-remove-args.js} +65 -12
  101. package/dist/{esm/print-err.d.ts → print-err.d.ts} +0 -1
  102. package/dist/{esm/print-err.js → print-err.js} +28 -4
  103. package/dist/query-diff-files.d.ts +17 -0
  104. package/dist/query-diff-files.js +63 -0
  105. package/dist/{esm/query-host-contexts.d.ts → query-host-contexts.d.ts} +0 -1
  106. package/dist/{esm/query-host-contexts.js → query-host-contexts.js} +8 -7
  107. package/dist/{esm/read-password.d.ts → read-password.d.ts} +0 -1
  108. package/dist/{esm/read-password.js → read-password.js} +0 -1
  109. package/dist/read-project-folders.d.ts +17 -0
  110. package/dist/read-project-folders.js +100 -0
  111. package/dist/registry-error-message.d.ts +2 -0
  112. package/dist/registry-error-message.js +29 -0
  113. package/dist/reload-config.d.ts +2 -0
  114. package/dist/reload-config.js +11 -0
  115. package/dist/render-mermaid.d.ts +22 -0
  116. package/dist/render-mermaid.js +68 -0
  117. package/dist/require-registry.d.ts +48 -0
  118. package/dist/require-registry.js +122 -0
  119. package/dist/select-registry.d.ts +23 -0
  120. package/dist/select-registry.js +40 -0
  121. package/dist/telemetry.d.ts +58 -0
  122. package/dist/telemetry.js +170 -0
  123. package/dist/verbose-log.d.ts +31 -0
  124. package/dist/verbose-log.js +62 -0
  125. package/dist/{esm/view.d.ts → view.d.ts} +0 -1
  126. package/dist/{esm/view.js → view.js} +1 -2
  127. package/package.json +75 -82
  128. package/dist/esm/commands/bugs.d.ts.map +0 -1
  129. package/dist/esm/commands/bugs.js.map +0 -1
  130. package/dist/esm/commands/build.d.ts.map +0 -1
  131. package/dist/esm/commands/build.js.map +0 -1
  132. package/dist/esm/commands/cache.d.ts.map +0 -1
  133. package/dist/esm/commands/cache.js.map +0 -1
  134. package/dist/esm/commands/ci.d.ts.map +0 -1
  135. package/dist/esm/commands/ci.js.map +0 -1
  136. package/dist/esm/commands/config.d.ts.map +0 -1
  137. package/dist/esm/commands/config.js.map +0 -1
  138. package/dist/esm/commands/docs.d.ts.map +0 -1
  139. package/dist/esm/commands/docs.js.map +0 -1
  140. package/dist/esm/commands/exec-cache.d.ts.map +0 -1
  141. package/dist/esm/commands/exec-cache.js.map +0 -1
  142. package/dist/esm/commands/exec-local.d.ts.map +0 -1
  143. package/dist/esm/commands/exec-local.js.map +0 -1
  144. package/dist/esm/commands/exec.d.ts.map +0 -1
  145. package/dist/esm/commands/exec.js.map +0 -1
  146. package/dist/esm/commands/help.d.ts.map +0 -1
  147. package/dist/esm/commands/help.js.map +0 -1
  148. package/dist/esm/commands/init.d.ts.map +0 -1
  149. package/dist/esm/commands/init.js.map +0 -1
  150. package/dist/esm/commands/install/reporter.d.ts.map +0 -1
  151. package/dist/esm/commands/install/reporter.js.map +0 -1
  152. package/dist/esm/commands/install.d.ts.map +0 -1
  153. package/dist/esm/commands/install.js +0 -46
  154. package/dist/esm/commands/install.js.map +0 -1
  155. package/dist/esm/commands/list.d.ts.map +0 -1
  156. package/dist/esm/commands/list.js.map +0 -1
  157. package/dist/esm/commands/login.d.ts.map +0 -1
  158. package/dist/esm/commands/login.js +0 -13
  159. package/dist/esm/commands/login.js.map +0 -1
  160. package/dist/esm/commands/logout.d.ts.map +0 -1
  161. package/dist/esm/commands/logout.js +0 -13
  162. package/dist/esm/commands/logout.js.map +0 -1
  163. package/dist/esm/commands/pack.d.ts.map +0 -1
  164. package/dist/esm/commands/pack.js.map +0 -1
  165. package/dist/esm/commands/pkg.d.ts.map +0 -1
  166. package/dist/esm/commands/pkg.js.map +0 -1
  167. package/dist/esm/commands/publish.d.ts.map +0 -1
  168. package/dist/esm/commands/publish.js.map +0 -1
  169. package/dist/esm/commands/query.d.ts.map +0 -1
  170. package/dist/esm/commands/query.js.map +0 -1
  171. package/dist/esm/commands/run-exec.d.ts.map +0 -1
  172. package/dist/esm/commands/run-exec.js +0 -14
  173. package/dist/esm/commands/run-exec.js.map +0 -1
  174. package/dist/esm/commands/run.d.ts.map +0 -1
  175. package/dist/esm/commands/run.js.map +0 -1
  176. package/dist/esm/commands/serve.d.ts +0 -14
  177. package/dist/esm/commands/serve.d.ts.map +0 -1
  178. package/dist/esm/commands/serve.js +0 -103
  179. package/dist/esm/commands/serve.js.map +0 -1
  180. package/dist/esm/commands/token.d.ts +0 -4
  181. package/dist/esm/commands/token.d.ts.map +0 -1
  182. package/dist/esm/commands/token.js +0 -30
  183. package/dist/esm/commands/token.js.map +0 -1
  184. package/dist/esm/commands/uninstall.d.ts.map +0 -1
  185. package/dist/esm/commands/uninstall.js.map +0 -1
  186. package/dist/esm/commands/update.d.ts.map +0 -1
  187. package/dist/esm/commands/update.js.map +0 -1
  188. package/dist/esm/commands/version.d.ts.map +0 -1
  189. package/dist/esm/commands/version.js.map +0 -1
  190. package/dist/esm/commands/whoami.d.ts.map +0 -1
  191. package/dist/esm/commands/whoami.js +0 -19
  192. package/dist/esm/commands/whoami.js.map +0 -1
  193. package/dist/esm/config/definition.d.ts.map +0 -1
  194. package/dist/esm/config/definition.js.map +0 -1
  195. package/dist/esm/config/index.d.ts.map +0 -1
  196. package/dist/esm/config/index.js.map +0 -1
  197. package/dist/esm/config/merge.d.ts.map +0 -1
  198. package/dist/esm/config/merge.js.map +0 -1
  199. package/dist/esm/config/usage.d.ts.map +0 -1
  200. package/dist/esm/config/usage.js.map +0 -1
  201. package/dist/esm/custom-help.d.ts.map +0 -1
  202. package/dist/esm/custom-help.js.map +0 -1
  203. package/dist/esm/exec-command.d.ts.map +0 -1
  204. package/dist/esm/exec-command.js.map +0 -1
  205. package/dist/esm/index.d.ts.map +0 -1
  206. package/dist/esm/index.js.map +0 -1
  207. package/dist/esm/load-command.d.ts.map +0 -1
  208. package/dist/esm/load-command.js.map +0 -1
  209. package/dist/esm/output.d.ts.map +0 -1
  210. package/dist/esm/output.js.map +0 -1
  211. package/dist/esm/pack-tarball.d.ts.map +0 -1
  212. package/dist/esm/pack-tarball.js.map +0 -1
  213. package/dist/esm/package.json +0 -3
  214. package/dist/esm/parse-add-remove-args.d.ts.map +0 -1
  215. package/dist/esm/parse-add-remove-args.js.map +0 -1
  216. package/dist/esm/print-err.d.ts.map +0 -1
  217. package/dist/esm/print-err.js.map +0 -1
  218. package/dist/esm/query-host-contexts.d.ts.map +0 -1
  219. package/dist/esm/query-host-contexts.js.map +0 -1
  220. package/dist/esm/read-password.d.ts.map +0 -1
  221. package/dist/esm/read-password.js.map +0 -1
  222. package/dist/esm/start-gui.d.ts +0 -10
  223. package/dist/esm/start-gui.d.ts.map +0 -1
  224. package/dist/esm/start-gui.js +0 -60
  225. package/dist/esm/start-gui.js.map +0 -1
  226. package/dist/esm/view.d.ts.map +0 -1
  227. package/dist/esm/view.js.map +0 -1
@@ -0,0 +1,335 @@
1
+ import * as dotProp from '@vltpkg/dot-prop';
2
+ import { error } from '@vltpkg/error-cause';
3
+ import { PackageInfoClient } from '@vltpkg/package-info';
4
+ import { SecurityArchive } from '@vltpkg/security-archive';
5
+ import { Spec } from '@vltpkg/spec';
6
+ import { joinDepIDTuple } from '@vltpkg/dep-id';
7
+ import { commandUsage } from "../config/usage.js";
8
+ export const needsRegistry = true;
9
+ export const usage = () => commandUsage({
10
+ command: 'view',
11
+ usage: [
12
+ '<pkg>[@<version>] [<field>]',
13
+ '<pkg>[@<version>] [--view=human | json]',
14
+ ],
15
+ description: `View registry information about a package.
16
+
17
+ Fetches and displays packument and manifest data for a given
18
+ package from the registry.
19
+
20
+ When a specific field is provided, only that field value is
21
+ displayed. Use dot-prop syntax to access nested fields
22
+ (e.g., \`dist-tags.latest\`, \`dependencies.lodash\`).
23
+
24
+ Security data from the vlt security archive is shown when
25
+ available, including scores and alerts.`,
26
+ examples: {
27
+ express: {
28
+ description: 'View info about the latest version of express',
29
+ },
30
+ 'express@4.18.2': {
31
+ description: 'View info about a specific version',
32
+ },
33
+ 'express versions': {
34
+ description: 'List all published versions',
35
+ },
36
+ 'express dist-tags': {
37
+ description: 'Show all dist-tags',
38
+ },
39
+ 'express dependencies': {
40
+ description: 'Show dependencies of the latest version',
41
+ },
42
+ 'express dist-tags.latest': {
43
+ description: 'Show the latest dist-tag value',
44
+ },
45
+ },
46
+ options: {
47
+ view: {
48
+ value: '[human | json]',
49
+ description: 'Output format. Defaults to human-readable or json if no tty.',
50
+ },
51
+ },
52
+ });
53
+ const formatScore = (score) => `${Math.round(score * 100)}/100`;
54
+ const formatAlertSeverity = (severity) => {
55
+ switch (severity) {
56
+ case 'critical':
57
+ return '[CRITICAL]';
58
+ case 'high':
59
+ return '[HIGH]';
60
+ case 'medium':
61
+ return '[MEDIUM]';
62
+ case 'low':
63
+ return '[LOW]';
64
+ /* c8 ignore next 2 */
65
+ default:
66
+ return `[${String(severity).toUpperCase()}]`;
67
+ }
68
+ };
69
+ const formatSecurity = (report) => {
70
+ const lines = [];
71
+ const { score, alerts } = report;
72
+ lines.push('');
73
+ lines.push('security:');
74
+ lines.push(` score: ${formatScore(score.overall)}`);
75
+ lines.push(` license: ${formatScore(score.license)}`);
76
+ lines.push(` maintenance: ${formatScore(score.maintenance)}`);
77
+ lines.push(` quality: ${formatScore(score.quality)}`);
78
+ lines.push(` supply chain: ${formatScore(score.supplyChain)}`);
79
+ lines.push(` vulnerability: ${formatScore(score.vulnerability)}`);
80
+ if (alerts.length > 0) {
81
+ lines.push(` alerts: ${alerts.length}`);
82
+ for (const alert of alerts) {
83
+ lines.push(` ${formatAlertSeverity(alert.severity)} ${alert.type}: ${alert.key} (${alert.category})`);
84
+ }
85
+ }
86
+ else {
87
+ lines.push(' alerts: none');
88
+ }
89
+ return lines.join('\n');
90
+ };
91
+ const formatDependencyCount = (manifest) => {
92
+ const lines = [];
93
+ const deps = Object.keys(manifest.dependencies ?? {}).length;
94
+ const devDeps = Object.keys(manifest.devDependencies ?? {}).length;
95
+ const optDeps = Object.keys(manifest.optionalDependencies ?? {}).length;
96
+ const peerDeps = Object.keys(manifest.peerDependencies ?? {}).length;
97
+ const parts = [];
98
+ if (deps > 0)
99
+ parts.push(`${deps} dependencies`);
100
+ if (devDeps > 0)
101
+ parts.push(`${devDeps} dev`);
102
+ if (optDeps > 0)
103
+ parts.push(`${optDeps} optional`);
104
+ if (peerDeps > 0)
105
+ parts.push(`${peerDeps} peer`);
106
+ if (parts.length > 0) {
107
+ lines.push(`deps: ${parts.join(', ')}`);
108
+ }
109
+ return lines;
110
+ };
111
+ const formatHuman = (result) => {
112
+ const { packument, manifest, security } = result;
113
+ const lines = [];
114
+ // Name and version
115
+ const name = manifest.name ?? packument.name;
116
+ const version = manifest.version ?? '';
117
+ lines.push(`${name}@${version}`);
118
+ // Description
119
+ if (manifest.description) {
120
+ lines.push(manifest.description);
121
+ }
122
+ lines.push('');
123
+ // License
124
+ if (manifest.license) {
125
+ lines.push(`license: ${manifest.license}`);
126
+ }
127
+ // Homepage
128
+ if (manifest.homepage) {
129
+ lines.push(`homepage: ${manifest.homepage}`);
130
+ }
131
+ // Repository
132
+ if (manifest.repository) {
133
+ const repo = typeof manifest.repository === 'string' ?
134
+ manifest.repository
135
+ : manifest.repository.url;
136
+ if (repo) {
137
+ lines.push(`repository: ${repo}`);
138
+ }
139
+ }
140
+ // Author
141
+ if (manifest.author) {
142
+ const author = typeof manifest.author === 'string' ?
143
+ manifest.author
144
+ : manifest.author.name;
145
+ if (author) {
146
+ lines.push(`author: ${author}`);
147
+ }
148
+ }
149
+ // Keywords
150
+ if (manifest.keywords) {
151
+ const kw = Array.isArray(manifest.keywords) ?
152
+ manifest.keywords
153
+ : [manifest.keywords];
154
+ if (kw.length > 0) {
155
+ lines.push(`keywords: ${kw.join(', ')}`);
156
+ }
157
+ }
158
+ // Dist-tags
159
+ const tagEntries = Object.entries(packument['dist-tags']);
160
+ if (tagEntries.length > 0) {
161
+ lines.push('');
162
+ lines.push('dist-tags:');
163
+ for (const [tag, ver] of tagEntries) {
164
+ lines.push(` ${tag}: ${ver}`);
165
+ }
166
+ }
167
+ // Dependencies count
168
+ const depLines = formatDependencyCount(manifest);
169
+ if (depLines.length > 0) {
170
+ lines.push('');
171
+ lines.push(...depLines);
172
+ }
173
+ // Maintainers
174
+ if (packument.maintainers && packument.maintainers.length > 0) {
175
+ lines.push('');
176
+ lines.push('maintainers:');
177
+ for (const m of packument.maintainers) {
178
+ const mName = typeof m === 'string' ? m : m.name;
179
+ lines.push(` - ${mName}`);
180
+ }
181
+ }
182
+ // Published time
183
+ if (packument.time && version && packument.time[version]) {
184
+ lines.push('');
185
+ lines.push(`published: ${packument.time[version]}`);
186
+ }
187
+ // Security info
188
+ if (security) {
189
+ lines.push(formatSecurity(security));
190
+ }
191
+ // Versions count
192
+ const versionCount = Object.keys(packument.versions).length;
193
+ if (versionCount > 0) {
194
+ lines.push('');
195
+ lines.push(`versions: ${versionCount} total`);
196
+ }
197
+ return lines.join('\n');
198
+ };
199
+ export const views = {
200
+ human: (result, _options, _conf) => {
201
+ // Field access mode: just return the value
202
+ if (result.fieldPath !== undefined) {
203
+ const val = result.fieldValue;
204
+ if (Array.isArray(val)) {
205
+ return val.join('\n');
206
+ }
207
+ if (typeof val === 'object' && val !== null) {
208
+ return JSON.stringify(val, null, 2);
209
+ }
210
+ if (val === undefined || val === null)
211
+ return '';
212
+ return typeof val === 'string' ? val : JSON.stringify(val);
213
+ }
214
+ // Full view mode
215
+ return formatHuman(result);
216
+ },
217
+ json: (result, _options, _conf) => {
218
+ if (result.fieldPath !== undefined) {
219
+ return result.fieldValue;
220
+ }
221
+ return {
222
+ ...result.manifest,
223
+ 'dist-tags': result.packument['dist-tags'],
224
+ time: result.packument.time,
225
+ maintainers: result.packument.maintainers,
226
+ ...(result.security ? { security: result.security } : {}),
227
+ };
228
+ },
229
+ };
230
+ /**
231
+ * Create a minimal NodeLike for SecurityArchive lookup.
232
+ * Only the fields used by SecurityArchive.start() are needed.
233
+ */
234
+ const createFakeNode = (name, version) => ({
235
+ id: joinDepIDTuple(['registry', '', `${name}@${version}`]),
236
+ name,
237
+ version,
238
+ confused: false,
239
+ edgesIn: new Set(),
240
+ edgesOut: new Map(),
241
+ workspaces: undefined,
242
+ importer: false,
243
+ mainImporter: false,
244
+ projectRoot: '',
245
+ dev: false,
246
+ optional: false,
247
+ graph: {},
248
+ options: {},
249
+ /* c8 ignore next 5 - stub methods for NodeLike interface */
250
+ toJSON: () => ({}),
251
+ toString: () => `${name}@${version}`,
252
+ setResolved: () => { },
253
+ setConfusedManifest: () => { },
254
+ maybeSetConfusedManifest: () => { },
255
+ });
256
+ /**
257
+ * Lookup fields from a combined packument+manifest view.
258
+ *
259
+ * The lookup searches in this order:
260
+ * 1. Top-level packument fields (name, dist-tags, versions, time,
261
+ * readme, maintainers)
262
+ * 2. Manifest fields for the resolved version
263
+ * 3. Security data (security.score, security.alerts)
264
+ */
265
+ const lookupField = (result, path) => {
266
+ // Special handling for packument-level fields
267
+ const packumentFields = [
268
+ 'dist-tags',
269
+ 'versions',
270
+ 'time',
271
+ 'readme',
272
+ 'maintainers',
273
+ 'modified',
274
+ 'contributors',
275
+ ];
276
+ /* c8 ignore next - split always returns at least one element */
277
+ const topLevel = path.split('.')[0] ?? path;
278
+ if (packumentFields.includes(topLevel)) {
279
+ return dotProp.get(result.packument, path);
280
+ }
281
+ // Check security namespace
282
+ if (topLevel === 'security' && result.security) {
283
+ const subPath = path.slice('security.'.length);
284
+ if (subPath === '' || path === 'security') {
285
+ return result.security;
286
+ }
287
+ return dotProp.get(result.security, subPath);
288
+ }
289
+ // Default: look up in manifest
290
+ return dotProp.get(result.manifest, path);
291
+ };
292
+ export const command = async (conf) => {
293
+ const specArg = conf.positionals[0];
294
+ if (!specArg) {
295
+ throw error('view requires a package spec argument', {
296
+ code: 'EUSAGE',
297
+ });
298
+ }
299
+ const fieldPath = conf.positionals[1];
300
+ const spec = Spec.parseArgs(specArg, conf.options);
301
+ const pic = new PackageInfoClient(conf.options);
302
+ // Fetch the full packument (needs time, maintainers) and resolved manifest
303
+ const [packument, resolvedManifest] = await Promise.all([
304
+ pic.packument(spec),
305
+ pic.manifest(spec),
306
+ ]);
307
+ const manifest = resolvedManifest;
308
+ // Try to get security data for this package
309
+ let security;
310
+ const name = manifest.name ?? packument.name;
311
+ const version = manifest.version;
312
+ if (name && version) {
313
+ try {
314
+ const node = createFakeNode(name, version);
315
+ const archive = await SecurityArchive.start({
316
+ nodes: [node],
317
+ });
318
+ security = archive.get(node.id);
319
+ }
320
+ catch {
321
+ // Security data is optional, don't fail the command
322
+ }
323
+ }
324
+ const result = {
325
+ packument,
326
+ manifest,
327
+ security,
328
+ };
329
+ // If a field path is provided, resolve it
330
+ if (fieldPath !== undefined) {
331
+ result.fieldPath = fieldPath;
332
+ result.fieldValue = lookupField(result, fieldPath);
333
+ }
334
+ return result;
335
+ };
@@ -1,5 +1,6 @@
1
1
  import type { JSONField } from '@vltpkg/types';
2
2
  import type { CommandFn, CommandUsage } from '../index.ts';
3
+ export declare const needsRegistry = true;
3
4
  export declare const usage: CommandUsage;
4
5
  type CommandResult = {
5
6
  username?: JSONField;
@@ -10,4 +11,3 @@ export declare const views: {
10
11
  };
11
12
  export declare const command: CommandFn<CommandResult>;
12
13
  export {};
13
- //# sourceMappingURL=whoami.d.ts.map
@@ -0,0 +1,33 @@
1
+ import { RegistryClient } from '@vltpkg/registry-client';
2
+ import { commandUsage } from "../config/usage.js";
3
+ import { resolveRegistry } from "../require-registry.js";
4
+ export const needsRegistry = true;
5
+ export const usage = () => commandUsage({
6
+ command: 'whoami',
7
+ usage: [''],
8
+ description: `Look up the username for the currently active token,
9
+ when logged into a registry.
10
+
11
+ Target a specific configured registry by alias with
12
+ \`vlt registry <alias> whoami\`.`,
13
+ options: {
14
+ registry: {
15
+ value: '<url>',
16
+ description: 'Registry URL to query for authenticated user info.',
17
+ },
18
+ identity: {
19
+ value: '<name>',
20
+ description: 'Identity namespace used to look up auth tokens.',
21
+ },
22
+ },
23
+ });
24
+ export const views = {
25
+ human: r => r.username,
26
+ json: r => r,
27
+ };
28
+ export const command = async (conf) => {
29
+ const rc = new RegistryClient(conf.options);
30
+ const response = await rc.request(new URL('-/whoami', await resolveRegistry(conf)), { useCache: false });
31
+ const { username } = response.json();
32
+ return { username };
33
+ };
@@ -15,18 +15,23 @@ export declare const commands: {
15
15
  readonly r: "run";
16
16
  readonly 'run-script': "run";
17
17
  readonly rx: "run-exec";
18
- readonly s: "serve";
19
18
  readonly x: "exec";
20
19
  readonly xl: "exec-local";
21
20
  readonly h: "help";
22
21
  readonly '?': "help";
22
+ readonly info: "view";
23
23
  readonly ls: "list";
24
+ readonly show: "view";
24
25
  readonly xc: "exec-cache";
26
+ readonly access: "access";
25
27
  readonly bugs: "bugs";
26
28
  readonly build: "build";
27
29
  readonly cache: "cache";
28
30
  readonly ci: "ci";
29
31
  readonly config: "config";
32
+ readonly create: "create";
33
+ readonly deprecate: "deprecate";
34
+ readonly 'dist-tag': "dist-tag";
30
35
  readonly docs: "docs";
31
36
  readonly exec: "exec";
32
37
  readonly 'exec-local': "exec-local";
@@ -37,17 +42,23 @@ export declare const commands: {
37
42
  readonly logout: "logout";
38
43
  readonly list: "list";
39
44
  readonly pack: "pack";
45
+ readonly ping: "ping";
40
46
  readonly pkg: "pkg";
47
+ readonly profile: "profile";
41
48
  readonly publish: "publish";
42
49
  readonly query: "query";
50
+ readonly registry: "registry";
51
+ readonly repo: "repo";
43
52
  readonly 'run-exec': "run-exec";
44
53
  readonly run: "run";
45
- readonly serve: "serve";
54
+ readonly setup: "setup";
46
55
  readonly token: "token";
47
56
  readonly uninstall: "uninstall";
57
+ readonly unpublish: "unpublish";
48
58
  readonly update: "update";
49
59
  readonly 'exec-cache': "exec-cache";
50
60
  readonly version: "version";
61
+ readonly view: "view";
51
62
  readonly whoami: "whoami";
52
63
  };
53
64
  /**
@@ -59,7 +70,7 @@ export declare const getCommand: (s?: string) => Commands[keyof Commands] | unde
59
70
  /**
60
71
  * Fields that are parsed as a set of key=value pairs
61
72
  */
62
- export declare const recordFields: readonly ["git-hosts", "registries", "git-host-archives", "scope-registries", "jsr-registries"];
73
+ export declare const recordFields: readonly ["git-hosts", "registries", "git-host-archives", "scoped-registries", "jsr-registries"];
63
74
  export type RecordField = (typeof recordFields)[number];
64
75
  export declare const isRecordField: (s: string) => s is RecordField;
65
76
  export declare const definition: import("jackspeak").Jack<{
@@ -76,18 +87,23 @@ export declare const definition: import("jackspeak").Jack<{
76
87
  'no-color': import("jackspeak").ConfigOption<"boolean", false, undefined>;
77
88
  } & {
78
89
  registry: {
90
+ hint: string;
91
+ description: string;
92
+ };
93
+ 'default-registry-alias': {
79
94
  hint: string;
80
95
  default: string;
81
96
  description: string;
82
97
  };
83
98
  } & {
84
99
  registry: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
100
+ 'default-registry-alias': import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
85
101
  } & {
86
102
  registries: {
87
103
  hint: string;
88
104
  description: string;
89
105
  };
90
- 'scope-registries': {
106
+ 'scoped-registries': {
91
107
  hint: string;
92
108
  description: string;
93
109
  };
@@ -107,7 +123,7 @@ export declare const definition: import("jackspeak").Jack<{
107
123
  };
108
124
  } & {
109
125
  registries: import("jackspeak").ConfigOption<"string", true, readonly string[] | undefined>;
110
- 'scope-registries': import("jackspeak").ConfigOption<"string", true, readonly string[] | undefined>;
126
+ 'scoped-registries': import("jackspeak").ConfigOption<"string", true, readonly string[] | undefined>;
111
127
  'jsr-registries': import("jackspeak").ConfigOption<"string", true, readonly string[] | undefined>;
112
128
  'git-hosts': import("jackspeak").ConfigOption<"string", true, readonly string[] | undefined>;
113
129
  'git-host-archives': import("jackspeak").ConfigOption<"string", true, readonly string[] | undefined>;
@@ -133,6 +149,9 @@ export declare const definition: import("jackspeak").Jack<{
133
149
  description: string;
134
150
  default: NodeJS.Architecture;
135
151
  };
152
+ libc: {
153
+ description: string;
154
+ };
136
155
  'node-version': {
137
156
  hint: string;
138
157
  description: string;
@@ -144,6 +163,7 @@ export declare const definition: import("jackspeak").Jack<{
144
163
  before: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
145
164
  os: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
146
165
  arch: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
166
+ libc: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
147
167
  'node-version': import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
148
168
  } & {
149
169
  'git-shallow': {
@@ -200,7 +220,6 @@ export declare const definition: import("jackspeak").Jack<{
200
220
  description: string;
201
221
  };
202
222
  'workspace-group': {
203
- short: string;
204
223
  description: string;
205
224
  };
206
225
  } & {
@@ -278,15 +297,37 @@ export declare const definition: import("jackspeak").Jack<{
278
297
  };
279
298
  } & {
280
299
  package: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
300
+ } & {
301
+ call: {
302
+ hint: string;
303
+ description: string;
304
+ };
305
+ } & {
306
+ call: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
281
307
  } & {
282
308
  view: {
283
309
  hint: string;
284
310
  default: string;
285
311
  description: string;
286
- validOptions: readonly ["human", "json", "mermaid", "gui", "inspect", "silent"];
312
+ validOptions: readonly ["human", "json", "mermaid", "svg", "png", "count", "inspect", "silent"];
287
313
  };
288
314
  } & {
289
315
  view: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
316
+ } & {
317
+ loglevel: {
318
+ hint: string;
319
+ default: string;
320
+ description: string;
321
+ validOptions: readonly ["silent", "error", "warn", "info", "verbose", "debug"];
322
+ };
323
+ } & {
324
+ loglevel: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
325
+ } & {
326
+ verbose: {
327
+ description: string;
328
+ };
329
+ } & {
330
+ verbose: import("jackspeak").ConfigOption<"boolean", false, undefined>;
290
331
  } & {
291
332
  'dashboard-root': {
292
333
  hint: string;
@@ -299,6 +340,10 @@ export declare const definition: import("jackspeak").Jack<{
299
340
  short: string;
300
341
  description: string;
301
342
  };
343
+ 'save-exact': {
344
+ short: string;
345
+ description: string;
346
+ };
302
347
  'save-optional': {
303
348
  short: string;
304
349
  description: string;
@@ -312,9 +357,17 @@ export declare const definition: import("jackspeak").Jack<{
312
357
  };
313
358
  } & {
314
359
  'save-dev': import("jackspeak").ConfigOption<"boolean", false, undefined>;
360
+ 'save-exact': import("jackspeak").ConfigOption<"boolean", false, undefined>;
315
361
  'save-optional': import("jackspeak").ConfigOption<"boolean", false, undefined>;
316
362
  'save-peer': import("jackspeak").ConfigOption<"boolean", false, undefined>;
317
363
  'save-prod': import("jackspeak").ConfigOption<"boolean", false, undefined>;
364
+ } & {
365
+ 'save-prefix': {
366
+ description: string;
367
+ default: string;
368
+ };
369
+ } & {
370
+ 'save-prefix': import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
318
371
  } & {
319
372
  'expect-results': {
320
373
  hint: string;
@@ -327,6 +380,10 @@ export declare const definition: import("jackspeak").Jack<{
327
380
  'dry-run': {
328
381
  description: string;
329
382
  };
383
+ force: {
384
+ short: string;
385
+ description: string;
386
+ };
330
387
  'expect-lockfile': {
331
388
  description: string;
332
389
  };
@@ -338,6 +395,7 @@ export declare const definition: import("jackspeak").Jack<{
338
395
  };
339
396
  } & {
340
397
  'dry-run': import("jackspeak").ConfigOption<"boolean", false, undefined>;
398
+ force: import("jackspeak").ConfigOption<"boolean", false, undefined>;
341
399
  'expect-lockfile': import("jackspeak").ConfigOption<"boolean", false, undefined>;
342
400
  'frozen-lockfile': import("jackspeak").ConfigOption<"boolean", false, undefined>;
343
401
  'lockfile-only': import("jackspeak").ConfigOption<"boolean", false, undefined>;
@@ -352,7 +410,6 @@ export declare const definition: import("jackspeak").Jack<{
352
410
  access: {
353
411
  description: string;
354
412
  validOptions: readonly ["public", "restricted"];
355
- default: string;
356
413
  };
357
414
  } & {
358
415
  access: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
@@ -364,19 +421,16 @@ export declare const definition: import("jackspeak").Jack<{
364
421
  hint: string;
365
422
  description: string;
366
423
  };
367
- port: {
368
- hint: string;
369
- description: string;
370
- };
371
- 'registry-port': {
372
- hint: string;
373
- description: string;
374
- };
375
424
  } & {
376
425
  otp: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
377
426
  'publish-directory': import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
378
- port: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
379
- 'registry-port': import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
427
+ } & {
428
+ telemetry: {
429
+ description: string;
430
+ default: true;
431
+ };
432
+ } & {
433
+ telemetry: import("jackspeak").ConfigOption<"boolean", false, undefined>;
380
434
  } & {
381
435
  yes: {
382
436
  short: string;
@@ -402,4 +456,3 @@ export declare const definition: import("jackspeak").Jack<{
402
456
  }>;
403
457
  export declare const getSortedCliOptions: () => string[];
404
458
  export declare const getSortedKeys: () => string[];
405
- //# sourceMappingURL=definition.d.ts.map