Repository navigation
Conversation
Global bins dispatch through `pnpm --shim` and prefer the nearest project's version of the invoked bin — bare `node` follows the project's devEngines pin, downloading it on demand when missing. First use of a project's bins prompts for trust; decisions persist machine-locally. `globalShims: false` restores direct shims. Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
|
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 change adds configurable context-aware global shims. It links direct or dispatcher-backed binaries, resolves project-local candidates and managed runtimes, persists trust decisions, supports Unix and Windows execution, and adds configuration, unit, and end-to-end tests. ChangesContext-aware global shims
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant GeneratedShim
participant ShimDispatcher
participant ProjectLocalBin
participant GlobalTarget
User->>GeneratedShim: Invoke global binary
GeneratedShim->>ShimDispatcher: Pass shim metadata and arguments
ShimDispatcher->>ProjectLocalBin: Resolve project candidate
ShimDispatcher->>ShimDispatcher: Apply policy and trust checks
ShimDispatcher->>GlobalTarget: Execute global fallback
ShimDispatcher->>User: Return command status
Assessment against linked issues
Out-of-scope changes
Possibly related issues
Possibly related PRs
Suggested labels: ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Micro-Benchmark ResultsLinux |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #13731 +/- ##
==========================================
- Coverage 88.23% 88.09% -0.14%
==========================================
Files 616 621 +5
Lines 100167 101071 +904
==========================================
+ Hits 88380 89042 +662
- Misses 11787 12029 +242 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The local candidate must be provided by the same-named package as the global bin, and the trust prompt is skipped when the project's lockfile has a matching machine-local verification record. `globalShims: false` now also disables dispatch immediately, without relinking. Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
Integrated-Benchmark Report (Linux)Commit: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time). Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.54986082096,
"stddev": 0.1179452839186949,
"median": 2.54629120176,
"user": 1.6926766399999997,
"system": 1.32721224,
"min": 2.3459975862599998,
"max": 2.73496087426,
"times": [
2.66424126726,
2.58643946826,
2.65940376126,
2.55576067026,
2.43731751426,
2.3459975862599998,
2.73496087426,
2.45251924626,
2.53682173326,
2.52514608826
]
},
{
"command": "pacquet@main",
"mean": 2.46914064666,
"stddev": 0.09648357096323633,
"median": 2.45071661726,
"user": 1.6833124399999995,
"system": 1.31363094,
"min": 2.32991980126,
"max": 2.64001361826,
"times": [
2.64001361826,
2.32991980126,
2.37052873326,
2.45590538526,
2.4314182402599998,
2.53181265026,
2.54113287226,
2.44552784926,
2.38834942926,
2.5567978872599997
]
},
{
"command": "pnpr@HEAD",
"mean": 1.53302262876,
"stddev": 0.1956214734214914,
"median": 1.46321307876,
"user": 1.2078122399999998,
"system": 1.1289385399999998,
"min": 1.34076701626,
"max": 1.7897351872599998,
"times": [
1.7897351872599998,
1.7102140292599999,
1.37900834326,
1.3467471872599999,
1.54741781426,
1.36916616426,
1.35267563526,
1.76075308226,
1.34076701626,
1.73374182826
]
},
{
"command": "pnpr@main",
"mean": 1.5478834895600002,
"stddev": 0.164577655892559,
"median": 1.5690951652599998,
"user": 1.1955142399999998,
"system": 1.1257061399999997,
"min": 1.34138880726,
"max": 1.74721038426,
"times": [
1.36402813126,
1.71178711626,
1.44688370726,
1.34138880726,
1.71455073426,
1.6423029332599999,
1.6620879522599998,
1.49588739726,
1.74721038426,
1.3527077322599999
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.25752855504000005,
"stddev": 0.007846466538850379,
"median": 0.2566755298400001,
"user": 0.19779014,
"system": 0.52205956,
"min": 0.24274445734,
"max": 0.27010215734000004,
"times": [
0.26884955534000005,
0.27010215734000004,
0.25776503934000006,
0.25558602034000005,
0.25466975534,
0.25348542534,
0.25881731134,
0.25960436434000006,
0.24274445734,
0.25366146434000003
]
},
{
"command": "pacquet@main",
"mean": 0.24993125444000003,
"stddev": 0.0039837802987769105,
"median": 0.25141574734000005,
"user": 0.19161274,
"system": 0.51628576,
"min": 0.24343411034,
"max": 0.25455467934000003,
"times": [
0.25452749334,
0.25213233934,
0.25132403734000003,
0.25179824834000003,
0.25150745734,
0.24898507434,
0.24720267534,
0.24384642934,
0.25455467934000003,
0.24343411034
]
},
{
"command": "pnpr@HEAD",
"mean": 0.27056379824000004,
"stddev": 0.005582879545657246,
"median": 0.26994199084000003,
"user": 0.21009583999999998,
"system": 0.5068370600000001,
"min": 0.26130962234000005,
"max": 0.27989525334000004,
"times": [
0.27844317534,
0.26130962234000005,
0.27246599534000004,
0.27209265734000004,
0.27989525334000004,
0.27137742934000003,
0.26773587934000004,
0.26713604034000005,
0.26667537734,
0.26850655234000004
]
},
{
"command": "pnpr@main",
"mean": 0.26870538964000007,
"stddev": 0.005569715542129626,
"median": 0.26992118084000005,
"user": 0.20247014000000002,
"system": 0.51522036,
"min": 0.25703427534,
"max": 0.27783864134,
"times": [
0.26995114634000006,
0.27783864134,
0.25703427534,
0.27136020534000005,
0.27090069434,
0.26989121534000005,
0.26815329334000004,
0.26257317134,
0.26810285034000003,
0.27124840334000005
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.5814473582,
"stddev": 0.013112597450885517,
"median": 2.5785716287,
"user": 1.6625702,
"system": 1.3540859399999998,
"min": 2.5652597067,
"max": 2.6047286766999997,
"times": [
2.5797711557,
2.5986888577,
2.6047286766999997,
2.5747052977,
2.5799793747,
2.5917878937,
2.5773721017,
2.5652597067,
2.5764586537,
2.5657218637
]
},
{
"command": "pacquet@main",
"mean": 2.5762761228999995,
"stddev": 0.01230036996410497,
"median": 2.5786600932,
"user": 1.6857205999999998,
"system": 1.3100481399999997,
"min": 2.5454177377000002,
"max": 2.5924578557,
"times": [
2.5814311307,
2.5820000897,
2.5706420437,
2.5924578557,
2.5773491056999998,
2.5767982206999998,
2.5824009457,
2.5799710807,
2.5742930187,
2.5454177377000002
]
},
{
"command": "pnpr@HEAD",
"mean": 1.6049670654,
"stddev": 0.1607845591072967,
"median": 1.5619662312,
"user": 1.1794759,
"system": 1.1573123399999998,
"min": 1.4361766367,
"max": 1.8315405677,
"times": [
1.4477285247,
1.4361766367,
1.4549244827,
1.4966994067,
1.8233341747,
1.8315405677,
1.6272330557,
1.4900072627,
1.7736987496999999,
1.6683277927
]
},
{
"command": "pnpr@main",
"mean": 1.5946473782,
"stddev": 0.11514489495455243,
"median": 1.5821698311999999,
"user": 1.1627157000000001,
"system": 1.1564446399999997,
"min": 1.4649838327,
"max": 1.8015499737,
"times": [
1.5483885947,
1.8015499737,
1.6277209017,
1.4773434167000001,
1.7634904817,
1.6159510677,
1.6184127947,
1.5260864277000001,
1.5025462907,
1.4649838327
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.43041249608000004,
"stddev": 0.009205502422618323,
"median": 0.42719391338,
"user": 0.5171555399999999,
"system": 0.7123398599999999,
"min": 0.42170164938000004,
"max": 0.44795387138000003,
"times": [
0.43245454038000003,
0.42329510638,
0.44795387138000003,
0.42170164938000004,
0.42965421138000004,
0.43566690938,
0.44275603338,
0.42329072938,
0.42473361538000004,
0.42261829438000004
]
},
{
"command": "pacquet@main",
"mean": 0.41380691888000004,
"stddev": 0.012364280710981576,
"median": 0.41258977788000006,
"user": 0.5050571399999999,
"system": 0.68341186,
"min": 0.39033771438000003,
"max": 0.43058631238,
"times": [
0.39033771438000003,
0.40674837138000003,
0.41366391038,
0.43058631238,
0.40973681938,
0.41314036538000004,
0.42717743238000006,
0.41203919038000003,
0.40569840638000004,
0.42894066638
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29955244287999994,
"stddev": 0.012433980735551544,
"median": 0.29731925638,
"user": 0.17289503999999997,
"system": 0.5185278600000001,
"min": 0.28869273738,
"max": 0.33096331338,
"times": [
0.33096331338,
0.29374505638000004,
0.28869273738,
0.29417783138000003,
0.30046068138000004,
0.30178756338,
0.28989911938,
0.28960941338,
0.30389599938,
0.30229271338
]
},
{
"command": "pnpr@main",
"mean": 0.29754652938000004,
"stddev": 0.005631096114491589,
"median": 0.29587032788,
"user": 0.18580484,
"system": 0.5046524600000001,
"min": 0.29038724238,
"max": 0.30660642938000005,
"times": [
0.29551850138,
0.30660642938000005,
0.30263900438,
0.30111301938,
0.30374430338,
0.29134284338,
0.29038724238,
0.29237329438000004,
0.29586092738,
0.29587972838000004
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.71783635592,
"stddev": 0.0072803445768385155,
"median": 1.7172805957200001,
"user": 0.7617416799999999,
"system": 0.7651285800000001,
"min": 1.7018894357199998,
"max": 1.72783554272,
"times": [
1.71773493772,
1.7140692367200001,
1.7234740047200001,
1.7146557197199999,
1.71544571772,
1.72422072272,
1.72221198772,
1.71682625372,
1.7018894357199998,
1.72783554272
]
},
{
"command": "pacquet@main",
"mean": 1.7219165517200001,
"stddev": 0.008838393112349047,
"median": 1.72401448622,
"user": 0.76664518,
"system": 0.7715561799999999,
"min": 1.71019281972,
"max": 1.73852237472,
"times": [
1.71222571772,
1.7260975567199999,
1.72863794272,
1.71841739372,
1.7251967797199999,
1.7241903247200001,
1.71184595972,
1.71019281972,
1.73852237472,
1.7238386477199998
]
},
{
"command": "pnpr@HEAD",
"mean": 0.30142079712,
"stddev": 0.005973566785481777,
"median": 0.30083247172000005,
"user": 0.17409038,
"system": 0.52627728,
"min": 0.29336296072,
"max": 0.31019891472000005,
"times": [
0.30441044272,
0.29502232472,
0.31019891472000005,
0.29788083972,
0.30336948572000005,
0.29336296072,
0.30462498072000005,
0.31000594472000004,
0.29703661972,
0.29829545772000005
]
},
{
"command": "pnpr@main",
"mean": 0.29900640122000005,
"stddev": 0.005586581740201195,
"median": 0.29871230122000003,
"user": 0.18875577999999998,
"system": 0.51159618,
"min": 0.28671704072000004,
"max": 0.30668241972000004,
"times": [
0.29688189772,
0.29761916372,
0.29971992372,
0.29770467872,
0.30249307272000003,
0.30526892172000003,
0.29620970972000005,
0.30076718372000005,
0.28671704072000004,
0.30668241972000004
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2276148973123077,
"stddev": 0.01706237188423311,
"median": 0.22349846662,
"user": 0.1692757969230769,
"system": 0.07914290615384616,
"min": 0.19501460562,
"max": 0.25844027062,
"times": [
0.22349846662,
0.24618789962,
0.23103194562,
0.23321543662,
0.22084203062,
0.22330904162,
0.21416615262,
0.25844027062,
0.19501460562,
0.20927409762,
0.21972242462,
0.23998626962,
0.24430502362
]
},
{
"command": "pacquet@main",
"mean": 0.22424006534727275,
"stddev": 0.022929821422242886,
"median": 0.22473770062,
"user": 0.16194353818181814,
"system": 0.08488378727272727,
"min": 0.19895781162,
"max": 0.26921996362000006,
"times": [
0.25341404662000006,
0.21694149462,
0.23094292462,
0.26921996362000006,
0.22473770062,
0.20100521262,
0.22537621862,
0.23919356862,
0.20072396062,
0.20612781662,
0.19895781162
]
},
{
"command": "pnpr@HEAD",
"mean": 0.09083522840125002,
"stddev": 0.00393176462394708,
"median": 0.09105020762,
"user": 0.023058688750000004,
"system": 0.010704903750000001,
"min": 0.08572246562000001,
"max": 0.10322068262,
"times": [
0.08910779062,
0.08731369062000001,
0.09627648562,
0.08588867562000001,
0.10322068262,
0.09766356762,
0.09243799762,
0.08862850762,
0.08935342562000001,
0.09110987162,
0.09183614362,
0.09566755062000001,
0.08975447062000001,
0.08615738662000001,
0.09157224262000001,
0.09147684262000001,
0.09587873462,
0.09456667062,
0.09247294662000001,
0.09099054362,
0.09025293862000001,
0.08699346162,
0.08801078962,
0.09121776262,
0.09152735362,
0.09116887962,
0.08588747062,
0.08768510462000001,
0.08896958962000001,
0.09167160262000001,
0.08572246562000001,
0.08624566262000001
]
},
{
"command": "pnpr@main",
"mean": 0.08937266437000001,
"stddev": 0.003676474525880055,
"median": 0.08927799112000001,
"user": 0.022345188749999995,
"system": 0.01011752125,
"min": 0.08505701262000001,
"max": 0.10422950462000001,
"times": [
0.08709938462000001,
0.08681613562000001,
0.08542851762,
0.08575303662,
0.08704321062,
0.09213575462000001,
0.08680077862,
0.08999275162,
0.09154120162000001,
0.09021131962000001,
0.08659280862,
0.08569388362000001,
0.08909990562,
0.08984680962000001,
0.08591932262,
0.08600353862000001,
0.08729725362,
0.08505701262000001,
0.09231899262000001,
0.09100235962000001,
0.09341620162000001,
0.08865746462,
0.09059378862,
0.08793934262000001,
0.08945607662,
0.09296411862000001,
0.09079182562,
0.10422950462000001,
0.09057361362,
0.08664052162000001,
0.09138411562000001,
0.09162470762000001
]
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.8369239411666667,
"stddev": 0.1837771536106097,
"median": 0.8787906785,
"user": 0.7714447711111112,
"system": 0.18053236666666667,
"min": 0.5823475945000001,
"max": 1.1087443315,
"times": [
0.9949708155000001,
1.1087443315,
0.5984146215,
0.8999850395000001,
0.7574071055,
0.5823475945000001,
0.8787906785,
0.9915925745,
0.7200627095000001
]
},
{
"command": "pacquet@main",
"mean": 0.7089368046111111,
"stddev": 0.17259518829245743,
"median": 0.6139533105,
"user": 0.6533839933333332,
"system": 0.12795014444444444,
"min": 0.5362306405,
"max": 1.0158318545,
"times": [
1.0158318545,
0.6139533105,
0.5921443015,
0.5924739695,
0.7375036335,
0.7829195725,
0.5708403235,
0.5362306405,
0.9385336355
]
},
{
"command": "pnpm@HEAD",
"mean": 2.9751876411666665,
"stddev": 0.1314744864693575,
"median": 2.9059559975,
"user": 4.239877326666667,
"system": 0.3024988111111111,
"min": 2.8698771655,
"max": 3.2294902135,
"times": [
2.8826679405,
2.8974163545000002,
2.8927934705000005,
3.0337030285,
2.9059559975,
3.2294902135,
2.8698771655,
2.9175764785000005,
3.1472081215000003
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.573552040200001,
"stddev": 0.1656655022534087,
"median": 4.5014065406,
"user": 1.82367338,
"system": 1.43956484,
"min": 4.4302946766,
"max": 4.8817626076,
"times": [
4.6008107296,
4.4513517576,
4.5112756296,
4.8461423506,
4.4302946766,
4.4458169806,
4.8817626076,
4.4915374516,
4.4604945346000004,
4.6160336835999995
]
},
{
"command": "pacquet@main",
"mean": 4.5154938575,
"stddev": 0.09402895102261251,
"median": 4.4843359191,
"user": 1.8679870800000002,
"system": 1.4219491399999997,
"min": 4.4291653596,
"max": 4.6757731066,
"times": [
4.4291653596,
4.4420978376,
4.5664581696,
4.4678715336,
4.6711363856,
4.4456548986,
4.6757731066,
4.5008003046,
4.5229779346,
4.4330030446
]
},
{
"command": "pnpr@HEAD",
"mean": 3.5335622494999996,
"stddev": 0.12479789014844664,
"median": 3.4780203351,
"user": 1.32801828,
"system": 1.2212861399999997,
"min": 3.4510369976,
"max": 3.8251333786,
"times": [
3.4961306106,
3.4900235896,
3.4553240056,
3.5459571956,
3.4604696656,
3.4591949736,
3.6863349976,
3.4510369976,
3.8251333786,
3.4660170806
]
},
{
"command": "pnpr@main",
"mean": 3.500476856,
"stddev": 0.039378287024118185,
"median": 3.4805854976,
"user": 1.30061488,
"system": 1.23425634,
"min": 3.4534865476,
"max": 3.5626771436,
"times": [
3.4729845096,
3.5240771166,
3.4677022756,
3.4842804856000003,
3.5394998246,
3.4768905096,
3.4734819846000002,
3.5626771436,
3.5496881626,
3.4534865476
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13731 |
| 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,436.18 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 293.36 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 288.69 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 85.72 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,340.77 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,451.04 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 261.31 ms |
Default globalShims to auto. It follows only publisher-signature-verified stable Node.js pins. Resolve runtimes from the trusted global virtual store. Do not consult project bin entries. Keep ordinary package switching behind globalShims: all, retain off and the one-shot bypass. Install a native Windows node.exe dispatcher with a recorded direct fallback.
The dispatcher's mode now reads the pnpm home's own pnpm-workspace.yaml directly instead of walking the home's ancestors, so an unrelated workspace above the pnpm home can no longer influence dispatch. The Windows node dispatcher refuses a target file that points back at itself instead of recursing. A fallback shim the host cannot execute degrades to the embedded target instead of failing the invocation. Co-Authored-By: Claude Fable 5 <[email protected]>
`globalShims` selects eligible packages as a record of package names
to booleans, keyed by the providing package's manifest name and
merged key-wise over the built-in { node, deno, bun } defaults across
config layers, with scalar false/true shorthands. Eligibility stays
orthogonal to trust: signature-verified stable Node runs promptless,
every other eligible candidate keeps the candidate-bound prompt.
Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
The setting is now `contextAwareGlobalShims` — every global bin is a shim either way; what the record controls is which ones are context-aware. Values grow from booleans into policies: `true` defers to artifact authentication, `"trusted"` pre-answers the trust prompt for a package (machine-local consent a repository cannot grant itself, and the CI story for unsigned runtime pins), `"prompt"` always asks even for authenticated candidates, `false` disables the package's shim. Co-Authored-By: Claude Fable 5 <[email protected]>
…cy to always
In the version-manager lineage (rbenv, asdf, Volta, corepack, mise) a
shim is by definition the executable that picks the project's version,
so the short name is the ecosystem-correct one; the context-aware
qualifier restated an internal implementation contrast users don't
share. The `"trusted"` value read ambiguously as a condition
("only when the source is trusted") when it grants consent, so it is
now `"always"`: always switch, never prompt.
Co-Authored-By: Claude Fable 5 <[email protected]>
With "prompt" and "always" in the vocabulary, a bare true sat next to them as a third, unnamed policy. "auto" names it — defer to artifact authentication — and the booleans stay as shorthand (true ≡ "auto", false ≡ disabled). Co-Authored-By: Claude Fable 5 <[email protected]>
The cfg(windows) test still passed the raw target path where validate_candidate now takes the resolved provider; Linux builds never compile it, so Windows CI was the first to see the mismatch. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Code review by qodo was updated up to the latest commit 623e6c5 |
The trust prompt leaves a human-scale window between fingerprinting a candidate and executing it; a bin swapped during that window would run without approval. Revalidating right before exec closes it — the residual race is process-scale and requires an attacker already executing code as the user, outside the gate's threat model. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Code review by qodo was updated up to the latest commit 1abb732 |
The managed runtime dispatcher read the entire pnpm executable to detect libc on every invocation. Since the bundled executable is tens of megabytes, this dominated otherwise warm runtime dispatch. Detect libc by opening /proc/self/exe and seeking only to the bounded ELF header, program-header table, and PT_INTERP value. Preserve the existing filesystem and command fallbacks for malformed or unsupported ELF layouts. Do not add persistent launcher state: every managed runtime invocation continues through the existing materialization path and reloads current trusted configuration. This brings warm runtime dispatch close to direct process startup without introducing cache invalidation or a new executable-path trust surface. Related to #13731.
Summary
Closes #13735.
Bins installed into the global bin dir (
pnpm add -g,pnpm runtime set node -g) become context-aware shims: typing barenodeinside a project runs the Node.js version the project pins throughdevEngines.runtime/engines.runtime, with the release authenticated and executed from pnpm's trusted global virtual store. This is the fnm/nodenv workflow — bare commands following the project you're standing in — but per-invocation instead of per-cd, so it needs no shell hooks and also covers scripts, CI, and editors that spawnnodewith a project cwd.Each context-aware shim dispatches through a protocol-versioned executable (
.pnpm-shim-v1) installed next to it, so replacing the mainpnpmbinary with an older version never breaks the global bins; self-update refreshes an existing dispatcher from the newly installed v12+ engine, while leaving it absent for users who have not enabled context-aware shims and preserving it across downgrades. When the dispatcher is missing, shims degrade to direct execution of the global target.The new
globalShimssetting is a record of package names to policies selecting which globally installed packages are project-aware, keyed by the providing package's manifest name (sotypescript: truecoverstsc):{ node: true, deno: true, bun: true }. Layers merge key-wise (default → globalconfig.yaml→ the pnpm home'spnpm-workspace.yaml→ env), soglobalShims: { bun: false }switches one default off without restating the rest, and{ typescript: true }adds prompted switching for another package."auto"(shorthand:true) defers to artifact authentication — a stable Node.js pin runs without prompting because the release is authenticated against the Node.js release-team signatures, every other candidate keeps the candidate-boundDo you trust this project?prompt, and if Deno/Bun releases gain publisher signatures later they become promptless with no config change."always"switches without ever asking — a deliberate, machine-local consent a repository cannot grant itself, which is also the CI story for unsigned runtime pins."prompt"always asks, even for authenticated candidates.falsedisables the package's shim.globalShims: false(disable everything) andtrue(just the defaults) are accepted;PNPM_SHIM_BYPASS=1is a one-invocation bypass. The runtime names only qualify when actually installed through theruntime:protocol, so an npm package that happens to be callednodeis not elevated.Security posture:
node_modules/.bin; a compromised local shim cannot become the executable. The selected release is materialized with scripts and project dependency rewrites disabled, and the resolved package and executable must canonicalize inside the trusted store.supportedArchitecturescross-target overrides never select a different binary than the policy checked.%%);.cmd/.battargets are spawned through the standard library's CVE-2024-24576 argument escaping; project-local candidate lookup never accepts a.exe(identity is derived from the sibling script, so a planted binary cannot ride a benign script's validation); and the test-only trust escape hatch is compiled out of release builds.Do you trust this project?on the terminal. Approvals are recorded machine-locally, bound to the provider manifest, canonical target, shim contents, and file identity, so a changed checkout or replaced bin cannot inherit an earlier approval. Non-interactive sessions fall back to the global command.pnpm-workspace.yaml, and the globalconfig.yaml— with no ancestor discovery, so neither a repository nor an unrelated workspace above the pnpm home can influence dispatch. TurningglobalShimsoff takes effect immediately, without relinking.On Windows, globally installed Node.js uses the native dispatcher as
node.exe, with the original managed executable recorded as its direct fallback, so programs can continue spawningnode.exewithout a shell.This is intentionally a Rust pnpm v12 breaking change; TypeScript pnpm parity is not required.
Squash Commit Body
Checklist
pnpm/port only — deliberately: it is a v12-only breaking change and the TypeScript CLI will not receive it (see Summary).pnpm changeset) forpacquet.globalShimsand the trust prompt is a follow-up once the design settles in review.Written by agents (Claude Code, claude-fable-5; Codex, GPT-5.6).
Summary by CodeRabbit
New Features
off,auto,prompt, andalwayspolicies with per-package overrides.PNPM_SHIM_BYPASS=1for per-invocation bypassing.Bug Fixes