Skip to content

feat(source-control): script the worktree audit Step 2b recreate-and-reap remedy #8022

Description

@kyle-sexton

Refs: #7457

Agent Brief

Type: Feature
Summary: One script runs the Step 2b remedy over the paths the user confirmed and stops at the first failure.

Current behavior:
For each confirmed candidate-orphan path, worktree audit Step 2b tells the model to present a hand-run chain: plain mkdir of the path, cd into it, the reap helper with --dry-run, the reap helper, remove the path's .claude, cd .., rmdir. Twenty paths meant an ad-hoc batch script.

Desired behavior:
A script takes the confirmed paths as arguments and runs that same chain for each, in order, stopping at the first failure with the path and step named, and prints a per-path result. It keeps every guard of the chain: plain mkdir that fails when the path exists (so a live directory is never reaped), the reap helper's own cwd-only check, and removal of only the directory it created. A path whose parent is missing fails at mkdir with a message pointing at #7461. Step 2b presents the script instead of the chain, still after per-path confirmation.

Key interfaces:

  • The reap helper's --worktree-path contract (unchanged).
  • The new remedy script's arguments, per-path output and exit status.
  • worktree audit Step 2b's remedy text.

Acceptance criteria:

  • A .test.sh for the script passes under scripts/run-test-file.sh, with a stubbed claude CLI, covering two dead paths reaped in order, an existing path refused without reaping, and a stop after the first failing path.
  • scripts/run-test-file.sh plugins/source-control/scripts/reap-project-plugin-records.test.sh passes.
  • check-skill.sh passes for the worktree skill.
  • A source-control changelog fragment is added and scripts/check-changelog-fragments.sh passes.

Out of scope:


This was generated by AI during backlog shaping. Split from #7457; the owner approved filing it in an attended backlog-shaping session on 2026-10-18.

Activity

  1. added
    needs-human
    on Oct 18, 2026
  2. added
    agent-ready
    and removed
    needs-human
    on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-ready

    Fields

    No fields configured for Feature.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions