Problem
`ghcp-worktree.ts` has `add` and `remove` but no garbage collection. Over time `.gstack/worktrees/` accumulates directories for branches that are already merged to main.
Approach
`bun run bin/ghcp-worktree.ts gc`:
- List worktrees in `.gstack/worktrees/*`
- For each, check whether its branch is merged into the default branch OR whether its PR is closed/merged (via `gh`)
- Remove worktrees whose branches are safely mergeable
Dry-run by default; `--force` to actually remove.
Part of the G8 management story.
Review reference
Adversarial review T6
Problem
`ghcp-worktree.ts` has `add` and `remove` but no garbage collection. Over time `.gstack/worktrees/` accumulates directories for branches that are already merged to main.
Approach
`bun run bin/ghcp-worktree.ts gc`:
Dry-run by default; `--force` to actually remove.
Part of the G8 management story.
Review reference
Adversarial review T6