Skip to content

fix(cli): support top-level command fallback - #12810

Merged
zkochan merged 4 commits into
mainfrom
fix-pnpm-exec
Jul 5, 2026
Merged

zkochan merged 4 commits into
mainfrom
fix-pnpm-exec

Conversation

@zkochan

@zkochan zkochan commented Jul 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Pacquet now matches the TypeScript pnpm shorthand for unknown top-level commands. pnpm <name> first tries a matching package script, and when no script exists it executes <name> from node_modules/.bin through the existing exec path.

This fixes hooks such as pnpm commitlint --edit --config=commitlint.config.cjs when the repository uses the Rust pnpm binary.

Squash Commit Body

Pacquet did not implement pnpm's top-level fallback command behavior. The TypeScript CLI parses an unknown top-level token as `run`, then falls through to `exec` when no matching script exists. That lets commands like `pnpm commitlint --edit ...` resolve local bins from `node_modules/.bin`.

Add an external clap subcommand for pacquet, route it through the existing run dispatcher, and fall through to the existing exec implementation only when no script matches. Scripts still take precedence over local bins, matching pnpm.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust pacquet/ port, or the description notes what still needs porting.
  • Added or updated tests.

Written by an agent (Codex, GPT-5).

Summary by CodeRabbit

  • New Features
    • Unknown top-level commands are now accepted and passed through as external commands.
    • Invoking pacquet <name> now prefers a matching package.json script when present, otherwise falls back to executing the local binary.
    • In recursive mode, this fallback behavior is applied across workspace projects.
  • Bug Fixes
    • --config.* and other global options are no longer incorrectly consumed when an external command begins.
    • Fallback forwarding preserves positional and dotted config-style arguments more reliably.
  • Tests
    • Added unit tests and Unix-only integration coverage for parsing, fallback resolution, recursive behavior, and argument forwarding.

Copilot AI review requested due to automatic review settings July 5, 2026 00:07

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 Jul 5, 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: 261a0659-08e8-4636-a776-80ca319444af

📥 Commits

Reviewing files that changed from the base of the PR and between 5650aaf and e7c9ba1.

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

📝 Walkthrough

Walkthrough

Adds external subcommand capture, routes it through fallback dispatch, extends RunArgs with exec-style fallback behavior, updates config override parsing around external commands, and adds parsing plus integration tests for direct and recursive top-level fallback.

Changes

External command fallback execution

Layer / File(s) Summary
External subcommand variant and dispatch wiring
pacquet/crates/cli/src/cli_args/cli_command.rs, pacquet/crates/cli/src/cli_args/dispatch.rs
Adds CliCommand::External(Vec<String>) as a clap external subcommand and routes it to dispatch_script::fallback.
Fallback dispatcher constructing RunArgs
pacquet/crates/cli/src/cli_args/dispatch_script.rs
Adds fallback, which maps the external command vector into RunArgs and dispatches through recursive or non-recursive run paths.
RunArgs exec fallback path
pacquet/crates/cli/src/cli_args/run.rs
Refactors run into a shared helper, adds run_fallback, and switches missing-script handling to ExecArgs when fallback mode is enabled.
Config override boundary detection
pacquet/crates/cli/src/config_overrides.rs
Stops consuming --config.* tokens after the detected external command boundary and adds helpers for detecting command and option boundaries.
Tests for external command parsing and fallback execution
pacquet/crates/cli/src/cli_args/tests.rs, pacquet/crates/cli/src/config_overrides/tests.rs, pacquet/crates/cli/tests/run.rs, pacquet/crates/cli/tests/run_recursive.rs
Adds unit tests for external-command parsing and config override handling, plus integration tests covering script precedence, binary fallback, argument forwarding, and recursive execution across workspace projects.

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

Possibly related PRs

  • pnpm/pnpm#11806: Both PRs modify pacquet/crates/cli/src/config_overrides.rs around parsing and consuming --config.<key>=<value> argv tokens.
  • pnpm/pnpm#12093: Shares the RunArgs/recursive-run execution path that the new fallback-to-exec behavior now uses.

Suggested labels: product: pacquet

✨ 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-pnpm-exec

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-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

CLI: support pnpm-style top-level fallback to exec for unknown commands

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Parse unknown top-level tokens as an external command, preserving global options.
• Try running a matching package.json script first; fall back to exec when missing.
• Add parsing and integration tests covering script precedence and node_modules/.bin execution.
Diagram

graph TD
  A["CLI args"] --> B["clap parser"] --> C["CliCommand::External"] --> D["dispatch_script::fallback"] --> E["RunArgs::run_fallback"] --> F{"script exists?"}
  F -->|"yes"| G["run script"]
  F -->|"no"| H["ExecArgs::run (.bin PATH)"]
  subgraph Legend
    direction LR
    _flow["Handler step"] ~~~ _dec{"Decision"}
  end
Loading
High-Level Assessment

Using clap’s external_subcommand is the most direct way to capture unknown top-level commands while still letting global options parse normally. The chosen approach cleanly reuses the existing run and exec implementations and enforces pnpm’s precedence rules (scripts before local bins) without duplicating exec PATH logic. A manual argv pre-parse would offer more control but would be more error-prone and harder to keep consistent with clap parsing behavior.

Files changed (6) +133 / -0

Bug fix (4) +49 / -0
cli_command.rsCapture unknown top-level commands via clap external subcommand +2/-0

Capture unknown top-level commands via clap external subcommand

• Adds an 'External(Vec<String>)' variant to 'CliCommand' annotated with '#[clap(external_subcommand)]', allowing unknown top-level tokens to be parsed instead of rejected.

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

dispatch.rsRoute External commands through script fallback dispatcher +1/-0

Route External commands through script fallback dispatcher

• Wires 'CliCommand::External' into the main command router, sending it to 'dispatch_script::fallback' so external tokens follow run→exec fallback semantics.

pacquet/crates/cli/src/cli_args/dispatch.rs

dispatch_script.rsImplement top-level fallback handler (run, then exec) +21/-0

Implement top-level fallback handler (run, then exec)

• Introduces 'fallback()' which converts raw external tokens into 'RunArgs' and runs them. For non-recursive mode it uses 'RunArgs::run_fallback' to enable exec fallback when no script matches.

pacquet/crates/cli/src/cli_args/dispatch_script.rs

run.rsAdd 'run_fallback' and exec fallback when script is missing +25/-0

Add 'run_fallback' and exec fallback when script is missing

• Refactors script execution into 'run_inner(...)' and adds 'run_fallback(...)' to enable fallback behavior. When no script matches and fallback is enabled, constructs 'ExecArgs' and executes the command via the existing exec path (preserving script precedence).

pacquet/crates/cli/src/cli_args/run.rs

Tests (2) +84 / -0
tests.rsAdd CLI parsing tests for External command capture +26/-0

Add CLI parsing tests for External command capture

• Adds unit tests verifying that an unknown top-level command parses as 'CliCommand::External' and that global flags (e.g. '--dir') are preserved while capturing the external command tokens.

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

run.rsAdd integration tests for script-vs-bin precedence and fallback exec +58/-0

Add integration tests for script-vs-bin precedence and fallback exec

• Adds unix-only integration tests ensuring 'pacquet <cmd>' runs a same-named package script before a local bin, and falls back to executing 'node_modules/.bin/<cmd>' (including argument passthrough) when the script is absent.

pacquet/crates/cli/tests/run.rs

@github-actions

github-actions Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.00      6.8±0.30ms   639.5 KB/sec    1.01      6.9±0.35ms   632.5 KB/sec

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jul 5, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. Fallback needs package.json ✓ Resolved 🐞 Bug ≡ Correctness
Description
dispatch_script::fallback routes unknown top-level commands through RunArgs::run_fallback, but
RunArgs::run_inner always parses /package.json before it can fall back to ExecArgs. As a
result, the new pnpm  shorthand fails in directories without a manifest even though exec itself
can run without package.json.
Code

pacquet/crates/cli/src/cli_args/run.rs[R99-112]

+    pub fn run_fallback(self, dir: &Path, config: &Config, silent: bool) -> miette::Result<()> {
+        self.run_inner(dir, config, silent, true)
+    }
+
+    fn run_inner(
+        self,
+        dir: &Path,
+        config: &Config,
+        silent: bool,
+        fallback_to_exec: bool,
+    ) -> miette::Result<()> {
let RunArgs { command, args, if_present, .. } = self;
let manifest =
  PackageManifest::from_path(dir.join("package.json")).map_err(RunError::Manifest)?;
Evidence
The fallback route uses RunArgs::run_fallback, but RunArgs::run_inner parses package.json
before it checks whether it should fall back to exec, so missing manifests prevent fallback. In
contrast, exec is explicitly designed to run without a manifest (it only optionally reads
package.json to stamp an env var).

pacquet/crates/cli/src/cli_args/dispatch_script.rs[48-66]
pacquet/crates/cli/src/cli_args/run.rs[84-146]
pacquet/crates/cli/src/cli_args/exec.rs[78-93]
pacquet/crates/cli/src/cli_args/exec.rs[192-203]

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

## Issue description
Top-level fallback is intended to behave like `run` when a matching script exists, and like `exec` when it does not. Currently, the fallback path cannot reach `exec` if `package.json` is missing/unreadable because `RunArgs::run_inner` unconditionally loads the manifest first and returns `RunError::Manifest` on failure.
## Issue Context
`ExecArgs::run` can execute in arbitrary directories; it only *optionally* reads `package.json` to set `PNPM_PACKAGE_NAME`. The fallback should preserve that behavior, at least when `package.json` is missing.
## Fix Focus Areas
- pacquet/crates/cli/src/cli_args/run.rs[99-146]
- pacquet/crates/cli/src/cli_args/dispatch_script.rs[48-66]
## Suggested fix
In `RunArgs::run_inner`, when `fallback_to_exec` is true and `PackageManifest::from_path(...)` fails, detect the "missing package.json" case (e.g. `PackageManifestError::Io(err)` with `err.kind() == NotFound`) and directly execute `ExecArgs { command: [script_name, args...], shell_mode: false, ... }.run(dir, config)` instead of erroring. Add a regression test for `pacquet <bin>` in a directory with `node_modules/.bin/<bin>` present and no `package.json`.

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



Remediation recommended

2. -- terminator ignored 🐞 Bug ≡ Correctness
Description
external_command_index() returns None when it encounters --, so ConfigOverrides::extract()
continues classifying later tokens and may strip/apply --config.* that were meant to be passed
through (e.g. pacquet -- commitlint --config.foo=bar). This breaks explicit argv pass-through and
can unexpectedly apply pacquet config overrides from arguments that the user intended for the
external command.
Code

pacquet/crates/cli/src/config_overrides.rs[R109-117]

+fn external_command_index(argv: &[OsString]) -> Option<usize> {
+    let mut index = 1;
+    while index < argv.len() {
+        let Some(arg) = argv[index].to_str() else {
+            return Some(index);
+        };
+        if arg == "--" {
+            return None;
+        }
Evidence
ConfigOverrides::extract() runs before clap parsing specifically to strip --config.* tokens;
returning None on -- means extraction does not stop at the option terminator and continues to
classify later tokens, so --config.* after -- can still be consumed/dropped instead of being
passed through.

pacquet/crates/cli/src/lib.rs[16-41]
pacquet/crates/cli/src/config_overrides.rs[36-56]
pacquet/crates/cli/src/config_overrides.rs[109-132]

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

## Issue description
`ConfigOverrides::extract()` strips `--config.*` tokens before clap parsing. With the new external-command boundary logic, a leading `--` should terminate override extraction so subsequent tokens are forwarded literally, but `external_command_index()` returns `None` on `--`, which disables the post-boundary preservation and allows later `--config.*` tokens to be consumed/dropped.
## Issue Context
This shows up with invocations like:
- `pacquet -- commitlint --config.foo=bar`
Where the user is explicitly using `--` to stop pacquet option parsing and pass remaining args to the external command.
## Fix Focus Areas
- pacquet/crates/cli/src/config_overrides.rs[36-56]
- pacquet/crates/cli/src/config_overrides.rs[109-132]
- pacquet/crates/cli/src/config_overrides/tests.rs[1-150]
### Concrete fix approach
- In `ConfigOverrides::extract()`, treat `--` as a hard stop:
- Push the `--` token into `remaining`, then push all remaining argv tokens as-is and `break`.
- This ensures *no* `--config.*` stripping occurs after `--`.
- Adjust/remove the `if arg == "--" { return None; }` branch in `external_command_index()` as needed so semantics are not misleading.
- Add a unit test proving `ConfigOverrides::extract(argv(["pacquet","--","commitlint","--config.foo=bar"]))` leaves `--config.foo=bar` in `remaining` and does not apply it as an override.

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


3. Wrong global option width 🐞 Bug ☼ Reliability
Description
external_command_index() treats unknown long options like --foo bar as single-token flags, so it
can misinterpret bar as the top-level command and stop --config.* extraction too early. This can
leave --config.* tokens in argv for clap to reject (or skip intended overrides) when pnpm forwards
new/global value-taking flags that pacquet hasn’t yet modeled.
Code

pacquet/crates/cli/src/config_overrides.rs[R135-152]

+fn global_option_width(arg: &str) -> Option<usize> {
+    if matches!(arg, "-r" | "-v") {
+        return Some(1);
+    }
+    if matches!(arg, "-C" | "-F") {
+        return Some(2);
+    }
+    if arg.starts_with("-C") || arg.starts_with("-F") {
+        return Some(1);
+    }
+    let name = arg.strip_prefix("--")?;
+    let (name, has_value) = name.split_once('=').map_or((name, false), |(name, _)| (name, true));
+    let consumes_value = matches!(
+        name,
+        "dir" | "filter" | "filter-prod" | "npmrc-auth-file" | "reporter" | "userconfig",
+    );
+    Some(if consumes_value && !has_value { 2 } else { 1 })
+}
Evidence
The new boundary detector advances by global_option_width() for --... tokens, but
global_option_width() defaults to width=1 for unknown long options, which can shift the scan onto
the option’s value and treat it as the command. Elsewhere in this codebase, argv scanning explicitly
assumes unknown long options consume a value to avoid exactly this mis-detection.

pacquet/crates/cli/src/config_overrides.rs[109-152]
pacquet/crates/cli/src/with_current.rs[16-21]
pacquet/crates/cli/src/with_current.rs[116-128]

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

## Issue description
`ConfigOverrides::extract()` now uses `external_command_index()` to avoid stripping `--config.*` tokens that belong to an external top-level command. The helper `global_option_width()` currently returns width=1 for any unknown `--flag` (unless it’s in a small allowlist of value-taking names). If pnpm adds/forwards a new global long option that consumes a separate value token (e.g. `--new-opt value`), `external_command_index()` will treat `value` as the command token and may incorrectly stop config override extraction early.
## Issue Context
This repo already has a conservative argv-scanning rule in `with_current.rs`: unknown long options are assumed to consume a value, specifically to avoid mis-locating the subcommand position.
## Fix Focus Areas
- pacquet/crates/cli/src/config_overrides.rs[109-158]
- pacquet/crates/cli/src/with_current.rs[16-21]
- pacquet/crates/cli/src/with_current.rs[116-128]
## Suggested fix
Update `global_option_width()` to mirror `with_current`’s conservative parsing:
- For tokens starting with `--` that do **not** include `=`:
- return width=1 only for known boolean/no-value globals (and `--no-...` negations if applicable in this CLI)
- otherwise return width=2 (assume it consumes the next token)
This keeps `external_command_index()` from mistaking an option value for a command boundary, improving forward-compatibility with new pnpm global options.

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


4. Non-UTF8 argv breaks fallback 🐞 Bug ☼ Reliability
Description
external_command_index() uses OsString::to_str()? and returns None on the first non-UTF8 argv
token, disabling external-command boundary detection. This can cause ConfigOverrides::extract() to
keep stripping --config.* tokens that appear after a top-level external command, breaking argument
forwarding in non-UTF8 paths/argv.
Code

pacquet/crates/cli/src/config_overrides.rs[R109-113]

+fn external_command_index(argv: &[OsString]) -> Option<usize> {
+    let mut index = 1;
+    while index < argv.len() {
+        let arg = argv[index].to_str()?;
+        if arg == "--" {
Evidence
The regression is directly caused by early-returning None on non-UTF8 argv values, which disables
the newly added external-command boundary detection. pacquet’s CLI explicitly accepts --dir as a
PathBuf, so non-UTF8 argv values are expected to be supported in at least some positions; the new
boundary detection should not short-circuit on them.

pacquet/crates/cli/src/config_overrides.rs[109-130]
pacquet/crates/cli/src/cli_args/cli_command.rs[66-87]

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

## Issue description
`external_command_index()` currently does `argv[index].to_str()?`, which returns `None` for non-UTF8 argv tokens and aborts detection of the external-command boundary. When that happens, `ConfigOverrides::extract()` will continue classifying and stripping `--config.*` tokens even after the external command token, so external tools can silently lose their `--config.*` arguments.
## Issue Context
pacquet otherwise accepts non-UTF8 values for some globals (e.g. `--dir` is a `PathBuf`), so a non-UTF8 path component or other argv value can realistically appear on Unix. The external-command boundary detection should therefore not fail closed on `to_str()`.
## Fix Focus Areas
- pacquet/crates/cli/src/config_overrides.rs[109-131]
### Implementation sketch (one acceptable approach)
- Replace `let arg = argv[index].to_str()?;` with a non-aborting conversion:
- If `to_str()` is `Some`, run the current ASCII matching logic.
- If `None`, treat it as an opaque value and advance `index += 1` (or otherwise continue scanning without returning `None`).
- Prefer `OsStr` equality checks for ASCII sentinels where possible (e.g. `arg == OsStr::new("--")`) so `--` can be detected even if other args are non-UTF8.

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


View more (4)
5. No recursive exec fallback 🐞 Bug ≡ Correctness
Description
dispatch_script::fallback sends recursive shorthand (-r) straight to RunArgs::run_recursive,
which has no run→exec fallback path. If no workspace project defines the requested script, it errors
instead of falling through to exec like the non-recursive shorthand does.
Code

pacquet/crates/cli/src/cli_args/dispatch_script.rs[R61-65]

+    if ctx.recursive {
+        args.run_recursive((ctx.config)()?, ctx.dir)?;
+    } else {
+        args.run_fallback(ctx.dir, (ctx.config)()?, matches!(ctx.reporter, ReporterType::Silent))?;
+    }
Evidence
The new shorthand handler uses run_recursive when ctx.recursive is true, but only the
non-recursive path calls run_fallback, which is where the exec fallback is implemented.
run_recursive explicitly errors when no scripts matched and --if-present is not set, so
recursive shorthand cannot fall through to exec today.

pacquet/crates/cli/src/cli_args/dispatch_script.rs[48-65]
pacquet/crates/cli/src/cli_args/run.rs[99-140]
pacquet/crates/cli/src/cli_args/run/recursive.rs[217-228]

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

## Issue description
Recursive top-level shorthand (`pacquet -r <name> ...`) currently does **not** perform the intended “try scripts first, then fall back to exec when no script matches” behavior. The recursive branch calls `RunArgs::run_recursive` directly, and `run_recursive` returns an error when no script matched (`has_command == 0`), with no attempt to run the command via recursive `exec`.
### Issue Context
Non-recursive shorthand uses `RunArgs::run_fallback(..., fallback_to_exec=true)` and falls back to `exec` when the script is missing. Recursive shorthand should mirror that contract (either by explicitly documenting that recursive shorthand is scripts-only, or by implementing the same exec fallback when *no* script matches).
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/dispatch_script.rs[48-66]
- pacquet/crates/cli/src/cli_args/run/recursive.rs[217-228]

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


6. Dropped --config.* external args ✓ Resolved 🐞 Bug ☼ Reliability
Description
With the new External top-level fallback, external-command argv is forwarded into
run_fallback/exec, but any token starting with --config. is removed earlier by
ConfigOverrides::extract before clap parsing. This prevents external tools from receiving
legitimate --config.= style flags (even if the user tries to separate args with --), breaking
the new fallback’s argument forwarding for CLIs that use dotted config flags.
Code

pacquet/crates/cli/src/cli_args/dispatch_script.rs[R48-65]

+pub(super) fn fallback<'a>(
+    ctx: &RunCtx<'a>,
+    command: Vec<String>,
+) -> miette::Result<CommandFuture<'a>> {
+    let mut command = command.into_iter();
+    let args = RunArgs {
+        command: command.next(),
+        args: command.collect(),
+        if_present: false,
+        resume_from: None,
+        report_summary: false,
+        no_bail: false,
+    };
+    if ctx.recursive {
+        args.run_recursive((ctx.config)()?, ctx.dir)?;
+    } else {
+        args.run_fallback(ctx.dir, (ctx.config)()?, matches!(ctx.reporter, ReporterType::Silent))?;
+    }
Evidence
The new fallback forwards unknown-command tokens as RunArgs { command, args }, but argv
preprocessing strips --config.* tokens before clap ever constructs that Vec, so they cannot be
forwarded to the external command.

pacquet/crates/cli/src/cli_args/dispatch_script.rs[48-66]
pacquet/crates/cli/src/lib.rs[19-29]
pacquet/crates/cli/src/config_overrides.rs[34-47]
pacquet/crates/cli/src/config_overrides.rs[107-122]

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

## Issue description
`ConfigOverrides::extract` strips all tokens beginning with `--config.` from argv before clap runs. After this PR, unknown top-level commands are parsed as `CliCommand::External` and forwarded as external-command argv, but those stripped tokens never reach the external command.
### Issue Context
This is especially problematic for external tools that legitimately use dotted options (e.g. `--config.foo=bar`). Users expect `--` to terminate pacquet option parsing so such flags can be passed through.
### Fix Focus Areas
- pacquet/crates/cli/src/config_overrides.rs[34-47]
- pacquet/crates/cli/src/config_overrides.rs[107-122]
- pacquet/crates/cli/src/config_overrides/tests.rs[1-110]
### Suggested fix
1. In `ConfigOverrides::extract`, stop classifying tokens after a literal `--` terminator: once `--` is encountered, push it into `remaining`, then push all subsequent args into `remaining` unchanged.
2. Add tests proving `--config.<key>=<value>` is **not** stripped when it appears after `--` (and remains in `remaining`).
3. (Optional) Add an end-to-end CLI test exercising the new top-level external fallback with `--` + `--config.<key>=<value>` to ensure the external argv remains intact.

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


7. Trailing globals become args 🐞 Bug ⚙ Maintainability
Description
With #[clap(external_subcommand)], all tokens after an unknown top-level command are captured into
Vec and never parsed by clap, so global flags placed after the shorthand command are forwarded as
external-command args instead of affecting pacquet. This creates an inconsistent CLI contract vs
other subcommands where global = true flags are intended to work across the subcommand boundary.
Code

pacquet/crates/cli/src/cli_args/dispatch_script.rs[R48-60]

+pub(super) fn fallback<'a>(
+    ctx: &RunCtx<'a>,
+    command: Vec<String>,
+) -> miette::Result<CommandFuture<'a>> {
+    let mut command = command.into_iter();
+    let args = RunArgs {
+        command: command.next(),
+        args: command.collect(),
+        if_present: false,
+        resume_from: None,
+        report_summary: false,
+        no_bail: false,
+    };
Evidence
CliCommand::External captures unknown subcommands as raw strings, and dispatch_script::fallback
treats the remainder as RunArgs.args without any option parsing. Meanwhile, the CLI defines
several options as global = true, which implies users may place them across the boundary; in the
External path, they will instead be forwarded to the external command.

pacquet/crates/cli/src/cli_args/cli_command.rs[66-120]
pacquet/crates/cli/src/cli_args/cli_command.rs[278-284]
pacquet/crates/cli/src/cli_args/dispatch_script.rs[48-66]

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 external-subcommand fallback treats *all* remaining argv tokens as payload for `run`/`exec` fallback, which means users can accidentally place pacquet global flags (e.g. `--recursive`, `--reporter`, `--filter`) after the shorthand command and have them silently passed to the external command instead.
## Issue Context
`CliArgs` marks several options `global = true` and even documents behavior across the “subcommand boundary”; the external-subcommand path short-circuits that parsing.
## Fix Focus Areas
- pacquet/crates/cli/src/cli_args/dispatch_script.rs[48-66]
- pacquet/crates/cli/src/cli_args/cli_command.rs[66-120]
- pacquet/crates/cli/src/cli_args/tests.rs[161-185]
## Suggested fix
In `dispatch_script::fallback`, scan the captured `Vec<String>` for known pacquet global flags (at least `-r`/`--recursive`, `--reporter`, `-F`/`--filter`, `--filter-prod`, `--npmrc-auth-file`). If any are present, return a clear usage error like: "Global options must appear before the command when using pnpm shorthand" (or reparse by moving those tokens before the subcommand if you want to support both). Add a test that demonstrates the chosen behavior (error or supported parsing).

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


8. Typos may execute binaries 🐞 Bug ⛨ Security
Description
The new #[clap(external_subcommand)] path routes any unknown top-level token through
run_fallback, which falls through to ExecArgs::run when no matching package.json script
exists. This changes unknown-command handling from fail-closed to potentially executing a
repo-controlled binary from node_modules/.bin (or other PATH entries), increasing
accidental/typo-triggered code execution risk in untrusted repos.
Code

pacquet/crates/cli/src/cli_args/run.rs[R132-141]

+            if fallback_to_exec {
+                return ExecArgs {
+                    command: std::iter::once(script_name).chain(args).collect(),
+                    shell_mode: false,
+                    resume_from: None,
+                    report_summary: false,
+                    no_bail: false,
+                }
+                .run(dir, config);
+            }
Evidence
The diff adds an external subcommand that captures unknown top-level tokens, routes them into a
fallback handler, and when no script matches it constructs ExecArgs and runs it. ExecArgs
explicitly resolves the program against a PATH that prepends node_modules/.bin and then executes
it, enabling repo-provided binaries to run on unknown/typoed commands.

pacquet/crates/cli/src/cli_args/cli_command.rs[278-284]
pacquet/crates/cli/src/cli_args/dispatch.rs[232-262]
pacquet/crates/cli/src/cli_args/dispatch_script.rs[39-67]
pacquet/crates/cli/src/cli_args/run.rs[95-146]
pacquet/crates/cli/src/cli_args/exec.rs[117-170]

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

## Issue description
Unknown top-level commands now default to execution via the run→exec fallback, which can run repo-controlled binaries (e.g., from `node_modules/.bin`) when a user mistypes a pacquet command. This is intentional pnpm-compat behavior, but it’s a meaningful safety regression vs. the previous hard error for unknown subcommands.
## Issue Context
- `CliCommand::External` captures unrecognized subcommands.
- Dispatch routes this to `dispatch_script::fallback`, which constructs `RunArgs` and calls `run_fallback`.
- `RunArgs::run_fallback` falls through to `ExecArgs::run` when no script matches.
- `ExecArgs` resolves the executable using `node_modules/.bin` + `extra_bin_paths` + inherited `PATH`.
## Fix Focus Areas
- pacquet/crates/cli/src/cli_args/cli_command.rs[282-283]
- pacquet/crates/cli/src/cli_args/dispatch.rs[258-259]
- pacquet/crates/cli/src/cli_args/dispatch_script.rs[48-66]
- pacquet/crates/cli/src/cli_args/run.rs[99-146]
## Concrete mitigation options (pick one)
1. Add a global flag (e.g., `--no-external-fallback` / `--strict-commands`) that, when set, turns `CliCommand::External(_)` into an explicit error instead of execution.
2. Implement a `pm`-style forced-builtin prefix (similar to pnpm’s `pnpm pm ...`) so scripts/CI can enforce fail-closed parsing.
Keep the default behavior unchanged to preserve pnpm compatibility, but provide the opt-out for security-sensitive automation.

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



Informational

9. Duplicate clap command build 🐞 Bug ➹ Performance
Description
ConfigOverrides::extract now calls CliArgs::command() to detect known top-level commands, which
constructs clap’s full command tree before parsing; clap then constructs it again during
CliArgs::try_parse_from, adding avoidable cold-start overhead on every invocation.
Code

pacquet/crates/cli/src/config_overrides.rs[R152-156]

+fn is_known_top_level_command(name: &str) -> bool {
+    CliArgs::command().get_subcommands().any(|command| {
+        command.get_name() == name || command.get_all_aliases().any(|alias| alias == name)
+    })
+}
Evidence
The new preprocessing step uses clap’s CommandFactory to enumerate subcommands (which builds the
clap command structure) before later invoking clap parsing, which also requires building/using the
command structure; this duplicates work on startup.

pacquet/crates/cli/src/config_overrides.rs[40-55]
pacquet/crates/cli/src/config_overrides.rs[109-156]
pacquet/crates/cli/src/lib.rs[16-41]

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

## Issue description
`ConfigOverrides::extract()` now calls `CliArgs::command()` (via `is_known_top_level_command`) during argv preprocessing. This builds clap’s full command definition before parsing, and clap then builds it again during `CliArgs::try_parse_from(...)`, adding avoidable startup work on every CLI invocation.
### Issue Context
This runs on the CLI cold-start path (`pacquet_cli::main` calls `ConfigOverrides::extract(...)` before `CliArgs::try_parse_from(...)`). The extra work is small but systematic.
### Fix Focus Areas
- pacquet/crates/cli/src/config_overrides.rs[109-156]
- pacquet/crates/cli/src/lib.rs[16-41]
### Suggested approach
- Avoid constructing a full clap `Command` during preprocessing. Options:
- Replace `is_known_top_level_command()` with a static set of known top-level command names + aliases (kept in one place), or
- Build the subcommand-name set once using `OnceLock`/`LazyLock` and reuse it across calls, rather than rebuilding the full clap tree each time.
- Keep behavior identical; this is purely a startup-cost reduction.

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


Grey Divider

Qodo Logo

@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.

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

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

No test exercises the ctx.recursive branch of dispatch_script::fallback.

Both new tests only cover the non-recursive run_fallback path. The fallback dispatcher (per context snippet 1 in dispatch_script.rs) also has a run_recursive branch when ctx.recursive is true, which remains untested here.

As per path instructions (pacquet/AGENTS.md): "don't 'skip' missing-tool branches silently (no probe-and-return test early)" — while this isn't a probe-and-return case, the recursive dispatch path for the new External fallback is currently unverified by any test in this PR.

🤖 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 `@pacquet/crates/cli/tests/run.rs` around lines 335 - 392, The new fallback
tests in run.rs only verify the non-recursive dispatch path, leaving the
ctx.recursive branch of dispatch_script::fallback untested. Add a test that
drives the recursive path in dispatch_script::fallback (and its run_recursive
branch) for the External fallback behavior, using the existing CommandTempCwd
setup and the same commitlint-style fixture symbols to keep it aligned with the
current 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.

Nitpick comments:
In `@pacquet/crates/cli/tests/run.rs`:
- Around line 335-392: The new fallback tests in run.rs only verify the
non-recursive dispatch path, leaving the ctx.recursive branch of
dispatch_script::fallback untested. Add a test that drives the recursive path in
dispatch_script::fallback (and its run_recursive branch) for the External
fallback behavior, using the existing CommandTempCwd setup and the same
commitlint-style fixture symbols to keep it aligned with the current coverage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 76cf347e-0f7b-4463-b230-3e55418c7336

📥 Commits

Reviewing files that changed from the base of the PR and between 2b5e9bc and f921a4a.

📒 Files selected for processing (6)
  • pacquet/crates/cli/src/cli_args/cli_command.rs
  • pacquet/crates/cli/src/cli_args/dispatch.rs
  • pacquet/crates/cli/src/cli_args/dispatch_script.rs
  • pacquet/crates/cli/src/cli_args/run.rs
  • pacquet/crates/cli/src/cli_args/tests.rs
  • pacquet/crates/cli/tests/run.rs

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 5, 2026
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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

@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)
pacquet/crates/cli/tests/run_recursive.rs (1)

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

Test doesn't cover the actual fallback-to-local-binary scenario.

This test defines a commitlint script in each project's package.json, so -r commitlint is satisfied via the normal script-run branch of run_inner (script found → executed directly), never reaching exec_fallback. It proves CliCommand::External correctly routes to dispatch_script::fallback → run_recursive when a script exists, but it doesn't exercise the PR's headline behavior: falling back to executing a local binary from node_modules/.bin recursively when no script matches (the scenario run.rs's run_inner handles via exec_fallback on NoImporterManifestFound/empty specified).

Consider adding a companion recursive test where no commitlint script is defined but a local binary/shim exists in node_modules/.bin, asserting the binary actually executes per-project. As per path instructions, "add/extend Rust integration tests that prove the same scenario(s) as the TS tests."

🤖 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 `@pacquet/crates/cli/tests/run_recursive.rs` around lines 102 - 130, The
recursive run test currently only covers the script-execution path, not the
local binary fallback path. Update or add a test around
run_recursive::top_level_fallback_enters_recursive_run so it omits the
commitlint script and instead provides a local binary/shim under
node_modules/.bin, then assert run_inner reaches exec_fallback and executes that
binary for each workspace project. Use the existing CommandTempCwd,
write_workspace, and pacquet CLI flow to keep the test aligned with the
recursive fallback behavior.

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 `@pacquet/crates/cli/tests/run_recursive.rs`:
- Line 109: The `run_recursive` test uses `scripts.commitlint` with `touch
ran.txt`, which is not Windows-safe. Update this test case to use the same
cross-platform file creation approach used elsewhere in the recursive run tests,
or conditionally skip/gate the `commitlint` script case on Windows. Keep the
change localized around the `run_recursive` test setup where the `commitlint`
script is defined.

---

Nitpick comments:
In `@pacquet/crates/cli/tests/run_recursive.rs`:
- Around line 102-130: The recursive run test currently only covers the
script-execution path, not the local binary fallback path. Update or add a test
around run_recursive::top_level_fallback_enters_recursive_run so it omits the
commitlint script and instead provides a local binary/shim under
node_modules/.bin, then assert run_inner reaches exec_fallback and executes that
binary for each workspace project. Use the existing CommandTempCwd,
write_workspace, and pacquet CLI flow to keep the test aligned with the
recursive fallback behavior.
🪄 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: bf4f35b9-dff1-4b90-8aa9-8ec56892529d

📥 Commits

Reviewing files that changed from the base of the PR and between f921a4a and 9215562.

📒 Files selected for processing (3)
  • pacquet/crates/cli/src/cli_args/run.rs
  • pacquet/crates/cli/tests/run.rs
  • pacquet/crates/cli/tests/run_recursive.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • pacquet/crates/cli/tests/run.rs
  • pacquet/crates/cli/src/cli_args/run.rs

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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

@codecov-commenter

codecov-commenter commented Jul 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.41284% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.09%. Comparing base (2b5e9bc) to head (e7c9ba1).

Files with missing lines Patch % Lines
pacquet/crates/cli/src/config_overrides.rs 92.30% 4 Missing ⚠️
pacquet/crates/cli/src/cli_args/run.rs 97.36% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12810      +/-   ##
==========================================
+ Coverage   85.07%   85.09%   +0.01%     
==========================================
  Files         415      415              
  Lines       65544    65649     +105     
==========================================
+ Hits        55761    55863     +102     
- Misses       9783     9786       +3     

☔ 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.

Copilot AI review requested due to automatic review settings July 5, 2026 00:44

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 Jul 5, 2026

Copy link
Copy Markdown
Member Author

Follow-up on the remaining Qodo items after 5650aaf:

  • No recursive exec fallback: this is intentionally not implemented for pnpm parity. TypeScript pnpm routes recursive shorthand through runRecursive before the non-recursive fallback-to-exec path, and runRecursive reports ERR_PNPM_RECURSIVE_RUN_NO_SCRIPT when no workspace script matches. The PR now pins that behavior with top_level_fallback_does_not_exec_local_bin_recursively.
  • Trailing globals become args: this matches TypeScript pnpm’s parser contract. The TS parser test explicitly expects cases like foo --recursive, foo --filter=bar, and foo --help to remain script arguments for fallback run, not become global options.
  • Typos may execute binaries: that execution is the pnpm-compatible shorthand feature being ported here. Adding a pacquet-only strict flag or forced-builtin prefix would create a new CLI surface that does not exist in TypeScript pnpm.

The valid findings were handled in earlier commits: missing-manifest fallback in 9215562, and dotted --config.* external argv preservation plus the recursive parity regression test in 5650aaf.


Written by an agent (Codex, GPT-5).

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 5650aaf

1 similar comment
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 5650aaf

@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: 2

🧹 Nitpick comments (1)
pacquet/crates/cli/src/config_overrides.rs (1)

109-131: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Duplicated argv-boundary-scanning logic vs. with_current.rs::command_index.

Both external_command_index here and command_index in with_current.rs implement a very similar "scan argv, skip global options, find the first positional token" algorithm independently. Keeping two hand-rolled scanners increases the risk of behavioral drift between pacquet with <cmd> and top-level external-command fallback as global flags are added/changed in the future.

Consider extracting a shared argv-scanning helper (parameterized by what counts as "known"/terminal) that both call sites can reuse.

🤖 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 `@pacquet/crates/cli/src/config_overrides.rs` around lines 109 - 131, The argv
scanning logic in external_command_index is duplicated with command_index in
with_current.rs, so factor out a shared helper for walking argv and skipping
global options/terminators. Reuse that helper from external_command_index and
command_index, and parameterize it with the command-classification predicate
(for example, the known-top-level check) so both paths stay behaviorally aligned
as flags evolve.
🤖 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 `@pacquet/crates/cli/src/config_overrides.rs`:
- Around line 109-119: The argv scanning in external_command_index() is too
permissive because a non-UTF-8 token currently causes a full-scan reset in
ConfigOverrides::extract(), allowing later --config.* args to be stripped past
the command boundary. Update external_command_index() to treat the first
non-UTF-8 argv token as the boundary like with_current::command_index() does, so
only the pre-command segment is considered for config override removal.

In `@pacquet/crates/cli/tests/run_recursive.rs`:
- Around line 26-32: Add a Unix-only gate around the recursive run test helpers
in run_recursive.rs: write_executable uses
std::os::unix::fs::PermissionsExt::set_mode, so it must be behind #[cfg(unix)]
or split into a Unix-only helper. Also gate
top_level_fallback_does_not_exec_local_bin_recursively (and any other test using
that helper or a shebang script) with #[cfg(unix)] so Windows CI can compile and
run the test suite. Use the existing write_executable helper and
top_level_fallback_does_not_exec_local_bin_recursively test as the symbols to
update.

---

Nitpick comments:
In `@pacquet/crates/cli/src/config_overrides.rs`:
- Around line 109-131: The argv scanning logic in external_command_index is
duplicated with command_index in with_current.rs, so factor out a shared helper
for walking argv and skipping global options/terminators. Reuse that helper from
external_command_index and command_index, and parameterize it with the
command-classification predicate (for example, the known-top-level check) so
both paths stay behaviorally aligned as flags evolve.
🪄 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: bede629d-bee3-41d2-bc01-84a5ce8d2d05

📥 Commits

Reviewing files that changed from the base of the PR and between 9215562 and 5650aaf.

📒 Files selected for processing (4)
  • pacquet/crates/cli/src/config_overrides.rs
  • pacquet/crates/cli/src/config_overrides/tests.rs
  • pacquet/crates/cli/tests/run.rs
  • pacquet/crates/cli/tests/run_recursive.rs

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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

1 similar comment
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: e7c9ba1e6057

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.901 ± 0.148 3.718 4.127 1.83 ± 0.12
pacquet@main 3.849 ± 0.160 3.695 4.107 1.81 ± 0.12
pnpr@HEAD 2.149 ± 0.122 2.045 2.430 1.01 ± 0.08
pnpr@main 2.127 ± 0.106 1.976 2.280 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.9006237454,
      "stddev": 0.14841840090943573,
      "median": 3.9013469667000003,
      "user": 3.6176457999999996,
      "system": 3.46746932,
      "min": 3.7176882937,
      "max": 4.1272494657,
      "times": [
        4.1023240787,
        4.1272494657,
        3.9428309427,
        3.8495703017,
        4.0027592926999995,
        3.7176882937,
        3.7357488976999997,
        3.9050316597,
        3.8976622737,
        3.7253722477
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.8493529643000004,
      "stddev": 0.16039064387482474,
      "median": 3.7546645712,
      "user": 3.6838657999999995,
      "system": 3.4782754200000006,
      "min": 3.6945811137,
      "max": 4.1065474037,
      "times": [
        3.7292839147,
        3.6945811137,
        3.7382212067,
        3.7549359007,
        3.7543932417,
        4.0860020237,
        4.1065474037,
        3.8779652117,
        4.0145514577,
        3.7370481687
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.1493567655999994,
      "stddev": 0.12152103394102523,
      "median": 2.0957152086999997,
      "user": 2.6552935999999994,
      "system": 3.0375901199999995,
      "min": 2.0451891057,
      "max": 2.4301881637,
      "times": [
        2.0451891057,
        2.1684115397,
        2.1023173797,
        2.2912644227,
        2.1422520617,
        2.0655618297,
        2.0891130377,
        2.0847291887,
        2.4301881637,
        2.0745409267
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.1265453295,
      "stddev": 0.10640745248178575,
      "median": 2.1016197001999997,
      "user": 2.6692262999999996,
      "system": 3.0482045199999996,
      "min": 1.9758309977000001,
      "max": 2.2804774047,
      "times": [
        2.2295737026999998,
        2.2804774047,
        2.0422767676999998,
        2.2659992427,
        2.0337381057,
        1.9758309977000001,
        2.1729985967,
        2.0613190767,
        2.0695146777,
        2.1337247227
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 650.7 ± 12.8 633.8 671.4 1.01 ± 0.03
pacquet@main 647.0 ± 13.8 629.3 669.1 1.00
pnpr@HEAD 724.6 ± 110.4 669.1 1037.6 1.12 ± 0.17
pnpr@main 700.2 ± 31.1 676.1 780.2 1.08 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6507384289800001,
      "stddev": 0.012808731484233036,
      "median": 0.65126074888,
      "user": 0.3864006,
      "system": 1.32800508,
      "min": 0.6337831243800001,
      "max": 0.67144372138,
      "times": [
        0.65256139238,
        0.6338168803800001,
        0.65186270638,
        0.65687591238,
        0.66827994238,
        0.65065879138,
        0.64821200038,
        0.67144372138,
        0.63988981838,
        0.6337831243800001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.64700117558,
      "stddev": 0.01384164832520626,
      "median": 0.6484749118800001,
      "user": 0.39376579999999994,
      "system": 1.3211864799999997,
      "min": 0.62930982938,
      "max": 0.66907810038,
      "times": [
        0.65015912438,
        0.65920278538,
        0.62985833438,
        0.66907810038,
        0.6498250813800001,
        0.62930982938,
        0.66197100338,
        0.6471247423800001,
        0.64052326938,
        0.63295948538
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.72459799668,
      "stddev": 0.11037987557633727,
      "median": 0.69180027588,
      "user": 0.39666999999999997,
      "system": 1.37055808,
      "min": 0.6690585423800001,
      "max": 1.03755872238,
      "times": [
        0.70253164238,
        0.6900759173800001,
        0.6690585423800001,
        0.70008790338,
        0.67932304738,
        0.69094270238,
        0.6916796053800001,
        0.69192094638,
        0.69280093738,
        1.03755872238
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.70021446258,
      "stddev": 0.03113980724183004,
      "median": 0.69491004888,
      "user": 0.4098223,
      "system": 1.3394852799999997,
      "min": 0.67613862538,
      "max": 0.78021712938,
      "times": [
        0.69190648938,
        0.67837473638,
        0.71303436738,
        0.67773151938,
        0.70494042838,
        0.69791360838,
        0.70382349938,
        0.67806422238,
        0.78021712938,
        0.67613862538
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.180 ± 0.064 4.103 4.307 1.94 ± 0.11
pacquet@main 4.237 ± 0.062 4.139 4.351 1.96 ± 0.12
pnpr@HEAD 2.186 ± 0.102 2.062 2.353 1.01 ± 0.07
pnpr@main 2.157 ± 0.124 2.055 2.446 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.179737982659999,
      "stddev": 0.06406314500490606,
      "median": 4.179275412459999,
      "user": 3.7147867000000003,
      "system": 3.364688459999999,
      "min": 4.1027925089599995,
      "max": 4.30652776096,
      "times": [
        4.19983815896,
        4.11657145296,
        4.1587126659599996,
        4.22156541696,
        4.157293290959999,
        4.1027925089599995,
        4.20120532296,
        4.10712205496,
        4.30652776096,
        4.22575119296
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.23689980556,
      "stddev": 0.061823303507167096,
      "median": 4.23246839396,
      "user": 3.7653965,
      "system": 3.39008716,
      "min": 4.138702556959999,
      "max": 4.35067828696,
      "times": [
        4.2686141829599995,
        4.191815903959999,
        4.1860207869599995,
        4.35067828696,
        4.2042626489599995,
        4.138702556959999,
        4.23135478796,
        4.304475689959999,
        4.259491210959999,
        4.233581999959999
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.18590661506,
      "stddev": 0.10167288220342068,
      "median": 2.18145909296,
      "user": 2.531973,
      "system": 2.9149765600000004,
      "min": 2.06162241096,
      "max": 2.35273194596,
      "times": [
        2.21509776496,
        2.14782042096,
        2.11263375896,
        2.23780535796,
        2.06162241096,
        2.35273194596,
        2.27502375896,
        2.0873153919600003,
        2.28873827796,
        2.08027706196
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.15727080256,
      "stddev": 0.1236538608366579,
      "median": 2.11395884646,
      "user": 2.5537018,
      "system": 2.9309331599999995,
      "min": 2.0546062479600002,
      "max": 2.44551798396,
      "times": [
        2.44551798396,
        2.08106807496,
        2.1646306979600003,
        2.11170455296,
        2.09848133296,
        2.0547157779600003,
        2.11621313996,
        2.0546062479600002,
        2.14614268296,
        2.2996275339600003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.343 ± 0.010 1.330 1.362 1.98 ± 0.03
pacquet@main 1.386 ± 0.034 1.344 1.455 2.05 ± 0.06
pnpr@HEAD 0.691 ± 0.044 0.659 0.811 1.02 ± 0.07
pnpr@main 0.677 ± 0.009 0.666 0.690 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.3426326628600003,
      "stddev": 0.010049276032664372,
      "median": 1.34143309876,
      "user": 1.333536,
      "system": 1.6845246799999998,
      "min": 1.32997219776,
      "max": 1.3620680337600002,
      "times": [
        1.3620680337600002,
        1.33972217076,
        1.34110697976,
        1.33433014776,
        1.3417592177600002,
        1.3548133067600001,
        1.34594708876,
        1.32997219776,
        1.34514276976,
        1.3314647157600001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.3861132177600002,
      "stddev": 0.0335761457244924,
      "median": 1.38483032726,
      "user": 1.3878534999999999,
      "system": 1.7275461799999998,
      "min": 1.34360758076,
      "max": 1.45453237376,
      "times": [
        1.34803666376,
        1.45453237376,
        1.37800940876,
        1.36894470076,
        1.39979343176,
        1.41750386776,
        1.39623112876,
        1.34360758076,
        1.39165124576,
        1.36282177576
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.6909659959600001,
      "stddev": 0.0436528239797513,
      "median": 0.6799186182600001,
      "user": 0.36129870000000003,
      "system": 1.2941384799999998,
      "min": 0.65933997176,
      "max": 0.81136620276,
      "times": [
        0.6693501527600001,
        0.65933997176,
        0.6656288317600001,
        0.81136620276,
        0.69003312376,
        0.6881347667600001,
        0.67859702176,
        0.6812402147600001,
        0.6740231587600001,
        0.6919465147600001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6772665450600002,
      "stddev": 0.008780322218998682,
      "median": 0.67527315326,
      "user": 0.3618496,
      "system": 1.3063817799999997,
      "min": 0.6664727007600001,
      "max": 0.69024646576,
      "times": [
        0.6864646567600001,
        0.6901181257600001,
        0.6689688797600001,
        0.69024646576,
        0.6757182667600001,
        0.6731517157600001,
        0.6692094057600001,
        0.6664727007600001,
        0.67482803976,
        0.6774871937600001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.061 ± 0.040 2.988 3.121 4.59 ± 0.09
pacquet@main 3.059 ± 0.045 3.015 3.175 4.59 ± 0.09
pnpr@HEAD 0.673 ± 0.008 0.661 0.688 1.01 ± 0.02
pnpr@main 0.667 ± 0.009 0.655 0.683 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.06062448572,
      "stddev": 0.04043943562355924,
      "median": 3.06070908312,
      "user": 1.8262636399999999,
      "system": 1.97861308,
      "min": 2.9879009281199997,
      "max": 3.12097041512,
      "times": [
        3.11186888512,
        3.0472687981199997,
        3.01950975712,
        3.05897247912,
        3.12097041512,
        3.0375852171199997,
        3.07702996112,
        2.9879009281199997,
        3.06244568712,
        3.08269272912
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.05868375642,
      "stddev": 0.04522623669578289,
      "median": 3.05317424262,
      "user": 1.8391862399999996,
      "system": 1.9849749799999998,
      "min": 3.01482039312,
      "max": 3.17501326612,
      "times": [
        3.06785450312,
        3.03193536512,
        3.01482039312,
        3.01651814312,
        3.05310801212,
        3.05324047312,
        3.05546851812,
        3.04714215312,
        3.17501326612,
        3.0717367371199997
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.67334381712,
      "stddev": 0.007968682239229478,
      "median": 0.6733395211200002,
      "user": 0.34401384,
      "system": 1.31826238,
      "min": 0.6609660471200001,
      "max": 0.6879868431200001,
      "times": [
        0.66354699512,
        0.6879868431200001,
        0.6609660471200001,
        0.6783441591200001,
        0.6736536451200001,
        0.6703969791200001,
        0.6730253971200001,
        0.6755995641200001,
        0.66931562312,
        0.6806029181200001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.66698845762,
      "stddev": 0.009238035800936862,
      "median": 0.6673449286200002,
      "user": 0.35424153999999997,
      "system": 1.2947209800000001,
      "min": 0.65461177812,
      "max": 0.6826669851200001,
      "times": [
        0.6676201531200001,
        0.6670697041200001,
        0.65461177812,
        0.68054567612,
        0.6576564161200001,
        0.6583913641200001,
        0.6631384141200001,
        0.6694078951200001,
        0.6826669851200001,
        0.6687761901200001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 669.9 ± 17.7 644.1 692.3 6.22 ± 0.18
pacquet@main 663.2 ± 20.5 639.4 696.6 6.16 ± 0.20
pnpr@HEAD 107.7 ± 1.2 103.2 109.4 1.00
pnpr@main 107.9 ± 1.4 105.8 113.4 1.00 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6698901381400001,
      "stddev": 0.01767945722012245,
      "median": 0.6727480541399999,
      "user": 0.6360186800000001,
      "system": 0.15587231999999998,
      "min": 0.64408478064,
      "max": 0.6923175486400001,
      "times": [
        0.64408478064,
        0.67771071064,
        0.64437438264,
        0.65173945664,
        0.68792813164,
        0.6923175486400001,
        0.67353282264,
        0.68598888464,
        0.67196328564,
        0.66926137764
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6632083269400001,
      "stddev": 0.02047251865998611,
      "median": 0.65686327564,
      "user": 0.6332879799999999,
      "system": 0.15301991999999998,
      "min": 0.63938680564,
      "max": 0.69658271764,
      "times": [
        0.69658271764,
        0.69431156164,
        0.64510858264,
        0.65737950664,
        0.66468698764,
        0.63938680564,
        0.6450878706400001,
        0.65634704464,
        0.65315649564,
        0.68003569664
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10765363607999999,
      "stddev": 0.0011789528435668746,
      "median": 0.10776525964,
      "user": 0.027235579999999995,
      "system": 0.0184382,
      "min": 0.10322361164,
      "max": 0.10936503964,
      "times": [
        0.10693381564,
        0.10855713964,
        0.10732235164,
        0.10936503964,
        0.10669828064,
        0.10885479564,
        0.10637540164,
        0.10772549564,
        0.10830872564,
        0.10726725664,
        0.10799476864,
        0.10760366764,
        0.10724257564,
        0.10827108264,
        0.10732160064,
        0.10322361164,
        0.10814004264,
        0.10758679664,
        0.10797364564,
        0.10776525964,
        0.10830615064,
        0.10827425164,
        0.10698485064,
        0.10913088464,
        0.10811341064
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.10793235471999997,
      "stddev": 0.0013732608192667706,
      "median": 0.10784735664,
      "user": 0.027799620000000004,
      "system": 0.018992079999999995,
      "min": 0.10576737964,
      "max": 0.11335067364,
      "times": [
        0.10685521864,
        0.10835145264,
        0.10760742464,
        0.10857522364,
        0.10784735664,
        0.10775292164,
        0.10576737964,
        0.10832383264,
        0.10812917564,
        0.10824598164,
        0.10666294364,
        0.10884359464,
        0.10628546464,
        0.10749182364,
        0.10802852764,
        0.11335067364,
        0.10776397264,
        0.10858020064,
        0.10664832664,
        0.10803493964,
        0.10774162164,
        0.10877743964,
        0.10773375564,
        0.10785465964,
        0.10705495664
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 6.758 ± 0.150 6.528 7.032 1.34 ± 0.04
pacquet@main 6.659 ± 0.108 6.509 6.866 1.32 ± 0.03
pnpr@HEAD 5.081 ± 0.172 4.848 5.346 1.01 ± 0.04
pnpr@main 5.046 ± 0.083 4.889 5.153 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 6.75806229136,
      "stddev": 0.15036900681372684,
      "median": 6.72091402546,
      "user": 3.8783311000000005,
      "system": 3.736618419999999,
      "min": 6.52774599646,
      "max": 7.03239603546,
      "times": [
        6.72434987546,
        6.83901881946,
        6.95284452646,
        6.78806746746,
        6.69043457246,
        7.03239603546,
        6.52774599646,
        6.63360945646,
        6.71747817546,
        6.67467798846
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 6.6586259949599995,
      "stddev": 0.1077249999579519,
      "median": 6.656706057959999,
      "user": 3.8635736,
      "system": 3.7108445199999993,
      "min": 6.50877898546,
      "max": 6.86550805146,
      "times": [
        6.53701604846,
        6.66473463846,
        6.59842968346,
        6.72006837346,
        6.67446488946,
        6.77174229946,
        6.64867747746,
        6.86550805146,
        6.59683950246,
        6.50877898546
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 5.08116793866,
      "stddev": 0.17234009741956324,
      "median": 5.04604282546,
      "user": 2.8173785,
      "system": 3.30800122,
      "min": 4.84816796946,
      "max": 5.34563971946,
      "times": [
        5.28597256246,
        5.04200022646,
        4.89883710746,
        4.84816796946,
        5.28366576646,
        4.95768885746,
        5.10967318246,
        5.34563971946,
        5.05008542446,
        4.98994857046
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 5.04585372156,
      "stddev": 0.08323648982017696,
      "median": 5.02596376196,
      "user": 2.8544291999999998,
      "system": 3.3136441199999993,
      "min": 4.88906127646,
      "max": 5.15302135646,
      "times": [
        5.15302135646,
        5.0210402824600004,
        5.02114675946,
        4.88906127646,
        5.15120573346,
        4.99667925046,
        5.00638821046,
        5.04458536346,
        5.14462821846,
        5.03078076446
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12810
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
4,179.74 ms
(-1.19%)Baseline: 4,229.97 ms
5,075.97 ms
(82.34%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
3,060.62 ms
(+1.35%)Baseline: 3,019.93 ms
3,623.91 ms
(84.46%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,342.63 ms
(+0.10%)Baseline: 1,341.32 ms
1,609.58 ms
(83.42%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
669.89 ms
(+7.37%)Baseline: 623.90 ms
748.68 ms
(89.48%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
3,900.62 ms
(-3.86%)Baseline: 4,057.42 ms
4,868.90 ms
(80.11%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
6,758.06 ms
(-2.26%)Baseline: 6,914.08 ms
8,296.89 ms
(81.45%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
650.74 ms
(+2.43%)Baseline: 635.27 ms
762.33 ms
(85.36%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12810
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
2,185.91 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
673.34 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
690.97 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
107.65 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,149.36 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
5,081.17 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
724.60 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.

3 participants