Skip to content

feat: add --depth option to pnpm why to limit display depth#10627

Merged
zkochan merged 1 commit intov10from
v10-why-depth
Feb 15, 2026
Merged

feat: add --depth option to pnpm why to limit display depth#10627
zkochan merged 1 commit intov10from
v10-why-depth

Conversation

@zkochan
Copy link
Member

@zkochan zkochan commented Feb 15, 2026

No description provided.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a --depth option to the pnpm why command, allowing users to limit the display depth of the reverse dependency tree. The implementation follows the same pattern as the existing pnpm list command's depth option, where depth=N shows N levels of dependencies/dependents.

Changes:

  • Added --depth <number> CLI option to the pnpm why command
  • Implemented depth limiting across all output formats (tree, JSON, parseable)
  • Added comprehensive test coverage for the new functionality

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
reviewing/plugin-commands-listing/src/why.ts Registers depth option in CLI/RC configuration, adds help text, and extracts depth from options to pass to rendering functions
reviewing/list/src/renderDependentsTree.ts Implements depth limiting logic in tree, JSON, and parseable renderers using recursive depth tracking
reviewing/list/src/index.ts Threads depth parameter from handler through to rendering functions
reviewing/list/test/renderDependentsTree.test.ts Adds test coverage for depth limiting across all three output formats

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zkochan zkochan changed the title feat: add --depth option to pnpm why to limit display depth feat: add --depth option to pnpm why to limit display depth Feb 15, 2026
@zkochan zkochan merged commit cb4991a into v10 Feb 15, 2026
17 of 19 checks passed
zkochan added a commit to teambit/bit that referenced this pull request Feb 17, 2026
`bit why` now shows a reverse dependency tree. The searched package
appears at the root with its dependents as branches, walking back to
workspace components. This replaces the previous forward-tree output
which was noisy and hard to read for deeply nested dependencies.

Also with the complete rewrite of the dependency tree builder we have
fixed the out-of-memory errors that were frequent with the why command.
The command also became a lot faster.

## Proposed Changes

Related PRs:
- pnpm/pnpm#10582
- pnpm/pnpm#10586
- pnpm/pnpm#10615
- pnpm/pnpm#10616
- pnpm/pnpm#10627
- pnpm/pnpm#10629
- pnpm/pnpm#10596

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants