docs(tools): clarify edit_file selector exclusivity (#5598)
* docs(tools): clarify edit selector exclusivity * docs(tools): streamline edit_file guidance --------- Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
This commit is contained in:
1 parent
bb34b58f47
commit
feb33e1f99
3 files changed
+14
-14
No files matched your search
@@ -40,7 +40,7 @@
|
||||
result with its original consumer or checker when one is available.
|
||||
- Use `apply_patch` as the default code editing tool, especially for multi-file changes, structural edits, generated code, moves, adds, or deletes.
|
||||
- Use `apply_patch dry_run=true` when the patch is uncertain and you want validation plus a change summary before writing.
|
||||
- Use `edit_file` only for small exact replacements in one file, with `old_text` copied from `read_file`; when editing a specific numbered line, pass that exact line as `line_hint`; add `occurrence` or `expected_replacements` when ambiguity matters.
|
||||
- Use `edit_file` only for small exact replacements in one file, with `old_text` copied from `read_file`.
|
||||
- Use `write_file` for new files or intentional full-file rewrites, not routine partial edits.
|
||||
- If `apply_patch` or `edit_file` fails, re-read with `force=true`, narrow the context, and try a smaller patch rather than switching to shell `sed` or `echo`.
|
||||
|
||||
|
||||
Reference in new issue
Block a user