MCPcopy Create free account
hub / github.com/codehamr/codehamr / EditFile

Function EditFile

internal/tools/edit.go:15–62  ·  view source on GitHub ↗

EditFile replaces old_string with new_string in path. old_string must match EXACTLY ONCE; otherwise the file is untouched and an error string is returned so the model sees the failure and reacts, same convention as bash/WriteFile. Empty old_string is rejected (no anchor, every position matches); ol

(path, oldString, newString string)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 13

TestEditFileHappyFunction · 0.85
TestEditFileEmptyPathFunction · 0.85
TestEditFileMissingFileFunction · 0.85
TestEditFileOldNotFoundFunction · 0.85
TestEditFileOldNotUniqueFunction · 0.85
TestEditFileNoOpFunction · 0.85
TestEditFileDeleteFunction · 0.85

Calls 1

differsOnlyInWhitespaceFunction · 0.85

Tested by 12

TestEditFileHappyFunction · 0.68
TestEditFileEmptyPathFunction · 0.68
TestEditFileMissingFileFunction · 0.68
TestEditFileOldNotFoundFunction · 0.68
TestEditFileOldNotUniqueFunction · 0.68
TestEditFileNoOpFunction · 0.68
TestEditFileDeleteFunction · 0.68