Files
mguinhos d17575771b Projeto: app demo, servidor/firmware em software/, simulacao Godot, planta do bloco D, chapas MDF da base, renders e slides
- app/: app demo (Kivy/buildozer) da API do robo
- software/: servidor RoboMovel (SLAM, profundidade, navegacao) e firmware da base movel (movido de firmware/)
- simulacao/: projeto Godot do robo e script de lancamento servidor + simulacao
- modelos/: planta do 5o andar do bloco D, cena Blender do corredor e modelo real do robo
- partes/mdf/: chapas identificadas e nesting da base do robo (DXF/SVG/FCStd)
- projeto/render, relatorio/imagens, slides: renders finais e apresentacoes de progresso
- ferramentas/scripts: encaixe de chapas, planta do bloco D e render do corredor no Blender
- .gitignore: ignora backups do Blender/FreeCAD e .godot/
2026-10-25 23:38:16 -03:00

1.2 KiB

edit_file

Replace an exact piece of text in a file, leaving the rest alone.

Input — path (required), old_string (required), new_string (optional), replace_all (optional, default false)

write_file overwrites a whole file, so changing one line means reproducing every other one — expensive on a large file and easy to get subtly wrong. This edits in place.

old_string is matched literally, whitespace and indentation included. It must appear exactly once, or the call is refused: include enough surrounding lines to pick out one site. replace_all drops the exactly-once rule and changes every occurrence. An empty new_string deletes the matched text.

The match is not a diff or patch format. Those need context lines and line numbers that drift as the file changes, and a fuzzy match that silently picks the wrong site is worse than a failure. Literal matching gives a clear error instead.

The result carries a coloured diff, the same as write_file.

What it refuses

Text that isn't there, naming the file and pointing at whitespace and indentation as the usual cause.

Text that appears more than once without replace_all, reporting how many times it matched.

Identical old and new strings, which would be a no-op.