@vltpkg/cli-sdk 1.0.0-rc.22 → 1.0.0-rc.24

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 (103) hide show
  1. package/dist/commands/bugs.d.ts +17 -0
  2. package/dist/commands/bugs.js +163 -0
  3. package/dist/commands/build.d.ts +24 -0
  4. package/dist/commands/build.js +101 -0
  5. package/dist/commands/cache.d.ts +64 -0
  6. package/dist/commands/cache.js +256 -0
  7. package/dist/commands/ci.d.ts +10 -0
  8. package/dist/commands/ci.js +40 -0
  9. package/dist/commands/config.d.ts +5 -0
  10. package/dist/commands/config.js +429 -0
  11. package/dist/commands/create.d.ts +8 -0
  12. package/dist/commands/create.js +102 -0
  13. package/dist/commands/docs.d.ts +17 -0
  14. package/dist/commands/docs.js +153 -0
  15. package/dist/commands/exec-cache.d.ts +48 -0
  16. package/dist/commands/exec-cache.js +145 -0
  17. package/dist/commands/exec-local.d.ts +5 -0
  18. package/dist/commands/exec-local.js +46 -0
  19. package/dist/commands/exec.d.ts +8 -0
  20. package/dist/commands/exec.js +161 -0
  21. package/dist/commands/help.d.ts +3 -0
  22. package/dist/commands/help.js +43 -0
  23. package/dist/commands/init.d.ts +7 -0
  24. package/dist/commands/init.js +116 -0
  25. package/dist/commands/install/reporter.d.ts +10 -0
  26. package/dist/commands/install/reporter.js +93 -0
  27. package/dist/commands/install.d.ts +27 -0
  28. package/dist/commands/install.js +80 -0
  29. package/dist/commands/list.d.ts +17 -0
  30. package/dist/commands/list.js +197 -0
  31. package/dist/commands/login.d.ts +3 -0
  32. package/dist/commands/login.js +22 -0
  33. package/dist/commands/logout.d.ts +3 -0
  34. package/dist/commands/logout.js +22 -0
  35. package/dist/commands/pack.d.ts +31 -0
  36. package/dist/commands/pack.js +205 -0
  37. package/dist/commands/ping.d.ts +17 -0
  38. package/dist/commands/ping.js +114 -0
  39. package/dist/commands/pkg.d.ts +6 -0
  40. package/dist/commands/pkg.js +232 -0
  41. package/dist/commands/publish.d.ts +21 -0
  42. package/dist/commands/publish.js +282 -0
  43. package/dist/commands/query.d.ts +18 -0
  44. package/dist/commands/query.js +216 -0
  45. package/dist/commands/repo.d.ts +17 -0
  46. package/dist/commands/repo.js +157 -0
  47. package/dist/commands/run-exec.d.ts +5 -0
  48. package/dist/commands/run-exec.js +40 -0
  49. package/dist/commands/run.d.ts +5 -0
  50. package/dist/commands/run.js +62 -0
  51. package/dist/commands/token.d.ts +3 -0
  52. package/dist/commands/token.js +39 -0
  53. package/dist/commands/uninstall.d.ts +15 -0
  54. package/dist/commands/uninstall.js +39 -0
  55. package/dist/commands/update.d.ts +13 -0
  56. package/dist/commands/update.js +46 -0
  57. package/dist/commands/version.d.ts +25 -0
  58. package/dist/commands/version.js +252 -0
  59. package/dist/commands/view.d.ts +22 -0
  60. package/dist/commands/view.js +334 -0
  61. package/dist/commands/whoami.d.ts +12 -0
  62. package/dist/commands/whoami.js +28 -0
  63. package/dist/config/definition.d.ts +407 -0
  64. package/dist/config/definition.js +684 -0
  65. package/dist/config/index.d.ts +218 -0
  66. package/dist/config/index.js +488 -0
  67. package/dist/config/merge.d.ts +3 -0
  68. package/dist/config/merge.js +27 -0
  69. package/dist/config/usage.d.ts +18 -0
  70. package/dist/config/usage.js +39 -0
  71. package/dist/custom-help.d.ts +8 -0
  72. package/dist/custom-help.js +419 -0
  73. package/dist/exec-command.d.ts +52 -0
  74. package/dist/exec-command.js +313 -0
  75. package/dist/index.d.ts +3 -0
  76. package/dist/index.js +72 -0
  77. package/dist/load-command.d.ts +15 -0
  78. package/dist/load-command.js +20 -0
  79. package/dist/mermaid-image-view.d.ts +18 -0
  80. package/dist/mermaid-image-view.js +36 -0
  81. package/dist/output.d.ts +20 -0
  82. package/dist/output.js +125 -0
  83. package/dist/pack-tarball.d.ts +23 -0
  84. package/dist/pack-tarball.js +256 -0
  85. package/dist/parse-add-remove-args.d.ts +28 -0
  86. package/dist/parse-add-remove-args.js +103 -0
  87. package/dist/print-err.d.ts +13 -0
  88. package/dist/print-err.js +193 -0
  89. package/dist/query-diff-files.d.ts +17 -0
  90. package/dist/query-diff-files.js +63 -0
  91. package/dist/query-host-contexts.d.ts +15 -0
  92. package/dist/query-host-contexts.js +136 -0
  93. package/dist/read-password.d.ts +7 -0
  94. package/dist/read-password.js +32 -0
  95. package/dist/read-project-folders.d.ts +17 -0
  96. package/dist/read-project-folders.js +100 -0
  97. package/dist/reload-config.d.ts +2 -0
  98. package/dist/reload-config.js +11 -0
  99. package/dist/render-mermaid.d.ts +22 -0
  100. package/dist/render-mermaid.js +68 -0
  101. package/dist/view.d.ts +29 -0
  102. package/dist/view.js +30 -0
  103. package/package.json +30 -30
@@ -0,0 +1,429 @@
1
+ import assert from 'node:assert';
2
+ import * as dotProp from '@vltpkg/dot-prop';
3
+ import { error } from '@vltpkg/error-cause';
4
+ import { commandUsage } from "../config/usage.js";
5
+ import { get, set, edit, list, del } from '@vltpkg/config';
6
+ import { load, find } from '@vltpkg/vlt-json';
7
+ export const views = {
8
+ human: results => {
9
+ // Handle string arrays (like list output)
10
+ if (Array.isArray(results) && typeof results[0] === 'string') {
11
+ return results.join('\n');
12
+ }
13
+ // For all other values (primitives, objects, arrays), use JSON formatting like vlt pkg
14
+ return JSON.stringify(results, null, 2);
15
+ },
16
+ };
17
+ export const usage = () => commandUsage({
18
+ command: 'config',
19
+ usage: '[<command>] [<args>]',
20
+ description: 'Get or manipulate vlt configuration values',
21
+ options: {
22
+ config: {
23
+ value: '<all | user | project>',
24
+ description: 'Specify which configuration to show or operate on.',
25
+ },
26
+ },
27
+ subcommands: {
28
+ get: {
29
+ usage: '[<key>] [--config=<all | user | project>]',
30
+ description: 'Get a single config value. Use --config to specify which config to read from.',
31
+ },
32
+ pick: {
33
+ usage: '[<key> [<key> ...]] [--config=<all | user | project>]',
34
+ description: 'Get multiple config values or all configuration. Use --config to specify which config to read from.',
35
+ },
36
+ list: {
37
+ usage: '[--config=<all | user | project>]',
38
+ description: 'Print configuration settings. --config=all shows merged config (default), --config=user shows only user config, --config=project shows only project config.',
39
+ },
40
+ set: {
41
+ usage: '<key>=<value> [<key>=<value> ...] [--config=<all | user | project>]',
42
+ description: `Set config values. By default (or with --config=all), these are
43
+ written to the project config file, \`vlt.json\`
44
+ in the root of the project. To set things for all
45
+ projects, run with \`--config=user\`.`,
46
+ },
47
+ delete: {
48
+ usage: '<key> [<key> ...] [--config=<all | user | project>]',
49
+ description: `Delete the named config fields. If no values remain in
50
+ the config file, delete the file as well. By default
51
+ (or with --config=all), operates on the \`vlt.json\` file in
52
+ the root of the current project. To delete a config field from
53
+ the user config file, specify \`--config=user\`.`,
54
+ },
55
+ edit: {
56
+ usage: '[--config=<all | user | project>]',
57
+ description: 'Edit the configuration file. By default (or with --config=all), edits the project config file.',
58
+ },
59
+ location: {
60
+ usage: '[--config=<user | project>]',
61
+ description: 'Show the file path of the configuration file. Defaults to project config.',
62
+ },
63
+ },
64
+ });
65
+ export const command = async (conf) => {
66
+ const [sub] = conf.positionals;
67
+ assert(sub, error('config command requires a subcommand', {
68
+ code: 'EUSAGE',
69
+ validOptions: [
70
+ 'get',
71
+ 'pick',
72
+ 'set',
73
+ 'delete',
74
+ 'list',
75
+ 'edit',
76
+ 'location',
77
+ ],
78
+ }));
79
+ switch (sub) {
80
+ case 'set':
81
+ return configSet(conf);
82
+ case 'get':
83
+ return configGet(conf);
84
+ case 'pick':
85
+ return configPick(conf);
86
+ case 'ls':
87
+ case 'list':
88
+ return configList(conf);
89
+ case 'edit':
90
+ return configEdit(conf);
91
+ case 'location':
92
+ return configLocation(conf);
93
+ case 'del':
94
+ case 'delete':
95
+ case 'rm':
96
+ case 'remove':
97
+ case 'unset':
98
+ return configDelete(conf);
99
+ default: {
100
+ throw error('Unrecognized config command', {
101
+ code: 'EUSAGE',
102
+ found: sub,
103
+ validOptions: [
104
+ 'get',
105
+ 'pick',
106
+ 'set',
107
+ 'delete',
108
+ 'list',
109
+ 'edit',
110
+ 'location',
111
+ ],
112
+ });
113
+ }
114
+ }
115
+ };
116
+ // Enhanced get function that supports multiple keys (falls back to pick behavior)
117
+ const configGet = async (conf) => {
118
+ const keys = conf.positionals.slice(1);
119
+ const configOption = conf.get('config');
120
+ // If no keys provided, show all config (like pkg get with no args)
121
+ if (keys.length === 0) {
122
+ return configPick(conf);
123
+ }
124
+ // If exactly one key, get the value based on --config option
125
+ if (keys.length === 1) {
126
+ const key = keys[0];
127
+ if (!key) {
128
+ throw error('Key is required', { code: 'EUSAGE' });
129
+ }
130
+ switch (configOption) {
131
+ case 'all': {
132
+ // Default behavior - get from merged/consolidated config (like original get function)
133
+ const result = await get(conf);
134
+ return result;
135
+ }
136
+ case 'user': {
137
+ return getUserConfigValue(key);
138
+ }
139
+ case 'project': {
140
+ return getProjectConfigValue(key);
141
+ }
142
+ default: {
143
+ // Fallback to merged config
144
+ const result = await get(conf);
145
+ return result;
146
+ }
147
+ }
148
+ }
149
+ // Multiple keys: use pick behavior
150
+ return configPick(conf);
151
+ };
152
+ // New pick function for getting multiple config values (like vlt pkg pick)
153
+ const configPick = async (conf) => {
154
+ const keys = conf.positionals.slice(1);
155
+ const configOption = conf.get('config');
156
+ // If no keys provided, return entire config object based on --config option (like vlt pkg pick)
157
+ if (keys.length === 0) {
158
+ switch (configOption) {
159
+ case 'all':
160
+ // For 'all', return the merged config as a serializable object
161
+ return getSerializableConfig(conf);
162
+ case 'user': {
163
+ // Return entire user config object
164
+ const userConfig = getUserConfigObject();
165
+ return userConfig /* c8 ignore next */ ?? {};
166
+ }
167
+ case 'project': {
168
+ // Return entire project config object
169
+ const projectConfig = getProjectConfigObject();
170
+ return projectConfig /* c8 ignore next */ ?? {};
171
+ }
172
+ }
173
+ }
174
+ // Multiple keys: build an object with the requested keys (like vlt pkg pick)
175
+ const result = {};
176
+ for (const key of keys) {
177
+ if (!key) /* c8 ignore next */
178
+ continue;
179
+ switch (configOption) {
180
+ case 'all':
181
+ // Get from merged config (default behavior)
182
+ result[key] = await get(Object.assign(Object.create(Object.getPrototypeOf(conf)), conf, {
183
+ positionals: ['get', key],
184
+ }));
185
+ break;
186
+ case 'user':
187
+ result[key] = getUserConfigValue(key);
188
+ break;
189
+ case 'project':
190
+ result[key] = getProjectConfigValue(key);
191
+ break;
192
+ }
193
+ }
194
+ return result;
195
+ };
196
+ // Enhanced list function that respects --config option
197
+ const configList = (conf) => {
198
+ const configOption = conf.get('config');
199
+ switch (configOption) {
200
+ case 'all':
201
+ // Default behavior - show merged config
202
+ return list(conf);
203
+ case 'user':
204
+ // Show only user config
205
+ return getUserConfigList();
206
+ case 'project':
207
+ // Show only project config
208
+ return getProjectConfigList();
209
+ default:
210
+ // Fallback to merged config
211
+ return list(conf);
212
+ }
213
+ };
214
+ // Convert RecordPairs to string array in key=value format
215
+ const configToStringArray = (config) => {
216
+ const result = [];
217
+ for (const [key, value] of Object.entries(config)) {
218
+ if (value === undefined || value === null) {
219
+ continue;
220
+ }
221
+ if (Array.isArray(value)) {
222
+ // Handle array values (like registries)
223
+ for (const item of value) {
224
+ if (typeof item === 'string') {
225
+ result.push(`${key}=${item}`);
226
+ }
227
+ }
228
+ }
229
+ else if (typeof value === 'object') {
230
+ // Handle object values
231
+ for (const [subKey, subValue] of Object.entries(value)) {
232
+ if (subValue !== undefined && subValue !== null) {
233
+ result.push(`${key}.${subKey}=${String(subValue)}`);
234
+ }
235
+ }
236
+ }
237
+ else {
238
+ // Handle primitive values
239
+ let stringValue;
240
+ if (typeof value === 'string') {
241
+ stringValue = value;
242
+ }
243
+ else if (typeof value === 'number' ||
244
+ typeof value === 'boolean') {
245
+ stringValue = String(value);
246
+ }
247
+ else {
248
+ stringValue = '[object]';
249
+ }
250
+ result.push(`${key}=${stringValue}`);
251
+ }
252
+ }
253
+ return result.sort();
254
+ };
255
+ // Get user config as key=value pairs
256
+ const getUserConfigList = () => {
257
+ try {
258
+ const userConfig = load('config', (x, file) => {
259
+ if (x !== null &&
260
+ typeof x === 'object' &&
261
+ !Array.isArray(x)) {
262
+ return;
263
+ }
264
+ throw new Error(`Invalid config in ${file}`);
265
+ }, 'user');
266
+ if (!userConfig)
267
+ return /* c8 ignore next */ [];
268
+ return configToStringArray(userConfig);
269
+ }
270
+ catch (_err) {
271
+ return [];
272
+ }
273
+ };
274
+ // Get project config as key=value pairs
275
+ const getProjectConfigList = () => {
276
+ try {
277
+ const projectConfig = load('config', (x, file) => {
278
+ if (x !== null &&
279
+ typeof x === 'object' &&
280
+ !Array.isArray(x)) {
281
+ return;
282
+ }
283
+ throw new Error(`Invalid config in ${file}`);
284
+ }, 'project');
285
+ if (!projectConfig)
286
+ return /* c8 ignore next */ [];
287
+ return configToStringArray(projectConfig);
288
+ }
289
+ catch (_err) {
290
+ return [];
291
+ }
292
+ };
293
+ // Get the entire user config object
294
+ const getUserConfigObject = () => {
295
+ try {
296
+ const userConfig = load('config', (x, file) => {
297
+ if (x !== null &&
298
+ typeof x === 'object' &&
299
+ !Array.isArray(x)) {
300
+ return;
301
+ }
302
+ throw new Error(`Invalid config in ${file}`);
303
+ }, 'user');
304
+ if (!userConfig || typeof userConfig !== 'object')
305
+ /* c8 ignore next */
306
+ return;
307
+ return userConfig;
308
+ }
309
+ catch (_err) {
310
+ return;
311
+ }
312
+ };
313
+ // Get a specific value from user config
314
+ const getUserConfigValue = (key) => {
315
+ const userConfig = getUserConfigObject();
316
+ if (!userConfig)
317
+ return;
318
+ // Use dotProp.get like vlt pkg get does
319
+ return dotProp.get(userConfig, key);
320
+ };
321
+ // Get the entire project config object
322
+ const getProjectConfigObject = () => {
323
+ try {
324
+ const projectConfig = load('config', (x, file) => {
325
+ if (x !== null &&
326
+ typeof x === 'object' &&
327
+ !Array.isArray(x)) {
328
+ return;
329
+ }
330
+ throw new Error(`Invalid config in ${file}`);
331
+ }, 'project');
332
+ if (!projectConfig || typeof projectConfig !== 'object')
333
+ /* c8 ignore next */
334
+ return;
335
+ return projectConfig;
336
+ }
337
+ catch (_err) {
338
+ return;
339
+ }
340
+ };
341
+ // Get a specific value from project config
342
+ const getProjectConfigValue = (key) => {
343
+ const projectConfig = getProjectConfigObject();
344
+ if (!projectConfig)
345
+ return;
346
+ // Use dotProp.get like vlt pkg get does
347
+ return dotProp.get(projectConfig, key);
348
+ };
349
+ // Helper function to get the effective config option for write operations
350
+ const getWriteConfigOption = (conf) => {
351
+ const configOption = conf.get('config');
352
+ if (configOption === 'all') {
353
+ // For write operations, 'all' defaults to 'project'
354
+ return 'project';
355
+ }
356
+ return configOption;
357
+ };
358
+ // Wrapper for set command that handles --config option appropriately
359
+ const configSet = async (conf) => {
360
+ const effectiveConfig = getWriteConfigOption(conf);
361
+ // Temporarily modify the config value for the set operation
362
+ const originalGet = conf.get;
363
+ conf.get = ((key) => {
364
+ if (key === 'config') {
365
+ return effectiveConfig;
366
+ }
367
+ return originalGet.call(conf, key);
368
+ });
369
+ try {
370
+ return await set(conf);
371
+ }
372
+ finally {
373
+ // Restore the original get method
374
+ conf.get = originalGet;
375
+ }
376
+ };
377
+ // Wrapper for delete command that handles --config option appropriately
378
+ const configDelete = async (conf) => {
379
+ const effectiveConfig = getWriteConfigOption(conf);
380
+ // Temporarily modify the config value for the delete operation
381
+ const originalGet = conf.get;
382
+ conf.get = ((key) => {
383
+ if (key === 'config') {
384
+ return effectiveConfig;
385
+ }
386
+ return originalGet.call(conf, key);
387
+ });
388
+ try {
389
+ return await del(conf);
390
+ }
391
+ finally {
392
+ // Restore the original get method
393
+ conf.get = originalGet;
394
+ }
395
+ };
396
+ // Wrapper for edit command that handles --config option appropriately
397
+ const configEdit = async (conf) => {
398
+ const effectiveConfig = getWriteConfigOption(conf);
399
+ // Temporarily modify the config value for the edit operation
400
+ const originalGet = conf.get;
401
+ conf.get = ((key) => {
402
+ if (key === 'config') {
403
+ return effectiveConfig;
404
+ }
405
+ return originalGet.call(conf, key);
406
+ });
407
+ try {
408
+ return await edit(conf);
409
+ }
410
+ finally {
411
+ // Restore the original get method
412
+ conf.get = originalGet;
413
+ }
414
+ };
415
+ // Get a serializable config object from LoadedConfig (without circular references)
416
+ const getSerializableConfig = (conf) => {
417
+ // Use the list function which calls recordsToPairs to get a clean config object
418
+ return list(conf);
419
+ };
420
+ // Location command that shows config file paths
421
+ const configLocation = (conf) => {
422
+ const configOption = conf.get('config');
423
+ // For location command, default to 'project' when 'all' is specified
424
+ // since there's no single "all" file to show
425
+ const effectiveConfig = configOption === 'all' ? 'project' : configOption;
426
+ // Get the config file path
427
+ const configPath = find(effectiveConfig);
428
+ return configPath;
429
+ };
@@ -0,0 +1,8 @@
1
+ import type { PromptFn } from '@vltpkg/vlx';
2
+ import type { ExecResult } from '../exec-command.ts';
3
+ import type { CommandFn, CommandUsage } from '../index.ts';
4
+ export { views } from '../exec-command.ts';
5
+ export declare const usage: CommandUsage;
6
+ export declare const prettyPath: (path: string) => string;
7
+ export declare const promptFn: PromptFn;
8
+ export declare const command: CommandFn<ExecResult>;
@@ -0,0 +1,102 @@
1
+ import { exec, execFG } from '@vltpkg/run';
2
+ import * as vlx from '@vltpkg/vlx';
3
+ import { homedir } from 'node:os';
4
+ import { createInterface } from 'node:readline/promises';
5
+ import { commandUsage } from "../config/usage.js";
6
+ import { ExecCommand } from "../exec-command.js";
7
+ import { styleTextStdout } from "../output.js";
8
+ export { views } from "../exec-command.js";
9
+ export const usage = () => commandUsage({
10
+ command: 'create',
11
+ usage: '<initializer> [args...]',
12
+ description: `Initialize a new project from a template package.
13
+
14
+ Works like \`npm create\` and \`bun create\`, automatically
15
+ prepending "create-" to the package name and executing it.
16
+
17
+ For example, \`vlt create react-app my-app\` will fetch and
18
+ execute the \`create-react-app\` package with the arguments
19
+ \`my-app\`.
20
+
21
+ If a satisfying instance of the create package exists in the
22
+ local \`node_modules\` folder, then that will be used.
23
+
24
+ At no point will \`vlt create\` change the locally installed
25
+ dependencies. Any installs it performs is done in vlt's XDG
26
+ data directory.
27
+ `,
28
+ examples: {
29
+ 'react-app my-app': {
30
+ description: 'Create a new React app using create-react-app',
31
+ },
32
+ 'vite my-project': {
33
+ description: 'Create a new Vite project using create-vite',
34
+ },
35
+ '@scope/template my-app': {
36
+ description: 'Create a new project using @scope/create-template',
37
+ },
38
+ },
39
+ options: {
40
+ 'allow-scripts': {
41
+ value: '<query>',
42
+ description: 'Filter which packages are allowed to run lifecycle scripts using DSS query syntax.',
43
+ },
44
+ yes: {
45
+ description: 'Skip interactive prompts and accept defaults.',
46
+ },
47
+ },
48
+ });
49
+ const HOME = homedir();
50
+ export const prettyPath = (path) => path.startsWith(HOME) ? `~${path.substring(HOME.length)}` : path;
51
+ export const promptFn = async (pkgSpec, path, resolution) => {
52
+ const response = await createInterface(process.stdin, process.stdout).question(`About to install: ${styleTextStdout(['bgWhiteBright', 'black', 'bold'], String(pkgSpec))}
53
+ from: ${styleTextStdout(['bgWhiteBright', 'black', 'bold'], resolution)}
54
+ into: ${styleTextStdout(['bgWhiteBright', 'black', 'bold'], prettyPath(path))}
55
+ Is this ok? (y) `);
56
+ process.stdin.pause();
57
+ return response;
58
+ };
59
+ export const command = async (conf) => {
60
+ const [initializer, ...args] = conf.positionals;
61
+ if (!initializer) {
62
+ throw new Error('Missing required argument: <initializer>\n\nUsage: vlt create <initializer> [args...]');
63
+ }
64
+ // Transform the initializer to a create-* package name
65
+ // e.g., "react-app" -> "create-react-app"
66
+ // or "@scope/template" -> "@scope/create-template"
67
+ let packageName;
68
+ if (initializer.startsWith('@')) {
69
+ // Handle scoped packages: @scope/name -> @scope/create-name
70
+ const [scope, name] = initializer.split('/');
71
+ packageName = name ? `${scope}/create-${name}` : `${scope}/create`;
72
+ }
73
+ else {
74
+ // Handle regular packages: name -> create-name
75
+ packageName = `create-${initializer}`;
76
+ }
77
+ /* c8 ignore start */
78
+ const allowScripts = conf.get('allow-scripts') ?
79
+ String(conf.get('allow-scripts'))
80
+ : ':not(*)';
81
+ /* c8 ignore stop */
82
+ const yesFlag = conf.get('yes');
83
+ // Resolve the create-* package using vlx. We pass the package name as
84
+ // a synthetic positional so vlx treats it as the command to resolve —
85
+ // NOT the user's args (like "app"). Without this, vlx would mistake
86
+ // the first user arg as the executable to spawn.
87
+ const arg0 = await vlx.resolve([packageName], {
88
+ ...conf.options,
89
+ query: undefined,
90
+ allowScripts,
91
+ }, yesFlag ? async () => 'y' : promptFn);
92
+ // Set positionals to the resolved executable and the user's args
93
+ if (arg0) {
94
+ conf.positionals = [arg0, ...args];
95
+ }
96
+ else {
97
+ throw new Error(`Could not resolve executable for package "${packageName}"`);
98
+ }
99
+ // Execute the create package
100
+ delete conf.options['script-shell'];
101
+ return await new ExecCommand(conf, exec, execFG).run();
102
+ };
@@ -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 {};