aiden-review-pr
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMANDATORY: Use Aiden MCP Tools
强制要求:使用Aiden MCP工具
The Aiden MCP server provides GitHub tools that are ALREADY in your tool list.
They work exactly like Read, Bash, Edit — you call them as tool invocations.
They are named with the prefix .
mcp__aiden__github_Authentication is handled automatically by the MCP server. You do NOT need
GitHub tokens, gh CLI auth, SSH keys, .netrc files, environment variables, or
any credentials. The tools work immediately with zero setup.
Aiden MCP服务器提供的GitHub工具已在你的工具列表中。
它们的工作方式与Read、Bash、Edit完全相同——你可以通过工具调用的方式使用它们。
这些工具的名称均以为前缀。
mcp__aiden__github_认证由MCP服务器自动处理。 你无需
GitHub令牌、gh CLI认证、SSH密钥、.netrc文件、环境变量或
任何凭证。这些工具无需任何设置即可立即使用。
NEVER do any of the following for GitHub API access:
绝对不要为GitHub API访问执行以下操作:
- or
curlto api.github.comwget - CLI commands (gh pr, gh api, etc.)
gh - or scanning for tokens/secrets
env | grep - ,
cat ~/.netrc, orgit credentialssh -T git@github.com - Any attempt to find, construct, or configure GitHub authentication
- Installing packages or CLIs for GitHub access
If an MCP tool call fails, report the error to the user. Do NOT fall back to
CLI alternatives.
- 使用或
curl访问api.github.comwget - 使用CLI命令(如gh pr、gh api等)
gh - 使用或扫描令牌/密钥
env | grep - 使用、
cat ~/.netrc或git credentialssh -T git@github.com - 任何尝试查找、构造或配置GitHub认证的操作
- 安装用于GitHub访问的包或CLI
如果MCP工具调用失败,请向用户报告错误。不要 fallback 到
CLI替代方案。
Verify tools are available
验证工具是否可用
Before starting, confirm you can see tools in your
available tools. If they are NOT available, STOP and tell the user:
"The GitHub MCP tools are not available. Please check the sandbox MCP configuration."
mcp__aiden__github_*开始之前,请确认你能在可用工具中看到工具。如果这些工具不可用,请停止操作并告知用户:
"GitHub MCP工具不可用,请检查沙箱MCP配置。"
mcp__aiden__github_*Tool parameters
工具参数
All GitHub PR tools require these parameters:
- (string): GitHub org or username, e.g. "supatest-ai"
owner - (string): Repository name, e.g. "aiden"
repo - (integer): PR number, e.g. 42
prNumber
Example tool call:
Tool: mcp__aiden__github_get_pull_request
Parameters: { "owner": "supatest-ai", "repo": "aiden", "prNumber": 42 }所有GitHub PR工具都需要以下参数:
- (字符串):GitHub组织或用户名,例如"supatest-ai"
owner - (字符串):仓库名称,例如"aiden"
repo - (整数):PR编号,例如42
prNumber
工具调用示例:
Tool: mcp__aiden__github_get_pull_request
Parameters: { "owner": "supatest-ai", "repo": "aiden", "prNumber": 42 }Resolving owner/repo
解析owner/repo
If the user only provides a PR number, run to get
the remote URL, then parse owner and repo from it. This is the ONLY git CLI
command you should run for GitHub operations. Everything else uses MCP tools.
git remote get-url origin如果用户仅提供PR编号,请运行获取远程URL,然后从中解析owner和repo。这是你在GitHub操作中应该运行的唯一git CLI命令。其他所有操作都使用MCP工具。
git remote get-url originAvailable GitHub MCP tools
可用的GitHub MCP工具
| Tool name | Purpose |
|---|---|
| Get PR details (title, state, labels, merge status) |
| Get unified diff of a PR |
| List all comments on a PR |
| List all reviews on a PR |
| List changed files with additions/deletions |
| Get issue details |
| Get CI check run status for a ref |
| Add a comment to an issue or PR |
| Submit a review (APPROVE/REQUEST_CHANGES/COMMENT) |
| Add labels to an issue or PR |
| Merge a PR |
| Close an issue or PR |
| Request reviewers on a PR |
| 工具名称 | 用途 |
|---|---|
| 获取PR详情(标题、状态、标签、合并状态) |
| 获取PR的统一差异文件 |
| 列出PR上的所有评论 |
| 列出PR上的所有评审 |
| 列出有新增/删除内容的变更文件 |
| 获取Issue详情 |
| 获取某个引用的CI检查运行状态 |
| 向Issue或PR添加评论 |
| 提交评审(APPROVE/REQUEST_CHANGES/COMMENT) |
| 向Issue或PR添加标签 |
| 合并PR |
| 关闭Issue或PR |
| 为PR请求评审人 |
Task: Review a Pull Request
任务:审核拉取请求
Input
输入
The user will provide one of:
- A PR number (e.g. "42" or "#42")
- A PR URL (e.g. "https://github.com/owner/repo/pull/42")
- A reference like "owner/repo#42"
用户将提供以下内容之一:
- PR编号(例如"42"或"#42")
- PR URL(例如"https://github.com/owner/repo/pull/42")
- 类似"owner/repo#42"的引用
Workflow
工作流程
-
Resolve owner/repo/prNumber from the input. If only a PR number is given, runto parse owner and repo.
git remote get-url origin -
Fetch PR metadata — callwith
mcp__aiden__github_get_pull_requestto get title, description, state, labels, branches.{ owner, repo, prNumber } -
Fetch the diff — callto get the unified diff.
mcp__aiden__github_get_pr_diff -
Fetch changed files — callto see files modified/added/deleted with line counts.
mcp__aiden__github_list_pr_files -
Fetch existing reviews — callto see prior review state.
mcp__aiden__github_list_pr_reviews -
Fetch existing comments — callfor ongoing discussion context.
mcp__aiden__github_list_pr_comments -
Check CI status — callwith the head branch or SHA. If a check failed, include the html_url link so the user can view full logs (the tool does not return log output).
mcp__aiden__github_get_ci_status -
Read source files — for complex changes, use the Read tool to read full source files (not just the diff) for context.
-
Analyze — identify issues INTRODUCED by this PR only (not pre-existing). For each finding, determine: severity, file path, start/end line, title, description, and a concrete fix prompt for agents.
-
Post review — callwith inline comments (one per finding) plus a summary body. See formats below.
mcp__aiden__github_create_pr_review
-
解析owner/repo/prNumber:从输入中解析。如果仅提供PR编号,请运行来解析owner和repo。
git remote get-url origin -
获取PR元数据——调用,传入
mcp__aiden__github_get_pull_request以获取标题、描述、状态、标签、分支信息。{ owner, repo, prNumber } -
获取差异文件——调用获取统一差异文件。
mcp__aiden__github_get_pr_diff -
获取变更文件——调用查看 被修改/新增/删除的文件及其行数统计。
mcp__aiden__github_list_pr_files -
获取现有评审——调用查看 之前的评审状态。
mcp__aiden__github_list_pr_reviews -
获取现有评论——调用获取 当前讨论的上下文信息。
mcp__aiden__github_list_pr_comments -
检查CI状态——调用,传入头部分支或SHA。如果检查失败,请包含html_url链接以便用户查看完整日志(该工具不会返回日志输出)。
mcp__aiden__github_get_ci_status -
读取源文件——对于复杂变更,使用Read工具读取完整的源文件(而不仅仅是差异文件)以获取上下文。
-
分析——识别仅由本次PR引入的问题(而非预先存在的问题)。 对于每个发现的问题,确定:严重程度、文件路径、开始/结束行、标题、 描述,以及供Agent执行的具体修复提示。
-
提交评审——调用,传入内联 评论(每个问题对应一条)以及摘要正文。格式如下所示。
mcp__aiden__github_create_pr_review
Review Dimensions (priority order)
评审维度(优先级顺序)
- Security — injection, auth bypass, secrets in code, input validation
- Correctness — logic errors, null handling, async issues, race conditions
- Performance — N+1 queries, unbounded operations, memory issues
- Error Handling — silent failures, empty catch blocks, swallowed errors
- Maintainability — functions >30 lines, deep nesting, magic numbers
- Test Coverage — happy path tested? edge cases? meaningful assertions?
- 安全性——注入攻击、认证绕过、代码中的密钥、输入验证
- 正确性——逻辑错误、空值处理、异步问题、竞态条件
- 性能——N+1查询、无界操作、内存问题
- 错误处理——静默失败、空catch块、被忽略的错误
- 可维护性——函数超过30行、深层嵌套、魔术数字
- 测试覆盖率——是否测试了正常路径?边缘情况?是否有有意义的断言?
Confidence Filter
置信度筛选
Only include findings where:
- You can point to exact file + line
- You can describe a concrete scenario where it causes a real problem
- Confidence >= 80%
Skip: linter-catchable issues, speculative risks, style preferences, pre-existing problems.
仅包含符合以下条件的发现:
- 你可以指向确切的文件 + 行号
- 你可以描述一个会导致实际问题的具体场景
- 置信度 >= 80%
跳过:Linter可捕获的问题、推测性风险、风格偏好、预先存在的问题。
Inline Comment Format
内联评论格式
Each finding becomes its own inline comment on the PR. Format the of each comment like this:
bodymarkdown
<!-- aiden-review-comment {"id": "aiden_review_{prNumber}_{sequential_4digit}", "file_path": "{path}", "start_line": {start}, "end_line": {end}, "side": "RIGHT"} -->
{severity_icon} **{short_title}**
{detailed_description}
<details>
<summary>Prompt for agents</summary>
\`\`\`
{concrete_fix_instructions_an_AI_agent_can_execute — specify exact file, what to change, and how}
\`\`\`
</details>
<!-- aiden-review-badge-begin -->
<a href="{aiden_session_url}" target="_blank">
<img src="https://app.aiden-platform.com/logo.png" alt="Open in Aiden" height="20">
</a>
<!-- aiden-review-badge-end -->Severity icons:
- 🔴 = Blocking (critical bugs, security, data loss — must fix before merge)
- 🟡 = Important (real bugs/risks — should fix before merge)
- 🔵 = Nit (minor quality issues — fix if easy)
每个发现的问题都成为PR上的一条独立内联评论。每条评论的格式如下:
bodymarkdown
<!-- aiden-review-comment {"id": "aiden_review_{prNumber}_{sequential_4digit}", "file_path": "{path}", "start_line": {start}, "end_line": {end}, "side": "RIGHT"} -->
{severity_icon} **{short_title}**
{detailed_description}
<details>
<summary>Agent修复提示</summary>
\`\`\`
{concrete_fix_instructions_an_AI_agent_can_execute — specify exact file, what to change, and how}
\`\`\`
</details>
<!-- aiden-review-badge-begin -->
<a href="{aiden_session_url}" target="_blank">
<img src="https://app.aiden-platform.com/logo.png" alt="Open in Aiden" height="20">
</a>
<!-- aiden-review-badge-end -->严重程度图标:
- 🔴 = 阻塞(严重bug、安全问题、数据丢失——合并前必须修复)
- 🟡 = 重要(实际bug/风险——合并前应修复)
- 🔵 = 小问题(轻微质量问题——如果容易修复则处理)
Summary Comment Format
摘要评论格式
The parameter of the review (top-level summary) should be:
bodymarkdown
**Aiden Review** found {N} potential issues.
| Severity | Count |
|----------|-------|
| 🔴 Blocking | {X} |
| 🟡 Important | {Y} |
| 🔵 Nit | {Z} |
<details>
<summary>View all findings</summary>评审的参数(顶级摘要)应为:
bodymarkdown
**Aiden评审**发现{N}个潜在问题。
| 严重程度 | 数量 |
|----------|-------|
| 🔴 阻塞 | {X} |
| 🟡 重要 | {Y} |
| 🔵 小问题 | {Z} |
<details>
<summary>查看所有发现</summary>🔴 Blocking
🔴 阻塞
- {title} — `{file_path}:{line}` — {one_line_description}
- {title} — `{file_path}:{line}` — {one_line_description}
🟡 Important
🟡 重要
- {title} — `{file_path}:{line}` — {one_line_description}
- {title} — `{file_path}:{line}` — {one_line_description}
🔵 Nit
🔵 小问题
- {title} — `{file_path}:{line}` — {one_line_description}
Was this helpful? React with 👍 or 👎 to provide feedback.
undefined- {title} — `{file_path}:{line}` — {one_line_description}
这个评审对你有帮助吗?请用👍或👎反馈。
undefined"Open in Aiden" Badge URL
"Open in Aiden"徽章URL
Every badge links to the current Aiden session. The user/trigger will provide the
session URL. Replace in every badge with the actual URL.
{aiden_session_url}If no session URL is provided, fall back to .
https://app.aiden-platform.com每个徽章都链接到当前的Aiden会话。用户/触发器会提供会话URL。请将每个徽章中的替换为实际URL。
{aiden_session_url}如果未提供会话URL,请回退到。
https://app.aiden-platform.comPosting the Review
提交评审
Call with:
mcp__aiden__github_create_pr_review- ,
owner,repo: from step 1prNumber - : the summary comment above
body - : "REQUEST_CHANGES" if any 🔴 blocking findings, otherwise "COMMENT"
event - : array of inline comments, each with:
comments- : relative file path from repo root
path - : the end line number of the finding
line - : the formatted inline comment body above
body
IMPORTANT:
- Always post inline comments (one per finding) — do NOT bundle into one big comment
- Always include the "Prompt for agents" section in every finding
- Always include the "Open in Aiden" badge on every comment and the summary
- Replace with the actual session URL in every badge
{aiden_session_url} - If zero findings, post an approving review with a clean summary
调用时传入:
mcp__aiden__github_create_pr_review- ,
owner,repo:来自步骤1prNumber - :上述摘要评论
body - :如果有任何🔴阻塞问题,则为"REQUEST_CHANGES",否则为"COMMENT"
event - :内联评论数组,每个评论包含:
comments- :相对于仓库根目录的文件路径
path - :问题的结束行号
line - :上述格式化的内联评论正文
body
重要提示:
- 始终提交内联评论(每个问题一条)——不要合并为一条大评论
- 始终在每个问题中包含"Agent修复提示"部分
- 始终在每条评论和摘要中包含"Open in Aiden"徽章
- 将每个徽章中的替换为实际会话URL
{aiden_session_url} - 如果没有发现问题,请提交一个通过的评审并附上简洁的摘要