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

+11
View File
@@ -95,3 +95,14 @@ func BuildCommitMsgPrompt(lang string) string {
%s
`, langName, exampleSummary, exampleBullet1, exampleBullet2)
}
// BuildCommitMsgPromptWithCustom 在内置 Conventional Commits 约束基础上追加用户规则。
// 保留内置约束,避免自定义提示词意外要求模型输出非法提交格式。
func BuildCommitMsgPromptWithCustom(lang, customPrompt string) string {
basePrompt := BuildCommitMsgPrompt(lang)
customPrompt = strings.TrimSpace(customPrompt)
if customPrompt == "" {
return basePrompt
}
return customPrompt + "\n\n### git-air 内置提交信息约束(必须遵守):\n" + basePrompt
}