Skip to content

feat(ce-pr-stack): stacked PR support foundation (Layer 1/3)#559

Draft
tmchow wants to merge 8 commits intomainfrom
feat/gh-stack-foundation
Draft

feat(ce-pr-stack): stacked PR support foundation (Layer 1/3)#559
tmchow wants to merge 8 commits intomainfrom
feat/gh-stack-foundation

Conversation

@tmchow
Copy link
Copy Markdown
Collaborator

@tmchow tmchow commented Apr 14, 2026

⏸ Blocked on gh-stack GA — Draft pending upstream availability

Current status: This PR is parked as a draft. GitHub's gh stack CLI extension is currently in private preview and is not enabled on this repository. The code in this PR is architecturally complete and ready to ship when gh stack becomes broadly available, but it cannot be validated end-to-end or released in its current state.

What's split out and shipping now: The ce-pr-description skill extraction from this stack has been cherry-picked into a standalone PR (#561) since it is architecturally independent and valuable regardless of gh stack availability.

What to do when gh stack ships: Re-evaluate the plan, update the CLI surface against any changes between private preview and GA, validate against a real stack, and move this PR (and #560) out of draft.


Summary

First of three stacked PRs introducing stacked-PR support to the compound-engineering plugin via GitHub's gh stack CLI extension. This layer is the foundation: plan, detection, and the new ce-pr-stack skill. No stable skills are modified in this layer — that's Layer 2 (PR #560).

What's in this layer

  • Plan (docs/plans/2026-04-14-001-feat-gh-stack-stacked-pr-support-plan.md) — 10-unit implementation plan with two-stage effectiveness test grounded in SmartBear/Cisco + Rigby & Bird data, governing principle that respects prior user decisions within a session, and the full gh-stack CLI surface verified against the installed extension at the time of writing.
  • ce-setup integrationgh-stack added as a recommended dependency. Detection uses gh extension list and skips gracefully when gh itself is missing.
  • stack-detect script — deterministic shell script emitting labeled signal sections (=== TOOL ===, === STACK_STATE ===, === CHANGE_SUMMARY ===, === COMMIT_LOG ===). No judgments — those belong to the model.
  • ce-pr-stack skill (SKILL.md) — decompose a branch into stacked PRs. Scope is decomposition only; shipping is handed off to git-commit-push-pr. Consent routing relies on the governing principle rather than structured caller-side flags.
  • Splitting workflow reference — three-phase decomposition (analyze → propose layers → create locally), ending with handoff to git-commit-push-pr. Rollback protocol bounds failure blast radius to local state.

Stack context

Related shipping PR

Naming

The new skill is ce-pr-stack, not git-stack. Stacking is a GitHub feature (gh-stack extension + GitHub's stack UI), not a git feature. The ce- prefix matches the future convention for plugin skills.

Dogfooding and lessons

  • gh stack init --adopt worked cleanly on an existing branch
  • gh stack push cascades correctly; gh stack submit --draft --auto creates PRs
  • Caveat: auto-generated PR titles from gh stack submit --auto do NOT match conventional-commit format, causing the repo's pr-title CI check to fail on first submit. Current workaround: gh pr edit + gh run rerun after every gh stack submit --auto. This is the exact flow Unit 6's stack-aware ship automates.
  • Caveat: gh stack submit surfaces ⚠ Stacked PRs are not enabled for this repository — the GitHub-side stack UI (native stack navigator) requires admin enablement; without it, PRs are linked via base branches instead of the navigator. No public API probes this enablement state before submit.

Test plan

Run these once gh stack is enabled on the repo:

  • bash plugins/compound-engineering/skills/ce-setup/scripts/check-health includes gh-stack with correct tier
  • bash plugins/compound-engineering/skills/ce-pr-stack/scripts/stack-detect main on this branch emits all four sections with accurate data
  • bun test tests/frontmatter.test.ts passes
  • bun run release:validate clean
  • Invoke /ce-pr-stack on a real feature branch; verify the three-phase decomposition runs to completion and hands off correctly

Stack created with GitHub Stacks CLIGive Feedback 💬

🤖 Generated with Claude Code

tmchow and others added 6 commits April 14, 2026 09:53
Covers retroactive splitting, shipping-time suggestion, and
detection across ce-setup, git-commit-push-pr, ce-work, and a
new git-stack skill. Reviewed by 5 document-review personas
with 12 auto-fixes and 7 judgment findings addressed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ciple

Added Unit 7 (stack-aware resolve-pr-feedback), Unit 8 (ce:plan stack-
candidacy assessment), renumbered README unit to Unit 9. Replaced the
files+lines+concerns heuristic with a two-stage effectiveness test
(size/spread hint then independence/divergence/sequencing/mixed-kinds
signals) grounded in SmartBear/Cisco, Rigby & Bird, and practitioner
consensus. Added "Respect prior user decisions within the session" as
a governing principle. Corrected the gh-stack CLI surface against the
installed extension (added rebase, sync, merge, view, checkout, etc.
— the plan previously listed status which does not exist). Documented
offer-and-run install across all touchpoints.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Detection uses gh extension list because gh-stack is a gh CLI extension,
not a standalone binary. The check-health loop now handles gh-* entries
specially and skips them gracefully when gh itself is missing, avoiding
confusing "install gh extension" messaging in that case.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ysis

Emits parseable signals about gh-stack availability, current branch's
stack-membership state, and change summary vs a base branch. Supports
--mock and STACK_DETECT_MOCK for testing without a real stack. Reports
signals only — no "should stack" judgments, which belong in consuming
skills per the plan's governing principle.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Handles two operational modes (split to decompose a branch into stacked
PRs, manage to drive an existing stack via gh stack commands) with three
invocation flavors (manual, delegated, auto-invoked). Auto-invocation
runs an effectiveness-test gate before proposing a split; manual and
delegated entries go straight to layer proposal, which remains the
second gate for all modes. Availability gate offers to install gh-stack
and runs the command on consent, honoring the session-level governing
principle that respects prior user decisions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion

Four-phase workflow for decomposing a feature branch into stacked PRs:
analyze (commit-based grouping as V1 strategy), propose layers with
mandatory user approval, create the stack locally using gh stack init
and gh stack add, submit via gh stack push plus gh stack submit. The
rollback protocol separates local construction from remote submission
so failures stay local. Workflow content verified against the installed
gh-stack CLI via --help on each command referenced.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tmchow tmchow changed the title feat/gh stack foundation feat(git-stack): stacked PR support foundation (Layer 1/3) Apr 14, 2026
tmchow and others added 2 commits April 14, 2026 14:57
…ecomposition skill

Renames git-stack to ce-pr-stack — stacking is a GitHub feature, not a git
feature, and the ce- prefix matches the future convention for plugin skills.

Restructures responsibilities:
- ce-pr-stack: decomposition only (analyze + propose + create layers locally).
  Manage mode removed; pure pass-throughs to gh stack commands do not warrant
  a skill wrapper.
- git-commit-push-pr: single ship path for both monolithic and stacked cases,
  with four explicit routing cases (already in stack, suggest stacking,
  offer install, monolithic). Absorbs what was previously a duplicate submit
  phase in ce-pr-stack.
- ce-pr-description (new Unit 5): focused skill for PR description writing,
  invoked by git-commit-push-pr for each PR created or updated.

Drops the three-flavor invocation enumeration (manual/delegated/auto-invoked)
and the delegated: true flag. Consent routing now relies on the governing
principle that respects prior user decisions within the session — agent
context awareness handles it without structural signal plumbing.

Adds the --plan input for ce-pr-stack so ce:work's Phase 4 shipping delegation
can pass plan-unit boundaries as primary signal for candidate layers.

Adds R10 (ce-pr-description) and renumbers Units 5-10. Updates Requirements
Trace, Key Technical Decisions, System-Wide Impact, and Risks tables for
the new architecture.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Renames the skill directory to match the plan's architectural reshape.
Stacking is a GitHub feature (gh-stack extension, GitHub's stack UI),
not a git feature, and the ce- prefix matches the future convention
for plugin skills.

Narrows scope to decomposition only:
- Removes manage-mode operations. Push and submit are owned by
  git-commit-push-pr now that it is stack-aware. Rebase, sync, view,
  and navigation commands are one-line pass-throughs to gh stack with
  no skill-scale value — invoked directly when needed.
- Removes the three-flavor invocation enumeration (manual / delegated
  / auto-invoked). Consent routing relies on the governing principle
  that respects prior user decisions within the session, rather than
  structured caller-side flags.
- Drops the delegated / stacking_declined / gh_stack_install_declined
  signal plumbing from the SKILL.md. Agent context awareness is the
  primary mechanism; the principle is documented at the bottom.

Narrows the CLI surface section: init, add, view, unstack --local for
rollback. Ship commands (push, submit) moved to git-commit-push-pr.

Rewrites splitting-workflow reference file: four phases collapsed to
three. Removes the submit phase entirely; phase 3 ends with a handoff
to git-commit-push-pr, which then runs gh stack push + gh stack
submit + per-PR description generation via ce-pr-description. Separating
decomposition from shipping bounds failure blast radius to local state.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tmchow tmchow changed the title feat(git-stack): stacked PR support foundation (Layer 1/3) feat(ce-pr-stack): stacked PR support foundation (Layer 1/3) Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant