AiCommitMessage 0.11.4
dotnet tool install --global AiCommitMessage --version 0.11.4
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local AiCommitMessage --version 0.11.4
#tool dotnet:?package=AiCommitMessage&version=0.11.4
nuke :add-package AiCommitMessage --version 0.11.4
🧠🧰 This tool generates AI-powered commit messages via Git hooks, automating meaningful message suggestions from OpenAI and others to improve commit quality and efficiency.
[!CAUTION] This is still in development/beta. It will be GA when a major release 1.0 becomes available.
What this tool does
Generates a commit message based on the git diff
result using the OpenAI API.
Requirements
Getting started
This repository is available at NuGet under the name AICommitMessage.
Installation
- Install the tool globally (or per project/repository).
- Move to the project folder.
- Install the Git hook on the default
hooks
directory.
dotnet tool install -g AiCommitMessage
cd my-project/
dotnet-aicommitmessage install-hook
git add .
git commit -m ""
Use git log -1
to review the last commit details and find the automatically generated commit message.
Commit message pattern
The training model for the AI used is designed using as reference these guidelines:
- Conventional Commits v1.0.0.
- Padrões de Commits (in Portuguese).
- Conventional Commit Messages.
- Emoji for Conventional Commits.
- conventional-commit-types.
Sequence of Execution
Here’s a flow diagram showing the sequence of execution of the prepare-commit-msg
hook and its integration with dotnet-aicommitmessage
to generate commit messages using the OpenAI API:
graph TD
A[Git Commit] --> B[prepare-commit-msg Hook Trigger]
B --> C[Invoke dotnet-aicommitmessage Tool]
C --> D[Send Data to OpenAI API]
D --> E[Generate Commit Message]
E --> F[Check and append pre-defined commands to Commit Message]
F --> G[Return Generated Commit Message]
G --> H[Insert Commit Message into Git Commit]
H --> I[Finalize Commit]
Commands
This tool accepts an argument as the command to execute. Here is a list of available commands:
Command | Description |
---|---|
install-hook |
Installs GIT hooks in the default .git/hooks directory or in the custom directory configured in GIT settings. |
generate-message |
Generates a commit message based on the current changes (git diff context). |
set-settings |
Set the OpenAI settings. |
help |
Display information about this program. |
version |
Display version information. |
Example output
Here is an example of the commit messages generated in a real-world project:
Debug
You can run the message generation manually to debug it, but it will not commit the content to your GIT repository.
If you also want to check the OpenAI JSON response, append the -D
parameter.
Manually generating the commit message
To manually generate a commit message without committing the staged changes, run the following command:
dotnet-aicommitmessage generate-message -m "."
Saving the OpenAI JSON response
If you want to persist the OpenAI JSON response, add the -D
parameter and a debug.json
file will be created with the response JSON.
dotnet-aicommitmessage generate-message -Dm "."
Here is a sample debug.json
content:
{
"Value": {
"CreatedAt": "2024-11-20T12:54:03+00:00",
"FinishReason": 0,
"ContentTokenLogProbabilities": [],
"RefusalTokenLogProbabilities": [],
"Role": 2,
"Content": [
{
"Kind": 0,
"Text": "feat - add reactivation handling for refunds due today",
"ImageUri": null,
"ImageBytes": null,
"ImageBytesMediaType": null,
"ImageDetailLevel": null,
"Refusal": null
}
],
"ToolCalls": [],
"Refusal": null,
"FunctionCall": null,
"Id": "chatcmpl-[[REDACTED]]",
"Model": "gpt-4o-mini-2024-07-18",
"SystemFingerprint": "fp-[[REDACTED]]",
"Usage": {
"OutputTokenCount": 10,
"InputTokenCount": 6229,
"TotalTokenCount": 6239,
"OutputTokenDetails": {
"ReasoningTokenCount": 0
}
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. |
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
0.11.4 | 69 | 11/26/2024 |
0.11.3 | 66 | 11/26/2024 |
0.11.2 | 65 | 11/26/2024 |
0.11.1 | 72 | 11/25/2024 |
0.11.0 | 69 | 11/23/2024 |
0.10.2 | 75 | 11/23/2024 |
0.10.1 | 67 | 11/23/2024 |
0.10.0 | 83 | 11/20/2024 |
0.9.1 | 77 | 11/20/2024 |
0.9.0 | 70 | 11/20/2024 |
0.8.8 | 76 | 11/18/2024 |
0.8.7 | 68 | 11/18/2024 |
0.8.6 | 71 | 11/15/2024 |
0.8.5 | 68 | 11/15/2024 |
0.8.4 | 77 | 11/12/2024 |
0.8.3 | 85 | 11/11/2024 |
0.8.2 | 81 | 11/11/2024 |
0.8.1 | 74 | 11/4/2024 |
0.8.0 | 82 | 11/1/2024 |
0.7.9 | 72 | 11/1/2024 |
0.7.8 | 74 | 11/1/2024 |
0.7.7 | 68 | 11/1/2024 |
0.7.6 | 76 | 11/1/2024 |
0.7.5 | 80 | 11/1/2024 |
0.7.4 | 71 | 10/28/2024 |
0.7.3 | 82 | 10/28/2024 |
0.7.2 | 76 | 10/28/2024 |
0.7.1 | 75 | 10/27/2024 |
0.7.0 | 76 | 10/26/2024 |
0.6.1 | 77 | 10/26/2024 |
0.6.0 | 76 | 10/22/2024 |
0.5.1 | 72 | 10/22/2024 |
0.5.0 | 69 | 10/22/2024 |
0.4.23 | 80 | 10/22/2024 |
0.4.22 | 73 | 10/22/2024 |
0.4.21 | 87 | 10/21/2024 |
0.4.20 | 161 | 10/19/2024 |
0.4.19 | 106 | 10/19/2024 |
0.4.18 | 105 | 10/19/2024 |
0.4.17 | 107 | 10/19/2024 |
0.4.16 | 103 | 10/19/2024 |
0.4.15 | 109 | 10/19/2024 |
0.4.14 | 118 | 10/19/2024 |
0.4.13 | 115 | 10/19/2024 |
0.4.12 | 116 | 10/19/2024 |
0.4.11 | 117 | 10/19/2024 |
0.4.10 | 116 | 10/19/2024 |
0.4.9 | 82 | 10/14/2024 |
0.4.8 | 80 | 10/14/2024 |
0.4.7 | 108 | 10/14/2024 |
0.4.6 | 90 | 10/8/2024 |
0.4.5 | 82 | 10/8/2024 |
0.4.4 | 84 | 10/8/2024 |
0.4.3 | 81 | 10/8/2024 |
0.4.2 | 83 | 10/8/2024 |
0.4.1 | 82 | 10/8/2024 |
0.4.0 | 85 | 10/8/2024 |
0.3.11 | 84 | 10/8/2024 |
0.3.10 | 119 | 10/8/2024 |
0.3.9 | 83 | 10/8/2024 |
0.3.8 | 93 | 10/8/2024 |
0.3.7 | 80 | 10/8/2024 |
0.3.6 | 81 | 10/8/2024 |
0.3.5 | 82 | 10/7/2024 |
0.3.4 | 84 | 10/7/2024 |
0.3.3 | 121 | 9/30/2024 |
0.3.2 | 91 | 9/30/2024 |
0.3.1 | 93 | 9/25/2024 |
0.3.0 | 82 | 9/25/2024 |
0.2.7 | 91 | 9/23/2024 |
0.2.6 | 93 | 9/23/2024 |
0.2.5 | 91 | 9/23/2024 |
0.2.4 | 91 | 9/23/2024 |
0.2.3 | 88 | 9/23/2024 |
0.2.2 | 126 | 9/23/2024 |
0.2.1 | 86 | 9/21/2024 |
0.2.0 | 91 | 9/20/2024 |
0.1.29 | 86 | 9/20/2024 |
0.1.28 | 80 | 9/20/2024 |
0.1.27 | 85 | 9/20/2024 |
0.1.26 | 87 | 9/20/2024 |
0.1.25 | 89 | 9/20/2024 |
0.1.24 | 96 | 9/20/2024 |
0.1.23 | 107 | 9/17/2024 |
0.1.22 | 96 | 9/17/2024 |
0.1.21 | 96 | 9/17/2024 |
0.1.20 | 96 | 9/17/2024 |
0.1.19 | 102 | 9/17/2024 |
0.1.18 | 96 | 9/17/2024 |
0.1.17 | 101 | 9/17/2024 |
0.1.16 | 99 | 9/16/2024 |
0.1.15 | 152 | 9/16/2024 |
0.1.14 | 96 | 9/16/2024 |
0.1.12 | 98 | 9/16/2024 |
0.1.11 | 99 | 9/16/2024 |