aiden-review-pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

MANDATORY: 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访问执行以下操作:

  • curl
    or
    wget
    to api.github.com
  • gh
    CLI commands (gh pr, gh api, etc.)
  • env | grep
    or scanning for tokens/secrets
  • cat ~/.netrc
    ,
    git credential
    , or
    ssh -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
    wget
    访问api.github.com
  • 使用
    gh
    CLI命令(如gh pr、gh api等)
  • 使用
    env | grep
    或扫描令牌/密钥
  • 使用
    cat ~/.netrc
    git credential
    ssh -T git@github.com
  • 任何尝试查找、构造或配置GitHub认证的操作
  • 安装用于GitHub访问的包或CLI
如果MCP工具调用失败,请向用户报告错误。不要 fallback 到 CLI替代方案。

Verify tools are available

验证工具是否可用

Before starting, confirm you can see
mcp__aiden__github_*
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配置。"

Tool parameters

工具参数

All GitHub PR tools require these parameters:
  • owner
    (string): GitHub org or username, e.g. "supatest-ai"
  • repo
    (string): Repository name, e.g. "aiden"
  • prNumber
    (integer): PR number, e.g. 42
Example tool call:
Tool: mcp__aiden__github_get_pull_request
Parameters: { "owner": "supatest-ai", "repo": "aiden", "prNumber": 42 }
所有GitHub PR工具都需要以下参数:
  • owner
    (字符串):GitHub组织或用户名,例如"supatest-ai"
  • repo
    (字符串):仓库名称,例如"aiden"
  • prNumber
    (整数):PR编号,例如42
工具调用示例:
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
git remote get-url origin
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.
如果用户仅提供PR编号,请运行
git remote get-url origin
获取远程URL,然后从中解析owner和repo。这是你在GitHub操作中应该运行的唯一git CLI命令。其他所有操作都使用MCP工具。

Available GitHub MCP tools

可用的GitHub MCP工具

Tool namePurpose
mcp__aiden__github_get_pull_request
Get PR details (title, state, labels, merge status)
mcp__aiden__github_get_pr_diff
Get unified diff of a PR
mcp__aiden__github_list_pr_comments
List all comments on a PR
mcp__aiden__github_list_pr_reviews
List all reviews on a PR
mcp__aiden__github_list_pr_files
List changed files with additions/deletions
mcp__aiden__github_get_issue
Get issue details
mcp__aiden__github_get_ci_status
Get CI check run status for a ref
mcp__aiden__github_add_comment
Add a comment to an issue or PR
mcp__aiden__github_create_pr_review
Submit a review (APPROVE/REQUEST_CHANGES/COMMENT)
mcp__aiden__github_add_labels
Add labels to an issue or PR
mcp__aiden__github_merge_pull_request
Merge a PR
mcp__aiden__github_close_issue
Close an issue or PR
mcp__aiden__github_request_reviewers
Request reviewers on a PR

工具名称用途
mcp__aiden__github_get_pull_request
获取PR详情(标题、状态、标签、合并状态)
mcp__aiden__github_get_pr_diff
获取PR的统一差异文件
mcp__aiden__github_list_pr_comments
列出PR上的所有评论
mcp__aiden__github_list_pr_reviews
列出PR上的所有评审
mcp__aiden__github_list_pr_files
列出有新增/删除内容的变更文件
mcp__aiden__github_get_issue
获取Issue详情
mcp__aiden__github_get_ci_status
获取某个引用的CI检查运行状态
mcp__aiden__github_add_comment
向Issue或PR添加评论
mcp__aiden__github_create_pr_review
提交评审(APPROVE/REQUEST_CHANGES/COMMENT)
mcp__aiden__github_add_labels
向Issue或PR添加标签
mcp__aiden__github_merge_pull_request
合并PR
mcp__aiden__github_close_issue
关闭Issue或PR
mcp__aiden__github_request_reviewers
为PR请求评审人

Task: Review a Pull Request

任务:审核拉取请求

Input

输入

The user will provide one of:
用户将提供以下内容之一:

Workflow

工作流程

  1. Resolve owner/repo/prNumber from the input. If only a PR number is given, run
    git remote get-url origin
    to parse owner and repo.
  2. Fetch PR metadata — call
    mcp__aiden__github_get_pull_request
    with
    { owner, repo, prNumber }
    to get title, description, state, labels, branches.
  3. Fetch the diff — call
    mcp__aiden__github_get_pr_diff
    to get the unified diff.
  4. Fetch changed files — call
    mcp__aiden__github_list_pr_files
    to see files modified/added/deleted with line counts.
  5. Fetch existing reviews — call
    mcp__aiden__github_list_pr_reviews
    to see prior review state.
  6. Fetch existing comments — call
    mcp__aiden__github_list_pr_comments
    for ongoing discussion context.
  7. Check CI status — call
    mcp__aiden__github_get_ci_status
    with 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).
  8. Read source files — for complex changes, use the Read tool to read full source files (not just the diff) for context.
  9. 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.
  10. Post review — call
    mcp__aiden__github_create_pr_review
    with inline comments (one per finding) plus a summary body. See formats below.
  1. 解析owner/repo/prNumber:从输入中解析。如果仅提供PR编号,请运行
    git remote get-url origin
    来解析owner和repo。
  2. 获取PR元数据——调用
    mcp__aiden__github_get_pull_request
    ,传入
    { owner, repo, prNumber }
    以获取标题、描述、状态、标签、分支信息。
  3. 获取差异文件——调用
    mcp__aiden__github_get_pr_diff
    获取统一差异文件。
  4. 获取变更文件——调用
    mcp__aiden__github_list_pr_files
    查看 被修改/新增/删除的文件及其行数统计。
  5. 获取现有评审——调用
    mcp__aiden__github_list_pr_reviews
    查看 之前的评审状态。
  6. 获取现有评论——调用
    mcp__aiden__github_list_pr_comments
    获取 当前讨论的上下文信息。
  7. 检查CI状态——调用
    mcp__aiden__github_get_ci_status
    ,传入头部分支或SHA。如果检查失败,请包含html_url链接以便用户查看完整日志(该工具不会返回日志输出)。
  8. 读取源文件——对于复杂变更,使用Read工具读取完整的源文件(而不仅仅是差异文件)以获取上下文。
  9. 分析——识别仅由本次PR引入的问题(而非预先存在的问题)。 对于每个发现的问题,确定:严重程度、文件路径、开始/结束行、标题、 描述,以及供Agent执行的具体修复提示。
  10. 提交评审——调用
    mcp__aiden__github_create_pr_review
    ,传入内联 评论(每个问题对应一条)以及摘要正文。格式如下所示。

Review Dimensions (priority order)

评审维度(优先级顺序)

  1. Security — injection, auth bypass, secrets in code, input validation
  2. Correctness — logic errors, null handling, async issues, race conditions
  3. Performance — N+1 queries, unbounded operations, memory issues
  4. Error Handling — silent failures, empty catch blocks, swallowed errors
  5. Maintainability — functions >30 lines, deep nesting, magic numbers
  6. Test Coverage — happy path tested? edge cases? meaningful assertions?
  1. 安全性——注入攻击、认证绕过、代码中的密钥、输入验证
  2. 正确性——逻辑错误、空值处理、异步问题、竞态条件
  3. 性能——N+1查询、无界操作、内存问题
  4. 错误处理——静默失败、空catch块、被忽略的错误
  5. 可维护性——函数超过30行、深层嵌套、魔术数字
  6. 测试覆盖率——是否测试了正常路径?边缘情况?是否有有意义的断言?

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
body
of each comment like this:
markdown
<!-- 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上的一条独立内联评论。每条评论的
body
格式如下:
markdown
<!-- 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
body
parameter of the review (top-level summary) should be:
markdown
**Aiden Review** found {N} potential issues.

| Severity | Count |
|----------|-------|
| 🔴 Blocking | {X} |
| 🟡 Important | {Y} |
| 🔵 Nit | {Z} |

<details>
<summary>View all findings</summary>
评审的
body
参数(顶级摘要)应为:
markdown
**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}
</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 -->
Was this helpful? React with 👍 or 👎 to provide feedback.
undefined
  • {title} — `{file_path}:{line}` — {one_line_description}
</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 -->
这个评审对你有帮助吗?请用👍或👎反馈。
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
{aiden_session_url}
in every badge with the actual URL.
If no session URL is provided, fall back to
https://app.aiden-platform.com
.
每个徽章都链接到当前的Aiden会话。用户/触发器会提供会话URL。请将每个徽章中的
{aiden_session_url}
替换为实际URL。
如果未提供会话URL,请回退到
https://app.aiden-platform.com

Posting the Review

提交评审

Call
mcp__aiden__github_create_pr_review
with:
  • owner
    ,
    repo
    ,
    prNumber
    : from step 1
  • body
    : the summary comment above
  • event
    : "REQUEST_CHANGES" if any 🔴 blocking findings, otherwise "COMMENT"
  • comments
    : array of inline comments, each with:
    • path
      : relative file path from repo root
    • line
      : the end line number of the finding
    • body
      : the formatted inline comment body above
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
    {aiden_session_url}
    with the actual session URL in every badge
  • If zero findings, post an approving review with a clean summary
调用
mcp__aiden__github_create_pr_review
时传入:
  • owner
    ,
    repo
    ,
    prNumber
    :来自步骤1
  • body
    :上述摘要评论
  • event
    :如果有任何🔴阻塞问题,则为"REQUEST_CHANGES",否则为"COMMENT"
  • comments
    :内联评论数组,每个评论包含:
    • path
      :相对于仓库根目录的文件路径
    • line
      :问题的结束行号
    • body
      :上述格式化的内联评论正文
重要提示:
  • 始终提交内联评论(每个问题一条)——不要合并为一条大评论
  • 始终在每个问题中包含"Agent修复提示"部分
  • 始终在每条评论和摘要中包含"Open in Aiden"徽章
  • 将每个徽章中的
    {aiden_session_url}
    替换为实际会话URL
  • 如果没有发现问题,请提交一个通过的评审并附上简洁的摘要