aider
aider copied to clipboard
Configure aider to always add specific files to the chat (eg, conventions file)
Question and suggestion.
Suggestion: Augment .editorconfig file content into all queries as an additional context.
Question: Is there a way to specify files that will be augmented to the context of all queries by default? Is there is no, I suggest to implement it.
Thanks for trying aider and filing this issue.
https://aider.chat/docs/conventions.html
Thank you for the answer!
So, we can use aider like aider .editorconfig, right?
It would be great if aider itself would automatically pick up known code-styles files (.editorconfig, .DotSettings, etc.) and inject them in the prompt in the right place. So, I think, we can convert the issue into feature request.
As I mentioned in #743, I would like to see this as an option flag / env var.
Something like...
## Automatically add this file to each chat
AIDER_AUTO_ADD=./CONVENTIONS.md
What about writing a function that overrides the aider command in your shell? In have this which searches for CONVENTIONS.md in the current directory and parent directories until it finds that file or the .aider* project files:
aider() {
current_dir="$PWD"
while [ "$current_dir" != "/" ]; do
if [ -f "$current_dir/CONVENTIONS.md" ]; then
echo "Using CONVENTIONS.md found at $current_dir/CONVENTIONS.md :"
echo
cat "$current_dir/CONVENTIONS.md"
echo
command aider "$@" "$current_dir/CONVENTIONS.md"
return 0
fi
if find -maxdepth 1 -name ".aider*" -type f -print 2>/dev/null | grep -q .; then
echo ".aider* files were found but CONVENTIONS.md was not"
break
fi
current_dir=$(dirname "$current_dir")
done
command aider "$@"
}
I work with different languages and frameworks, so i'm thinking of having different convention files such as python_conventions.md and bash_conventions.md, in which case I would change the function above to automatically include these convention files based on grepping the shebang line
It would be great to have a configuration rather than a hack, like we have it for input-history-file or chat-history-file. Something like conventions-file to give a location even from outside of the repository. I am using the same convention in multiple projects. No need to have it in the repo.
I am using the same convention in multiple projects. No need to have it in the repo.
fwiw it seems we're allowed to add files outside of the repo when invoking aider:
aider ~/testfile.conventions.md
But it's not allowed when using the /add command. I'm not sure if this is a bug
Also, it'll be convenient if aider preserves the convention files after /drop command.
You can now add file: CONVENTIONS.md to .aider.conf.yml to always load a specific file.
- Or
file: [file1, file2, file3]to always load multiple files.
The change is available in the main branch. You can get it by installing the latest version from github:
python -m pip install --upgrade git+https://github.com/paul-gauthier/aider.git
If you have a chance to try it, let me know if it works for you.
Wow, great news! Thanks a lot, Paul! I can't wait for this feature in the release via pipx.
I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.
Thanks for getting this done, @paul-gauthier!
Shouldn't file always be relative to .aider.conf or git repository root?
For example,
# /some/repo/.aider.yml
file: CONVENTIONS.md
If you open aider in /some/repo/subdirectory/, aider will try to add subdirectory/CONVENTIONS.md to chat. It does not exist so it will create an empty file CONVENTIONS.md in subdirectory.
This makes it impractical to launch aider in a subdirectory of a repo to get simpler paths in aider, if you want to use file.
Workaround is to use an absolute path in file, but I feel the path being relative to .aider.yml (or repo root) is more intuitive.