| Crates.io | commitor |
| lib.rs | commitor |
| version | 0.1.0 |
| created_at | 2025-07-13 17:31:09.104261+00 |
| updated_at | 2025-07-13 17:31:09.104261+00 |
| description | Automatically generate conventional commit messages based on git diff using AI |
| homepage | |
| repository | https://github.com/simonhdickson/commitor |
| max_upload_size | |
| id | 1750653 |
| size | 241,077 |
Automatically generate conventional commit messages based on your git diff using AI.
Commitor is a Rust CLI tool that analyzes your staged git changes and generates conventional commit messages using AI models from OpenAI or Ollama. Say goodbye to writer's block when crafting commit messages!
✅ COMPLETE: Full implementation with AI-powered analysis and conventional commit generation!
This project successfully demonstrates a complete Rust application that:
git clone https://github.com/simonhdickson/commitor.git
cd commitor
cargo install --path .
Set your OpenAI API key as an environment variable:
export OPENAI_API_KEY="your-api-key-here"
Or pass it directly using the --api-key flag.
ollama serve
ollama pull llama2
git add .
commitor generate
commitor --provider ollama --model llama2 generate
commitor commit
commitor [OPTIONS] [COMMAND]
Commands:
generate Generate a commit message for staged changes
commit Generate and commit in one step
diff Show the current git diff
models List available models for the selected provider
check-ollama Check if Ollama is available (only for Ollama provider)
Options:
--provider <PROVIDER> AI provider to use [default: openai] [possible values: openai, ollama]
--api-key <API_KEY> OpenAI API key [env: OPENAI_API_KEY]
--ollama-url <OLLAMA_URL> Ollama base URL [default: http://localhost:11434]
--ollama-timeout <TIMEOUT> Timeout for Ollama requests in seconds [default: 30]
--model <MODEL> Model to use for generation [default: gpt-4]
--count <COUNT> Maximum number of commit message options to generate [default: 3]
-y, --auto-commit Automatically use the first generated commit message
--show-diff Show the git diff before generating commit message
-h, --help Print help
-V, --version Print version
Generate multiple commit message options with OpenAI:
commitor generate --count 5
Use Ollama with a local model:
commitor --provider ollama --model llama2 generate
Use a different OpenAI model:
commitor generate --model gpt-3.5-turbo
Auto-commit with the first suggestion:
commitor commit --auto-commit
Show diff before generating:
commitor generate --show-diff
List available models (shows your installed models):
commitor models --provider ollama
Check Ollama availability:
commitor check-ollama
Use custom Ollama URL:
commitor --provider ollama --ollama-url http://localhost:11434 --model codellama generate
Commitor generates messages following the Conventional Commits specification:
<type>(<scope>): <description>
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Changes that do not affect the meaning of the coderefactor: A code change that neither fixes a bug nor adds a featuretest: Adding missing tests or correcting existing testschore: Changes to the build process or auxiliary toolsperf: A code change that improves performanceci: Changes to CI configuration files and scriptsbuild: Changes that affect the build system or external dependenciesfeat(auth): add JWT token validationfix(database): resolve connection timeout issuedocs(readme): update installation instructionsrefactor(utils): simplify string parsing logictest(api): add integration tests for user endpointsYou can customize the behavior by setting environment variables:
# Set your OpenAI API key (for OpenAI provider)
export OPENAI_API_KEY="sk-..."
# Set default model (applies to both providers)
export COMMITOR_MODEL="gpt-4"
# Set default count
export COMMITOR_COUNT="3"
Popular models you can use with Ollama:
llama2: General purpose modelcodellama: Optimized for code understandingmistral: Fast and efficient modelneural-chat: Good for conversational tasksdeepseek-coder: Specialized for coding tasksPull models using:
ollama pull <model-name>
Contributions are welcome! Please feel free to submit a Pull Request.
cargo buildcargo testcargo run -- generatecargo test
This project is licensed under the MIT License - see the LICENSE file for details.
"Not in a git repository"
git init if needed"No staged changes found"
git add <files>git status"OpenAI API key not found" (OpenAI provider)
OPENAI_API_KEY environment variable--api-key flag"Ollama is not available" (Ollama provider)
ollama servecommitor check-ollama--ollama-urlAPI rate limits (OpenAI provider)
Model not found (Ollama provider)
ollama pull <model-name>commitor models --provider ollamaRun with debug logging:
RUST_LOG=debug commitor generate
Core Features Implemented:
Key Technical Achievements:
Future Roadmap: