@mazhu/git-ai
v1.0.0
Published
AI-powered Git assistant — auto commit messages, PR descriptions, code reviews & changelogs
Maintainers
Readme
git-ai 🤖
AI-powered Git assistant — auto commit messages, PR descriptions, code reviews & changelogs.
Features
git-ai commit— Generate commit messages from staged diffgit-ai pr— Generate PR descriptions from branch changesgit-ai review— AI-powered code review with severity ratingsgit-ai summary— Weekly/monthly code change summaries- Zero runtime dependencies — Only you and the AI
- OpenAI & Claude — Bring your own API key
- Conventional Commits — Optional conventional format
- Multilingual — English and Chinese output
Install
npm install -g @mazhu/git-aiQuick Start
# Configure your API key
git-ai config --api-key=sk-xxx
# Generate & commit
git add .
git-ai commit
# Preview without committing
git-ai commit --dry-run
# Conventional Commits format
git-ai commit --conventionalCommands
git-ai commit
Generate a commit message from your staged changes.
git add .
git-ai commit # generate and commit
git-ai commit --dry-run # preview only
git-ai commit -c # conventional commits formatgit-ai pr
Generate a PR description from your branch changes.
git-ai pr # auto-detect base branch
git-ai pr --base develop # specify base branchgit-ai review
AI-powered code review of your branch changes.
git-ai review # review against default branch
git-ai review --base main # specify base branchgit-ai summary
Generate a weekly or monthly summary of code changes.
git-ai summary # weekly (default)
git-ai summary --week # weekly
git-ai summary --month # monthlygit-ai config
Manage your configuration.
git-ai config --api-key=sk-xxx # set API key
git-ai config --provider=claude # use Claude
git-ai config --model=claude-sonnet-4-20250514 # set model
git-ai config --language=zh # Chinese output
git-ai config --api-base=https://api.groq.com/openai/v1 # custom endpoint
git-ai config --show # show config
git-ai config --reset # reset configConfiguration
Config is stored in ~/.git-ai/config.json.
| Option | Default | Description |
|--------|---------|-------------|
| apiKey | — | Your API key (required) |
| provider | openai | openai or claude |
| model | gpt-4o-mini | Model name |
| apiBase | https://api.openai.com/v1 | API base URL |
| language | en | Output language (en or zh) |
Using with OpenAI-compatible APIs
Works with any OpenAI-compatible API:
# Groq
git-ai config --api-base=https://api.groq.com/openai/v1 --model=llama-3-70b
# Together AI
git-ai config --api-base=https://api.together.xyz/v1 --model=meta-llama/Llama-3-70b-chat-hf
# Local (Ollama, LM Studio, etc.)
git-ai config --api-base=http://localhost:11434/v1 --model=llama3Using with Claude
git-ai config --provider=claude --model=claude-sonnet-4-20250514 --api-key=sk-ant-xxxHow It Works
- Reads your git diff/commits
- Sends to your configured AI model
- Returns structured, actionable output
- For commits: directly creates the git commit
Why Zero Dependencies?
Because your commit tool shouldn't bring in 500 sub-dependencies. git-ai uses only Node.js built-in modules (https, child_process, fs, path, os) to call the AI API.
License
MIT © mazhu
