From 4bbce3a15a497c7728c025ba76de218241a676bb Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 29 Jun 2026 16:24:32 -0600 Subject: [PATCH 1/2] fix(cli): expose vpr as a package bin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `vpr` (the `vp run` shorthand) only existed as a global PATH shim created by `vp env setup`. The npm package shipped only `vp`, `oxfmt`, and `oxlint` bins, so clean CI installs without the global shims (Vercel build image, generic CI runners) failed with `vpr: command not found` (exit 127). Add a `bin/vpr` Node shim that injects `run` into argv and delegates to the existing CLI entry, and register it in the package `bin` map so a normal install creates `node_modules/.bin/vpr`. The shim splices `run` before a dynamic `await import('../dist/bin.js')` so the entry reads the spliced argv and dispatches the `run` subcommand — byte-for-byte equivalent to `vp run`. `vpx` is intentionally not shipped this way: its npx-equivalent resolution chain lives only in the global CLI crate with no JS entrypoint. Closes #1827 --- packages/cli/bin/vpr | 9 +++++++++ packages/cli/package.json | 3 ++- packages/cli/snap-tests/command-vpr/args.mjs | 4 ++++ packages/cli/snap-tests/command-vpr/package.json | 9 +++++++++ packages/cli/snap-tests/command-vpr/steps.json | 9 +++++++++ 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100755 packages/cli/bin/vpr create mode 100644 packages/cli/snap-tests/command-vpr/args.mjs create mode 100644 packages/cli/snap-tests/command-vpr/package.json create mode 100644 packages/cli/snap-tests/command-vpr/steps.json diff --git a/packages/cli/bin/vpr b/packages/cli/bin/vpr new file mode 100755 index 0000000000..1848381e60 --- /dev/null +++ b/packages/cli/bin/vpr @@ -0,0 +1,9 @@ +#!/usr/bin/env node + +import module from 'node:module'; +if (module.enableCompileCache) { + module.enableCompileCache(); +} + +process.argv.splice(2, 0, 'run'); +await import('../dist/bin.js'); diff --git a/packages/cli/package.json b/packages/cli/package.json index 7ebe9448ff..d6772be8f2 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -16,7 +16,8 @@ "bin": { "oxfmt": "./bin/oxfmt", "oxlint": "./bin/oxlint", - "vp": "./bin/vp" + "vp": "./bin/vp", + "vpr": "./bin/vpr" }, "files": [ "AGENTS.md", diff --git a/packages/cli/snap-tests/command-vpr/args.mjs b/packages/cli/snap-tests/command-vpr/args.mjs new file mode 100644 index 0000000000..137b1e1095 --- /dev/null +++ b/packages/cli/snap-tests/command-vpr/args.mjs @@ -0,0 +1,4 @@ +// Print arguments passed to this script, one per line +for (const arg of process.argv.slice(2)) { + console.log(arg); +} diff --git a/packages/cli/snap-tests/command-vpr/package.json b/packages/cli/snap-tests/command-vpr/package.json new file mode 100644 index 0000000000..ceac7270df --- /dev/null +++ b/packages/cli/snap-tests/command-vpr/package.json @@ -0,0 +1,9 @@ +{ + "name": "command-vpr", + "version": "1.0.0", + "scripts": { + "hello": "node args.mjs hello from script", + "greet": "node args.mjs greet" + }, + "packageManager": "pnpm@10.19.0" +} diff --git a/packages/cli/snap-tests/command-vpr/steps.json b/packages/cli/snap-tests/command-vpr/steps.json new file mode 100644 index 0000000000..14dfbba51c --- /dev/null +++ b/packages/cli/snap-tests/command-vpr/steps.json @@ -0,0 +1,9 @@ +{ + "ignoredPlatforms": ["win32"], + "commands": [ + "vpr -h # should show vp run help", + "vpr hello # should run script via vpr shorthand", + "vpr greet --arg1 value1 # should pass through additional args", + "vpr nonexistent # should show pnpm missing script error" + ] +} From b5c6107249cb34663152ee9cec317547dbb4d68f Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 1 Jul 2026 19:34:22 -0600 Subject: [PATCH 2/2] test(cli): add generated command-vpr snapshot The command-vpr fixture was missing its expected snap.txt, so running `pnpm -F vite-plus snap-test-local command-vpr` produced an untracked snapshot instead of validating committed output. Generate and commit it. The local snapshot goes through the JS bin -> NAPI `run` path, so its `vpr -h` output is clap's derived help (not the global vpr shim's compact unified help); the task-run lines match the global command-vpr fixture. Addresses Codex review on #1988. --- packages/cli/snap-tests/command-vpr/snap.txt | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 packages/cli/snap-tests/command-vpr/snap.txt diff --git a/packages/cli/snap-tests/command-vpr/snap.txt b/packages/cli/snap-tests/command-vpr/snap.txt new file mode 100644 index 0000000000..de60d81935 --- /dev/null +++ b/packages/cli/snap-tests/command-vpr/snap.txt @@ -0,0 +1,57 @@ +> vpr -h # should show vp run help +Run tasks + +Usage: vp run [OPTIONS] [TASK_SPECIFIER] [ADDITIONAL_ARGS]... + +Arguments: + [TASK_SPECIFIER] [ADDITIONAL_ARGS]... + Task to run, as `packageName#taskName` or just `taskName`. + Any arguments after the task name are forwarded to the task process. + Running `vp run` without a task name shows an interactive task selector. + +Options: + -r, --recursive + Select all packages in the workspace + -t, --transitive + Select the current package and its transitive dependencies + -w, --workspace-root + Select the workspace root package + -F, --filter + Match packages by name, directory, or glob pattern + --fail-if-no-match + Exit with a non-zero status if a `--filter` expression matches no packages + --ignore-depends-on + Do not run dependencies specified in `dependsOn` fields + -v, --verbose + Show full detailed summary after execution + --cache + Force caching on for all tasks and scripts + --no-cache + Force caching off for all tasks and scripts + --log + How task output is displayed [default: interleaved] [possible values: interleaved, labeled, grouped] + --concurrency-limit + Maximum number of tasks to run concurrently. Defaults to 4 + --parallel + Run tasks without dependency ordering. Sets concurrency to unlimited unless `--concurrency-limit` is also specified + --last-details + Display the detailed summary of the last run + -h, --help + Print help (see more with '--help') + +> vpr hello # should run script via vpr shorthand +$ node args.mjs hello from script ⊘ cache disabled +hello +from +script + + +> vpr greet --arg1 value1 # should pass through additional args +$ node args.mjs greet --arg1 value1 ⊘ cache disabled +greet +--arg1 +value1 + + +[1]> vpr nonexistent # should show pnpm missing script error +Task "nonexistent" not found.