{"repo":"Romelium/mpatch","free":true,"listed":false,"github":"https://github.com/Romelium/mpatch","clone":"git clone https://github.com/Romelium/mpatch.git","description":"Applies diffs based on context, not line numbers. Useful for AI-generated code.","language":"Rust","stars":20,"topics":["ai","automation","cli","cli-app","code-generation","command-line-tool","context-aware","dev-tools","developer-tools","diff"],"license":"MIT","category":"cli-tools","readme_excerpt":"Mpatch mpatch is a contextual patching program/library tailored towards the \"messy\" world of modern software development. Different from standard patch and git apply , which require line number/context to be exact matches, mpatch utilizes fuzzy matching , looking for patches based on the context around the change in the code. This tool was created to easily apply diffs produced by LLMs (ChatGPT, Gemini, Claude, Copilot) , since they tend to hallucinate the exact line numbers or the context around the patch. 🐍 Python Developer? We have official Python bindings! Check out the mpatch PyPI package and Python documentation. --- The Problem and the Solution You ask an AI to modify some code. You get the diff. Except, the comment inside this code block is missing. Standard patch : Won't work. The context isn't exact byte-for-byte match. mpatch : Works! It notices that the code structure hasn't changed and applies the patch. Original File (Modified Locally) AI-Generated Patch (Stale Context) patch Result mpatch Result :--- :--- :--- :--- fn main() { // Forgettable comment println!(\"Hello\"); } fn main() { - println!(\"Hello\"); + println!(\"World\"); } ❌ Failed Hunk #1 FAILED at 1. 1 out of 1 hunk FAILED fn main() { // Forgettable comment println!(\"World\"); } --- Supported Input Formats mpatch automatically detects the input format. Flags are not needed. 1. Code Blocks in Markdown: The default output format for language models. Uses either rust , or other code blocks if they have diff he","default_branch":null,"files":null,"tree":[],"storefront":"/r/Romelium","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Romelium/mpatch/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}