pr-comments by casper-studios/casper-marketplace
npx skills add https://github.com/casper-studios/casper-marketplace --skill pr-comments获取所有未解决的 PR 审阅线程,跨机器人去重,按严重性分级,并生成供人工批准的修复计划。批准后,解决被忽略的线程并启动子代理来修复实际问题。
/pr-comments — 从当前分支自动检测 PR/pr-comments 608 — 指定 PR 编号# 从当前分支自动检测,或使用提供的 PR 编号
gh pr view --json number,headRepositoryOwner,title,headRefName,baseRefName
使用 GraphQL 获取线程解决状态 — 这是唯一可靠的真实来源。
gh api graphql -f query='
{
repository(owner: "{OWNER}", name: "{REPO_NAME}") {
pullRequest(number: {PR_NUMBER}) {
reviewThreads(first: 100) {
nodes {
id
isResolved
isOutdated
path
line
comments(first: 20) {
nodes {
databaseId
author { login }
body
path
line
originalLine
createdAt
url
}
}
}
}
}
}
}'
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
如果 hasNextPage 为 true,则进行分页。收集每个线程。
isResolved == false 的线程isOutdated — 差异可能已移动;标记这些以供额外审查gh api --paginate "repos/{OWNER}/{REPO_NAME}/issues/{PR_NUMBER}/comments?per_page=100"
筛选出来自仅限人工审阅者(非机器人)的评论。这些通常是最重要的。
多个机器人经常在同一个文件/行上标记相同的潜在问题。将它们分组。
针对同一文件且在 5 行范围内的线程很可能指向同一个问题。将它们合并为一个逻辑问题。
每个机器人使用不同的严重性标记:
| 机器人 | 格式 | 示例 |
|---|---|---|
coderabbitai[bot] | 正文中的表情徽章 | 🟠 Major, 🟡 Minor, 🔴 Critical |
gemini-code-assist[bot] | SVG 图像替代文本 | ![medium], ![high], ![low] |
chatgpt-codex-connector[bot] | 盾牌徽章 | P1, P2, P3 |
devin-ai-integration[bot] | HTML 评论元数据 | 解析 devin-review-comment JSON 中的严重性 |
将所有标记映射到统一等级:Critical > Major > Medium > Minor > Nitpick
当多个机器人以不同严重性标记同一问题时,采用最高严重性。
对于每个去重后的问题,确定:
security | bug | correctness | performance | accessibility | style | config | docs如果符合以下任何条件,则标记为忽略候选:
.md、配置、迁移文件)的评论,且没有安全隐患isOutdated == true)将计划写入 .claude/scratchpad/pr-{PR_NUMBER}-review-plan.md。
# PR #{PR_NUMBER} 审阅计划 — "{PR_TITLE}"
**分支:** {branch_name}
**PR URL:** {pr_url}
**获取的线程:** 总计 {total},未解决 {unresolved},过时 {outdated}
**机器人分布:** {count per bot}
---
## 需要修复的问题(按严重性排序)
仅包含实际将被修复的问题。在阶段 2 中被分类为忽略的项目**仅**出现在下面的忽略部分 — 切勿在此处列出。
### 1. [{SEVERITY}] {问题的简短描述}
- **文件:** `path/to/file.ts#L{line}`
- **类别:** {category}
- **标记者:** @bot1, @bot2
- **评论 URL:** {url to first comment}
- **问题所在:** {用通俗英语解释,1-2 句话}
- **建议修复:** {具体描述需要更改的内容}
> 原始评论(来自 @bot1):
> {相关摘录 — 去除样板内容/徽章}
---
### 2. [{SEVERITY}] ...
---
## 已忽略(附原因)
每个被忽略的项目**仅**出现在此处 — 不会在上面"需要修复的问题"部分重复列出。
### I1. @{bot} 在 `path/to/file.ts#L{line}`
- **忽略原因:** {具体原因 — 例如,"与 AGENTS.md 中不使用显式返回类型的项目约定相冲突","过时线程,代码已更改","对配置文件的风格挑剔"}
- **原始评论:** {评论链接}
### I2. ...
---
## 总结
- **{N} 个问题需要修复**,涉及 {M} 个文件
- **{K} 条评论被忽略**({reasons breakdown})
- 预估复杂度:{low/medium/high}
编写计划后,告知用户:
审阅计划已写入
.claude/scratchpad/pr-{PR_NUMBER}-review-plan.md。{N} 个问题需要修复,{K} 个已忽略。请审阅并确认以继续。
在此处停止。 等待用户审阅和批准。在用户确认之前不要继续。
一旦用户批准(他们可能会先编辑计划 — 在执行前重新阅读):
对于每个被忽略的问题,在 GitHub 线程上回复一个简短的评论解释原因并解决:
# 在线程上发布回复评论
gh api -X POST "repos/{OWNER}/{REPO_NAME}/pulls/{PR_NUMBER}/comments" \
-f body="已确认 — {reason}。正在解决。" \
-F in_reply_to={COMMENT_DATABASE_ID}
# 通过 GraphQL 解决线程
gh api graphql -f query='
mutation {
resolveReviewThread(input: { threadId: "{THREAD_NODE_ID}" }) {
thread { isResolved }
}
}'
使用简洁、具体的驳回原因。例如:
将涉及同一文件或逻辑单元的相关问题分组。然后使用 Task 工具启动并行子代理(每个文件或逻辑组一个):
为每个组启动一个 Task 子代理 (subagent_type: "general-purpose"):
提示模板:
"在分支 {BRANCH} 上修复以下 PR 审阅问题:
问题:{description}
文件:{path}#{line}
问题所在:{explanation}
建议修复:{fix description}
读取文件,理解周围上下文,并进行修复。
修复后,验证更改是否正确。
请勿修改无关代码。"
subagent_type: "general-purpose"这些几乎总是可以忽略 — 但在驳回前请验证:
as 类型转换或非空断言 — 在接受前检查项目约定每周安装量
113
仓库
GitHub 星标数
9
首次出现
2026年2月18日
安全审计
安装于
opencode113
codex113
cursor112
claude-code110
github-copilot108
windsurf107
Fetch all unresolved PR review threads, deduplicate across bots, triage by severity, and produce a fix plan for human approval. After sign-off, resolve ignored threads and spawn subagents to fix real issues.
/pr-comments — auto-detect PR from current branch/pr-comments 608 — specific PR number# Auto-detect from current branch, or use the provided PR number
gh pr view --json number,headRepositoryOwner,title,headRefName,baseRefName
Use GraphQL to get thread resolution status — this is the only reliable source of truth.
gh api graphql -f query='
{
repository(owner: "{OWNER}", name: "{REPO_NAME}") {
pullRequest(number: {PR_NUMBER}) {
reviewThreads(first: 100) {
nodes {
id
isResolved
isOutdated
path
line
comments(first: 20) {
nodes {
databaseId
author { login }
body
path
line
originalLine
createdAt
url
}
}
}
}
}
}
}'
Paginate if hasNextPage is true. Collect every thread.
isResolved == falseisOutdated — the diff may have moved; flag these for extra scrutinygh api --paginate "repos/{OWNER}/{REPO_NAME}/issues/{PR_NUMBER}/comments?per_page=100"
Filter to comments from human reviewers only (not bots). These are often the most important.
Multiple bots often flag the same underlying issue on the same file/line. Group them.
Threads targeting the same file within a 5-line range likely address the same issue. Merge them into a single logical issue.
Each bot uses different severity markers:
| Bot | Format | Example |
|---|---|---|
coderabbitai[bot] | Emoji badge in body | 🟠 Major, 🟡 Minor, 🔴 Critical |
gemini-code-assist[bot] | SVG image alt text | ![medium], ![high], ![low] |
Map all to a unified scale: Critical > Major > Medium > Minor > Nitpick
When multiple bots flag the same issue at different severities, take the highest.
For each deduplicated issue, determine:
security | bug | correctness | performance | accessibility | style | config | docsFlag as ignore candidate if ANY of these apply:
.md, config, migrations) with no security implicationsisOutdated == true) where the code has already changedWrite the plan to .claude/scratchpad/pr-{PR_NUMBER}-review-plan.md.
# PR #{PR_NUMBER} Review Plan — "{PR_TITLE}"
**Branch:** {branch_name}
**PR URL:** {pr_url}
**Threads fetched:** {total} total, {unresolved} unresolved, {outdated} outdated
**Bot breakdown:** {count per bot}
---
## Issues to Fix (ordered by severity)
Only include issues that will actually be fixed. Items classified as ignored in Phase 2 go EXCLUSIVELY in the Ignored section below — never list them here.
### 1. [{SEVERITY}] {Short description of the issue}
- **File:** `path/to/file.ts#L{line}`
- **Category:** {category}
- **Flagged by:** @bot1, @bot2
- **Comment URL:** {url to first comment}
- **What's wrong:** {1-2 sentence explanation in plain english}
- **Suggested fix:** {concrete description of what to change}
> Original comment (from @bot1):
> {relevant excerpt — strip boilerplate/badges}
---
### 2. [{SEVERITY}] ...
---
## Ignored (with reasoning)
Each ignored item appears ONLY here — not duplicated in the Issues to Fix section above.
### I1. @{bot} on `path/to/file.ts#L{line}`
- **Why ignored:** {specific reason — e.g., "contradicts project convention in AGENTS.md to not use explicit return types", "outdated thread, code already changed", "style nitpick on a config file"}
- **Original comment:** {link to comment}
### I2. ...
---
## Summary
- **{N} issues to fix** across {M} files
- **{K} comments ignored** ({reasons breakdown})
- Estimated complexity: {low/medium/high}
After writing the plan, tell the user:
Review plan written to
.claude/scratchpad/pr-{PR_NUMBER}-review-plan.md. {N} issues to fix , {K} ignored. Please review and confirm to proceed.
STOP HERE. Wait for the user to review and approve. Do not proceed until they confirm.
Once the user approves (they may edit the plan first — re-read it before executing):
For each ignored issue, resolve the GitHub thread with a brief comment explaining why:
# Post a reply comment on the thread
gh api -X POST "repos/{OWNER}/{REPO_NAME}/pulls/{PR_NUMBER}/comments" \
-f body="Acknowledged — {reason}. Resolving." \
-F in_reply_to={COMMENT_DATABASE_ID}
# Resolve the thread via GraphQL
gh api graphql -f query='
mutation {
resolveReviewThread(input: { threadId: "{THREAD_NODE_ID}" }) {
thread { isResolved }
}
}'
Use concise, specific dismiss reasons. Examples:
Group related issues that touch the same file or logical unit. Then launch parallel subagents (one per file or logical group) using the Task tool:
Launch a Task subagent (subagent_type: "general-purpose") for each group:
Prompt template:
"Fix the following PR review issue(s) on branch {BRANCH}:
Issue: {description}
File: {path}#{line}
What's wrong: {explanation}
Suggested fix: {fix description}
Read the file, understand the surrounding context, and make the fix.
After fixing, verify the change is correct.
Do NOT touch unrelated code."
subagent_type: "general-purpose" for each groupThese are almost always ignorable — but verify before dismissing:
as casts or non-null assertions — check project conventions before acceptingWeekly Installs
113
Repository
GitHub Stars
9
First Seen
Feb 18, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode113
codex113
cursor112
claude-code110
github-copilot108
windsurf107
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
152,900 周安装
chatgpt-codex-connector[bot] | Shield badge | P1, P2, P3 |
devin-ai-integration[bot] | HTML comment metadata | Parse devin-review-comment JSON for severity |