A smart AI-powered Git commit message generator for Dart and Flutter projects.
It automatically analyzes your Git changes (git diff
) and suggests a clean, concise, and meaningful commit message using OpenAI.
✅ Automatically stages and analyzes your code changes
✅ Generates professional commit messages using OpenAI GPT models
✅ Interactive CLI — choose commit type and confirm messages
✅ Works on Windows, macOS, and Linux
✅ No manual initialization required in CI/CD environments
✅ Safe to use — requires explicit confirmation before committing
Add this to your dev_dependencies
in your pubspec.yaml
:
dev_dependencies:
commit_agent: ^1.0.0
Then run:
flutter pub get
Now that CI/CD handles initialization, you only need to set your OpenAI API key and run the CLI command.
- Set your OpenAI API key as an environment variable
export OPENAI_API_KEY="sk-your-key"
setx OPENAI_API_KEY "sk-your-key"
- Run the Commit Agent
dart run commit_agent
The agent will:
- Stage all changes (
git add .
) - Ask for the commit type (e.g., FEAT, FIX, REFACTOR, DOCS, etc.)
- Optionally take your note
- Generate an AI-based commit message
- Ask for confirmation before committing and pushing 🚀
✅ All changes staged.
Select commit type:
1. FEAT
2. FIX
3. CHORE
4. REFACTOR
5. DOCS
6. TEST
7. STYLE
8. BUG
Enter choice: 1
📝 Optional note: Added login validation
🧠 Suggested commit message:
[FEAT] Improve login validation flow with error handling
Proceed? (y/n): y
🚀 Commit created & pushed successfully!
Since CI/CD pipelines now handle initialization, you don’t need to call initCommitAgent()
manually.
Just make sure the environment variable OPENAI_API_KEY
is available in your CI/CD runner before running:
dart run commit_agent
This project is licensed under the MIT License — feel free to use it in personal and commercial projects.
Copyright (c) 2025 Rohan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
Rohan Kumar Chaudhary (@rohan-165) 📧 rohanchy165@gmail.com 💻 GitHub
💬 “Let your commits tell a story — not just a change.”