cmt is a Rust CLI tool that generates git commit messages using LLMs (Claude, OpenAI, Gemini). It analyzes staged changes, builds rich context, and produces conventional commit messages via structured output.
src/git.rs- Git diff extraction, filtering, and statisticssrc/lib.rs- Main generation logic and post-processingsrc/config/mod.rs- ResolvedConfig(defaults < global < project < CLI) passed through the pipelinesrc/ai/mod.rs- LLM provider abstractionsrc/prompts/- System and user prompt templatessrc/templates.rs- Handlebars template renderingsrc/config/- CLI args, config file loading, defaultssrc/bin/main.rs- CLI entry point
See METHODOLOGY.md for detailed documentation of:
- How git diffs are assembled and filtered
- Prompt construction and LLM communication
- All default parameters and adaptive behavior
When modifying the diff-to-LLM pipeline, update METHODOLOGY.md to keep it accurate.
cargo build --release # Build
cargo test # Run tests
cargo clippy # Lintgit2- Git operationsrstructor- Structured LLM outputhandlebars- Template renderingtokio- Async runtime