Files

Exact-string edit of a text file

Replaces an exact old_text span with new_text. Fails 422 on zero or (without replace_all) multiple matches, 409 when revision (from a prior read) no longer matches the bytes on disk, and 415 on binary files. Matching is literal (no Unicode normalization).

post/v1/filesystem/edit-file

Request

  • Base URL: http://localhost:9998
  • URL: http://localhost:9998/v1/filesystem/edit-file
  • Auth: HTTP bearer

Request body

pathstring required

Absolute path (tilde expanded) of the file to edit

old_textstring required

Exact span to replace; must not be empty

new_textstring required
replace_allboolean
revisionstring

Revision hash from a prior file read; 409 on mismatch

Response

Edit applied

pathstring required
replacementsinteger required
revisionstring required

Hash of the post-edit file content

Changes

No recorded changes to this operation across all 1 revision of this API.