diff options
| -rw-r--r-- | gptel-tools.el | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/gptel-tools.el b/gptel-tools.el index bd76a98..1e8453c 100644 --- a/gptel-tools.el +++ b/gptel-tools.el | |||
| @@ -31,7 +31,31 @@ longer match after external changes." | |||
| 31 | ;; TODO bash_readonly (shell-command-to-string, whitelisted commands) | 31 | ;; TODO bash_readonly (shell-command-to-string, whitelisted commands) |
| 32 | ;; TODO bash (shell-command-to-string, needs heavy filtering) | 32 | ;; TODO bash (shell-command-to-string, needs heavy filtering) |
| 33 | 33 | ||
| 34 | ;; TODO find_files (directory-files-decursively) | 34 | ;; find_files (directory-files-recursively) |
| 35 | (gptel-make-tool | ||
| 36 | :name "find_files" | ||
| 37 | :function (lambda (dir &optional pattern) | ||
| 38 | (let ((git-dir (concat (file-name-as-directory dir) ".git"))) | ||
| 39 | (delq nil (mapcar (lambda (f) | ||
| 40 | (unless (string-prefix-p git-dir f) f)) | ||
| 41 | (directory-files-recursively dir (or pattern "")))))) | ||
| 42 | :description "\ | ||
| 43 | Recursively find all files in a given directory, excluding files within | ||
| 44 | .git directories. Returns a list of absolute file paths. Optionally | ||
| 45 | accepts a pattern to filter file names (e.g., `*.el' for Emacs Lisp | ||
| 46 | files). Use this to discover files in a project directory before reading | ||
| 47 | or editing them." | ||
| 48 | :args (list '(:name "directory" | ||
| 49 | :type string | ||
| 50 | :description "Path to the directory to be read, relative to the working directory.") | ||
| 51 | '(:name "pattern" | ||
| 52 | :type string | ||
| 53 | :description "Optional file name pattern to filter results, e.g. `*.el' or `*.txt'." | ||
| 54 | :optional t)) | ||
| 55 | :async nil | ||
| 56 | :confirm nil | ||
| 57 | :include t) | ||
| 58 | |||
| 35 | ;; TODO grep (just grep :D) | 59 | ;; TODO grep (just grep :D) |
| 36 | ;; TODO fetch_url (use gptel-agent's one as a base, but needs mime handling like PDFs and images) | 60 | ;; TODO fetch_url (use gptel-agent's one as a base, but needs mime handling like PDFs and images) |
| 37 | ;; TODO web_search (use gptel-agent's eww/shr method as a base) | 61 | ;; TODO web_search (use gptel-agent's eww/shr method as a base) |
