![]() # Aider chat conversation: USER: how can i test this release action? ASSISTANT: Testing a GitHub Actions workflow can be done in a few ways: 1. **Push to a branch:** You can push your changes to a branch and see if the workflow runs as expected. This is the most straightforward way to test a workflow, but it may not be suitable if the workflow is supposed to run on specific events like a release or a tag. 2. **Use Pull Requests:** If your workflow should run on pull requests, you can open a pull request to trigger the workflow. 3. **Use Actions tab on GitHub:** You can manually trigger a workflow run from the Actions tab in your GitHub repository. Click on the workflow you want to run, then click `Run workflow` and select the branch you want to run the workflow on. 4. **Use a workflow_dispatch event:** You can add a `workflow_dispatch` event to your workflow file to manually trigger the workflow from GitHub's UI. Here's an example of how to add it: ```yaml on: workflow_dispatch: push: tags: - 'v*' ``` After adding this to your workflow file and pushing it to your repository, you can manually trigger the workflow from the Actions tab in your GitHub repository. 5. **Use a specific branch for testing:** If your workflow runs on a push to a specific branch, you can create a separate branch for testing. You can push your changes to this branch to test the workflow. 6. **Use act:** [act](https://github.com/nektos/act) is a tool that lets you run your GitHub Actions workflows locally. This can be useful for testing your workflows before pushing them to your repository. Remember to remove or comment out any actions that could have side effects (like publishing a package or pushing a Docker image) when you're testing your workflows. USER: what will github.ref be if i manually trigger? ASSISTANT: When you manually trigger a workflow using the `workflow_dispatch` event, the `github.ref` will be set to the branch or tag you selected when you triggered the workflow. If you didn't select a branch or tag (which is possible if your workflow file doesn't specify any `inputs` for the `workflow_dispatch` event), `github.ref` will be set to the default branch of your repository (usually `main` or `master`). Here's an example of how you can specify an input for the `workflow_dispatch` event: ```yaml on: workflow_dispatch: inputs: branch: description: 'Branch or tag to run the workflow on' required: true default: 'main' ``` In this example, when you manually trigger the workflow, you'll be prompted to enter a branch or tag. The value you enter will be available in the `github.event.inputs.branch` context, and `github.ref` will be set to the same value. USER: buildx failed with: ERROR: invalid tag "***/aider:refs/tags/v0.14.2-dev1": invalid reference format ASSISTANT: The error message indicates that the Docker tag is not valid. Docker tags cannot contain slashes (`/`), and `github.ref` includes the full Git reference, which will be something like `refs/tags/v0.14.2-dev1` for a tag. To fix this, you can use the `github.ref_name` context instead of `github.ref`. The `github.ref_name` context contains just the name of the branch or tag without the `refs/heads/` or `refs/tags/` prefix. Here's how you can update your workflow file: ```yaml .github/workflows/release.yml <<<<<<< HEAD - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . file: ./docker/Dockerfile push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/aider:${{ github.ref }} ======= - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . file: ./docker/Dockerfile push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/aider:${{ github.ref_name }} >>>>>>> updated ``` This will tag the Docker image with just the name of the branch or tag that triggered the workflow run, which should be a valid Docker tag. |
||
---|---|---|
.github/workflows | ||
_layouts | ||
aider | ||
assets | ||
benchmark | ||
docker | ||
docs | ||
examples | ||
scripts | ||
share | ||
tests | ||
.dockerignore | ||
.flake8 | ||
.pre-commit-config.yaml | ||
_config.yml | ||
CNAME | ||
hello.py | ||
HISTORY.md | ||
LICENSE.txt | ||
MANIFEST.in | ||
pytest.ini | ||
README.md | ||
requirements.txt | ||
setup.py |
aider is AI pair programming in your terminal
Aider is a command line tool that lets you pair program with GPT-3.5/GPT-4, to edit code stored in your local git repository. You can start a new project or work with an existing repo. And you can fluidly switch back and forth between the aider chat where you ask GPT to edit the code and your own editor to make changes yourself. Aider makes sure edits from you and GPT are committed to git with sensible commit messages. Aider is unique in that it works well with pre-existing, larger codebases.
- Getting started
- Example chat transcripts
- Features
- Usage
- In-chat commands
- Tips
- GPT-4 vs GPT-3.5
- Installation
- Voice-to-code
- FAQ
- Discord
Getting started
See the installation instructions for more details, but you can get started quickly like this:
$ pip install aider-chat
$ export OPENAI_API_KEY=your-key-goes-here
$ aider hello.js
Using git repo: .git
Added hello.js to the chat.
hello.js> write a js script that prints hello world
Example chat transcripts
Here are some example transcripts that show how you can chat with aider
to write and edit code with GPT-4.
-
Hello World Flask App: Start from scratch and have GPT create a simple Flask app with various endpoints, such as adding two numbers and calculating the Fibonacci sequence.
-
Javascript Game Modification: Dive into an existing open-source repo, and get GPT's help to understand it and make modifications.
-
Complex Multi-file Change with Debugging: GPT makes a complex code change that is coordinated across multiple source files, and resolves bugs by reviewing error output and doc snippets.
-
Create a Black Box Test Case: GPT creates a "black box" test case without access to the source of the method being tested, using only a high level map of the repository based on ctags.
You can find more chat transcripts on the examples page.
Features
- Chat with GPT about your code by launching
aider
from the command line with set of source files to discuss and edit together. Aider lets GPT see and edit the content of those files. - GPT can write and edit code in most popular languages: python, javascript, typescript, html, css, etc.
- Request new features, changes, improvements, or bug fixes to your code. Ask for new test cases, updated documentation or code refactors.
- Aider will apply the edits suggested by GPT directly to your source files.
- Aider will automatically commit each changeset to your local git repo with a descriptive commit message. These frequent, automatic commits provide a safety net. It's easy to undo changes or use standard git workflows to manage longer sequences of changes.
- You can use aider with multiple source files at once, so GPT can make coordinated code changes across all of them in a single changeset/commit.
- Aider can give GPT-4 a map of your entire git repo, which helps it understand and modify large codebases.
- You can also edit files by hand using your editor while chatting with aider. Aider will notice these out-of-band edits and keep GPT up to date with the latest versions of your files. This lets you bounce back and forth between the aider chat and your editor, to collaboratively code with GPT.
Usage
Run the aider
tool by executing the following command:
aider <file1> <file2> ...
If your pip install did not place the aider
executable on your path, you can invoke aider like this:
python -m aider.main <file1> <file2>
Replace <file1>
, <file2>
, etc., with the paths to the source code files you want to work on.
These files will be "added to the chat session", so that GPT can see their contents and edit them according to your instructions.
You can also just launch aider
anywhere in a git repo without naming
files on the command line. It will discover all the files in the
repo. You can then add and remove individual files in the chat
session with the /add
and /drop
chat commands described below.
If you or GPT mention one of the repo's filenames in the conversation,
aider will ask if you'd like to add it to the chat.
Aider will work best if you think about which files need to be edited to make your change and add them to the chat. Aider has some ability to help GPT figure out which files to edit all by itself, but the most effective approach is to explicitly add the needed files to the chat yourself.
Aider also has many
additional command-line options, environment variables or configuration file
to set many options. See aider --help
for details.
In-chat commands
Aider supports commands from within the chat, which all start with /
. Here are some of the most useful in-chat commands:
/add <file>
: Add matching files to the chat session./drop <file>
: Remove matching files from the chat session./undo
: Undo the last git commit if it was done by aider./diff
: Display the diff of the last aider commit./run <command>
: Run a shell command and optionally add the output to the chat./voice
: Speak to aider to request code changes with your voice./help
: Show help about all commands.
See the full command docs for more information.
Tips
- Think about which files need to be edited to make your change and add them to the chat. Aider has some ability to help GPT figure out which files to edit all by itself, but the most effective approach is to explicitly add the needed files to the chat yourself.
- Large changes are best performed as a sequence of thoughtful bite sized steps, where you plan out the approach and overall design. Walk GPT through changes like you might with a junior dev. Ask for a refactor to prepare, then ask for the actual change. Spend the time to ask for code quality/structure improvements.
- Use Control-C to safely interrupt GPT if it isn't providing a useful response. The partial response remains in the conversation, so you can refer to it when you reply to GPT with more information or direction.
- Use the
/run
command to run tests, linters, etc and show the output to GPT so it can fix any issues. - Use Meta-ENTER (Esc+ENTER in some environments) to enter multiline chat messages. Or enter
{
alone on the first line to start a multiline message and}
alone on the last line to end it. - If your code is throwing an error, share the error output with GPT using
/run
or by pasting it into the chat. Let GPT figure out and fix the bug. - GPT knows about a lot of standard tools and libraries, but may get some of the fine details wrong about APIs and function arguments. You can paste doc snippets into the chat to resolve these issues.
- GPT can only see the content of the files you specifically "add to the chat". Aider also sends GPT-4 a map of your entire git repo. So GPT may ask to see additional files if it feels that's needed for your requests.
- I also shared some general GPT coding tips on Hacker News.
GPT-4 vs GPT-3.5
Aider supports all of OpenAI's chat models.
You can choose a model with the --model
command line argument.
You should probably use GPT-4 if you can. For more details see the FAQ entry that compares GPT-4 vs GPT-3.5.
For a discussion of using other non-OpenAI models, see the FAQ about other LLMs.
Installation
See the installation instructions.
FAQ
For more information, see the FAQ.
Kind words from users
- The best AI coding assistant so far. -- Matthew Berman
- Hands down, this is the best AI coding assistant tool so far. -- IndyDevDan
- Aider ... has easily quadrupled my coding productivity. -- SOLAR_FIELDS
- It's really like having your senior developer live right in your Git repo - truly amazing! -- rappster
- What an amazing tool. It's incredible. -- valyagolev
- Aider is such an astounding thing! -- cgrothaus
- It was WAY faster than I would be getting off the ground and making the first few working versions. -- Daniel Feldman
- This project is stellar. -- funkytaco
- Amazing project, definitely the best AI coding assistant I've used. -- joshuavial
- I am an aider addict. I'm getting so much more work done, but in less time. -- dandandan
- Best agent for actual dev work in existing codebases. -- Nick Dobos