diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-16 01:18:35 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-16 01:18:35 -0500 |
| commit | 38e64bc76d4e1bb5a036fa5612dbf4c576a9bbc9 (patch) | |
| tree | 439a7156f7a43a9a443be3a30d75cf0dded05b89 /githooks | |
| parent | 6a3e93ec83e4e87a0cd85fc0874758a3088eccbf (diff) | |
| download | dotemacs-38e64bc76d4e1bb5a036fa5612dbf4c576a9bbc9.tar.gz dotemacs-38e64bc76d4e1bb5a036fa5612dbf4c576a9bbc9.zip | |
feat(gptel-tools): wire update_text_file as a local tool with tests
I rewrote `update_text_file.el` in pure Elisp. The previous version
shelled out to sed for everything, had a stray quote terminator at EOF
(line 149) that broke loading, produced literal backslash-n where
actual newlines were expected, and prompted via `y-or-n-p` redundantly
with gptel's own `:confirm t` flag.
The five operations -- replace, append, prepend, insert-at-line,
delete-lines -- split into pure string transforms that test without
touching the disk. The file-level wrapper validates the path, enforces
a 10MB size limit, takes a timestamped backup, and writes atomically.
No backup is created when the operation is a no-op. Patterns are
literal substrings (not regex) so the model can't trip over
metacharacter quoting.
`tests/test-update-text-file.el` covers Normal / Boundary / Error per
operation plus the file-level wrapper. 48 tests green. Added
`update_text_file` to `cj/gptel-local-tool-features` so gptel exposes
the tool after restart.
Diffstat (limited to 'githooks')
0 files changed, 0 insertions, 0 deletions
