feat(KB-023): add smart automatic merge conflict resolution

- Add conflict classification API: classifyConflict(), getConflictedFiles(), resolveWithOurs(), resolveWithTheirs(), resolveTrivialWhitespace()

- Auto-resolve lock files (ours), generated files (theirs), and trivial whitespace conflicts

- Add smartConflictResolution setting (alias for autoResolveConflicts)

- Track resolution path via resolutionMethod and autoResolvedCount in MergeResult

- Implement 3-attempt retry logic with escalating strategies in aiMergeTask

- Export pattern constants LOCKFILE_PATTERNS and GENERATED_PATTERNS
This commit is contained in:
gsxdsm
2026-03-29 18:46:57 -07:00
parent 95fe32560d
commit 5993264e25
5 changed files with 636 additions and 38 deletions

View File

@@ -0,0 +1,17 @@
---
"@dustinbyrne/kb": minor
---
Add smart automatic merge conflict resolution. Lock files, generated files, and trivial whitespace conflicts are now resolved automatically without AI intervention, reducing merge latency and API costs.
New API in `@kb/engine`:
- `classifyConflict(filePath, cwd)` - returns 'lockfile-ours' | 'generated-theirs' | 'trivial-whitespace' | 'complex'
- `getConflictedFiles(cwd)` - list conflicted files via git
- `resolveWithOurs(filePath, cwd)` - resolve using current branch
- `resolveWithTheirs(filePath, cwd)` - resolve using incoming branch
- `resolveTrivialWhitespace(filePath, cwd)` - resolve whitespace conflicts
- `isTrivialWhitespaceConflict(filePath, cwd)` - detect using git diff-tree -w
- Exported pattern constants: `LOCKFILE_PATTERNS`, `GENERATED_PATTERNS`
New setting: `smartConflictResolution` (alias for `autoResolveConflicts`)
New MergeResult fields: `resolutionMethod`, `autoResolvedCount` for tracking resolution paths