About this project
AI Commits is a command-line tool that generates Git commit messages from your staged changes using a chosen AI provider. It is distributed on npm and requires Node.js v22 or newer.
Setup begins with a global install (`npm install -g aicommits`) followed by `aicommits setup`, which walks through provider selection, API key configuration, model selection, and preferred commit message format. Supported providers include TogetherAI, OpenAI, Groq, xAI, OpenRouter, Ollama (local), LM Studio (local), and any custom OpenAI-compatible endpoint. Configuration can also be written directly for CI/CD use via `aicommits config set`.
Typical usage is to stage files with `git add` and run `aicommits`. Unknown flags are forwarded to `git commit`. Notable CLI options include `--all` to stage tracked changes, `--clipboard` to copy the message instead of committing, `--generate` to produce multiple candidate messages, `--exclude` to omit files from analysis, `--description` to add a body, `--type` to select a format, `--prompt` for custom instructions, `--no-verify` to bypass hooks, and `--yes` to skip confirmation. An `aic` alias is provided.
Five commit message formats are available: plain, conventional, conventional+body, gitmoji, and subject+body. Custom prompts can steer language, tone, or focus. A `prepare-commit-msg` Git hook can be installed with `aicommits hook install` so normal `git commit` invocations generate a message that opens in your editor for review.
Configuration is resolved in the order: command-line arguments, environment variables, config file, then defaults. Settings include OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_MODEL, provider, locale, generate count, timeout, max-length, and type. Commands such as `aicommits config`, `aicommits config get`, `aicommits config set`, `aicommits model`, and `aicommits update` manage configuration and upgrades.
The tool reads only Git's staged snapshot, so unstaged edits are not sent to the model. The README notes that generating multiple messages consumes more tokens and therefore costs more.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.