Remote unstack by stack number#180
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds remote-first unstacking by stack number while reconciling local tracking when available.
Changes:
- Adds remote-only unstack handling and API error mapping.
- Refactors local stack-number lookup and legacy backfilling.
- Updates tests and user/agent documentation.
Show a summary per file
| File | Description |
|---|---|
cmd/unstack.go |
Implements tracked and remote-only paths. |
cmd/utils.go |
Adds quiet local stack lookup. |
cmd/unstack_test.go |
Covers remote-only outcomes. |
README.md |
Documents numbered unstacking. |
docs/src/content/docs/reference/cli.md |
Updates CLI reference. |
docs/src/content/docs/faq.md |
Updates unstack guidance. |
skills/gh-stack/SKILL.md |
Updates agent instructions. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 5
- Review effort level: Medium
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 stack unstackpreviously required the target stack to be tracked locally — running it on a stack number that wasn't checked out locally failed withstack #N is not tracked locallyand never reached the API. This PR makesunstack <number>a remote-first operation (likegh stack link): the stack is unstacked directly through the GitHub API by its number, from anywhere in the repository, whether or not it's tracked locally. When the stack is also tracked locally, its local tracking is removed as well.Behavior
<stack-number>tracked locally (unchanged) — unstacks on GitHub and removes local tracking.<stack-number>not tracked locally (new) — unstacks on GitHub by number, no local checkout required. A number that doesn't exist on GitHub reportsstack #N not found on GitHub(exit 2).--local(unchanged) — only removes local tracking and never contacts GitHub; combining it with a number that isn't tracked locally is an error.Changes
cmd/utils.go— replaceloadStackByNumberwith a quietlookupStackByNumberthat reports "not tracked locally" without erroring, so the caller can fall back to the API (legacy-id backfill preserved).cmd/unstack.go— splitrunUnstackinto a locally-tracked path and a remote-only path (runRemoteUnstack), sharing one Unstack API call and error mapping. A404is an idempotent success when there's local tracking to clean up, but a hard error in remote-only mode.README.md(which never documented the<stack-number>argument),docs/src/content/docs/reference/cli.md,faq.md, andskills/gh-stack/SKILL.md.Testing
cmd/unstack_test.go: replaced the old "not tracked → fail" test with remote-only cases for dissolved,404, partial (200),422, and--localon an untracked number; the local-path tests are unchanged.go test -race -count=1 ./...andgo vet ./...are clean, and the changed files passgofmt.Stack created with GitHub Stacks CLI • Give Feedback 💬