* feat(doctor): worktree lifecycle checks, cleanup consolidation, enhanced /worktree list
Phase 1: Worktree lifecycle doctor checks
- worktree_branch_merged: detect worktrees fully merged into main (auto-fixable)
- worktree_stale: warn on worktrees with no commits in 14+ days
- worktree_dirty: warn on stale worktrees with uncommitted changes
- worktree_unpushed: warn on stale worktrees with unpushed commits
- New worktree-health.ts module with shared helpers for status computation
Phase 2: Fold cleanup into doctor
- legacy_slice_branches now fixable (was info-only, doctor fix deletes them)
- snapshot_ref_bloat check added to doctor (was only in /gsd cleanup snapshots)
- /gsd cleanup worktrees wired up as convenience entry point
Phase 3: Enhanced /worktree list
- Shows inline health status per worktree (merge status, dirty files, age, etc)
- Color-coded: green for safe-to-remove, yellow for stale/dirty, dim for active
New git primitives: nativeIsAncestor, nativeLastCommitEpoch, nativeUnpushedCount
* fix: close gaps — rewire cleanup to doctor, add tests
- Rewire handleCleanupBranches to delegate to doctor fix (branch issues)
- Rewire handleCleanupSnapshots to delegate to doctor fix (snapshot issues)
- Remove duplicate cleanup logic from commands-maintenance.ts
- Fix safeToRemove: merged+clean is sufficient (unpushed irrelevant when merged)
- Add 10 new doctor-git tests: worktree_branch_merged detection/fix/no-false-positive, legacy_slice_branches fixable
- Add 21 new worktree-health tests: merged, dirty, unpushed, stale, format
Total: 178 tests pass across 4 suites, 0 failures
* fix(ci): escape glob pattern in JSDoc comment, clean up duplicate comment
* fix: narrow cleanup scope and protect quick branches
* fix(test): trim leading spaces from git branch output assertion
run() calls .trim() so git branch output has no leading spaces.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>