Skip to content

feat: Projects & Worktrees cleanup (CLI + app) - #202

Closed
HigorAlves wants to merge 2 commits into
momenbasel:mainfrom
HigorAlves:feat/dev-worktree-purge
Closed

HigorAlves wants to merge 2 commits into
momenbasel:mainfrom
HigorAlves:feat/dev-worktree-purge

Conversation

@HigorAlves

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a way to point PureMac at a projects folder (for example ~/Developer) and clean up developer clutter in one pass:

  • Build artifacts: node_modules, .turbo, .next, target, .venv and the rest of the existing purge list.
  • Linked git worktrees, including .claude/worktrees, .orc, .supacode and ~/.supacode, plus orphaned worktree folders whose repository is gone.

Available in two places:

  • CLI: puremac purge ~/Developer --worktrees (opt-in, so --force never removes worktrees unattended). ~/Developer and ~/Developers are now default scan roots.
  • App: new Projects & Worktrees entry under Developer Cleanup in the sidebar.

Safety

  • Preselected: artifacts older than 7 days, and worktrees that are clean, have every commit on a remote, and are not recent.
  • Listed but unchecked, with the reason shown: uncommitted changes, unpushed commits, locked, recent, orphaned.
  • Worktrees are removed with git worktree remove (never --force) followed by git worktree prune, so git refuses anything with uncommitted changes and repo metadata stays consistent. Branches are never deleted.
  • Detached worktrees whose commits are on no branch or remote are skipped.
  • Worktree sizes exclude nested artifacts, so nothing is counted twice.
  • Deletion is permanent and always behind a confirmation (the CLI --force path skips it, as it already does for artifacts).
  • This frees disk space, not memory.

Type of change

  • New feature

Testing

  • CLI: swift test passes (70 tests, 14 new, using real temporary git repos and worktrees).
  • App: xcodebuild test passes (190 tests, 13 new, including localization key parity).
  • Dry run of puremac purge ~/Developer --worktrees against a real folder found and classified existing .orc worktrees without deleting anything.
  • Opened the new screen in a debug build and checked sidebar placement and scanning.
  • Tested on macOS Ventura (13.x)
  • Tested on macOS Sonoma (14.x)
  • Tested on macOS Sequoia (15.x) or later

New localization strings are English in every language file as a fallback; translations are welcome.

Size-budget-override: the feature spans the CLI and the app. The commits are split so each half can be reviewed separately.

Adds a git worktree scanner and remover to puremac purge. Covers worktrees
registered with repos under the scanned folders plus .claude/worktrees, .orc,
.supacode and ~/.supacode, and orphaned worktree folders. Only clean worktrees
whose commits all exist on a remote and are older than the threshold are
preselected. Removal uses git worktree remove without --force, then prune.
Adds ~/Developer and ~/Developers to the default purge roots.

Size-budget-override: feature spans CLI and app; the CLI half is the core logic and tests
New tool that scans a chosen folder for build artifacts (node_modules,
.turbo, .next, target, ...) and linked git worktrees, including
.claude/worktrees, .orc and Supacode. Old artifacts and clean, pushed
worktrees are preselected; everything else is listed with the reason it is
left unchecked. Deletion is permanent after confirmation; worktrees are
removed with git worktree remove (never forced). Adds localization keys to
every language file and documents the feature in both READMEs.

Size-budget-override: feature spans CLI and app; the app half is the service, view and wiring
@momenbasel

momenbasel commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Thanks. The CLI half landed as your commit 9fc197c in 9028c74 (#209), plus cad9be4, which skips orphaned worktree folders instead of deleting them, because moving a repository leaves its worktrees in that state.
Reason for the CLI half: worktrees that coding agents and tools such as .orc and Supacode create pile up with no cleanup path, and this removes them only through git worktree remove.
Closing the app half: node_modules and Rust targets now come from the marker-checked categories in #197, and this screen removed folders such as target, Pods and venv by name with no project check.

@momenbasel momenbasel closed this Nov 19, 2026
iramarfalcao pushed a commit to iramarfalcao/PureMac that referenced this pull request Nov 19, 2026
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