Skip to content

feat(sc-gh-stack): stacked-PR skill from field lessons + sc-gh-stack-view (0.1.0) - #109

Merged
randlee merged 2 commits into
developfrom
feature/sc-gh-stack-v2
Sep 23, 2026
Merged

randlee merged 2 commits into
developfrom
feature/sc-gh-stack-v2

Conversation

@randlee

@randlee randlee commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Summary

Fresh sc-gh-stack package built from the atm-core gh-stack playbook (five production phases, stacks of 2 to 21 PRs). Replaces the earlier managing-gh-stacks attempt on #101, whose rules contradicted the field lessons; #101 and #107 are left for Rand to close.

Two skills in one package (one install guarantees the status tool is present):

  • sc-gh-stack (/sc-gh-stack): progressive-disclosure table of contents over references/:
    • model.md, workflow.md, preconditions.md: append-only linear stack on a named trunk, frozen layers, one writer per branch and one stack writer, QA/CI on the top only, every known failure encoded as a check with its incident.
    • Recipes: recipe-cut-layer, recipe-link (--base + full list; append shortcut), recipe-restack (insert, remove a red layer whose fix lives above, collapse the bottom), recipe-land (atomic gh stack merge <stack#> --yes --merge, merge-async fallback with the full 40-char SHA, non-linear fallback), recipe-stale-tracking (unstack --local + checkout).
    • commands.md, troubleshooting.md, stack-design.md, installation-and-troubleshooting.md: the gh stack v0.1.0 command guide carried over from the retired generic /gh-stack skill, with field-verified overrides and failure signatures.
    • phase-model-example.md: phase-bc as the worked example.
  • sc-gh-stack-view (/sc-gh-stack-view): atm-core's gh_stack_view.py ported; default view shows every open stack on any trunk.

Scripts are stdlib-only and read-only (one git fetch, skippable): gh_stack_view.py, gh_stack_chain_check.py (pre-link linear-ancestry / PR-base / clean-merge check that prints the exact link command), gh_stack_shared.py (timeouts, actionable hints for rate-limit/auth/network, never-a-traceback guard). Exit codes 0/1/2 everywhere.

Also in this PR: pytest.ini collects the package tests; requirements-dev.txt gains pypdf so the docling suite collects locally; ai-cli hook test fixtures call python3.

Review process

Three repo review agents (architecture, implementation, metadata) plus a hostile Opus final review against docs/claude-code-skills-agents-guidelines.md v0.7. All blocking findings fixed in the second commit (shell-unsafe #N link command, non-linear develop-stack recipe, inconsistent link rules, gh stack sync as an out-of-date remedy). Deliberate exceptions: skill names are sc-gh-stack / sc-gh-stack-view rather than gerunds (chosen name; matches the sc-git-worktree directory precedent); no [Unreleased] changelog heading for a first release.

Test plan

  • python3 -m pytest packages/sc-gh-stack/tests -q: 55 passed (mocked, real temporary-repo git, shell round-trip of the link command)
  • python3 scripts/validate-all.py: 9/9 validators pass; validate-hook-paths.py clean for this package
  • python3 -m pytest tests/ -q (CI job): 1392 passed
  • gh_stack_view.py and gh_stack_chain_check.py run against atm-core's live stacks (integrate/phase-bc), including an error path returning one actionable line with exit 2
  • Install into a scratch repo with sc-install and run /sc-gh-stack-view once on a real stack (first-use validation after merge)

🤖 Generated with Claude Code

randlee and others added 2 commits September 22, 2026 21:46
…ack-view (0.1.0)

Fresh package replacing the managing-gh-stacks attempt (PR #101). Two skills:

- sc-gh-stack: progressive-disclosure table of contents over references/ for
  the append-only stack model, lifecycle workflow, preconditions distilled
  from five production phases (link --base, frozen layers, one stack writer,
  QA/CI on the top, trunk freeze, no red-bottom-alone merges, full branches[]
  before scoped merges), and recipes for cut-layer, link, restack (insert,
  remove red layer, collapse bottom), land (atomic merge, merge-async and
  non-linear fallbacks) and stale per-worktree tracking; the gh stack v0.1.0
  command guide, troubleshooting signatures and stack-design guidance carried
  over from the retired generic gh-stack skill; a phase-model worked example.
- sc-gh-stack-view: atm-core's gh_stack_view.py ported (default view now
  shows every open stack on any trunk) with its regression tests.

Scripts are stdlib-only and read-only: gh_stack_view.py, gh_stack_chain_check.py
(pre-link linear-ancestry / PR-base / clean-merge check that prints the exact
link command), gh_stack_shared.py (timeouts, actionable hints, never-a-traceback
guard). 46 unit tests; registries regenerated at 0.1.0.

Also: pytest.ini collects the package tests; requirements-dev.txt gains pypdf
so the docling suite collects; ai-cli hook test fixtures call python3.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Blocking: chain check printed PR numbers as `#N` (a shell comment), now bare
numbers and no `next:` line unless LINKABLE; develop-stack recipe left PRs
unrebased (non-linear, unlandable), now chains with one merge-forward per
layer and runs the chain check; three inconsistent `link` rules unified
(full `--base` list is canonical, `link <stack#> <pr#>` appends only);
"out-of-date with base" remedy no longer suggests `gh stack sync`.

Should-fix: red layer is removed, never "landed as a pair"; fix tasks on
frozen layers route to a new top layer; land by stack number; insert requires
containment + chain check; collapse resets the rebased child; `--no-track`
on worktree add; `{owner}/{repo}` in gh api paths; stack-number recovery via
`gh stack checkout <pr#>`; view skill gets the full installation doc and
`$CLAUDE_PLUGIN_ROOT` script paths.

Scripts: skipped (unreadable) worktrees now exit 1 with LANDING unjudged;
unresolved PRs render as unknown instead of stale; fetch timeouts degrade to
unknown; behind-a-moved-trunk gets its own icon and downgrades needsRebase to
a note; pool capped at 4; actionable hints for rate-limit/auth/network; real
temporary-repo tests for merge-tree/is-ancestor and a shell round-trip test
for the link command (55 tests).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@randlee
randlee merged commit b063b85 into develop Sep 23, 2026
14 checks passed
randlee added a commit that referenced this pull request Sep 23, 2026
The nuget/.claude-plugin registries were stale post-merge (sc-ci-automation
still showed 0.12.0 despite its manifest being at 0.13.0, and sc-gh-stack
was missing after landing via PR #109). Regenerated from current manifests
with no manifest version changes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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