Skip to content

feat: add interactive stale worktree cleanup with wtk clean #33

Description

@nettee

What to build

Add wtk clean, an interactive command for cleaning up leftover/stale worktrees. The command should inspect candidate worktrees, explain why each one appears safe or risky to remove, show a confidence level for cleanup, and support confirmed batch cleanup.

The goal is to make cleanup safer and more transparent than manually deleting directories or running low-level Git commands.

Acceptance criteria

  • wtk clean discovers leftover/stale worktree cleanup candidates.
  • Each candidate includes a human-readable explanation and a cleanup confidence level, such as high/medium/low.
  • The command is interactive by default and requires explicit confirmation before deleting/pruning anything.
  • Users can select multiple candidates and clean them in one confirmed batch.
  • Low-confidence or ambiguous candidates are clearly marked and are not silently cleaned.
  • The command fails fast with a clear error if required repository/worktree state cannot be determined.
  • Tests cover discovery, confidence classification, confirmation flow, cancellation, and batch cleanup behavior.

Blocked by

None - can start immediately

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions