Aider with Github CLI
Working with GitHub Issues in Aider
This tutorial shows how to use Aider's /run
command to work with GitHub issues using the GitHub CLI.
Prerequisites
- GitHub CLI (
gh
) installed and authenticated - Aider installed
- A GitHub repository with issues
Setting Up
First, start Aider in your repository:
bash
aider
Working with GitHub Issues
Listing Issues
To see the open issues in your repository:
/run gh issue list
Viewing an Issue
To view details of a specific issue:
/run gh issue view 123 # Replace 123 with the issue number
Creating a Branch for an Issue
To create and switch to a branch for working on an issue:
/run gh issue develop 123 -b fix-issue-123
This creates a new branch (named fix-issue-123
) and checks it out.
Implementing the Solution
Now you can use Aider to implement the solution by explaining what needs to be done:
I need to implement a solution for issue #123 which requires [describe the requirement].
Testing Your Changes
Run tests to verify your changes:
/run npm test # Or any appropriate test command for your project
Committing Changes
You can ask Aider to commit the changes:
Please commit these changes with an appropriate commit message.
Or manually commit using GitHub CLI:
/run git add .
/run git commit -m "Fix issue #123: [brief description]"
Creating a Pull Request
Create a pull request to merge your changes:
/run gh pr create --title "Fix issue #123" --body "This PR addresses issue #123 by implementing [description]"
Linking PR to Issue
Close the issue when the PR is merged:
/run gh issue close 123 --reason completed
Additional Useful Commands
Managing Pull Requests
List pull requests:
/run gh pr list
Check PR status:
/run gh pr status
Issue Comments
Add a comment to an issue:
/run gh issue comment 123 --body "I've implemented a fix in PR #456"
Example Workflow
Here's a practical example of a complete workflow:
# Start Aider in your repository
aider
List open issues
/run gh issue list
View details of issue #123
/run gh issue view 123
Create a branch for the issue
/run gh issue develop 123 -b fix-issue-123
Implement the solution with Aider
I need to fix the validation in user_controller.js for issue #123
Test the changes
/run npm test
Create a PR
/run gh pr create --title "Fix validation in user_controller.js" --body "Fixes #123 by adding proper input validation"
Check PR status
/run gh pr status
Tips for an Efficient Workflow
/run
to execute any shell command within Aider--file
option when starting Aider to focus on specific files:aider --file user_controller.js
/help
in Aider to see available commandsThis workflow combines the power of Aider's AI capabilities with GitHub CLI's repository management features, allowing you to manage issues and implement solutions without leaving your terminal.