An AI-powered CLI to generate git commit messages using Google Gemini.
Project description
GitComposer
GitComposer is a command-line tool that uses Google's Gemini AI to automatically generate concise, conventional commit messages from your staged Git changes. It streamlines your workflow by analyzing your diff and committing the changes for you with a single command.
The Problem It Solves
Writing clear and conventional commit messages is a best practice, but it can be tedious. GitComposer takes on this task for you. It reads your staged changes, understands the context, and generates a high-quality commit message in the imperative mood (e.g., "Add user authentication feature" instead of "Added a feature"). This saves you time and ensures your project's commit history remains clean, consistent, and easy to read.
Features
- 🤖 AI-Powered Messages: Leverages the Google Gemini CLI to generate context-aware commit messages.
- ✅ Interactive Workflow: Displays the suggested message and asks for your confirmation before committing.
- ⚙️ Simple Interface: Runs with a single command:
gitcomposer. - 📂 Directory-Aware: Works on any Git repository by pointing to its path or by running it from within the project directory.
- 📦 Easy Installation: Packaged and ready for installation via
pip.
Demo
Here is a typical workflow using gitcomposer:
# You've done some work and staged your files
$ git add .
# Run gitcomposer in your repository's directory
$ gitcomposer
Analyzing repository at: /home/user/projects/my-awesome-project
Sending staged changes to Gemini to generate a commit message...
✨ Suggested Commit Message ✨
---------------------------------
Refactor user service to use dependency injection
---------------------------------
Do you want to commit with this message? [Y/n]: y
Committing changes...
✅ Commit successful!
[main 7f3b1d9] Refactor user service to use dependency injection
1 file changed, 5 insertions(+), 3 deletions(-)
Prerequisites
Before you can use GitComposer, you must have the following tools installed and configured on your system:
-
Git: The version control system itself. Installation Guide
-
Node.js and npm: Required to install the Gemini CLI. Installation Guide
-
Google Gemini CLI: The core dependency that provides the AI capabilities.
Install it globally via
npm:npm install -g @google/gemini-cli
Installation
Once the prerequisites are met, you can install GitComposer directly from PyPI:
pip install gitcomposer
This will automatically install the click library and make the gitcomposer command available in your terminal.
Configuration
GitComposer works by calling the gemini command, which must be configured with your Google Gemini API key. If you haven't done so already, configure the Gemini CLI by running:
gemini auth
This command will prompt you to enter your API key. This is a one-time setup.
Usage
The command is simple and straightforward.
-
Navigate to your Git repository in your terminal.
-
Stage the changes you want to commit (
git add ...). -
Run the command:
gitcomposer
Alternatively, you can run the command from anywhere and pass the path to your repository as an argument:
gitcomposer /path/to/your/repository
The tool will then generate a message and prompt you for confirmation before committing.
How It Works
- The
gitcomposercommand is executed in a repository with staged changes. - It runs
git diff --stagedto capture the code modifications. - This diff is sent to the Gemini CLI with a carefully crafted prompt asking for a conventional commit message.
- Gemini returns a suggested message.
- The message is displayed to you for approval.
- If you confirm, the tool executes
git commit -m "The generated message"to finalize the commit.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitcomposer-0.1.1.tar.gz.
File metadata
- Download URL: gitcomposer-0.1.1.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e55001011971ee959c567fd6b21c8738e3fce0119e6ad2f6045f9118847fb85
|
|
| MD5 |
f47f75158a65ab3572b2aba56d4b6abd
|
|
| BLAKE2b-256 |
ccdf4a722772b7142ed522273d0a66bb28d72ed8f0cd9111e15ee598c8462c5e
|
File details
Details for the file gitcomposer-0.1.1-py3-none-any.whl.
File metadata
- Download URL: gitcomposer-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed98e9a2eaa0a7b56860bdbdbd4387a261d200a78b39268f106331508cb8004e
|
|
| MD5 |
af94a15b406407d0aee91549925aba24
|
|
| BLAKE2b-256 |
2687ea2a4ec80c68ad1bebaadd4da3b784e1868f7d593595545f7d76c6271b9b
|