3.8 KiB
3.8 KiB
| id | parent | milestone | provides | key_files | key_decisions | patterns_established | observability_surfaces | duration | verification_result | completed_at | blocker_discovered | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| T01 | S03 | M001 |
|
|
|
|
|
12m | passed | 2026-03-12 | false |
T01: Fix worktree create ordering and add deterministic merge dispatch
Fixed handleCreate to commit before forking and handleMerge to use deterministic squash-merge with conflict-aware LLM fallback.
What Happened
- Added imports:
mergeWorktreeToMainfrom worktree-manager.js,inferCommitTypefrom git-service.js,execSyncfrom node:child_process. - In
handleCreate(), movedautoCommitCurrentBranch()call (now line 357) beforecreateWorktree()call (now line 361). This ensures dirty working state is committed before the new worktree forks from HEAD. - In
handleMerge(), after the confirmation prompt and CWD switch to basePath, inserted a deterministic merge attempt usingmergeWorktreeToMain(basePath, name, commitMessage). The commit message is built as{inferCommitType(name)}({name}): merge worktree {name}. - On success, the user is notified with file/line stats and the merge returns early (skipping LLM dispatch entirely).
- On conflict (error message matches
/conflict/i),git merge --abortcleans up the failed merge, a warning notification explains the fallback, and execution continues to the existing LLM dispatch path. - On non-conflict errors, the error is surfaced directly to the user and the function returns without LLM fallback.
Verification
npm run build— passes cleannpm run test— 114 pass, 4 fail (pre-existing, unrelated)grep -nconfirmsautoCommitCurrentBranchat line 357 precedescreateWorktreeat line 361 in handleCreategrep -nconfirmsmergeWorktreeToMaincalled at line 676 inside handleMerge- All 6 must-haves from the task plan verified
Slice-level checks (T01 scope):
- ✅
npm run buildpasses - ✅
npm run test— 114/118 pass (4 pre-existing failures) - ✅ autoCommitCurrentBranch line < createWorktree line in handleCreate
- ✅ mergeWorktreeToMain appears in handleMerge
- ⏳
grep -c 'preserved' README.md— not yet addressed (T02 scope) - ⏳
grep -c 'checkpoint' src/resources/GSD-WORKFLOW.md— not yet addressed (T02 scope) - ⏳
grep -c 'Branch kept' src/resources/GSD-WORKFLOW.md— not yet addressed (T02 scope)
Diagnostics
After a /worktree merge operation, inspect the TUI notification messages:
- Deterministic success: shows "✓ Merged {name} → {mainBranch} (deterministic squash)" with commit message
- Conflict fallback: shows "Deterministic merge hit conflicts — falling back to LLM-guided merge."
- Non-conflict error: shows "Failed to merge: {error message}"
Deviations
None.
Known Issues
None.
Files Created/Modified
src/resources/extensions/gsd/worktree-command.ts— Reordered handleCreate (autoCommit before createWorktree), added deterministic merge path in handleMerge with conflict-aware LLM fallback, added imports for mergeWorktreeToMain, inferCommitType, and execSync