feat(sc-git-worktree): stack-aware worktree creation (0.14.0) - #110
Merged
Merged
Conversation
New `sc-worktree-create-stacked` agent and `--create-stacked <layer> <parent> <trunk> [--above <layer>]`: cut a gh-stack layer from the parent's PUSHED head with --no-track, refuse bad cuts before any mutation (layer exists, parent not pushed / landed / off trunk, insert target not stacked on the parent), record parent_sha in tracking, and return a stack_handoff block (push, PR base, link or mid-stack insert sequence, writer rules) for the agent that works in the worktree. The plain create agent is untouched; the skill and command route stack layers to the new agent. Cleanup/abort refuse to delete a branch that live layers were cut from unless git shows a merge commit landing (STACK.HAS_CHILDREN, batch `stack_blocked`). Scan reports stack_parent_advanced / stack_parent_landed on layer rows. Fixes: remote-ref bases no longer become the new branch's upstream (--no-track); merge detection recognises the `+` marker for branches checked out in other worktrees. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
randlee
added this pull request to stack #111
September 23, 2026 05:56
…handoff and guards - stack_handoff split by role: `writer` (WIP commit first, push -u, one rebase rule, no gh stack write commands) and `stack_writer` (PR with base = parent, gh stack checkout in the new worktree, link on top, or the insert sequence with merge-forward by EVERY layer above) - STACK.PARENT_HAS_CHILD: refuse an append onto a parent that already has a live layer - find_stack_children checks liveness against git/filesystem and treats the layer an inserted layer sits under (`stack.above`) as its child; is_landed_by_merge fails closed when its first-parent window is exhausted - cleanup judges landing against origin/<children's trunk>, only when children exist; batch cleanup never sweeps a fresh layer with no commits; actionable reconcile hints - scan: parent_advanced now means "layer does not contain origin/<parent>" (clears after the writer's rebase or a merge-forward); landed recommendation adds the diff-before-reset rule - shell-safe handoff commands (quoted heredoc PR body, quoted paths) - docs aligned (agent, reference, skill, command, changelog); sc-gh-stack recipe-cut-layer points at --create-stacked (sc-gh-stack 0.1.1) - tests: 42 real-git stack tests; package tests added to local pytest testpaths Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Parent: refactory @ 75fd333
Task: make /sc-git-worktree stack-aware with surgical changes (no redesign)
Fence: packages/sc-git-worktree/**, tests/test_sc_prefix_validation.py, registries
What
sc-worktree-create-stackedagent +--create-stacked <layer> <parent> <trunk> [--above <layer>]: cuts a gh-stack layer fromorigin/<parent>with--no-track, validates the cut before any mutation, recordsparent_sha, returns astack_handoff(push, PR base, link / mid-stack insert sequence, writer rules) to paste into the worker agent's prompt.sc-worktree-createagent untouched; SKILL.md and the command route stack layers to the new agent.STACK.HAS_CHILDRENguard (batchstack_blocked) unless git shows a merge-commit landing.stack_parent_advanced/stack_parent_landedissues + recommendations.stackmetadata; old rows load unchanged.references/stack-layers.mddocuments the worktree side of the stack model and the writer contract.Fixes to the stable skill
--no-track), sogit push/--force-with-leasecannot target the base.is_branch_mergednow strips git's+marker for branches checked out in other worktrees; single-branch cleanup of a landed branch that still has a worktree no longer reports it unmerged.Verification
packages/sc-git-worktree/tests: 165 passed (32 new real-git tests intest_stack_aware.py).scripts/validate-all.py: 9/9 PASS.Stacked on #84 (refactory); trunk develop.
🤖 Generated with Claude Code