Add a "Prune worktrees" palette action #54

Merged
pedromcaraujo merged 1 commit from prune-worktrees into main 2026-11-07 17:59:08 +00:00

Worktree sessions only closed one at a time (sidebar × / Close worktree), so finished ones stayed open long after they were used.

Summary

  • Palette → Prune worktrees closes every clean worktree across all channels: session killed, worktree removed, branch kept.
  • Shows the list first (what goes, what's kept and why) and asks to confirm.
  • Kept: uncommitted/untracked changes, a Claude that is mid-turn, the session you're in. Never forces — each worktree is re-checked on the real run, so one that changed after the confirm is skipped, not lost.
  • Backend: POST /worktrees/prune (dry_run for the confirm list, keep for the current session). close and prune share the dirty-check/removal helpers; /status's session enumeration is factored out so prune can skip busy sessions.
  • README, tmux shortcuts sheet and nginx comment updated.

Test plan

  • Throwaway repo: clean worktree removed + its tmux session killed, a worktree whose directory was deleted is pruned, dirty one skipped, all branches kept
  • /worktrees/close still 409s on a dirty worktree
  • Launcher JS passes node --check
  • After deploy: palette shows Prune worktrees, confirm dialog lists the right worktrees, sidebar updates
Worktree sessions only closed one at a time (sidebar `×` / *Close worktree*), so finished ones stayed open long after they were used. ## Summary - Palette → **Prune worktrees** closes every *clean* worktree across all channels: session killed, worktree removed, **branch kept**. - Shows the list first (what goes, what's kept and why) and asks to confirm. - Kept: uncommitted/untracked changes, a Claude that is mid-turn, the session you're in. Never forces — each worktree is re-checked on the real run, so one that changed after the confirm is skipped, not lost. - Backend: `POST /worktrees/prune` (`dry_run` for the confirm list, `keep` for the current session). `close` and `prune` share the dirty-check/removal helpers; `/status`'s session enumeration is factored out so prune can skip busy sessions. - README, tmux shortcuts sheet and nginx comment updated. ## Test plan - [x] Throwaway repo: clean worktree removed + its tmux session killed, a worktree whose directory was deleted is pruned, dirty one skipped, all branches kept - [x] `/worktrees/close` still 409s on a dirty worktree - [x] Launcher JS passes `node --check` - [ ] After deploy: palette shows *Prune worktrees*, confirm dialog lists the right worktrees, sidebar updates
Add a "Prune worktrees" palette action
All checks were successful
CI / check (pull_request) Successful in 20s
0333bbca17
Worktree sessions only closed one at a time from the sidebar ×, so finished
ones piled up long after they were used. The palette now has "Prune
worktrees": it closes every clean worktree in every channel at once (session
killed, checkout removed, branch kept), after listing what goes and what stays.

Kept: worktrees with uncommitted/untracked changes, a Claude that is mid-turn,
and the session you're looking at. Never forces; cleanliness is re-checked on
the real run, so a worktree that changed after the confirm is skipped.

Backend: POST /worktrees/prune (with dry_run for the confirm list). Close and
prune share the dirty check and removal helpers; /status's enumeration is
factored out so prune can skip busy sessions.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pedromcaraujo/forge!54
No description provided.