Skip to main content

Module apply_patch

Module apply_patch 

Source
Expand description

apply_patch — multi-hunk, context-anchored file editing with a graduated fuzzy matcher, adapted from OpenAI Codex’s apply-patch crate. This is Mermaid’s sole file editor: it replaced the brittle exact-match edit_file, which failed on any whitespace or curly-quote drift.

The parser/matcher/apply logic lives in the submodules; this file is the ToolExecutor glue — resolve + lock + checkpoint + apply + render — reusing the same safety gate, per-path write lock, shadow-git checkpoint, confined atomic writes, and diff renderer as the other filesystem tools.

Structs§

ApplyPatchTool
The apply_patch tool: apply a *** Begin Patch … *** End Patch envelope.