pr-resolution
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseResolve PR Comments in Parallel (v3)
并行处理PR评论(v3)
DEFAULT WORKFLOW for resolving PR comments with parallel execution.
默认工作流 用于通过并行执行处理PR评论。
Quick Reference
快速参考
| Action | Command |
|---|---|
| Get comments | |
| Parse CodeRabbit | |
| Check CI | |
| Resolve thread | |
| Resolve all threads | |
| 操作 | 命令 |
|---|---|
| 获取评论 | |
| 解析CodeRabbit | |
| 检查CI | |
| 处理线程 | |
| 处理所有线程 | |
Workflow Overview
工作流概述
text
Phase 0: Pre-Flight → GoodToGo status check (if installed, otherwise skip)
Phase 1: Discovery → Gather comments, parse bot formats, enumerate
Phase 2: Classification → Categorize by priority, group by file
Phase 3: Resolution → Launch parallel agents by file group
Phase 4: Verification → Local checks + GoodToGo gate (if installed)
Phase 5: Completion → Commit, push, resolve threadstext
阶段0:预检查 → GoodToGo状态检查(若已安装则执行,否则跳过)
阶段1:发现 → 收集评论、解析机器人格式、枚举整理
阶段2:分类 → 按优先级分类、按文件分组
阶段3:处理 → 按文件分组启动并行Agent
阶段4:验证 → 本地检查 + GoodToGo验证环节(若已安装)
阶段5:完成 → 提交、推送、处理所有线程Phase 0: Pre-Flight
阶段0:预检查
If is installed, run the GoodToGo pre-flight check (see ):
gtgreferences/goodtogo.mdbash
if command -v gtg &> /dev/null; then
# gtg auto-detects repo from git remote
GTG_RESULT=$(gtg $PR_NUM --format json 2>/dev/null)
GTG_STATUS=$(echo "$GTG_RESULT" | jq -r '.status')
fiRoute based on status (or skip straight to Phase 1 if is not installed):
gtg- → Quick verify and commit (fast path — skip Phases 1-3)
READY - → Fix CI first
CI_FAILING - → Continue with full workflow
ACTION_REQUIRED - → Continue with full workflow
UNRESOLVED_THREADS
若已安装,运行GoodToGo预检查(详见):
gtgreferences/goodtogo.mdbash
if command -v gtg &> /dev/null; then
# gtg 从git远程仓库自动检测项目
GTG_RESULT=$(gtg $PR_NUM --format json 2>/dev/null)
GTG_STATUS=$(echo "$GTG_RESULT" | jq -r '.status')
fi根据状态进行路由(若未安装则直接进入阶段1):
gtg- → 快速验证并提交(快速路径 — 跳过阶段1-3)
READY - → 优先修复CI问题
CI_FAILING - → 继续执行完整工作流
ACTION_REQUIRED - → 继续执行完整工作流
UNRESOLVED_THREADS
Phase 1: Discovery
阶段1:发现
- Gather comments using scripts from
references/discovery.md - Parse bot formats using rules from
references/bot-formats.md - Print enumeration - counts MUST match before proceeding
- 收集评论 使用中的脚本
references/discovery.md - 解析机器人格式 遵循中的规则
references/bot-formats.md - 打印枚举结果 - 计数必须匹配才能继续
Phase 2: Classification & Grouping
阶段2:分类与分组
- Classify each comment using
references/classification.md - Group by file for parallel execution:
markdown
undefined- 分类每条评论 使用中的规则
references/classification.md - 按文件分组 以支持并行执行:
markdown
undefinedParallel Execution Plan
并行执行计划
Group A: src/api/route.ts (3 comments → 1 agent)
分组A:src/api/route.ts(3条评论 → 1个Agent)
- #1 [blocking] Line 45 - Add error handling
- #3 [suggestion] Line 67 - Improve validation
- #1 [阻塞] 第45行 - 添加错误处理
- #3 [建议] 第67行 - 优化验证逻辑
Group B: src/components/Button.tsx (1 comment → 1 agent)
分组B:src/components/Button.tsx(1条评论 → 1个Agent)
- #2 [suggestion] Line 23 - Add prop types
- #2 [建议] 第23行 - 添加属性类型
Group C: CI Failures (if any → 1 agent)
分组C:CI失败(若存在 → 1个Agent)
- Fix lint/type errors
Total: 3 parallel agents
---- 修复lint/类型错误
总计:3个并行Agent
---Phase 3: PARALLEL EXECUTION
阶段3:并行执行
MANDATORY: Launch agents simultaneously using the Task tool:
markdown
Agent 1: "Fix comments on src/api/route.ts"
- Comment #1: Add error handling at line 45
- Comment #3: Improve validation at line 67
Agent 2: "Fix comments on src/components/Button.tsx"
- Comment #2: Add prop types at line 23
Agent 3: "Fix CI failures"
- Lint errors
- Type errorsParallel execution rules:
| Condition | Execution |
|---|---|
| Same file | → Same agent (avoid conflicts) |
| Different files | → Parallel agents |
| CI failures | → Dedicated agent |
| Questions | → Ask human first |
Wait for all agents to complete.
强制要求:使用任务工具同时启动Agent:
markdown
Agent 1: "修复src/api/route.ts上的评论"
- 评论#1:在第45行添加错误处理
- 评论#3:在第67行优化验证逻辑
Agent 2: "修复src/components/Button.tsx上的评论"
- 评论#2:在第23行添加属性类型
Agent 3: "修复CI失败问题"
- Lint错误
- 类型错误并行执行规则:
| 条件 | 执行方式 |
|---|---|
| 同一文件 | → 分配给同一个Agent(避免冲突) |
| 不同文件 | → 并行Agent处理 |
| CI失败 | → 专用Agent处理 |
| 疑问类评论 | → 先询问人工 |
等待所有Agent执行完成。
Phase 4: Verification Gate (MANDATORY)
阶段4:验证环节(强制要求)
- Run local checks from
references/verification.md - If is installed, run final verification from
gtg(deterministic READY/BLOCK signal)references/goodtogo.md - Verify all resolutions - every comment needs explicit resolution
DO NOT commit until all checks pass.
- 运行本地检查 参考
references/verification.md - 若已安装,运行
gtg中的最终验证(确定性READY/BLOCK信号)references/goodtogo.md - 验证所有处理结果 - 每条评论都需要明确的处理结果
所有检查通过前请勿提交。
Phase 5: Completion (MANDATORY — DO NOT SKIP)
阶段5:完成(强制要求 — 请勿跳过)
Follow steps from :
references/completion.md遵循中的步骤:
references/completion.md5a. Commit and push
5a. 提交并推送
- Commit all fixes together
- Push to remote
- 一次性提交所有修复
- 推送到远程仓库
5b. Post resolution summary
5b. 发布处理总结
- Post resolution summary comment to PR
- 在PR中发布处理总结评论
5c. Resolve ALL GitHub threads (MANDATORY)
5c. 处理所有GitHub线程(强制要求)
Run the resolve-all-threads script:
bash
~/.claude/skills/pr-resolution/bin/resolve-all-threads $PR_NUMThis script:
- Queries all unresolved threads on the PR
- Resolves each one via GraphQL mutation
- Verifies zero unresolved threads remain
If the script reports failures or remaining threads: DO NOT mark workflow as complete. Fix manually with .
bin/resolve-pr-thread THREAD_ID运行resolve-all-threads脚本:
bash
~/.claude/skills/pr-resolution/bin/resolve-all-threads $PR_NUM该脚本:
- 查询PR中所有未处理的线程
- 通过GraphQL变更处理每个线程
- 验证是否不存在未处理线程
若脚本报告失败或存在剩余线程:请勿标记工作流为完成。使用手动修复。
bin/resolve-pr-thread THREAD_ID5d. Final verification
5d. 最终验证
- Confirm script output shows "All threads resolved"
Workflow is NOT complete until all threads are resolved.
- 确认脚本输出显示"所有线程已处理"
所有线程处理完成前,工作流不算结束。
Example: PR with 6 Comments
示例:包含6条评论的PR
markdown
undefinedmarkdown
undefinedDiscovery
发现阶段
- [blocking] src/api/route.ts:45 - Security issue
- [suggestion] src/api/route.ts:67 - Add validation
- [suggestion] src/components/Form.tsx:23 - Add types
- [nitpick] src/utils/format.ts:12 - Typo
- [question] src/lib/auth.ts:89 - "Handle null?"
- CI: Lint error
- [阻塞] src/api/route.ts:45 - 安全问题
- [建议] src/api/route.ts:67 - 添加验证逻辑
- [建议] src/components/Form.tsx:23 - 添加类型定义
- [小问题] src/utils/format.ts:12 - 拼写错误
- [疑问] src/lib/auth.ts:89 - "是否需要处理null?"
- CI:Lint错误
Parallel Plan (after asking human about #5)
并行计划(询问人工关于#5的问题后)
- Agent 1: src/api/route.ts (#1, #2)
- Agent 2: src/components/Form.tsx (#3)
- Agent 3: src/utils/format.ts (#4)
- Agent 4: src/lib/auth.ts (#5 - if fix)
- Agent 5: CI fix (#6)
- Agent 1: src/api/route.ts(#1、#2)
- Agent 2: src/components/Form.tsx(#3)
- Agent 3: src/utils/format.ts(#4)
- Agent 4: src/lib/auth.ts(#5 - 若需要修复)
- Agent 5: CI修复(#6)
Execution
执行
Launch agents in parallel → Wait → Verify → Commit → Push
---启动并行Agent → 等待 → 验证 → 提交 → 推送
---Related
相关资源
| Resource | Description |
|---|---|
| Single-threaded detailed reference |
| Clean commit workflow |
| 资源 | 描述 |
|---|---|
| 单线程处理详细参考文档 |
| 规范提交工作流 |