Expand description
Span-safe replacement engine with atomic writes and validation gates.
This module provides byte-exact patching with:
- Atomic file replacement (write temp + fsync + rename)
- File hash validation (before/after)
- Tree-sitter reparse gate (multi-language)
- Compiler validation gate (multi-language)
- Optional rust-analyzer gate (Rust only)
- Automatic rollback on any failure
Re-exports§
pub use pattern::apply_pattern_replace;pub use pattern::find_pattern_in_files;pub use pattern::PatternReplaceConfig;pub use pattern::PatternReplaceResult;
Modules§
- pattern
- Pattern-based search and replace with AST confirmation.
Structs§
- Backup
Manifest - Manifest describing a backup operation.
- Backup
Writer - Writer for creating backups of files before patching.
- File
Patch Summary - Result summary for a patched file.
- Preview
Report - Preview metadata describing the diff produced by a patch.
- Span
Batch - Collection of replacements that must succeed atomically.
- Span
Replacement - Replacement to apply within a specific file.
Functions§
- apply_
batch_ with_ validation - Apply multiple span replacements atomically across files.
- apply_
patch_ with_ validation - Apply a patch with comprehensive validation and automatic rollback.
- load_
batches_ from_ file - Load span batches from a JSON manifest.
- preview_
patch - Preview a patch by cloning the workspace, applying the change, and validating there.
- preview_
patch_ with_ content - Preview a patch and return before/after content for diff generation.
- replace_
span - Replace byte span without validation (legacy method for backward compatibility).
- restore_
from_ manifest - Restore files from a backup manifest.
- validate_
utf8_ span - Validate that a span aligns with UTF-8 boundaries.