wt-cleanup
/wt:cleanup - Clean Up Merged Worktrees
Description
Quick command to identify and remove merged or stale worktrees.
Usage
/wt:cleanup
What It Does
This slash command:
- Activates the Git Worktree Manager skill (
@git-worktree) - Automatically runs the
*cleanupcommand - Helps you clean up old worktrees
Workflow
The command will:
- List all worktrees - Show all active worktrees
- Identify merged branches - Find branches already merged to main/develop
- Close orphaned PRs - For each worktree being removed:
gh pr list --head {branch} --state open --json number- If PR exists:
gh pr close {number} --comment "Story worktree cleaned up — closing stale PR" - If
ghCLI is unavailable: skip with WARNING, continue cleanup
- Ask which to remove - Interactive selection
- Remove selected worktrees - Safely delete worktrees
- Prune worktree references - Clean up git metadata
Benefits
✅ Smart Detection - Identifies merged branches automatically ✅ Safe Cleanup - Only suggests merged branches ✅ Selective Removal - Choose which to remove ✅ Complete Cleanup - Removes worktrees and branches
Notes
- Only suggests worktrees with merged branches
- You can choose which ones to remove
- Warns about unmerged branches
- Prunes git metadata after cleanup
- Closes any orphaned GitHub PRs associated with branches being removed (
ghCLI optional — skipped with warning if unavailable)
More from michael-menard/monorepo
review
Comprehensive code review with parallel specialist sub-agents. Analyzes requirements traceability, code quality, security, performance, accessibility, test coverage, and technical debt. Produces detailed findings and calls /qa-gate for final gate decision.
40lint-fix
Run ESLint with --fix across the repo (or a scope), capture errors that could not be auto-fixed, group them by rule, store results in the KB, and scan for eslint-disable suppressions (which are covered-up errors, not fixes). Use this skill instead of running pnpm lint directly.
25plans
List all plans from the KB database with key metadata. Use to get a quick overview of plan statuses, priorities, and story counts.
24wt-list
List all active git worktrees with their status. Use when checking what worktrees exist, their branches, and which has uncommitted changes. Quick overview command.
23roadmap
Show the active roadmap — current and future plans only (excludes implemented, superseded, archived). Quick view of what's in flight and coming next.
23review-draft-story
Comprehensive draft story review with parallel specialist sub-agents. Spawns PM, UX, and SM agents to review stories from product, design, and implementation readiness perspectives before development begins.
23