Repository navigation
feat(claude-code): bake gh-stack extension and add stacked-PRs skill - #167
Merged
Merged
Conversation
Agents in claude-code containers fell back to hand-chaining PRs with `gh pr create --base`, which GitHub cannot merge atomically. Native stacks need the github/gh-stack extension, but a runtime `gh extension install` writes to ~/.local/share/gh on the container overlay (only ~/.config/gh is a volume), so it vanished on every rebuild. A runtime install is also likely blocked by the sandbox firewall (release-assets.githubusercontent.com). - Install gh-stack at build time as node in both the claude-code image (default + sandbox, via base) and the repo-root devcontainer. The install works unauthenticated. Pinned via GH_STACK_VERSION with a renovate annotation, grouped with the other devcontainer tools (3-day soak). - Assert `gh stack --version` in the PR-time and post-build verify steps. `gh extension list` is not usable there: it requires gh auth. - Add a stacked-prs skill: gh stack init/add/submit for new work, link for existing PRs, merge <pr> --yes for atomic merges, the non-interactive flags, and never hand-chain --base PRs. Track it in the devcontainer-upstream-sync manifest (skill bumped to 1.2.0). - Document the extension, arg and skill in the READMEs. Fixes #160
# Conflicts: # .github/workflows/build-claude-code.yml # .github/workflows/ci.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Bakes the official
github/gh-stackgh extension into the claude-code images and the repo-root devcontainer, and adds astacked-prsskill that tells agents to use native stacked PRs.Why
Agents fell back to hand-chaining PRs with
gh pr create --base, and GitHub can't merge that kind of chain atomically. A runtimegh extension installwrites to~/.local/share/ghon the container overlay, and only~/.config/ghis a volume, so the extension disappears on every rebuild. Inclaude-sandboxthe firewall probably blocks the runtime install too. Installing at build time fixes both problems.Changes
Dockerfiles:
claude-code/.devcontainer/Dockerfile(inbase, so both default and sandbox get it) and the root.devcontainer/Dockerfilerungh extension install github/gh-stack --pin "v${GH_STACK_VERSION}"asnode.~/.local/share/ghwould hide the baked copy.Renovate:
GH_STACK_VERSIONgets a# renovate: datasource=github-releases depName=github/gh-stackannotation. The ARG holds the bare version, likeGH_VERSION, andextractVersionstrips thev.github/gh-stackjoins the "devcontainer tools" group, which auto-merges after a 3-day soak.CI:
gh stack --versionis added to the claude-code verify commands inci.yml(PR time) andbuild-claude-code.yml(post-build, amd64 and arm64, both variants).Skill: new
claude-code/.claude/skills/stacked-prs/SKILL.mdcovering:init/add/submit --autofor new worklink <bottom>…<top>for PRs that already existmerge <pr> --yesfor an atomic merge up to that PR--remotewhen there are several remotes--basePRsIt is named
stacked-prsso it doesn't clash with the upstreamgh-stackskill, which it points to. The skill is added to thedevcontainer-upstream-syncmanifest, and that skill goes to version 1.2.0.Docs:
claude-code/README.mdgets a What's Included row, the Automatic Rebuilds list, a skill section, the file tree and the Build Args table. The root README's Renovate paragraph also mentions gh-stack.Notes
gh extension installworks without authentication at build time. It was checked in a container from the published image with noGH_TOKEN(exit 0,gh stack --version→gh stack version 0.1.1). It does callapi.github.comwithout a token, so the 60 requests/hour per-IP rate limit applies during the build.gh stack --versionrather thangh extension list, becausegh extension listfails without gh auth..deb.hadolint2.12.0 (CI's version),actionlintandrenovate-config-validatorall pass, and the install and every skill command were checked in a container from the published image. CI's build-and-verify is the first full build.devcontainer-upstream-syncto1.2.0. Whichever merges second should bump to1.3.0.Fixes #160