Skip to content
| Marketplace
Sign in
Visual Studio Code>AI>Git 智能代码审查助手New to Visual Studio Code? Get it now.
Git 智能代码审查助手

Git 智能代码审查助手

Matrixport App

|
24 installs
| (1) | Free
基于 AI 自动分析 Git 工作区代码变更,在提交前发现 Bug 并提供优化建议,提升代码质量。
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Git 智能代码审查助手 (Git AI Reviewer)

基于 AI 的 VS Code 代码审查插件。自动分析 Git 暂存区 (Staged) 的代码变更,在提交前发现 Bug、安全隐患并提供优化建议,支持一键采纳修复。

✨ 核心特性

  • 🤖 智能审查:支持 GPT-4o、Claude 3.5 Sonnet 等 OpenAI 兼容 API
  • 🎯 精准定位:仅审查 Git 暂存区变更,避免无效 Token 消耗
  • 💬 行内评论:审查意见以 VS Code 原生评论形式展示在代码行间
  • ⚡️ 一键修复:点击 Apply Fix 按钮即可采纳 AI 修复建议
  • 🛡️ 安全隐私:内置敏感信息扫描,防止 API Key 等泄露
  • 📚 RAG 增强:支持 Clotho + Confluence 双知识源,提供项目规范上下文

🚀 快速开始

  1. 在 VS Code 扩展市场搜索 Git AI Reviewer 或安装 .vsix 包
  2. 配置 API Key(见下文)
  3. 点击 SCM 面板的机器人图标启动审查

⚙️ 配置说明

配置文件位置

配置文件 路径 用途 提交到 Git
项目配置 .git-ai-reviewer.yaml 项目规则、忽略列表 ✅ 团队共享
全局配置 ~/git-ai-config.yaml API Key、敏感信息 ❌ 个人私有

全局配置 (~/git-ai-config.yaml)

存放敏感信息,不提交到 Git:

# API 配置
baseUrl: "https://api.openai.com/v1"
apiKey: "sk-..."
model: "gpt-4o"

# Clotho RAG (可选,优先级高)
clotho:
  enabled: true
  baseUrl: "http://localhost:8001/mcp"
  timeout: 30000

# Confluence (可选,优先级低)
confluence:
  enabled: true
  baseUrl: "https://company.atlassian.net"
  username: "email@company.com"
  apiToken: "${CONFLUENCE_API_TOKEN}"
  parentPageId: "123456789"
  cacheExpiry: 86400

项目配置 (.git-ai-reviewer.yaml)

存放项目规则,提交到 Git 与团队共享:

systemPrompt: |
  你是 Flutter 代码审查员,关注内存泄漏和命名规范。

ignore:
  - "**/*.g.dart"
  - "assets/**"

maxFileLineSize: 2000
concurrency: 5

配置项详解

基础配置

字段 类型 默认值 说明
baseUrl string https://api.openai.com/v1 LLM API 地址
apiKey string "" API Key
model string claude-3-5-sonnet-20240620 模型名称
systemPrompt string (内置) 自定义 System Prompt
maxFileLineSize number 1000 单文件最大行数
timeout number 60000 AI 请求超时 (ms)
concurrency number 5 审查并发数
ignore string[] (内置) Glob 忽略列表
sensitivePatterns string[] (内置) 敏感信息正则
debug boolean false 调试模式,生成 llm_prompt_debug.txt

Clotho RAG 配置

使用向量数据库进行语义搜索,获取相关规范和代码示例。

字段 类型 默认值 说明
clotho.enabled boolean false 是否启用
clotho.baseUrl string http://localhost:8001/mcp MCP 服务地址
clotho.timeout number 30000 请求超时 (ms)

Confluence 配置

从 Confluence 同步团队共享的审查规范。

字段 类型 默认值 说明
confluence.enabled boolean false 是否启用
confluence.baseUrl string - Confluence 地址
confluence.username string - 账号邮箱
confluence.apiToken string - API Token(支持 ${ENV})
confluence.parentPageId string - 规范文档父页面 ID
confluence.cacheExpiry number 86400 缓存有效期 (秒)
confluence.cacheDir string ~/.git-ai-reviewer/cache 缓存目录

提示:Clotho 和 Confluence 可同时启用,优先使用 Clotho,Confluence 作为回退。


📖 使用指南

启动审查

  1. 修改代码并执行 git add 将文件加入暂存区
  2. 点击 源代码管理 (SCM) 面板标题栏的 机器人图标
  3. 或使用命令面板 (Cmd+Shift+P) 运行 Git AI Reviewer: Start AI Review

查看结果

  • 审查完成后自动打开相关文件
  • 审查意见以评论 (Comment) 形式挂载在代码行上

交互操作

按钮 说明
✅ Apply Fix 采纳修复建议,自动修改代码
❌ Dismiss 忽略建议,移除评论
⬆️⬇️ Prev/Next 在多条建议之间跳转

清除评论

使用命令面板 (Cmd+Shift+P) 运行:

命令 说明
Git AI Reviewer: Clear AI Comments (Current File) 清除当前文件的所有评论
Git AI Reviewer: Clear All AI Comments (Workspace) 清除所有文件的评论

⚠️ 常见问题

Q: 点击审查没有反应?
A: 请确保暂存区有文件变更(git status)。被 ignore 规则命中或超过行数限制的文件会被跳过。

Q: 如何忽略某些文件?
A: 在 .git-ai-reviewer.yaml 的 ignore 字段添加 Glob 规则。默认已忽略 node_modules、lock 文件等。

Q: Clotho 和 Confluence 有什么区别?
A: Clotho 使用向量数据库进行语义搜索,更智能;Confluence 直接同步文档。两者可同时启用,Clotho 优先,Confluence 作为回退。


License: MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft