Skip to content

fix(setup): stop writing .ps1 wrappers for the pn, pnpx, and pnx aliases - #16219

Merged
zkochan merged 2 commits into
mainfrom
fix/drop-alias-ps1
Sep 26, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix/drop-alias-ps1

Conversation

@zkochan

@zkochan zkochan commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Summary

pnpm setup wrote pn.ps1, pnpx.ps1, and pnx.ps1 next to the .cmd wrappers. PowerShell prefers a .ps1 over a .cmd, so under the default Restricted execution policy on Windows client the aliases failed with "not digitally signed", while pnpm itself worked because the bin linker already omits pnpm.ps1.

The wrappers added nothing: each one only called pnpm.cmd, which is also what pn.cmd calls. They also dropped a bare -- from the arguments, which is the reason pnpm has no .ps1 either (#3168).

This PR stops writing them and removes ones left by an earlier run. The change is in every writer:

  • v12 pnpm setup (pnpm/crates/cli/src/cli_args/setup.rs)
  • v11 pnpm setup (pnpm11/engine/pm/commands/src/setup/setup.ts)
  • the @pnpm/exe prepare script, which ships these wrappers for installs whose scripts did not run

PowerShell shims for other packages' bins are unchanged. They run node directly, which avoids the batch-job Ctrl+C prompt. A pnpm.ps1 that npm or corepack writes in the Node.js directory is outside pnpm's control.

Closes #8444

Squash Commit Body

PowerShell prefers a .ps1 over a .cmd of the same name, so under the
default Restricted execution policy on Windows client `pn` failed with
"not digitally signed" while `pnpm` worked. The wrappers only called
pnpm.cmd, since the bin linker already omits pnpm.ps1, so they added no
behavior. They also dropped a bare `--` from the arguments, the reason
pnpm itself has no .ps1 (pnpm/pnpm#3168).

Both setup implementations and the @pnpm/exe prepare script now write
only the .cmd form and delete a .ps1 left by an earlier run.

Closes pnpm/pnpm#8444

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

Written by an agent (Claude Code, claude-opus-5-5).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • On Windows, pnpm setup no longer creates PowerShell .ps1 alias wrappers and removes stale ones from previous setups. Use the .cmd wrappers instead; this avoids errors caused by PowerShell script execution policies.
    • Packaged Windows aliases use .cmd wrappers.

PowerShell prefers a .ps1 over a .cmd of the same name, so under the
default Restricted execution policy on Windows client `pn` failed with
"not digitally signed" while `pnpm` worked. The wrappers only called
pnpm.cmd, since the bin linker already omits pnpm.ps1, so they added no
behavior. They also dropped a bare `--` from the arguments, the reason
pnpm itself has no .ps1 (#3168).

Both setup implementations and the `@pnpm/exe` prepare script now write
only the .cmd form and delete a .ps1 left by an earlier run.

Closes #8444

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: pnpm/pnpm/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 352619ff-3280-42be-ae91-b4c000af0796

📥 Commits

Reviewing files that changed from the base of the PR and between 96276fd and 0645db0.

📒 Files selected for processing (2)
  • .changeset/drop-alias-ps1-wrappers.md
  • pnpm11/engine/pm/commands/src/setup/setup.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/drop-alias-ps1-wrappers.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

Windows setup and executable preparation now create .cmd aliases, stop creating .ps1 aliases, and remove stale .ps1 files. Tests cover .cmd execution and stale-file removal. The executable package allowlist no longer includes the PowerShell alias files.

Changes

Windows alias wrapper updates

Layer / File(s) Summary
pnpm setup alias behavior
pnpm11/engine/pm/commands/src/setup/setup.ts, pnpm11/engine/pm/commands/test/setup/setup.test.ts
Windows setup creates .cmd aliases and removes stale .ps1 aliases. Tests cover .cmd execution and stale alias cleanup.
CLI setup alias behavior
pnpm/crates/cli/src/cli_args/setup.rs, pnpm/crates/cli/src/cli_args/setup/tests.rs
The Windows CLI setup writer removes stale .ps1 aliases instead of generating them. Tests cover .cmd wrappers and stale-file removal.
Executable package alias behavior
pnpm11/pnpm/artifacts/exe/prepare.js, pnpm11/pnpm/artifacts/exe/package.json, pnpm11/pnpm/artifacts/exe/test/setup.test.ts, .changeset/drop-alias-ps1-wrappers.md
Executable preparation removes .ps1 aliases, and the package allowlist excludes them. Tests retain .cmd coverage and check .ps1 absence. The changeset records patch releases and the alias-wrapper change.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Assessment against linked issues

Objective Addressed Explanation
Allow pnpm setup from Corepack PowerShell without requiring execution-policy changes [#8444] ❌ The issue reports failure in pnpm.ps1. The changes remove the pn, pnpx, and pnx alias scripts, but do not change pnpm.ps1.

Out-of-scope changes

Code Change Explanation
Remove pn.ps1, pnpx.ps1, and pnx.ps1 aliases (pnpm11/engine/pm/commands/src/setup/setup.ts:243-248; pnpm/crates/cli/src/cli_args/setup.rs:311-314; pnpm11/pnpm/artifacts/exe/prepare.js:42-44) Issue #8444 reports a failure in pnpm.ps1; it does not state an objective for the separate pn, pnpx, or pnx aliases.

Suggested labels: product: pnpm@11, product: pacquet

Merge Risk: ⚪ Minimal · up to 0645d

This change stops writing PowerShell alias scripts that can fail under default execution policy and removes stale ones. No risk to merging was identified from the supplied evidence.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 96276

The change removes PowerShell wrappers that can block the aliases and retains the existing command wrappers. No newly introduced security issue was established. Cleanup can remain incomplete if setup is interrupted, and security coverage is incomplete.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed executable-resolution behavior is scoped to pn, pnpx, and pnx in the Windows alias directories managed by these writers.

Trust Boundaries and Controls

  • observed — The executable-preparation wrappers' use of the caller's PATH predates this change; removing their .ps1 form does not introduce that lookup.

Resilience and Maintainability Implications

  • inferred — Stale-wrapper removal is needed for the intended PowerShell resolution after an upgrade, but it is not atomic with .cmd creation. The same-name .ps1 replacement and write ordering existed in the previous writers, so this does not establish a newly worsened attack path.
✨ Finishing Touches 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

pnpm11/engine/pm/commands/src/setup/setup.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

codecov-commenter commented Sep 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.05%. Comparing base (be6c05d) to head (0645db0).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/cli/src/cli_args/setup.rs 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16219      +/-   ##
==========================================
+ Coverage   92.03%   92.05%   +0.01%     
==========================================
  Files        1485     1485              
  Lines      200060   200055       -5     
==========================================
+ Hits       184129   184152      +23     
+ Misses      15931    15903      -28     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.02     11.0±0.10ms    34.0 MB/sec    1.00     10.8±0.18ms    34.6 MB/sec
packument/parse                                  1.03     38.4±0.76µs  1727.8 MB/sec    1.00     37.4±0.58µs  1771.8 MB/sec
tarball/download_dependency                      1.00      4.9±0.23ms   886.1 KB/sec    1.01      5.0±0.22ms   874.4 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    172.4±3.79ms 92.8 KElem/sec    1.01    173.4±2.12ms 92.3 KElem/sec
workspace_resolution/hoist_heavy                 1.02    233.7±2.18ms        ? ?/sec    1.00    228.5±1.53ms        ? ?/sec
workspace_sort/chained_projects                  1.03     12.1±0.63ms        ? ?/sec    1.00     11.8±0.53ms        ? ?/sec

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Same-run regression check

HEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval.

Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2419.99 ms 2386.66 ms -1.4% 121.00 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1485.89 ms 1466.21 ms -1.3% 74.29 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 217.72 ms 218.89 ms 0.5% 10.89 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 304.76 ms 272.23 ms -10.7% 15.24 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 10.88 ms 11.14 ms 2.4% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 11.56 ms 10.64 ms -7.9% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 7.46 ms 7.50 ms 0.5% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 7.12 ms 7.61 ms 7.0% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2524.96 ms 2513.91 ms -0.4% 126.25 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1521.79 ms 1509.89 ms -0.8% 76.09 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 488.53 ms 508.93 ms 4.2% 24.43 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 296.33 ms 294.90 ms -0.5% 14.82 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1645.63 ms 1633.05 ms -0.8% 82.28 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 282.52 ms 298.13 ms 5.5% 14.13 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pacquet 201.81 ms 208.05 ms 3.1% 10.09 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 94.50 ms 95.69 ms 1.3% 4.73 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 781.76 ms 754.13 ms -3.5% 39.09 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 213.75 ms 266.75 ms 24.8% 10.69 ms Inconclusive (overlapping samples)
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4378.73 ms 4390.48 ms 0.3% 218.94 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3465.27 ms 3371.31 ms -2.7% 173.26 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 114.24 ms 116.39 ms 1.9% 5.71 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 131.86 ms 132.27 ms 0.3% 6.59 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: 0645db003ab5

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked-workspace scenario compares current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.461 ± 0.157 2.303 2.691 1.64 ± 0.18
pacquet@main 2.474 ± 0.135 2.330 2.648 1.65 ± 0.18
pnpr@HEAD 1.503 ± 0.124 1.339 1.697 1.00 ± 0.12
pnpr@main 1.498 ± 0.138 1.337 1.708 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.46105154258,
      "stddev": 0.15670044983469808,
      "median": 2.38666311278,
      "user": 1.50183088,
      "system": 1.45861638,
      "min": 2.30337854778,
      "max": 2.6912539357800003
    },
    {
      "command": "pacquet@main",
      "mean": 2.4741610508800003,
      "stddev": 0.13514255017234314,
      "median": 2.41998527428,
      "user": 1.58686018,
      "system": 1.5327923799999998,
      "min": 2.3295154467800003,
      "max": 2.6482352827800004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.50291257968,
      "stddev": 0.12370835886329393,
      "median": 1.4662148527799999,
      "user": 1.3024529800000002,
      "system": 1.2832256799999997,
      "min": 1.3394016337799999,
      "max": 1.69664731278
    },
    {
      "command": "pnpr@main",
      "mean": 1.4977749264799998,
      "stddev": 0.1375368572259019,
      "median": 1.4858908952799998,
      "user": 1.3481816800000002,
      "system": 1.3176845799999999,
      "min": 1.3365597487799998,
      "max": 1.70769632178
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 221.6 ± 10.2 208.9 240.2 1.01 ± 0.06
pacquet@main 220.0 ± 9.7 212.2 245.6 1.00
pnpr@HEAD 275.3 ± 13.1 253.1 300.8 1.25 ± 0.08
pnpr@main 311.6 ± 40.5 268.1 390.8 1.42 ± 0.19
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.22164826314000002,
      "stddev": 0.010172042917961699,
      "median": 0.21888901424,
      "user": 0.23825085999999995,
      "system": 0.5379263999999999,
      "min": 0.20887769024000002,
      "max": 0.24022725924000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.21997953804000003,
      "stddev": 0.009710563840102063,
      "median": 0.21772213974000001,
      "user": 0.24559505999999995,
      "system": 0.5310741,
      "min": 0.21215472024,
      "max": 0.24558727824
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27526562354000006,
      "stddev": 0.013138437623531495,
      "median": 0.27223363074000007,
      "user": 0.29004815999999994,
      "system": 0.6164862999999998,
      "min": 0.25306197624000004,
      "max": 0.30076640324000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.31163326314,
      "stddev": 0.040539191760613956,
      "median": 0.30476133524000004,
      "user": 0.34144845999999995,
      "system": 0.7091280999999999,
      "min": 0.26807714624,
      "max": 0.39084943924000004
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 11.4 ± 1.6 8.7 16.4 1.03 ± 0.21
pacquet@main 11.1 ± 1.6 8.7 17.3 1.00
pnpr@HEAD 11.1 ± 1.7 8.8 16.5 1.01 ± 0.21
pnpr@main 12.0 ± 1.9 8.8 17.5 1.08 ± 0.23
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.011440725520861242,
      "stddev": 0.001628217561062049,
      "median": 0.011143863540000002,
      "user": 0.006260238660287083,
      "system": 0.005882432631578948,
      "min": 0.00872940854,
      "max": 0.01640460254
    },
    {
      "command": "pacquet@main",
      "mean": 0.011057316100714287,
      "stddev": 0.0015635577319513224,
      "median": 0.01087902104,
      "user": 0.0062939628571428595,
      "system": 0.005446068285714285,
      "min": 0.008662220540000001,
      "max": 0.01729696154
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.011142143161276602,
      "stddev": 0.001657740420351683,
      "median": 0.010642439540000001,
      "user": 0.005710497361702125,
      "system": 0.006139502553191486,
      "min": 0.008777550540000002,
      "max": 0.01652069754
    },
    {
      "command": "pnpr@main",
      "mean": 0.01198299628509804,
      "stddev": 0.0018806176421394343,
      "median": 0.011557891540000002,
      "user": 0.006147315098039209,
      "system": 0.0065579796078431354,
      "min": 0.008770389540000001,
      "max": 0.01746767154
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 7.7 ± 0.8 6.9 12.7 1.07 ± 0.13
pacquet@main 7.5 ± 0.3 6.7 9.8 1.04 ± 0.08
pnpr@HEAD 7.6 ± 0.5 6.7 9.8 1.07 ± 0.09
pnpr@main 7.2 ± 0.4 6.3 9.9 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.0076618628376470595,
      "stddev": 0.0008249599623788266,
      "median": 0.007502095220000001,
      "user": 0.004225296470588236,
      "system": 0.003877005294117646,
      "min": 0.006884429720000001,
      "max": 0.012707534720000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.007481218548282824,
      "stddev": 0.00032956984172380235,
      "median": 0.007461524720000001,
      "user": 0.004624946599326605,
      "system": 0.003312672188552188,
      "min": 0.006728637720000001,
      "max": 0.00976376672
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.007647566150508475,
      "stddev": 0.000463550364610578,
      "median": 0.007614281720000001,
      "user": 0.004527223389830514,
      "system": 0.003592498305084746,
      "min": 0.006676070720000001,
      "max": 0.00978884372
    },
    {
      "command": "pnpr@main",
      "mean": 0.007167953128637872,
      "stddev": 0.0004207324096744657,
      "median": 0.007116887720000001,
      "user": 0.0044108625249169395,
      "system": 0.0031542986046511623,
      "min": 0.006319009720000001,
      "max": 0.009933204720000002
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.517 ± 0.034 2.475 2.576 1.63 ± 0.11
pacquet@main 2.524 ± 0.032 2.483 2.592 1.64 ± 0.11
pnpr@HEAD 1.549 ± 0.132 1.390 1.737 1.00 ± 0.11
pnpr@main 1.542 ± 0.105 1.422 1.687 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5174648395399997,
      "stddev": 0.03380690488118472,
      "median": 2.51391088734,
      "user": 1.8488674999999997,
      "system": 1.5195701199999998,
      "min": 2.47489142884,
      "max": 2.5755328348399997
    },
    {
      "command": "pacquet@main",
      "mean": 2.52379435634,
      "stddev": 0.03201292757351821,
      "median": 2.52495567534,
      "user": 1.8761084999999997,
      "system": 1.5378298200000002,
      "min": 2.4825069318399997,
      "max": 2.59190660784
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5491840625399997,
      "stddev": 0.13177673463443718,
      "median": 1.50989413584,
      "user": 1.1289008999999999,
      "system": 1.21837302,
      "min": 1.38984528684,
      "max": 1.73670595384
    },
    {
      "command": "pnpr@main",
      "mean": 1.54151923704,
      "stddev": 0.1053348569194007,
      "median": 1.5217905583399998,
      "user": 1.210575,
      "system": 1.22261842,
      "min": 1.4221918918399998,
      "max": 1.68660312084
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 508.7 ± 19.1 466.0 529.6 1.72 ± 0.09
pacquet@main 568.8 ± 172.1 437.2 923.3 1.92 ± 0.59
pnpr@HEAD 298.1 ± 10.0 283.4 313.9 1.01 ± 0.05
pnpr@main 296.3 ± 11.4 278.3 315.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5086952820399999,
      "stddev": 0.01911329891008167,
      "median": 0.50893099324,
      "user": 0.70266442,
      "system": 0.75935232,
      "min": 0.46599700424,
      "max": 0.52955410324
    },
    {
      "command": "pacquet@main",
      "mean": 0.5687874809400001,
      "stddev": 0.17213463865356188,
      "median": 0.48852632824000003,
      "user": 0.7648090199999998,
      "system": 0.8569005199999999,
      "min": 0.43722766024000004,
      "max": 0.92327048324
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29807208574,
      "stddev": 0.009964049826105768,
      "median": 0.29489883024,
      "user": 0.27269412000000004,
      "system": 0.56999512,
      "min": 0.28339327524,
      "max": 0.31393147824
    },
    {
      "command": "pnpr@main",
      "mean": 0.29631241814000003,
      "stddev": 0.01142700244753527,
      "median": 0.29632513724000004,
      "user": 0.24704991999999998,
      "system": 0.5734642199999999,
      "min": 0.27831837424000005,
      "max": 0.31507533624
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.641 ± 0.031 1.606 1.691 5.81 ± 0.34
pacquet@main 1.648 ± 0.022 1.620 1.687 5.83 ± 0.33
pnpr@HEAD 0.298 ± 0.007 0.288 0.306 1.05 ± 0.06
pnpr@main 0.283 ± 0.015 0.266 0.309 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.64129670124,
      "stddev": 0.03149783776985795,
      "median": 1.63305364794,
      "user": 0.89048298,
      "system": 0.8424656999999998,
      "min": 1.60563874894,
      "max": 1.69119593394
    },
    {
      "command": "pacquet@main",
      "mean": 1.6483512791400003,
      "stddev": 0.02197206381247702,
      "median": 1.6456337969400001,
      "user": 0.92349508,
      "system": 0.8521993999999999,
      "min": 1.61999903594,
      "max": 1.68679859494
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29756720404000003,
      "stddev": 0.006543239063141249,
      "median": 0.29813429344,
      "user": 0.25143627999999996,
      "system": 0.5748499999999999,
      "min": 0.28755385894,
      "max": 0.30589421394
    },
    {
      "command": "pnpr@main",
      "mean": 0.28267312554,
      "stddev": 0.015405986176146027,
      "median": 0.28251624594,
      "user": 0.22779817999999996,
      "system": 0.5500714999999999,
      "min": 0.26553373394,
      "max": 0.30940053794
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 209.5 ± 12.7 191.6 233.7 2.21 ± 0.16
pacquet@main 204.0 ± 12.1 190.6 229.1 2.15 ± 0.15
pnpr@HEAD 95.9 ± 3.7 90.4 104.6 1.01 ± 0.06
pnpr@main 95.0 ± 3.7 89.2 105.3 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.20948567314000002,
      "stddev": 0.012746883142093686,
      "median": 0.20805094794,
      "user": 0.21263836666666663,
      "system": 0.08940035333333332,
      "min": 0.19160067394000002,
      "max": 0.23365626894000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.20403426544,
      "stddev": 0.012076993659039281,
      "median": 0.20181432794,
      "user": 0.20710974285714284,
      "system": 0.08586254857142857,
      "min": 0.19057672694000002,
      "max": 0.22913083094
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09594576097333335,
      "stddev": 0.0037375705398802936,
      "median": 0.09569146194,
      "user": 0.03301256666666666,
      "system": 0.01960425333333334,
      "min": 0.09042193894,
      "max": 0.10456111094000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.0950025445851613,
      "stddev": 0.0036919501736085627,
      "median": 0.09450306894,
      "user": 0.03404416451612903,
      "system": 0.016710232903225805,
      "min": 0.08918744894000001,
      "max": 0.10525523294
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 769.5 ± 93.6 628.7 962.6 1.05 ± 0.22
pacquet@main 734.6 ± 124.8 521.1 884.8 1.00
pnpm@HEAD 3226.5 ± 238.0 2893.5 3541.8 4.39 ± 0.81
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.7694988441400001,
      "stddev": 0.09357065097777899,
      "median": 0.7541293171400001,
      "user": 0.7794117488888889,
      "system": 0.1914557822222222,
      "min": 0.62872004814,
      "max": 0.9626020861400001
    },
    {
      "command": "pacquet@main",
      "mean": 0.7345890809177779,
      "stddev": 0.12476840334944102,
      "median": 0.7817608821400001,
      "user": 0.7514865266666667,
      "system": 0.17845933777777778,
      "min": 0.52114607814,
      "max": 0.88479789014
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.2264610694733338,
      "stddev": 0.2379787021411211,
      "median": 3.19198406414,
      "user": 4.695109526666666,
      "system": 0.2861075599999999,
      "min": 2.8935340971400003,
      "max": 3.5417503871400005
    }
  ]
}

Scenario: Isolated linker: linked-workspace resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 269.3 ± 16.0 246.0 305.0 1.10 ± 0.24
pacquet@main 245.1 ± 50.9 197.8 331.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.26933310374,
      "stddev": 0.015982227324499967,
      "median": 0.26674581974000006,
      "user": 0.20118186000000002,
      "system": 0.10989059999999999,
      "min": 0.24604748874000001,
      "max": 0.30504045674
    },
    {
      "command": "pacquet@main",
      "mean": 0.24506109592181824,
      "stddev": 0.05092022636403958,
      "median": 0.21374724074,
      "user": 0.18196291454545452,
      "system": 0.1024145909090909,
      "min": 0.19781161974,
      "max": 0.33160332374000007
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.455 ± 0.152 4.305 4.694 1.30 ± 0.07
pacquet@main 4.428 ± 0.132 4.298 4.648 1.29 ± 0.06
pnpr@HEAD 3.436 ± 0.138 3.349 3.713 1.00
pnpr@main 3.514 ± 0.139 3.385 3.770 1.02 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.45493454202,
      "stddev": 0.1519667047305024,
      "median": 4.39047551302,
      "user": 1.4316702,
      "system": 1.49008814,
      "min": 4.30517448952,
      "max": 4.69407817152
    },
    {
      "command": "pacquet@main",
      "mean": 4.42767930732,
      "stddev": 0.13237325692585272,
      "median": 4.378728431020001,
      "user": 1.3842221999999997,
      "system": 1.36856004,
      "min": 4.29813593852,
      "max": 4.64762640952
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.43627374122,
      "stddev": 0.13841419107666808,
      "median": 3.37130896802,
      "user": 1.2690252000000002,
      "system": 1.2984153399999996,
      "min": 3.34903786652,
      "max": 3.71322124752
    },
    {
      "command": "pnpr@main",
      "mean": 3.51356008092,
      "stddev": 0.13911096141168933,
      "median": 3.4652679175200003,
      "user": 1.4563704999999998,
      "system": 1.43701704,
      "min": 3.38478187552,
      "max": 3.77009345752
    }
  ]
}

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

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 116.5 ± 3.5 110.4 122.8 1.00 ± 0.06
pacquet@main 116.4 ± 6.2 108.1 134.8 1.00
pnpr@HEAD 132.6 ± 4.8 126.8 146.3 1.14 ± 0.07
pnpr@main 132.1 ± 3.4 126.4 138.4 1.14 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.11648942729818183,
      "stddev": 0.003499018698859079,
      "median": 0.11639223348000002,
      "user": 0.14894529636363638,
      "system": 0.12798417636363632,
      "min": 0.11035827148000002,
      "max": 0.12279561748000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.11635811988909092,
      "stddev": 0.006212562347024505,
      "median": 0.11423777448000001,
      "user": 0.14672861454545452,
      "system": 0.11915494909090908,
      "min": 0.10810094948000001,
      "max": 0.13480231648000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.13263753163789474,
      "stddev": 0.004798066077954794,
      "median": 0.13227242448,
      "user": 0.1643075547368421,
      "system": 0.1324886452631579,
      "min": 0.12679888248,
      "max": 0.14629135548000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.1321087772168421,
      "stddev": 0.003364403747912235,
      "median": 0.13185502248,
      "user": 0.15825702842105263,
      "system": 0.14257175052631574,
      "min": 0.12644834448,
      "max": 0.13843975548
    }
  ]
}

@zkochan
zkochan marked this pull request as ready for review September 26, 2026 21:22
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Stop generating PowerShell wrappers for Windows pnpm aliases

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Stop setup writers from creating redundant PowerShell wrappers for Windows aliases.
• Remove stale alias .ps1 files so PowerShell resolves supported .cmd wrappers.
• Cover cleanup and CMD delegation across v12, v11, and @pnpm/exe.
Diagram

graph TD
  A["v12 setup"] --> D["Alias writer"] --> E["CMD aliases"] --> F["PowerShell"] --> G["pnpm.cmd"]
  B["v11 setup"] --> D
  C["@pnpm/exe prepare"] --> D
  D -.->|removes| H["Stale PS1"]
Loading
High-Level Assessment

The selected approach is optimal because the .ps1 aliases add no behavior beyond calling pnpm.cmd, can lose bare -- arguments, and are preferred by PowerShell even when execution policy blocks them. Retaining or signing separate PowerShell wrappers would introduce redundant maintenance and signing requirements without improving alias behavior.

Files changed (8) +132 / -198

Bug fix (3) +26 / -27
setup.rsWrite only CMD alias wrappers in v12 setup +13/-17

Write only CMD alias wrappers in v12 setup

• Replaces the dual Windows wrapper writer with a CMD-only implementation. After writing each '.cmd' alias atomically, setup removes any stale matching '.ps1' file while ignoring missing files.

pnpm/crates/cli/src/cli_args/setup.rs

setup.tsRemove PowerShell alias wrappers during v11 setup +9/-8

Remove PowerShell alias wrappers during v11 setup

• Stops creating '.ps1' forms of 'pn', 'pnpx', and 'pnx'. Each setup run now force-removes stale PowerShell wrappers after writing the CMD aliases.

pnpm11/engine/pm/commands/src/setup/setup.ts

prepare.jsStop preparing PowerShell fallback aliases +4/-2

Stop preparing PowerShell fallback aliases

• The executable package prepare script now writes only CMD fallback wrappers. It force-removes stale '.ps1' aliases that may remain from an earlier preparation.

pnpm11/pnpm/artifacts/exe/prepare.js

Tests (3) +97 / -167
tests.rsVerify v12 setup removes stale PS1 aliases +24/-45

Verify v12 setup removes stale PS1 aliases

• Removes PowerShell wrapper execution coverage while retaining CMD delegation checks. Adds a test confirming that the Windows alias writer creates the CMD wrapper and deletes an existing '.ps1' wrapper.

pnpm/crates/cli/src/cli_args/setup/tests.rs

setup.test.tsTest v11 CMD aliases and stale PS1 cleanup +71/-65

Test v11 CMD aliases and stale PS1 cleanup

• Narrows Windows delegation tests to the supported CMD wrappers and removes PowerShell-specific environment setup. Adds coverage proving setup deletes all stale alias '.ps1' files while preserving '.cmd' files.

pnpm11/engine/pm/commands/test/setup/setup.test.ts

setup.test.tsAssert executable artifacts omit PS1 aliases +2/-57

Assert executable artifacts omit PS1 aliases

• Updates artifact tests to require absent '.ps1' aliases and removes their PowerShell execution cases and probes. CMD fallback behavior and exit-status propagation remain covered.

pnpm11/pnpm/artifacts/exe/test/setup.test.ts

Documentation (1) +8 / -0
drop-alias-ps1-wrappers.mdDocument removal of unsigned alias PowerShell wrappers +8/-0

Document removal of unsigned alias PowerShell wrappers

• Adds patch release notes for the affected packages. It explains that setup now removes '.ps1' aliases and allows PowerShell to use the corresponding '.cmd' wrappers.

.changeset/drop-alias-ps1-wrappers.md

Other (1) +1 / -4
package.jsonExclude alias PS1 wrappers from the executable package +1/-4

Exclude alias PS1 wrappers from the executable package

• Removes 'pn.ps1', 'pnpx.ps1', and 'pnx.ps1' from the published '@pnpm/exe' file list, leaving only the CMD fallback wrappers.

pnpm11/pnpm/artifacts/exe/package.json

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Sep 26, 2026
@qodo-code-review

qodo-code-review Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (2) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. One release sentence combines changes ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The changeset's first sentence combines stopping creation of three wrappers with deleting wrappers
already present from prior setup runs. Fresh setups and upgrades are distinct observable cases, so
readers cannot consume each release-note change as an individual statement.
Code

.changeset/drop-alias-ps1-wrappers.md[8]

+`pnpm setup` no longer writes the `pn.ps1`, `pnpx.ps1`, and `pnx.ps1` PowerShell wrappers and removes ones left by an earlier setup. PowerShell now runs `pn`, `pnpx`, and `pnx` through their `.cmd` wrappers, like `pnpm` itself. Before, these aliases failed with a "not digitally signed" error wherever the execution policy blocks unsigned scripts [#8444](https://github.com/pnpm/pnpm/issues/8444).
Relevance

●●● Strong

Recent changeset reviews consistently accept splitting compound sentences describing distinct
observable behaviors.

PR-#15430
PR-#15121
PR-#15289

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 3058304 requires each changeset sentence to describe one logical change. Line 8 joins behavior
for fresh setups and cleanup behavior for existing installations in one sentence with and.

Rule 3058304: Avoid compound sentences in individual changeset entries
.changeset/drop-alias-ps1-wrappers.md[8-8]

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

## Issue description
The changeset's opening sentence combines two observable changes: future setup runs no longer create PowerShell wrappers, and setup removes wrappers that already exist.

## Fix Focus Areas
- .changeset/drop-alias-ps1-wrappers.md[8-8]

## Recommended Fix
Split the opening into two direct sentences. State first that `pnpm setup` no longer creates the alias `.ps1` wrappers, then state separately that it removes existing copies.

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


2. Alias JSDoc omits cleanup behavior 📘 Rule violation ⚙ Maintainability
Description
createShellScript's JSDoc describes which sibling shims the implementation selects but omits that
it deletes existing PowerShell wrappers and can propagate filesystem errors. When callers use this
contract to assess setup side effects, they cannot discover the destructive cleanup or its failure
mode without reading the implementation.
Code

pnpm11/engine/pm/commands/src/setup/setup.ts[R160-162]

+ * just installed: a pnpm shim and, on Windows, its pnpm.cmd twin. The bin linker
+ * writes a bare pnpm.exe only for the `node` bin name, so each form has exactly
+ * one sibling to name.
Relevance

●● Moderate

JSDoc contract expansion is plausible, but similar documentation requests have been rejected without
stronger evidence of required side effects.

PR-#15321
PR-#13140

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 713430 requires modified JSDoc to document preconditions, postconditions, side effects, errors,
and edge cases rather than implementation steps. The modified documentation discusses the particular
sibling shim selected without documenting the newly added removal side effect or its error behavior.

Rule 713430: JSDoc must document function contracts, not re-describe implementation
pnpm11/engine/pm/commands/src/setup/setup.ts[154-164]
pnpm11/engine/pm/commands/src/setup/setup.ts[239-245]

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

## Issue description
The modified `createShellScript` JSDoc narrates shim-selection internals but does not document the function's complete filesystem contract, including deletion of existing `.ps1` wrappers and propagation of I/O errors.

## Fix Focus Areas
- pnpm11/engine/pm/commands/src/setup/setup.ts[154-164]

## Recommended Fix
Rewrite the JSDoc around purpose, parameter expectations, files created or removed, platform-specific behavior, and filesystem failure behavior. Avoid narrating the implementation's shim-selection steps.

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



Informational

3. Cleanup docs preserve setup history 📘 Rule violation ⚙ Maintainability
Description
write_windows_alias_wrapper documents the deletion in terms of what an earlier setup left behind
rather than stating the current invariant for existing .ps1 files. The same historical framing
appears in the TypeScript implementation, so future changes must distinguish migration history from
the cleanup behavior that remains required.
Code

pnpm/crates/cli/src/cli_args/setup.rs[R293-294]

+/// No `.ps1` form is written, and one an earlier setup left is removed, because
+/// PowerShell prefers it over the `.cmd`. A `.ps1` could only call `pnpm.cmd`
Relevance

● Weak

Recent repository precedent rejects removing useful historical compatibility context from comments
when it explains migration behavior.

PR-#15615
PR-#14443

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 772199 prohibits source comments from describing historical implementations and directs
migration history to release or design documentation. Both implementations introduce comments
referring to files left by an earlier setup instead of expressing only the current invariant.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/cli/src/cli_args/setup.rs[291-297]
pnpm11/engine/pm/commands/src/setup/setup.ts[240-245]

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

## Issue description
The new source comments refer to wrappers left by an earlier setup, embedding migration history in implementation documentation instead of describing the current cleanup invariant.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/setup.rs[291-297]
- pnpm11/engine/pm/commands/src/setup/setup.ts[240-244]

## Recommended Fix
Rephrase both comments in present tense, such as stating that any existing alias `.ps1` wrapper is removed because PowerShell gives it precedence over the `.cmd` wrapper. Keep historical context in the changeset or commit message.

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


Grey Divider

Context sources
✅ Compliance rules (platform): 64 rules
✅ Skills: review-code
Review mode: ⏭️ Skipped: The latest push only changes a changeset sentence and adds a TypeScript comment, with no behavioral or configuration changes.

Grey Divider

Tip of the day
💡 Did you know, you can type 'qodo, fix this' on a finding and the fix lands right on your PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@zkochan

zkochan commented Sep 26, 2026

Copy link
Copy Markdown
Member Author

Re the Qodo review above:

  1. Changeset sentence combines two changes: fixed in 0645db0. The removal is its own sentence now.
  2. createShellScript JSDoc omits the cleanup: fixed in 0645db0. The JSDoc now says it writes the .cmd form and removes a .ps1 of the same name on Windows.
  3. "Earlier setup" as historical framing: not changing. The comment describes a file that can exist on a user's disk when setup runs, which is why the removal is there. It is a runtime condition, not the code's history.

Written by an agent (Claude Code, claude-opus-5-5).

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 0645db0

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows Execution Policy error pnpm.ps1 is not digitally signed

2 participants