Stack number as primary identifier#178
Open
skarim wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Makes repository-scoped stack numbers the CLI’s primary stack identifier and surfaces them across commands and TUIs.
Changes:
- Adds checkout and unstack targeting by stack number.
- Persists and displays stack numbers in command output and TUIs.
- Updates tests, documentation, and agent guidance.
Show a summary per file
| File | Description |
|---|---|
cmd/checkout.go |
Resolves numeric targets as stack numbers first. |
cmd/checkout_test.go |
Tests checkout by stack number. |
cmd/link.go |
Adds stack numbers to success output. |
cmd/submit.go |
Passes and prints stack numbers. |
cmd/unstack.go |
Adds optional stack-number targeting. |
cmd/unstack_test.go |
Tests targeted unstack behavior. |
cmd/utils.go |
Adds stack-label and number lookup helpers. |
cmd/view.go |
Displays stack numbers in views. |
internal/tui/stackview/model.go |
Adds stack numbers to the header. |
internal/tui/stackview/model_test.go |
Tests stack-view headers. |
internal/tui/submitview/model.go |
Stores the stack number in TUI state. |
internal/tui/submitview/render.go |
Renders numbered submit headers. |
internal/tui/submitview/screen.go |
Adds the number to the timeline label. |
internal/tui/submitview/model_test.go |
Tests numbered submit UI elements. |
docs/src/content/docs/reference/cli.md |
Documents stack-number commands and output. |
docs/src/content/docs/getting-started/quick-start.md |
Removes obsolete authentication guidance. |
skills/gh-stack/SKILL.md |
Documents stack-number workflows for agents. |
AGENTS.md |
Updates API and stack identity guidance. |
.github/copilot-instructions.md |
Updates GitHub client interface guidance. |
Review details
- Files reviewed: 19/19 changed files
- Comments generated: 6
- Review effort level: Medium
checkout now interprets a bare integer as a stack number first (the identifier shown in the github.com stack UI), falling back to a locally tracked PR number, then a PR number discovered from GitHub, then a branch name. A new checkoutStackByNumber resolves the stack via GetStack and checks out its top-most unmerged branch; the reconcile/import logic is shared with the PR-number path. unstack gains an optional <stack-number> positional argument to unstack a specific locally tracked stack instead of the current one. Copilot-Session: 03673c26-a245-42da-93ed-dfcebc92a740
Show the human-facing stack number wherever it is known: - Append a "(stack #N)" label to submit, link, checkout, and unstack success messages. - Add a "Stack #N" header line to the view command (short and static) and the stackview TUI header. - Add a "Stack #N" info line to the submit TUI header when submitting an already-created stack. Copilot-Session: 03673c26-a245-42da-93ed-dfcebc92a740
- cli.md: document checkout/unstack by stack number and drop the "PATs are not supported" note (any gh-authenticated user can now run stack operations). - quick-start.md: drop the PAT-not-supported note. - AGENTS.md / copilot-instructions.md: ClientOps is now 13 methods over the public Stacks REST API; remove the TokenForHostFn test hook; note the stack file's id/number identity. - SKILL.md: add checkout/unstack-by-stack-number quick references. Copilot-Session: 03673c26-a245-42da-93ed-dfcebc92a740
95ae5d1 to
ec712bc
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.
Builds on the Stacks REST API migration and newly available stack number. Now that the API exposes each stack's number (the repo-scoped identifier shown in the GitHub stack UI) this makes it the primary way to reference a stack in the CLI and surfaces it throughout the output and TUIs.
What's new
gh stack checkout <stack-number>. A bare number is now interpreted first as a stack number, falling back — in order — to a locally tracked PR number, a PR number whose stack is discovered from GitHub, and finally a branch name. Existing PR-number, PR-URL, and branch-name usage is unchanged.gh stack unstack [<stack-number>]. An optional positional argument targets a specific locally tracked stack instead of the current one.submit/link/checkout/unstacksuccess messages, e.g.Created stack with 3 PRs (stack #42),Stack #Nline ingh stack viewand the stack-view TUI header,Stack #N • repoheader line and aSTACK #Nlabel on the left-panel timeline.The number is persisted in the tracking file (
.git/gh-stack) and backfilled from the API for stacks created before it was tracked.Changes
Support addressing a stack by its stack number
cmd/checkout.go— interpret a bare numeric argument as a stack number first (resolved viaGetStack), then fall back in order to a locally tracked PR number, a PR number discovered from GitHub, and a branch name; check out the stack's top-most unmerged branch.cmd/unstack.go,cmd/utils.go— add the optional<stack-number>argument and a helper that loads a locally tracked stack by its number.Surface the stack number in output and TUIs
cmd/{submit,link,checkout,unstack,view}.go,cmd/utils.go— append a(stack #N)label to the success messages and add aStack #Nline togh stack view.internal/tui/stackview/model.go,internal/tui/submitview/{model,render,screen}.go— show the number in the stack-view and submit TUI headers, plus aSTACK #Nlabel on the submit timeline's left panel.Update docs and agent instructions for the new API
docs/CLI reference and quick-start,AGENTS.md,.github/copilot-instructions.md, andskills/gh-stack/SKILL.md— document checkout/unstack by stack number and drop the now-removed PAT note.Testing
go test -race ./...,go vet ./..., andgofmtare clean, and each of the three commits builds and passes tests independently.Stack created with GitHub Stacks CLI • Give Feedback 💬