Repository navigation
fix(cli): accept top-level --if-present and stop workspace installs scaffolding a root manifest - #12919
Conversation
|
💖 Thanks for opening this pull request! 💖 |
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:
📝 WalkthroughWalkthroughTop-level ChangesCLI compatibility and workspace behavior
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CliArgs
participant RunCtx
participant dispatch_script
participant RunArgs
CliArgs->>RunCtx: pass top-level if_present
RunCtx->>dispatch_script: provide execution context
dispatch_script->>RunArgs: merge if_present
RunArgs->>dispatch_script: execute script command
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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pnpm/crates/cli/src/cli_args/cli_command.rs (1)
210-239: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winReject
--if-presentforexec, or thread it through to the executor — this validator currently acceptspnpm --if-present exec ..., butdispatch_script::execdropsctx.if_presentandExecArgshas no corresponding field, so the flag becomes a silent no-op.🤖 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 `@pnpm/crates/cli/src/cli_args/cli_command.rs` around lines 210 - 239, Reject --if-present for the exec command, or explicitly propagate it through dispatch_script::exec by adding the necessary ExecArgs field and executor handling. Update validate_if_present_top_level_option and related validation so the flag cannot be silently ignored, while preserving its existing support for restart and valid commands.
🤖 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.
Outside diff comments:
In `@pnpm/crates/cli/src/cli_args/cli_command.rs`:
- Around line 210-239: Reject --if-present for the exec command, or explicitly
propagate it through dispatch_script::exec by adding the necessary ExecArgs
field and executor handling. Update validate_if_present_top_level_option and
related validation so the flag cannot be silently ignored, while preserving its
existing support for restart and valid commands.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2bc85599-a7a2-4190-ab32-bdc89a560571
📒 Files selected for processing (8)
pnpm/crates/cli/src/cli_args/cli_command.rspnpm/crates/cli/src/cli_args/dispatch.rspnpm/crates/cli/src/cli_args/dispatch_script.rspnpm/crates/cli/src/cli_args/tests.rspnpm/crates/cli/src/state.rspnpm/crates/cli/tests/run.rspnpm/crates/cli/tests/run_recursive.rspnpm/crates/cli/tests/workspace_install.rs
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12919 +/- ##
==========================================
- Coverage 85.51% 85.44% -0.08%
==========================================
Files 469 474 +5
Lines 72988 74565 +1577
==========================================
+ Hits 62417 63712 +1295
- Misses 10571 10853 +282 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.03251457044,
"stddev": 0.132990601510945,
"median": 4.03182646054,
"user": 3.7901553,
"system": 3.494241,
"min": 3.83337024804,
"max": 4.23097965804,
"times": [
4.09132451004,
4.23097965804,
3.9723284110400003,
3.94980533504,
3.91226027204,
3.83337024804,
4.10228126004,
4.10035484604,
3.9247870860400003,
4.20765407804
]
},
{
"command": "pacquet@main",
"mean": 4.12030257134,
"stddev": 0.22494964101103201,
"median": 4.07408843104,
"user": 3.775013,
"system": 3.4957247000000002,
"min": 3.89040195204,
"max": 4.66805205604,
"times": [
4.66805205604,
4.277974868039999,
4.0459333940399995,
4.102243468039999,
3.96478106704,
3.89040195204,
4.10559885904,
4.020849505039999,
4.18828354704,
3.93890699704
]
},
{
"command": "pnpr@HEAD",
"mean": 2.1720399263400005,
"stddev": 0.14203582578676996,
"median": 2.14890822804,
"user": 2.6772621,
"system": 3.0025876000000005,
"min": 1.98128192204,
"max": 2.36726771404,
"times": [
2.21587655704,
2.31038510204,
2.22783455904,
2.07935737204,
2.36726771404,
1.98128192204,
2.03726378204,
2.0592675810400003,
2.35992477504,
2.08193989904
]
},
{
"command": "pnpr@main",
"mean": 2.1380563538400006,
"stddev": 0.12888703521312725,
"median": 2.07911452704,
"user": 2.6453647000000005,
"system": 3.0201519,
"min": 2.01305482304,
"max": 2.33798331804,
"times": [
2.0147085810400003,
2.1116594870400003,
2.33798331804,
2.2701807510400003,
2.04656956704,
2.0283994240400003,
2.0381596340400003,
2.2446752230400002,
2.27517273004,
2.01305482304
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6423485445400001,
"stddev": 0.01189424970944471,
"median": 0.6390641475400001,
"user": 0.37630231999999997,
"system": 1.32910356,
"min": 0.62815937204,
"max": 0.6662117400400001,
"times": [
0.65921081504,
0.62815937204,
0.63925936504,
0.63237410504,
0.63742390004,
0.63886893004,
0.6662117400400001,
0.6462222440400001,
0.6348976270400001,
0.6408573470400001
]
},
{
"command": "pacquet@main",
"mean": 0.6618180186400001,
"stddev": 0.04697591697018613,
"median": 0.64631333154,
"user": 0.39845922,
"system": 1.3230283600000001,
"min": 0.63535206604,
"max": 0.7907380780400001,
"times": [
0.63585906804,
0.64530129104,
0.63623814504,
0.66767533104,
0.66854702404,
0.63535206604,
0.65335992404,
0.6473253720400001,
0.63778388704,
0.7907380780400001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.7155561407400001,
"stddev": 0.018677919430166542,
"median": 0.7120875335400001,
"user": 0.40645032,
"system": 1.3718026600000002,
"min": 0.6906613650400001,
"max": 0.74683496204,
"times": [
0.74683496204,
0.7140101360400001,
0.71016493104,
0.71486654804,
0.6906613650400001,
0.69852022104,
0.70940019004,
0.73808973704,
0.69817569404,
0.73483762304
]
},
{
"command": "pnpr@main",
"mean": 0.7729245890400002,
"stddev": 0.02122919368839561,
"median": 0.7671701185400001,
"user": 0.4177842199999999,
"system": 1.41593496,
"min": 0.73696183904,
"max": 0.80252451704,
"times": [
0.7656756490400001,
0.73696183904,
0.80252451704,
0.7556351010400001,
0.76734730904,
0.7830934270400001,
0.8000920570400001,
0.75793269904,
0.79299036404,
0.7669929280400001
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.2177586246,
"stddev": 0.03908067215367826,
"median": 4.2054769103,
"user": 3.7139254999999998,
"system": 3.37621872,
"min": 4.1899647503,
"max": 4.3204091802999995,
"times": [
4.3204091802999995,
4.2026817883,
4.2145373133,
4.1899647503,
4.2082720323,
4.1923762733,
4.1994184873,
4.211735357299999,
4.2424181853,
4.1957728783
]
},
{
"command": "pacquet@main",
"mean": 4.2029189375,
"stddev": 0.04469311662522019,
"median": 4.2054980503,
"user": 3.7119790999999998,
"system": 3.3890107199999995,
"min": 4.1427630763,
"max": 4.2814316293,
"times": [
4.2625640393,
4.2109439992999995,
4.2814316293,
4.1885422783,
4.1427630763,
4.1473833003,
4.1698717643,
4.2146931873,
4.2098232253,
4.2011728753
]
},
{
"command": "pnpr@HEAD",
"mean": 2.2279873709,
"stddev": 0.11048702008283207,
"median": 2.2119555668000004,
"user": 2.4929037999999997,
"system": 2.9320865200000004,
"min": 2.0435997403000004,
"max": 2.3667877213,
"times": [
2.3667877213,
2.1740747893,
2.3189304693,
2.3510199343000004,
2.3345607803000004,
2.2286054053,
2.0435997403000004,
2.1953057283,
2.1321286343000003,
2.1348605063000003
]
},
{
"command": "pnpr@main",
"mean": 2.2170666482000003,
"stddev": 0.13152759955190335,
"median": 2.2268718483,
"user": 2.4934658,
"system": 2.90237412,
"min": 2.0347979743000004,
"max": 2.4560539773000003,
"times": [
2.2693795943,
2.2145573773000002,
2.2877635473000004,
2.1211389393,
2.3370259473000004,
2.0347979743000004,
2.4560539773000003,
2.0398491473,
2.1709136583000004,
2.2391863193000003
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.36729034092,
"stddev": 0.01773090773622481,
"median": 1.3687137051200002,
"user": 1.3053524199999997,
"system": 1.72872828,
"min": 1.33666818062,
"max": 1.3983222376200002,
"times": [
1.3619408906200001,
1.3983222376200002,
1.37464347262,
1.33666818062,
1.34847791662,
1.3838899096200001,
1.35560629162,
1.3759270996200001,
1.36785644362,
1.3695709666200002
]
},
{
"command": "pacquet@main",
"mean": 1.38622555022,
"stddev": 0.06186215559227677,
"median": 1.3646222516200002,
"user": 1.3446249199999998,
"system": 1.7115653800000001,
"min": 1.3405064506200002,
"max": 1.5560813526200001,
"times": [
1.36825589162,
1.3606549356200002,
1.5560813526200001,
1.3975537106200002,
1.36098861162,
1.37155878962,
1.38956744662,
1.3581501496200001,
1.3405064506200002,
1.3589381636200002
]
},
{
"command": "pnpr@HEAD",
"mean": 0.67927198782,
"stddev": 0.018320154190912118,
"median": 0.67705669712,
"user": 0.33634132,
"system": 1.30535948,
"min": 0.6528865766199999,
"max": 0.72434933662,
"times": [
0.66474099962,
0.67863199062,
0.67717202662,
0.67694136762,
0.6528865766199999,
0.67593182862,
0.72434933662,
0.68331156462,
0.67470818762,
0.68404599962
]
},
{
"command": "pnpr@main",
"mean": 0.69174190392,
"stddev": 0.07388620114406251,
"median": 0.66564351812,
"user": 0.34911981999999997,
"system": 1.2987139799999998,
"min": 0.65806499362,
"max": 0.90081714662,
"times": [
0.6618380766199999,
0.67625969262,
0.65806499362,
0.66472516362,
0.68266227962,
0.67816492562,
0.66401758462,
0.66430730362,
0.66656187262,
0.90081714662
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.07792039554,
"stddev": 0.05473155594171144,
"median": 3.0646285403399998,
"user": 1.7661765199999997,
"system": 2.03124672,
"min": 3.02325207184,
"max": 3.16921030984,
"times": [
3.16921030984,
3.0638704618399997,
3.03615422684,
3.1093197928399996,
3.02369373784,
3.02325207184,
3.0287625878399997,
3.06538661884,
3.09963297784,
3.1599211698399996
]
},
{
"command": "pacquet@main",
"mean": 3.03681470914,
"stddev": 0.029383502516071212,
"median": 3.02362425284,
"user": 1.79880542,
"system": 1.96459652,
"min": 2.99586510484,
"max": 3.09178599984,
"times": [
3.06142330584,
3.05574871984,
3.0140567198399997,
3.0208991258399998,
3.02248412384,
3.02476438184,
3.01867533684,
2.99586510484,
3.09178599984,
3.0624442728399996
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6968450945400001,
"stddev": 0.013603034514439687,
"median": 0.69734383734,
"user": 0.34252112,
"system": 1.3519156200000002,
"min": 0.6753160758400001,
"max": 0.72352890684,
"times": [
0.6907520328400001,
0.6753160758400001,
0.70687624784,
0.72352890684,
0.69745675984,
0.69386119984,
0.6972309148400001,
0.70349105584,
0.7000671138400001,
0.67987063784
]
},
{
"command": "pnpr@main",
"mean": 0.6904351272400001,
"stddev": 0.016330837771050856,
"median": 0.6918574308400001,
"user": 0.36385892000000003,
"system": 1.3058962199999997,
"min": 0.66694694684,
"max": 0.7214324078400001,
"times": [
0.6994875608400001,
0.70106559984,
0.6812865128400001,
0.66694694684,
0.69269116484,
0.6671499268400001,
0.7214324078400001,
0.6970457388400001,
0.6910236968400001,
0.68622171684
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.66440139982,
"stddev": 0.03272731014722693,
"median": 0.65810155362,
"user": 0.6178261199999999,
"system": 0.16087926000000002,
"min": 0.62672050862,
"max": 0.71984429762,
"times": [
0.65950912762,
0.71984429762,
0.71448696462,
0.6874911876199999,
0.64863034962,
0.63094739162,
0.62672050862,
0.6391395466199999,
0.66055064462,
0.65669397962
]
},
{
"command": "pacquet@main",
"mean": 0.64073017252,
"stddev": 0.01778664167673489,
"median": 0.64549448512,
"user": 0.60764822,
"system": 0.15385136,
"min": 0.60604893262,
"max": 0.66194516362,
"times": [
0.66194516362,
0.6434005806199999,
0.65885458062,
0.64772033462,
0.61965839262,
0.64758838962,
0.60604893262,
0.65285615062,
0.62764915362,
0.64158004662
]
},
{
"command": "pnpr@HEAD",
"mean": 0.10898378057999998,
"stddev": 0.002828660615846932,
"median": 0.10817583162000001,
"user": 0.02701578,
"system": 0.020293159999999998,
"min": 0.10668939162,
"max": 0.11837259662,
"times": [
0.10684699362,
0.10786914762000001,
0.10811845462,
0.10772128162,
0.10791135762000001,
0.10853680762000001,
0.10722082262,
0.10846700862,
0.10843986562,
0.11495856762000001,
0.11520804962,
0.10820618762,
0.10817583162000001,
0.10896388662,
0.10826272462,
0.11837259662,
0.10808670462,
0.10725353562,
0.10792735662,
0.10790858162,
0.10828069562,
0.10737283962000001,
0.10906180962,
0.10668939162,
0.10873401562
]
},
{
"command": "pnpr@main",
"mean": 0.10810385845999998,
"stddev": 0.0014744984500667975,
"median": 0.10779123762000001,
"user": 0.027483899999999995,
"system": 0.01937332,
"min": 0.10555280062,
"max": 0.11297504862,
"times": [
0.10766795162000001,
0.10765982662000001,
0.10738873862000001,
0.10899660662,
0.10733874662000001,
0.10772322462,
0.10734989662000001,
0.10904488762,
0.10776445162,
0.10716640862,
0.10983582762,
0.10589047662,
0.10852558662,
0.11297504862,
0.10823493162,
0.10823387462,
0.10656570562,
0.10842851462,
0.10863780562,
0.11038364562,
0.10555280062,
0.10724366862000001,
0.10780936162,
0.10779123762000001,
0.10838723662000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 6.9114230299,
"stddev": 0.15819096581319814,
"median": 6.8585473479,
"user": 3.9834718199999997,
"system": 3.7995512,
"min": 6.7488887479,
"max": 7.1704611849,
"times": [
6.7884459348999995,
7.1704611849,
6.8883619249,
7.1418390169,
6.8287327709,
6.8064140429,
7.0604622839,
6.7604253948999995,
6.7488887479,
6.9201989969
]
},
{
"command": "pacquet@main",
"mean": 6.776409427899999,
"stddev": 0.10612419742139297,
"median": 6.7475614164,
"user": 3.97688092,
"system": 3.7470444,
"min": 6.665797599899999,
"max": 7.0490504239,
"times": [
6.665797599899999,
6.7543704209,
6.7665480499,
7.0490504239,
6.722813224899999,
6.7190493829,
6.7353257219,
6.7637750219,
6.7407524119,
6.8466120209
]
},
{
"command": "pnpr@HEAD",
"mean": 5.0424711937,
"stddev": 0.14293976575825917,
"median": 5.0739820048999995,
"user": 2.75242142,
"system": 3.2699278,
"min": 4.8521312269,
"max": 5.3306600859,
"times": [
5.0956979299,
4.966644286899999,
4.8521312269,
4.9212764089,
5.0522660799,
5.1114333729,
5.3306600859,
5.1016149939,
5.1164006379,
4.8765869139
]
},
{
"command": "pnpr@main",
"mean": 5.006930432399999,
"stddev": 0.08980922192246045,
"median": 4.9798319859,
"user": 2.77879812,
"system": 3.2662682,
"min": 4.9292493349,
"max": 5.2085563599,
"times": [
4.9915426639,
5.2085563599,
4.9412036849,
5.0314698209,
5.1093661389,
4.9681213079,
4.9292493349,
4.930471305899999,
4.953085940899999,
5.0062377659
]
}
]
} |
|
| Branch | pr/12919 |
| 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,227.99 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 696.85 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 679.27 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 108.98 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,172.04 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 5,042.47 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 715.56 ms |
55e0a71 to
821e255
Compare
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1. New package.json mode 0600
|
PR Code Suggestions ✨Latest suggestions up to 7c7f48f Warning
Previous suggestionsSuggestions up to commit 1c9638a
Suggestions up to commit b8651b8
Suggestions up to commit 821e255
|
||||||||||||||||||||||||||||||||||||
821e255 to
c66c5ef
Compare
The top-level --if-present validator accepted `pnpm --if-present exec`, but exec has no if-present semantics and dispatch dropped the flag silently. pnpm rejects the option for exec (Unknown option), so pacquet now returns the same UnknownArgument validation error it uses for the other non-script commands. Raised in CodeRabbit review of pnpm#12919. Co-Authored-By: Claude Fable 5 <[email protected]>
|
The CodeRabbit review finding (top-level Written by an agent (Claude Code, claude-fable-5). |
pnpm's option parser accepts --if-present before the script (`pnpm --workspace-concurrency=1 --no-sort --if-present .test`), but pacquet's clap surface only declared it on the run/stop/restart subcommands, so the top-level spelling failed to parse. This is the exact shape of the repo's own test-pkgs-branch script, which every pull-request TS CI job runs — together with the changed-packages filter selector (pnpm#12914), this unblocks the ci:test-branch job once a pnpm v12 alpha carrying both is released and the repo's packageManager is bumped. The flag is declared top-level like the other run-scoped options (--resume-from, --report-summary, --no-bail) but deliberately not clap-global: run/stop/restart declare their own --if-present, and a propagated global flag would collide with theirs. Validation rejects it for non-script commands the same way as the other run-scoped flags, plus restart, which also runs scripts. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Code review by qodo was updated up to the latest commit 1c9638a |
Gate State::init's no-scaffold path on workspace membership (config.workspace_dir) rather than a pnpm-workspace.yaml beside the missing manifest, so installs in workspace member directories can't scaffold a package.json either — pnpm never creates one anywhere in a workspace. Keep an empty object as the in-memory stand-in instead of the init template: pnpm's add at a rootless workspace root persists a manifest holding only the added dependencies, and the template's failing test script would otherwise ride along on any explicit save. Co-Authored-By: Claude Fable 5 <[email protected]>
The top-level --if-present validator accepted `pnpm --if-present exec`, but exec has no if-present semantics and dispatch dropped the flag silently. pnpm rejects the option for exec (Unknown option), so pacquet now returns the same UnknownArgument validation error it uses for the other non-script commands. Raised in CodeRabbit review of pnpm#12919. Co-Authored-By: Claude Fable 5 <[email protected]>
The scaffolding-broke-recursive-runs story lives in the commit message; the doc comment and test keep only the current contract. The exec case in if_present_flag_rejects_non_script_commands is documented on validate_if_present_top_level_option. Co-Authored-By: Claude Fable 5 <[email protected]>
1c9638a to
7c7f48f
Compare
|
Code review by qodo was updated up to the latest commit 7c7f48f |
|
Congrats on merging your first pull request! 🎉🎉🎉 |
Summary
Every TS-touching pull request currently fails TS CI: the repo's package manager is the pacquet-based pnpm v12 alpha, and the PR-only
test-pkgs-branchscript (pn --workspace-concurrency=1 --filter=...[origin/main] --no-sort --if-present .test) needs two things that binary lacks. #12914 supplied the...[<since>]filter selector; this PR supplies the other half — top-level--if-present— and aligns the workspace no-scaffold behavior (introduced on main by #12922 to fix therun_recursivetest that had been red since #12910 landed on top of #12914) with pnpm.Top-level
--if-present— pnpm accepts--if-presentahead of the script name; pacquet only declared it onrun/stop/restart, so thetest-pkgs-branchinvocation died at argument parsing (unexpected argument '--if-present' found). It is now a top-level flag like the other run-scoped options (--resume-from,--report-summary,--no-bail), merged with the subcommands' own flag, and rejected for non-script commands. Deliberately not clap-global: a propagated global flag would collide with the subcommands' own declarations.execalso rejects it — pnpm treats--if-presentas an unknown option there, and threading it through would make it a silent no-op (raised in CodeRabbit review).No manifest scaffolding anywhere inside a workspace — pnpm never creates a
package.jsonduring an install inside a workspace. feat(pacquet): port the stage command and add its -/stage endpoints to pnpr #12922 already stopped persisting the scaffold when apnpm-workspace.yamlsits next to the missing root manifest; this PR closes the remaining parity gaps: the gate is workspace membership (config.workspace_dir), so installs in workspace member directories can't scaffold one either, and the in-memory stand-in is an empty manifest instead of the init template —pnpm add -wat a rootless workspace root persists only the added dependencies (verified against the TS CLI), not npm's init template with its failingtestscript. Non-workspace installs keep scaffolding, andaddstill persists through its explicit save.Verified against the TS CLI on identical fixtures:
pnpm --filter '...[origin/main]' teston a rootless workspace selects only the changed projects, exits 0, and leaves nopackage.jsonbehind — pacquet now matches. A remaining smaller gap: pacquet still writes an empty.importer topnpm-lock.yamlwhere pnpm writes none.Note for reviewers: PR TS CI can only turn green after a pnpm v12 alpha carrying #12914 plus this change is published to
next-12and the repo'spackageManageris bumped. Unrelated: under plaincargo test(not nextest),patch_state's doomed-cwd test can race any test that reads the process cwd (e.g.pack_app); nextest's process-per-test isolation hides it in CI, but the doomed-cwd behavior likely belongs behind the DI seam.No TypeScript-side change: both fixes align pacquet with existing TS behavior.
Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.Written by an agent (Claude Code, claude-fable-5).
Summary by CodeRabbit
New Features
--if-presentsupport for script commands, including recursive execution.--if-presentis used.Bug Fixes
--if-presentto supported command contexts with clear validation errors.