Documentation
¶
Overview ¶
Package aiconflict implements a three-way diff panel with AI-powered conflict resolution suggestions. It displays base/ours/theirs content for each conflict region alongside the AI's suggested resolution, and lets the user accept the AI suggestion, pick ours/theirs, or navigate between regions.
The panel defines its own view-model types (ConflictFileData, ConflictRegionData) to avoid importing internal/ai, which has a circular dependency. The caller converts from ai types when sending SetConflictsMsg.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConflictFileData ¶
type ConflictFileData struct {
// Path is the repository-relative file path.
Path string
// Regions contains the conflict regions within this file.
Regions []ConflictRegionData
}
--------------------------------------------------------------------------- View-model types (avoid importing internal/ai to prevent import cycle) --------------------------------------------------------------------------- ConflictFileData holds display data for one conflicted file. The caller converts from ai.ConflictFile + ops.ConflictResolution when building the SetConflictsMsg.
type ConflictRegionData ¶
type ConflictRegionData struct {
// Ours is the text from the current branch.
Ours string
// Theirs is the text from the incoming branch.
Theirs string
// Base is the text from the common ancestor (may be empty).
Base string
// AIResolution is the AI-suggested resolution text. Empty when no AI
// resolution is available for this region.
AIResolution string
// Explanation describes why the AI chose this resolution.
Explanation string
// StartLine is the 1-based line where the conflict begins.
StartLine int
// EndLine is the 1-based line where the conflict ends (inclusive).
EndLine int
// Confidence is a 0.0–1.0 score for the AI's certainty.
Confidence float64
}
ConflictRegionData holds display data for a single conflict region, including the AI resolution if available.
type Panel ¶
--------------------------------------------------------------------------- Panel --------------------------------------------------------------------------- Panel is the AI conflict resolution panel. It shows a three-way diff (base/ours/theirs) with AI-suggested resolutions and lets the user accept or override each region's resolution.
func New ¶
New creates a new AI conflict panel. The theme may be nil; the panel falls back to hard-coded colors when it is.
func (*Panel) Init ¶
--------------------------------------------------------------------------- Panel interface --------------------------------------------------------------------------- Init implements panels.Panel.
func (*Panel) KeyBindings ¶
func (p *Panel) KeyBindings() []panels.KeyBinding
--------------------------------------------------------------------------- KeyBindings --------------------------------------------------------------------------- KeyBindings implements panels.Panel.
type SetConflictsMsg ¶
type SetConflictsMsg struct {
Files []ConflictFileData
}
--------------------------------------------------------------------------- Messages --------------------------------------------------------------------------- SetConflictsMsg delivers conflict data to the panel. The root model converts from ai.ConflictFile / ops.ConflictResolution into these view-model types before sending.