feat(mcp): expose the conflict resolver's hunk API over MCP
get_merge_conflicts and resolve_conflict_hunk let an MCP caller resolve a leaveConflictsInTree merge hunk-by-hunk (ours/theirs/base/literal text) instead of grep-parsing diff3 markers itself. Reuses the existing TaskMergeService/ConflictMarkerParser machinery (adds MergeSegment.StartLine and a non-staging TaskMergeService.WriteConflictFileAsync) rather than a second parser. A partially resolved file is written without git add so continue_merge keeps refusing while any hunk still has markers.
This commit is contained in:
@@ -68,6 +68,20 @@ public class ConflictMarkerParserTests
|
||||
Assert.Equal("Y\n", segments[1].Theirs);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Segments_ExposeStartLine()
|
||||
{
|
||||
const string text =
|
||||
"line1\nline2\n<<<<<<< HEAD\nours\n=======\ntheirs\n>>>>>>> branch\nline3\n";
|
||||
|
||||
var segments = ConflictMarkerParser.Parse(text);
|
||||
|
||||
Assert.Equal(3, segments.Count);
|
||||
Assert.Equal(1, segments[0].StartLine); // "line1\nline2\n"
|
||||
Assert.Equal(3, segments[1].StartLine); // the "<<<<<<<" line
|
||||
Assert.Equal(8, segments[2].StartLine); // "line3\n"
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MultipleConflicts_AreEachCaptured()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user