From 3b778e38999336a35ec36f1536390f855573b769 Mon Sep 17 00:00:00 2001 From: Erik Mackdanz Date: Thu, 13 Nov 2025 21:55:12 -0600 Subject: [PATCH] apply_patch need not append the new line Parameter doc generalization --- gptel | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/gptel b/gptel index b031cbd..4bb1aea 100644 --- a/gptel +++ b/gptel @@ -157,16 +157,6 @@ ) ) -(gptel-make-tool - :name "current_directory" - :function (lambda () - (pwd) - ) - :category "filesystem" - :confirm nil - :description "Returns the current working directory." - :args nil) - (gptel-make-tool :name "replace_file" :function (lambda (workingdirectory path content) @@ -199,12 +189,12 @@ :function (lambda (workingdirectory patch) (cd workingdirectory) (let ((output-buffer (generate-new-buffer "*patch-output*"))) - (call-process-region (concat patch "\n") nil "patch" nil output-buffer t "-p1" "--fuzz" "3") + (call-process-region patch nil "patch" nil output-buffer t "-p1" "--fuzz" "3") (message "Patch output: %s" (with-current-buffer output-buffer (buffer-string))) (with-current-buffer output-buffer (buffer-string)) ) ) - :description "Patch files in the working directory. If the patch fails to apply, generate a new patch and try again." + :description "Patch files in the working directory. A patch should only have one hunk; if multiple hunks are required, generate multiple patches. If the patch fails to apply, generate a new patch and try again." :args (list '(:name "workingdirectory" :type string :description "The project's directory to change to before running the command. Defaults to '.'" @@ -307,7 +297,7 @@ :description "A preset for hledger tasks" :backend "DeepSeek" :model 'deepseek-chat - :system "You add valid account data to hledger accounting files by applying a patch. The working diretory is /home/erik/src/ledgerfile and you may only list files under that directory. The main ledgerfile is /home/erik/src/ledgerfile/2025only. You may read only the ledgerfile or files included by the ledgerfile. You may write only to the month file (like 202510 or 202512). A credit card purchase is added by adding the transaction as a credit (usually to Expenses:Dining/Entertainment) and a corresponding (blank) debit to Liabilities:Chase; also the same amount is credited to the following 'Chase balance' transaction (which may be in next month's ledgerfile). Remember to actually patch the file. A patch should only have one hunk; if multiple hunks are required, generate multiple patches. After adding a transaction, check that the ledger is balanced and fix any errors." + :system "You add valid account data to hledger accounting files by applying a patch. The working diretory is /home/erik/src/ledgerfile and you may only list files under that directory. The main ledgerfile is /home/erik/src/ledgerfile/2025only. You may read only the ledgerfile or files included by the ledgerfile. You may write only to the month file (like 202510 or 202512). A credit card purchase is added by adding the transaction as a credit (usually to Expenses:Dining/Entertainment) and a corresponding (blank) debit to Liabilities:Chase; also the same amount is credited to the following 'Chase balance' transaction (which may be in next month's ledgerfile). Remember to actually patch the file. After adding a transaction, check that the ledger is balanced and fix any errors." :confirm-tool-calls 'auto :temperature 0.0 :tools '( -- 2.52.0