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 is omitted, the command will automatically detect and use the PR associated with the current branch.
PR_NUMBER用法:
/pr-threads-address [PR_NUMBER]说明: 查看所有未解决的PR评审线程,通过必要的代码修改处理这些问题,并以恰当的方式提交更改。
注意: 如果省略,该命令会自动检测并使用与当前分支关联的PR。
PR_NUMBERWorkflow
工作流程
- Fetch and display all unresolved PR review threads
- Analyze each thread to understand the requested changes
- For each thread:
- Make the necessary code modifications
- (When possible) Add unit tests to verify the change
- Commit the changes with descriptive commit messages using conventional commit specification
- Report back with a summary of addressed threads
- Ask if the user wants to resolve the threads. If so, reply to each thread indicating what was done and then resolve the thread.
- 获取并显示所有未解决的PR评审线程
- 分析每个线程以理解所需的修改
- 针对每个线程:
- 进行必要的代码修改
- (如有可能)添加单元测试以验证修改
- 使用规范提交说明编写描述性的提交信息,提交更改
- 返回已处理线程的摘要
- 询问用户是否要解决这些线程。如果是,则回复每个线程说明已完成的操作,然后标记线程为已解决。
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 42This 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-reviewCLI 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:
- — Filter by specific reviewer
--reviewer <login> - — Filter by review state (APPROVED, CHANGES_REQUESTED, COMMENTED, DISMISSED)
--states <list> - — Show only unresolved threads
--unresolved - — Exclude outdated threads
--not_outdated - — Show only the last n replies per thread
--tail <n> - — Include GraphQL node IDs for replies
--include-comment-node-id
Examples:
bash
undefined显示拉取请求的所有评审、行内评论及回复:
bash
gh pr-review review view --pr <number> --repo <owner/repo>常用过滤器:
- — 按特定评审者过滤
--reviewer <login> - — 按评审状态过滤(APPROVED、CHANGES_REQUESTED、COMMENTED、DISMISSED)
--states <list> - — 仅显示未解决的线程
--unresolved - — 排除过时线程
--not_outdated - — 仅显示每个线程的最后n条回复
--tail <n> - — 包含回复的GraphQL节点ID
--include-comment-node-id
示例:
bash
undefinedView 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
undefinedgh pr-review review view --pr 42 --states CHANGES_REQUESTED --not_outdated --repo owner/repo
undefinedReply 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 42Resolve 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: ) needed for adding comments.
PRR_...创建新的待处理评审,以便在提交前添加评论:
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 from
--review-idcommand (required)--start - — File path in the repository (required)
--path - — Line number for the comment (required)
--line - — Comment text (required)
--body
向内联待处理评审添加行内评论:
bash
gh pr-review review --add-comment --review-id <PRR_...> --path <file-path> --line <number> --body "<comment-text>" --repo <owner/repo>参数:
- — 来自
--review-id命令的评审ID(必填)--start - — 仓库中的文件路径(必填)
--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 the changes
APPROVE - — Request changes before merging
REQUEST_CHANGES - — Submit general feedback without explicit approval
COMMENT
完成并提交待处理评审:
bash
gh pr-review review --submit --review-id <PRR_...> --event <EVENT_TYPE> --body "<summary>" --repo <owner/repo>事件类型:
- — 批准修改
APPROVE - — 要求修改后再合并
REQUEST_CHANGES - — 提交一般性反馈,不明确批准或要求修改
COMMENT
Usage Notes
使用注意事项
-
Repository Context: Always includeto ensure correct repository context, or run commands from within a local clone of the repository.
--repo owner/repo -
Thread IDs: Thread IDs (format) can be obtained from
PRRT_...orreview view --include-comment-node-idcommands.threads list -
Review IDs: Review IDs (format) are returned by the
PRR_...command and must be used for adding comments to that review.review --start -
State Filters: When using, provide a comma-separated list:
--states--states APPROVED,CHANGES_REQUESTED -
Unresolved Focus: Usetogether to focus on actionable comments that need attention.
--unresolved --not_outdated
-
仓库上下文:请始终包含以确保正确的仓库上下文,或在仓库的本地克隆目录中运行命令。
--repo owner/repo -
线程ID:线程ID(格式)可通过
PRRT_...或review view --include-comment-node-id命令获取。threads list -
评审ID:评审ID(格式)由
PRR_...命令返回,必须用于向该评审添加评论。review --start -
状态过滤器:使用时,请提供逗号分隔的列表:
--states--states APPROVED,CHANGES_REQUESTED -
聚焦未解决项:同时使用可聚焦于需要处理的可操作评论。
--unresolved --not_outdated