Text conflict parse
text-conflict-parse · version 1.0.0 · Text · free, no key needed
Parse merge or diff3 conflict-marker text into ordered text and conflict parts.
Use when you need to: text conflict parse · parse conflict marker blocks · split merge conflict text into parts.
Supported
- text conflict parse
- parse conflict marker blocks
- split merge conflict text into parts
Not supported
- nested conflict markers
- git mergetool filesystem access
- unicode normalization
- fuzzy matching
- RFC 6902 JSON Patch
Behavior
- text is scanned as line records; conflict blocks start at a line whose text begins with "<<<<< " plus a nonempty label.
- A merge block is ours lines, a line whose text is "=======", theirs lines, then a ">>>>>>> " closer. diff3 inserts a "||||||| " base section before =======.
- Nested <<<<<<< markers, missing closers, unknown marker order, and ||||||| without a following ======= are rejected.
- parts is an ordered list of {type:"text", text} or {type:"conflict", ours, theirs} with base only when a ||||||| section existed.
- ours, theirs, and base are the inner texts without marker lines, preserving inner bytes including original record eols.
- conflict_count is the number of conflict parts. Empty text yields no parts and conflict_count 0.
Input
text(string, required): max length 262144
Output
parts(array of object, required)conflict_count(integer, required): min 0
Limits
- max text bytes: 262144
- max line count: 4096
- max line bytes: 16384
- max output bytes: 1048576
Example
Request input:
{
"text": "keep\n<<<<<<< ours\naaa\n=======\nbbb\n>>>>>>> theirs\n"
}
Response:
{
"result": {
"parts": [
{
"type": "text",
"text": "keep\n"
},
{
"type": "conflict",
"ours": "aaa\n",
"theirs": "bbb\n"
}
],
"conflict_count": 1
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "text-conflict-parse",
"version": "1.0.0",
"input": {
"text": "keep\n<<<<<<< ours\naaa\n=======\nbbb\n>>>>>>> theirs\n"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/text-conflict-parse/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"text":"keep\n<<<<<<< ours\naaa\n=======\nbbb\n>>>>>>> theirs\n"}'
The machine-readable contract is at /v1/tools/text-conflict-parse/versions/1.0.0.
CLI
node cli.mjs run text-conflict-parse 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Text conflict render: Render text and conflict parts as merge or diff3 conflict-marker text.
- Text three way merge: Three-way merge of text line records with merge or diff3 conflict markers.
- Text lines chunk: Split parsed lines into consecutive chunks of size lines each.
- Text parse unified patch: Parse a one-file unified patch into path names and 0-based hunks.
- Text split exact: Split text on an exact literal separator and reject results that exceed max_parts.
- Text apply unified patch: Apply a one-file unified patch to text at original line addresses with exact hunk matches.