Aider-AI / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
22.19k stars 2.06k forks source link

[Feature Req] Add the option to add custom commands to aider (via a yaml file) #894

Open Emasoft opened 4 months ago

Emasoft commented 4 months ago

Issue

Add the option to add custom commands to aider (via a yaml file like aider_commands.yml ). For example:

commands:
  - name: checktypes
    min_num_of_args: 1
    files_to_add_to_chat: "%1"
    aider_command: "/run mypy %1 --show-traceback --python-version=3.11"
    add_output_to_chat: true
    term_command: ""

  - name: selfcheck
    min_num_of_args: 0
    files_to_add_to_chat: ""
    aider_command: "Examine your last commit for errors and potential issues."
    add_output_to_chat: true
    term_command: ""

  - name: rufflint
    min_num_of_args: 1
    files_to_add_to_chat: "%1"
    aider_command: "/run ruff check %1 --ignore E203,E501,E266,W503,W504,W505,F841,F842 --isolated --fix --target-version py311 --output-format full"
    add_output_to_chat: true
    term_command: ""

  - name: textualdev
    min_num_of_args: 1
    files_to_add_to_chat: "%1"
    aider_command: "/run textual console --port 7342 -x SYSTEM -x EVENT -x DEBUG -x INFO"
    add_output_to_chat: true
    term_command: "textual run --dev --port 7342 %1"

  - name: rclone
    min_num_of_args: 0
    files_to_add_to_chat: ""
    aider_command: ""
    add_output_to_chat: false
    term_command: "rclone -vv -P sync . Jottacloud:DEVBOX_aider --exclude-from .gitignore"

Commands predefined variables: %n = argument number n (put between double quotes) %a = all arguments separated by space (and each one between double quotes) %c = all arguments separated by comma (and each one between double quotes) %f = last file with changes committed by aider (put between double quotes) %s = all files added to the chat separated by space (and each one between double quotes) %k = all files added to the chat separated by comma (and each one between double quotes) %p = project root path (put between double quotes)

Version and model info

No response

amanhigh commented 3 months ago

Yes even Continue.dev allows custom command. This would help setup common workflows easily in aider.

  "customCommands": [
    {
      "name": "test",
      "prompt": "Write a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.",
      "description": "Write unit tests for highlighted code"
    },
    {
      "name": "task",
      "description": "Next AI Task",
      "prompt": "Read Instructions for Next Task in task.md"
    }
  ],