AI-powered commit message generator
Project description
Cmscribe
AI-powered commit message generator that leverages various AI providers to create meaningful commit messages from your code changes.
🌟 Features
-
Multiple AI Providers
- OpenAI
- Anthropic
- Azure OpenAI
- Ollama
- HuggingFace
-
Commit Message Formats
- Conventional Commits
- Semantic Versioning
- Simple format
- Angular format
-
Smart Configuration
- Multiple provider configurations
- Default provider setting
- Environment variable support
- Provider-specific defaults
- Easy provider switching
-
Developer Experience
- Auto-commit support
- Response caching
- Git hook integration
- Cross-platform support
🚀 Installation
Using uv (Recommended)
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create and activate virtual environment
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install the package
uv pip install cmscribe
Using pip
pip install cmscribe
💻 Usage
Basic Usage
# Generate a commit message for staged changes
cmscribe gen
# Generate with a specific provider (overrides default)
cmscribe gen --provider openai
# Generate with a specific commit format
cmscribe gen --format conventional
# Generate and auto-commit
cmscribe gen --auto
Configuration Management
Quick Setup
# Create initial configuration with all providers
cmscribe config create
# Configure OpenAI
cmscribe config update --provider openai --api-key YOUR_API_KEY
# Configure Anthropic
cmscribe config update --provider anthropic --api-key YOUR_API_KEY
# Configure Google
cmscribe config update --provider gemini --api-key YOUR_API_KEY
# Set OpenAI as default provider
cmscribe config update --provider openai --set-default
Provider-Specific Configuration
Each provider has sensible defaults, but you can customize them:
# OpenAI with custom settings
cmscribe config update --provider openai \
--api-key YOUR_API_KEY \
--model gpt-4 \
--max-tokens 100 \
--temperature 0.8
# Ollama (local)
cmscribe config update --provider ollama \
--model llama2 \
--endpoint http://localhost:11434
# Ollama (remote)
cmscribe config update --provider ollama \
--model llama2 \
--endpoint http://your-server:11434
# Azure OpenAI
cmscribe config update --provider azure_openai \
--api-key YOUR_API_KEY \
--endpoint YOUR_ENDPOINT \
--model gpt-4
Core Settings
Configure global settings that apply to all providers:
# Set default commit format
cmscribe config update --format conventional
# Enable auto-commit
cmscribe config update --auto-commit true
# Enable response caching
cmscribe config update --cache-responses true
Environment Variables
You can also use environment variables for sensitive information:
# OpenAI
export OPENAI_API_KEY="your-api-key"
# Anthropic
export ANTHROPIC_API_KEY="your-api-key"
# Google
export GOOGLE_API_KEY="your-api-key"
# Azure OpenAI
export AZURE_OPENAI_API_KEY="your-api-key"
export AZURE_OPENAI_ENDPOINT="your-endpoint"
View Configuration
View your current configuration:
cmscribe config show
🔧 Configuration File
The configuration file is located at:
- Unix/macOS:
~/.config/cmscribe/config.ini - Windows:
%APPDATA%\cmscribe\config.ini
Example Configuration
[Core]
provider = openai
commit_format = conventional
auto_commit = false
cache_responses = true
[openai]
model = gpt-3.5-turbo
endpoint = https://api.openai.com/v1
max_tokens = 50
temperature = 0.7
api_key = your-api-key
[anthropic]
model = claude-3-sonnet-20240229
endpoint = https://api.anthropic.com
max_tokens = 50
temperature = 0.7
api_key = your-api-key
[gemini]
model = gemini-pro
endpoint = https://generativelanguage.googleapis.com/v1
max_tokens = 50
temperature = 0.7
api_key = your-api-key
[ollama]
model = llama2
endpoint = http://localhost:11434
max_tokens = 50
temperature = 0.7
api_key =
[huggingface]
model = mistralai/Mistral-7B-Instruct-v0.2
endpoint = https://api-inference.huggingface.co/models
max_tokens = 50
temperature = 0.7
api_key = your-api-key
🧪 Development
Running Tests
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=cmscribe
# Run specific test file
uv run pytest test/test_providers.py
Code Quality
# Run linter
uv run ruff check .
# Format code
uv run black .
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
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 cmscribe-0.1.0.tar.gz.
File metadata
- Download URL: cmscribe-0.1.0.tar.gz
- Upload date:
- Size: 67.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4188a9d6d260dc7e7b510ea1236cfdb5c0ab1e4d8d6970a8a040da499e514920
|
|
| MD5 |
d3124051b6dcfeb9a40651dde2f43348
|
|
| BLAKE2b-256 |
e33cb702db36e78a7e9e4bc3e440774c177afa93c1e0708406fc977e001b47dd
|
File details
Details for the file cmscribe-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cmscribe-0.1.0-py3-none-any.whl
- Upload date:
- Size: 32.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1e8a414b1822f38e73f9f715ea2a5ff9250b6dcc184d64520ff8dd060269ab8
|
|
| MD5 |
52d1d1eb6f791a595873a9a84ed2eabd
|
|
| BLAKE2b-256 |
ec1da470eafc59b1f23207d8b49b35c9f9b6e81f3bd1b56c18b24f2204f47be5
|