modernize

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Modernize

Modernize

Modernize the idea, not just the branch. A clean rebase does not prove that the PR still belongs in the product.
要更新的是创意,而不只是分支。干净的 rebase 并不能证明该 PR 仍适合当前产品。

Guardrails

防护规则

  • Always check to make sure you have pulled latest origin for your branch, main branch, and any other branch related to your work before starting.
  • Treat existing worktree changes as user-owned. Use a disposable worktree when the active worktree is dirty or is being used for other work.
  • Modernizing authorizes rebasing and updating the PR branch. It does not authorize merging, closing, changing the base branch, or expanding scope.
  • Never use an unqualified force push. Update a rebased branch with
    --force-with-lease
    against the head SHA observed before the rebase.
  • Do not post a PR comment unless the user asked for one. Use the
    leaving-pr-comments
    skill for every comment posted on the user's behalf.
  • 开始前,务必确认已为你的分支、
    main
    分支以及与工作相关的所有其他分支拉取
    origin
    的最新内容。
  • 将现有 worktree 更改视为用户所有。如果当前 worktree 存在未提交更改或正在用于其他工作,请使用临时 worktree。
  • Modernize 流程仅授权执行 rebase 和更新 PR 分支,不授权合并、关闭 PR、更改 base 分支或扩大工作范围。
  • 绝不要使用无安全限制的 force push。更新 rebase 后的分支时,应使用
    --force-with-lease
    ,并以 rebase 前观察到的 head SHA 为约束。
  • 除非用户明确要求,否则不要发布 PR 评论。代表用户发布的所有评论都应使用
    leaving-pr-comments
    skill。

Establish the PR's intent

明确 PR 的意图

Resolve the PR and record its URL, state, base, head repository and branch, current head SHA, author, checks, and review state. Read the title, body, linked issues, commits, review threads, and complete diff. State the smallest coherent goal the PR was trying to accomplish before judging its implementation.
Fetch the latest remote base and PR head. Use the PR's actual base branch, usually
main
, rather than assuming the local branch is current. Record the merge base so the original PR and subsequent base-branch changes can be compared separately.
解析该 PR,并记录其 URL、状态、base、head 仓库与分支、当前 head SHA、作者、检查结果和审查状态。阅读标题、正文、关联 issue、提交、审查讨论和完整 diff。在评判实现方式之前,先明确该 PR 试图实现的最小且完整的目标。
拉取最新的远程 base 和 PR head。使用 PR 实际的 base 分支(通常是
main
),不要假设本地分支处于最新状态。记录 merge base,以便分别比较原始 PR 与 base 分支后续发生的变化。

Check what changed around it

检查周边变化

Inspect commits and diffs added to the base branch since the PR diverged. Search merged and open PRs when titles, code paths, or behavior suggest a replacement or competing implementation.
Look beyond overlapping lines:
  • Has the same user-facing problem already been solved?
  • Did APIs, types, schemas, dependencies, or architectural boundaries change?
  • Do both sides now claim ownership of the same behavior or invariant?
  • Was the code being changed deleted, moved, or intentionally simplified?
  • Would landing the PR restore an old behavior or create two ways to do the same thing?
  • Is the original benefit still large enough to justify the maintenance cost?
Do not describe a PR as current merely because Git reports no conflicts.
检查 PR 分叉之后合并到 base 分支的提交和 diff。当标题、代码路径或行为表明可能存在替代或竞争实现时,搜索已合并和未合并的 PR。
不要只关注重叠的行:
  • 相同的用户侧问题是否已经解决?
  • API、类型、schema、依赖项或架构边界是否发生了变化?
  • 双方现在是否都声称拥有同一行为或 invariant?
  • 被修改的代码是否已被删除、移动或有意简化?
  • 合并该 PR 是否会恢复旧行为,或造成实现同一目标的两种方式?
  • 原有收益是否仍然足够大,能够抵偿维护成本?
不要仅因为 Git 报告没有冲突,就认定该 PR 仍然适用。

Choose a disposition before pushing

推送前选择处置方式

Use one of these recommendations:
  • MODERNIZE: the goal is still useful and the implementation remains the right shape. Rebase, resolve conflicts, test, and update the branch.
  • REWORK: the goal is still useful, but a mechanical rebase would preserve the wrong implementation. Explain the smallest credible rewrite and stop before pushing unless the user also asked for that rework.
  • CLOSE: the PR is superseded, obsolete, directionally wrong, or no longer worth its cost. Cite concrete evidence and stop. Do not spend time rebasing an obsolete branch, and do not close it without explicit permission.
Be willing to recommend
CLOSE
. Age alone is not evidence, and sunk effort is not a reason to keep a PR alive.
采用以下建议之一:
  • MODERNIZE:目标仍然有用,且实现方式依然合理。执行 rebase、解决冲突、运行测试并更新分支。
  • REWORK:目标仍然有用,但机械式 rebase 会保留错误的实现。说明最小且合理的重写方案;除非用户同时要求重写,否则在推送前停止。
  • CLOSE:PR 已被取代、已经过时、方向错误,或不再值得投入相应成本。列出具体证据并停止。不要浪费时间 rebase 过时的分支,也不要在未获得明确许可时关闭 PR。
应敢于建议
CLOSE
。PR 的年龄本身不是证据,已经投入的成本也不是让 PR 继续存在的理由。

Rebase without losing intent

在不丢失意图的情况下 rebase

For a
MODERNIZE
disposition:
  1. Create a safe local branch or disposable worktree at the recorded PR head.
  2. Rebase its commits onto the freshly fetched base branch.
  3. Resolve each conflict according to the PR's current intent and the base branch's newer invariants. If a conflict reveals a product or architecture disagreement, stop and reconsider the disposition instead of guessing.
  4. Compare the pre-rebase and post-rebase commit series with
    git range-diff
    and inspect the final diff. Confirm that no intentional behavior disappeared and no already-landed behavior was reintroduced.
  5. Run the repository's focused checks for the touched area. Distinguish real failures from pre-existing or infrastructure failures.
  6. Push with
    --force-with-lease
    tied to the previously observed remote head. If the lease fails, fetch and reassess rather than overwriting new work.
Do not merge the PR.
对于
MODERNIZE
处置方式:
  1. 在记录的 PR head 上创建一个安全的本地分支或临时 worktree。
  2. 将其提交 rebase 到刚拉取的 base 分支上。
  3. 根据 PR 的当前意图和 base 分支中较新的 invariant 解决每一个冲突。如果冲突暴露出产品或架构层面的分歧,应停止操作并重新评估处置方式,而不是猜测。
  4. 使用
    git range-diff
    比较 rebase 前后的提交序列,并检查最终 diff。确认没有丢失有意保留的行为,也没有重新引入已经合并的行为。
  5. 运行仓库中与受影响区域相关的定向检查。区分真实失败、既有失败和基础设施故障。
  6. 使用
    --force-with-lease
    推送,并以之前观察到的远程 head 为约束。如果 lease 失效,应重新拉取并重新评估,而不是覆盖新的工作。
不要合并该 PR。

Report

报告

Lead with
MODERNIZE
,
REWORK
, or
CLOSE
and the reason. Then summarize:
  • meaningful changes on the base branch;
  • conceptual conflicts or confirmation that none were found;
  • the rebase and push result, if performed;
  • checks run and their results;
  • the remaining decision or work, with a link to the PR.
Separate observed facts from judgment. Say what could not be verified instead of manufacturing confidence.
首先给出
MODERNIZE
、
REWORK
或
CLOSE
及原因。然后总结:
  • base 分支上的重要变化;
  • 概念性冲突,或确认未发现此类冲突;
  • rebase 和推送结果(如果已执行);
  • 已运行的检查及其结果;
  • 尚待决定或完成的工作,并附上 PR 链接。
将观察到的事实与主观判断分开说明。无法验证的内容应直接说明,不要制造不必要的确定性。