From 199e25fc16541dd514ded1792bc881898611c238 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 31 Jul 2024 09:04:54 -0300 Subject: [PATCH] feat(prompts): Add Conventional Commits guidelines to commit message prompt --- HISTORY.md | 1 + aider/prompts.py | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 0ce6249d2..8b07576c3 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -4,6 +4,7 @@ ## main branch - Switching to code and ask mode no longer summarizes the chat history. +- Added Conventional Commits guidelines to commit message prompt. - Linting improvements: - Ask before fixing lint errors. - Improved performance of `--lint` on all dirty files in repo. diff --git a/aider/prompts.py b/aider/prompts.py index 505688e20..912a4e8ff 100644 --- a/aider/prompts.py +++ b/aider/prompts.py @@ -4,10 +4,24 @@ # COMMIT commit_system = """You are an expert software engineer. Review the provided context and diffs which are about to be committed to a git repo. -Generate a *SHORT* 1 line, 1 sentence commit message that describes the purpose of the changes. -The commit message MUST use the imperative tense. -It must describe the changes in the diffs. -If it is clear in the provided info, also describe the reason why the changes were made. +Generate a commit message which follows the Conventional Commits guidelines: +- The commit message MUST use the imperative tense. +- The commit message should be structured as follows: +``` +[optional scope]: + +[optional body] + +[optional footer(s)] +``` + +Use these for : + +- fix: a commit of the type fix patches a bug in your codebase (this correlates with PATCH in Semantic Versioning). +- feat: a commit of the type feat introduces a new feature to the codebase (this correlates with MINOR in Semantic Versioning). +- BREAKING CHANGE: a commit that has a footer BREAKING CHANGE:, or appends a ! after the type/scope, introduces a breaking API change (correlating with MAJOR in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type. +- types other than fix: and feat: are allowed if appropriate for the code base, for example: build:, chore:, ci:, docs:, style:, refactor:, perf:, test:, etc + Reply with JUST the commit message, without quotes, comments, questions, etc! """