M1: edit tool with opencode's replacer chain, ported verbatim

Ports opencode's multi-strategy string-replacer chain (and its test table) into harness-tools::edit, giving the edit tool the same fuzzy-match fallback behavior opencode relies on.
This commit is contained in:
2026-07-10 16:19:38 +02:00
parent a5af873924
commit 4118279da1
3 changed files with 1167 additions and 1 deletions
+4 -1
View File
@@ -1,4 +1,5 @@
mod bash;
mod edit;
mod glob;
mod grep;
mod paths;
@@ -6,6 +7,7 @@ mod read;
mod write;
pub use bash::BashTool;
pub use edit::EditTool;
pub use glob::GlobTool;
pub use grep::GrepTool;
pub use read::ReadTool;
@@ -15,10 +17,11 @@ use std::sync::Arc;
use harness_core::tool::ToolRegistry;
/// Registers the M1 built-ins (`edit` is added separately once its replacer chain lands).
/// Registers all M1 built-ins: read, write, edit, bash, glob, grep.
pub fn register_builtins(registry: &mut ToolRegistry) {
registry.register(Arc::new(ReadTool));
registry.register(Arc::new(WriteTool));
registry.register(Arc::new(EditTool::new()));
registry.register(Arc::new(BashTool));
registry.register(Arc::new(GlobTool));
registry.register(Arc::new(GrepTool));