feat: 拆分评审与提交消息提示词并增加 hook 备份与 JSON 输出

- 新增 custom_reviewer_prompt 和 custom_commit_msg_prompt,兼容旧 custom_prompt
- pre-commit hook 安装时备份已有 hook,卸载时恢复
- 支持 --format json 输出评审结果
- diff 发送前自动脱敏敏感信息
This commit is contained in:
unclesam committed 2026-08-23 22:31:30 +08:00
1 parent 39c58316a5
commit b04d70b99a
18 files changed
+637 -45

No files matched your search

+31 -1
View File
@@ -269,6 +269,9 @@ model: "gemini-3.7-flash"
# base_url: "https://api.deepseek.com/v1"
# Custom System Prompt (Optional)
# custom_reviewer_prompt: ""
# custom_commit_msg_prompt: ""
# Legacy compatibility field (supported throughout v1.x)
# custom_prompt: ""
# Custom Token Pricing (Optional, in USD per 1M tokens)
@@ -279,6 +282,34 @@ model: "gemini-3.7-flash"
# commit_lang: "auto"
```
### Prompt Field Migration
Older versions provided a single `custom_prompt` field. Since `git-air` supports both code review and AI commit-message generation, sharing one prompt can lead to mixed instructions and unclear behavior.
Use separate fields instead:
```yaml
custom_reviewer_prompt: "Prompt for code review"
custom_commit_msg_prompt: "Prompt for commit message generation"
```
The legacy `custom_prompt` field remains compatible for now and is treated as `custom_reviewer_prompt`.
Migration commands:
```bash
git air config set --reviewer-prompt "Your reviewer prompt"
git air config set --commit-msg-prompt "Your commit message prompt"
```
Deprecation timeline:
- `v1.x`: `custom_prompt` remains supported;
- `v1.1.0`: the field is marked deprecated and migration is recommended;
- `v2.0.0`: `custom_prompt` will be removed.
This keeps existing configurations working while making the two prompt responsibilities explicit.
---
## 📋 Custom Team Rules (`.airules`)
@@ -318,4 +349,3 @@ secrets.yaml
## 📄 License
This project is licensed under the [MIT License](LICENSE). Contributions, PRs, and issues are welcome!