Repository navigation
Conversation
… CLI Rebuild pacquet's list/why on a shared deps_tree module that ports the TypeScript deps.inspection tree-builder: a lockfile-backed dependency graph, materialization with subtree deduplication and circular-reference marking, dev/prod dep-type detection, absolute package paths (global virtual store aware), reconstructed tarball URLs, peer/skipped flags, and peer-variant hashes. The renderers now match the TypeScript output byte for byte: legend, cyan group headers, package-count summary, long manifest details, JSON field order, and parseable dedup. New command surface, matching the TypeScript CLI: list gains --only-projects, --find-by (finders exported by .pnpmfile.cjs, evaluated through the pnpmfile Node worker via a new finder protocol), search by version range, --depth for globally installed packages (with the GLOBAL_LS_DEPTH_NOT_SUPPORTED guard), and shared-lockfile single-pass recursive rendering. why gains --json/--parseable/--long, the prod/dev/no-optional include filters, --find-by, workspace project names read from importer manifests, dependency-field annotations, circular/deduped markers, peer-variant hashes, semver-ordered results, and the Found-N-versions summary. why now prefers the current lockfile over the wanted one, and error codes/messages match the TypeScript CLI (MISSING_PACKAGE_NAME, FINDER_NOT_FOUND). Ported the upstream test suites: the 24 getTree materialization tests, the packages-searcher and getPkgInfo tests, all 21 renderDependentsTree renderer tests, the renderer-level list tests, and the CLI-level listing/why/list.ts suites (exact tree output, lockfile-only, private JSON field, file: deps, recursive rendering, finders end to end, finder manifest reads from the store, and global-virtual-store paths). The ported coverage is enumerated in pnpm/plans/TEST_PORTING.md.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe Rust CLI now shares dependency-tree infrastructure between ChangesDependency inspection infrastructure
Command integration
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoMake
AI Description
Diagram
High-Level Assessment
Files changed (30)
|
Micro-Benchmark ResultsLinux |
PR Code Suggestions ✨Latest suggestions up to c080c34 Warning
Previous suggestionsSuggestions up to commit 99864e0
Suggestions up to commit 6a90541
Suggestions up to commit d4c7a4a
Suggestions up to commit 40e551a
Suggestions up to commit fe88f53
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Code Review by Qodo
1.
|
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/why.rs (1)
67-162: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winWire
--exclude-peersintowhy
WhyArgs::runnever readsexclude_peers, sopnpm why --exclude-peersis accepted but ignored.listalready threads this flag into graph construction;whyshould do the same or drop the option.🤖 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/why.rs` around lines 67 - 162, Update WhyArgs::run and its BuildGraphOptions construction to propagate self.exclude_peers into dependency graph building, matching the existing list command behavior. Ensure --exclude-peers changes graph traversal/output while preserving the current behavior when the flag is false.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@pnpm/crates/cli/src/cli_args/why.rs`:
- Around line 67-162: Update WhyArgs::run and its BuildGraphOptions construction
to propagate self.exclude_peers into dependency graph building, matching the
existing list command behavior. Ensure --exclude-peers changes graph
traversal/output while preserving the current behavior when the flag is false.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b1f7b3ad-1162-4a5c-8131-745d7f962164
📒 Files selected for processing (30)
.changeset/list-why-parity.mdpnpm/crates/cli/src/cli_args.rspnpm/crates/cli/src/cli_args/deps_tree.rspnpm/crates/cli/src/cli_args/deps_tree/build.rspnpm/crates/cli/src/cli_args/deps_tree/dep_types.rspnpm/crates/cli/src/cli_args/deps_tree/dependents.rspnpm/crates/cli/src/cli_args/deps_tree/finders.rspnpm/crates/cli/src/cli_args/deps_tree/get_tree.rspnpm/crates/cli/src/cli_args/deps_tree/get_tree/tests.rspnpm/crates/cli/src/cli_args/deps_tree/graph.rspnpm/crates/cli/src/cli_args/deps_tree/pkg_info.rspnpm/crates/cli/src/cli_args/deps_tree/pkg_info/tests.rspnpm/crates/cli/src/cli_args/deps_tree/render.rspnpm/crates/cli/src/cli_args/deps_tree/search.rspnpm/crates/cli/src/cli_args/deps_tree/search/tests.rspnpm/crates/cli/src/cli_args/dispatch_query.rspnpm/crates/cli/src/cli_args/list.rspnpm/crates/cli/src/cli_args/list/render.rspnpm/crates/cli/src/cli_args/list/tests.rspnpm/crates/cli/src/cli_args/why.rspnpm/crates/cli/src/cli_args/why/render.rspnpm/crates/cli/src/cli_args/why/tests.rspnpm/crates/cli/tests/list.rspnpm/crates/cli/tests/why.rspnpm/crates/global/src/lib.rspnpm/crates/global/src/list.rspnpm/crates/hooks/src/lib.rspnpm/crates/hooks/src/node_runtime.rspnpm/crates/hooks/src/worker.rspnpm/plans/TEST_PORTING.md
Confidence Score: 5/5Safe to merge. The TypeScript CLI is untouched; the Rust-side changes are an additive port with extensive test coverage and no regressions to existing functionality. The tree-building pipeline faithfully mirrors the TypeScript tree-builder, the deduplication cache bounds output to O(N), the path-traversal guard in normalize_importer_path correctly stops .. from escaping the workspace, and the worker finder protocol is consistent with the existing hook protocol. No incorrect filtering, wrong data, or dropped state was found in the changed paths. No files require special attention. deps_tree/build.rs and deps_tree/get_tree.rs are the most complex new additions; both have matching unit tests in their tests submodules. Reviews (6): Last reviewed commit: "fix(pacquet-cli): validate lockfile impo..." | Re-trigger Greptile |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #13178 +/- ##
==========================================
+ Coverage 86.56% 86.68% +0.12%
==========================================
Files 510 522 +12
Lines 86274 87556 +1282
==========================================
+ Hits 74683 75900 +1217
- Misses 11591 11656 +65 ☔ 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. 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.55281208376,
"stddev": 0.14603468254547008,
"median": 2.53878113516,
"user": 2.1235576199999997,
"system": 1.6590299600000002,
"min": 2.40066588866,
"max": 2.7878912746599998,
"times": [
2.66604369466,
2.42080191066,
2.56347906266,
2.57778851766,
2.7878912746599998,
2.40066588866,
2.5140832076599997,
2.76304215966,
2.42166693566,
2.41265818566
]
},
{
"command": "pacquet@main",
"mean": 2.6106125086599996,
"stddev": 0.1879269863914833,
"median": 2.54856050316,
"user": 2.18775592,
"system": 1.7181984599999995,
"min": 2.41267553366,
"max": 2.89050769766,
"times": [
2.89050769766,
2.4624638706599997,
2.42826727266,
2.41267553366,
2.4988466156599998,
2.81937036666,
2.77846804666,
2.78287222266,
2.43437906966,
2.59827439066
]
},
{
"command": "pnpr@HEAD",
"mean": 1.7199196651600002,
"stddev": 0.18507301016657152,
"median": 1.77143237366,
"user": 2.00679042,
"system": 1.85317746,
"min": 1.50232023166,
"max": 1.93919684266,
"times": [
1.93919684266,
1.7361638096599998,
1.92040750166,
1.50870385666,
1.8396608096599998,
1.5237759446599999,
1.50232023166,
1.80670093766,
1.8945306416599998,
1.52773607566
]
},
{
"command": "pnpr@main",
"mean": 1.70953708166,
"stddev": 0.18304076453920765,
"median": 1.65011773066,
"user": 2.00917502,
"system": 1.8779766600000003,
"min": 1.4864277506599999,
"max": 1.96827893966,
"times": [
1.61539823766,
1.7244923216599999,
1.6313107696599998,
1.5959211336599999,
1.50826070266,
1.96600786666,
1.93034840266,
1.96827893966,
1.4864277506599999,
1.66892469166
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.40706058334,
"stddev": 0.019733141152163635,
"median": 0.40932158434000004,
"user": 0.33595655999999996,
"system": 0.74481932,
"min": 0.38054218484,
"max": 0.43618589584000006,
"times": [
0.39383394184000003,
0.38217882284000004,
0.42343720084,
0.38054218484,
0.40238285484,
0.39012588084000005,
0.41626031384000006,
0.43618589584000006,
0.42250281684,
0.42315592084000003
]
},
{
"command": "pacquet@main",
"mean": 0.39420174874,
"stddev": 0.021691186438656092,
"median": 0.38587549434,
"user": 0.34204315999999996,
"system": 0.7232829199999999,
"min": 0.37461589584000005,
"max": 0.44941996384000005,
"times": [
0.38271790284,
0.38674579284000005,
0.44941996384000005,
0.38397220984,
0.40951526384000003,
0.37461589584000005,
0.39751754284,
0.38108737884000005,
0.39142034084000005,
0.38500519584000004
]
},
{
"command": "pnpr@HEAD",
"mean": 0.43285601524000006,
"stddev": 0.03345988691226418,
"median": 0.43043557634000007,
"user": 0.36916416,
"system": 0.7693085199999998,
"min": 0.37778608284000004,
"max": 0.47989522284,
"times": [
0.43353788284000006,
0.42733326984000003,
0.47028275584000007,
0.47989522284,
0.45253494384000004,
0.42191674984000005,
0.46016461684000004,
0.37778608284000004,
0.39010659284000004,
0.41500203484000003
]
},
{
"command": "pnpr@main",
"mean": 0.42182369263999997,
"stddev": 0.020732692940301948,
"median": 0.42679857384000003,
"user": 0.37619066000000007,
"system": 0.72820402,
"min": 0.38681549284000005,
"max": 0.44504038284,
"times": [
0.44244488284000005,
0.44504038284,
0.39493241184000005,
0.42942582484,
0.42046799684,
0.43030382084,
0.42417132284000003,
0.44254233084000005,
0.40209245984,
0.38681549284000005
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.2118830919400003,
"stddev": 0.057946482298114846,
"median": 3.21543589494,
"user": 3.2307587599999996,
"system": 2.27260198,
"min": 3.12363440344,
"max": 3.29260960044,
"times": [
3.29260960044,
3.21796684944,
3.20149403044,
3.12363440344,
3.21290494044,
3.27454017844,
3.2194531304400003,
3.1458130894400003,
3.27603087044,
3.15438382644
]
},
{
"command": "pacquet@main",
"mean": 3.33786634944,
"stddev": 0.13725129394971033,
"median": 3.3272809064400004,
"user": 3.43332536,
"system": 2.3187784799999998,
"min": 3.17175218044,
"max": 3.57991168244,
"times": [
3.2399539014400003,
3.43630521044,
3.17175218044,
3.1896068744400004,
3.40343844544,
3.28514286444,
3.2218496184400003,
3.48128376844,
3.3694189484400003,
3.57991168244
]
},
{
"command": "pnpr@HEAD",
"mean": 1.88551626904,
"stddev": 0.1530804675268083,
"median": 1.82793165744,
"user": 2.10726036,
"system": 2.06718388,
"min": 1.71416200844,
"max": 2.11356824344,
"times": [
1.81531982544,
1.72825892744,
1.8192845954399999,
2.1011222004400003,
1.95075593844,
2.11356824344,
2.03355305044,
1.83657871944,
1.71416200844,
1.74255918144
]
},
{
"command": "pnpr@main",
"mean": 1.9501934003399999,
"stddev": 0.144928222514866,
"median": 1.89954459594,
"user": 2.12284896,
"system": 2.0955052800000002,
"min": 1.7696718784399998,
"max": 2.19072693844,
"times": [
1.89230878444,
1.80948065544,
2.19072693844,
2.15870088544,
1.89643513744,
1.7696718784399998,
2.0129705174400003,
1.8287020064400001,
2.04028314544,
1.90265405444
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.17196433868,
"stddev": 0.12845330499933308,
"median": 1.14989769228,
"user": 1.48925404,
"system": 1.1245771999999998,
"min": 0.97693576628,
"max": 1.34644151428,
"times": [
1.31424309028,
1.15706895728,
0.97693576628,
1.33855340028,
1.09915463128,
1.14272642728,
1.21042913628,
1.34644151428,
1.09987141528,
1.03421904828
]
},
{
"command": "pacquet@main",
"mean": 1.19225146758,
"stddev": 0.17821250040102074,
"median": 1.16506969778,
"user": 1.48374294,
"system": 1.0964203999999997,
"min": 0.90551061428,
"max": 1.4782670172799999,
"times": [
1.28374616728,
1.32957572328,
1.14829245428,
1.05184393728,
1.4782670172799999,
1.38617957628,
1.17635016428,
1.15378923128,
0.90551061428,
1.00895979028
]
},
{
"command": "pnpr@HEAD",
"mean": 0.4700360979800001,
"stddev": 0.019553489414743205,
"median": 0.46813303228,
"user": 0.32842953999999996,
"system": 0.8070216,
"min": 0.43571202728,
"max": 0.5122425752800001,
"times": [
0.46964531028,
0.45471446328000004,
0.46662075428,
0.43571202728,
0.5122425752800001,
0.46991301628,
0.47576818128000004,
0.48321245428000004,
0.46640415728,
0.46612804028
]
},
{
"command": "pnpr@main",
"mean": 0.43914644608,
"stddev": 0.017020878913809094,
"median": 0.43511566228,
"user": 0.31169364,
"system": 0.7533637,
"min": 0.41201831628,
"max": 0.46959057228,
"times": [
0.46959057228,
0.42778758128,
0.45279702828,
0.45624701128,
0.43061061728,
0.43687964428000003,
0.44625396628,
0.42592804328,
0.43335168028,
0.41201831628
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.3129676329200004,
"stddev": 0.032646899551051774,
"median": 2.3168876675199996,
"user": 1.68462954,
"system": 1.2379586999999996,
"min": 2.26422314302,
"max": 2.36916584202,
"times": [
2.36916584202,
2.31842899802,
2.32974279002,
2.33661069602,
2.26422314302,
2.29110805102,
2.31534633702,
2.28759327702,
2.27691198802,
2.34054520702
]
},
{
"command": "pacquet@main",
"mean": 2.45767943752,
"stddev": 0.12878207247223103,
"median": 2.45428263802,
"user": 1.8617206400000001,
"system": 1.2793626999999996,
"min": 2.30758000702,
"max": 2.69460159102,
"times": [
2.43677012802,
2.30758000702,
2.39277308302,
2.34811682502,
2.30898780802,
2.62745628602,
2.50224252902,
2.48647097002,
2.47179514802,
2.69460159102
]
},
{
"command": "pnpr@HEAD",
"mean": 0.47691482462,
"stddev": 0.015682815668242974,
"median": 0.47970496852000005,
"user": 0.36469873999999997,
"system": 0.7642233999999999,
"min": 0.44953401702000007,
"max": 0.49567803002000005,
"times": [
0.4808668970200001,
0.47854304002000003,
0.44953401702000007,
0.4538077750200001,
0.47033434702000004,
0.49500139002000004,
0.48660430002000005,
0.47294615202000007,
0.48583229802000005,
0.49567803002000005
]
},
{
"command": "pnpr@main",
"mean": 0.4273352254200001,
"stddev": 0.026968182102965206,
"median": 0.43683375102000005,
"user": 0.32325644000000003,
"system": 0.7309913,
"min": 0.38133459502000006,
"max": 0.46565033102000003,
"times": [
0.43625999702000007,
0.43850847502000007,
0.41166275302000005,
0.46565033102000003,
0.39635241302000007,
0.38133459502000006,
0.44223474902000004,
0.43740750502000003,
0.40762976502000003,
0.45631167102000003
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.58105037632,
"stddev": 0.055942420322965286,
"median": 0.5747410992199999,
"user": 0.56751374,
"system": 0.13609649999999998,
"min": 0.50971949472,
"max": 0.71033482272,
"times": [
0.52837604972,
0.57427837272,
0.5979864447200001,
0.57449074772,
0.60256314272,
0.71033482272,
0.60364838372,
0.57499145072,
0.53411485372,
0.50971949472
]
},
{
"command": "pacquet@main",
"mean": 0.5527888682200001,
"stddev": 0.027690472000156147,
"median": 0.54701005622,
"user": 0.53816504,
"system": 0.1305097,
"min": 0.51564391972,
"max": 0.61114629572,
"times": [
0.54725258172,
0.51564391972,
0.54239825072,
0.54245253872,
0.52212675172,
0.5751995547200001,
0.57256765672,
0.61114629572,
0.5467675307200001,
0.55233360172
]
},
{
"command": "pnpr@HEAD",
"mean": 0.11444712826166668,
"stddev": 0.007851993050948034,
"median": 0.11289205222000001,
"user": 0.032941464999999996,
"system": 0.02128208333333333,
"min": 0.10349174272,
"max": 0.13606716972000002,
"times": [
0.11499845672,
0.12075162372,
0.13003570772,
0.11615198172,
0.11524264372000001,
0.11489313972000001,
0.13606716972000002,
0.10707374872000001,
0.11391726272000001,
0.11193342472000001,
0.11186588872000001,
0.11073346572000001,
0.11385067972000001,
0.11128741372,
0.12244861972000001,
0.10809656972000001,
0.12242719772,
0.10687960772,
0.10377616372000001,
0.10898499372,
0.11033706572,
0.11014062972000001,
0.10349174272,
0.12134588072000001
]
},
{
"command": "pnpr@main",
"mean": 0.11375116975846154,
"stddev": 0.00813849548905733,
"median": 0.11240437072000001,
"user": 0.032564224615384614,
"system": 0.020391615384615383,
"min": 0.10022321872,
"max": 0.12991116572,
"times": [
0.10487298972,
0.12991116572,
0.12327250472000001,
0.11143601472,
0.11349304672,
0.10516685872,
0.11568290272000001,
0.10922091772,
0.10474973072,
0.10653368972,
0.11550641072000001,
0.10692751372,
0.11027654772,
0.11451999472,
0.12779747672,
0.10500759372,
0.11265729972,
0.10946410472000001,
0.12308488572000001,
0.12691873272,
0.11363476072,
0.10931585672000001,
0.10022321872,
0.11215144172000001,
0.12377867072000001,
0.12192608372000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.8469743454800005,
"stddev": 0.1458873811609164,
"median": 4.826075148879999,
"user": 3.11606976,
"system": 2.2631972599999997,
"min": 4.62971798338,
"max": 5.08015778338,
"times": [
4.81297531038,
4.965100737379999,
4.83917498738,
4.97954142738,
4.724053436379999,
4.80034177338,
4.680744897379999,
4.95793511838,
5.08015778338,
4.62971798338
]
},
{
"command": "pacquet@main",
"mean": 4.737017295980001,
"stddev": 0.14891400402821475,
"median": 4.70326749038,
"user": 2.89279796,
"system": 2.13855636,
"min": 4.60805465938,
"max": 5.14111236638,
"times": [
4.71687236138,
5.14111236638,
4.64844444138,
4.75132603338,
4.68694687238,
4.660322648379999,
4.75022522138,
4.68966261938,
4.60805465938,
4.7172057363799995
]
},
{
"command": "pnpr@HEAD",
"mean": 3.64537687348,
"stddev": 0.11830836798511633,
"median": 3.60740493588,
"user": 1.8578584599999999,
"system": 1.7001555600000002,
"min": 3.53401531438,
"max": 3.90656308438,
"times": [
3.53401531438,
3.5918105603800004,
3.58731915738,
3.6788302493800003,
3.64062715338,
3.90656308438,
3.5515921823800003,
3.55282872638,
3.62299931138,
3.7871829953800002
]
},
{
"command": "pnpr@main",
"mean": 3.5799336659799996,
"stddev": 0.06916238147053823,
"median": 3.5516830713800003,
"user": 1.6794376599999996,
"system": 1.5990288599999998,
"min": 3.5134605433800004,
"max": 3.6899771933800003,
"times": [
3.5134605433800004,
3.55598052738,
3.5306464443800003,
3.57703941938,
3.6899771933800003,
3.51528782038,
3.68150530738,
3.6555037353800004,
3.54738561538,
3.53255005338
]
}
]
} |
Base unresolvable link: finder candidates on the parent importer's directory (the same base the tree materialization uses), so --find-by reads the manifest the edge actually refers to for nested importers. Build the dependency graph once per list invocation and share it between finder evaluation and tree building. Identify the --long path line by its virtual-store dirname in the long-format test so the assertion holds on Windows path separators. Trim restating doc comments in the finder worker protocol and correct the find_global_install_dirs contract note.
|
Addressed the review findings in 40e551a:
Also fixed the Windows CI failure (the long-format test asserted a forward-slash path) and the earlier Doc job failure (a bad intra-doc link). Written by an agent (Claude Code, claude-fable-5). |
|
Code review by qodo was updated up to the latest commit 40e551a |
…ackage_path Never join or dereference a lockfile-derived virtual-store dirname, package name, or alias that carries traversal segments or an absolute path — the same guard pnpm licenses applies before reading store paths built from lockfile keys.
Summary
Makes pacquet's
pnpm list(ls/ll/la) andpnpm whyfeature complete and behaviorally identical to the TypeScript CLI. The TypeScript side is untouched — it is the source of truth here; this PR closes the Rust side of the gap and ports the corresponding test suites.New shared tree-builder. A new
cli_args/deps_treemodule ports@pnpm/deps.inspection.tree-builder: a lockfile-backed dependency graph (importer + package nodes, workspace-link resolution,--only-projectsedge filtering), a materializer with per-(node, depth)subtree deduplication ([deduped]markers anddedupedDependenciesCount, bounding output to O(N)), a circular-reference post-pass, dev/prod dep-type detection (port of@pnpm/lockfile.detect-dep-types), and per-node metadata resolution: absolute filesystem paths (global-virtual-store aware, resolving through parentnode_modulessymlinks), reconstructed registry tarball URLs forresolved, peer/skipped flags,link:version rewriting, and peer-variant hashes.pnpm list. Rewritten on the tree-builder with byte-identical renderers: the legend, cyan group headers, theN packages[ in M projects]summary,peer/skippedannotations, redpeer#hash (N variations)suffixes, bold search matches with subtree pruning,--longmanifest details (description/repository/homepage/path; JSON adds license/author), sorted JSON keyed by alias withfrom/version/resolved/path, and flat deduplicated parseable output. New surface matching TS:--only-projects,--find-by(finders exported by.pnpmfile.cjs, evaluated through the pnpmfile Node worker via a new finder protocol), version-range search queries (pnpm ls "foo@^2"),--depthfor globally installed packages (with theERR_PNPM_GLOBAL_LS_DEPTH_NOT_SUPPORTEDguard and install-group narrowing), and shared-lockfile recursive rendering in a single pass (one legend, cross-project dedup, combined summary). The pacquet-only "No lockfile found" messages are gone — a lockfile-less project renders the root header like TS does.pnpm why. Rebuilt on the same graph:--json/--parseable/--longoutput,-P/-D/--no-optionalinclude filters,--find-by, workspace project names/versions read from importer manifests,(dependencies)-style dependency-field annotations on importer leaves,[circular]/[deduped]markers, peer-variant hashes, semver-ordered results, theFound N versions[, M instances] of <pkg>summary, archy-style tree rendering, and current-lockfile preference. Error message/code now match TS (ERR_PNPM_MISSING_PACKAGE_NAME:`pnpm why` requires the package name or --find-by=<finder-name>). Search roots are now package nodes only, matching TS.Tests. Ported one-to-one and enumerated in
pnpm/plans/TEST_PORTING.md(new "pnpm list/pnpm why(deps/inspection)" section): the 24getTreematerialization tests, the packages-searcher andgetPkgInfotests, all 21renderDependentsTreerenderer tests, the renderer-levellisttests, and the CLI-levellisting/why/list.tssuites — exact tree output including legend and summary,--lockfile-only, the JSONprivatefield,file:deps, recursive rendering, finders end to end (including finder manifest reads from the content-addressable store), and global-virtual-store paths. 62 unit + 38 integration tests pass; regression checks were done per the "test the tests" convention (breaking dedup, the missing-package fallback, version-range matching, and the summary each made the corresponding tests fail).Not ported, with reasons recorded in the plan: the upstream
test.skip-ped skipped-optional-deps listing test, thenameFormattergroup ofbuildDependentsTree.test.ts(no pnpm command passes anameFormatter; thedisplayNamerendering it feeds is covered), andmanyDeps.ts(its OOM guard is the dedup cache, pinned directly).Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.(Rust-only by design: the TypeScript CLI already has all of this
behavior and is unchanged.)
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
output formats are already documented for the TypeScript CLI.)
Written by an agent (Claude Code, claude-fable-5).
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
pnpm listandpnpm whyare now more feature-complete and behaviorally aligned, including--only-projectsand--find-byfinder support with version-range searching.--long, with richer peer, deduped, and circular annotations plus “Found …” summaries.pnpm whyvalidation messaging.pnpm list/pnpm why.