cmai analyzes your staged git changes and generates commit messages following your projects existing commit standards. Dynamically creating contextually appropriate messages in multiple languages.
- ⚡ Provider flexibility – supports OpenAI, Anthropic, and local Llama (via Ollama)
- 🧐 Smart commit generation – Context-aware messages from staged changes and git history
- 🏃 Fast workflow – terminal, interactive, clipboard output modes with cross-platform support
- ⚙️ Rule enforcement – define per-project or global rules to keep commits consistent
- 📝 Multiple suggestions – generate and regenerate commit options until one fits
- 🌍 Multi-language support – generate commits in 25+ languages
- 🗜️ Commitlint compatibility – works seamlessly with existing commitlint setups
- 🔒 Built-in safety – auto-redacts API keys, tokens, and secrets before sending to AI
- 📊 Git-aware – branch context, recent commit analysis, and large diff handling
pnpm add -g cmai
npm install -g cmai
yarn global add cmaiYou can also run cmai without installing it globally using pnpx (or npx):
pnpx cmai init
npx cmai initgit add .
cmai| Mode | Description |
|---|---|
| clipboard | Copy to clipboard (default) |
| commit | Create a Git commit directly |
| terminal | Output a git commit command for editing |
| display | Show the messages only |
cmai init # Set up provider and key
cmai settings # Modify configuration
cmai # Generate commit messages
cmai --dryrun # Preview prompts before sending.cmai/settings.json. Since this directory contains your private key, please ensure it’s listed in your .gitignore.
{
"provider": "OLLAMA",
"maxCommitLength": 72,
"commitChoicesCount": 8,
"usageMode": "TERMINAL",
"redactSensitiveData": true,
"customRules": [
"all commit messages must be lowercase"
],All settings can be overridden with environment variables:
CMAI_PROVIDER=ANTHROPIC
CMAI_MODEL=claude-3-haiku-20240307
CMAI_USAGE_MODE=COMMIT
CMAI_COMMIT_LANGUAGE=esnode>=18.0.0pnpm10.14.0(corepack enableto install)- SonarScanner (optional):
brew install sonar-scanner - Docker/OrbStack (optional): for testing GitHub Actions locally
pnpm install
# Development mode (auto-rebuild on changes)
pnpm devpnpm dev # Watch mode with concurrent build & typecheck
pnpm build # Production build
pnpm test # Run tests in watch mode
pnpm test:ci # Run tests once (for CI)
pnpm test:coverage # Generate coverage report (80% threshold)pnpm lint # Check code style
pnpm lint:fix # Auto-fix style issues
pnpm typecheck # TypeScript type checking
pnpm knip # Find unused code/dependencies
pnpm knip:fix # Remove unused dependenciespnpm sonar:local # SonarCloud (requires project SONAR_TOKEN)
pnpm bundle:stats # Analyze bundle size
pnpm analyze # Package content analysis
pnpm act # Test GitHub Actions locally (needs Docker)pnpm release # Interactive release with version bump & changelog
pnpm release:dry # Preview release without publishingContributions, issues, and feature requests are welcome. If you would like to get involved, please open an issue or submit a pull request to help improve the project.
This project is released under the MIT License. Created and maintained by Alex Whinfield.

