pr-resolution

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Resolve PR Comments in Parallel (v3)

并行处理PR评论(v3)

DEFAULT WORKFLOW for resolving PR comments with parallel execution.
默认工作流 用于通过并行执行处理PR评论。

Quick Reference

快速参考

ActionCommand
Get comments
~/.claude/skills/pr-resolution/bin/get-pr-comments PR_NUM
Parse CodeRabbit
~/.claude/skills/pr-resolution/bin/parse-coderabbit-review PR_NUM
Check CI
gh pr checks
Resolve thread
~/.claude/skills/pr-resolution/bin/resolve-pr-thread NODE_ID
Resolve all threads
~/.claude/skills/pr-resolution/bin/resolve-all-threads PR_NUM
操作命令
获取评论
~/.claude/skills/pr-resolution/bin/get-pr-comments PR_NUM
解析CodeRabbit
~/.claude/skills/pr-resolution/bin/parse-coderabbit-review PR_NUM
检查CI
gh pr checks
处理线程
~/.claude/skills/pr-resolution/bin/resolve-pr-thread NODE_ID
处理所有线程
~/.claude/skills/pr-resolution/bin/resolve-all-threads PR_NUM

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 threads

text
阶段0:预检查     → GoodToGo状态检查(若已安装则执行,否则跳过)
阶段1:发现      → 收集评论、解析机器人格式、枚举整理
阶段2:分类 → 按优先级分类、按文件分组
阶段3:处理     → 按文件分组启动并行Agent
阶段4:验证   → 本地检查 + GoodToGo验证环节(若已安装)
阶段5:完成     → 提交、推送、处理所有线程

Phase 0: Pre-Flight

阶段0:预检查

If
gtg
is installed
, run the GoodToGo pre-flight check (see
references/goodtogo.md
):
bash
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')
fi
Route based on status (or skip straight to Phase 1 if
gtg
is not installed):
  • READY
    → Quick verify and commit (fast path — skip Phases 1-3)
  • CI_FAILING
    → Fix CI first
  • ACTION_REQUIRED
    → Continue with full workflow
  • UNRESOLVED_THREADS
    → Continue with full workflow

若已安装
gtg
,运行GoodToGo预检查(详见
references/goodtogo.md
):
bash
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
根据状态进行路由(若未安装
gtg
则直接进入阶段1):
  • READY
    → 快速验证并提交(快速路径 — 跳过阶段1-3)
  • CI_FAILING
    → 优先修复CI问题
  • ACTION_REQUIRED
    → 继续执行完整工作流
  • UNRESOLVED_THREADS
    → 继续执行完整工作流

Phase 1: Discovery

阶段1:发现

  1. Gather comments using scripts from
    references/discovery.md
  2. Parse bot formats using rules from
    references/bot-formats.md
  3. Print enumeration - counts MUST match before proceeding

  1. 收集评论 使用
    references/discovery.md
    中的脚本
  2. 解析机器人格式 遵循
    references/bot-formats.md
    中的规则
  3. 打印枚举结果 - 计数必须匹配才能继续

Phase 2: Classification & Grouping

阶段2:分类与分组

  1. Classify each comment using
    references/classification.md
  2. Group by file for parallel execution:
markdown
undefined
  1. 分类每条评论 使用
    references/classification.md
    中的规则
  2. 按文件分组 以支持并行执行:
markdown
undefined

Parallel 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 errors
Parallel execution rules:
ConditionExecution
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:验证环节(强制要求)

  1. Run local checks from
    references/verification.md
  2. If
    gtg
    is installed
    , run final verification from
    references/goodtogo.md
    (deterministic READY/BLOCK signal)
  3. Verify all resolutions - every comment needs explicit resolution
DO NOT commit until all checks pass.

  1. 运行本地检查 参考
    references/verification.md
  2. 若已安装
    gtg
    ,运行
    references/goodtogo.md
    中的最终验证(确定性READY/BLOCK信号)
  3. 验证所有处理结果 - 每条评论都需要明确的处理结果
所有检查通过前请勿提交。

Phase 5: Completion (MANDATORY — DO NOT SKIP)

阶段5:完成(强制要求 — 请勿跳过)

Follow steps from
references/completion.md
:
遵循
references/completion.md
中的步骤:

5a. Commit and push

5a. 提交并推送

  1. Commit all fixes together
  2. Push to remote
  1. 一次性提交所有修复
  2. 推送到远程仓库

5b. Post resolution summary

5b. 发布处理总结

  1. Post resolution summary comment to PR
  1. 在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_NUM
This 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_ID
手动修复。

5d. Final verification

5d. 最终验证

  1. Confirm script output shows "All threads resolved"
Workflow is NOT complete until all threads are resolved.

  1. 确认脚本输出显示"所有线程已处理"
所有线程处理完成前,工作流不算结束。

Example: PR with 6 Comments

示例:包含6条评论的PR

markdown
undefined
markdown
undefined

Discovery

发现阶段

  1. [blocking] src/api/route.ts:45 - Security issue
  2. [suggestion] src/api/route.ts:67 - Add validation
  3. [suggestion] src/components/Form.tsx:23 - Add types
  4. [nitpick] src/utils/format.ts:12 - Typo
  5. [question] src/lib/auth.ts:89 - "Handle null?"
  6. CI: Lint error
  1. [阻塞] src/api/route.ts:45 - 安全问题
  2. [建议] src/api/route.ts:67 - 添加验证逻辑
  3. [建议] src/components/Form.tsx:23 - 添加类型定义
  4. [小问题] src/utils/format.ts:12 - 拼写错误
  5. [疑问] src/lib/auth.ts:89 - "是否需要处理null?"
  6. 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

相关资源

ResourceDescription
detailed-reference.md
Single-threaded detailed reference
/commit-commands:commit
Clean commit workflow
资源描述
detailed-reference.md
单线程处理详细参考文档
/commit-commands:commit
规范提交工作流