Commit graph

2882 commits

Author SHA1 Message Date
Paul Gauthier
fc92862017 enable pypi again 2023-10-18 09:15:40 -07:00
Paul Gauthier
44afdeff25 aider: Updated build and push action to include the ":latest" tag when pushing the Docker image.
# Aider chat conversation:

USER: i also want to update :latest when i push

ASSISTANT: To update the `:latest` tag each time you push, you can add it to the `tags` parameter of the `docker/build-push-action` action in your workflow file. This will build and push the Docker image with both the branch or tag name and `latest` as tags.

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 }}
=======
    - 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 }}
          ${{ secrets.DOCKERHUB_USERNAME }}/aider:latest
>>>>>>> updated
```

This will ensure that the `:latest` tag always points to the most recently pushed image.
2023-10-18 09:05:53 -07:00
Paul Gauthier
87296ddcee aider: Updated Docker tag to use github.ref_name instead of github.ref.
# 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.
2023-10-18 09:01:37 -07:00
Paul Gauthier
8cb9d1d64d update actions 2023-10-18 08:54:26 -07:00
Paul Gauthier
ec13c87e8d disable pypi for now 2023-10-18 08:48:24 -07:00
Paul Gauthier
b69edcfcba prep docker build to run in github action 2023-10-18 08:45:02 -07:00
Paul Gauthier
5769821a35 aider: Updated Dockerfile path to ./docker/Dockerfile in the docker/build-push-action action.
# Aider chat conversation:

USER: what is github.ref?

ASSISTANT: In GitHub Actions, `github.ref` is a context variable that refers to the branch or tag name that triggered the workflow run.

For example, if you push a commit to the `main` branch, `github.ref` will be `refs/heads/main`. If you create a tag named `v1.0.0`, `github.ref` will be `refs/tags/v1.0.0`.

In your workflow file, you're using `github.ref` to tag the Docker image. This means that the Docker image will be tagged with the name of the branch or tag that triggered the workflow run.

However, since you're triggering the workflow on tag creation (`on: push: tags: - 'v*'`), `github.ref` will always be the name of the tag. If you create a tag named `v1.0.0`, the Docker image will be tagged as `v1.0.0`.

USER: the Dockerfile is in the docker/ subdir.

ASSISTANT: If your Dockerfile is in the `docker/` subdirectory, you need to specify this in the `context` and `file` parameters of the `docker/build-push-action` action in your GitHub Actions workflow file.

The `context` parameter is the path to the directory that contains the Dockerfile. The `file` parameter is the path to the Dockerfile.

Here are the changes you need to make to the `.github/workflows/release.yml` file:

```yaml
.github/workflows/release.yml
<<<<<<< HEAD
    - name: Build and push Docker image
      uses: docker/build-push-action@v2
      with:
        context: .
        push: true
        tags: ${{ secrets.DOCKERHUB_USERNAME }}/aider:${{ github.ref }}
=======
    - name: Build and push Docker image
      uses: docker/build-push-action@v2
      with:
        context: .
        file: ./docker/Dockerfile
        push: true
        tags: ${{ secrets.DOCKERHUB_USERNAME }}/aider:${{ github.ref }}
>>>>>>> updated
```

This will tell the `docker/build-push-action` action to look for the Dockerfile in the `docker/` subdirectory.
2023-10-18 08:38:30 -07:00
Paul Gauthier
9bcef8b853 aider: Added Docker login and build/push steps to the GitHub Actions workflow for building and pushing a Docker image to DockerHub on each release.
# Aider chat conversation:

USER: what's the best way to docker build and push a new version to dockerhub on each release?

ASSISTANT: To build and push a new Docker image to DockerHub on each release, you can use GitHub Actions. You will need to modify the existing GitHub Actions workflow file `.github/workflows/release.yml` to include steps for building and pushing the Docker image.

Here are the steps you need to follow:

1. Add Docker login step: You need to log in to DockerHub before you can push images. You can use the `docker/login-action` action for this. You will need to store your DockerHub username and password as secrets in your GitHub repository.

2. Build the Docker image: You can use the `docker/build-push-action` action to build your Docker image. You should use the new version as the tag for the Docker image.

3. Push the Docker image: The `docker/build-push-action` action can also push the Docker image to DockerHub.

Here are the changes you need to make to the `.github/workflows/release.yml` file:

```yaml
.github/workflows/release.yml
<<<<<<< HEAD
name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  build_and_publish:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v3

    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: 3.x

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install setuptools wheel twine

    - name: Build and publish
      env:
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
      run: |
        python setup.py sdist bdist_wheel
        twine upload dist/*
=======
name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  build_and_publish:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v3

    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: 3.x

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install setuptools wheel twine

    - name: Build and publish
      env:
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
      run: |
        python setup.py sdist bdist_wheel
        twine upload dist/*

    - name: Login to DockerHub
      uses: docker/login-action@v1
      with:
        username: ${{ secrets.DOCKERHUB_USERNAME }}
        password: ${{ secrets.DOCKERHUB_PASSWORD }}

    - name: Build and push Docker image
      uses: docker/build-push-action@v2
      with:
        context: .
        push: true
        tags: ${{ secrets.DOCKERHUB_USERNAME }}/aider:${{ github.ref }}
>>>>>>> updated
```

Please replace `DOCKERHUB_USERNAME` and `DOCKERHUB_PASSWORD` with your DockerHub username and password. You should store these as secrets in your GitHub repository.

Please note that this will build and push a new Docker image for every release. If you want to build and push a Docker image only for specific releases, you will need to modify the `on` section of the workflow file.
2023-10-18 08:36:16 -07:00
Paul Gauthier
f954bc2ecc Changed RUN to ENTRYPOINT 2023-10-18 08:27:32 -07:00
Paul Gauthier
f068e49501 added experimental docker image 2023-10-18 08:25:17 -07:00
Paul Gauthier
364a3f70e9 Be careful to set done_messages=[] not None #273 2023-10-17 16:41:05 -07:00
Paul Gauthier
22eb344192 disable /voice if import soundfile failes #274 2023-10-12 07:00:51 -07:00
Paul Gauthier
87fb6c8fbb set version to 0.14.2-dev 2023-09-29 17:21:19 -07:00
Paul Gauthier
3d4c021fc6 version bump to 0.14.1 2023-09-29 17:20:53 -07:00
Paul Gauthier
fa7656cef8 Updated HISTORY 2023-09-29 17:19:47 -07:00
Paul Gauthier
b78b8fabf4 use regex not shlex to parse quoted filenames portably on windows and others 2023-09-29 17:07:17 -07:00
Paul Gauthier
2dc01bb9bd handle abs paths on windows 2023-09-29 16:36:37 -07:00
Paul Gauthier
774589b376 test to ensure we accept abs filenames; use shlex so we handle quoted filenames; #152 #156 2023-09-29 15:02:45 -07:00
Paul Gauthier
d2acb8e95e use a windows compatible regex filename 2023-09-29 14:50:41 -07:00
Paul Gauthier
dc19a1fe4b /add treats args as literal filenames initially, only glob if they do not exist #195 2023-09-29 13:44:49 -07:00
Paul Gauthier
399d86d437 block /add of files from outside coder.root #178 2023-09-29 13:27:43 -07:00
Paul Gauthier
5d7e44082e print warning if cur wd is different than git wd, per discussion in #188 2023-09-29 13:10:06 -07:00
Paul Gauthier
98bacd0b5b test case and fix for /add blowing up in subdir #201 2023-09-29 10:49:27 -07:00
Paul Gauthier
545f10551e Show supported models when avail check fails 2023-09-29 09:20:36 -07:00
Paul Gauthier
82d7f04865 handle the case of no git repo 2023-09-27 18:37:26 -07:00
Paul Gauthier
1d0d91d71e improved gitignore check logic 2023-09-27 18:32:18 -07:00
Paul Gauthier
19e4787502 aider: Refactored check_gitignore function to use gitpython library to check if the .aider pattern is already ignored by the repository before adding it to .gitignore.
# Aider chat conversation:

USER: in `check_gitignore` use gitpython to see if the repo is already ignoring `.aider`. if so, don't add anything to gitignore

ASSISTANT: To implement this change, we need to modify the `check_gitignore` function in the `aider/main.py` file. We will use the `gitpython` library to check if the `.aider` pattern is already ignored by the repository. If it is, we won't add anything to the `.gitignore` file.

Here are the steps we need to take:

1. Import the `git` module at the top of the file.
2. In the `check_gitignore` function, create a `git.Repo` object for the current repository.
3. Use the `Repo.ignored` method to check if the `.aider` pattern is already ignored.
4. Only add the `.aider` pattern to the `.gitignore` file if it's not already ignored.

Here is the *edit block* for this change:

```python
aider/main.py
<<<<<<< HEAD
def check_gitignore(git_root, io, ask=True):
    if not git_root:
        return

    pat = ".aider*"

    gitignore_file = Path(git_root) / ".gitignore"
    if gitignore_file.exists():
        content = io.read_text(gitignore_file)
        if pat in content.splitlines():
            return
    else:
        content = ""

    if ask and not io.confirm_ask(f"Add {pat} to .gitignore (recommended)?"):
        return

    if content and not content.endswith("\n"):
        content += "\n"
    content += pat + "\n"
    io.write_text(gitignore_file, content)

    io.tool_output(f"Added {pat} to .gitignore")
=======
import git

def check_gitignore(git_root, io, ask=True):
    if not git_root:
        return

    pat = ".aider*"

    gitignore_file = Path(git_root) / ".gitignore"
    if gitignore_file.exists():
        content = io.read_text(gitignore_file)
        if pat in content.splitlines():
            return
    else:
        content = ""

    repo = git.Repo(git_root)
    if repo.is_ignored(pat):
        return

    if ask and not io.confirm_ask(f"Add {pat} to .gitignore (recommended)?"):
        return

    if content and not content.endswith("\n"):
        content += "\n"
    content += pat + "\n"
    io.write_text(gitignore_file, content)

    io.tool_output(f"Added {pat} to .gitignore")
>>>>>>> updated
```
Please note that this change assumes that the `gitpython` library is already installed in your environment. If it's not, you will need to install it using pip (`pip install gitpython`).
2023-09-27 18:30:26 -07:00
Paul Gauthier
14eb12364d aider: Add --gitignore/--no-gitignore switches (like the others) default is true, only call check_gitignore if it's true.
# Aider chat conversation:

USER: add --gitignore/--no-gitignore switches (like the others) default is true. only call `check_gitignore` if it's true.

ASSISTANT: To add the `--gitignore/--no-gitignore` switches, we need to modify the `aider/main.py` file.

Here are the steps:

1. Add a new argument to the `git_group` in the `main` function to handle the `--gitignore/--no-gitignore` switches.
2. Modify the `if args.git:` block to only call `check_gitignore` if `args.gitignore` is `True`.

Here are the proposed changes:

```python
aider/main.py
<<<<<<< HEAD
    git_group = parser.add_argument_group("Git Settings")
    git_group.add_argument(
        "--git",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable looking for a git repo (default: True)",
    )
    git_group.add_argument(
        "--auto-commits",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable auto commit of GPT changes (default: True)",
    )
    git_group.add_argument(
        "--dirty-commits",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable commits when repo is found dirty (default: True)",
    )
    git_group.add_argument(
        "--dry-run",
        action=argparse.BooleanOptionalAction,
        default=False,
        help="Enable/disable performing a dry run without modifying files (default: False)",
    )
=======
    git_group = parser.add_argument_group("Git Settings")
    git_group.add_argument(
        "--git",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable looking for a git repo (default: True)",
    )
    git_group.add_argument(
        "--gitignore",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable adding .aider* to .gitignore (default: True)",
    )
    git_group.add_argument(
        "--auto-commits",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable auto commit of GPT changes (default: True)",
    )
    git_group.add_argument(
        "--dirty-commits",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable commits when repo is found dirty (default: True)",
    )
    git_group.add_argument(
        "--dry-run",
        action=argparse.BooleanOptionalAction,
        default=False,
        help="Enable/disable performing a dry run without modifying files (default: False)",
    )
>>>>>>> updated
```

```python
aider/main.py
<<<<<<< HEAD
    if args.git:
        git_root = setup_git(git_root, io)
        check_gitignore(git_root, io)
=======
    if args.git:
        git_root = setup_git(git_root, io)
        if args.gitignore:
            check_gitignore(git_root, io)
>>>>>>> updated
```
2023-09-27 16:24:43 -07:00
Paul Gauthier
6a7fd93580 copy 2023-09-27 10:20:59 -07:00
Paul Gauthier
2ec453ab2a copy 2023-09-27 10:17:19 -07:00
Paul Gauthier
6d5827643f don't try and commit unless there are changes #264 2023-09-25 14:55:00 -07:00
Paul Gauthier
7910c2f731 copy 2023-09-25 12:25:22 -07:00
paul-gauthier
ede5bd4bf0
Merge pull request #254 from fahmad91/main 2023-09-18 18:00:51 -07:00
Farhan Ahmad
7137b29744 Moved instructions from README.md into FAQs section. 2023-09-18 15:04:00 -04:00
Farhan Ahmad
e255b2f500 Removed .gitignore from repo 2023-09-18 14:41:46 -04:00
Farhan Ahmad
b7e3911afc aider: Updated the instructions for running the project locally.
# Aider chat conversation:

USER: update the instruction for running locally to include step by step instructions like cloning the repo / creating a fork. Switch to the correct directly. Install all the dependencies inside `requirements.txt` file using pip install -r. and finally running the program using python -m aider.main

ASSISTANT: To update the instructions for running the project locally, we need to modify the README.md file.

Here are the changes:

<source>markdown
README.md
<<<<<<< HEAD
## Running Locally

After cloning the repository or creating your fork, you can run the local version of Aider using the following command:

```
python -m aider.main
```
=======
## Running Locally

To run the project locally, follow these steps:

1. Clone the repository or create your fork:

```
git clone https://github.com/your-username/aider.git
```

2. Navigate to the project directory:

```
cd aider
```

3. Install the dependencies listed in the `requirements.txt` file:

```
pip install -r requirements.txt
```

4. Run the local version of Aider:

```
python -m aider.main
```
>>>>>>> updated
</source>
2023-09-16 15:45:46 -04:00
Farhan Ahmad
53c467ae88 Updated gitignore 2023-09-16 15:41:42 -04:00
Farhan Ahmad
8bac324b0f aider: Add instructions for running the project locally.
# Aider chat conversation:

USER: Update the readme to include instruction for running the project locally after closing the repo or creating your fork. Make sure to mention how you will go about running the local version aider by using the following command: python -m aider.main

ASSISTANT: To add instructions for running the project locally, we need to modify the README.md file.

Here are the changes:

<source>markdown
README.md
<<<<<<< HEAD
## Installation

See the [installation instructions](https://aider.chat/docs/install.html).
=======
## Installation

See the [installation instructions](https://aider.chat/docs/install.html).

## Running Locally

After cloning the repository or creating your fork, you can run the local version of Aider using the following command:

```
python -m aider.main
```
>>>>>>> updated
</source>
2023-09-16 15:40:05 -04:00
paul-gauthier
93184d1fc2
Merge pull request #250 from joshuavial/fix-benchmark 2023-09-08 17:18:21 -07:00
Joshua Vial
9a91d8fbad set git config safe dir in benchmark docker 2023-09-09 12:07:11 +12:00
paul-gauthier
e073d6901b
Merge pull request #234 from Taik/main 2023-09-08 17:07:02 -07:00
Joshua Vial
91b7648f33 update model creation method 2023-09-09 12:06:34 +12:00
Thinh Nguyen
2f835e9c46
Add default value for skip_model_availabily_check 2023-09-08 16:09:35 -07:00
Thinh Nguyen
45298f8af6
Add option to skip model availability check 2023-09-08 14:04:02 -07:00
Paul Gauthier
2a8c7ef70d set version to 0.14.1-dev 2023-09-08 09:54:43 -07:00
Paul Gauthier
f852bcabcd version bump to 0.14.0 2023-09-08 09:54:15 -07:00
Paul Gauthier
68e3d98f24 Updated HISTORY 2023-09-08 09:53:52 -07:00
Paul Gauthier
aee1338670 copy 2023-09-08 09:49:58 -07:00
Paul Gauthier
239fb92563 Merge remote-tracking branch 'origin/main' 2023-09-08 09:13:07 -07:00
Paul Gauthier
491993f979 Added a benchmarking readme 2023-09-08 09:12:34 -07:00