gcm-ai
v0.1.1
Published
AI-powered Git commit message generator following Conventional Commits
Downloads
178
Maintainers
Readme
gcm-ai
AI-powered Git commit message generator following Conventional Commits.
Reads your staged changes, sends the diff to an LLM, and generates a clean commit message. You accept, edit, or reject before anything is committed.
Install
npm install -g gcm-aiRequires Node.js 18+.
Usage
git add .
gcmFirst run triggers a one-time setup wizard. After that, just run gcm in any git repository.
$ gcm
Analyzing staged changes...
feat(auth): add JWT refresh token rotation
- Implement automatic token refresh before expiration
- Add retry logic for failed refresh attempts
? [Y] Accept [e] Edit [r] Regenerate [n] CancelSetup
Runs automatically on first use, or manually with:
gcm --setupThe wizard asks for:
- LLM provider (OpenAI or Anthropic)
- API key (stored locally, never sent anywhere except your chosen provider)
- Preferred model
- Commit message language
Configuration is saved to ~/.gcm/config.json with restricted file permissions.
Commands
| Command | Description |
|--------------------|--------------------------------------------|
| gcm | Generate commit message from staged changes|
| gcm --setup | Run or re-run the setup wizard |
| gcm --dry-run | Show message without committing |
| gcm --verbose | Print diff sent to LLM and raw response |
| gcm --provider X | Override provider for this run |
| gcm --model X | Override model for this run |
| gcm --help | Show usage information |
| gcm --version | Show version |
Supported Providers
| Provider | Default Model | Get API Key | |-----------|-------------------------------|------------------------------| | OpenAI | gpt-4o-mini | https://platform.openai.com | | Anthropic | claude-sonnet-4-20250514 | https://console.anthropic.com|
How It Works
- Runs
git diff --stagedin the current repository - Parses changed files to infer a commit scope
- Sends the diff to your configured LLM with an optimized prompt
- Presents the generated message for your approval
- Commits only when you explicitly accept
Privacy
- Your API key is stored locally in
~/.gcm/config.jsonwith file permissions0600 - No telemetry, no analytics, no tracking
- The only network request is to your chosen LLM provider
- Diff content is sent to the LLM and not stored or cached anywhere
Development
git clone https://github.com/samcab28/GCM-AI.git
cd gcm-ai
npm install
npm run build
npm test
npm link # Test the CLI locallyLicense
MIT
