pr-threads-address

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/pr-threads-address

/pr-threads-address

Usage:
/pr-threads-address [PR_NUMBER]
Description: Review all unresolved PR review threads, address them by making necessary code changes, and commit the changes appropriately.
Note: If
PR_NUMBER
is omitted, the command will automatically detect and use the PR associated with the current branch.
用法:
/pr-threads-address [PR_NUMBER]
说明: 查看所有未解决的PR评审线程,通过必要的代码修改处理这些问题,并以恰当的方式提交更改。
注意: 如果省略
PR_NUMBER
,该命令会自动检测并使用与当前分支关联的PR。

Workflow

工作流程

  1. Fetch and display all unresolved PR review threads
  2. Analyze each thread to understand the requested changes
  3. For each thread:
    1. Make the necessary code modifications
    2. (When possible) Add unit tests to verify the change
    3. Commit the changes with descriptive commit messages using conventional commit specification
  4. Report back with a summary of addressed threads
  5. Ask if the user wants to resolve the threads. If so, reply to each thread indicating what was done and then resolve the thread.
  1. 获取并显示所有未解决的PR评审线程
  2. 分析每个线程以理解所需的修改
  3. 针对每个线程:
    1. 进行必要的代码修改
    2. (如有可能)添加单元测试以验证修改
    3. 使用规范提交说明编写描述性的提交信息,提交更改
  4. 返回已处理线程的摘要
  5. 询问用户是否要解决这些线程。如果是,则回复每个线程说明已完成的操作,然后标记线程为已解决。

When to use

使用场景

Use this command when you have received PR review feedback and need to systematically address all unresolved threads before the PR can be merged.
当你收到PR评审反馈,需要在PR合并前系统地处理所有未解决的线程时,使用此命令。

Example

示例

/pr-threads-address 42
This will:
  • View unresolved threads on PR #42
  • Make code changes to address each thread
  • Create commits for the changes
  • Reply to reviewers with explanations
  • Provide a summary of all addressed items
  • Ask if you want to resolve the threads
/pr-threads-address 42
这将:
  • 查看PR #42上的未解决线程
  • 进行代码修改以处理每个线程
  • 为修改创建提交
  • 向评审者回复修改说明
  • 提供所有已处理项的摘要
  • 询问你是否要解决这些线程

Prerequisites

前提条件

Before using this command, check if the gh pr-review extension is installed:
bash
gh extension list | grep -q pr-review || gh extension install agynio/gh-pr-review
使用此命令前,请检查是否已安装gh pr-review扩展:
bash
gh extension list | grep -q pr-review || gh extension install agynio/gh-pr-review

CLI Reference

CLI参考

View PR Reviews and Comments

查看PR评审与评论

Display all reviews, inline comments, and replies for a pull request:
bash
gh pr-review review view --pr <number> --repo <owner/repo>
Common filters:
  • --reviewer <login>
    — Filter by specific reviewer
  • --states <list>
    — Filter by review state (APPROVED, CHANGES_REQUESTED, COMMENTED, DISMISSED)
  • --unresolved
    — Show only unresolved threads
  • --not_outdated
    — Exclude outdated threads
  • --tail <n>
    — Show only the last n replies per thread
  • --include-comment-node-id
    — Include GraphQL node IDs for replies
Examples:
bash
undefined
显示拉取请求的所有评审、行内评论及回复:
bash
gh pr-review review view --pr <number> --repo <owner/repo>
常用过滤器:
  • --reviewer <login>
    — 按特定评审者过滤
  • --states <list>
    — 按评审状态过滤(APPROVED、CHANGES_REQUESTED、COMMENTED、DISMISSED)
  • --unresolved
    — 仅显示未解决的线程
  • --not_outdated
    — 排除过时线程
  • --tail <n>
    — 仅显示每个线程的最后n条回复
  • --include-comment-node-id
    — 包含回复的GraphQL节点ID
示例:
bash
undefined

View all unresolved comments

查看所有未解决的评论

gh pr-review review view --pr 42 --unresolved --repo owner/repo
gh pr-review review view --pr 42 --unresolved --repo owner/repo

View comments from a specific reviewer

查看特定评审者的评论

gh pr-review review view --pr 42 --reviewer username --repo owner/repo
gh pr-review review view --pr 42 --reviewer username --repo owner/repo

View only change requests, excluding outdated threads

仅查看需要修改的请求,排除过时线程

gh pr-review review view --pr 42 --states CHANGES_REQUESTED --not_outdated --repo owner/repo
undefined
gh pr-review review view --pr 42 --states CHANGES_REQUESTED --not_outdated --repo owner/repo
undefined

Reply to Review Threads

回复评审线程

Respond to specific review comment threads:
bash
gh pr-review comments reply --thread-id <PRRT_...> --body "<reply-text>" --repo <owner/repo> --pr <number>
Multi-line replies use heredoc syntax:
bash
gh pr-review comments reply --thread-id PRRT_xyz789 --body "$(cat <<'EOF'
Fixed in commit abc123.

The changes include:
- Updated function signature
- Added error handling
- Updated tests
EOF
)" --repo owner/repo --pr 42
回复特定的评审评论线程:
bash
gh pr-review comments reply --thread-id <PRRT_...> --body "<reply-text>" --repo <owner/repo> --pr <number>
多行回复 使用heredoc语法:
bash
gh pr-review comments reply --thread-id PRRT_xyz789 --body "$(cat <<'EOF'
Fixed in commit abc123.

The changes include:
- Updated function signature
- Added error handling
- Updated tests
EOF
)" --repo owner/repo --pr 42

Resolve a Thread

解决线程

bash
gh pr-review threads resolve --thread-id <PRRT_...> --pr <number> --repo <owner/repo>
bash
gh pr-review threads resolve --thread-id <PRRT_...> --pr <number> --repo <owner/repo>

Start a Pending Review

发起待处理评审

Create a new pending review to add comments before submission:
bash
gh pr-review review --start --pr <number> --repo <owner/repo>
This returns a review ID (format:
PRR_...
) needed for adding comments.
创建新的待处理评审,以便在提交前添加评论:
bash
gh pr-review review --start --pr <number> --repo <owner/repo>
此命令会返回一个评审ID(格式:
PRR_...
),用于后续添加评论。

Add Review Comments

添加评审评论

Add inline comments to a pending review:
bash
gh pr-review review --add-comment --review-id <PRR_...> --path <file-path> --line <number> --body "<comment-text>" --repo <owner/repo>
Flags:
  • --review-id
    — Review ID from
    --start
    command (required)
  • --path
    — File path in the repository (required)
  • --line
    — Line number for the comment (required)
  • --body
    — Comment text (required)
向内联待处理评审添加行内评论:
bash
gh pr-review review --add-comment --review-id <PRR_...> --path <file-path> --line <number> --body "<comment-text>" --repo <owner/repo>
参数:
  • --review-id
    — 来自
    --start
    命令的评审ID(必填)
  • --path
    — 仓库中的文件路径(必填)
  • --line
    — 评论所在的行号(必填)
  • --body
    — 评论内容(必填)

Submit a Review

提交评审

Finalize and submit a pending review:
bash
gh pr-review review --submit --review-id <PRR_...> --event <EVENT_TYPE> --body "<summary>" --repo <owner/repo>
Event types:
  • APPROVE
    — Approve the changes
  • REQUEST_CHANGES
    — Request changes before merging
  • COMMENT
    — Submit general feedback without explicit approval
完成并提交待处理评审:
bash
gh pr-review review --submit --review-id <PRR_...> --event <EVENT_TYPE> --body "<summary>" --repo <owner/repo>
事件类型:
  • APPROVE
    — 批准修改
  • REQUEST_CHANGES
    — 要求修改后再合并
  • COMMENT
    — 提交一般性反馈,不明确批准或要求修改

Usage Notes

使用注意事项

  1. Repository Context: Always include
    --repo owner/repo
    to ensure correct repository context, or run commands from within a local clone of the repository.
  2. Thread IDs: Thread IDs (format
    PRRT_...
    ) can be obtained from
    review view --include-comment-node-id
    or
    threads list
    commands.
  3. Review IDs: Review IDs (format
    PRR_...
    ) are returned by the
    review --start
    command and must be used for adding comments to that review.
  4. State Filters: When using
    --states
    , provide a comma-separated list:
    --states APPROVED,CHANGES_REQUESTED
  5. Unresolved Focus: Use
    --unresolved --not_outdated
    together to focus on actionable comments that need attention.
  1. 仓库上下文:请始终包含
    --repo owner/repo
    以确保正确的仓库上下文,或在仓库的本地克隆目录中运行命令。
  2. 线程ID:线程ID(格式
    PRRT_...
    )可通过
    review view --include-comment-node-id
    threads list
    命令获取。
  3. 评审ID:评审ID(格式
    PRR_...
    )由
    review --start
    命令返回,必须用于向该评审添加评论。
  4. 状态过滤器:使用
    --states
    时,请提供逗号分隔的列表:
    --states APPROVED,CHANGES_REQUESTED
  5. 聚焦未解决项:同时使用
    --unresolved --not_outdated
    可聚焦于需要处理的可操作评论。