branch: elpa/aidermacs
commit 8908f375b10e143b09649298fb314571dc6bc28e
Author: Mingde (Matthew) Zeng <matthew...@posteo.net>
Commit: Mingde (Matthew) Zeng <matthew...@posteo.net>

    Add aidermacs-before-run-backend-hook doc
    
    Signed-off-by: Mingde (Matthew) Zeng <matthew...@posteo.net>
---
 README.md | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/README.md b/README.md
index 851c5c4c76..b76423a9c6 100644
--- a/README.md
+++ b/README.md
@@ -82,6 +82,24 @@ Here's what the community is saying about Aidermacs:
 
 ## Configuration
 
+#### Pre-Run Hook
+
+You can use the `aidermacs-before-run-backend-hook` to run custom setup code 
before starting the Aider backend. This is particularly useful for:
+
+- Setting environment variables
+- Injecting secrets
+- Performing any other pre-run configuration
+
+Example usage to securely set an OpenAI API key from password-store:
+
+```elisp
+(add-hook 'aidermacs-before-run-backend-hook
+          (lambda ()
+            (setenv "OPENAI_API_KEY" (password-store-get 
"code/openai_api_key"))))
+```
+
+This approach keeps sensitive information out of your dotfiles while still 
making it available to Aidermacs.
+
 ### Default Model Selection
 
 You can customize the default AI model used by Aidermacs by setting the 
`aidermacs-default-model` variable:

Reply via email to