Skip to content

fix(cli): accept npm's --prefix and --store spellings - #13592

Merged
zkochan merged 4 commits into
mainfrom
fix-13583
Aug 2, 2026
Merged

zkochan merged 4 commits into
mainfrom
fix-13583

Conversation

@zkochan

@zkochan zkochan commented Aug 2, 2026 •

Copy link
Copy Markdown
Member

Summary

pnpm --prefix ../ run test failed on pnpm 12 with error: unexpected argument '--prefix' found. pnpm 11 rewrites --prefix to --dir and --store to --store-dir before parsing (RENAMED_OPTIONS in pnpm11/pnpm/src/parseCliArgs.ts), so npm habits and existing CI scripts keep working; pacquet had no equivalent and clap rejected the unknown long flag outright.

Two pieces:

  1. The spellings are hidden clap aliases on the two global options, rather than a full argv-rewriting pass. The pre-clap passes (shorthands.rs, flag_relocation.rs, parse_boundary.rs) derive their arity tables from the clap Command and already fold in every alias, so --prefix relocates and steps over its value exactly like --dir. Hidden rather than visible_alias, so --help stays identical to pnpm 11's, which documents neither spelling.
  2. The canonical spelling wins when a command line uses both. pnpm's rename loop drops the alias whenever the canonical option is also present, in either order (--prefix foo --dir bar and --dir bar --prefix foo both resolve to bar), while clap alone would keep the last occurrence. The new renamed_options pass removes the shadowed alias tokens ahead of the parse, reusing the same clap-derived arity tables, so an alias value that spells a subcommand is never mistaken for one and a script's own --prefix stays the script's.

Two smaller fixes ride along. The --version pre-scan (SwitchInput::from_version_argv) now reads option arity from the clap grammar instead of a hand-maintained list of value-taking options. The list did not know about --store-dir, so pnpm --store-dir /s --version took /s for the command name and stopped scanning — a pre-existing bug that the --store alias would have extended. And the clap grammar is now built once per process (cli_args::grammar()) instead of per caller: constructing it walks every subcommand, and the pre-parse passes each need the same view of it, so this is a net reduction in startup work versus main.

TypeScript-side parity: none needed — the TS CLI already supports both spellings, this is pacquet catching up.

Closes #13583

Squash Commit Body

pnpm 11 rewrites `--prefix` to `--dir` and `--store` to `--store-dir`
before parsing argv (`RENAMED_OPTIONS` in `parseCliArgs.ts`), so npm
habits and existing CI scripts keep working. pacquet had no equivalent
and clap rejected the unknown long flag outright, breaking invocations
like `pnpm --prefix ../ run test:ci`.

Both spellings are added as clap aliases on the global options rather
than as an argv-rewriting pass: the pre-clap passes derive their arity
tables from the clap `Command` and already fold in every alias, so
`--prefix` relocates and steps over its value like `--dir` does. The
aliases are hidden so the help output stays identical to pnpm 11's,
which does not document either spelling.

pnpm additionally drops the alias when a command line spells the same
option both ways, so `--prefix foo --dir bar` and `--dir bar --prefix
foo` both resolve to `bar`. Clap keeps the last occurrence instead, so
`renamed_options` removes the shadowed alias tokens ahead of the parse,
alongside the other pre-clap passes and using the same clap-derived
arity tables.

The `--version` pre-scan reads `--dir` directly to find the project
whose pin decides the delegated version. It now honors `--prefix` there
too, and takes option arity from the clap grammar instead of a
hand-maintained list of value-taking options: the list did not know
about `--store-dir`, so `pnpm --store-dir /s --version` took `/s` for
the command name and stopped scanning.

The clap grammar is built once per process rather than per caller.
Constructing it walks every subcommand, and every pass that runs before
the parse needs the same view of it, so the boundary scan no longer
rebuilds one on each call.

Closes pnpm/pnpm#13583

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

Written by an agent (Claude Code, claude-opus-5[1m]).

Summary by CodeRabbit

  • New Features

    • Added --prefix as an alias for --dir, supporting separate values and --prefix=<path>.
    • Added --store as an alias for --store-dir, including --store=<path>.
    • Commands such as pnpm --prefix <directory> run <script> now work as expected.
    • Canonical options take precedence when both forms are provided.
    • Options intended for scripts continue to be forwarded correctly.
  • Tests

    • Added coverage for aliases before and after subcommands, including end-to-end script execution and option forwarding.

pnpm 11 rewrites `--prefix` to `--dir` and `--store` to `--store-dir`
before parsing argv (`RENAMED_OPTIONS` in `parseCliArgs.ts`), so npm
habits and existing CI scripts keep working. pacquet had no equivalent
and clap rejected the unknown long flag outright, breaking invocations
like `pnpm --prefix ../ run test:ci`.

Both spellings are added as clap aliases on the global options rather
than as an argv-rewriting pass: the pre-clap passes derive their arity
tables from the clap `Command` and already fold in every alias, so
`--prefix` relocates and steps over its value like `--dir` does. The
aliases are hidden so the help output stays identical to pnpm 11's,
which does not document either spelling.

The pre-clap argv scan behind `pnpm --version` reads `--dir` directly to
find the project whose pin decides the delegated version; it now honors
`--prefix` there too, the way it already honors `--userconfig`.

Closes #13583
Copilot AI review requested due to automatic review settings August 2, 2026 15:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a245dd3-2bb8-489f-83a7-6b48cfdd80e2

📥 Commits

Reviewing files that changed from the base of the PR and between e6b825d and 231e1da.

📒 Files selected for processing (2)
  • pnpm/crates/cli/src/renamed_options.rs
  • pnpm/crates/cli/src/renamed_options/tests.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • pnpm/crates/cli/src/renamed_options/tests.rs
  • pnpm/crates/cli/src/renamed_options.rs

📝 Walkthrough

Walkthrough

This change adds --prefix as an alias for --dir and --store as an alias for --store-dir. It updates argument consumption, removes shadowed aliases, and adds parser and integration tests.

Changes

CLI option aliases

Layer / File(s) Summary
Alias parsing and option consumption
pnpm/crates/cli/src/cli_args/cli_command.rs, pnpm/crates/cli/src/cli_args.rs, pnpm/crates/cli/src/parse_boundary.rs, pnpm/crates/cli/src/cli_args/pre_command.rs, pnpm/crates/cli/src/cli_args/*tests.rs
The CLI maps --prefix to dir and --store to store_dir. Argument scanning uses cached clap grammar metadata to identify option values. Tests cover separate-value and equals-form arguments before and after subcommands.
Shadowed alias normalization
pnpm/crates/cli/src/renamed_options.rs, pnpm/crates/cli/src/renamed_options/tests.rs, pnpm/crates/cli/src/lib.rs
The preprocessing pipeline removes --prefix and --store when canonical options are also present. It preserves option values and forwarded script arguments.
Command integration and release metadata
pnpm/crates/cli/tests/run.rs, .changeset/prefix-alias-of-dir.md
An integration test verifies project selection and script argument forwarding with --prefix. The changeset records both aliases.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • pnpm/pnpm#13246: Both changes modify global --dir CLI parsing and option positioning.
  • pnpm/pnpm#13300: Both changes modify CLI argument-boundary handling in pre_command.rs.
  • pnpm/pnpm#13309: Both changes modify clap-based option-value handling at the argument boundary.

Suggested labels: product: pacquet

Suggested reviewers: copilot

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-13583

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

CLI: accept npm-style --prefix/--store as aliases for --dir/--store-dir

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Add hidden clap aliases so npm-style --prefix and --store flags are accepted.
• Extend pre-parse --version argv scan to recognize --prefix like --dir.
• Add unit + integration tests and a changeset to prevent regressions.
Diagram

graph TD
  argv["ARGV"] --> prepasses["Pre-clap passes"] --> clap["clap parse"] --> exec["Subcommand exec"]
  spec["CliArgs clap spec"] --> prepasses["Pre-clap passes"] --> clap["clap parse"]
  argv["ARGV"] --> prescan["--version prescan"] --> vout["Version output"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Pre-parse argv rewrite pass (pnpm 11-style RENAMED_OPTIONS)
  • ➕ Keeps clap definition unchanged and centralizes compatibility rewrites
  • ➕ Can be extended to more renames without touching clap attributes
  • ➖ Duplicates logic already implied by clap aliases (arity, relocation)
  • ➖ Higher risk of divergence between rewrite rules and clap option definitions
2. Document aliases via visible_alias
  • ➕ Improves discoverability for users migrating from npm
  • ➕ Reduces surprise by showing supported spellings in --help
  • ➖ Would change help output compared to pnpm 11 expectations
  • ➖ May implicitly “bless” legacy flags the project prefers to keep undocumented

Recommendation: Keep the current approach: hidden clap aliases are the lowest-maintenance way to accept npm spellings while automatically integrating with existing pre-clap relocation/arity logic. The only supplemental work needed (and included here) is updating any out-of-band argv scans (the --version prescan) to recognize the same alias.

Files changed (6) +88 / -2

Bug fix (2) +10 / -2
cli_command.rsDefine hidden clap aliases for dir and store-dir globals +7/-1

Define hidden clap aliases for dir and store-dir globals

• Updates the global --dir option to accept --prefix as an alias, matching npm/pnpm 11 behavior while keeping help output unchanged. Adds --store as an alias for --store-dir so clap accepts both spellings.

pnpm/crates/cli/src/cli_args/cli_command.rs

pre_command.rsTeach --version prescan to treat --prefix like --dir +3/-1

Teach --version prescan to treat --prefix like --dir

• Extends the early argv scanning logic (used for version delegation) to parse --prefix and --prefix= forms in addition to --dir. Ensures the project directory is correctly detected before full clap parsing runs.

pnpm/crates/cli/src/cli_args/pre_command.rs

Tests (3) +73 / -0
tests.rsAdd prescan test cases for --prefix forms +14/-0

Add prescan test cases for --prefix forms

• Adds coverage ensuring the --version argv prescan reads directory from both --prefix VALUE and --prefix=VALUE forms. Verifies behavior remains consistent with existing --dir handling.

pnpm/crates/cli/src/cli_args/pre_command/tests.rs

tests.rsAdd clap parse unit tests for --prefix and --store aliases +23/-0

Add clap parse unit tests for --prefix and --store aliases

• Introduces unit tests asserting --prefix populates CliArgs.dir across different positions and syntaxes. Adds similar tests confirming --store is accepted and mapped into store_dir.

pnpm/crates/cli/src/cli_args/tests.rs

run.rsAdd integration test exercising --prefix before subcommand +36/-0

Add integration test exercising --prefix before subcommand

• Adds an end-to-end test that runs a script from a prefixed project directory using --prefix before the subcommand, confirming the script executes in the intended directory. Explicitly limits coverage to pre-subcommand usage to avoid changing post-script argument forwarding semantics.

pnpm/crates/cli/tests/run.rs

Documentation (1) +5 / -0
prefix-alias-of-dir.mdAdd changeset documenting --prefix/--store alias support +5/-0

Add changeset documenting --prefix/--store alias support

• Introduces a patch changeset for pacquet describing that npm-style --prefix and --store are now accepted as aliases for --dir and --store-dir. Links the fix to pnpm/pnpm#13583 and documents the prior failure mode.

.changeset/prefix-alias-of-dir.md

@greptile-apps

greptile-apps Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

The previously reported precedence mismatch and comment-maintenance issue are fixed, and no blocking failure remains.

Reviews (4): Last reviewed commit: "fix(cli): step over the value of a short..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     11.2±0.04ms    33.4 MB/sec    1.06     11.9±0.05ms    31.5 MB/sec
packument/parse                                  1.01     37.9±0.22µs  1752.0 MB/sec    1.00     37.5±0.06µs  1769.7 MB/sec
tarball/download_dependency                      1.04      2.3±0.06ms  1898.0 KB/sec    1.00      2.2±0.07ms  1969.7 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    171.1±1.28ms 93.5 KElem/sec    1.01    172.3±2.86ms 92.9 KElem/sec
workspace_resolution/hoist_heavy                 1.00    235.3±0.67ms        ? ?/sec    1.01    237.2±0.82ms        ? ?/sec

@qodo-code-review

qodo-code-review Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Remediation recommended

1. Short cluster value re-scanned ✓ Resolved 🐞 Bug ≡ Correctness ⭐ New
Description
drop_shadowed_aliases() detects canonical shorts inside -abc clusters but advances the scan
based only on the *first* short, so a cluster like -rC <dir> (where C consumes a separate value
token) will re-scan <dir> as if it were another argv token. If that value happens to look like an
alias token (e.g. --prefix), it can be incorrectly recorded and later drained, corrupting argv and
potentially changing the parsed working directory/store selection.
Code

pnpm/crates/cli/src/renamed_options.rs[R72-75]

+            mark_canonical_shorts(rest, &arity, &mut canonical_seen);
+            index += token_width(
+                arity.short_consumes_value(short).unwrap_or(false) && is_bare_short,
+                false,
Relevance

●●● Strong

Team has accepted similar argv-scan width bugs; skipping consumed value tokens is treated as
correctness-critical.

PR-#13309

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The scan records canonical shorts inside a cluster (mark_canonical_shorts), but the scan
advancement uses only the first short + is_bare_short, so it will not skip a separate value token
for a later short like -C. Since -C is the canonical short for --dir, a -rC <value> shape
can cause <value> to be processed as if it were another option token and potentially drained if it
matches --prefix/--store.

pnpm/crates/cli/src/renamed_options.rs[69-76]
pnpm/crates/cli/src/renamed_options.rs[97-114]
pnpm/crates/cli/src/cli_args/cli_command.rs[112-115]
pnpm/crates/cli/src/flag_relocation.rs[158-162]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`drop_shadowed_aliases()` scans short-option tokens by looking only at the first short and `is_bare_short` to decide whether to skip a following value token. This fails for clustered shorts where a *later* short consumes a separate value token (e.g. `-rC <dir>`), causing the value token to be scanned as if it were a new option/positional.

### Issue Context
This is in the argv pre-pass that removes shadowed aliases (`--prefix`/`--store`) before clap parsing.

### Fix Focus Areas
- pnpm/crates/cli/src/renamed_options.rs[69-76]
- pnpm/crates/cli/src/renamed_options.rs[97-114]
- pnpm/crates/cli/src/renamed_options/tests.rs[63-84]

### Implementation notes
- Replace the current short-token width computation with a helper that scans the cluster left-to-right until it finds the first short that consumes a value:
 - If the consuming short has trailing characters in the same token, treat them as the attached value => width 1.
 - If the consuming short is the last char in the cluster, it consumes the *next argv token* => width 2.
 - If no consuming short exists, width 1.
- Use that computed width for `index += ...` so the value token is skipped and never interpreted as an option/alias.
- Add a regression test alongside the existing `-rCcanonical` coverage, e.g. ensure `drop_shadowed_aliases(["pnpm","-rC","--prefix","--dir","canonical","install"])` does **not** treat `--prefix` as an alias option token (it’s the `-C` value), and does not drain it.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Extra passthrough scan added ✓ Resolved 🐞 Bug ➹ Performance
Description
renamed_options::drop_shadowed_aliases() calls parse_boundary::passthrough_from(), adding
another full passthrough-boundary scan to every CLI invocation. Since other pre-clap passes already
compute the passthrough boundary, this increases CLI startup overhead and also triggers another
CliArgs::command() build via parse_boundary::command_boundary().
Code

pnpm/crates/cli/src/renamed_options.rs[R40-44]

+pub fn drop_shadowed_aliases(cmd: &Command, argv: Vec<OsString>) -> Vec<OsString> {
+    let mut arity = ArgTable::top_level(cmd);
+    arity.absorb_subcommands(cmd);
+    let passthrough_from = parse_boundary::passthrough_from(&argv).unwrap_or(argv.len());
+
Relevance

●●● Strong

Extra passthrough_from() scan + CliArgs::command() rebuild matches prior accepted perf feedback
to de-duplicate boundary/clap work.

PR-#13309

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new renamed_options pass adds its own call to passthrough_from(). passthrough_from() uses
command_boundary(), which constructs a fresh clap tree (CliArgs::command()), so each additional
call increases startup work. Other existing passes already call passthrough_from() as well, so
this is an added per-invocation cost introduced by this PR.

pnpm/crates/cli/src/renamed_options.rs[40-49]
pnpm/crates/cli/src/shorthands.rs[28-38]
pnpm/crates/cli/src/config_overrides.rs[104-111]
pnpm/crates/cli/src/parse_boundary.rs[45-53]
pnpm/crates/cli/src/parse_boundary.rs[65-71]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The new `drop_shadowed_aliases()` pass computes `passthrough_from` by calling `parse_boundary::passthrough_from(&argv)`. Other pre-clap passes (e.g., shorthands expansion and config override extraction) already compute the same boundary, so this introduces an additional scan and an additional clap `CliArgs::command()` construction in `parse_boundary::command_boundary()`.

### Issue Context
This PR introduced a new argv pre-pass (`renamed_options`) and wired it into `run_cli()`. The new pass needs the passthrough boundary so it doesn’t mutate forwarded/script arguments.

### Fix Focus Areas
- pnpm/crates/cli/src/renamed_options.rs[40-49]
- pnpm/crates/cli/src/lib.rs[74-87]
- pnpm/crates/cli/src/parse_boundary.rs[45-90]

### Suggested fix
- Add an overload in `parse_boundary` that reuses an already-built clap `Command` (and/or an already-built `ArgTable`) to avoid rebuilding the command tree:
 - e.g. `passthrough_from_with_command(cmd: &Command, argv: &[OsString]) -> Option<usize>`
 - internally, build arity from `cmd` instead of calling `CliArgs::command()`.
- Update `renamed_options::drop_shadowed_aliases()` to call the new overload.
- (Optional follow-up) Consider computing and passing a single `passthrough_from` value through the pre-clap pipeline in `run_cli()` so multiple passes can share it, if signatures can be adjusted cleanly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Redundant clap build on --version ✓ Resolved 🐞 Bug ➹ Performance
Description
SwitchInput::from_version_argv() now builds a fresh clap Command (CliArgs::command()) just to
derive an ArgTable, adding extra CLI-grammar construction to the pnpm --version handling path.
This increases startup work in a commonly-invoked command even though run_cli() already built a
clap Command for parsing.
Code

pnpm/crates/cli/src/cli_args/pre_command.rs[837]

+        let global_options = ArgTable::top_level(&CliArgs::command());
Relevance

●●● Strong

Team previously accepted avoiding repeated CliArgs::command() builds in CLI boundary logic; same
startup-performance concern here.

PR-#13309

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new code builds a clap Command in from_version_argv(), and this function is used
specifically on the --version path. Meanwhile, run_cli() already constructs a clap Command for
parsing, so this additional construction is redundant work.

pnpm/crates/cli/src/cli_args/pre_command.rs[833-883]
pnpm/crates/cli/src/cli_args/pre_command.rs[70-91]
pnpm/crates/cli/src/lib.rs[71-102]
pnpm/crates/cli/src/parse_boundary.rs[65-71]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`SwitchInput::from_version_argv()` constructs a new clap `Command` via `CliArgs::command()` to compute `ArgTable` for `consumes_next_token()`. This duplicates work already done in `run_cli()` (which builds the full clap tree) and adds avoidable startup overhead to the `--version` path.

### Issue Context
- The `--version` flow already has an in-scope `command` built in `run_cli()`.
- The new scan only needs the top-level/global option arity table.

### Fix Focus Areas
- pnpm/crates/cli/src/cli_args/pre_command.rs[833-885]
- pnpm/crates/cli/src/lib.rs[70-105]

### Suggested fix
- Thread the already-built `Command` (or a precomputed `ArgTable`) into `pre_command_plan_for_version_flag()` / `SwitchInput::from_version_argv()`.
 - Example approach: change `from_version_argv(argv: &[OsString])` to `from_version_argv(argv: &[OsString], global_options: &ArgTable)`.
 - Build `let global_options = ArgTable::top_level(&command);` once in `run_cli()` right before calling `pre_command_plan_for_version_flag()` and pass it through.
- This preserves the clap-derived arity behavior while eliminating an extra clap tree build.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (2)
4. Version scan misreads --store ✓ Resolved 🐞 Bug ≡ Correctness
Description
The --version pre-scan (SwitchInput::from_version_argv) does not treat the newly-accepted
--store as consuming a value token, so pnpm --store /tmp --prefix /proj --version can stop
scanning at /tmp and ignore --prefix. This can make pre_command_plan_for_version_flag load
config/pins from the wrong directory (default ".") and potentially skip package-manager
switching/checks for the intended project.
Code

pnpm/crates/cli/src/cli_args/cli_command.rs[R125-128]

    #[clap(
        long = "store-dir",
+        alias = "store",
        value_name = "DIR",
Relevance

●●● Strong

Matches prior accepted fixes for drift-prone argv width/value-consumption tables in
pre-scan/boundary logic; correctness-impacting.

PR-#13309

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR makes --store a value-taking global option via clap aliasing, but the --version scanner
only skips a small hard-coded set of value-taking globals; store/store-dir are not in that set,
so --store <DIR> leaves <DIR> to be treated as a positional command and terminates the scan
before later options (like --prefix) are processed.

pnpm/crates/cli/src/cli_args/cli_command.rs[120-134]
pnpm/crates/cli/src/cli_args/pre_command.rs[835-883]
pnpm/crates/cli/src/cli_args/pre_command.rs[997-1011]
pnpm/crates/cli/src/cli_args/pre_command/tests.rs[15-90]
PR-#13309

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`SwitchInput::from_version_argv` (used by `pre_command_plan_for_version_flag`) advances over unknown options using a hard-coded `value_taking_global_option()` list. This list does not include `--store` (added in this PR as an alias of `--store-dir`), so `--store <dir>` advances by 1 and the `<dir>` token is treated as a positional command, terminating the scan early and preventing later `--prefix/--dir` from being read.

## Issue Context
- The PR adds `--store` as a clap alias for `--store-dir`, and `--store` is a value-taking global option.
- The pre-clap passes derive arity from clap (including aliases), but the `--version` pre-scan does not; it uses a drift-prone manual list.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/pre_command.rs[835-881]
- pnpm/crates/cli/src/cli_args/pre_command.rs[997-1011]
- pnpm/crates/cli/src/cli_args/pre_command/tests.rs[15-90]

## Suggested fix
1. Teach the `--version` pre-scan to skip `--store` and `--store-dir` when they appear in the separate-token form (i.e., no `=`), so the following token is not mistaken for a command.
  - Minimal: add `store` and `store-dir` to `value_taking_global_option()`.
  - Preferred (to avoid future drift): derive value-taking arity from clap metadata similarly to `parse_boundary`/`flag_relocation` (e.g., build an `ArgTable::top_level(CliArgs::command())` and consult it).
2. Add regression tests in `pre_command/tests.rs` covering:
  - `pnpm --store /tmp/store --prefix /tmp/prefix --version` => `dir == /tmp/prefix`, `command == None`
  - (optional) same shape for `--store-dir /tmp/store` as well.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Historical RENAMED_OPTIONS comments ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
New inline comments explain the current Rust clap aliases by referring to pnpm11's old argv-rewrite
mechanism (RENAMED_OPTIONS), which is not the current implementation. This makes the code
misleading and violates the rule against historical-implementation commentary in source comments.
Code

pnpm/crates/cli/src/cli_args/cli_command.rs[R114-116]

+    // `--prefix` is npm's spelling of the same option; pnpm renames it to
+    // `--dir` before parsing (`RENAMED_OPTIONS` in `parseCliArgs.ts`) and
+    // keeps it out of the help output.
Relevance

●●● Strong

Team often rewrites/removes historical/provenance comments; prefers present-tense behavior-only
rationale in code comments.

PR-#13138
PR-#13417
PR-#13298

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist forbids comments that describe prior implementations instead of current behavior. The
added comments explicitly cite pnpm's prior RENAMED_OPTIONS rewrite table to explain behavior that
is now implemented via clap aliases in this file.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/cli/src/cli_args/cli_command.rs[114-117]
pnpm/crates/cli/src/cli_args/cli_command.rs[123-127]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Comments in `CliArgs` describe pnpm11's historical argv-rewrite (`RENAMED_OPTIONS`) rather than the current Rust implementation (clap `alias`), which can mislead future maintainers.

## Issue Context
This PR implements `--prefix`/`--store` support via clap aliases, not via an argv rewriting pass.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/cli_command.rs[114-128]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Previous review results

Review updated until commit 231e1da

Results up to commit 1f36d96 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Version scan misreads --store ✓ Resolved 🐞 Bug ≡ Correctness
Description
The --version pre-scan (SwitchInput::from_version_argv) does not treat the newly-accepted
--store as consuming a value token, so pnpm --store /tmp --prefix /proj --version can stop
scanning at /tmp and ignore --prefix. This can make pre_command_plan_for_version_flag load
config/pins from the wrong directory (default ".") and potentially skip package-manager
switching/checks for the intended project.
Code

pnpm/crates/cli/src/cli_args/cli_command.rs[R125-128]

    #[clap(
        long = "store-dir",
+        alias = "store",
        value_name = "DIR",
Relevance

●●● Strong

Matches prior accepted fixes for drift-prone argv width/value-consumption tables in
pre-scan/boundary logic; correctness-impacting.

PR-#13309

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR makes --store a value-taking global option via clap aliasing, but the --version scanner
only skips a small hard-coded set of value-taking globals; store/store-dir are not in that set,
so --store <DIR> leaves <DIR> to be treated as a positional command and terminates the scan
before later options (like --prefix) are processed.

pnpm/crates/cli/src/cli_args/cli_command.rs[120-134]
pnpm/crates/cli/src/cli_args/pre_command.rs[835-883]
pnpm/crates/cli/src/cli_args/pre_command.rs[997-1011]
pnpm/crates/cli/src/cli_args/pre_command/tests.rs[15-90]
PR-#13309

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`SwitchInput::from_version_argv` (used by `pre_command_plan_for_version_flag`) advances over unknown options using a hard-coded `value_taking_global_option()` list. This list does not include `--store` (added in this PR as an alias of `--store-dir`), so `--store <dir>` advances by 1 and the `<dir>` token is treated as a positional command, terminating the scan early and preventing later `--prefix/--dir` from being read.

## Issue Context
- The PR adds `--store` as a clap alias for `--store-dir`, and `--store` is a value-taking global option.
- The pre-clap passes derive arity from clap (including aliases), but the `--version` pre-scan does not; it uses a drift-prone manual list.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/pre_command.rs[835-881]
- pnpm/crates/cli/src/cli_args/pre_command.rs[997-1011]
- pnpm/crates/cli/src/cli_args/pre_command/tests.rs[15-90]

## Suggested fix
1. Teach the `--version` pre-scan to skip `--store` and `--store-dir` when they appear in the separate-token form (i.e., no `=`), so the following token is not mistaken for a command.
  - Minimal: add `store` and `store-dir` to `value_taking_global_option()`.
  - Preferred (to avoid future drift): derive value-taking arity from clap metadata similarly to `parse_boundary`/`flag_relocation` (e.g., build an `ArgTable::top_level(CliArgs::command())` and consult it).
2. Add regression tests in `pre_command/tests.rs` covering:
  - `pnpm --store /tmp/store --prefix /tmp/prefix --version` => `dir == /tmp/prefix`, `command == None`
  - (optional) same shape for `--store-dir /tmp/store` as well.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Historical RENAMED_OPTIONS comments ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
New inline comments explain the current Rust clap aliases by referring to pnpm11's old argv-rewrite
mechanism (RENAMED_OPTIONS), which is not the current implementation. This makes the code
misleading and violates the rule against historical-implementation commentary in source comments.
Code

pnpm/crates/cli/src/cli_args/cli_command.rs[R114-116]

+    // `--prefix` is npm's spelling of the same option; pnpm renames it to
+    // `--dir` before parsing (`RENAMED_OPTIONS` in `parseCliArgs.ts`) and
+    // keeps it out of the help output.
Relevance

●●● Strong

Team often rewrites/removes historical/provenance comments; prefers present-tense behavior-only
rationale in code comments.

PR-#13138
PR-#13417
PR-#13298

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist forbids comments that describe prior implementations instead of current behavior. The
added comments explicitly cite pnpm's prior RENAMED_OPTIONS rewrite table to explain behavior that
is now implemented via clap aliases in this file.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/cli/src/cli_args/cli_command.rs[114-117]
pnpm/crates/cli/src/cli_args/cli_command.rs[123-127]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Comments in `CliArgs` describe pnpm11's historical argv-rewrite (`RENAMED_OPTIONS`) rather than the current Rust implementation (clap `alias`), which can mislead future maintainers.

## Issue Context
This PR implements `--prefix`/`--store` support via clap aliases, not via an argv rewriting pass.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/cli_command.rs[114-128]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit 98c170b ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Extra passthrough scan added ✓ Resolved 🐞 Bug ➹ Performance
Description
renamed_options::drop_shadowed_aliases() calls parse_boundary::passthrough_from(), adding
another full passthrough-boundary scan to every CLI invocation. Since other pre-clap passes already
compute the passthrough boundary, this increases CLI startup overhead and also triggers another
CliArgs::command() build via parse_boundary::command_boundary().
Code

pnpm/crates/cli/src/renamed_options.rs[R40-44]

+pub fn drop_shadowed_aliases(cmd: &Command, argv: Vec<OsString>) -> Vec<OsString> {
+    let mut arity = ArgTable::top_level(cmd);
+    arity.absorb_subcommands(cmd);
+    let passthrough_from = parse_boundary::passthrough_from(&argv).unwrap_or(argv.len());
+
Relevance

●●● Strong

Extra passthrough_from() scan + CliArgs::command() rebuild matches prior accepted perf feedback
to de-duplicate boundary/clap work.

PR-#13309

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new renamed_options pass adds its own call to passthrough_from(). passthrough_from() uses
command_boundary(), which constructs a fresh clap tree (CliArgs::command()), so each additional
call increases startup work. Other existing passes already call passthrough_from() as well, so
this is an added per-invocation cost introduced by this PR.

pnpm/crates/cli/src/renamed_options.rs[40-49]
pnpm/crates/cli/src/shorthands.rs[28-38]
pnpm/crates/cli/src/config_overrides.rs[104-111]
pnpm/crates/cli/src/parse_boundary.rs[45-53]
pnpm/crates/cli/src/parse_boundary.rs[65-71]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The new `drop_shadowed_aliases()` pass computes `passthrough_from` by calling `parse_boundary::passthrough_from(&argv)`. Other pre-clap passes (e.g., shorthands expansion and config override extraction) already compute the same boundary, so this introduces an additional scan and an additional clap `CliArgs::command()` construction in `parse_boundary::command_boundary()`.

### Issue Context
This PR introduced a new argv pre-pass (`renamed_options`) and wired it into `run_cli()`. The new pass needs the passthrough boundary so it doesn’t mutate forwarded/script arguments.

### Fix Focus Areas
- pnpm/crates/cli/src/renamed_options.rs[40-49]
- pnpm/crates/cli/src/lib.rs[74-87]
- pnpm/crates/cli/src/parse_boundary.rs[45-90]

### Suggested fix
- Add an overload in `parse_boundary` that reuses an already-built clap `Command` (and/or an already-built `ArgTable`) to avoid rebuilding the command tree:
 - e.g. `passthrough_from_with_command(cmd: &Command, argv: &[OsString]) -> Option<usize>`
 - internally, build arity from `cmd` instead of calling `CliArgs::command()`.
- Update `renamed_options::drop_shadowed_aliases()` to call the new overload.
- (Optional follow-up) Consider computing and passing a single `passthrough_from` value through the pre-clap pipeline in `run_cli()` so multiple passes can share it, if signatures can be adjusted cleanly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Redundant clap build on --version ✓ Resolved 🐞 Bug ➹ Performance
Description
SwitchInput::from_version_argv() now builds a fresh clap Command (CliArgs::command()) just to
derive an ArgTable, adding extra CLI-grammar construction to the pnpm --version handling path.
This increases startup work in a commonly-invoked command even though run_cli() already built a
clap Command for parsing.
Code

pnpm/crates/cli/src/cli_args/pre_command.rs[837]

+        let global_options = ArgTable::top_level(&CliArgs::command());
Relevance

●●● Strong

Team previously accepted avoiding repeated CliArgs::command() builds in CLI boundary logic; same
startup-performance concern here.

PR-#13309

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new code builds a clap Command in from_version_argv(), and this function is used
specifically on the --version path. Meanwhile, run_cli() already constructs a clap Command for
parsing, so this additional construction is redundant work.

pnpm/crates/cli/src/cli_args/pre_command.rs[833-883]
pnpm/crates/cli/src/cli_args/pre_command.rs[70-91]
pnpm/crates/cli/src/lib.rs[71-102]
pnpm/crates/cli/src/parse_boundary.rs[65-71]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`SwitchInput::from_version_argv()` constructs a new clap `Command` via `CliArgs::command()` to compute `ArgTable` for `consumes_next_token()`. This duplicates work already done in `run_cli()` (which builds the full clap tree) and adds avoidable startup overhead to the `--version` path.

### Issue Context
- The `--version` flow already has an in-scope `command` built in `run_cli()`.
- The new scan only needs the top-level/global option arity table.

### Fix Focus Areas
- pnpm/crates/cli/src/cli_args/pre_command.rs[833-885]
- pnpm/crates/cli/src/lib.rs[70-105]

### Suggested fix
- Thread the already-built `Command` (or a precomputed `ArgTable`) into `pre_command_plan_for_version_flag()` / `SwitchInput::from_version_argv()`.
 - Example approach: change `from_version_argv(argv: &[OsString])` to `from_version_argv(argv: &[OsString], global_options: &ArgTable)`.
 - Build `let global_options = ArgTable::top_level(&command);` once in `run_cli()` right before calling `pre_command_plan_for_version_flag()` and pass it through.
- This preserves the clap-derived arity behavior while eliminating an extra clap tree build.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
pnpm/crates/cli/tests/run.rs (1)

588-596: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Test the script-argument boundary.

The invocation stops at test. It proves that --prefix works before run, but it does not prove that an option after the script name remains script input. The test documentation states this boundary.

Pass a sentinel option after test, make the fixture record its received arguments, and assert that the sentinel is preserved.

As per path instructions, regression tests must cover the documented pre-subcommand/script-name scope.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/cli/tests/run.rs` around lines 588 - 596, Update the test
invocation around pacquet to append a sentinel option after the script name
test, and modify the fixture’s marker recording to capture the received
arguments. Assert that the marker contains the sentinel, proving arguments after
the script name remain script input while retaining the existing --prefix
coverage.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm/crates/cli/src/cli_args/cli_command.rs`:
- Around line 123-127: Update SwitchInput::from_version_argv to recognize both
store-dir and its store alias, consuming their values in separated and equals
forms so the value is not treated as the command; add regression cases covering
--store /tmp/store and --store=/tmp/store.

---

Nitpick comments:
In `@pnpm/crates/cli/tests/run.rs`:
- Around line 588-596: Update the test invocation around pacquet to append a
sentinel option after the script name test, and modify the fixture’s marker
recording to capture the received arguments. Assert that the marker contains the
sentinel, proving arguments after the script name remain script input while
retaining the existing --prefix coverage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 79d5f2d0-d93e-4ed3-b389-eb5d12dc4aab

📥 Commits

Reviewing files that changed from the base of the PR and between 2d30dd6 and 1f36d96.

📒 Files selected for processing (6)
  • .changeset/prefix-alias-of-dir.md
  • pnpm/crates/cli/src/cli_args/cli_command.rs
  • pnpm/crates/cli/src/cli_args/pre_command.rs
  • pnpm/crates/cli/src/cli_args/pre_command/tests.rs
  • pnpm/crates/cli/src/cli_args/tests.rs
  • pnpm/crates/cli/tests/run.rs

@codecov-commenter

codecov-commenter commented Aug 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.99%. Comparing base (2d30dd6) to head (231e1da).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/cli/src/renamed_options.rs 96.77% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13592   +/-   ##
=======================================
  Coverage   87.98%   87.99%           
=======================================
  Files         565      567    +2     
  Lines       97856    97928   +72     
=======================================
+ Hits        86101    86172   +71     
- Misses      11755    11756    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

pnpm drops the alias when a command line spells the same option both
ways, so `--prefix foo --dir bar` and `--dir bar --prefix foo` both
resolve to `bar`. Clap keeps the last occurrence instead, which would
have made pacquet pick a different directory (or a different store) for
the same command line.

`renamed_options` removes the shadowed alias tokens ahead of the parse,
alongside the other pre-clap passes and using the same clap-derived
arity tables, so an alias value that spells a subcommand is never
mistaken for one and a script's own `--prefix` is left alone.

The `--version` pre-scan now reads option arity from the clap grammar
instead of a hand-maintained list of value-taking options. The list did
not know about `--store-dir`, so `pnpm --store-dir /s --version` took
`/s` for the command name and stopped scanning; deriving the arity keeps
every current and future global (and alias) in step.

Reviewed-by: greptile-apps[bot]
Reviewed-by: qodo-code-review[bot]
Reviewed-by: coderabbitai[bot]
Copilot AI review requested due to automatic review settings August 2, 2026 15:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zkochan

zkochan commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

Both Qodo findings are addressed in 98c170b:

Historical RENAMED_OPTIONS comments — removed from cli_command.rs; the clap attributes stand on their own now. The rationale worth keeping (which npm spellings are accepted, why they're hidden, and the canonical-wins precedence rule) lives once in the module docs of the new renamed_options.rs, where the behavior is implemented.

Version scan misreads --store — fixed in the "preferred" form: SwitchInput::from_version_argv now reads option arity from the clap grammar (ArgTable::top_level(&CliArgs::command())) instead of the hand-maintained value_taking_global_option list, so every global and alias is accounted for without a second edit. Note the same bug already existed for the canonical --store-dir, which the list never covered; both shapes now have regression cases in version_argv_reads_dir_auth_file_and_command_forms.

Greptile separately caught that clap's alias keeps the last occurrence where pnpm's rename loop always keeps the canonical spelling; the new renamed_options pre-parse pass drops shadowed alias tokens so --store-dir=/a --store=/b resolves to /a in either order.


Written by an agent (Claude Code, claude-opus-5[1m]).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
pnpm/crates/cli/src/renamed_options/tests.rs (1)

18-18: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the redundant helper comment.

This comment only restates parse. Keep comments for test rationale or parsing invariants.

As per coding guidelines, Rust comments must explain non-obvious invariants, workarounds, deliberate exceptions, or contracts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/cli/src/renamed_options/tests.rs` at line 18, Remove the
redundant “Run the full pre-parse pipeline and parse” comment in the test code,
leaving the surrounding parse logic unchanged. Retain only comments that
document non-obvious test rationale, parsing invariants, workarounds, deliberate
exceptions, or contracts.

Sources: Coding guidelines, Path instructions, Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm/crates/cli/src/renamed_options.rs`:
- Around line 72-80: Update the short-option remainder handling in the loop over
RENAMED_OPTIONS so it scans each short flag from left to right instead of using
rest.contains(canonical), marking canonical matches only for actual short
options. Stop scanning once the current short option consumes the attached
remainder, while preserving token_width advancement and canonical_seen updates.

---

Nitpick comments:
In `@pnpm/crates/cli/src/renamed_options/tests.rs`:
- Line 18: Remove the redundant “Run the full pre-parse pipeline and parse”
comment in the test code, leaving the surrounding parse logic unchanged. Retain
only comments that document non-obvious test rationale, parsing invariants,
workarounds, deliberate exceptions, or contracts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cf0035e0-d84c-4e2a-b5fc-e669475576e4

📥 Commits

Reviewing files that changed from the base of the PR and between 1f36d96 and 98c170b.

📒 Files selected for processing (7)
  • pnpm/crates/cli/src/cli_args/cli_command.rs
  • pnpm/crates/cli/src/cli_args/pre_command.rs
  • pnpm/crates/cli/src/cli_args/pre_command/tests.rs
  • pnpm/crates/cli/src/lib.rs
  • pnpm/crates/cli/src/renamed_options.rs
  • pnpm/crates/cli/src/renamed_options/tests.rs
  • pnpm/crates/cli/tests/run.rs
💤 Files with no reviewable changes (1)
  • pnpm/crates/cli/src/cli_args/cli_command.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • pnpm/crates/cli/tests/run.rs
  • pnpm/crates/cli/src/cli_args/pre_command/tests.rs

Comment thread pnpm/crates/cli/src/renamed_options.rs Resolved
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 98c170b

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

The shadowed-alias scan looked for the canonical short anywhere in a
short-option cluster, so `-FpkgC --prefix here` read the `C` ending a
`--filter` pattern as a `--dir` and dropped the `--prefix`. The cluster
is now read left to right and stops at the first option that takes a
value, since everything past it is that value.

The clap grammar is also built once per process instead of per caller.
Constructing it walks every subcommand, and the passes that run before
the parse each need the same view of it — the boundary scan built one on
every call, and the `--version` pre-scan added another.

Reviewed-by: coderabbitai[bot]
Reviewed-by: qodo-code-review[bot]
Copilot AI review requested due to automatic review settings August 2, 2026 15:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zkochan

zkochan commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

Both new Qodo findings are addressed in e6b825d.

Redundant clap build on --version and extra passthrough scan share a root cause: CliArgs::command() was being rebuilt per caller. There is now a single process-wide cli_args::grammar() (a OnceLock), used by parse_boundary::command_boundary and by the --version pre-scan. Net effect is fewer grammar builds than before this PR: command_boundary previously built one on every call, and it is called from ConfigOverrides::extract, the shorthand expansion, and now the alias pass — all three now share one build.


Written by an agent (Claude Code, claude-opus-5[1m]).

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 2, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit e6b825d

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

A cluster ending in a value-taking short takes the next argv token as
its value, but the shadowed-alias scan advanced by the first short's
arity alone. `pnpm -rC --prefix install` therefore re-read `--prefix` —
the directory `-C` was given — as an option of pnpm's own, and dropped
it along with the token behind it because the same cluster had already
marked `-C` as present.

Reading the cluster and its width in one pass keeps the two in step:
scanning stops at the first short that takes a value, which is also what
decides whether that value is attached or the next token.

Reviewed-by: qodo-code-review[bot]
Copilot AI review requested due to automatic review settings August 2, 2026 15:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zkochan

zkochan commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

Fixed in 231e1da — this one was a real corruption path in the new pass, thanks.

pnpm -rC --prefix install (a directory literally spelled --prefix) advanced by the first short's arity, so the value token was re-read as one of pnpm's own options; since the same cluster had already marked -C as present, it was then dropped together with the token behind it. scan_short_cluster now derives both the canonical-short marks and the token width from one left-to-right pass — scanning stops at the first short that takes a value, which is also what decides whether that value is attached or the next token.

Regression test: a_cluster_s_separate_value_is_not_read_as_an_option. I verified it fails against the previous width logic before keeping it.


Written by an agent (Claude Code, claude-opus-5[1m]).

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 231e1da

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 231e1da84d39

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.571 ± 0.176 2.351 2.801 1.73 ± 0.17
pacquet@main 2.449 ± 0.132 2.333 2.690 1.65 ± 0.15
pnpr@HEAD 1.527 ± 0.131 1.376 1.766 1.03 ± 0.11
pnpr@main 1.484 ± 0.103 1.357 1.697 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.57073440888,
      "stddev": 0.17596416511457208,
      "median": 2.64374003908,
      "user": 1.67108712,
      "system": 1.2690629000000002,
      "min": 2.35131844058,
      "max": 2.8009170505800003,
      "times": [
        2.35131844058,
        2.64201080858,
        2.8009170505800003,
        2.36632070358,
        2.40422599758,
        2.69505577558,
        2.71080081458,
        2.72029922358,
        2.3709260045800002,
        2.64546926958
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.44927477158,
      "stddev": 0.1317801999195643,
      "median": 2.39804993958,
      "user": 1.67673052,
      "system": 1.2641342999999998,
      "min": 2.33312142658,
      "max": 2.6895192265800003,
      "times": [
        2.59148422358,
        2.37982392158,
        2.35125108258,
        2.41627595758,
        2.61417760358,
        2.6895192265800003,
        2.33312142658,
        2.35642010158,
        2.42517532458,
        2.3354988475800003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5273449483800001,
      "stddev": 0.13055394530170172,
      "median": 1.5312156940800001,
      "user": 1.14299902,
      "system": 1.1697605999999998,
      "min": 1.3762075495800001,
      "max": 1.7663351875800002,
      "times": [
        1.39629854958,
        1.7663351875800002,
        1.64141499758,
        1.5451187535800002,
        1.56460439058,
        1.64245942858,
        1.51731263458,
        1.43941905358,
        1.3762075495800001,
        1.38427893858
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.4840088338800002,
      "stddev": 0.10338257406543314,
      "median": 1.4769604695800003,
      "user": 1.1960625200000001,
      "system": 1.1569753999999999,
      "min": 1.3574523785800001,
      "max": 1.6971954885800002,
      "times": [
        1.5720741775800002,
        1.3650128185800001,
        1.3574523785800001,
        1.46583647458,
        1.39228376358,
        1.6971954885800002,
        1.54659968558,
        1.47398245058,
        1.4799384885800002,
        1.48971261258
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 259.0 ± 9.0 244.6 273.2 1.02 ± 0.04
pacquet@main 253.6 ± 4.3 245.7 260.0 1.00
pnpr@HEAD 271.2 ± 3.3 267.2 278.9 1.07 ± 0.02
pnpr@main 271.5 ± 4.3 264.0 278.5 1.07 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25896955158,
      "stddev": 0.0089719234091528,
      "median": 0.25754717988,
      "user": 0.20872570000000001,
      "system": 0.5056565799999999,
      "min": 0.24459737188000003,
      "max": 0.27315940488,
      "times": [
        0.25909861988,
        0.24459737188000003,
        0.25694053988,
        0.25526155088,
        0.27315940488,
        0.27212270888,
        0.25124488188,
        0.25815381988,
        0.25387369688,
        0.26524292088
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.25364297078,
      "stddev": 0.004258743051832836,
      "median": 0.25471061988,
      "user": 0.20259690000000002,
      "system": 0.51549768,
      "min": 0.24565460588000002,
      "max": 0.25996676288,
      "times": [
        0.25996676288,
        0.25168763288,
        0.25565623388,
        0.25470340788,
        0.24565460588000002,
        0.25176916588,
        0.24860473888000004,
        0.25471783188,
        0.25687035788,
        0.25679896988
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27116302098,
      "stddev": 0.0032611163466777695,
      "median": 0.27105740938,
      "user": 0.2092845,
      "system": 0.5019930799999999,
      "min": 0.26723074988,
      "max": 0.27885965688,
      "times": [
        0.27119905488,
        0.27290099888,
        0.27231999188,
        0.26927352288,
        0.26723074988,
        0.27885965688,
        0.26905264188,
        0.27091576388,
        0.26826999288,
        0.27160783588
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.27154572498,
      "stddev": 0.0043016152773255045,
      "median": 0.27194315138,
      "user": 0.21571379999999998,
      "system": 0.5172941799999999,
      "min": 0.26400669388,
      "max": 0.27853785888,
      "times": [
        0.26988506188,
        0.27495341088,
        0.27178941088,
        0.26978744788,
        0.26400669388,
        0.26638874088,
        0.27209689188,
        0.27546945988,
        0.27254227288,
        0.27853785888
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.593 ± 0.011 2.573 2.608 1.64 ± 0.16
pacquet@main 2.580 ± 0.014 2.560 2.615 1.64 ± 0.16
pnpr@HEAD 1.679 ± 0.170 1.423 1.870 1.06 ± 0.15
pnpr@main 1.577 ± 0.155 1.436 1.869 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5930165093000004,
      "stddev": 0.011248436929368425,
      "median": 2.5938156937,
      "user": 1.6247072799999998,
      "system": 1.3425767199999998,
      "min": 2.5734454112000003,
      "max": 2.6081933282,
      "times": [
        2.5882265402,
        2.5971425592,
        2.5904888282000003,
        2.5984959292,
        2.6046752112,
        2.5881246552,
        2.5734454112000003,
        2.6024822002,
        2.6081933282,
        2.5788904302
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5801774504000003,
      "stddev": 0.014113535471841151,
      "median": 2.5795406277,
      "user": 1.6108070799999996,
      "system": 1.3117958199999997,
      "min": 2.5603728042,
      "max": 2.6152936321999998,
      "times": [
        2.5806133762,
        2.5716356262,
        2.5767688912,
        2.5727399272,
        2.5799600772,
        2.5853089142,
        2.5603728042,
        2.6152936321999998,
        2.5793423362,
        2.5797389192
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6792100876000002,
      "stddev": 0.170014223171539,
      "median": 1.7087337047,
      "user": 1.16899368,
      "system": 1.15672432,
      "min": 1.4225428012,
      "max": 1.8702297282,
      "times": [
        1.6287965222,
        1.8607911652000002,
        1.7786693122,
        1.5135660172,
        1.8392977122,
        1.4606596872,
        1.6387980972,
        1.7787498332,
        1.4225428012,
        1.8702297282
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5771359622,
      "stddev": 0.15535779156511972,
      "median": 1.4958623437,
      "user": 1.1798832799999999,
      "system": 1.1587777199999998,
      "min": 1.4364947262,
      "max": 1.8686396882,
      "times": [
        1.6323854822000001,
        1.4609389762,
        1.5094031622,
        1.4364947262,
        1.8000035822,
        1.6562596052,
        1.4823215252000002,
        1.8686396882,
        1.4697000052,
        1.4552128692
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 388.9 ± 5.2 381.3 396.9 1.29 ± 0.03
pacquet@main 383.5 ± 9.3 370.3 401.1 1.27 ± 0.04
pnpr@HEAD 302.4 ± 5.9 295.1 315.1 1.00
pnpr@main 303.8 ± 5.9 295.2 314.4 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.38887103252,
      "stddev": 0.0051557830873997365,
      "median": 0.38878631602,
      "user": 0.48348815999999994,
      "system": 0.72206144,
      "min": 0.38125299702000004,
      "max": 0.39692442102000003,
      "times": [
        0.38323078902,
        0.39191163402,
        0.38458609102,
        0.38613426902000003,
        0.39692442102000003,
        0.39269305002000005,
        0.39023517202,
        0.39440444202,
        0.38733746002,
        0.38125299702000004
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.38345144721999996,
      "stddev": 0.009255246004942564,
      "median": 0.38222555502,
      "user": 0.50606706,
      "system": 0.6792683399999999,
      "min": 0.37027950302,
      "max": 0.40109319302,
      "times": [
        0.38288450302000004,
        0.37610320202,
        0.38098306602000004,
        0.38156660702,
        0.39148951002000004,
        0.38315464602000004,
        0.39235539702,
        0.40109319302,
        0.37027950302,
        0.37460484502
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30239576432000004,
      "stddev": 0.005862983207580573,
      "median": 0.30151080252,
      "user": 0.18685535999999997,
      "system": 0.51923444,
      "min": 0.29505042702,
      "max": 0.31509113602,
      "times": [
        0.29736976302,
        0.30952869902,
        0.30230622102000004,
        0.30246503302,
        0.29941989702,
        0.29505042702,
        0.30104745202,
        0.31509113602,
        0.30197415302,
        0.29970486202
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30376320612,
      "stddev": 0.005902363028888327,
      "median": 0.30294960352,
      "user": 0.17633376,
      "system": 0.52946884,
      "min": 0.29520364502,
      "max": 0.31440547502,
      "times": [
        0.31228786502,
        0.30513102302,
        0.30336328102000004,
        0.29520364502,
        0.30479847102,
        0.31440547502,
        0.30036457302,
        0.30253592602,
        0.30154722602,
        0.29799457602
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.729 ± 0.009 1.715 1.747 5.76 ± 0.12
pacquet@main 1.724 ± 0.011 1.713 1.751 5.75 ± 0.12
pnpr@HEAD 0.304 ± 0.007 0.294 0.317 1.01 ± 0.03
pnpr@main 0.300 ± 0.006 0.290 0.315 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.72894398168,
      "stddev": 0.009054450387202744,
      "median": 1.72838794958,
      "user": 0.72377604,
      "system": 0.7665513400000001,
      "min": 1.71514090958,
      "max": 1.7473552585800003,
      "times": [
        1.7377111115800001,
        1.7302981155800001,
        1.72633465958,
        1.72659695258,
        1.7473552585800003,
        1.73225713858,
        1.7301789465800002,
        1.72285183858,
        1.71514090958,
        1.72071488558
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.7243995858800005,
      "stddev": 0.0113341722774165,
      "median": 1.7205018090800002,
      "user": 0.71786344,
      "system": 0.7605454399999999,
      "min": 1.7133979325800002,
      "max": 1.7508286055800002,
      "times": [
        1.7133979325800002,
        1.7221287485800003,
        1.7508286055800002,
        1.7153037095800001,
        1.71697569458,
        1.71887486958,
        1.7267371325800003,
        1.7259826455800003,
        1.71843323358,
        1.7353332865800002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30403604738,
      "stddev": 0.006891507853313263,
      "median": 0.30207330108,
      "user": 0.19347354,
      "system": 0.49967054,
      "min": 0.29358772458,
      "max": 0.31721152558,
      "times": [
        0.31721152558,
        0.30010983258,
        0.29358772458,
        0.30599795058,
        0.30263111258000003,
        0.30117000858000004,
        0.30719988558,
        0.30151548958,
        0.29858529558,
        0.31235164858000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.29996113658,
      "stddev": 0.006133917538774111,
      "median": 0.29942760608,
      "user": 0.17797754,
      "system": 0.51964424,
      "min": 0.29042111758,
      "max": 0.31471857758,
      "times": [
        0.29671334758,
        0.30074016658,
        0.29735922858,
        0.30037022958000004,
        0.30236828458000004,
        0.29806458358,
        0.31471857758,
        0.29848498258,
        0.30037084758,
        0.29042111758
      ]
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 179.3 ± 3.8 172.6 187.2 2.01 ± 0.10
pacquet@main 180.7 ± 3.4 176.5 187.4 2.02 ± 0.10
pnpr@HEAD 89.3 ± 4.0 84.8 104.5 1.00
pnpr@main 91.1 ± 4.0 85.7 102.2 1.02 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.179274878295,
      "stddev": 0.003840516136995144,
      "median": 0.17872934992,
      "user": 0.16175691,
      "system": 0.0850158,
      "min": 0.17256159992000003,
      "max": 0.18715514992,
      "times": [
        0.18022620592000002,
        0.17513504992000004,
        0.17881607992,
        0.17800425992000002,
        0.18715514992,
        0.17730010192000004,
        0.17951916692000003,
        0.17604420192000003,
        0.17556858892000002,
        0.17256159992000003,
        0.17864261992000002,
        0.18197476792000003,
        0.18276248492000002,
        0.18061845192000003,
        0.17821466892,
        0.18585465392000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.18073361498250004,
      "stddev": 0.0034363800614267814,
      "median": 0.18029686542,
      "user": 0.15735416000000002,
      "system": 0.08912411249999998,
      "min": 0.17650206792000003,
      "max": 0.18740297892000002,
      "times": [
        0.18127790692,
        0.18740297892000002,
        0.17743497892,
        0.17814912492,
        0.18014885492000002,
        0.17736340192000002,
        0.17659556192000003,
        0.18044487592000003,
        0.18361748692000002,
        0.18423580992000002,
        0.18078983392000003,
        0.18705418192000003,
        0.17875384992,
        0.17967940992000003,
        0.18228751492000003,
        0.17650206792000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08932652092000001,
      "stddev": 0.003990170048296196,
      "median": 0.08851366742,
      "user": 0.020800597499999997,
      "system": 0.011855759375,
      "min": 0.08475342392,
      "max": 0.10454050092,
      "times": [
        0.08855886192000001,
        0.08846847292,
        0.08882993192000001,
        0.09223412892,
        0.08639298392,
        0.08592395092,
        0.08604914392,
        0.09396009092,
        0.08958489292,
        0.08518123892,
        0.08688816792000001,
        0.09047090392,
        0.08642638492,
        0.08643065892,
        0.08521835092,
        0.08938797992,
        0.10454050092,
        0.09714377692000001,
        0.08813417692,
        0.08680950392,
        0.09151146092000001,
        0.09161806092000001,
        0.09291885792,
        0.09036169292,
        0.09073554692000001,
        0.08711521192,
        0.08669921192,
        0.08475342392,
        0.08834378992,
        0.09033638892,
        0.08634482992,
        0.09107609092
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.09106593402,
      "stddev": 0.003999457975236812,
      "median": 0.09091302542,
      "user": 0.02137969333333334,
      "system": 0.0125506,
      "min": 0.08569942492,
      "max": 0.10220826092,
      "times": [
        0.09486342492000001,
        0.08795525892,
        0.08643898892,
        0.09159870792000001,
        0.09739741592000001,
        0.08962862392,
        0.09303573892,
        0.09431460092,
        0.09080970392,
        0.09138524792000001,
        0.09489801892000001,
        0.08718525492,
        0.08612158192000001,
        0.08699737592000001,
        0.08662582192,
        0.09091059692,
        0.09091545392,
        0.10220826092,
        0.09072840192,
        0.08584757392,
        0.09229114192,
        0.09891186492000001,
        0.08850951992,
        0.08569942492,
        0.09151997092,
        0.09159492292,
        0.09022230292,
        0.09169295792,
        0.09393614592,
        0.08773371492
      ]
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 844.7 ± 166.5 540.9 1088.2 1.00
pacquet@main 941.2 ± 101.8 785.0 1068.7 1.11 ± 0.25
pnpm@HEAD 2903.9 ± 44.4 2850.8 2991.3 3.44 ± 0.68
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.8446508549266667,
      "stddev": 0.1665477328335081,
      "median": 0.8119520402600001,
      "user": 0.7961549066666667,
      "system": 0.20119455555555557,
      "min": 0.54091184426,
      "max": 1.08815084226,
      "times": [
        1.03646351926,
        0.9621780972600001,
        1.08815084226,
        0.8119520402600001,
        0.75787588526,
        0.54091184426,
        0.8518292002600001,
        0.8057633482600001,
        0.7467329172600001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.9411606917044444,
      "stddev": 0.10177115453790261,
      "median": 0.94791513126,
      "user": 0.8948727955555557,
      "system": 0.22230911111111112,
      "min": 0.7850255502600001,
      "max": 1.0687495412599999,
      "times": [
        0.8659716432600001,
        0.9849031172600001,
        0.94791513126,
        0.7850255502600001,
        1.0687495412599999,
        0.8952634512600001,
        1.02898487026,
        1.0579600892599998,
        0.8356728312600001
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 2.903866282593333,
      "stddev": 0.044383277045899144,
      "median": 2.89334057526,
      "user": 4.1370116844444444,
      "system": 0.2994805555555556,
      "min": 2.8508316532599998,
      "max": 2.99128405326,
      "times": [
        2.90528970026,
        2.8715501092599998,
        2.89334057526,
        2.87420521126,
        2.88085355226,
        2.8508316532599998,
        2.95557670626,
        2.91186498226,
        2.99128405326
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.521 ± 0.129 4.414 4.754 1.28 ± 0.06
pacquet@main 4.541 ± 0.142 4.430 4.813 1.28 ± 0.06
pnpr@HEAD 3.539 ± 0.123 3.449 3.805 1.00
pnpr@main 3.540 ± 0.098 3.444 3.758 1.00 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.5211441101,
      "stddev": 0.12936285139787024,
      "median": 4.455623559999999,
      "user": 1.7493863600000001,
      "system": 1.4559019999999998,
      "min": 4.4144707245,
      "max": 4.7537213235,
      "times": [
        4.4433547865,
        4.4678923335,
        4.4214428425,
        4.7238230565,
        4.5649074275,
        4.7537213235,
        4.5792557355,
        4.4144707245,
        4.4211712265,
        4.4214016445
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.541229689500001,
      "stddev": 0.14242216823027185,
      "median": 4.4643051685,
      "user": 1.77194526,
      "system": 1.3973359999999997,
      "min": 4.4301349225,
      "max": 4.8134626815,
      "times": [
        4.7431452535,
        4.8134626815,
        4.4420120665,
        4.4332619145,
        4.4865982705,
        4.4399694045,
        4.4301349225,
        4.4304046685,
        4.5637247995,
        4.6295829135
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5390479184999997,
      "stddev": 0.12318494133101252,
      "median": 3.4640167775,
      "user": 1.3051593599999998,
      "system": 1.2063921,
      "min": 3.4489019385,
      "max": 3.8050037315000003,
      "times": [
        3.4593321405,
        3.4489019385,
        3.5775944385000003,
        3.5853564225,
        3.4529458185,
        3.4514049105,
        3.4572832465,
        3.6839551235,
        3.4687014145,
        3.8050037315000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.540216634,
      "stddev": 0.09827778465194306,
      "median": 3.5035956995,
      "user": 1.3042954599999999,
      "system": 1.2088891999999998,
      "min": 3.4442213285,
      "max": 3.7575041385,
      "times": [
        3.7575041385,
        3.4962445475,
        3.4442213285,
        3.4610978085,
        3.5311034665,
        3.5109468515,
        3.6154134395,
        3.4713481594999998,
        3.6292341974999998,
        3.4850524025
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13592
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,573.45 ms
(-0.44%)Baseline: 2,584.86 ms
3,101.83 ms
(82.97%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,715.14 ms
(-1.00%)Baseline: 1,732.46 ms
2,078.95 ms
(82.50%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
381.25 ms
(-3.57%)Baseline: 395.39 ms
474.46 ms
(80.35%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
172.56 ms
(-4.92%)Baseline: 181.49 ms
217.79 ms
(79.23%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,351.32 ms
(-1.02%)Baseline: 2,375.48 ms
2,850.57 ms
(82.49%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,414.47 ms
(-0.67%)Baseline: 4,444.10 ms
5,332.92 ms
(82.78%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
244.60 ms
(-1.77%)Baseline: 249.00 ms
298.80 ms
(81.86%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
540.91 ms
(-41.04%)Baseline: 917.36 ms
1,100.83 ms
(49.14%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13592
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,422.54 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
293.59 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
295.05 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
84.75 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,376.21 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,448.90 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
267.23 ms
🐰 View full continuous benchmarking report in Bencher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm 12 beta 3 issue found: --prefix is not known

3 participants