{"id":"text-parse-unified-patch","version":"1.0.0","description":"Parse a one-file unified patch into path names and 0-based hunks.","supported_operations":["text parse unified patch","parse unified diff","parse unified patch headers and hunks"],"unsupported_operations":["preserve original CR/LF through unified text","git diff --git headers","index/binary markers","multi-file patches","offset/fuzz patch apply","RFC 6902","filesystem access"],"semantics":["Empty unified yields from_name \"a\", to_name \"b\", hunks [], and identical true.","Non-empty patches must start with --- and +++ headers. git diff --git, index, and binary markers are rejected.","An omitted hunk count is parsed as 1. Output hunk starts are 0-based. Nonzero counts subtract one from the 1-based text start; a zero count keeps the GNU insertion index from the header.","Body values are {text, eol} records. eol is \"\" iff a \"\\ No newline at end of file\" line immediately followed that body line; otherwise eol is \"\\n\".","The unified document uses LF line breaks and does not round-trip original CR/LF from the source file.","strip is an integer 0..8 (default 0) that removes that many leading slash-separated components from both paths; an empty path after strip is rejected.","identical is true iff there are no hunks. Unknown input fields are rejected."],"limits":{"max_text_bytes":262144,"max_path_bytes":1024,"max_line_bytes":16384,"max_hunks":1024,"max_strip":8,"max_output_bytes":1048576},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["unified"],"properties":{"unified":{"type":"string","maxLength":262144},"strip":{"type":"integer","minimum":0,"maximum":8}}},"output_schema":{"type":"object","additionalProperties":false,"required":["from_name","to_name","hunks","identical"],"properties":{"from_name":{"type":"string"},"to_name":{"type":"string"},"hunks":{"type":"array","maxItems":1024,"items":{"type":"object","additionalProperties":false,"required":["old_start","old_count","new_start","new_count","ops"],"properties":{"old_start":{"type":"integer","minimum":0},"old_count":{"type":"integer","minimum":0},"new_start":{"type":"integer","minimum":0},"new_count":{"type":"integer","minimum":0},"ops":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["op","value"],"properties":{"op":{"type":"string","enum":["keep","delete","insert"]},"value":{"type":"object","additionalProperties":false,"required":["text","eol"],"properties":{"text":{"type":"string"},"eol":{"type":"string","enum":["","\n"]}}}}}}}}},"identical":{"type":"boolean"}}},"examples":[{"input":{"unified":"--- a\n+++ b\n@@ -1,1 +1,1 @@\n-a\n+b\n"},"output":{"from_name":"a","to_name":"b","hunks":[{"old_start":0,"old_count":1,"new_start":0,"new_count":1,"ops":[{"op":"delete","value":{"text":"a","eol":"\n"}},{"op":"insert","value":{"text":"b","eol":"\n"}}]}],"identical":false}}],"execute_url":"/v1/tools/text-parse-unified-patch/versions/1.0.0/execute"}