Skip to content

refactor: add recursiveByDefault property to CommandDefinition#11062

Merged
zkochan merged 2 commits into
mainfrom
feat/recursive-by-default
Mar 22, 2026
Merged

refactor: add recursiveByDefault property to CommandDefinition#11062
zkochan merged 2 commits into
mainfrom
feat/recursive-by-default

Conversation

@zkochan

@zkochan zkochan commented Mar 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a recursiveByDefault property to CommandDefinition so commands can declaratively opt into running workspace-wide by default
  • Replaces the hardcoded command name list in main.ts with a set built from command definitions
  • Adds recursiveByDefault to list, ll, and why commands (in addition to the previously hardcoded install, import, dedupe, patch, patch-commit, patch-remove, approve-builds, audit)

Test plan

  • Compiles successfully
  • All lint checks pass
  • CI passes

🤖 Generated with Claude Code

Replace the hardcoded command name list in main.ts with a declarative
recursiveByDefault property on CommandDefinition. Each command that
should run workspace-wide by default now exports this property.

Also adds recursiveByDefault to list, ll, and why commands.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 22, 2026 14:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors how pnpm decides to default certain commands to workspace-wide (recursive) execution by moving the decision into each command’s definition (recursiveByDefault) and deriving the default-recursive command set from those definitions.

Changes:

  • Add recursiveByDefault?: boolean to CommandDefinition and export a derived recursiveByDefaultCommands set.
  • Update main.ts to use recursiveByDefaultCommands instead of a hardcoded command-name condition.
  • Opt additional commands (list, ll, why, plus previously hardcoded ones like install, dedupe, patch*, approve-builds, audit) into recursive-by-default behavior.

Reviewed changes

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

Show a summary per file
File Description
pnpm/src/main.ts Switches default-recursive condition to use a derived command set.
pnpm/src/cmd/index.ts Adds recursiveByDefault to the command definition shape and builds recursiveByDefaultCommands.
patching/commands/src/patchRemove.ts Marks patch-remove as recursive-by-default via command definition export.
patching/commands/src/patchCommit.ts Marks patch-commit as recursive-by-default via command definition export.
patching/commands/src/patch.ts Marks patch as recursive-by-default via command definition export.
installing/commands/src/install.ts Marks install as recursive-by-default via command definition export.
installing/commands/src/import/index.ts Marks import as recursive-by-default via command definition export.
installing/commands/src/dedupe.ts Marks dedupe as recursive-by-default via command definition export.
deps/inspection/commands/src/listing/why.ts Marks why as recursive-by-default via command definition export.
deps/inspection/commands/src/listing/ll.ts Marks ll/la as recursive-by-default via command definition export.
deps/inspection/commands/src/listing/list.ts Marks list/ls as recursive-by-default via command definition export.
deps/compliance/commands/src/audit/audit.ts Marks audit as recursive-by-default via command definition export.
building/commands/src/policy/approveBuilds.ts Marks approve-builds as recursive-by-default via command definition export.
Comments suppressed due to low confidence (1)

pnpm/src/main.ts:197

  • This block forces recursive=true for commands marked recursiveByDefault even if the user explicitly passed --no-recursive (or otherwise set recursive to false) on the CLI. With more commands now opting into the default, this becomes a user-visible regression for disabling workspace-wide behavior. Consider only applying the default when cliOptions.recursive is undefined (or not present), and leave explicit true/false untouched (same for config.recursive).
  if (
    cmd != null && recursiveByDefaultCommands.has(cmd) &&
    typeof workspaceDir === 'string'
  ) {
    cliOptions['recursive'] = true
    config.recursive = true

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

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@zkochan zkochan merged commit 54ffb94 into main Mar 22, 2026
12 checks passed
@zkochan zkochan deleted the feat/recursive-by-default branch March 22, 2026 15:04
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