pr-comment-analyzer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGitHub PR Comment Analyzer
GitHub PR Comment Analyzer
Analyze all review comments on a pull request to assess relevance, identify ambiguities, and generate a detailed report with suggested Q&A discussions. Unlike the PR resolver skill, this skill only analyzes and reports without making code changes.
分析拉取请求(PR)上的所有评审评论,评估相关性、识别模糊点,并生成带有建议问答讨论的详细报告。与PR resolver技能不同,本技能仅进行分析和报告,不会修改代码。
When to Use This Skill
适用场景
Use this skill when you need to:
- Analyze comment relevance without immediately acting on them
- Identify ambiguous feedback that needs clarification
- Generate reports on PR review status and comment landscape
- Facilitate discussions about comments through Q&A format
- Understand outdated comments that may no longer apply to the current code
当你需要以下操作时使用本技能:
- 分析评论相关性但不立即采取行动
- 识别模糊反馈以需要进一步澄清
- 生成报告展示PR评审状态和评论整体情况
- 促进讨论通过问答格式展开关于评论的交流
- 了解过时评论识别可能不再适用于当前代码的评论
Prerequisites
前置条件
bash
undefinedbash
undefinedVerify gh CLI is installed and authenticated
验证gh CLI已安装并完成认证
gh auth status
gh auth status
If not authenticated, run:
若未认证,运行以下命令:
gh auth login
Token requires `repo` scope for full repository access.gh auth login
令牌需要`repo`权限范围以获取完整的仓库访问权限。Workflow Overview
工作流概述
- Fetch PR context → Get all review threads with metadata (always fresh from GitHub)
- Analyze each comment → Assess relevance, type, intent, and clarity
- Identify ambiguities → Flag unclear, contradictory, or potentially outdated comments
- Generate report → Structured markdown report with findings
- Create Q&A discussions → Suggest discussion prompts for ambiguous items
- No code changes → Only analysis, reporting, and discussion generation
KEY PRINCIPLE: This is a read-only analysis skill. No files are modified, no commits are made, no threads are resolved.
- 获取PR上下文 → 获取所有带元数据的评审线程(始终从GitHub获取最新数据)
- 分析每条评论 → 评估相关性、类型、意图和清晰度
- 识别模糊点 → 标记不清晰、矛盾或可能过时的评论
- 生成报告 → 结构化的markdown报告呈现分析结果
- 创建问答讨论 → 为模糊项建议讨论提示
- 无代码修改 → 仅进行分析、报告和讨论生成
核心原则: 这是一个只读分析技能。不会修改任何文件、提交代码或解决线程。
Step 1: Fetch PR Context (Always Fresh)
步骤1:获取PR上下文(始终最新)
CRITICAL: Always fetch fresh data from GitHub. Never reuse previously fetched context data.
重要提示:始终从GitHub获取最新数据。切勿复用之前获取的上下文数据。
1.1 Get PR Details
1.1 获取PR详情
bash
undefinedbash
undefinedGet PR metadata
获取PR元数据
gh pr view <PR_NUMBER> --json number,title,state,headRefName,baseRefName,author,url,commits
undefinedgh pr view <PR_NUMBER> --json number,title,state,headRefName,baseRefName,author,url,commits
undefined1.2 Get Review Threads (GraphQL with Pagination)
1.2 获取评审线程(带分页的GraphQL查询)
Use GraphQL to fetch ALL review threads with full metadata. The API returns max 100 items per request, so pagination is required.
bash
undefined使用GraphQL获取所有带完整元数据的评审线程。API每次请求最多返回100条数据,因此需要分页处理。
bash
undefinedFirst page (no cursor)
第一页(无游标)
gh api graphql -f query='
query($owner: String!, $repo: String!, $prNumber: Int!, $cursor: String) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $prNumber) {
reviewThreads(first: 100, after: $cursor) {
pageInfo {
hasNextPage
endCursor
}
nodes {
id
isResolved
isOutdated
path
line
comments(first: 100) {
nodes {
id
databaseId
body
author { login }
createdAt
path
line
diffHunk
}
}
}
}
}
}
}' -f owner=OWNER -f repo=REPO -F prNumber=PR_NUMBER
undefinedgh api graphql -f query='
query($owner: String!, $repo: String!, $prNumber: Int!, $cursor: String) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $prNumber) {
reviewThreads(first: 100, after: $cursor) {
pageInfo {
hasNextPage
endCursor
}
nodes {
id
isResolved
isOutdated
path
line
comments(first: 100) {
nodes {
id
databaseId
body
author { login }
createdAt
path
line
diffHunk
}
}
}
}
}
}
}' -f owner=OWNER -f repo=REPO -F prNumber=PR_NUMBER
undefined1.3 Get Commit History
1.3 获取提交历史
bash
undefinedbash
undefinedGet commits in the PR to understand code evolution
获取PR中的提交记录以了解代码演进
gh pr view <PR_NUMBER> --json commits --json body | jq '.commits[] | {oid, messageHeadline, committedDate}'
undefinedgh pr view <PR_NUMBER> --json commits --json body | jq '.commits[] | {oid, messageHeadline, committedDate}'
undefined1.4 Collect ALL Threads (With Pagination)
1.4 收集所有线程(带分页)
IMPORTANT: Continue fetching pages until is . Collect ALL threads before analyzing.
hasNextPagefalsebash
undefined重要提示:持续获取页面直到为。在分析前收集所有线程。
hasNextPagefalsebash
undefinedPseudocode for pagination
分页处理伪代码
ALL_THREADS = []
CURSOR = null
while true:
RESULT = fetch_with_cursor(CURSOR)
ALL_THREADS.append(RESULT.nodes)
if not RESULT.pageInfo.hasNextPage:
break
CURSOR = RESULT.pageInfo.endCursor
undefinedALL_THREADS = []
CURSOR = null
while true:
RESULT = fetch_with_cursor(CURSOR)
ALL_THREADS.append(RESULT.nodes)
if not RESULT.pageInfo.hasNextPage:
break
CURSOR = RESULT.pageInfo.endCursor
undefinedStep 2: Analyze Each Comment
步骤2:分析每条评论
For every comment in the PR, perform comprehensive analysis:
对PR中的每条评论进行全面分析:
2.1 Extract Comment Metadata
2.1 提取评论元数据
- Thread ID (for reference)
- File path and line number
- Author and timestamp
- Thread resolution status (resolved/unresolved)
- Thread outdated status
- Full comment text
- Code diff context (diffHunk)- 线程ID(用于参考)
- 文件路径和行号
- 作者和时间戳
- 线程解决状态(已解决/未解决)
- 线程过时状态
- 完整评论文本
- 代码差异上下文(diffHunk)2.2 Assess Relevance
2.2 评估相关性
For each comment, determine its current relevance:
| Relevance Status | Definition | Indicators |
|---|---|---|
| HIGHLY RELEVANT | Comment directly addresses current code | Line still exists, code structure matches comment context |
| POTENTIALLY RELEVANT | Comment may apply but needs verification | Line is near current line, similar code patterns exist |
| OUTDATED | Comment refers to code no longer in PR | File was deleted, line removed, code completely refactored |
| UNCLEAR | Cannot determine relevance without more context | Vague reference, ambiguous terminology, no clear target |
| RESOLVED | Thread already marked as resolved | isResolved: true (included for completeness) |
Analysis Method:
- Check if file still exists in PR
- Verify line number still contains relevant code
- Cross-reference with commit history to see if code was modified/removed
- Compare diffHunk with current code context
针对每条评论,判断其当前相关性:
| 相关性状态 | 定义 | 指标 |
|---|---|---|
| 高度相关 | 评论直接针对当前代码 | 对应行仍然存在,代码结构与评论上下文匹配 |
| 可能相关 | 评论可能适用但需要验证 | 对应行接近当前行,存在相似代码模式 |
| 过时 | 评论指向PR中已不存在的代码 | 文件已删除、行已移除、代码完全重构 |
| 不清晰 | 无更多上下文无法判断相关性 | 模糊引用、术语歧义、无明确目标 |
| 已解决 | 线程已标记为已解决 | isResolved: true(为完整性包含此项) |
分析方法:
- 检查PR中文件是否仍然存在
- 验证行号是否仍包含相关代码
- 交叉引用提交历史查看代码是否被修改/移除
- 对比diffHunk与当前代码上下文
2.3 Classify Comment Type
2.3 分类评论类型
Identify what type of feedback this is:
| Type | Pattern | Examples |
|---|---|---|
| Bug Fix | Identifies issue, suggests fix | "This will crash if X is null" |
| Feature Request | Suggests new functionality | "Consider adding retry logic" |
| Code Quality | Style, refactoring, best practices | "This could be simplified with a helper function" |
| Documentation | Comments, documentation, clarity | "Add JSDoc for this function" |
| Performance | Optimization, efficiency | "This loop could be parallelized" |
| Testing | Test coverage, assertions | "Add test case for this scenario" |
| Architecture | Design patterns, structure | "This should use dependency injection" |
| Question/Discussion | Clarification, discussion points | "Why did you choose this approach?" |
| Suggestion/Nit | Minor preference, non-blocking | "Nit: prefer const over let here" |
识别反馈的类型:
| 类型 | 模式 | 示例 |
|---|---|---|
| Bug修复 | 指出问题并建议修复 | "当X为null时会崩溃" |
| 功能请求 | 建议新增功能 | "考虑添加重试逻辑" |
| 代码质量 | 风格、重构、最佳实践 | "可以用辅助函数简化这段代码" |
| 文档 | 注释、文档、清晰度 | "为这个函数添加JSDoc" |
| 性能 | 优化、效率 | "这个循环可以并行化" |
| 测试 | 测试覆盖率、断言 | "为这个场景添加测试用例" |
| 架构 | 设计模式、结构 | "应该使用依赖注入" |
| 问题/讨论 | 澄清、讨论点 | "为什么选择这种方案?" |
| 建议/细节优化 | 次要偏好、非阻塞性 | "细节优化:这里优先使用const而非let" |
2.4 Assess Intent Clarity
2.4 评估意图清晰度
Determine how clearly the comment communicates intent:
| Clarity Level | Definition | Examples |
|---|---|---|
| EXPLICIT | Clear action requested with specific guidance | "Add this validation: |
| IMPLICIT | Intent clear but specific action undefined | "This needs better error handling" |
| AMBIGUOUS | Multiple interpretations possible | "Simplify this code" (unclear what aspect) |
| UNCLEAR | Difficult to understand what's needed | Domain-specific jargon without context, typos, incomplete thoughts |
判断评论传达意图的清晰程度:
| 清晰度等级 | 定义 | 示例 |
|---|---|---|
| 明确 | 清晰说明所需操作并提供具体指导 | "添加此验证: |
| 隐含 | 意图清晰但具体操作未明确 | "这里需要更好的错误处理" |
| 歧义 | 存在多种解释可能 | "简化这段代码"(未明确简化哪方面) |
| 不清晰 | 难以理解需求 | 使用无上下文的领域术语、拼写错误、不完整的想法 |
2.5 Check for Contradictions
2.5 检查矛盾点
Identify comments that contradict each other:
- Different reviewers suggesting opposite approaches
- Multiple solutions proposed for same issue
- Conflicting coding standards referenced
识别相互矛盾的评论:
- 不同评审者提出相反方案
- 针对同一问题提出多种解决方案
- 引用冲突的编码标准
2.6 Outdated Status Analysis
2.6 过时状态分析
Determine if comment is outdated:
| Status | When | Indicators |
|---|---|---|
| NOT OUTDATED | Comment still applies | Code at line/path unchanged or similar |
| POSSIBLY OUTDATED | Needs verification | Code modified near the commented line |
| LIKELY OUTDATED | Comment obsolete | File deleted, entire function removed, massive refactor |
| EXPLICITLY MARKED | Already resolved/outdated | isOutdated: true from API |
判断评论是否过时:
| 状态 | 适用场景 | 指标 |
|---|---|---|
| 未过时 | 评论仍然适用 | 对应文件/行的代码未改变或相似 |
| 可能过时 | 需要验证 | 评论附近的代码已修改 |
| 大概率过时 | 评论已失效 | 文件已删除、整个函数已移除、大规模重构 |
| 明确标记 | 已标记为已解决/过时 | API返回isOutdated: true |
Step 3: Identify Ambiguities
步骤3:识别模糊点
Flag comments that need clarification:
标记需要澄清的评论:
3.1 Ambiguity Categories
3.1 模糊点分类
1. UNCLEAR INTENT
- What exactly needs to change?
- What's the success criterion?
- Examples: "Simplify this", "Make it better", "Consider X"
2. CONTRADICTORY
- Multiple comments suggest opposite solutions
- Conflicting coding standards or approaches
3. OUTDATED BUT UNRESOLVED
- Comment likely refers to old code
- But thread remains unresolved
- Needs clarification: still relevant?
4. DOMAIN-SPECIFIC
- Uses terminology without context
- References external docs/standards
- Requires subject matter expertise
5. ASSUMED CONTEXT
- References previous discussions
- Assumes knowledge of system architecture
- Missing background information
6. MULTIPLE VALID SOLUTIONS
- Comment mentions several approaches
- Unclear which is preferred
- No decision guidance provided1. 意图不明确
- 具体需要修改什么?
- 成功标准是什么?
- 示例:"简化这个"、"让它更好"、"考虑X"
2. 矛盾
- 多条评论提出相反解决方案
- 冲突的编码标准或方案
3. 过时但未解决
- 评论可能指向旧代码
- 但线程仍未解决
- 需要澄清:是否仍然相关?
4. 领域特定
- 使用无上下文的术语
- 引用外部文档/标准
- 需要领域专业知识
5. 假设上下文
- 引用之前的讨论
- 假设了解系统架构
- 缺少背景信息
6. 多种有效解决方案
- 评论提到多种方案
- 未明确偏好哪一种
- 未提供决策指导3.2 Severity Scoring
3.2 严重程度评分
Score each ambiguity for impact:
- CRITICAL: Blocks understanding or implementation
- HIGH: Significant confusion, multiple interpretations
- MEDIUM: Some clarity needed, but intent somewhat clear
- LOW: Minor ambiguity, intent is mostly clear
为每个模糊点进行影响评分:
- 关键:阻碍理解或实现
- 高:严重混淆,存在多种解释
- 中:需要一定澄清,但意图大致清晰
- 低:轻微歧义,意图基本清晰
Step 4: Generate Analysis Report
步骤4:生成分析报告
Create a comprehensive markdown report with findings:
创建包含分析结果的全面markdown报告:
4.1 Report Structure
4.1 报告结构
markdown
undefinedmarkdown
undefinedPR Comment Analysis Report
PR评论分析报告
PR: #<number> - <title>
Author: <author>
Branch: <branch>
Analysis Date: <timestamp>
PR: #<number> - <title>
作者: <author>
分支: <branch>
分析日期: <timestamp>
Summary Statistics
摘要统计
- Total Comments: N
- Comments Analyzed: N
- Highly Relevant: N
- Potentially Relevant: N
- Outdated: N
- Ambiguous: N
- Resolved: N
- 总评论数:N
- 已分析评论数:N
- 高度相关:N
- 可能相关:N
- 过时:N
- 模糊:N
- 已解决:N
Comments by Relevance
按相关性分类的评论
Highly Relevant Comments (N)
高度相关评论(N)
[List each with metadata]
[列出每条评论及元数据]
Potentially Relevant Comments (N)
可能相关评论(N)
[List with verification notes]
[列出并附验证说明]
Outdated Comments (N)
过时评论(N)
[List with reason marked outdated]
[列出并标记过时原因]
Ambiguous Comments (N)
模糊评论(N)
[List with ambiguity type and severity]
[列出并标注模糊类型和严重程度]
Already Resolved Comments (N)
已解决评论(N)
[List for reference]
[仅作参考列出]
Identified Issues
发现的问题
Contradictions (if any)
矛盾点(如有)
[List conflicting comments]
[列出相互矛盾的评论]
High-Impact Ambiguities
高影响模糊点
[Prioritized list needing clarification]
[按优先级列出需要澄清的项]
Comments Needing Verification
需要验证的评论
[List potentially outdated but unresolved]
[列出可能过时但未解决的评论]
Recommendations
建议
[Summary of key findings and suggested Q&A discussions]
undefined[关键发现摘要及建议的问答讨论]
undefined4.2 Comment Entry Format
4.2 评论条目格式
For each comment in the report, include:
markdown
**Comment ID:** <thread_id>
**File:** <path> (line <number>)
**Author:** <author> (<date>)
**Status:** <relevance_status> | <clarity_level> | <type>
**Resolved:** <yes/no>
**Text:**
> <comment_body>
**Analysis:**
- Intent: <description>
- Ambiguities: <list or "None">
- Relevance: <explanation>
- Recommended Q&A: [see Q&A section]报告中的每条评论需包含:
markdown
**评论ID:** <thread_id>
**文件:** <path>(第<number>行)
**作者:** <author>(<date>)
**状态:** <relevance_status> | <clarity_level> | <type>
**已解决:** <是/否>
**评论内容:**
> <comment_body>
**分析:**
- 意图:<描述>
- 模糊点:<列表或"无">
- 相关性:<解释>
- 建议问答:[见问答部分]Step 5: Generate Q&A Discussion Prompts
步骤5:生成问答讨论提示
For each ambiguous or high-impact comment, create discussion prompts:
为每个模糊或高影响评论创建讨论提示:
5.1 Q&A Format
5.1 问答格式
For each flagged item:
markdown
undefined针对每个标记项:
markdown
undefinedDiscussion: [Thread ID]
讨论:[线程ID]
Comment: > [quote]
Clarification Questions:
- [Question 1 - specific, focused]
- [Question 2 - alternative interpretation]
- [Question 3 - implementation details]
Suggested Response Approaches:
- Approach A: [Option with tradeoffs]
- Approach B: [Option with tradeoffs]
- Ask for: [Additional information needed]
undefined评论: > [引用内容]
澄清问题:
- [问题1 - 具体、聚焦]
- [问题2 - 替代解释]
- [问题3 - 实现细节]
建议回应方案:
- 方案A:[带权衡的选项]
- 方案B:[带权衡的选项]
- 请求:[需要的额外信息]
undefined5.2 Question Categories
5.2 问题分类
Design questions for different ambiguity types:
For UNCLEAR INTENT:
- "Could you clarify what 'X' means in this context?"
- "Are you suggesting [specific change] or [alternative]?"
- "What's the success criterion for this change?"
For OUTDATED COMMENTS:
- "This code has changed since your comment. Is this feedback still relevant?"
- "The file/line structure differs. Did you intend to comment on [new location]?"
- "Should we consider this for [other file/approach]?"
For CONTRADICTIONS:
- "I notice [Comment A] and [Comment B] suggest different approaches. Which is preferred?"
- "Can you help reconcile the difference between [Solution 1] and [Solution 2]?"
For DOMAIN-SPECIFIC:
- "Could you provide a brief example of what you mean by [term]?"
- "Is there a reference or doc I should review for context?"
针对不同模糊类型设计问题:
针对意图不明确:
- "能否澄清在此上下文中'X'的含义?"
- "您是建议[具体修改]还是[替代方案]?"
- "此修改的成功标准是什么?"
针对过时评论:
- "自您发表评论以来,代码已更改。此反馈是否仍然相关?"
- "文件/行结构已不同。您是否打算评论[新位置]?"
- "我们是否应该考虑将此应用于[其他文件/方案]?"
针对矛盾点:
- "我注意到[评论A]和[评论B]提出了不同方案。优先选择哪一种?"
- "能否帮助协调[方案1]和[方案2]之间的差异?"
针对领域特定:
- "能否提供一个您所说的[术语]的简单示例?"
- "是否有我应该参考的文档或资料以获取上下文?"
Step 6: Output Only (No Code Changes)
步骤6:仅输出(无代码修改)
6.1 Save Report
6.1 保存报告
bash
undefinedbash
undefinedSave markdown report to file
将markdown报告保存到文件
cat > "pr-${PR_NUMBER}-analysis.md" << 'EOF'
[Generated report]
EOF
cat > "pr-${PR_NUMBER}-analysis.md" << 'EOF'
[生成的报告]
EOF
Print to stdout as well
同时输出到标准输出
cat "pr-${PR_NUMBER}-analysis.md"
undefinedcat "pr-${PR_NUMBER}-analysis.md"
undefined6.2 Verification Checklist
6.2 验证清单
Before finalizing report, verify:
- All threads fetched (checked pagination)
- No threads were skipped
- All ambiguities identified and documented
- Q&A discussions generated for flagged items
- Report is current (fresh GitHub fetch)
- No code modifications made
- No threads resolved
- All files remain unchanged
在最终确定报告前,验证以下项:
- 已获取所有线程(检查分页)
- 无线程被跳过
- 所有模糊点已识别并记录
- 已为标记项生成问答讨论
- 报告是最新的(从GitHub获取的新鲜数据)
- 未修改任何代码
- 未解决任何线程
- 所有文件保持不变
Complete Example Script
完整示例脚本
bash
#!/bin/bashbash
#!/bin/bashComplete workflow for PR comment analysis
PR评论分析完整工作流
PR_NUMBER=$1
REPO="owner/repo" # Or extract from current git remote
OWNER=${REPO%/}
REPO_NAME=${REPO#/}
PR_NUMBER=$1
REPO="owner/repo" # 或从当前git远程仓库提取
OWNER=${REPO%/}
REPO_NAME=${REPO#/}
1. Fetch fresh context from GitHub
1. 从GitHub获取最新上下文
echo "Fetching PR #$PR_NUMBER..."
PR_INFO=$(gh pr view $PR_NUMBER --json number,title,headRefName,author)
echo "PR: $(echo $PR_INFO | jq -r '.title')"
echo "Author: $(echo $PR_INFO | jq -r '.author.login')"
echo "正在获取PR #$PR_NUMBER..."
PR_INFO=$(gh pr view $PR_NUMBER --json number,title,headRefName,author)
echo "PR: $(echo $PR_INFO | jq -r '.title')"
echo "作者: $(echo $PR_INFO | jq -r '.author.login')"
2. Fetch ALL review threads with pagination
2. 带分页获取所有评审线程
echo "Fetching all review comments..."
ALL_THREADS="[]"
CURSOR=""
HAS_NEXT=true
while [ "$HAS_NEXT" = "true" ]; do
if [ -z "$CURSOR" ]; then
CURSOR_ARG=""
else
CURSOR_ARG="-f cursor="$CURSOR""
fi
RESULT=$(gh api graphql -f query='
query($owner: String!, $repo: String!, $prNumber: Int!, $cursor: String) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $prNumber) {
reviewThreads(first: 100, after: $cursor) {
pageInfo {
hasNextPage
endCursor
}
nodes {
id
isResolved
isOutdated
path
line
comments(first: 100) {
nodes {
body
author { login }
createdAt
path
line
}
}
}
}
}
}
}' -f owner=$OWNER -f repo=$REPO_NAME -F prNumber=$PR_NUMBER $CURSOR_ARG)
Process results
PAGE_THREADS=$(echo $RESULT | jq '.data.repository.pullRequest.reviewThreads.nodes')
ALL_THREADS=$(echo "$ALL_THREADS $PAGE_THREADS" | jq -s 'add')
HAS_NEXT=$(echo $RESULT | jq -r '.data.repository.pullRequest.reviewThreads.pageInfo.hasNextPage')
CURSOR=$(echo $RESULT | jq -r '.data.repository.pullRequest.reviewThreads.pageInfo.endCursor')
done
echo "正在获取所有评审评论..."
ALL_THREADS="[]"
CURSOR=""
HAS_NEXT=true
while [ "$HAS_NEXT" = "true" ]; do
if [ -z "$CURSOR" ]; then
CURSOR_ARG=""
else
CURSOR_ARG="-f cursor="$CURSOR""
fi
RESULT=$(gh api graphql -f query='
query($owner: String!, $repo: String!, $prNumber: Int!, $cursor: String) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $prNumber) {
reviewThreads(first: 100, after: $cursor) {
pageInfo {
hasNextPage
endCursor
}
nodes {
id
isResolved
isOutdated
path
line
comments(first: 100) {
nodes {
body
author { login }
createdAt
path
line
}
}
}
}
}
}
}' -f owner=$OWNER -f repo=$REPO_NAME -F prNumber=$PR_NUMBER $CURSOR_ARG)
处理结果
PAGE_THREADS=$(echo $RESULT | jq '.data.repository.pullRequest.reviewThreads.nodes')
ALL_THREADS=$(echo "$ALL_THREADS $PAGE_THREADS" | jq -s 'add')
HAS_NEXT=$(echo $RESULT | jq -r '.data.repository.pullRequest.reviewThreads.pageInfo.hasNextPage')
CURSOR=$(echo $RESULT | jq -r '.data.repository.pullRequest.reviewThreads.pageInfo.endCursor')
done
3. Analyze comments (Claude does this part)
3. 分析评论(由Claude执行此部分)
TOTAL=$(echo $ALL_THREADS | jq 'length')
RESOLVED=$(echo $ALL_THREADS | jq '[.[] | select(.isResolved == true)] | length')
UNRESOLVED=$(echo $ALL_THREADS | jq '[.[] | select(.isResolved == false)] | length')
OUTDATED=$(echo $ALL_THREADS | jq '[.[] | select(.isOutdated == true)] | length')
echo "Total threads: $TOTAL"
echo "Unresolved: $UNRESOLVED"
echo "Resolved: $RESOLVED"
echo "Outdated: $OUTDATED"
TOTAL=$(echo $ALL_THREADS | jq 'length')
RESOLVED=$(echo $ALL_THREADS | jq '[.[] | select(.isResolved == true)] | length')
UNRESOLVED=$(echo $ALL_THREADS | jq '[.[] | select(.isResolved == false)] | length')
OUTDATED=$(echo $ALL_THREADS | jq '[.[] | select(.isOutdated == true)] | length')
echo "总线程数: $TOTAL"
echo "未解决: $UNRESOLVED"
echo "已解决: $RESOLVED"
echo "过时: $OUTDATED"
4. Generate report and Q&A discussions
4. 生成报告和问答讨论
(Analysis performed interactively by Claude)
(分析由Claude交互式执行)
echo ""
echo "✅ Analysis complete. Report saved to: pr-${PR_NUMBER}-analysis.md"
undefinedecho ""
echo "✅ 分析完成。报告已保存至: pr-${PR_NUMBER}-analysis.md"
undefinedKey Differences from PR Resolver
与PR Resolver的核心差异
| Aspect | PR Resolver | PR Comment Analyzer |
|---|---|---|
| Action | Fixes code | Analyzes and reports |
| Commits | Creates commits | No commits |
| Thread Resolution | Resolves threads | No thread changes |
| Output | Modified PR | Analysis report + Q&A |
| Goal | Complete feedback | Understand feedback |
| Use Case | Addressing review | Understanding review landscape |
| 方面 | PR Resolver | PR Comment Analyzer |
|---|---|---|
| 操作 | 修复代码 | 分析并报告 |
| 提交 | 创建提交 | 无提交 |
| 线程解决 | 解决线程 | 不修改线程 |
| 输出 | 修改后的PR | 分析报告 + 问答 |
| 目标 | 完成反馈处理 | 理解反馈情况 |
| 适用场景 | 处理评审反馈 | 了解评审整体情况 |
Reference
参考
See for:
references/github_api_reference.md- Detailed GitHub API pagination patterns
- GraphQL query templates
- API rate limits and error handling
- Comment intent patterns and classification
查看获取:
references/github_api_reference.md- 详细的GitHub API分页模式
- GraphQL查询模板
- API速率限制和错误处理
- 评论意图模式和分类