证据快照复核于 2026-08-30GitHub 数据核对日期: 2026-08-21
来源已审查独立 Skill编码与审查

dsh-merging-stacked-prs

用于合并堆叠 Pull Request 的指导。

快速了解

它能做什么

用于合并堆叠 Pull Request 的指导。

本站提供的是中文说明,不代表该项目或 Plugin 自身提供中文界面;语言支持请以上游文档为准。

能力
编码与审查代码审查工作流自动化

选择前先看

该技能提供用于合并堆叠 Pull Request 的指导

适合谁

需要codereview能力的 DSH 用户。

常见任务

  • 用于合并堆叠 PR相关的codereview工作流。
  • 决定是否适合你的 Profile 前先查看固定版本的仓库证据。

权限与数据

本次未测试运行时行为;宿主访问范围取决于 DSH 集成方式和声明的依赖项。

权限
  • 将技能加入宿主技能集合。
数据处理
  • 本次未测试运行时数据处理。
外部服务
  • 可能使用固定仓库声明的依赖项或服务。
凭据
  • 现有证据没有确认凭据要求。

局限

  • 本次未测试运行时安装和执行。
  • 描述基于固定版本的仓库证据。

DSHub 已核对

  • 证据中固定了源码仓库 commit。

DSHub 未核对

  • 本次未测试运行时安装、执行和兼容性。
  • 不表示任何安全认证。

固定版本安装

主要操作

这个独立 Skill没有 DSH Plugin 安装操作,请根据源码文档使用真实交付方式。

访问源码项目

维护者原文

Skill 使用说明

查看 commit effbc05 对应的 SKILL.md
维护者编写的上游内容原文于 2026/8/29.agents/skills/dsh-merging-stacked-prs/SKILL.md 获取,正文和仓库相对媒体固定到 commit effbc051049c,内容哈希为 1c3164317782。以下是未经 DSHub 翻译的上游原文,语言可能与当前页面不同;第三方托管的 badge 可能独立更新。

name: dsh-merging-stacked-prs description: Use when landing a stack of dependent GitHub PRs (A ← B ← C, where each bases on the one below) onto master, merging a PR whose base is another open PR's branch, or whenever a request mentions "stacked PRs", "PR stack", "dependent PRs", or merging several related PRs in sequence. Requires every same-repository dependency chain to use GitHub's official stacked-PR feature before landing so GitHub owns stack-wide rules, CI, ordering, retargeting, and merge state.

Landing an official GitHub PR stack

Land dependent PRs through GitHub's native stack object and gh stack merge. Do not reproduce stack semantics by merging and retargeting individual PRs with gh pr merge and gh pr edit. The root AGENTS.md owns the allowed merge-forward and rebase histories; the stack review guide owns review-fix propagation.

Require native stack support

Run gh stack --version before changing GitHub state. Hard-stop if the official extension or server-side stack feature is unavailable; do not fall back to manually merging and retargeting PRs one at a time. GitHub stacks require every head branch to live in the same repository, so hard-stop on a cross-fork chain.

Use a clean dedicated worktree. Fetch current PR metadata and exact head OIDs rather than trusting branch names or an earlier report:

gh pr view <pr> --json number,author,baseRefName,baseRefOid,headRefName,headRefOid,isCrossRepository,state,isDraft,reviewDecision,mergeStateStatus,statusCheckRollup

Query PullRequest.stack and stackEntry.position for at least one PR in each apparent chain; this official GitHub object, not base-branch inference alone, is the stack-membership authority. Paginate entries when size exceeds the returned page:

gh api graphql -F owner=<owner> -F name=<repo> -F number=<pr> -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      number
      author { login }
      baseRefName
      headRefName
      stackEntry { position }
      stack {
        number
        baseRefName
        size
        entries(first: 100) {
          nodes {
            position
            pullRequest { number author { login } baseRefName headRefName state isDraft }
          }
        }
      }
    }
  }
}'

Establish the expected bottom-to-top order from the live PR bases: the bottom targets the trunk, and each higher PR targets the head branch immediately below it.

Link missing stack members

First compare any existing stack entries with the expected chain. One existing stack may contain an order-preserving subset of the requested chain; multiple stack numbers, an unexpected entry, or a conflicting order requires user direction before any mutation.

When any dependent PR is not yet in that official stack:

  1. Compare every author.login exactly.
  2. If all authors match, link the chain automatically in bottom-to-top order:
gh stack link --base <trunk> <bottom-pr> <next-pr> ... <top-pr>
  1. If authors differ or any author is unavailable, ask the user whether to link before changing GitHub state.
  2. Re-query GraphQL and require one stack number, the expected trunk, the complete PR set, and the expected positions and base chain.

Never dissolve, reorder, or rebuild an existing stack automatically; gh stack link is additive and merged or queued entries cannot be unstacked.

Refresh only when needed

Do not rewrite branches merely because a refresh mechanism exists. When the live merge state or repository rules require an updated trunk, choose either allowed history:

  • Native cascading rebase: check out the remote stack with gh stack checkout <pr-or-stack> when it is not tracked locally, then run gh stack sync. The command may rebase and lease-protected force-push every active layer before local validation. Immediately inspect the rewritten scope, run the relevant checks for every affected layer, and do not merge or claim readiness until they pass. If sync detects a rebase conflict, use gh stack rebase, resolve and validate it, then publish with gh stack push. If checkout or sync reports divergent local and remote stack compositions, cancel and ask rather than deleting or recreating the remote stack automatically.
  • Incremental merge-forward: merge the trunk into the bottom affected branch, then propagate each updated parent into its child in bottom-to-top order and push normally. If the base advances during an in-progress merge, preserve that checkpoint before merging the newer tip as specified by the incremental-retargeting note.

Any history rewrite is allowed after review, but it invalidates commit-OID assumptions. Re-fetch exact heads and re-audit unresolved review threads, approvals, mergeability, and checks after the push. Never use raw --force or overwrite a concurrently advanced remote head.

Preflight the merge range

Re-query the official stack immediately before merging. Require every selected PR to be open, non-draft, in the expected order, and compliant with the repository's review and check requirements. Treat each PR's state independently; a ready top layer does not prove its dependencies are ready.

"Land the stack" selects the whole stack. A partial landing requires an explicit boundary PR and includes every layer from the bottom through that boundary.

Merge through the stack API

Merge the whole stack by its official stack number:

gh stack merge <stack-number> --yes --merge

For an explicitly requested partial landing, merge through the boundary PR:

gh stack merge <boundary-pr> --yes --merge

Do not pass --delete-branch, manually retarget dependents, or issue per-PR merge commands. GitHub merges the selected range bottom-up and retargets/rebases any remaining upper layers. A direct stack merge is all-or-nothing; when the trunk uses a merge queue, GitHub queues the selected range together but may land it in separate groups.

Do not bypass merge requirements. If the native merge reports a blocker, inspect and resolve that blocker through the owning PR or stop and report it; never fall back to gh pr merge.

Verify the landed state

Wait for every selected PR to report MERGED; a queued request is not a completed landing:

gh pr view <pr> --json number,state,mergedAt,mergeCommit,baseRefName,headRefName

For a partial landing, re-query the official stack and verify that every remaining PR is still linked in the expected order and targets the stack trunk or the layer below it. Re-check current heads, review state, and CI because GitHub may have rebased the remaining layers.

Delete branches only in a separate final pass after the corresponding PRs report MERGED. Before deleting each branch, require GitHub to report no open PR still using it as a base:

gh pr list --state open --base <branch> --json number --jq length

Anything other than 0 blocks deletion.

Checklist

  • Native gh stack support is available; every PR branch is in the same repository.
  • Live PR bases and exact heads establish one bottom-to-top dependency chain.
  • GraphQL reports one official stack with the expected trunk, entries, and order; an eligible same-author unstacked chain was linked automatically.
  • Any rewritten layers passed relevant validation, and review threads, approvals, mergeability, and checks were re-audited afterward.
  • The whole stack, or an explicitly bounded prefix, was submitted through gh stack merge --yes --merge.
  • Every selected PR reports MERGED; any remaining upper layers still form the expected official stack.
  • Branch deletion happened only after merged-state and zero-dependent verification.

有意识地管理

安装与管理

前置条件与目标 Profile

目标 没有原生 DSH Profile 目标。

交付方式 Skill 文件 — https://github.com/hust-open-atom-club/oh-dsh

兼容性与访问范围

not_runtime_tested not tested

检查兼容性证据

风险事实

installer-risk

A destructive recursive-delete pattern was detected in the installer script; do not run it without human review.

证据
installer-risk

A destructive recursive-delete pattern was detected in the installer script; do not run it without human review.

证据
installer-risk

A destructive recursive-delete pattern was detected in the installer script; do not run it without human review.

证据
distribution-signal

The npm distribution signal is incomplete or differs from the pinned source; review it before use.

证据
distribution-signal

The npm distribution signal is incomplete or differs from the pinned source; review it before use.

证据
distribution-signal

The npm distribution signal is incomplete or differs from the pinned source; review it before use.

证据
证据与编辑审查Manifest、Bundle patch、分发与新鲜度

不可变证据

审查状态与源码活动

人工已批准

在核对来源内容和不可变发布记录后,已由人工批准发布。AI 参与了内容草稿生成,最终发布决定由人工完成。

人工审查于 2026/8/29 UTC 15:26GitHub 事实核对日期: 2026/8/29 UTC 15:11

自当前证据基线以来,没有记录到重要源码变化。

下一步

比较生态 Artifact 类型

订阅重要变化: dsh-merging-stacked-prs