Text conflict render
text-conflict-render · version 1.0.0 · Text · free, no key needed
Render text and conflict parts as merge or diff3 conflict-marker text.
Use when you need to: text conflict render · render conflict marker blocks · emit merge or diff3 conflict text.
Supported
- text conflict render
- render conflict marker blocks
- emit merge or diff3 conflict text
Not supported
- nested conflict markers
- preserve marker CR/LF
- git mergetool filesystem access
- unicode normalization
- fuzzy matching
Behavior
- parts is an array of {type:"text", text} or {type:"conflict", ours, theirs} objects. Unknown keys on a part are rejected.
- marker_style merge (default) allows conflict keys type, ours, theirs only; a base key is rejected. diff3 requires base.
- Text parts are copied verbatim. Conflict parts emit LF marker lines: <<<<<<< ours_label, optional ||||||| base_label, =======, >>>>>>> theirs_label.
- Nonempty ours, theirs, or base that does not already end with LF gets a trailing LF before the next marker. Empty sides stay empty.
- Labels default to ours, theirs, and base. Labels are nonempty, at most 256 UTF-8 bytes, and must not contain CR or LF.
- Well-formed parts whose conflict inner texts already use LF line endings round-trip with text-conflict-parse.
Input
parts(array of object, required)marker_style(one of "merge", "diff3", optional)ours_label(string, optional): min length 1; max length 256theirs_label(string, optional): min length 1; max length 256base_label(string, optional): min length 1; max length 256
Output
text(string, required): max length 1048576
Limits
- max text bytes: 262144
- max label bytes: 256
- max output bytes: 1048576
Example
Request input:
{
"parts": [
{
"type": "text",
"text": "keep\n"
},
{
"type": "conflict",
"ours": "aaa\n",
"theirs": "bbb\n"
}
]
}
Response:
{
"result": {
"text": "keep\n<<<<<<< ours\naaa\n=======\nbbb\n>>>>>>> theirs\n"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "text-conflict-render",
"version": "1.0.0",
"input": {
"parts": [
{
"type": "text",
"text": "keep\n"
},
{
"type": "conflict",
"ours": "aaa\n",
"theirs": "bbb\n"
}
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/text-conflict-render/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"parts":[{"type":"text","text":"keep\n"},{"type":"conflict","ours":"aaa\n","theirs":"bbb\n"}]}'
The machine-readable contract is at /v1/tools/text-conflict-render/versions/1.0.0.
CLI
node cli.mjs run text-conflict-render 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Text conflict parse: Parse merge or diff3 conflict-marker text into ordered text and conflict parts.
- Text three way merge: Three-way merge of text line records with merge or diff3 conflict markers.
- Text indentation detect: Detect whether a text uses tabs or spaces for indentation by counting lines.
- Text unified diff: Emit a one-file unified diff of two texts with comma counts and LF document breaks.
- Text apply unified patch: Apply a one-file unified patch to text at original line addresses with exact hunk matches.
- Text control characters find: Find non-whitespace control characters in a text string.