Repository navigation
feat(pacquet): support global runtime install - #12814
Conversation
`pnpm runtime set <name> <version> -g` now installs the runtime (Node/Deno/Bun) into the global packages directory and links its binary into the global bin directory, matching the TypeScript pnpm CLI. It previously errored with a "not supported yet" stub. The `<name>@runtime:<version>` selector is routed through the existing global-add pipeline. The wrinkle: pacquet's manifest writer folds a `runtime:<version>` dependency into `engines.runtime` on save, so a globally-installed runtime lands under `engines.runtime` with an empty `dependencies` map. The global scanner and bin-linker read `dependencies`, so without a fix they would link no binary. The global crate now reifies `engines.runtime` / `devEngines.runtime` back into dependencies when reading a group manifest — the same conversion the package manifest reader already applies — so an installed runtime is treated as the direct dependency it is. `list -g`, `remove -g`, and `update -g` therefore see it too. The TypeScript pnpm CLI already ships this feature, so this brings pacquet to parity and needs no TypeScript change; pacquet crates are unpublished, so no changeset is required.
|
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:
📝 WalkthroughWalkthroughThis PR adds global runtime installation support, shared global package alias scanning, and runtime-name validation across pacquet and pnpm11. It also updates tests and release metadata. ChangesGlobal Runtime Install Support
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ 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 QodoEnable global runtime installs via
AI Description
Diagram
High-Level Assessment
Files changed (8)
|
Code Review by Qodo
1.
|
Micro-Benchmark ResultsLinux |
|
Code review by qodo was updated up to the latest commit baa28c7 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pacquet/crates/global/src/scan/tests.rs (1)
46-63: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAdd a guard test for ordinary
engines.node/engines.npmmanifests.Existing tests cover the
runtimeshape and itsonFail: "warn"variant, but not a plain"engines": {"node": ">=18"}manifest (very common in real packages). Add a case assertingread_direct_dependency_aliasesstays empty andread_installed_packagesis unaffected for such a manifest, to guard the reification logic's trust boundary.✅ Suggested additional test
#[test] fn ordinary_engines_node_range_is_not_reified() { let tmp = TempDir::new().unwrap(); write_json( &tmp.path().join("package.json"), &json!({ "engines": { "node": ">=18" }, }), ); assert!(read_direct_dependency_aliases(tmp.path()).is_empty()); assert!(read_installed_packages(tmp.path()).is_empty()); }🤖 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/global/src/scan/tests.rs` around lines 46 - 63, Add a guard test for plain engines manifests so the scan logic does not reify them as installed packages or dependency aliases. In the test module around engines_runtime_without_download_is_not_treated_as_installed, add a case for a normal package.json with engines.node (and optionally engines.npm) using a simple range like ">=18", then assert read_direct_dependency_aliases and read_installed_packages both remain empty. Keep the test focused on the trust boundary in the scan/reification behavior.
🤖 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/global/src/scan/tests.rs`:
- Around line 46-63: Add a guard test for plain engines manifests so the scan
logic does not reify them as installed packages or dependency aliases. In the
test module around engines_runtime_without_download_is_not_treated_as_installed,
add a case for a normal package.json with engines.node (and optionally
engines.npm) using a simple range like ">=18", then assert
read_direct_dependency_aliases and read_installed_packages both remain empty.
Keep the test focused on the trust boundary in the scan/reification behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 12ffc7ca-6b1f-4dd8-8abd-af5d43c95923
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock,!Cargo.lock
📒 Files selected for processing (8)
pacquet/crates/cli/src/cli_args/dispatch_install.rspacquet/crates/cli/src/cli_args/global.rspacquet/crates/cli/src/cli_args/runtime.rspacquet/crates/cli/src/cli_args/runtime/tests.rspacquet/crates/global/Cargo.tomlpacquet/crates/global/src/lib.rspacquet/crates/global/src/scan.rspacquet/crates/global/src/scan/tests.rs
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12814 +/- ##
==========================================
+ Coverage 85.07% 85.18% +0.11%
==========================================
Files 415 416 +1
Lines 65544 65903 +359
==========================================
+ Hits 55761 56141 +380
+ Misses 9783 9762 -21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
`pnpm runtime set <name> <version>` interpolates the runtime name into a `pnpm add` selector. Because the global-add pipeline splits a selector on commas and normalizes path-like tokens as local paths, an unsupported name such as `node,is-positive` or `./foo` could be misread and install unintended packages or a local directory's bins. Validate the name against the supported runtimes (node, deno, bun) up front and error with `ERR_PNPM_INVALID_RUNTIME_NAME` otherwise. Applied to both the TypeScript CLI (`@pnpm/engine.runtime.commands`) and the Rust `pacquet/` port so their behavior stays identical.
|
Code review by qodo was updated up to the latest commit 76436d7 |
1 similar comment
|
Code review by qodo was updated up to the latest commit 76436d7 |
A global install creates its group dir under the global packages directory, which carries a `pnpm-workspace.yaml` of global settings (allowBuilds, catalog, ...). With no workspace root pinned, the install pipeline walked up from the group dir, adopted that file as the workspace, and then failed trying to enumerate its non-existent root project — breaking `add -g`, `update -g`, and `runtime set -g` on any machine that already had global settings written there. Pin the group's workspace root to its own install dir (matching pnpm's `rootProjectManifestDir: installDir`) so the install stays an isolated single project. The group's `allowBuilds` is still read from the global dir explicitly, as before.
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": 3.81369501844,
"stddev": 0.19899419017317627,
"median": 3.7864398133400003,
"user": 3.5411303199999997,
"system": 3.3619348199999997,
"min": 3.54425903934,
"max": 4.14017742334,
"times": [
4.14017742334,
3.54425903934,
3.62884075434,
3.82952040734,
3.7433592193400003,
3.9735731313400002,
3.91202692334,
3.6480145843400003,
3.67001332834,
4.04716537334
]
},
{
"command": "pacquet@main",
"mean": 3.73665819064,
"stddev": 0.10647625380968624,
"median": 3.70776344034,
"user": 3.60614202,
"system": 3.38242262,
"min": 3.6496816243400003,
"max": 4.00738429534,
"times": [
3.7219372543400002,
3.70017607334,
4.00738429534,
3.71535080734,
3.69677121434,
3.6496816243400003,
3.7293770853400003,
3.66245026234,
3.8191002543400003,
3.66435303534
]
},
{
"command": "pnpr@HEAD",
"mean": 2.1272457276400005,
"stddev": 0.12503747373960944,
"median": 2.0832842198400003,
"user": 2.6641323199999993,
"system": 2.9866572199999997,
"min": 1.98491141434,
"max": 2.33919560534,
"times": [
2.32557218934,
2.33919560534,
2.0319609933400002,
2.19373897534,
1.98491141434,
2.0796450863400002,
2.08692335334,
2.01056609834,
2.15788302034,
2.06206054034
]
},
{
"command": "pnpr@main",
"mean": 2.22269065834,
"stddev": 0.12710107272835974,
"median": 2.2726744648399997,
"user": 2.6847739200000005,
"system": 2.99678532,
"min": 2.03692428634,
"max": 2.39815199834,
"times": [
2.09334634234,
2.29157446134,
2.03692428634,
2.04881840634,
2.32701929234,
2.16782726334,
2.39815199834,
2.25793289734,
2.31789560334,
2.28741603234
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.65101723958,
"stddev": 0.012160868786088531,
"median": 0.6475659228799999,
"user": 0.38829551999999995,
"system": 1.3275706,
"min": 0.63376476788,
"max": 0.67403221888,
"times": [
0.64740328888,
0.63376476788,
0.64112544088,
0.64772855688,
0.64114893688,
0.67403221888,
0.65998087788,
0.65656312788,
0.64546581488,
0.66295936488
]
},
{
"command": "pacquet@main",
"mean": 0.67673164788,
"stddev": 0.08364019467416395,
"median": 0.6507679238799999,
"user": 0.3836303199999999,
"system": 1.3343713999999998,
"min": 0.63578455788,
"max": 0.91173838488,
"times": [
0.6362770948800001,
0.64820973588,
0.67019618688,
0.65332611188,
0.63891971988,
0.66574894188,
0.63957041888,
0.63578455788,
0.66754532588,
0.91173838488
]
},
{
"command": "pnpr@HEAD",
"mean": 0.72137600258,
"stddev": 0.08447132164588238,
"median": 0.69150616738,
"user": 0.39597871999999995,
"system": 1.3555296,
"min": 0.67158360588,
"max": 0.9497890048800001,
"times": [
0.68761574988,
0.67908674288,
0.71808172288,
0.67158360588,
0.67486931388,
0.70776218088,
0.67284764288,
0.69539658488,
0.9497890048800001,
0.75672747688
]
},
{
"command": "pnpr@main",
"mean": 0.7376289689800001,
"stddev": 0.050754038256754695,
"median": 0.72316341638,
"user": 0.40032752,
"system": 1.3620652999999998,
"min": 0.69001847488,
"max": 0.8682982998800001,
"times": [
0.76219544588,
0.7470854408800001,
0.71105782088,
0.72566183188,
0.69001847488,
0.70713098988,
0.72066500088,
0.8682982998800001,
0.73940016888,
0.7047762158800001
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.26538062706,
"stddev": 0.042810548187688376,
"median": 4.27434978296,
"user": 3.75074284,
"system": 3.3933604799999997,
"min": 4.16528680646,
"max": 4.32307441146,
"times": [
4.25310937446,
4.2825453734600005,
4.25119402446,
4.28036070646,
4.28093628646,
4.30497720046,
4.32307441146,
4.26833885946,
4.16528680646,
4.24398322746
]
},
{
"command": "pacquet@main",
"mean": 4.236898119560001,
"stddev": 0.04427434735249548,
"median": 4.23259187146,
"user": 3.765843039999999,
"system": 3.38134808,
"min": 4.17881537546,
"max": 4.29808956146,
"times": [
4.18676223146,
4.1928696404600005,
4.21819967146,
4.29808956146,
4.28078957446,
4.17881537546,
4.26330797446,
4.24698407146,
4.28739595646,
4.21576713846
]
},
{
"command": "pnpr@HEAD",
"mean": 2.2213929175600002,
"stddev": 0.14591295726852652,
"median": 2.19329438946,
"user": 2.49133174,
"system": 2.91913028,
"min": 2.03955730446,
"max": 2.49587261346,
"times": [
2.0716010374600002,
2.2144186564600004,
2.14220879346,
2.03955730446,
2.49587261346,
2.4206385044600003,
2.1721701224600003,
2.13108221946,
2.2446972934600002,
2.28168263046
]
},
{
"command": "pnpr@main",
"mean": 2.13067188446,
"stddev": 0.10137824949157802,
"median": 2.11992828196,
"user": 2.54852554,
"system": 2.90231278,
"min": 1.99428289146,
"max": 2.36829164246,
"times": [
2.15678734246,
2.08789156446,
2.03555988046,
2.1317048724600003,
1.99428289146,
2.36829164246,
2.15224833746,
2.1851239324600003,
2.1081516914600003,
2.08667668946
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.3878038943599997,
"stddev": 0.020595530899392926,
"median": 1.39453256386,
"user": 1.3441809,
"system": 1.7094783599999996,
"min": 1.35528673736,
"max": 1.40869655836,
"times": [
1.40723082636,
1.40307247436,
1.40869655836,
1.35528673736,
1.35720050636,
1.4004004723599999,
1.38866465536,
1.36913315336,
1.40385595736,
1.38449760236
]
},
{
"command": "pacquet@main",
"mean": 1.3776110942599997,
"stddev": 0.05332978135695402,
"median": 1.36458225236,
"user": 1.3361987000000002,
"system": 1.69420026,
"min": 1.33145649836,
"max": 1.51655207036,
"times": [
1.3487297703599999,
1.35510688336,
1.51655207036,
1.38536403936,
1.39467249236,
1.36036335136,
1.36880115336,
1.3829150773599999,
1.33145649836,
1.33214960636
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6677385303600001,
"stddev": 0.019683396289025823,
"median": 0.6628843923600001,
"user": 0.336729,
"system": 1.2800017599999998,
"min": 0.6500354303600001,
"max": 0.71742167436,
"times": [
0.6500354303600001,
0.71742167436,
0.6503522973600001,
0.6745655513600001,
0.65778853936,
0.6573388063600001,
0.6775547943600001,
0.6614370283600001,
0.6665594253600001,
0.6643317563600001
]
},
{
"command": "pnpr@main",
"mean": 0.67458237536,
"stddev": 0.015415859442794316,
"median": 0.6695468438600001,
"user": 0.34134809999999993,
"system": 1.2969758599999996,
"min": 0.6588377823600001,
"max": 0.70890467036,
"times": [
0.70890467036,
0.67765861636,
0.6677711483600001,
0.6622426543600001,
0.6588377823600001,
0.6668299593600001,
0.6652614383600001,
0.6713225393600001,
0.69319894936,
0.6737959953600001
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.0477708172199995,
"stddev": 0.06814609020103937,
"median": 3.0176940541199997,
"user": 1.77835596,
"system": 1.9712491200000002,
"min": 2.99051005062,
"max": 3.22244740562,
"times": [
3.0663361946200003,
3.07789390662,
3.06088199562,
2.99051005062,
3.01395980662,
3.02142830162,
3.0108322316200002,
3.00488850762,
3.22244740562,
3.00852977162
]
},
{
"command": "pacquet@main",
"mean": 3.00312583532,
"stddev": 0.05729667739730704,
"median": 2.9808950341200005,
"user": 1.7434516599999998,
"system": 1.9612166199999996,
"min": 2.95807664762,
"max": 3.15367052062,
"times": [
2.97913115962,
3.0319750456200003,
2.95807664762,
2.97027789562,
2.96635190862,
2.9792955296200003,
3.00242173562,
2.98249453862,
3.15367052062,
3.00756337162
]
},
{
"command": "pnpr@HEAD",
"mean": 0.67424911062,
"stddev": 0.008492523403419583,
"median": 0.6723755971200001,
"user": 0.33550236,
"system": 1.3230849199999999,
"min": 0.66024844262,
"max": 0.68708634962,
"times": [
0.66924690162,
0.68048691662,
0.6829535236200001,
0.67105811362,
0.66764872262,
0.67369308062,
0.66820431762,
0.68708634962,
0.66024844262,
0.68186473762
]
},
{
"command": "pnpr@main",
"mean": 0.65356182292,
"stddev": 0.006535582924182424,
"median": 0.65337783212,
"user": 0.33985115999999993,
"system": 1.2754509200000002,
"min": 0.64354314162,
"max": 0.66662219562,
"times": [
0.66662219562,
0.65266497562,
0.6554782906200001,
0.64918559062,
0.6555449896200001,
0.64354314162,
0.64661913462,
0.6523169546200001,
0.65409068862,
0.65955226762
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6134391907600001,
"stddev": 0.008420118238644008,
"median": 0.6117317692600001,
"user": 0.5816617399999999,
"system": 0.14950139999999998,
"min": 0.60603943276,
"max": 0.63339999276,
"times": [
0.6151988877600001,
0.6144844687600001,
0.60723801676,
0.60897906976,
0.60657881276,
0.60603943276,
0.6188536317600001,
0.60730045676,
0.61631913776,
0.63339999276
]
},
{
"command": "pacquet@main",
"mean": 0.60586905276,
"stddev": 0.00811010374498688,
"median": 0.6038236857600001,
"user": 0.57349324,
"system": 0.1506305,
"min": 0.59533773376,
"max": 0.62001611676,
"times": [
0.60006419576,
0.60162047776,
0.6082422817600001,
0.6002083647600001,
0.62001611676,
0.6162682527600001,
0.59901185976,
0.6118943507600001,
0.59533773376,
0.6060268937600001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.10782566056000002,
"stddev": 0.0008904650052628879,
"median": 0.10808850176000001,
"user": 0.02739062,
"system": 0.0178281,
"min": 0.10484449576,
"max": 0.10914389876000001,
"times": [
0.10728014276,
0.10759530376000001,
0.10484449576,
0.10816787976000002,
0.10673699976,
0.10826476276000001,
0.10837601776000001,
0.10863868476,
0.10786629676000001,
0.10764749876000002,
0.10890825076,
0.10808850176000001,
0.10735141876000001,
0.10720133576,
0.10856283676,
0.10813118076000001,
0.10862626176000001,
0.10836798476000001,
0.10688227076000001,
0.10704445076,
0.10914389876000001,
0.10809800876,
0.10797751476,
0.10741020876000001,
0.10842930776000001
]
},
{
"command": "pnpr@main",
"mean": 0.10797223071999999,
"stddev": 0.001018568498522823,
"median": 0.10793158076,
"user": 0.027165340000000003,
"system": 0.018673940000000003,
"min": 0.10672610476000001,
"max": 0.11006547776,
"times": [
0.10858060976000002,
0.10816465276000001,
0.10674431276000002,
0.10901000776000001,
0.10678641476,
0.10838487376000001,
0.10997958876000001,
0.10706624076000001,
0.10718568576000001,
0.10869534376000001,
0.10766233676,
0.10677711376000001,
0.10835709276000001,
0.11006547776,
0.10740458176,
0.10672610476000001,
0.10801577076,
0.10884944776000001,
0.10812090076000001,
0.10793158076,
0.10735257376000001,
0.10779862976000001,
0.10972790676000001,
0.10714129976,
0.10677721976000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 6.551178212139999,
"stddev": 0.14074352601482112,
"median": 6.503470185339999,
"user": 3.6932434600000006,
"system": 3.6603431800000004,
"min": 6.3506449818399995,
"max": 6.79179596384,
"times": [
6.66819176884,
6.43195972284,
6.44313781084,
6.79179596384,
6.3506449818399995,
6.65325693384,
6.47429597284,
6.69155859584,
6.50295770184,
6.50398266884
]
},
{
"command": "pacquet@main",
"mean": 6.56421784784,
"stddev": 0.09752041513749955,
"median": 6.5537541818400005,
"user": 3.7782954600000003,
"system": 3.6726581800000004,
"min": 6.44711205384,
"max": 6.71455067884,
"times": [
6.55463078584,
6.48586861884,
6.55287757784,
6.46584918684,
6.61662626084,
6.44711205384,
6.48099605284,
6.71455067884,
6.61433281384,
6.70933444884
]
},
{
"command": "pnpr@HEAD",
"mean": 5.035714247539999,
"stddev": 0.11589947401993711,
"median": 4.99001047334,
"user": 2.7520113600000005,
"system": 3.2233707800000007,
"min": 4.90407504484,
"max": 5.2384205678399995,
"times": [
5.02632712384,
4.9465974588399995,
4.97621233484,
4.90407504484,
5.11223418984,
4.95333421984,
4.98124559084,
4.998775355839999,
5.21992058884,
5.2384205678399995
]
},
{
"command": "pnpr@main",
"mean": 4.88990779804,
"stddev": 0.12204735404975686,
"median": 4.85853811334,
"user": 2.80492186,
"system": 3.17449358,
"min": 4.73220600484,
"max": 5.16102138684,
"times": [
5.00390153884,
4.84014851084,
4.860323194839999,
5.16102138684,
4.9555842738399996,
4.85675303184,
4.79234507384,
4.87035689884,
4.73220600484,
4.82643806584
]
}
]
} |
|
| Branch | pr/12814 |
| 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 | 2,221.39 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 674.25 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 667.74 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 107.83 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,127.25 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 5,035.71 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 721.38 ms |
|
Code review by qodo was updated up to the latest commit 2a76582 |
|
Code review by qodo was updated up to the latest commit 2a76582 |
…tion config A global install runs in-process against the config already loaded from the caller's directory, so it inherited that project's dependency-graph settings. When the caller was a repo whose `overrides` referenced a `catalog:` (e.g. pnpm's own workspace), the isolated global install — which sees no catalogs — failed resolving the override with `ERR_PNPM_CATALOG_IN_OVERRIDES`; an inherited `catalogMode: strict` would likewise reject the install against an empty catalog. Clear the project-scoped resolution config (overrides, catalogs, catalogMode, packageExtensions, patchedDependencies) on the per-group config, matching pnpm, which runs the global install with `cwd` set to the pnpm home directory. Affects `add -g`, `update -g`, and `runtime set -g` alike.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pacquet/crates/cli/tests/global.rs (1)
143-181: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRegression test correctly targets the override/catalog-leak fix.
The test setup (workspace
overridesreferencingcatalog:+catalogMode: strict) matches the fix described in the commit summary, and assertingsuccess()here would fail without thecfg.overrides = None; cfg.catalogs = None; cfg.catalog_mode = CatalogMode::default();fix inpacquet/crates/cli/src/cli_args/global.rs. This satisfies the "regression-meaningful" requirement.One optional improvement: this test's structure (create pnpm_home/global_bin, write workspace yaml, run
add -g, assert success, check bin exists, drop cleanup) is essentially identical to the precedingglobal_add_ignores_ambient_global_workspace_yamltest (lines 103-142, not shown in this diff but referenced in the summary). Consider extracting a small helper (e.g.,run_global_add_and_assert_bin_exists(workspace, expected_bin)) to reduce duplication between the two tests.♻️ Sketch of a shared helper
+fn assert_global_add_succeeds(workspace: &Path, pnpm_home: &Path, package: &str, expected_bin: &str) { + use assert_cmd::assert::OutputAssertExt; + let global_bin = pnpm_home.join("bin"); + fs::create_dir_all(&global_bin).expect("create global bin dir"); + global_command(workspace, pnpm_home) + .with_arg("add") + .with_arg("-g") + .with_arg(package) + .assert() + .success(); + assert!(global_bin.join(expected_bin).exists()); +}As per path instructions, "missed reuse or duplication across the monorepo" is in scope for correctness/maintainability depth.
🤖 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/global.rs` around lines 143 - 181, The regression test in global_add_ignores_caller_project_overrides is correct, but it duplicates the setup/assertion flow used by global_add_ignores_ambient_global_workspace_yaml. Extract the shared global-add-and-bin-exists sequence into a small helper in the global.rs test module, then reuse it from both tests while keeping the specific workspace YAML setup separate so the override/catalog regression remains covered.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/global.rs`:
- Around line 143-181: The regression test in
global_add_ignores_caller_project_overrides is correct, but it duplicates the
setup/assertion flow used by global_add_ignores_ambient_global_workspace_yaml.
Extract the shared global-add-and-bin-exists sequence into a small helper in the
global.rs test module, then reuse it from both tests while keeping the specific
workspace YAML setup separate so the override/catalog regression remains
covered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: f61a4215-f157-4264-bd1b-05163b8958ff
📒 Files selected for processing (2)
pacquet/crates/cli/src/cli_args/global.rspacquet/crates/cli/tests/global.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- pacquet/crates/cli/src/cli_args/global.rs
|
Code review by qodo was updated up to the latest commit 59a58f6 |
1 similar comment
|
Code review by qodo was updated up to the latest commit 59a58f6 |
`pnpm runtime set <name> <version>` interpolates the version into the same `<name>@runtime:<version>` selector the global-add pipeline splits on commas. The name is already validated to a known runtime, but the version was not, so `runtime set node 22,evil -g` could smuggle in a second install target. Reject a comma in the version in both stacks; no valid runtime version (semver, dist-tag, channel) contains one.
A `-g` install ran against the config loaded from the caller's `--dir`, so a project `.npmrc` could steer the network / TLS / registry decisions of a *global* install (e.g. `strict-ssl=false`, a proxy, a custom `cafile`, or a registry redirect) — a repo the user merely `cd`-ed into could downgrade transport security or redirect traffic for a globally-linked binary. pnpm avoids this by running the global install with `cwd` set to the pnpm home dir. Mirror that: load a second config anchored at the pnpm home (resolved from `PNPM_HOME` / platform defaults, never the project) and use it for `add -g`, `update -g`, `remove -g`, and `runtime set -g`. Local-path selectors are still resolved relative to the caller's directory. The global e2e tests now seed the mocked registry / store at the pnpm home, since the isolated install no longer reads the workspace `.npmrc`.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pacquet/crates/cli/src/cli_args/dispatch_install.rs (1)
319-328: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd an e2e for
runtime set … -g
pacquet/crates/cli/tests/global.rscoversadd -g, but this newly enabled runtime path still lacks end-to-end coverage. Add a global round-trip test here so the dispatch branch andglobal_configisolation stay covered.🤖 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/cli_args/dispatch_install.rs` around lines 319 - 328, The global dispatch branch in dispatch_install should be covered by an end-to-end test for the runtime `set ... -g` path, since only `add -g` is currently exercised. Add a new round-trip test in the global test suite using the existing global test helpers and assertions around `dispatch_install`/`run_global`, verifying that `global_config` is used and that the global state remains isolated from the local config path.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/src/cli_args/dispatch_install.rs`:
- Around line 319-328: The global dispatch branch in dispatch_install should be
covered by an end-to-end test for the runtime `set ... -g` path, since only `add
-g` is currently exercised. Add a new round-trip test in the global test suite
using the existing global test helpers and assertions around
`dispatch_install`/`run_global`, verifying that `global_config` is used and that
the global state remains isolated from the local config path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 6a928721-bd8e-45ee-835c-e98a0047ac16
📒 Files selected for processing (8)
.changeset/validate-runtime-name.mdpacquet/crates/cli/src/cli_args/dispatch.rspacquet/crates/cli/src/cli_args/dispatch_install.rspacquet/crates/cli/src/cli_args/runtime.rspacquet/crates/cli/src/cli_args/runtime/tests.rspacquet/crates/cli/tests/global.rspnpm11/engine/runtime/commands/src/runtime/runtime.tspnpm11/engine/runtime/commands/test/runtime.test.ts
✅ Files skipped from review due to trivial changes (1)
- .changeset/validate-runtime-name.md
🚧 Files skipped from review as they are similar to previous changes (4)
- pacquet/crates/cli/src/cli_args/runtime/tests.rs
- pnpm11/engine/runtime/commands/test/runtime.test.ts
- pnpm11/engine/runtime/commands/src/runtime/runtime.ts
- pacquet/crates/cli/src/cli_args/runtime.rs
|
Code review by qodo was updated up to the latest commit ac551a3 |
1 similar comment
|
Code review by qodo was updated up to the latest commit ac551a3 |
`approve-builds` writes the `allowBuilds` decision to `config.workspace_dir`, falling back to the passed dir (the global packages dir). Pinning the group install's `workspace_dir` to the per-group install dir (to keep the install pipeline from adopting the global settings workspace) meant the approval landed in that throwaway install dir instead — so it wasn't reused by later global installs and left a stray `pnpm-workspace.yaml` under each group. Clear `workspace_dir` on the config used for the approval so the decision persists to the stable global packages dir; the rebuild keeps the install dir anchor so it still doesn't walk up. The global e2e tests now pin a per-test store via `pnpm-workspace.yaml` (`storeDir` isn't read from `.npmrc`), so a build's side-effects cache can't leak across runs and hide the ignored-build approval flow.
|
Code review by qodo was updated up to the latest commit 00fa622 |
1 similar comment
|
Code review by qodo was updated up to the latest commit 00fa622 |
Summary
pnpm runtime set <name> <version> -gnow installs a runtime (Node/Deno/Bun) into the global packages directory and links its binary into the global bin directory, matching the TypeScript pnpm CLI. Previously pacquet rejectedruntime set --globalwith a "not supported yet" stub.The
`<name>@runtime:<version>`selector is routed through the existing global-add pipeline. The one wrinkle: pacquet's manifest writer folds aruntime:<version>dependency intoengines.runtimeon save, so a globally-installed runtime is stored underengines.runtimewith an emptydependenciesmap. The global scanner and bin-linker readdependencies, so without a fix they would link no binary. The global crate now reifiesengines.runtime/devEngines.runtimeback into dependencies when reading a group manifest — the same conversion the package-manifest reader already applies on read — solist -g,remove -g, andupdate -gsee the runtime too.The TypeScript pnpm CLI already ships this feature, so this PR brings pacquet to parity and needs no TypeScript-side change.
Verified end-to-end:
runtime set node 22 -gdownloads Node 22.23.1 and linksnodeinto the global bin dir (node --version→v22.23.1);list -gshows[email protected];remove -g nodeunlinks it.Follow-ups from review:
runtime set(both stacks): the runtime name must benode/deno/bun, and the version must not contain a comma. Without this,node,is-positive,./foo, or22,evilcould be misread by the global-add pipeline as a package list / local path and install unintended packages. Errors areERR_PNPM_INVALID_RUNTIME_NAME/ERR_PNPM_INVALID_RUNTIME_VERSION, with tests and a changeset.cwd-anchored re-spawn): a-ginstall now (a) pins its workspace root to the install dir so it can't adopt the global-settingspnpm-workspace.yaml, (b) drops the caller project'soverrides/catalogs/catalogMode/etc., and (c) anchors its config at the pnpm home so a project.npmrccan't steer the network/TLS/registry of a global fetch. Each is covered by a regression test that fails without the fix.Squash Commit Body
Checklist
pacquet/port, or the description notes what still needs porting.(The TypeScript CLI already ships
runtime set -g; this PR brings theRust
pacquet/port to parity. No TypeScript-side change is needed.)runtime-command selector test; verified the full install/list/remove
lifecycle end-to-end.)
pnpm runtime set -gbehavior is already documented; this is a parity port with no
user-visible surface change.)
Written by an agent (Claude Code, claude-opus-4-8).
Summary by CodeRabbit
New Features
-gbehavior.Bug Fixes