Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds ChangesCLI with command and config plumbing
Sequence Diagram(s)sequenceDiagram
participant Main as main
participant Rewrite as with_current::rewrite
participant Parse as CliArgs::parse_from
participant Route as dispatch_query::with
participant Run as WithArgs::run
participant Install as install_pnpm_to_store::install_pnpm_to_store
participant Pnpm as pnpm
Main->>Rewrite: rewrite argv before clap parsing
Rewrite-->>Main: rewritten argv or error
Main->>Parse: parse argv
Parse->>Route: route CliCommand::With(args)
Route->>Run: args.run::<Reporter>(config)
Run->>Install: install pnpm@spec into store
Install-->>Run: bin path
Run->>Pnpm: spawn installed pnpm with args
Pnpm-->>Run: exit status
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
PR Summary by Qodofeat(pacquet-cli): port the Description
Diagram
High-Level Assessment
Files changed (17)
|
Code Review by Qodo
1. Trust policy bypass
|
Micro-Benchmark ResultsLinux |
|
Code review by qodo was updated up to the latest commit c7baf10 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/cli_args/with/install_pnpm_to_store.rs`:
- Around line 60-74: The cache-hit path in
install_pnpm_to_store::install_pnpm_to_store is returning too early when
package.json exists, even though fresh installs still perform the executable/bin
setup. Update the cache-hit branch so it validates or recreates the runnable
wrapper the same way the normal install flow does, using the existing
link_exe_platform_binary and link_bins steps after the package directory check.
Ensure a partially completed prior install cannot leave compute_pnpm_slot
returning a bin directory that has package files but no runnable wrapper.
🪄 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: f595374b-7c22-4bd5-8d99-9c902974b5e2
📒 Files selected for processing (17)
pacquet/crates/cli/src/cli_args.rspacquet/crates/cli/src/cli_args/cli_command.rspacquet/crates/cli/src/cli_args/dispatch.rspacquet/crates/cli/src/cli_args/dispatch_query.rspacquet/crates/cli/src/cli_args/self_update.rspacquet/crates/cli/src/cli_args/self_update/install_pnpm.rspacquet/crates/cli/src/cli_args/self_update/verify_engine.rspacquet/crates/cli/src/cli_args/with.rspacquet/crates/cli/src/cli_args/with/install_pnpm_to_store.rspacquet/crates/cli/src/lib.rspacquet/crates/cli/src/with_current.rspacquet/crates/cli/src/with_current/tests.rspacquet/crates/cli/tests/with.rspacquet/crates/config/src/env_overlay.rspacquet/crates/config/src/lib.rspacquet/crates/config/src/workspace_yaml.rspacquet/crates/package-manager/src/install_package_from_registry/tests.rs
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #12696 +/- ##
==========================================
- Coverage 85.47% 85.26% -0.22%
==========================================
Files 393 396 +3
Lines 59808 60060 +252
==========================================
+ Hits 51120 51208 +88
- Misses 8688 8852 +164 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.940197974299999,
"stddev": 0.2089688943622284,
"median": 4.8904063873,
"user": 4.0330213,
"system": 3.54516084,
"min": 4.6659136138,
"max": 5.3556278528,
"times": [
5.1002910578,
5.3556278528,
4.8758003728,
5.1675707838,
4.913422456799999,
4.8498600248,
4.8340479387999995,
4.7344332397999995,
4.9050124018,
4.6659136138
]
},
{
"command": "pacquet@main",
"mean": 4.811601972499999,
"stddev": 0.1535351445285978,
"median": 4.750202412799999,
"user": 3.9999656000000003,
"system": 3.5207178399999988,
"min": 4.6867592958,
"max": 5.159288731799999,
"times": [
5.159288731799999,
4.7026206317999995,
5.022335540799999,
4.6867592958,
4.7757251558,
4.748082473799999,
4.752322351799999,
4.7477649118,
4.735277894799999,
4.785842736799999
]
},
{
"command": "pnpr@HEAD",
"mean": 2.9605167997999997,
"stddev": 0.1544656639616241,
"median": 2.9144356013,
"user": 2.7538668999999993,
"system": 3.0510536399999997,
"min": 2.7929461568000002,
"max": 3.3202393818,
"times": [
2.8574679008,
2.7929461568000002,
2.8874573248,
2.8302593978000004,
2.9303007008,
3.3202393818,
2.9804232398,
3.0837570928,
3.0237463008,
2.8985705018
]
},
{
"command": "pnpr@main",
"mean": 3.0117384674000007,
"stddev": 0.12015120464529101,
"median": 2.9892560763000002,
"user": 2.7097960999999997,
"system": 3.0585041399999993,
"min": 2.8703012618000003,
"max": 3.2638128558,
"times": [
3.1596982248,
2.9841289508,
2.9197053878,
3.0390366898,
3.2638128558,
2.8703012618000003,
2.9790647848000003,
3.0101440538,
2.9943832018000003,
2.8971092628000004
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6505262658400001,
"stddev": 0.013583563307290472,
"median": 0.65348965264,
"user": 0.3939404999999999,
"system": 1.33518578,
"min": 0.63201450064,
"max": 0.67489736664,
"times": [
0.65734068064,
0.63901863264,
0.63770790864,
0.65298544664,
0.67489736664,
0.66448003064,
0.63822130464,
0.63201450064,
0.65460292864,
0.65399385864
]
},
{
"command": "pacquet@main",
"mean": 0.6599547347400001,
"stddev": 0.03863656148801284,
"median": 0.65466073114,
"user": 0.38494779999999995,
"system": 1.32645118,
"min": 0.63062207064,
"max": 0.76604441264,
"times": [
0.65422355264,
0.65509973764,
0.66273794364,
0.65536857164,
0.64187203364,
0.63565542664,
0.64282568864,
0.76604441264,
0.65509790964,
0.63062207064
]
},
{
"command": "pnpr@HEAD",
"mean": 0.69989412084,
"stddev": 0.011732062470449113,
"median": 0.69855522564,
"user": 0.4009644,
"system": 1.3658663799999997,
"min": 0.68541955564,
"max": 0.71642182064,
"times": [
0.70268481364,
0.70201895664,
0.68556728264,
0.69229917764,
0.68541955564,
0.71379111964,
0.71394768164,
0.69509149464,
0.71642182064,
0.69169930564
]
},
{
"command": "pnpr@main",
"mean": 0.69974146124,
"stddev": 0.02168164693433397,
"median": 0.69286829764,
"user": 0.3903176,
"system": 1.3689033799999997,
"min": 0.67778155564,
"max": 0.75084331664,
"times": [
0.69240744264,
0.68432593164,
0.69332915264,
0.69067030164,
0.68889274364,
0.69515606464,
0.67778155564,
0.72389763064,
0.75084331664,
0.70011047264
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.801176505160001,
"stddev": 0.04725432539884123,
"median": 4.79841706176,
"user": 3.9461361999999993,
"system": 3.4345996,
"min": 4.70495262726,
"max": 4.86354150026,
"times": [
4.8570143232600005,
4.80811290226,
4.768036797260001,
4.80357623226,
4.86354150026,
4.793257891260001,
4.84588165426,
4.70495262726,
4.78197537326,
4.78541575026
]
},
{
"command": "pacquet@main",
"mean": 4.732834627760001,
"stddev": 0.08122971868161481,
"median": 4.72699762576,
"user": 3.8402000999999997,
"system": 3.4028261,
"min": 4.60776784026,
"max": 4.88778257726,
"times": [
4.8143306822600005,
4.7392893892600005,
4.7695816112600005,
4.88778257726,
4.75676611326,
4.70903804126,
4.68581218826,
4.60776784026,
4.71470586226,
4.64327197226
]
},
{
"command": "pnpr@HEAD",
"mean": 3.16730410166,
"stddev": 0.09071014588023216,
"median": 3.14610997876,
"user": 2.8218775000000003,
"system": 3.1866627000000003,
"min": 3.07093945126,
"max": 3.3277862392600004,
"times": [
3.10707142626,
3.1546521852600002,
3.3277862392600004,
3.09425761626,
3.1926016122600003,
3.13756777226,
3.3238597392600004,
3.1584709652600003,
3.07093945126,
3.10583400926
]
},
{
"command": "pnpr@main",
"mean": 3.18532927286,
"stddev": 0.10071463262440829,
"median": 3.16048453126,
"user": 2.7807239999999998,
"system": 3.2314445,
"min": 3.05057352326,
"max": 3.3752992812600002,
"times": [
3.1959195632600004,
3.15145778726,
3.16951127526,
3.0807873692600003,
3.2249382802600004,
3.3752992812600002,
3.05057352326,
3.13523807526,
3.32320060926,
3.1463669642600003
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.3930452995,
"stddev": 0.018328139895722132,
"median": 1.3886300608999997,
"user": 1.4111784200000002,
"system": 1.7063156,
"min": 1.3651157539,
"max": 1.4184499919,
"times": [
1.4184499919,
1.4045827289,
1.3831972658999998,
1.3651157539,
1.3809855769,
1.3749411289,
1.4183862298999999,
1.3873157199,
1.3899444018999998,
1.4075341969
]
},
{
"command": "pacquet@main",
"mean": 1.3981862296999998,
"stddev": 0.030246784526081795,
"median": 1.3961752494,
"user": 1.36316292,
"system": 1.7192579,
"min": 1.3578149068999998,
"max": 1.4726746009,
"times": [
1.4126322769,
1.4726746009,
1.4008148869,
1.3772229989,
1.3913229859,
1.3957550538999999,
1.3965954449,
1.3796328998999998,
1.3578149068999998,
1.3973962419
]
},
{
"command": "pnpr@HEAD",
"mean": 1.4840953049999999,
"stddev": 0.034789180080448706,
"median": 1.4784571619,
"user": 0.62321902,
"system": 1.6045833999999999,
"min": 1.4459380659,
"max": 1.5406281519,
"times": [
1.4459380659,
1.4963859029,
1.5406281519,
1.5317690608999999,
1.4822290829,
1.4479151958999998,
1.4490447809,
1.4746852409,
1.4619038319,
1.5104537359
]
},
{
"command": "pnpr@main",
"mean": 1.4551431318999999,
"stddev": 0.024412108026384154,
"median": 1.4446511824,
"user": 0.60363802,
"system": 1.557839,
"min": 1.4257987039,
"max": 1.4930645868999999,
"times": [
1.4427167549,
1.4810594769,
1.4930645868999999,
1.4257987039,
1.4461449619,
1.4871724679,
1.4627366848999999,
1.4431574028999998,
1.4419211069,
1.4276591718999998
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.101308037,
"stddev": 0.018328371918542866,
"median": 3.1019604542999994,
"user": 1.89712904,
"system": 1.9882256200000004,
"min": 3.0754341328,
"max": 3.1364713928,
"times": [
3.1049246237999997,
3.0989962847999997,
3.0976378228,
3.0804961438,
3.1364713928,
3.1171381348,
3.1070257307999998,
3.0754341328,
3.1105124598,
3.0844436438
]
},
{
"command": "pacquet@main",
"mean": 3.0447614559000002,
"stddev": 0.05354098209970025,
"median": 3.0334787453,
"user": 1.7904441400000004,
"system": 1.99932182,
"min": 3.0036404738,
"max": 3.1912456417999997,
"times": [
3.0144397927999997,
3.0117086767999997,
3.0410920137999997,
3.0036404738,
3.0314896268,
3.0354678637999997,
3.0450661107999997,
3.0259090318,
3.1912456417999997,
3.0475553268
]
},
{
"command": "pnpr@HEAD",
"mean": 1.4330023079,
"stddev": 0.018104949612331767,
"median": 1.4303169088,
"user": 0.6171531399999999,
"system": 1.59200692,
"min": 1.4087287258,
"max": 1.4579037498,
"times": [
1.4579037498,
1.4355599548000002,
1.4222210988000001,
1.4178763278000002,
1.4150658228000002,
1.4526517668,
1.4374737728,
1.4574679968000002,
1.4087287258,
1.4250738628000001
]
},
{
"command": "pnpr@main",
"mean": 1.4431584527,
"stddev": 0.10434334186466952,
"median": 1.4138270563000002,
"user": 0.5708500400000001,
"system": 1.5847851199999998,
"min": 1.3727355218000001,
"max": 1.7333723438000002,
"times": [
1.4199808738000002,
1.4595321568000001,
1.7333723438000002,
1.4053915288,
1.4147020328000002,
1.4129520798000001,
1.3969961048000001,
1.4189559778,
1.3969659068,
1.3727355218000001
]
}
]
} |
|
| Branch | pr/12696 |
| Testbed | pacquet |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result milliseconds (ms) (Result Δ%) | Upper Boundary milliseconds (ms) (Limit %) |
|---|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot 🚷 view threshold | 4,801.18 ms(+0.91%)Baseline: 4,757.77 ms | 5,709.33 ms (84.09%) |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot 🚷 view threshold | 3,101.31 ms(+1.75%)Baseline: 3,047.87 ms | 3,657.44 ms (84.79%) |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot 🚷 view threshold | 1,393.05 ms(+2.84%)Baseline: 1,354.63 ms | 1,625.56 ms (85.70%) |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot 🚷 view threshold | 4,940.20 ms(+1.91%)Baseline: 4,847.67 ms | 5,817.21 ms (84.92%) |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot 🚷 view threshold | 650.53 ms(-0.01%)Baseline: 650.59 ms | 780.71 ms (83.33%) |
|
| Branch | pr/12696 |
| Testbed | pnpr |
⚠️ 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-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 3,167.30 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 1,433.00 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 1,484.10 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,960.52 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 699.89 ms |
|
Code review by qodo was updated up to the latest commit 2cd4181 |
1 similar comment
|
Code review by qodo was updated up to the latest commit 2cd4181 |
|
Code review by qodo was updated up to the latest commit fee6d92 |
|
Code review by qodo was updated up to the latest commit fee6d92 |
|
Code review by qodo was updated up to the latest commit 20111b9 |
1 similar comment
|
Code review by qodo was updated up to the latest commit 20111b9 |
|
Code review by qodo was updated up to the latest commit df9179f |
1 similar comment
|
Code review by qodo was updated up to the latest commit df9179f |
|
Code review by qodo was updated up to the latest commit 452eb3f |
|
Code review by qodo was updated up to the latest commit 452eb3f |
Port pnpm's `with` command to pacquet. `pnpm with <version> <args...>` resolves the spec through the trusted package-manager bootstrap registry, installs that pnpm engine into the global virtual store (matching pnpm's installPnpmToStore — shared across invocations and, unlike self-update, not registered in the global packages directory), and spawns it with the remaining args and the child's packageManager check disabled. `pnpm with current <args...>` is rewritten before clap parses argv into a direct in-process dispatch of `<args>`, forcing pmOnFail to ignore via the pnpm_config_pm_on_fail env var. Wire the pmOnFail setting into Config and the env overlay so the override is honored once the packageManager check is ported. Reuse the self-update engine installer (now global-virtual-store aware) and the engine-identity verifier rather than duplicating them. The end-to-end `with <version>` download path has no automated test because the mock registry does not serve the pnpm / `@pnpm/exe` engine packages, the same limitation self-update has.
Satisfy the dylint perfectionist::macro-trailing-comma lint enforced by the pre-push hook.
Before recursively removing the throwaway install directory used by `pnpm with`, refuse to recurse through a symlink at the temp path, mirroring the guard patch-commit already applies. The store is within pnpm's trust domain, so this is defense-in-depth rather than a fix for an in-scope threat. Adds a single lstat on the install (cache-miss) path only.
spawn_pnpm resolved `pnpm` against the full prepended PATH, so a missing or broken shim in the engine's bin directory could fall through to a different `pnpm` on PATH and run the wrong engine. Resolve strictly within the engine's bin directory instead, matching pnpm's `with`, which spawns the explicit `path.join(binDir, 'pnpm')`. which_in is still used so the platform-correct shim name (e.g. pnpm.cmd on Windows) is picked.
The with-current argv rewrite scanned the whole argv and stripped the first `with current` pair anywhere, so `pnpm exec with current ...` (where the tokens are data for another command) would be wrongly rewritten and incorrectly force pmOnFail=ignore. Anchor the match to the top-level subcommand position by skipping global options (and the values they consume), mirroring pnpm, which only enters the rewrite when the parsed command is `with` with first param `current`.
spawn_pnpm prepended the engine's store-resident bin directory to PATH without rejecting a path-delimiter character in it, so a bin dir containing ':' (or ';' on Windows) would silently split into multiple PATH entries. Guard it with an explicit ERR_PNPM_BAD_PATH_DIR error, mirroring the guard exec's prepend_dirs_to_path already applies. The store is within pnpm's trust domain, so this is defense-in-depth aligned with the existing exec precedent.
|
Code review by qodo was updated up to the latest commit 0359401 |
|
Code review by qodo was updated up to the latest commit 0359401 |
Summary
Ports pnpm's
withcommand to the Rustpacquet/port (the TypeScript CLI already ships it, so this is the pacquet side catching up — no TypeScript change).pnpm with <version> <args...>— resolves the spec (version / range / dist-tag) through the trusted package-manager bootstrap registry, installs that pnpm engine into the global virtual store (<store>/links/..., matching pnpm'sinstallPnpmToStore: shared across invocations and, unlikeself-update, not registered in the global packages directory sopnpm ls -gdoesn't see it), then spawns it with the remaining args and the child'spackageManager/devEngines.packageManagercheck disabled.pnpm with current <args...>— rewritten before clap parses argv into a direct in-process dispatch of<args>, forcingpmOnFailtoignorevia thepnpm_config_pm_on_failenv var.Implementation notes:
pnpm/`@pnpm/exe`marked buildable, soENGINE_NAMEis folded into the GVS hash exactly as pnpm'sfindPnpmGvsPathdoes. To avoid any hash-mismatch risk, the install is located via its post-install symlink (ground truth), while the pipeline's ownVirtualStoreLayoutdrives the cache-hit short-circuit — so install and locate are guaranteed consistent, and a cache hit skips both the re-install and the network signature check, like pnpm.self-updateengine installer was made global-virtual-store aware and its engine-identity verifier + native-binary linker promoted topub(crate), sowithreuses the proven, signature-verifying install path instead of duplicating it.pmOnFailsetting is wired intoConfigand the env overlay so the override is honored once the runtimepackageManagercheck is ported (the check itself is not ported yet).Squash Commit Body
Checklist
pacquet/port, or the description notes what still needs porting. (TheTypeScript CLI already has
with; this is the pacquet port.)with_currentargv-rewrite unit tests +withintegration tests for the usage errors and thewith currentrewrite. The end-to-end
with <version>download path is not coveredbecause the mock registry doesn't serve the pnpm /
`@pnpm/exe`engine packages — the same limitation
self-updatehas.)Written by an agent (Claude Code, claude-opus-4-8).
Summary by CodeRabbit
withcommand to run pnpm for a specified version (orcurrent) in a single invocation.with currentshorthand for inline commands.pmOnFail/PM_ON_FAILsupport across configuration, workspace YAML, and environment overrides.with/with currentvalidation and diagnostics for missing spec/command and safer argument handling.withandwith current.