autocommit-forge
v0.5.40
Published
AI-powered git commit generator with single-entry quick mode and preview confirmation
Downloads
5,411
Readme
AutoCommit Forge
Generate clear Git commit messages from your staged changes using the AI provider you choose.
AutoCommit Forge reads git diff --cached, applies your saved rules and style preferences, generates one commit message, and lets you accept or regenerate it before committing.
Features
- Generate commit messages from staged Git changes.
- Preview, accept, or regenerate suggestions before committing.
- Use Conventional Commits automatically.
- Choose a tone: neutral, casual, formal, funny, professional, or direct.
- Add matching emojis for Conventional Commit types.
- Match your existing commit-message style using examples.
- Add custom rules for your project or team.
- Limit generated message length.
- Install a Git
prepare-commit-msghook. - Use hosted AI providers or fully local Ollama models.
- Connect to an Ollama server running on another machine in your LAN.
Installation
Install AutoCommit Forge globally:
npm install -g autocommit-forge@latestConfirm that it is available:
autocommit-forge --helpFor local development from source:
npm install
npm run build
npm linkQuick Start
1. Setup the CLI (only needed once to configure your provider, model, and rules):
autocommit-forge setup2. Navigate to your project folder:
cd your-project3. Stage the files you want to commit:
git add src/index.ts4. Generate the commit message:
autocommit-forge generateBasic Workflow
1. Stage your changes
AutoCommit Forge only reads staged changes. You can stage files using the command line:
git add src/index.tsUsing a Git GUI? You can easily use third-party Git programs like Sourcetree, Fork, GitKraken, or VS Code. Simply select and stage your files using the GUI. Once the files are staged, open a terminal in that project folder and run:
autocommit-forge generate2. Generate a message
autocommit-forge generate3. Review the result
feat: add user validation
? Are you happy with this commit message, or would you like to regenerate it?
❯ Yes, use this message
No, regenerate a different messageAfter acceptance, AutoCommit Forge creates the Git commit using the selected message.
Commit Message Examples
The generated message depends on the staged diff, provider, model, tone, and configured rules.
Conventional Commits
feat: add user authenticationfix: prevent duplicate form submissionsdocs: update installation instructionsrefactor(api): simplify request validationtest: add coverage for authentication flowchore: update development dependenciesWith fixed emojis
When emoji support is enabled, AutoCommit Forge adds an emoji based on the detected Conventional Commit type.
✨ feat: add user authentication🐛 fix: prevent duplicate form submissions📚 docs: update installation instructions♻️ refactor(api): simplify request validation🚨 test: add coverage for authentication flowCommands
| Command | Description |
| --- | --- |
| autocommit-forge | Quick mode: generate, review, and commit using saved configuration |
| autocommit-forge setup | Configure provider, model, tone, rules, and defaults |
| autocommit-forge generate | Generate a commit message from staged changes |
| autocommit-forge install-hook | Install a prepare-commit-msg Git hook in the current repository |
Generate Options
Preview without committing
Generate and review a message while keeping changes staged:
autocommit-forge generate --no-commitSkip the confirmation prompt
Generate and commit immediately:
autocommit-forge generate --autoUse this only when you trust the active provider, model, and configuration.
Override tone
autocommit-forge generate --tone formalAvailable tones:
neutral
casual
formal
funny
professional
directEnable emojis for one run
autocommit-forge generate --with-emotesMatch existing commit style
Provide two examples from your repository or team convention:
autocommit-forge generate \
--example-1 "feat(auth): add passkey login" \
--example-2 "fix(api): handle empty response"AutoCommit Forge uses them as style guidance while keeping the generated message grounded in the staged diff.
AI Providers
AutoCommit Forge supports the following providers:
| Provider | API key required | Notes |
| --- | ---: | --- |
| perplexity-agent | Yes | Perplexity Agent API |
| perplexity | Yes | Legacy Perplexity Sonar API |
| openai | Yes | OpenAI-compatible chat completion API |
| anthropic | Yes | Anthropic Messages API |
| openrouter | Yes | OpenRouter chat completion API |
| ollama | No | Fully local or LAN-hosted models |
Run the setup wizard to select a provider and model:
autocommit-forge setupOllama
Ollama lets you generate commit messages with local models and no cloud API key.
Local Ollama
Install and start Ollama, then pull a model:
ollama pull llama3.1
ollama run llama3.1 "Say hello"Run setup and select ollama as the provider:
autocommit-forge setupUse the default host when Ollama runs on the same machine:
http://localhost:11434Ollama on another LAN machine
If Ollama runs on another machine in your trusted local network, expose the Ollama server on that machine and use its LAN IP address during setup:
http://192.168.0.221:11434AutoCommit Forge stores the chat endpoint automatically:
http://192.168.0.221:11434/api/chatFor security, do not expose an unauthenticated Ollama API directly to the public internet.
Git Hook
Install the hook from inside the repository where you want automatic commit-message generation:
cd your-project
autocommit-forge install-hookThen create a normal Git commit:
git add .
git commitThe prepare-commit-msg hook generates and writes a commit message automatically.
Environment Variables
Use these variables for temporary overrides or scripts:
export AUTOCOMMIT_TONE=casual
export AUTOCOMMIT_FORGE_AUTO=1Then run:
autocommit-forge generate| Variable | Description |
| --- | --- |
| AUTOCOMMIT_TONE | Override the configured tone |
| AUTOCOMMIT_FORGE_AUTO=1 | Skip the accept/regenerate prompt |
| AUTOCOMMIT_FORGE_DEBUG=1 | Print Perplexity request and response debug output |
Troubleshooting
No staged changes found
Stage files before generating a commit message:
git add .
autocommit-forge generateMissing configuration
Run the setup wizard:
autocommit-forge setupOllama cannot be reached
First verify that Ollama is available:
curl http://localhost:11434/api/tagsFor a LAN-hosted Ollama instance, replace localhost with the server IP address:
curl http://192.168.0.221:11434/api/tagsCheck the installed version
autocommit-forge --versionSupport
After every 15 successful uses, AutoCommit Forge may show a support message.
If the project helps you, consider buying me a coffee:
