{
"issueNumber": 270,
"branchName": "fix/270-idempotent-worktree",
"generatedAt": "2026-04-03T12:00:00Z",
"stories": [
{
"id": "S1",
"title": "Implement idempotent createWorktree() logic with isValidWorktree helper and three-path branching",
"priority": 1,
"dependsOn": [],
"acceptanceCriteria": [
"isValidWorktree() helper checks git worktree list for the given path",
"Valid existing worktree is reused with fetch+reset instead of removal",
"Invalid/corrupted worktree directory is removed and falls through to branch-check",
"Existing local branch without worktree uses git worktree add <path> <branch> (no -b)",
"Fresh start (no worktree, no branch) uses git worktree add -b <branch> <path> origin/master",
"git branch -D block (old lines 100-118) is completely removed",
"git fetch origin errors in reuse path are surfaced, not swallowed"
],
"passes": false,
"completedAt": null
},
{
"id": "S2",
"title": "Add unit tests for all four idempotent paths and update existing tests",
"priority": 2,
"dependsOn": [
"S1"
],
"acceptanceCriteria": [
"Test: worktree exists and is valid → reused without removal",
"Test: worktree exists but is invalid → removed, falls through to branch-check",
"Test: branch exists locally, no worktree → git worktree add without -b",
"Test: neither exists → fresh git worktree add -b (existing behavior)",
"Existing tests updated to remove assertions on git branch -D behavior",
"npm run test passes with zero failures",
"npm run lint passes with zero warnings"
],
"passes": false,
"completedAt": null
}
]
}