git-commit-ai-generator
v1.0.2
Published
AI驱动的Git Commit消息自动生成工具
Maintainers
Readme
Git Commit AI Generator
🤖 AI驱动的Git Commit消息自动生成工具
功能特性
- ✨ AI智能生成commit消息,符合Conventional Commits规范
- 支持中文/English
- 🔌 支持DeepSeek、OpenAI、千问、豆包等多种AI服务
- ⚙️ 交互式配置,简单易用
快速开始
安装
npm install -g git-commit-ai-generator配置
ai-git-commit config按提示选择AI服务、输入API Key即可。
使用
git add .
ai-git-commit配置方式
优先级
环境变量 > 配置文件 (~/.ai-git-commit.json) > 默认值配置文件
编辑 ~/.ai-git-commit.json:
{
"apiKey": "sk-...",
"baseURL": "https://api.deepseek.com/v1",
"modelName": "deepseek-chat",
"temperature": 0.3,
"language": "中文"
}环境变量
在 ~/.zshrc 中添加:
export DEEPSEEK_API_KEY="sk-..."
export DEEPSEEK_BASE_URL="https://api.deepseek.com/v1"
export MODEL_NAME="deepseek-chat"AI服务配置
DeepSeek(推荐)
{
"apiKey": "sk-...",
"baseURL": "https://api.deepseek.com/v1",
"modelName": "deepseek-chat"
}获取API Key:https://platform.deepseek.com/
OpenAI
{
"apiKey": "sk-...",
"baseURL": "https://api.openai.com/v1",
"modelName": "gpt-3.5-turbo"
}通义千问
{
"apiKey": "sk-...",
"baseURL": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"modelName": "qwen-turbo"
}豆包
{
"apiKey": "...",
"baseURL": "https://ark.cn-beijing.volces.com/api/v3",
"modelName": "doubao-pro-32k"
}智谱AI
{
"apiKey": "...",
"baseURL": "https://open.bigmodel.cn/api/paas/v4",
"modelName": "glm-4"
}命令
| 命令 | 说明 |
|------|------|
| ai-git-commit | 生成并提交commit |
| ai-git-commit config | 配置向导 |
| ai-git-commit show-config | 显示配置 |
| ai-git-commit --help | 帮助信息 |
Commit消息规范
遵循 Conventional Commits 规范:
<type>(<scope>): <subject>
<body>Type类型
feat- 新功能fix- 修复bugdocs- 文档style- 格式refactor- 重构perf- 性能优化test- 测试chore- 构建/工具ci- CI配置
常见问题
未配置API Key
ai-git-commit config网络连接失败
检查网络或使用国内AI服务(千问、豆包等)
生成质量不佳
调整 temperature(0.1-0.3更稳定)或切换更好的模型
Node版本问题
需要 Node.js >= 22.0.0
node -v # 检查版本
nvm install 22 # 升级License
MIT © 2026
让AI帮你写出更专业的Commit消息! 🚀
