fix-pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Fix PR

修复PR

Flags

参数

FlagEffect
--pr <n|url>
Target PR. Default:
gh pr view
on current branch; stop and ask if none.
--no-push
Commit locally; skip push. Off by default.
--no-reply
Fix code; skip GitHub thread replies. Off by default.
参数作用
--pr <n|url>
指定目标PR。默认值: 在当前分支执行
gh pr view
;若无对应PR则停止并询问用户。
--no-push
仅在本地提交代码;跳过推送步骤。默认关闭。
--no-reply
仅修复代码;跳过GitHub讨论线程回复。默认关闭。

Step 1: Resolve PR

步骤1:确定目标PR

--pr
if passed; else
gh pr view --json number,headRefName,url,headRepository
.
Record owner, repo, number, head branch, URL. If
gh
errors or no PR exists, stop and ask.
Done when: owner, repo, number, head branch, and URL are known.
若传入了
--pr
参数则使用该参数;否则执行
gh pr view --json number,headRefName,url,headRepository
记录仓库所有者、仓库名、PR编号、头部分支、链接。如果
gh
命令报错或不存在对应PR,则停止并询问用户。
完成标志: 已获取仓库所有者、仓库名、PR编号、头部分支和链接信息。

Step 2: Fetch open feedback

步骤2:获取未处理的评审反馈

Paginate all unresolved review threads using the GraphQL contract in
./REFERENCE.md
. Substitute owner, repo, and number from Step 1.
If a changes-requested review has a body with actionable feedback not already covered by inline threads, add those items using the REST pattern in
./REFERENCE.md
.
Done when: Every unresolved thread and orphan review-body item is listed with path, line, author, and body.
使用
./REFERENCE.md
中的GraphQL协议分页获取所有未解决的评审线程。代入步骤1中获取的仓库所有者、仓库名和PR编号。
若标记为“请求修改”的评审包含未被内联线程覆盖的可操作反馈,则使用
./REFERENCE.md
中的REST格式添加这些反馈项。
完成标志: 已列出所有未解决的线程和独立评审反馈项,包含文件路径、行号、作者和反馈内容。

Step 3: Checkout PR branch

步骤3:切换到PR分支

gh pr checkout <number>
or confirm the working tree is on
headRefName
.
Done when: Working tree is on the PR head branch.
执行
gh pr checkout <number>
或确认工作区已处于
headRefName
分支。
完成标志: 工作区已切换至PR的头部分支。

Step 4: Triage skeptically

步骤4:审慎筛选评审意见

For every item from Step 2. No file edits until this step completes.
  1. Read the cited file with surrounding context.
  2. Trace the code path the reviewer claims is wrong.
  3. Reproduce if possible (targeted test, call trace, type check).
  4. Assign verdict:
    fix
    |
    reject
    |
    clarify
    .
  5. Record one-line evidence.
Done when: Every item has verdict and evidence; no edits before this holds.
针对步骤2中的每一项反馈执行以下操作。在完成此步骤前禁止修改任何文件。
  1. 阅读标注文件及其上下文内容。
  2. 追踪评审者指出的问题代码路径。
  3. 尽可能复现问题(针对性测试、调用追踪、类型检查)。
  4. 给出判定结果:
    fix
    (修复)|
    reject
    (驳回)|
    clarify
    (澄清)。
  5. 记录一行简短的判定依据。
完成标志: 每一项反馈均已给出判定结果和依据;在此之前未进行任何文件修改。

Step 5: Implement

步骤5:实施修复

Apply only
fix
verdicts. Focused diffs; no drive-by refactors.
Done when: Every
fix
item has a local change, or there were zero
fix
verdicts.
仅对判定为
fix
的反馈进行修复。仅生成针对问题的差异代码;禁止顺带重构。
完成标志: 所有判定为
fix
的反馈均已完成本地修改,或无需要修复的反馈项。

Step 6: Commit

步骤6:提交代码

Read
../commit/SKILL.md
in full. Commit per that skill (diff-only message).
Done when: Changes are committed, or there is nothing to commit.
完整阅读
../commit/SKILL.md
文档。按照该技能要求提交代码(仅包含差异内容的提交信息)。
完成标志: 已提交修改内容,或无内容可提交。

Step 7: Push and reply

步骤7:推送代码并回复评审

Unless
--no-push
:
git push
.
Unless
--no-reply
, reply to every triaged item:
  1. Draft per verdict shape in
    ./REFERENCE.md
    .
  2. Apply the unslop process in
    ~/.agents/skills/unslop/SKILL.md
    to each draft. Replies must be concise (fact or fix first, no preamble) and humane (teammate tone, not a bot closing a ticket).
  3. Post using reply commands in
    ./REFERENCE.md
    . For
    fix
    verdicts, push before replying; reference the commit SHA. Never post platitudes ("acknowledged", "will fix", "good point", "hope this helps").
  4. When author is
    semgrep-code-scan
    , use dismissal patterns in
    ./REFERENCE.md
    .
Done when: Push succeeded (or
--no-push
); every item has a posted reply (or
--no-reply
); every reply is concise, humane, and unslopped.
除非启用
--no-push
参数:执行
git push
除非启用
--no-reply
参数,否则需回复每一项经过筛选的反馈:
  1. 按照
    ./REFERENCE.md
    中的判定结果格式撰写回复草稿。
  2. 应用
    ~/.agents/skills/unslop/SKILL.md
    中的unslop流程处理每一条草稿回复。回复必须简洁(先陈述事实或修复内容,无开场白)且人性化(采用团队协作语气,而非机器人处理工单的语气)。
  3. 使用
    ./REFERENCE.md
    中的回复命令发布回复。对于判定为
    fix
    的反馈,需先推送代码再回复;引用提交的SHA值。禁止发布空泛内容(如“已确认”、“将修复”、“好建议”、“希望有所帮助”)。
  4. 若反馈作者为
    semgrep-code-scan
    ,则使用
    ./REFERENCE.md
    中的驳回模板。
完成标志: 推送成功(或启用了
--no-push
参数);每一项反馈均已发布回复(或启用了
--no-reply
参数);所有回复均简洁、人性化且经过unslop流程处理。

Step 8: Report

步骤8:生成报告

Table:
item | verdict | action
. Include PR URL and commit SHA if any.
Done when: What was fixed, rejected, or discussed is visible at a glance.
Does not handle CI, merge conflicts, or stack restacking (
pr-babysit
); never invoke
make-pr
.
生成表格:
反馈项 | 判定结果 | 操作
。若有提交,需包含PR链接和提交SHA值。
完成标志: 可一目了然看到哪些问题已修复、哪些已驳回或已讨论。
本工具不处理CI、合并冲突或栈式PR重排(该功能由
pr-babysit
负责);请勿调用
make-pr