feat: 实现 Git 深度集成

参考 aider 的实现,添加 Git 深度集成功能:

- GitRepo: 封装 simple-git 的基础 Git 操作
- AutoCommitManager: 支持 immediate/batch/manual 三种自动提交模式
- MessageGenerator: 智能生成 conventional/simple/detailed 格式的 commit message
- UndoManager: 安全的 undo 机制,仅允许撤销 AI 生成的提交

主要特性:
- 文件变更后自动提交 (batch 模式默认 3 秒延迟)
- 智能检测变更类型 (feat/fix/docs/test/chore 等)
- 自动检测 scope (从文件路径推断)
- 多重安全检查的 undo 机制
- 追踪 AI 生成的提交,防止误撤销用户提交
- 与 Hook 系统集成

添加 simple-git 依赖
编写完整测试用例 (26 个测试)
This commit is contained in:
2025-12-11 23:41:51 +08:00
parent 630ce9fd4b
commit 2208179514
11 changed files with 2408 additions and 1 deletions
+1
View File
@@ -38,6 +38,7 @@
"minimatch": "^10.1.1",
"ora": "^8.1.0",
"qwen-ai-provider-v5": "^1.0.2",
"simple-git": "^3.30.0",
"tree-sitter-bash": "^0.25.1",
"uuid": "^13.0.0",
"vscode-jsonrpc": "^8.2.1",