Commit 1227bce
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
- crates
- vite_global_cli
- src
- commands
- vite_pm_cli
- src
- packages/cli
- binding
- src
- check
- cli
- snap-tests
- command-add-pnpm10
- command-dedupe-pnpm10
- command-dlx-pnpm10
- command-info-no-package-json
- command-install-auto-create-package-json
- command-install-shortcut
- command-link-pnpm10
- command-outdated-pnpm10
- command-pm-global-rejected
- command-pm-no-package-json
- command-remove-pnpm10
- command-unlink-pnpm10
- command-update-pnpm10
- command-why-pnpm10
- npm-install-with-options
- vite-task-path-env-include-pm
- yarn-install-with-options
- rfcs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
0 commit comments