triage-pr-reviews

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Triage PR Review Comments

分类处理PR评审评论

  1. Run
    gh pr-reviews [arg] --json
    to get unresolved review comments as JSON. If no argument is given, use the current branch's PR. Note: this command uses Copilot for classification and may take a while depending on the number of comments — use a longer timeout. Each JSON object contains:
    • comment_id
      (int): REST API comment ID — usable for replying via
      gh api
    • thread_id
      (string, only for
      type: "thread"
      ): inline review thread ID
    • type
      :
      "thread"
      (inline review) or
      "comment"
      (PR-level)
    • author
      ,
      body
      ,
      url
      : comment metadata
    • commit_id
      ,
      path
      ,
      line
      ,
      diff_hunk
      (only for
      type: "thread"
      ): file location and diff context
    • category
      : one of
      suggestion
      ,
      nitpick
      ,
      issue
      ,
      question
      ,
      approval
      ,
      informational
    • resolved
      (bool),
      reason
      (string): resolution status and rationale
  2. Check if PR metadata (number, title, url) is already available from conversation context. If not (e.g., when a PR number/URL is explicitly passed as argument), run
    gh pr view [arg] --json number,title,url
    to get it.
  3. For
    type: "thread"
    comments, use
    path
    ,
    line
    , and
    diff_hunk
    from the JSON response to identify the exact file location. For
    type: "comment"
    (PR-level), there is no file location.
  4. Check code context for each comment. Leverage any existing conversation context first. Only fetch additional context via
    gh pr diff
    or file reads when necessary.
  5. Evaluate each comment against the code context. Classify as Agree, Partially Agree, or Disagree with a rationale and suggested action.
  6. Output results in this format:
undefined
  1. 运行
    gh pr-reviews [arg] --json
    以JSON格式获取未解决的评审评论。如果未传入参数,默认使用当前分支对应的PR。注意:该命令使用Copilot进行分类,耗时取决于评论数量,请设置更长的超时时间。每个JSON对象包含:
    • comment_id
      (int):REST API评论ID,可用于通过
      gh api
      回复评论
    • thread_id
      (字符串,仅
      type: "thread"
      时存在):行内评审线程ID
    • type
      "thread"
      (行内评审)或
      "comment"
      (PR层级评论)
    • author
      ,
      body
      ,
      url
      :评论元数据
    • commit_id
      ,
      path
      ,
      line
      ,
      diff_hunk
      (仅
      type: "thread"
      时存在):文件位置和diff上下文
    • category
      :取值为
      suggestion
      nitpick
      issue
      question
      approval
      informational
      其中之一
    • resolved
      (布尔值),
      reason
      (字符串):解决状态和理由
  2. 检查对话上下文中是否已存在PR元数据(编号、标题、url)。如果不存在(例如用户显式传入PR编号/URL作为参数),运行
    gh pr view [arg] --json number,title,url
    获取相关数据。
  3. 对于
    type: "thread"
    类型的评论,使用JSON返回结果中的
    path
    line
    diff_hunk
    确定精准的文件位置。对于
    type: "comment"
    (PR层级)的评论,没有对应的文件位置。
  4. 检查每条评论对应的代码上下文。优先利用已有的对话上下文,仅在必要时通过
    gh pr diff
    或读取文件获取额外上下文。
  5. 结合代码上下文评估每条评论,将其分类为同意部分同意不同意,并给出理由和建议操作。
  6. 按照以下格式输出结果:
undefined

Unresolved Review Comments Analysis

Unresolved Review Comments Analysis

PR: #<number> (<title>) Unresolved comments: <count>

PR: #<number> (<title>) Unresolved comments: <count>

Comment 1 — [<category>] by @<author>

Comment 1 — [<category>] by @<author>

<comment body>
File:
<path>
(line <line>) Assessment: Agree | Partially Agree | Disagree Rationale: <1-3 sentences> Suggested action: <recommended action>

<comment body>
File:
<path>
(line <line>) Assessment: Agree | Partially Agree | Disagree Rationale: <1-3 sentences> Suggested action: <recommended action>

Summary

Summary

  • Agree: n — should be addressed
  • Partially Agree: n — worth discussing
  • Disagree: n — can be explained or dismissed

Do NOT write to GitHub (no commenting, resolving, or any mutations). Do NOT commit or push. If code context is unclear, search the codebase to verify before making a judgment. Prefer `gh` commands for GitHub data.
  • Agree: n — should be addressed
  • Partially Agree: n — worth discussing
  • Disagree: n — can be explained or dismissed

请勿向GitHub写入数据(不要发表评论、标记评论已解决或执行任何变更操作)。请勿提交或推送代码。如果代码上下文不明确,请先检索代码库核实后再做出判断。优先使用`gh`命令获取GitHub数据。