diff options
| -rw-r--r-- | llm-tools.el | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/llm-tools.el b/llm-tools.el index 6476d15..a125e55 100644 --- a/llm-tools.el +++ b/llm-tools.el | |||
| @@ -25,7 +25,38 @@ longer match after external changes." | |||
| 25 | :confirm nil | 25 | :confirm nil |
| 26 | :include t) | 26 | :include t) |
| 27 | 27 | ||
| 28 | ;; TODO write_file (with-temp-buffer + insert) | 28 | ;; write_file (write-region) |
| 29 | (gptel-make-tool | ||
| 30 | :name "write_file" | ||
| 31 | :function (lambda (file contents) | ||
| 32 | (write-region contents nil file)) | ||
| 33 | :description "\ | ||
| 34 | Overwrite an entire file with new contents. This is a destructive | ||
| 35 | operation that replaces all existing content. Use this tool for: | ||
| 36 | |||
| 37 | - Creating new files from scratch | ||
| 38 | - Completely replacing small files where the new content is the | ||
| 39 | intended final state | ||
| 40 | - Writing generated output, configuration files, or test fixtures | ||
| 41 | |||
| 42 | Do NOT use this for partial edits, appending, or modifying existing | ||
| 43 | files. Use `edit_file` instead for surgical changes to existing | ||
| 44 | content. Always call `read_file` first if the file already exists to | ||
| 45 | preserve content you intend to keep. This tool requires user | ||
| 46 | confirmation before executing." | ||
| 47 | :args '((:name "file" | ||
| 48 | :type string | ||
| 49 | :description "Path to the file to write to, relative to the working directory.") | ||
| 50 | (:name "contents" | ||
| 51 | :type string | ||
| 52 | :description "\ | ||
| 53 | Full file contents to write. This will replace all existing | ||
| 54 | content. Include newlines and indentation as they should appear in the | ||
| 55 | final file.")) | ||
| 56 | :async nil | ||
| 57 | :confirm t | ||
| 58 | :include t) | ||
| 59 | |||
| 29 | ;; TODO edit_file (hashline + patch apply) | 60 | ;; TODO edit_file (hashline + patch apply) |
| 30 | 61 | ||
| 31 | ;; TODO bash_readonly (shell-command-to-string, whitelisted commands) | 62 | ;; TODO bash_readonly (shell-command-to-string, whitelisted commands) |
