emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/aidermacs 3d4919292e 139/466: Feat: Basic support for Test


From: ELPA Syncer
Subject: [nongnu] elpa/aidermacs 3d4919292e 139/466: Feat: Basic support for Test Driven Development (TDD) (#29)
Date: Sat, 15 Mar 2025 19:12:55 -0400 (EDT)

branch: elpa/aidermacs
commit 3d4919292e3cd83a67ab0b0383e8dca8e6813b0e
Author: Kang Tu <tninja@gmail.com>
Commit: GitHub <noreply@github.com>

    Feat: Basic support for Test Driven Development (TDD) (#29)
    
    * feat: Add aider-fix-failing-test function for test debugging and repair
    
    * refactor: Update test failure handling to use /architect command
    
    * feat: Rename aider-fix-failing-test function and menu entry for clarity
    
    * docs(readme): update test-driven development section
    
    * docs(helm): add description of history prompt fuzzy search
    
    * docs: improve helm description in readme
---
 README.org |  7 ++++++-
 aider.el   | 19 ++++++++++++++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/README.org b/README.org
index 9bc7a5839a..b028e6b288 100644
--- a/README.org
+++ b/README.org
@@ -29,6 +29,9 @@
   - Explain: (`aider-region-explain`): Select a region (e.g., a code block) in 
a file and ask Aider to explain it.
   - Refactor: (`aider-region-refactor`): Ask Aider to refactor it given your 
input instruction.
 
+- Support for Test Driven Development:
+  - Fix Tests: (`aider-fix-failing-test-under-cursor`): Place cursor on a 
failing test function and ask Aider to analyze and fix the code to make tests 
pass.
+
 - And More: Add your own Elisp functions to support your use case. You can 
certainly ask Aider / `aider.el` to do that.
 
 * Installation
@@ -79,7 +82,9 @@ The aider prefix is "A".
 
 ** Optional
 
-*** Optional Helm Support
+*** Helm Support
+
+Helm enables fuzzy searching functionality for command history prompts
 
 You can enable Helm-based completion in two ways:
 
diff --git a/aider.el b/aider.el
index d312a2b0fd..56c49a8861 100644
--- a/aider.el
+++ b/aider.el
@@ -77,8 +77,9 @@ This function can be customized or redefined by the user."
    ["Code Change"
     ("c" "Code Change" aider-code-change)
     ("t" "Architect Discuss and Change" aider-architect-discussion)
-    ("R" "Refactor Function Under Cursor" aider-function-refactor)
     ("r" "Refactor Code in Selected Region" aider-region-refactor)
+    ("R" "Refactor Function Under Cursor" aider-function-refactor)
+    ("T" "Fix Failing Test Under Cursor" aider-fix-failing-test-under-cursor)
     ("m" "Show Last Commit with Magit" aider-magit-show-last-commit)
     ("u" "Undo Last Change" aider-undo-last-change)
     ]
@@ -423,6 +424,22 @@ The command will be formatted as \"/ask \" followed by the 
text from the selecte
       (let ((repo-path (string-trim git-repo-path)))
         (dired-other-window repo-path)))))
 
+;;; functions for test fixing
+
+;;;###autoload
+(defun aider-fix-failing-test-under-cursor ()
+  "Report the current test failure to aider and ask it to fix the code.
+This function assumes the cursor is on or inside a test function."
+  (interactive)
+  (if-let ((test-function-name (which-function)))
+      (let* ((initial-input (format "The test '%s' is failing. Please analyze 
and fix the code to make the test pass. Don't break any other test" 
+                                   test-function-name))
+             (test-output (aider-read-string "Architect question: " 
initial-input))
+             (command (format "/architect %s" test-output)))
+        (aider-add-current-file)
+        (aider--send-command command t))
+    (message "No test function found at cursor position.")))
+
 ;;; functions for .aider file related
 
 ;; New function to send "<line under cursor>" to the Aider buffer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]