diff options
| -rw-r--r-- | llm-tools.el | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llm-tools.el b/llm-tools.el index a125e55..2218ab8 100644 --- a/llm-tools.el +++ b/llm-tools.el | |||
| @@ -60,9 +60,11 @@ final file.")) | |||
| 60 | ;; TODO edit_file (hashline + patch apply) | 60 | ;; TODO edit_file (hashline + patch apply) |
| 61 | 61 | ||
| 62 | ;; TODO bash_readonly (shell-command-to-string, whitelisted commands) | 62 | ;; TODO bash_readonly (shell-command-to-string, whitelisted commands) |
| 63 | ;; TODO compile command (calls build system, doesn't need confirmation, whitelisted commands) | 63 | ;; TODO compile command (calls build system, doesn't neenfirmation, whitelisted commands) |
| 64 | 64 | ||
| 65 | ;; bash (make-process, taken from gptel-agent) | 65 | ;; bash (make-process, taken from gptel-agent) |
| 66 | ;; TODO refuse destructive operations like rm and dd, and refuse | ||
| 67 | ;; operations that have dedicated tool definitions like grep and compile | ||
| 66 | (defun llm-tools--execute-bash (callback command) | 68 | (defun llm-tools--execute-bash (callback command) |
| 67 | "Execute COMMAND asynchronously in bash and call CALLBACK with output. | 69 | "Execute COMMAND asynchronously in bash and call CALLBACK with output. |
| 68 | 70 | ||
| @@ -89,7 +91,7 @@ COMMAND is the bash command string to execute." | |||
| 89 | proc)) | 91 | proc)) |
| 90 | 92 | ||
| 91 | (gptel-make-tool | 93 | (gptel-make-tool |
| 92 | :name "Bash" | 94 | :name "bash" |
| 93 | :function #'llm-tools--execute-bash | 95 | :function #'llm-tools--execute-bash |
| 94 | :description "Execute Bash commands. | 96 | :description "Execute Bash commands. |
| 95 | 97 | ||
| @@ -97,6 +99,7 @@ This tool provides access to a Bash shell with GNU coreutils (or | |||
| 97 | equivalents) available. Use this to inspect system state, run builds, | 99 | equivalents) available. Use this to inspect system state, run builds, |
| 98 | tests or other development or system administration tasks. | 100 | tests or other development or system administration tasks. |
| 99 | 101 | ||
| 102 | TODO replace with saying do not use bash for operations that have equivalent tool definitions | ||
| 100 | Do NOT use this for file operations, finding, reading or editing files. | 103 | Do NOT use this for file operations, finding, reading or editing files. |
| 101 | Use the provided file tools instead: `read_file`, `write_file`, | 104 | Use the provided file tools instead: `read_file`, `write_file`, |
| 102 | `edit_file`, `find_file`, `grep`. | 105 | `edit_file`, `find_file`, `grep`. |
| @@ -104,11 +107,10 @@ Use the provided file tools instead: `read_file`, `write_file`, | |||
| 104 | - Quote file paths with spaces using double quotes. | 107 | - Quote file paths with spaces using double quotes. |
| 105 | - Chain dependent commands with && (or ; if failures are OK) | 108 | - Chain dependent commands with && (or ; if failures are OK) |
| 106 | - Use absolute paths instead of cd when possible | 109 | - Use absolute paths instead of cd when possible |
| 107 | - For parallel commands, make multiple `Bash` calls in one message | 110 | - For parallel commands, make multiple `bash` calls in one message |
| 108 | - Run tests, check your work or otherwise close the loop to verify changes you make. | 111 | - Run tests, check your work or otherwise close the loop to verify changes you make. |
| 109 | 112 | ||
| 110 | EXAMPLES: | 113 | EXAMPLES: |
| 111 | - Find recent errors: 'grep -i error /var/log/app.log | tail -20' | ||
| 112 | - Check file type: 'file document.pdf' | 114 | - Check file type: 'file document.pdf' |
| 113 | - Count lines: 'wc -l *.txt' | 115 | - Count lines: 'wc -l *.txt' |
| 114 | 116 | ||
| @@ -134,7 +136,7 @@ Example: 'ls -la | head -20' or 'grep -i error app.log | tail -50'")) | |||
| 134 | :description "\ | 136 | :description "\ |
| 135 | Recursively find all files in a given directory, excluding files within | 137 | Recursively find all files in a given directory, excluding files within |
| 136 | .git directories. Returns a list of absolute file paths. Optionally | 138 | .git directories. Returns a list of absolute file paths. Optionally |
| 137 | accepts a pattern to filter file names (e.g., `*.el' for Emacs Lisp | 139 | accepts a pattern to filter file names (e.g., '*.el' for Emacs Lisp |
| 138 | files). Use this to discover files in a project directory before reading | 140 | files). Use this to discover files in a project directory before reading |
| 139 | or editing them." | 141 | or editing them." |
| 140 | :args '((:name "directory" | 142 | :args '((:name "directory" |
| @@ -142,7 +144,7 @@ or editing them." | |||
| 142 | :description "Path to the directory to be read, relative to the working directory.") | 144 | :description "Path to the directory to be read, relative to the working directory.") |
| 143 | (:name "pattern" | 145 | (:name "pattern" |
| 144 | :type string | 146 | :type string |
| 145 | :description "Optional file name pattern to filter results, e.g. `*.el' or `*.txt'." | 147 | :description "Optional file name pattern to filter results, e.g. '*.el' or '*.txt'." |
| 146 | :optional t)) | 148 | :optional t)) |
| 147 | :async nil | 149 | :async nil |
| 148 | :confirm nil | 150 | :confirm nil |
