Repository navigation
fix(cli): make pnpm setup install the native CLI globally - #13006
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
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:
📝 WalkthroughWalkthroughThe ChangesGlobal add installation flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant AddArgs
participant Config
participant State
participant GlobalInstall
User->>AddArgs: pnpm add -g --ignore-scripts file:<dir>
AddArgs->>Config: resolve ignore_scripts override
Config->>State: initialize with updated configuration
State->>GlobalInstall: run global add
GlobalInstall->>GlobalInstall: infer local package alias
GlobalInstall-->>User: complete installation without lifecycle scripts
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 |
There was a problem hiding this comment.
Pull request overview
Fixes the native (Rust/pacquet) pnpm setup flow by restoring parity with the TypeScript CLI for the recursive global install it performs (pnpm add -g --ignore-scripts file:<dir>), including script-flag handling, alias inference for file: directories, and path normalization for directory fetches. Adds an integration test to cover the exact setup-triggered command shape.
Changes:
- Add
--ignore-scripts/--no-ignore-scriptssupport toadd, applying the override into config before state initialization (both local and global). - Infer a package alias for global
file:directory selectors by reading the localpackage.jsonname. - Normalize directory resolution paths lexically before directory fetching; add an integration test and a
pacquetchangeset.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pnpm/crates/package-manager/src/install_package_by_snapshot.rs | Lexically normalizes directory resolution paths before fetching. |
| pnpm/crates/cli/tests/global.rs | Adds an integration test covering add -g --ignore-scripts file:<dir> behavior used by pnpm setup. |
| pnpm/crates/cli/src/cli_args/global.rs | Infers aliases for global file: directory selectors by reading package.json. |
| pnpm/crates/cli/src/cli_args/dispatch_install.rs | Applies add CLI config overrides (ignore-scripts) before initializing state. |
| pnpm/crates/cli/src/cli_args/add.rs | Introduces --ignore-scripts / --no-ignore-scripts flags and config application helper. |
| .changeset/native-setup-ignore-scripts.md | Adds a pacquet patch changeset for the setup fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Confidence Score: 5/5The change is well-scoped and safe to merge: it threads an existing config flag to a command that was missing it, adds a small path-normalization wrapper, and fills a gap in alias inference for global Each changed function has a narrow, well-understood effect. The No files require special attention. The Reviews (8): Last reviewed commit: "fix(cli): keep global file:/link: select..." | Re-trigger Greptile |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13006 +/- ##
==========================================
+ Coverage 85.53% 85.55% +0.01%
==========================================
Files 498 498
Lines 79541 79588 +47
==========================================
+ Hits 68037 68088 +51
+ Misses 11504 11500 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The remaining Windows CI failure occurs during Written by an agent (GitHub Copilot CLI, gpt-5.6-sol). |
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": 2.74029313132,
"stddev": 0.21219502842084909,
"median": 2.81417157292,
"user": 2.56388312,
"system": 1.90018894,
"min": 2.41915582192,
"max": 3.02849686192,
"times": [
2.4644159269199997,
2.41915582192,
2.81541221592,
2.56544063092,
2.61038769792,
3.02849686192,
2.9797705249199997,
2.81293092992,
2.82508104192,
2.88183966092
]
},
{
"command": "pacquet@main",
"mean": 2.77970600342,
"stddev": 0.18498027936414066,
"median": 2.77754819792,
"user": 2.96275372,
"system": 2.36441964,
"min": 2.58006988692,
"max": 3.2037656699199997,
"times": [
3.2037656699199997,
2.65313989292,
2.79205889692,
2.82877368492,
2.90275829592,
2.58423391792,
2.66212901892,
2.58006988692,
2.7630374989199997,
2.82709327092
]
},
{
"command": "pnpr@HEAD",
"mean": 1.67296499722,
"stddev": 0.2001269312422653,
"median": 1.6419206434200002,
"user": 1.94112962,
"system": 1.8483846399999997,
"min": 1.46737938692,
"max": 1.9614191859200003,
"times": [
1.7967503029200003,
1.7253339599200002,
1.5585073269200003,
1.46737938692,
1.50638352692,
1.9614191859200003,
1.46807508692,
1.8090870659200002,
1.9544085509200002,
1.4823055789200001
]
},
{
"command": "pnpr@main",
"mean": 1.61095703722,
"stddev": 0.1685659741870905,
"median": 1.6481912104200003,
"user": 1.62124402,
"system": 1.58525064,
"min": 1.36518551792,
"max": 1.8283788769200002,
"times": [
1.44923767292,
1.6494485489200001,
1.70522045192,
1.48610871392,
1.6469338719200002,
1.81239609792,
1.8283788769200002,
1.7454237219200002,
1.42123689792,
1.36518551792
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.24261667888,
"stddev": 0.017088932428157344,
"median": 0.23808192238000003,
"user": 0.2240277,
"system": 0.6385892599999999,
"min": 0.22668588888000002,
"max": 0.28001528088,
"times": [
0.23415884888000002,
0.23163949088000002,
0.24638345088000002,
0.22739012788000001,
0.22975274988000002,
0.24666359588000003,
0.24200499588000002,
0.22668588888000002,
0.26147235888,
0.28001528088
]
},
{
"command": "pacquet@main",
"mean": 0.25078728918,
"stddev": 0.017657047076834548,
"median": 0.25278360988,
"user": 0.23072849999999995,
"system": 0.65179846,
"min": 0.22096111188000003,
"max": 0.27191466988,
"times": [
0.24036534288000003,
0.22729946688000002,
0.24546229288000002,
0.25701148488,
0.24936841388,
0.26971778688,
0.25619880588,
0.27191466988,
0.26957351588,
0.22096111188000003
]
},
{
"command": "pnpr@HEAD",
"mean": 0.31561733288,
"stddev": 0.032526109924267424,
"median": 0.31389418688000004,
"user": 0.30722499999999997,
"system": 0.7599007600000001,
"min": 0.27256855088,
"max": 0.37689987888,
"times": [
0.28070295088,
0.27256855088,
0.29294212788,
0.31417304588,
0.31486556788,
0.34205096688000003,
0.34994231388,
0.37689987888,
0.31361532788,
0.29841259788
]
},
{
"command": "pnpr@main",
"mean": 0.31697191368,
"stddev": 0.03353530955633332,
"median": 0.31732753538,
"user": 0.28678729999999997,
"system": 0.74685056,
"min": 0.26829304187999997,
"max": 0.37970282288,
"times": [
0.33201539288,
0.32738603888,
0.34976885588,
0.27597656988,
0.37970282288,
0.32443932088,
0.31021574988,
0.30843087288,
0.26829304187999997,
0.29349047088
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.91142369824,
"stddev": 0.05177018928730816,
"median": 2.9036329650400003,
"user": 2.5322595799999994,
"system": 1.8094161800000002,
"min": 2.85454402004,
"max": 3.0239205630400003,
"times": [
2.8860860760400002,
2.90073497504,
2.8670159180400003,
2.9065309550400005,
2.8578213000400003,
2.85454402004,
2.9508730510400003,
3.0239205630400003,
2.93994514404,
2.92676498004
]
},
{
"command": "pacquet@main",
"mean": 2.9532475565400005,
"stddev": 0.12958174748223378,
"median": 2.9452359310400005,
"user": 2.67358328,
"system": 1.8119040799999997,
"min": 2.73218522304,
"max": 3.19900245204,
"times": [
2.9446466380400005,
2.94425345604,
3.11062254104,
2.96982339404,
3.19900245204,
2.9458252240400005,
2.9604689920400005,
2.87287823204,
2.73218522304,
2.8527694130400003
]
},
{
"command": "pnpr@HEAD",
"mean": 1.60505449584,
"stddev": 0.16404118494530956,
"median": 1.55260197254,
"user": 1.39970138,
"system": 1.34514008,
"min": 1.43780077904,
"max": 1.89148940004,
"times": [
1.60897666304,
1.49622728204,
1.45762314704,
1.89148940004,
1.7920169640399999,
1.7824856990400002,
1.47906930104,
1.43780077904,
1.47920254604,
1.62565317704
]
},
{
"command": "pnpr@main",
"mean": 1.61036790084,
"stddev": 0.1933943548697487,
"median": 1.54503704304,
"user": 1.4310349799999997,
"system": 1.4208543800000002,
"min": 1.41956378604,
"max": 1.9390144850400002,
"times": [
1.59283621004,
1.42049972304,
1.8262904850400001,
1.49723787604,
1.41956378604,
1.45198355504,
1.84586907904,
1.48524848504,
1.6251353240400002,
1.9390144850400002
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6838745106800002,
"stddev": 0.04826606581365457,
"median": 0.6713980591800002,
"user": 0.8593352400000001,
"system": 0.84465516,
"min": 0.6197932786800001,
"max": 0.76761831168,
"times": [
0.6507364886800001,
0.6600544976800001,
0.6799657846800001,
0.7581493836800001,
0.76761831168,
0.7118676246800001,
0.6628303336800001,
0.6815038106800001,
0.6462255926800001,
0.6197932786800001
]
},
{
"command": "pacquet@main",
"mean": 0.7100522850800001,
"stddev": 0.09593260008123011,
"median": 0.6868459236800001,
"user": 0.9278308399999998,
"system": 0.8162003600000001,
"min": 0.6003236336800001,
"max": 0.8748274746800001,
"times": [
0.6287819776800001,
0.6380658376800001,
0.6003236336800001,
0.67554632268,
0.6567924636800001,
0.8733024606800001,
0.8748274746800001,
0.7420323686800001,
0.71270478668,
0.6981455246800001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29292513647999996,
"stddev": 0.012945666580587255,
"median": 0.29193897468,
"user": 0.23140123999999998,
"system": 0.62325856,
"min": 0.27779321368,
"max": 0.31782620168000003,
"times": [
0.30678085968,
0.28086160168,
0.27848109168,
0.28631849368,
0.27779321368,
0.29167935368000003,
0.29772823168,
0.29958372168,
0.31782620168000003,
0.29219859568
]
},
{
"command": "pnpr@main",
"mean": 0.29178292957999996,
"stddev": 0.01868277626690181,
"median": 0.28740211218,
"user": 0.22079543999999998,
"system": 0.64207316,
"min": 0.26311017568,
"max": 0.32019448968,
"times": [
0.26311017568,
0.29185243868,
0.31167092468,
0.31572087468,
0.28295178568,
0.28061939168,
0.29382475268,
0.27707683468,
0.32019448968,
0.28080762768
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.94337139062,
"stddev": 0.02914125494715001,
"median": 1.94014320052,
"user": 1.1301676600000001,
"system": 0.9070140200000001,
"min": 1.9048904115199998,
"max": 1.99638750252,
"times": [
1.9048904115199998,
1.93200621652,
1.94866995852,
1.94610014052,
1.9748594125199999,
1.99638750252,
1.93418626052,
1.9133798095199999,
1.96616521852,
1.9170689755199999
]
},
{
"command": "pacquet@main",
"mean": 1.9249460660199997,
"stddev": 0.032998156463496686,
"median": 1.92994852052,
"user": 1.10356036,
"system": 0.8926535199999999,
"min": 1.87253448352,
"max": 1.96591189052,
"times": [
1.96591189052,
1.9594030895199999,
1.9366876205199999,
1.93362758052,
1.9164299225199999,
1.87253448352,
1.88564685652,
1.92626946052,
1.96075923652,
1.89219051952
]
},
{
"command": "pnpr@HEAD",
"mean": 0.27344623582,
"stddev": 0.018856142550151625,
"median": 0.27301875952,
"user": 0.21328686000000002,
"system": 0.5852555200000001,
"min": 0.24323394152000002,
"max": 0.30139035052,
"times": [
0.30139035052,
0.28002653552,
0.28941156952,
0.27927557252,
0.26373492252,
0.24323394152000002,
0.25028859652,
0.26587806152000004,
0.29446086152,
0.26676194652
]
},
{
"command": "pnpr@main",
"mean": 0.28324450032,
"stddev": 0.015142971170827113,
"median": 0.28104531102,
"user": 0.21360096,
"system": 0.61639332,
"min": 0.26096893552,
"max": 0.30789168352,
"times": [
0.26885205452,
0.28444001352000003,
0.29810120652,
0.26096893552,
0.27765060852,
0.28704843452,
0.27300939252,
0.27404399052,
0.30789168352,
0.30043868352
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.46693498976000003,
"stddev": 0.062265228935497005,
"median": 0.44289578716,
"user": 0.45819893999999994,
"system": 0.1001512,
"min": 0.40104609666,
"max": 0.5922683286600001,
"times": [
0.40104609666,
0.43859049666,
0.41304985666,
0.5922683286600001,
0.49031445666,
0.50602155766,
0.5357307186600001,
0.44720107766,
0.42168360666,
0.42344370166
]
},
{
"command": "pacquet@main",
"mean": 0.43431267906000004,
"stddev": 0.03716008802902856,
"median": 0.42566050616,
"user": 0.4188737399999999,
"system": 0.1082738,
"min": 0.39589895466,
"max": 0.50664573166,
"times": [
0.43363010266,
0.43094009166,
0.42038092066,
0.39589895466,
0.41699006766,
0.40844526566,
0.40264609566,
0.43372289866,
0.49382666166,
0.50664573166
]
},
{
"command": "pnpr@HEAD",
"mean": 0.10557067358592594,
"stddev": 0.006753866065355093,
"median": 0.10471129766000001,
"user": 0.02837032148148148,
"system": 0.018495296296296294,
"min": 0.09425051966,
"max": 0.11928281166000002,
"times": [
0.09866619666000001,
0.10917578466000001,
0.09614156666000001,
0.11169334566000001,
0.09667434366000001,
0.10408431766000001,
0.09425051966,
0.10965293366000001,
0.11928281166000002,
0.10471129766000001,
0.11337405666000001,
0.11429932266000001,
0.10492901266000002,
0.11142336566000001,
0.10142442366000001,
0.10386275766000001,
0.11662156566000001,
0.10044324866000001,
0.09714898066000001,
0.10097381166000001,
0.09792227366000002,
0.10366145566000001,
0.11257183066000001,
0.10386742066000001,
0.10579554066,
0.10607801066000001,
0.11167799166000002
]
},
{
"command": "pnpr@main",
"mean": 0.10228845051714287,
"stddev": 0.007393987251940063,
"median": 0.10130206766000001,
"user": 0.02483426857142858,
"system": 0.019103000000000002,
"min": 0.09002491466000001,
"max": 0.11429851866000001,
"times": [
0.10018803466000001,
0.09878389666000001,
0.09510847866000001,
0.10612103966000001,
0.11263446766000001,
0.11429851866000001,
0.10877984166000002,
0.10711078066000002,
0.09839930266000001,
0.09268772066000001,
0.09580698566000001,
0.09242304466000001,
0.11119656066000001,
0.09949760566000002,
0.09319753566000001,
0.09610082766000001,
0.09427377166,
0.09002491466000001,
0.10401069366000001,
0.10600731366,
0.10241610066000001,
0.09794412266000001,
0.10853657466000001,
0.11338122066000002,
0.09853012366000001,
0.10262364866000001,
0.11017239966000002,
0.11382108866000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.67786605294,
"stddev": 0.11477454513621246,
"median": 4.64994260664,
"user": 2.4538333999999997,
"system": 1.83998782,
"min": 4.554250920139999,
"max": 4.91606306714,
"times": [
4.79397622814,
4.554250920139999,
4.63511312514,
4.5765216211399995,
4.683692758139999,
4.589057846139999,
4.76267804714,
4.664772088139999,
4.60253482814,
4.91606306714
]
},
{
"command": "pacquet@main",
"mean": 4.57540712564,
"stddev": 0.054183558637015065,
"median": 4.56822839314,
"user": 2.4439781,
"system": 1.9246644199999998,
"min": 4.49316407914,
"max": 4.6498996751399995,
"times": [
4.54253194814,
4.63268356814,
4.54159146914,
4.49316407914,
4.60167599814,
4.56037243614,
4.51608855514,
4.5760843501399995,
4.6498996751399995,
4.63997917714
]
},
{
"command": "pnpr@HEAD",
"mean": 3.6102063318399997,
"stddev": 0.14731601159729568,
"median": 3.54767095364,
"user": 1.6645832000000003,
"system": 1.47029352,
"min": 3.4874639151399998,
"max": 3.89290408714,
"times": [
3.5276310031399998,
3.53697466514,
3.55517534214,
3.50879473314,
3.5497100061399998,
3.4874639151399998,
3.89290408714,
3.8683558261399997,
3.5456319011399997,
3.62942183914
]
},
{
"command": "pnpr@main",
"mean": 3.6017748316400002,
"stddev": 0.08553378173977737,
"median": 3.57671535314,
"user": 1.7534464,
"system": 1.5770801200000002,
"min": 3.47961257514,
"max": 3.74337129714,
"times": [
3.5236233221399997,
3.54920487514,
3.74337129714,
3.6710811631399998,
3.5782324221399997,
3.57519828414,
3.5446626871399998,
3.64861415114,
3.70414753914,
3.47961257514
]
}
]
} |
|
| Branch | pr/13006 |
| 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 | 1,605.05 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 273.45 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 292.93 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 105.57 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,672.96 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,610.21 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 315.62 ms |
08badc9 to
0e66783
Compare
The `add -g --ignore-scripts file:<dir>` regression test set `PNPM_HOME` but never pinned a store or cache, so the global install could read from and write to the developer/CI machine's default global store, polluting state and risking flakiness across runs. Seed a per-test `storeDir` / `cacheDir` under the temporary pnpm home (where the global install resolves its config), mirroring `prepare_global_home`, so the install is fully sandboxed.
fe246d4 to
b5e596b
Compare
|
Code review by qodo was updated up to the latest commit b5e596b |
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
resolve_local_param joined every non-absolute file:/link: selector to the base directory. That diverged from the TypeScript resolveLocalParam, which rewrites only dot-relative selectors, and it broke home-relative selectors: `file:~/pkg` became `<base_dir>/~/pkg`, defeating the resolver's `~` expansion. Rewrite only dot-relative selectors, matching pnpm, and pass bare names, `~/`, and absolute selectors through unchanged. Cover the passthrough with a regression test.
|
Code review by qodo was updated up to the latest commit 4e9b4b4 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
Summary
Fix the native pnpm
setupflow, which recursively runs:The Rust CLI rejected
--ignore-scriptsonadd. Once accepted, the setup command also exposed two existing gaps in global local-directory installs: the package alias was not inferred frompackage.json, and unresolved..components could break directory fetching when the temporary and global directories crossed a symlinked filesystem root.This restores the behavior already supported by the TypeScript CLI by:
--ignore-scriptsand--no-ignore-scriptsto add configuration;file:directory selectors;Related to #12955.
Squash Commit Body
Checklist
pnpm/port.pnpm changeset) forpacquet.Written by an agent (GitHub Copilot CLI, gpt-5.6-sol).
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
New Features
--ignore-scriptsand--no-ignore-scriptsoptions to theaddcommand.file:directories, including unnamed packages.Bug Fixes
pnpm setupcould fail due to a globally installed native CLI executable.Tests
pnpm add -g --ignore-scriptswith local directories.file:alias derivation.Chores