fix(#2853): sync .sisyphus state from worktree to main repo before removal

When .sisyphus/ is gitignored, task state written during worktree execution
is lost when the worktree is removed. Fix:

- add worktree-sync.ts: syncSisyphusStateFromWorktree() copies .sisyphus/
  contents from worktree to main repo directory
- update start-work.ts template: documents the sync step as CRITICAL when
  worktree_path is set in boulder.json
- update work-with-pr/SKILL.md: adds explicit sync step before worktree removal
- export from boulder-state index
- test: 5 scenarios covering no-.sisyphus, nested dirs, overwrite stale state
This commit is contained in:
YeonGyu-Kim
2026-03-27 14:11:45 +09:00
parent 670d8ab175
commit 19ab3b5656
5 changed files with 144 additions and 4 deletions
@@ -115,9 +115,14 @@ Register these as task/todo items so progress is tracked and visible throughout
When working in a worktree (\`worktree_path\` is set in boulder.json) and ALL plan tasks are complete:
1. Commit all remaining changes in the worktree
2. Switch to the main working directory (the original repo, NOT the worktree)
3. Merge the worktree branch into the current branch: \`git merge <worktree-branch>\`
4. If merge succeeds, clean up: \`git worktree remove <worktree-path>\`
5. Remove the boulder.json state
2. **Sync .sisyphus state back**: Copy \`.sisyphus/\` from the worktree to the main repo before removal.
This is CRITICAL when \`.sisyphus/\` is gitignored — state written during worktree execution would otherwise be lost.
\`\`\`bash
cp -r <worktree-path>/.sisyphus/* <main-repo>/.sisyphus/ 2>/dev/null || true
\`\`\`
3. Switch to the main working directory (the original repo, NOT the worktree)
4. Merge the worktree branch into the current branch: \`git merge <worktree-branch>\`
5. If merge succeeds, clean up: \`git worktree remove <worktree-path>\`
6. Remove the boulder.json state
This is the DEFAULT behavior when \`--worktree\` was used. Skip merge only if the user explicitly instructs otherwise (e.g., asks to create a PR instead).`