branch: elpa/aidermacs commit 550ffcc07aff4447382f5350f07869973da8095a Author: Mingde (Matthew) Zeng <matthew...@posteo.net> Commit: Mingde (Matthew) Zeng <matthew...@posteo.net>
Fix prompt, add video demo Fixes #4 --- README.md | 60 ++++++++++++++++++++++++++++++++++++++++++--- aidermacs-backend-comint.el | 2 ++ aidermacs-backend-vterm.el | 2 ++ aidermacs-backends.el | 3 ++- aidermacs.el | 5 ---- 5 files changed, 63 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c962f1d961..25e66d0652 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ Missing [Cursor](https://cursor.sh) but prefer living in Emacs? Aidermacs brings <img style='height: auto; width: 80%; object-fit: contain' src="./introscreen.png"> </p> +### Video Demo! + +[<img src="https://img.youtube.com/vi/TPpyxaGZg1A/0.jpg" width=400>](https://www.youtube.com/watch?v=TPpyxaGZg1A) + ### Community-Driven Development Aidermacs thrives on community involvement. We believe collaborative development with user and contributor input creates the best software. We encourage you to: @@ -34,14 +38,14 @@ Your contributions are essential for making Aidermacs the best AI pair programmi <img src = "https://contrib.rocks/image?repo=MatthewZMD/aidermacs"/> </a> -## Installation +## Quick Start -### Requirements +1. Requirements - Emacs ≥ 28.1 - [Aider](https://aider.chat/docs/install.html) - [Transient](https://github.com/magit/transient) -### Sample Config +2. Modify this **sample config** to your Emacs `init.el`: ```emacs-lisp (use-package aidermacs :vc (:url "https://github.com/MatthewZMD/aidermacs" :rev :newest) @@ -57,6 +61,8 @@ Your contributions are essential for making Aidermacs the best AI pair programmi (aidermacs-use-architect-mode t) (aidermacs-default-model "sonnet")) ``` +3. Open a project and run `M-x aidermacs-transient-menu` or `C-c p` (where you bind it) +4. Add files and start coding with AI! ## Configuration @@ -380,3 +386,51 @@ With `Aidermacs`, you get: - We prioritize features and improvements that directly benefit Emacs users, ensuring a tool that evolves with your needs. ... and more to come 🚀 + +## Troubleshooting + +### Aider not found +- Ensure Aider is installed: `pip install aider-chat` +- Check `aidermacs-program` points to correct path + +### No response from AI +- Verify API keys are set correctly +- Check model selection matches your API access +- Try simpler prompts first + +### Ediff not working +- Ensure `ediff` is installed +- Check file permissions +- Try restarting Emacs + +## Example Workflows + +### Implementing a Feature +1. Add relevant files with `f` or `F` +2. Switch to Architect mode with `3` +3. Describe the feature: "/architect Implement user login system" +4. Review changes with Ediff +5. Accept/reject changes + +### Debugging Code +1. Add file with error +2. Place cursor on error +3. Run `!` (Debug Exception) +4. Follow AI's debugging steps + +### Writing Tests +1. Add file to test +2. Run `t` (Write Test) +3. Review generated tests +4. Run tests to verify + +## FAQ + +### How is this different from Copilot? +Aidermacs uses Aider which is more focused on code modification and architecture rather than just completion. + +### Can I use my own AI models? +Yes! Aidermacs supports any OpenAI-compatible API endpoint. + +### Is my code sent to the AI provider? +Yes, the code you add to the session is sent to the AI provider. Be mindful of sensitive code. diff --git a/aidermacs-backend-comint.el b/aidermacs-backend-comint.el index e85f385d2d..568fa1bfa5 100644 --- a/aidermacs-backend-comint.el +++ b/aidermacs-backend-comint.el @@ -104,6 +104,8 @@ that was matched at the start of the current syntax block.") (defvar-local aidermacs--comint-output-temp "" "Temporary output variable storing the raw output string.") +(defvar aidermacs-prompt-regexp) + (defun aidermacs--comint-output-filter (output) "Accumulate OUTPUT string until a prompt is detected, then store it." (when (and (aidermacs--is-aidermacs-buffer-p) (not (string-empty-p output))) diff --git a/aidermacs-backend-vterm.el b/aidermacs-backend-vterm.el index 868a463e0c..767a933cfc 100644 --- a/aidermacs-backend-vterm.el +++ b/aidermacs-backend-vterm.el @@ -62,6 +62,8 @@ :type 'string :group 'aidermacs) +(defvar aidermacs-prompt-regexp) + (defun aidermacs--vterm-check-finish-sequence-repeated (proc orig-filter start-point) "Check for the finish sequence in PROC's buffer. PROC is the process to check. ORIG-FILTER is the original process filter. diff --git a/aidermacs-backends.el b/aidermacs-backends.el index 57c59a16b4..6563c66747 100644 --- a/aidermacs-backends.el +++ b/aidermacs-backends.el @@ -146,7 +146,8 @@ Remove any files that don't exist." ;; <file>\nAdd file to the chat? ((string-match "Add file to the chat?" line) - (add-to-list 'aidermacs--tracked-files last-line)) + (add-to-list 'aidermacs--tracked-files last-line) + (aidermacs--prepare-for-code-edit)) ;; <file> is already in the chat as an editable file ((string-match "\\(\\./\\)?\\(.+\\) is already in the chat as an editable file" line) diff --git a/aidermacs.el b/aidermacs.el index acd1cdcdad..60e72ad4ca 100644 --- a/aidermacs.el +++ b/aidermacs.el @@ -331,7 +331,6 @@ and syntax highlighting to match the original file." This is called when all ediff sessions are complete. Kills all pre-edit buffers that were created to store original file content." (interactive) - (message "Cleaning up") (with-current-buffer (get-buffer (aidermacs-get-buffer-name)) ;; Clean up buffers in the tracking list (dolist (file-pair aidermacs--pre-edit-file-buffers) @@ -386,7 +385,6 @@ the next file in the ediff queue if any remain." Returns a list of files that have been modified according to the output." (let ((edited-files nil) (output aidermacs--current-output)) - (message "Detecting edited files from output...") (when output (let ((lines (split-string output "\n")) (last-line "")) @@ -395,14 +393,12 @@ Returns a list of files that have been modified according to the output." ;; Case 1: Look for "Applied edit to <filename>" pattern ((string-match "Applied edit to \\(\\./\\)?\\(.+\\)" line) (when-let ((file (match-string 2 line))) - (message "Found edited file (applied edit): %s" file) (push file edited-files))) ;; Case 2: Look for a filename followed by triple backticks on next line ((string-match "^```" line) (let ((potential-file (string-trim last-line))) (when (not (string-empty-p potential-file)) - (message "Found potential file (code block): %s" potential-file) (push potential-file edited-files))))) (setq last-line line)))) @@ -414,7 +410,6 @@ Returns a list of files that have been modified according to the output." (lambda (file) (file-exists-p (expand-file-name file project-root))) unique-files))) - (message "Detected valid edited files: %s" valid-files) (nreverse valid-files)))) (defvar-local aidermacs--ediff-queue nil