Skip to content

Commit 9b536a8

Browse files
committed
docs: drop local binding claims from vp_global_commands docs
The local CLI binding does not consume is_global_only yet; that wiring belongs to #2522. Describe the helper without naming a consumer.
1 parent 1962a97 commit 9b536a8

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

crates/vp_global_cli/src/cli.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ pub enum Commands {
221221

222222
// =========================================================================
223223
// Category D: Global-only commands (env, upgrade, implode)
224-
// (clap-flattened from `vp_global_commands::GlobalOnlyCommand` so the
225-
// local CLI binding can recognise the same surface.)
224+
// (clap-flattened from the shared `vp_global_commands::GlobalOnlyCommand`.)
226225
// =========================================================================
227226
#[command(flatten)]
228227
GlobalOnly(GlobalOnlyCommand),

crates/vp_global_commands/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Commands that exist only in the global `vp` binary.
22
//!
33
//! The global CLI flattens [`GlobalOnlyCommand`] into its top-level command
4-
//! enum, and the local CLI binding uses [`is_global_only`] to recognise these
5-
//! names so the two surfaces cannot drift apart.
4+
//! enum. [`is_global_only`] derives the command names from the same enum so
5+
//! other crates can recognise them without keeping a separate list.
66
77
#![allow(clippy::allow_attributes, clippy::disallowed_types)]
88

rfcs/merge-global-and-local-cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ The Rust `vp` binary (`crates/vp_global_cli/`) routes commands in four categorie
162162
- **Category A (Package Manager)**: `install`, `add`, `remove`, `update`, `dedupe`, `outdated`, `why`, `info`, `link`, `unlink`, `dlx`, `pm <subcmd>` — clap definitions and dispatch live in the shared `crates/vp_pm_cli/` crate. Both the global CLI and the local CLI binding flatten `vp_pm_cli::PackageManagerCommand` into their top-level argument parser and call `vp_pm_cli::dispatch` to run the underlying package manager (pnpm/npm/yarn/bun). The global CLI additionally intercepts `--global` for vite-plus-managed installs (`commands::env::global_install`) before delegating.
163163
- **Category B (JavaScript)**: `create`, `migrate`, `config`, `hooks`, `staged`, `--version` — Rust uses `oxc_resolver` to find the project's local `vite-plus/dist/bin.js` and runs it. Falls back to the global installation's `dist/bin.js` if no local installation exists. The unified `bin.ts` entry point then routes to either NAPI bindings (task commands and PM commands, the latter via `vp_pm_cli::dispatch`) or rolldown-bundled modules in `dist/global/` (create, migrate, version).
164164
- **Category C (Local CLI Delegation)**: `dev`, `build`, `test`, `lint`, `fmt`, `check`, `pack`, `run`, `exec`, `preview`, `cache` — forwarded to the project-local `vite-plus` CLI through `commands::delegate`, which resolves it the same way as Category B. `lint --init` and `fmt --init`/`--migrate` are forced to the global installation.
165-
- **Category D (Global-only)**: `env`, `upgrade`, `implode` — clap definitions live in the shared `crates/vp_global_commands/` crate as `GlobalOnlyCommand`. The global CLI flattens it into its top-level argument parser and keeps the implementations in `crates/vp_global_cli/src/commands/`. The local CLI binding does not flatten it; it calls `vp_global_commands::is_global_only(name)` (derived from the same enum via clap, so there is no separate list) to recognise these names and point users at the global binary.
165+
- **Category D (Global-only)**: `env`, `upgrade`, `implode` — clap definitions live in the shared `crates/vp_global_commands/` crate as `GlobalOnlyCommand`. The global CLI flattens it into its top-level argument parser and keeps the implementations in `crates/vp_global_cli/src/commands/`. The crate also exposes `is_global_only(name)`, derived from the same enum via clap, so other crates can recognise these names without a separate list.
166166

167167
### Global scripts_dir Resolution (Rust)
168168

@@ -279,7 +279,7 @@ if (command === 'create') {
279279

280280
12. **Extracted global-only commands into a shared `vp_global_commands` crate**:
281281
- Moved the `env`, `upgrade`, and `implode` clap definitions (plus `EnvArgs`, `EnvSubcommands`, `PinTarget`, `SortingMethod`) out of `crates/vp_global_cli/src/cli.rs` into `crates/vp_global_commands/` as `GlobalOnlyCommand`. The global CLI flattens it into `Commands` and re-exports the types so `commands/env/*` keep their import paths.
282-
- Exposed `is_global_only(name)`, computed from the enum through clap's `augment_subcommands`, so the local CLI binding can recognise global-only command names without maintaining its own list that could drift from the global surface.
282+
- Exposed `is_global_only(name)`, computed from the enum through clap's `augment_subcommands`, so command names can be recognised elsewhere without maintaining a list that could drift from the global surface.
283283

284284
## Verification
285285

0 commit comments

Comments
 (0)