aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-16 04:26:20 -0500
committerCraig Jennings <c@cjennings.net>2026-05-16 04:26:20 -0500
commitd9ec1a32bda45f2863a11e9fd2fd5c0e2a4c23ad (patch)
tree39efc19c7779a03d6fe116be622d96b54eddd809 /modules
parentdc359b96c7e7bc405bd4d20c348b572562f49d19 (diff)
downloaddotemacs-d9ec1a32bda45f2863a11e9fd2fd5c0e2a4c23ad.tar.gz
dotemacs-d9ec1a32bda45f2863a11e9fd2fd5c0e2a4c23ad.zip
feat(gptel-tools): wire git_status / git_log / git_diff as local tools
Three read-only git context tools so gptel can see what's changed without me pasting `git status` / `git log` / `git diff` output into every chat turn. Builds the first batch from the ADOPT bucket in `docs/design/gptel-tools-shortlist.org`. Shape per tool: - `gptel-tools/git_status.el` — `git status --short --branch` for a directory inside a git working tree under HOME. Returns the porcelain output, or a "Clean working tree" marker when only the branch line is present. - `gptel-tools/git_log.el` — `git log --oneline -nN` with an optional `--since` filter. N defaults to 20, capped at 100; nil / non- integer / out-of-range N falls back to the default. - `gptel-tools/git_diff.el` — `git diff [REF1 [REF2]] [-- FILE]`. Output capped at ~500KB so a runaway diff can't blow up context; truncation is reported inline. Validation is uniform: path must resolve under HOME, must be a directory, must be inside a git working tree (verified via `git rev-parse --is-inside-work-tree`). Color is disabled via `-c color.ui=false` at the git level (`git status` doesn't accept `--no-color` directly). Tests run against real temp git repos created via `process-file`, not mocked — there's nothing in gptel-tools/git_*.el that's process-mockable in a meaningful way, and a real `git init` + a couple of commits is cheaper than building a fake. 31 tests total: 7 for git_status, 11 for git_log, 13 for git_diff. Wired into `cj/gptel-local-tool-features` so gptel exposes the three tools on next restart.
Diffstat (limited to 'modules')
-rw-r--r--modules/ai-config.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/ai-config.el b/modules/ai-config.el
index 9ac00bfeb..a04a32a03 100644
--- a/modules/ai-config.el
+++ b/modules/ai-config.el
@@ -59,7 +59,10 @@
write_text_file
update_text_file
list_directory_files
- move_to_trash)
+ move_to_trash
+ git_status
+ git_log
+ git_diff)
"Feature symbols for optional local GPTel tool modules."
:type '(repeat symbol)
:group 'cj)