(path: str, old_text: str, new_text: str)
| 522 | |
| 523 | |
| 524 | def run_edit(path: str, old_text: str, new_text: str) -> str: |
| 525 | try: |
| 526 | fp = safe_path(path) |
| 527 | c = fp.read_text() |
| 528 | if old_text not in c: |
| 529 | return f"Error: Text not found in {path}" |
| 530 | fp.write_text(c.replace(old_text, new_text, 1)) |
| 531 | return f"Edited {path}" |
| 532 | except Exception as e: |
| 533 | return f"Error: {e}" |
| 534 | |
| 535 | |
| 536 | TOOL_HANDLERS = { |
no test coverage detected