Skip to content

vp pm approve / vp pm permissions (pnpm 12) are not forwarded to pnpm #3596

Backlog

Description

@luizfneves404

Describe the bug

pnpm 12's approve (alias of pnpm permissions approve, which covers build scripts and package skills) isn't reachable through vp pm. vp pm approve and vp pm -- approve both fail with Command 'approve' not found. vp pm approve-builds exists but covers build scripts only. PmCommand in crates/vp_pm_cli/src/cli.rs has no Approve/Permissions variant and no passthrough for unknown subcommands. Workaround: vp exec pnpm approve <pkg>. Related: #2422 (same class, other subcommands).

Reproduction

https://gist.github.com/luizfneves404/0b37462198e5be666fbcf8ecd5678d01

Steps to reproduce

pnpm install            # Ignored build scripts: esbuild@0.28.2
vp pm approve esbuild   # error: Command 'approve' not found / Did you mean `vp pm approve-builds`?
vp pm -- approve esbuild  # same error
pnpm approve esbuild    # works, runs esbuild postinstall

System Info

vp v1.8.0
Node.js v26.13.1, Linux
pnpm 12.23.0 (devEngines)

Used Package Manager

pnpm

Validations

  • Read the Contributing Guidelines.
  • Check that there isn't already an issue for the same bug.
  • Confirm this is a Vite+ issue and not an upstream issue.
  • The provided reproduction is a minimal reproducible example.

Disclosure: written by an AI agent (Claude Code), reviewed and filed by me.

Activity

  1. added theissue type on Nov 28, 2026
  2. voidzero-bot commented on Nov 28, 2026

    @voidzero-bot
    Contributor
    • Reproduced: Yes — vp pm approve esbuild, vp pm -- approve esbuild, and vp pm permissions … all fail with Command '…' not found (exit 2) in a minimal pnpm 12 project, while pnpm approve esbuild directly runs the esbuild postinstall.
    • Exploration: Yes — traced the full routing path on both CLI surfaces and verified product intent against docs, code, tests, and maintainer guidance from the related issue Add missing pnpm-parity commands: vp pm peers check and vp pm patch-remove #2422.
    • Unit Test: No — triage stopped at the verify step; no fix or failing test was added.
    • Priority: Priority P2: Has Workaround. Affects only pnpm 12 users managing dependency permissions through vp pm, and a straightforward workaround exists (vp exec pnpm approve <pkg>, or vp pm approve-builds for build scripts only), so this is not blocking for most workflows.

    The root cause is the deliberately curated vp pm command surface: PmCommand in crates/vp_pm_cli/src/cli.rs:75 is a closed clap Subcommand enum with per-package-manager, version-gated Resolve impls, and pnpm 12's new approve / permissions command family simply has no variant yet. There is no catch-all passthrough by design, so any unadapted subcommand — with or without -- — hits clap's InvalidSubcommand and is printed as Command '…' not found by crates/vp_global_cli/src/main.rs:575 / crates/vp_cli_help/src/error.rs:33 (the local NAPI binding fails identically since it flattens the same enum). Verification found this rejection behavior is intended (documented curated command list, snapshot-tested suggestion machinery, and maintainer policy in #2422), so the issue is in substance a request to extend the surface rather than a routing defect; notably, the approval workflow is implemented by three managers (pnpm 12, npm ≥ 11.16 approve-scripts, Bun pm trust), which meets the maintainers' stated inclusion bar — so an extension could well be accepted.

    I wasn't able to find a fix, but I identified some areas that may be relevant. If maintainers want to adapt this family, the starting points are: crates/vp_pm_cli/src/cli.rs (PmCommand + PmCommand::resolve_for_manager), crates/vp_pm_cli/src/resolution/commands/approve_builds.rs (the closest existing per-manager pattern to copy, including npm/Bun/Yarn no-op diagnostics), crates/vp_pm_cli/src/resolution/dialect.rs (pnpm version gates), and crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/ (snapshot fixtures such as command_pm_approve_builds_*). Edge cases to keep in mind: the --all/-y/!<pkg> deny flags, permissions list/ls, old-pnpm/npm/yarn/bun no-op behavior, and local-CLI parity — details are in the full report below.

    Full Triage Report

    Triage Report — Issue #3596

    Title: vp pm approve / vp pm permissions (pnpm 12) are not forwarded to pnpm
    Result: Reproduced (reproducible: true, skipped: false)
    Issue type: Bug (per initial classification; verification below concludes the behavior itself is intended and the issue is effectively a feature request to extend vp pm)

    Summary

    pnpm 12's approve command (alias of pnpm permissions approve, covering build scripts and package skills) is not reachable through vp pm. The PmCommand enum in crates/vp_pm_cli/src/cli.rs has an ApproveBuilds variant (build scripts only) but no Approve/Permissions variant, and there is no passthrough for unknown subcommands, so vp pm approve <pkg> and vp pm -- approve <pkg> both fail with error: Command 'approve' not found (exit 2).

    • Expected: vp pm approve esbuild forwards to pnpm and runs the esbuild postinstall.
    • Actual: vp pm approve esbuild and vp pm -- approve esbuild both exit 2 with error: Command 'approve' not found and a suggestion to use vp pm approve-builds. Direct pnpm approve esbuild succeeds.

    Environment

    Component Version
    vp (global CLI on PATH) v1.8.0
    Local vite-plus v1.8.0
    Node.js v24.22.3
    pnpm (on PATH) 12.11.2
    OS Linux (GitHub Actions runner, x86_64)

    Note: reporter used pnpm 12.23.0; the reproduction used the runner's pnpm 12.11.2, which already supports pnpm approve and shows the same behavior.

    Reproduction

    Path: /tmp/vite-plus-triage/gh-3596/repro — minimal project with devDependencies: { esbuild: "0.28.2" }.

    1. pnpm install — succeeds with Ignored build scripts: esbuild@0.28.2.
    2. vp pm approve esbuild — error: Command 'approve' not found / Did you mean \vp pm approve-builds`?` — exit 2.
    3. vp pm -- approve esbuild — same error; the -- passthrough form also fails; -- does not bypass the subcommand allowlist for vp pm. Exit 2.
    4. vp pm permissions approve esbuild — error: Command 'permissions' not found / Did you mean \vp pm version`?` — exit 2.
    5. Control: pnpm approve esbuild (direct, no vp) — exit 0, the esbuild postinstall ran (…/esbuild@0.28.2/node_modules/esbuild postinstall: Done), confirming the failure is in vp pm command routing, not in the environment or the project.

    Diagnosis

    Layer

    Package-manager command surface: crates/vp_pm_cli. PackageManagerCommand is clap-flattened into both CLI surfaces, so the behavior is identical on the global Rust CLI and the local NAPI CLI:

    • crates/vp_global_cli/src/cli.rs:66 — Commands::PackageManager(PackageManagerCommand) (#[command(flatten)]), parsed in crates/vp_global_cli/src/main.rs.
    • packages/cli/binding/src/cli/types.rs:160 / packages/cli/binding/src/cli/mod.rs:453 — the local binding parses the same enum and dispatches through vp_pm_cli::dispatch_for_local_cli.

    The design intent (documented in crates/vp_pm_cli/src/cli.rs lines 1–10) is that every vp pm subcommand is a typed variant with per-manager resolution and version gates in crates/vp_pm_cli/src/resolution/. There is deliberately no raw passthrough.

    Root Cause

    crates/vp_pm_cli/src/cli.rs:75 — PmCommand is a closed clap Subcommand enum with 27 variants (Ci, ApproveBuilds, …, Ping). It has:

    1. No Approve/Permissions variant. pnpm 12's pnpm approve (alias of pnpm permissions approve) and the pnpm permissions family (approve, list/ls) were never added, unlike sibling commands that were added as pnpm grew them (Token → pnpm 12.13.0, Team → pnpm 11.13.0, Owner → pnpm 11.1.0; gates live in crates/vp_pm_cli/src/resolution/dialect.rs).
    2. No catch-all passthrough. There is no #[command(external_subcommand)] variant on PmCommand, so any subcommand not in the enum is a clap ErrorKind::InvalidSubcommand.

    Observed failure chain (matches the reproduction exactly):

    • clap fails parsing vp pm approve esbuild with InvalidSubcommand, ContextKind::InvalidSubcommand = "approve".
    • Global CLI: crates/vp_global_cli/src/main.rs:575 → crates/vp_cli_help/src/error.rs:33 prints Command 'approve' not found; the suggestion machinery prints Did you mean \vp pm approve-builds`?`. Exit code 2.
    • vp pm -- approve esbuild: -- only ends option parsing in clap; the next token is still matched against the subcommand enum, so the same InvalidSubcommand error fires.
    • Local CLI: same clap enum fails; packages/cli/binding/src/cli/help.rs:42 and handler.rs:95 print the equivalent "not found" surface.

    Why approve-builds is not a substitute (confirmed against pnpm 12.11.2): pnpm approve / pnpm permissions approve approve "what dependencies may do" — build scripts and package skills (agent skills) — with packages/!packages positionals, --all, and -y/--yes flags; vp pm approve-builds resolves only to pnpm approve-builds (crates/vp_pm_cli/src/resolution/commands/approve_builds.rs:28), which covers lifecycle scripts only.

    Control Evidence

    pnpm approve esbuild run directly exits 0 and executes the esbuild postinstall, proving the failure is vp's routing surface, not the environment. vp exec pnpm approve <pkg> (the reported workaround) also bypasses the enum because Exec is a raw forwarding command.

    Suggested Fix Approach (not implemented)

    Follow the established per-command pattern rather than adding a general passthrough:

    1. Add Approve(ApproveArgs) and Permissions(PermissionsCommand) (subcommand enum: Approve/List, matching pnpm's permissions approve|list) variants to PmCommand in crates/vp_pm_cli/src/cli.rs, wired into PmCommand::resolve_for_manager.
    2. New args/Resolve impls in crates/vp_pm_cli/src/resolution/commands/: pnpm builds pnpm approve … / pnpm permissions approve|list … with the documented packages/!packages/--all/-y args and #[arg(last = true)] pass-through, version-gated on pnpm 12 (verified present in 12.11.2; exact introducing minor should be confirmed from pnpm release notes — the reporter used 12.23.0). npm/yarn/bun have no equivalent command, so they should Noop with a diagnostic like the ApproveBuildsArgs Yarn/Bun impls do.
    3. Update both help surfaces (vp help pm, unified subcommand help in crates/vp_global_cli / packages/cli/binding), the typo-suggestion path, and add CLI snapshot fixtures under crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/.
    4. The broader Add missing pnpm-parity commands: vp pm peers check and vp pm patch-remove #2422 class (general forwarding of unknown vp pm subcommands) is a separate, riskier design decision; this family can be added within the existing typed-surface pattern.

    Edge Cases to Cover When Fixing

    • vp pm approve with no packages (pnpm launches interactive mode) and with --all/-y/!<pkg> deny syntax.
    • vp pm permissions list alias ls.
    • Old pnpm, npm, yarn, bun, and unknown-version managers (gating defaults).
    • Local NAPI CLI parity (dispatch_for_local_cli and local help/snapshot fixtures).
    • Managed-global projections: new variants must be absent from ManagedGlobalCommand unless intended.

    Regression Evidence

    None found: git log on crates/vp_pm_cli/src/cli.rs shows commands have only been added incrementally (e.g. Team in #3040, Token per pnpm 12.13.0). approve/permissions were never present, so this is a coverage gap exposed by pnpm 12's new permissions/skills command family, not a regression.

    Confidence

    High — the closed PmCommand enum is proven by code inspection to be the only gate for vp pm subcommands on both CLI surfaces, and the observed error text, suggestions, and exit codes match the clap InvalidSubcommand handling paths exactly.

    Verification

    Claim

    • Observed: vp pm approve esbuild, vp pm -- approve esbuild, and vp pm permissions … all fail with Command '…' not found (exit 2) on both CLI surfaces, while the detected pnpm 12 supports and correctly executes pnpm approve esbuild.
    • Reporter's expectation: pnpm 12's approve / permissions command family should be reachable through vp pm.

    Research Findings

    1. Documented design — curated vp pm surface, not a passthrough. docs/guide/package-management/index.md: "Vite+ provides one command interface for npm, pnpm, Yarn, and Bun … translates commands and supported options"; the docs enumerate an explicit curated command list; approve/permissions are not in it. The "Native Arguments" -- section documents pass-through for arguments of known commands, never for unknown subcommands.
    2. Code design intent. crates/vp_pm_cli/src/cli.rs header: "Each variant owns the same typed argument value that is later diagnosed and resolved for the detected package manager. There is no parser-to-options compatibility layer." PmCommand is deliberately a closed clap enum with per-manager, version-gated Resolve impls. Rejection of unknown subcommands plus a "Did you mean …?" suggestion is the designed UX (crates/vp_cli_help/src/error.rs, crates/vp_global_cli/src/main.rs:575), exercised by the snapshot suite (e.g. command_pm_approve_builds_* fixtures).
    3. Maintainer policy (related issue Add missing pnpm-parity commands: vp pm peers check and vp pm patch-remove #2422, closed). A similar "missing pnpm-parity commands" issue (vp pm peers check, vp pm patch-remove) was closed with explicit maintainer guidance:
      • collaborator jong-kyung: pnpm-only commands "would expose a pnpm-only API rather than a shared package-manager workflow."
      • MEMBER fengmk2: "We will only adapt commands implemented by more than two package managers. If only pnpm supports those commands, we will temporarily not support them."
    4. No prior work on this family. gh search found no issue/PR about vp pm approve/permissions; vp pm approve / vp pm permissions (pnpm 12) are not forwarded to pnpm #3596 is the first report.
    5. The family is not pnpm-only. The "approve what dependencies may do" workflow exists in three managers: pnpm 12 (approve / permissions approve, build scripts and package skills), npm ≥ 11.16 (approve-scripts / deny-scripts), and Bun (pm trust) — and vp pm approve-builds already adapts this workflow partially for exactly those three. So under the Add missing pnpm-parity commands: vp pm peers check and vp pm patch-remove #2422 inclusion criterion, adding vp pm approve/permissions is consistent with policy; its absence today is an unadapted coverage gap, not a deliberate exclusion.

    Verdict

    Intended behavior (confidence: medium). The reproduced failure is exactly what the designed curated, typed vp pm surface does for any subcommand that has not been adapted, and Vite+ has never documented, tested, or promised forwarding of arbitrary pnpm subcommands. Nothing in docs, code, tests, or release history contradicts the observed behavior, so this is not a regression or an implementation defect; the issue is in substance a request to extend vp pm with the pnpm 12 approve/permissions command family. Medium rather than high confidence because there is no maintainer statement about this specific family, and unlike the pnpm-only commands in #2422, the approval workflow meets the stated "more than two package managers" bar (pnpm, npm, Bun), so maintainers may well accept an enhancement PR adding Approve/Permissions variants. Confidence in the diagnosis itself (closed PmCommand enum as the cause) remains high; the ambiguity is only about product intent for this specific command family.

    This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.

  3. added
    - P2: has workaround
    on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P2: has workaroundtriage: unable to fix

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Target date

    None yet

    Start date

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions