Skip to content

Commit 1227bce

Browse files
committed
feat(cli): bring all package-manager commands to the local CLI (#1495)
Extract the package-manager CLI surface (clap definitions + dispatch glue) into a new shared crate `vite_pm_cli` consumed by both the global Rust binary and the local NAPI binding, so `npx vp add <pkg>`, `vp remove`, `vp update`, `vp dedupe`, `vp dlx`, `vp pm publish`, etc. all work identically on the local CLI. Previously the local CLI only knew the `install` shortcut; every other PM command fell through to clap's "unknown subcommand" error. The core PM logic in `vite_install` was already a binding dependency — only the parser and dispatcher were missing. Sharing the clap surface guarantees the two CLIs cannot drift on flag names, aliases, or behavior. The global CLI keeps a thin wrapper that intercepts `--global` for vite-plus-managed installs (`commands::env::global_install`) and ensures the managed Node runtime is on PATH before delegating; the local CLI dispatches PM commands directly through `vite_pm_cli` and bypasses the vite-task scheduler since PM operations do not need caching. Snap-test coverage: one representative pnpm10 fixture per command mirrored into `packages/cli/snap-tests/`. Pre-existing snap updates reflect the now-consistent behavior — `vp install --help` prints clap's help instead of forwarding to the underlying PM, and PM commands inside `vp run` correctly show "cache disabled". <!-- CURSOR_SUMMARY --> --- > [!NOTE] > <sup>[Cursor Bugbot](https://cursor.com/bugbot) is generating a summary for commit 2f92ac7. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 9c84063 commit 1227bce

76 files changed

Lines changed: 3477 additions & 2584 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ vite_js_runtime = { path = "crates/vite_js_runtime" }
197197
vite_glob = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "d1b8cdae8b6df5eab8b9f1143ceb4fb13933a5ef" }
198198
vite_install = { path = "crates/vite_install" }
199199
vite_migration = { path = "crates/vite_migration" }
200+
vite_pm_cli = { path = "crates/vite_pm_cli" }
200201
vite_setup = { path = "crates/vite_setup" }
201202
vite_shared = { path = "crates/vite_shared" }
202203
vite_static_config = { path = "crates/vite_static_config" }

crates/vite_global_cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ crossterm = { workspace = true }
2828
vite_error = { workspace = true }
2929
vite_install = { workspace = true }
3030
vite_js_runtime = { workspace = true }
31+
vite_pm_cli = { workspace = true }
3132
vite_path = { workspace = true }
3233
vite_command = { workspace = true }
3334
vite_setup = { workspace = true }

0 commit comments

Comments
 (0)