@vzn/vx 0.0.221 → 0.0.222

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 (2) hide show
  1. package/package.json +5 -5
  2. package/src/cli/index.ts +22 -35
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vzn/vx",
3
- "version": "0.0.221",
3
+ "version": "0.0.222",
4
4
  "description": "A fast, correct task runner and build cache for JavaScript monorepos.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,10 +17,10 @@
17
17
  "node": ">=18"
18
18
  },
19
19
  "optionalDependencies": {
20
- "@vzn/vx-linux-x64": "0.0.221",
21
- "@vzn/vx-linux-arm64": "0.0.221",
22
- "@vzn/vx-darwin-x64": "0.0.221",
23
- "@vzn/vx-darwin-arm64": "0.0.221"
20
+ "@vzn/vx-linux-x64": "0.0.222",
21
+ "@vzn/vx-linux-arm64": "0.0.222",
22
+ "@vzn/vx-darwin-x64": "0.0.222",
23
+ "@vzn/vx-darwin-arm64": "0.0.222"
24
24
  },
25
25
  "dependencies": {
26
26
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
package/src/cli/index.ts CHANGED
@@ -1,21 +1,18 @@
1
- // Module contract for `cli`: the top-level dispatcher plus re-exports
2
- // for the test suite, which asserts on the pure parsers and formatters
3
- // directly. Each subcommand handler lives in a sibling `<name>.ts`.
1
+ // Module contract for `cli`: the top-level dispatcher. Each subcommand
2
+ // handler lives in a sibling `<name>.ts`; tests import its parsers there.
4
3
 
5
4
  import { VERSION } from '../version.js'
6
- import { runCmd } from './run.js'
7
5
  import { CORE_VERBS, printHelp } from './help.js'
8
- import { pluginCommandHelp, resolvePluginCommand, pluginVerbs } from './plugin-commands.js'
9
6
  import { FOREIGN_VERBS } from './foreign-flags.js'
10
- import { taskVerbHint } from './task-verb.js'
11
7
  import { isUserError, MOVED_VERBS, nearest, UserError } from '../util/index.js'
12
8
 
13
- // Every verb but `run` is imported when invoked. `vx run` is the hot path
14
- // and nearly every invocation; the other verbs' modules are code that
15
- // process never calls. Measured 2026-09-03: `--version` is 25 ms either
16
- // way (module loading is not where start-up goes), so this is hygiene, not
17
- // a speed-up. The specifiers are string literals, so `bun build --compile`
18
- // still embeds them.
9
+ // Every verb is imported when invoked, `run` included, and so is the
10
+ // plugin-verb lookup: each pulls in the orchestrator and the workspace
11
+ // loader, 49 ms of a 65 ms `vx --version` (2026-09-30). This file once
12
+ // re-exported the verbs' parsers for tests, which loaded every verb on
13
+ // every start. The specifiers are string literals, so `bun build
14
+ // --compile` still embeds them.
15
+ const plugins = () => import('./plugin-commands.js')
19
16
 
20
17
  export async function run(argv: readonly string[]): Promise<number> {
21
18
  const [command, ...rest] = argv
@@ -26,7 +23,7 @@ export async function run(argv: readonly string[]): Promise<number> {
26
23
  // which is the one place `--help` is not being asked of vx. Core verbs
27
24
  // only — a plugin verb owns its own arguments, `--help` included.
28
25
  if (command !== undefined && wantsHelp(command, rest)) {
29
- printHelp(await pluginCommandHelp(), command)
26
+ printHelp(await (await plugins()).pluginCommandHelp(), command)
30
27
  return 0
31
28
  }
32
29
 
@@ -34,7 +31,7 @@ export async function run(argv: readonly string[]): Promise<number> {
34
31
  case undefined:
35
32
  case '--help':
36
33
  case '-h':
37
- printHelp(await pluginCommandHelp())
34
+ printHelp(await (await plugins()).pluginCommandHelp())
38
35
  return 0
39
36
  case 'help': {
40
37
  // `vx help run` is the same question as `vx run --help`. A plugin verb
@@ -45,7 +42,7 @@ export async function run(argv: readonly string[]): Promise<number> {
45
42
  if (verb !== undefined && !core) {
46
43
  // A name that is no verb here is the typo `vx rnu` is, not a request
47
44
  // for the whole reference: it printed 145 lines and no hint.
48
- const resolved = await resolvePluginCommand(verb)
45
+ const resolved = await (await plugins()).resolvePluginCommand(verb)
49
46
  const unknown = resolved === null || 'declaredVerbs' in resolved
50
47
  const pointer = MOVED_VERBS[verb] ?? FOREIGN_VERBS[verb]
51
48
  if (unknown && pointer !== undefined) {
@@ -60,7 +57,7 @@ export async function run(argv: readonly string[]): Promise<number> {
60
57
  return 1
61
58
  }
62
59
  }
63
- printHelp(await pluginCommandHelp(), core ? verb : undefined)
60
+ printHelp(await (await plugins()).pluginCommandHelp(), core ? verb : undefined)
64
61
  return 0
65
62
  }
66
63
  case '--version':
@@ -68,7 +65,7 @@ export async function run(argv: readonly string[]): Promise<number> {
68
65
  process.stdout.write(`vx ${VERSION}\n`)
69
66
  return 0
70
67
  case 'run':
71
- return await runCmd(rest)
68
+ return await (await import('./run.js')).runCmd(rest)
72
69
  case 'watch':
73
70
  return await (await import('./watch.js')).watchCmd(rest)
74
71
  case 'cache':
@@ -88,12 +85,14 @@ export async function run(argv: readonly string[]): Promise<number> {
88
85
  case 'last':
89
86
  return await (await import('./last.js')).lastCmd(rest)
90
87
  case 'completions':
91
- return await (await import('./completions.js')).completionsCmd(rest, await pluginVerbs())
88
+ return await (
89
+ await import('./completions.js')
90
+ ).completionsCmd(rest, await (await plugins()).pluginVerbs())
92
91
  default: {
93
92
  // Not a core verb: a plugin declared in the workspace around the cwd
94
93
  // may own it (`VxPlugin.commands`). Core verbs were matched above, so
95
94
  // nothing here can shadow them.
96
- const resolved = await resolvePluginCommand(command)
95
+ const resolved = await (await plugins()).resolvePluginCommand(command)
97
96
  if (resolved !== null && !('loadError' in resolved) && !('declaredVerbs' in resolved)) {
98
97
  let code: number
99
98
  try {
@@ -137,7 +136,10 @@ export async function run(argv: readonly string[]): Promise<number> {
137
136
  }
138
137
  // A task typed where the verb goes (`turbo build`, `nx build app`),
139
138
  // `turbo dev` included: a repo's own `dev` task beats the no-service note.
140
- const task = loadNote === '' ? await taskVerbHint(command, rest, process.cwd()) : null
139
+ const task =
140
+ loadNote === ''
141
+ ? await (await import('./task-verb.js')).taskVerbHint(command, rest, process.cwd())
142
+ : null
141
143
  if (task !== null) {
142
144
  process.stderr.write(`vx: ${task}\n`)
143
145
  return 1
@@ -177,21 +179,6 @@ export async function run(argv: readonly string[]): Promise<number> {
177
179
  }
178
180
  }
179
181
 
180
- // Re-exports for tests + programmatic embedders.
181
- export {
182
- detectFlow,
183
- parseConcurrency,
184
- parseRunArgs,
185
- resolveRunOptions,
186
- type RunArgs,
187
- } from './run.js'
188
- export { parsePruneArgs, parseDuration, parseSize } from './cache.js'
189
- export { parseLockArgs, type LockArgs } from './lock.js'
190
- export { parseInitArgs, type InitArgs } from './init.js'
191
- export { parseShowArgs, type ShowArgs } from './show.js'
192
- export { parseWhyArgs } from './why.js'
193
- export { parseLastArgs } from './last.js'
194
- export { formatBytes } from './format.js'
195
182
  export { registerCoreAlias } from './core-alias.js'
196
183
 
197
184
  /**