MCPcopy Index your code
hub / github.com/shareAI-lab/learn-claude-code / run_edit

Function run_edit

agents/s07_task_system.py:161–170  ·  view source on GitHub ↗
(path: str, old_text: str, new_text: str)

Source from the content-addressed store, hash-verified

159 return f"Error: {e}"
160
161def run_edit(path: str, old_text: str, new_text: str) -> str:
162 try:
163 fp = safe_path(path)
164 c = fp.read_text()
165 if old_text not in c:
166 return f"Error: Text not found in {path}"
167 fp.write_text(c.replace(old_text, new_text, 1))
168 return f"Edited {path}"
169 except Exception as e:
170 return f"Error: {e}"
171
172
173TOOL_HANDLERS = {

Callers 1

s07_task_system.pyFile · 0.70

Calls 1

safe_pathFunction · 0.70

Tested by

no test coverage detected