Expand description
Patch application engine — combo patches and move corrections.
Provides a unified diff parser, applicator, validator, and generator so agents can land precise code changes without rewriting entire files. Think of it as a carefully choreographed combo: each hunk is a move in the sequence, and the engine ensures every hit connects cleanly.
Structs§
- File
Patch - A patch for a single file — the full combo sequence for one target.
- Patch
Conflict - A detected conflict when validating a patch against file content.
- Patch
Hunk - A contiguous region of changes within a file patch — one move in the combo.
- Patch
Set - A collection of file patches — a full combo chain across the codebase.
Enums§
- Conflict
Type - Classification of a patch conflict — how badly the move missed.
- Patch
Line - A single line in a patch hunk — context, removal, or addition.
Functions§
- apply_
patch - Apply a single file patch to the original content — execute the combo.
- apply_
patch_ fuzzy - Apply a file patch with fuzzy matching — allow hunks to land at a nearby offset.
- generate_
unified_ diff - Generate a unified diff from two strings — choreograph the combo notation.
- parse_
unified_ diff - Parse a unified diff string into a
PatchSet— decode the combo notation. - reverse_
patch - Create a reverse patch — swap additions and removals, old and new paths.
- validate_
patch - Validate a patch against the original content without applying it.