A CLI tool to generate commit messages using AI models
Project description
AI Message Generator for Git
A CLI tool that generates commit messages using AI models based on your git repository changes. It analyzes the staged changes in your git repository and uses AI models to generate meaningful and descriptive commit messages.
Features
- 🤖 Supports multiple AI models:
- OpenAI GPT-3.5 Turbo
- DeepSeek Chat
- 🎯 Follows conventional commits format
- 🛠️ Customizable prompt templates
- 🔑 Secure API key storage
- 🌐 Smart API endpoint management
- 📝 Clear and concise commit messages
Installation
pip install aimsg
Setup
Initialize the tool with your API key and preferred model:
aimsg init
This will guide you through:
- Selecting an AI model
- Entering your API key
- Configuring the API endpoint (if needed)
Each model has its default API endpoint:
- GPT-3.5 Turbo:
https://api.openai.com/v1 - DeepSeek Chat:
https://api.deepseek.com
Usage
Simply use the aimsg command in any git repository:
# Stage your changes first
git add .
# Generate commit message for staged changes
aimsg commit
# Show help
aimsg --help
# Configure custom prompt template
aimsg prompt
# Reset prompt template to default
aimsg reset_prompt
# Change the AI model or API endpoint
aimsg model
Model Selection
You can choose or change the AI model:
$ aimsg model
The tool will show you:
- Available models with their default API endpoints
- Your current configuration
- Option to modify the API endpoint (when applicable)
Some models (like DeepSeek) require using their specific API endpoints, which will be automatically configured for you.
Custom Prompt Template
You can customize the prompt template used for generating commit messages:
$ aimsg prompt
This will show the current prompt template and allow you to modify it. The template can use the following variables:
{diff}: The git diff content
Example custom prompt template:
Based on this git diff, write a commit message:
{diff}
The commit message should:
1. Start with a type (feat/fix/docs/style/refactor/test/chore)
2. Include a scope in parentheses
3. Have a brief description
4. Be no longer than 72 characters
To reset the prompt template to default:
$ aimsg reset_prompt
Example Output
$ git add .
$ aimsg commit
Generated commit message:
----------------------------------------
feat(cli): add AI-powered commit message generation
----------------------------------------
Do you want to commit with this message? [y/N]: y
Changes committed successfully!
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Troubleshooting
If you get "command not found: aimsg" after installation:
- Make sure you've added the user-level bin directory to your PATH as shown in the installation section
- Check if the aimsg command exists in the bin directory:
ls ~/Library/Python/3.12/bin/aimsg # Adjust Python version as needed
- If the command exists but still isn't found, try restarting your terminal
Project details
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 aimsg-0.1.0.tar.gz.
File metadata
- Download URL: aimsg-0.1.0.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a06493728a9a7254f680e494e28b6f89c57bd330fdd6fe14d13f9296eb261fdf
|
|
| MD5 |
b975277e29ce491280bcb78164675c81
|
|
| BLAKE2b-256 |
57ea0dd4c158aad04054792ef6917cf8991fae16c53dcadda3287fa97273ec05
|
File details
Details for the file aimsg-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aimsg-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51d40166032a87199a3b651b2df6f58c459f1dd9f5063a02badf438389addd86
|
|
| MD5 |
5061285ee77febcfb53461908a81d1a3
|
|
| BLAKE2b-256 |
efa0dc0e1c220ac20eed2f5ab7f0600f22991037d1b5a4ca7b74ae22cda2e620
|