-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: added new argument --commit-template-file #396
base: main
Are you sure you want to change the base?
Conversation
…e template for commits
@paul-gauthier Just a bump on this, can I get your thoughts on this idea? |
Thanks for putting this together. I don't think I can merge it. Your changes don't take into account that fact that |
Hey thanks for taking a look. I'm likely missing your point since I don't have as much project knowledge as you. I tried to not break functionality by falling back to the old message structure if a template file has not been presented (aka setting the old message structure as a default template string in code) while in the auto_commit method. For clarity, are you saying that there are other methods besides auto_commit that invoke the Repo.commit method? That being the case this definitely doesn't account for that and it would for sure break. If there are, could you maybe tell me which methods would also need modification? I would gladly make necessary changes there as well. @paul-gauthier |
I would love to see this feature as well! I think what @paul-gauthier is referring to is this, which will make sure any user edits are committed before the AI does its thing. Personally, I'd like to have this feature so Aider will use conventional commit messages. Looking at the title of your PR and branch you are looking to do the same @dejecj. If this is the case, however, passing a static template may not be ideal because the prefix is dependent on the type of change that is being committed. One approach to solve this would be to have an LLM look at the diff and ask it to determine the type of change and the appropriate prefix (e.g. As said, this approach is very specific to conventional commits and not as flexible as the template approach. It would probably require a dedicated flag like Example
This obviously is a simplified example, but I think it gives a rough idea. |
Addresses #352
This PR adds a new argument
Use this argument to specify the path to a template file.
If argument is not provided the it will default to the following template:
The default behavior is unchanged as far as the structure of commit messages when the template file is not provided.
The 3 "tags" shown in the default template are dynamically replaced with their actual contents based on the outputs of aider. These can be omitted but it's recommended to at minimum include the
{aider.commit_message}
tag.In addition to these default tags the template supports any number of
{user.**}
tags. For example I can replace the default prefix like so:When you introduce a
{user.**}
tag to the template aider will ask you for the values to inject into the template on startup.The provided template file is not allowed to be empty and it must exists or aider will exit with an error.