Skip to content

feat: reclaim stale dependencies and build output across worktrees - #32331

Merged
nwparker merged 3 commits into
mainfrom
nwparker/improve-reclaim-space
Oct 24, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/improve-reclaim-space

Conversation

@nwparker

@nwparker nwparker commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​342 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​336
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​301 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​293

Repositories with many old worktrees retain root and nested dependency installs and build output after pnpm reclaim-space. Include ignored, entirely untracked generated directories in sibling worktrees in the normal manual preview and apply flow after 30 days, with --generated-min-age-days to adjust retention. No additional opt-in flag is needed.

The pass protects the selected/invoking/excluded worktrees, skips symlinks and nested working/bare repositories anywhere within a cleanup target, and rechecks Git tracking, parent paths, directory identity and age before deletion. It preserves shared pnpm stores and hardlinked package-file permissions, and never runs in automatic cleanup. The command and documentation tell users to stop sibling apps, agents, installs, builds and tests before applying, and explain supported package layouts and regeneration behavior.

Validation:

  • 87 tests passed across the reclaim and automatic-worker suites, including default manual CLI preview/apply, real Git/filesystem coverage, directory replacement during a Git check, tracked paths with metacharacters, symlink exclusions and read-only directories with shared hardlinks.
  • Changed-code quality gate passed with zero new findings.
  • A preview against the local repository completed without deletion and identified 176 old generated directories.

Sub-agent review: fixed reproduced deletion cases involving nested working and bare repositories; re-review found no remaining actionable issues.

@nwparker
nwparker marked this pull request as ready for review October 24, 2026 07:08
@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant