feat(cli): link gh-stack worktrees and check them in doctor - #67
Open
lettertwo wants to merge 9 commits into
Open
feat(cli): link gh-stack worktrees and check them in doctor#67lettertwo wants to merge 9 commits into
lettertwo wants to merge 9 commits into
Conversation
lettertwo
force-pushed
the
gh-stack-linking-doctor
branch
from
August 28, 2026 03:13
1d9562d to
eb21ab1
Compare
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.
gh stackwrites one JSON file per git dir, which for a linked worktree is<common-dir>/worktrees/<name>/gh-stack. A stack created in one worktree is invisible from everyother one, which breaks
list, routing, and changeset assembly. Upstream's ownskills/gh-stack/SKILL.mdsays the local file "would be wrong or absent" for worktree workflows.This PR makes
<common-dir>/gh-stackthe one canonical store, withlink_worktreesymlinkinggh-stackandgh-stack.lockinto each worktree's admin dir.gh-stack-rebase-stateandgh-stack-modify-statestay per-worktree, since sharing them would make every other worktreebelieve it is mid-rebase.
migrate_worktreemoves a pre-existing real file into canonical with abackup, and
doctor --fixcalls it.doctorgainsGhStackWorktreeNotLinked,GhStackDivergentStacks,GhStackNotInitialized,GhStackExtensionNotFound,GhStackFileUnreadable,GhStackLocked, andBothStackToolsDetected.The Graphite-specific stack errors become provider-neutral.
docs/adr/028-provider-neutral-stack-metadata.mdcovers why the symlinks work and whyread_metadatakeeps a union fallback for worktrees that drift out of the linked state, under "Theshared canonical file" and the two sections after it. The claims about upstream's
SaveandLockare quoted there with file references.
Acceptance-tested against a copy of this repo's real 33-branch gh-stack file:
doctor --fixmigrated it preserving all 33 branches, every
baseSHA, the trunk, andrepository, andgh stack view --jsonthen parsed the workon-written file from two worktrees.Testing: 630 tests, clippy clean.
Stack created with GitHub Stacks CLI • Give Feedback 💬