An ultra lightweight Zig CLI tool (~900KB) that analyzes Git history and generates conventional commit messages using LLM providers.
- AI-Powered Commit Messages - Automatically generates conventional commit messages from your git diffs using LLM providers (z.ai, Groq)
- Customizable System Prompt - Edit the system prompt to customize how commit messages are generated (conventional commits, style, tone, etc.)
- Multiple LLM Providers - Support for z.ai and Groq with easy provider switching
- Interactive Workflow - Interactive prompts for staging files, reviewing commit messages, and pushing to remote
- Full Automation - Optional flags for fully automated add, commit, and push workflow
- Cross-Platform - Works on macOS and Linux
brew tap jsmenzies/tap
brew install autocommitRequires Zig 0.13.0 or later:
git clone https://github.com/jsmenzies/autocommit.git
cd autocommit
zig buildThe binary will be at zig-out/bin/autocommit.
Download from releases page (coming soon).
autocommit # Generate commit message interactively
autocommit config # Open config in default editor
autocommit config show # Display current configuration
autocommit config path # Show configuration file path--add- Auto-add all unstaged files before committing--push- Auto-push after committing--accept- Auto-accept generated commit message without prompting--provider <name>- Override provider (zai, groq)--model <name>- Override model--debug- Enable debug output--version- Show version information--help- Show help message
# Generate commit message interactively (default)
autocommit
# Full automation: add all files, auto-accept commit, and push
autocommit --add --accept --push
# Auto-add all files and commit
autocommit --add
# Full automated workflow: add, commit, and push
autocommit --add --push
# Use specific provider
autocommit --provider groq
# Use specific provider and model
autocommit --provider groq --model llama-3.1-8b-instant
# Full automation with provider override
autocommit --add --accept --push --provider groq
# Note: All flags can be mixed and matched. Remove any you don't need:
# autocommit --add # Just add files
# autocommit --add --push # Add and push (review commit message)
# autocommit --accept --push # Accept and push (files already staged)
# Edit configuration in default editor
autocommit config
# Display current configuration
autocommit config show
# Show configuration file path
autocommit config path
# Show version
autocommit --version
# Show help
autocommit --helpFor a fully automated workflow, add this alias to your shell configuration:
# ~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish
alias ac='autocommit --add --accept --push'With this alias, running ac will:
- Auto-add all unstaged/untracked files to git
- Generate a conventional commit message using AI
- Auto-accept the commit message (no prompting)
- Push the commit to the remote repository
This provides a quick "commit and push everything" workflow for rapid development.
Note: You can modify the flags to suit your needs:
- Remove
--acceptif you want to review/edit the commit message - Remove
--pushif you don't want to push immediately - Add
--provider <name>to use a specific provider
Configuration is stored as TOML at ~/.config/autocommit/config.toml by default on both macOS and Linux.
If the XDG_CONFIG_HOME environment variable is set, the config will be stored at $XDG_CONFIG_HOME/autocommit/config.toml instead.
When you run autocommit config, the tool automatically creates a default configuration file with the following structure and inputs the default prompt
default_provider = "zai"
system_prompt = ""
[[providers]]
name = "zai"
api_key = "paste-key-here"
model = "glm-4.7-Flash"
endpoint = "https://api.z.ai/api/paas/v4/chat/completions"
[[providers]]
name = "groq"
api_key = "paste-key-here"
model = "llama-3.1-8b-instant"
endpoint = "https://api.groq.com/openai/v1/chat/completions"Note: Groq offers a free tier for many models. Sign up at https://groq.com to get an API key.
The default system prompt instructs the LLM to generate conventional commit messages. It supports both single-line and multiline commit messages:
Single-line format (for simple changes):
<type>(<scope>): <subject>
Example:
feat(auth): add password validation to login form
Multiline format (for complex or multiple changes):
<type>(<scope>): <subject>
<body with bullet points>
Example:
feat(api): implement rate limiting middleware
- Add sliding window rate limiting with Redis backend
- Configurable limits per endpoint via env vars
- Returns 429 status with Retry-After header
The prompt instructs the LLM to:
- Use conventional commit types:
feat,fix,docs,style,refactor,test,chore - Keep the subject line concise and in present tense, imperative mood
- Add a body section for complex changes or when there are multiple distinct changes
- Use bullet points in the body to describe what and why
You can customize the system prompt in your config file to change how commit messages are generated.
default_provider- Which LLM provider to use (zai, groq)system_prompt- Custom prompt for commit message generation (see above for default behavior)providers.{name}.api_key- API key for the providerproviders.{name}.model- Model to useproviders.{name}.endpoint- API endpoint URL
For development and testing:
zig build # Development build
zig build test # Run tests
zig build run # Build and run
zig build -Doptimize=ReleaseSmall # Optimized buildzig build test# macOS ARM64
zig build -Dtarget=aarch64-macos -Doptimize=ReleaseSmall
# Linux x86_64 (static)
zig build -Dtarget=x86_64-linux-musl -Doptimize=ReleaseSmallMIT License - see LICENSE file for details
