feat: add --depth option to pnpm why to limit display depth#10627
Merged
feat: add --depth option to pnpm why to limit display depth#10627
--depth option to pnpm why to limit display depth#10627Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
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 thepnpm whycommand - 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.
pnpm why to limit display depth--depth option to pnpm why to limit display depth
zkochan
added a commit
that referenced
this pull request
Feb 15, 2026
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.