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

@@ -184,6 +184,10 @@ export interface Settings {
* intervention. When AI resolution fails, the system will retry with escalating
* strategies. Default: true. */
autoResolveConflicts?: boolean;
/** Alias for autoResolveConflicts. When true, enables automatic resolution of
* lock files (ours), generated files (theirs), and trivial whitespace conflicts
* without spawning an AI agent. Default: true. */
smartConflictResolution?: boolean;
}
export const DEFAULT_SETTINGS: Settings = {
@@ -202,6 +206,7 @@ export const DEFAULT_SETTINGS: Settings = {
defaultModelId: undefined,
defaultThinkingLevel: undefined,
autoResolveConflicts: true,
smartConflictResolution: true,
};
export interface BoardConfig {
@@ -218,8 +223,12 @@ export interface MergeResult {
error?: string;
/** Strategy that successfully resolved the merge, if any */
resolutionStrategy?: "ai" | "auto-resolve" | "theirs";
/** Alias for resolutionStrategy — how conflicts were resolved (for metrics/debugging) */
resolutionMethod?: "ai" | "auto" | "mixed" | "theirs";
/** Number of retry attempts made (1 = first attempt succeeded, 2-3 = retries needed) */
attemptsMade?: 1 | 2 | 3;
/** Number of files auto-resolved (for tracking mixed resolution scenarios) */
autoResolvedCount?: number;
}
export const COLUMN_LABELS: Record<Column, string> = {