PruneWorktrees runs `git worktree prune` to clean up stale worktree tracking.
(repoDir string)
| 187 | |
| 188 | // PruneWorktrees runs `git worktree prune` to clean up stale worktree tracking. |
| 189 | func PruneWorktrees(repoDir string) error { |
| 190 | cmd := exec.Command("git", "worktree", "prune") |
| 191 | cmd.Dir = repoDir |
| 192 | if out, err := cmd.CombinedOutput(); err != nil { |
| 193 | return fmt.Errorf("failed to prune worktrees: %s", strings.TrimSpace(string(out))) |
| 194 | } |
| 195 | return nil |
| 196 | } |
| 197 | |
| 198 | // DetectOrphanedWorktrees scans .chief/worktrees/ and returns a map of PRD name -> absolute worktree path |
| 199 | // for worktrees that exist on disk. The caller is responsible for determining which are orphaned |
no outgoing calls