Interactive stack picker for checkout#179
Open
skarim wants to merge 3 commits into
Open
Conversation
Running `gh stack checkout` with no argument previously showed a plain text prompt of locally tracked stacks only. It could not surface stacks that exist only on the remote, gave no sense of a stack's state, and listed fully merged stacks that can no longer be added to. Replace it with an interactive picker (new package internal/tui/checkoutview) that lists every stack available to you, reconciling the local stack file with the Stacks REST API: - Merges local and remote stacks, matched by stack id/number, and labels each Local (present locally, even if also tracked on the remote) or Remote (only on GitHub). Fully merged stacks are filtered out. - Shows compact columns: stack number, first...last branch, base branch, a muted status bar summarizing merged/open/closed/unpushed PRs, type, and relative created time. - Offers All / Local / Remote tabs and `/` type-to-filter search. The picker renders inline rather than taking over the screen: it shows up to ten rows with a scroll indicator, shrinks to fit short terminals, and clears itself on exit. Selecting a locally available stack checks out its top unmerged branch; selecting a remote-only stack clones it down through the existing checkout-by-number import flow. When the Stacks API is unavailable (stacks not enabled, no auth, or a network error), the picker degrades gracefully to a local-only list. Also update the README, overview, and CLI reference for the new behavior.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an inline, searchable checkout picker combining local and remote stacks.
Changes:
- Reconciles local and remote stacks, filtering fully merged stacks.
- Supports tabs, search, scrolling, status summaries, and remote cloning.
- Adds picker tests and updates checkout documentation.
Show a summary per file
| File | Description |
|---|---|
README.md |
Documents the picker workflow. |
cmd/checkout.go |
Integrates picker and selection routing. |
cmd/checkout_picker_test.go |
Tests checkout picker integration. |
docs/src/content/docs/reference/cli.md |
Updates CLI reference. |
docs/src/content/docs/introduction/overview.md |
Updates checkout overview. |
internal/tui/checkoutview/data.go |
Builds reconciled picker rows. |
internal/tui/checkoutview/data_test.go |
Tests row reconciliation. |
internal/tui/checkoutview/model.go |
Implements picker interaction and rendering. |
internal/tui/checkoutview/model_test.go |
Tests picker behavior. |
internal/tui/checkoutview/styles.go |
Defines picker styling and status bars. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 7
- Review effort level: Medium
Lukeghenco
reviewed
Jul 14, 2026
|
|
||
| ``` | ||
| gh stack checkout [<pr-number> | <pr-url> | <branch>] | ||
| gh stack checkout [<stack-number> | <pr-number> | <pr-url> | <branch>] |
Lukeghenco
approved these changes
Jul 14, 2026
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 stack-number work: now that we can list every stack in a repo and reference each by its number,
gh stack checkoutgets a much better no-argument experience. Previously it showed a plain text prompt of your locally tracked stacks only — it couldn't surface stacks that live only on the remote, gave no sense of a stack's state, and listed fully merged stacks you can no longer add to. This replaces that prompt with an interactive picker that reconciles your local stacks with the ones on GitHub.What's new
gh stack checkoutwith no argument opens a picker that renders in place over a few lines and clears itself on exit, rather than taking over the whole screen..git/gh-stack) are merged with the repo's stacks from the Stacks REST API, matched by id/number, and labeled Local (available locally, even if also tracked on the remote) or Remote (only on GitHub)./to type-filter. Search matches the stack number, the base, and any branch in the stack — including mid-stack branches that aren't shown in the column.Up to ten rows are shown at once with a scroll position indicator, and the list shrinks to fit shorter terminals.
Changes
Add an interactive stack picker for checkout
internal/tui/checkoutview/(new package) —data.goreconciles local and remote stacks into the picker's rows (Local/Remote labeling, status counts, merged-stack filtering, sorting);model.gois the Bubble Tea model (inline rendering, tabs,/search, scrolling, selection, clear-on-exit);styles.goholds the table and status-bar styling.cmd/checkout.go— the no-argument path now fetches remote stacks (best-effort), builds the rows, launches the picker, and routes the selection (local checkout vs. remote clone-by-number), falling back to a local-only list when the API is unavailable. Updated the command help text.README.md,docs/CLI reference and overview — document the new picker.Search by entire branch list
internal/tui/checkoutview/{data,model}.go— each row now carries every branch name in the stack (not just the shown first/last), and the search haystack includes them all, so a mid-stack branch matches even though it isn't displayed.Testing
cmdwiring (remote fetch + local-only fallback, and local vs. remote selection routing).go test -race ./...,go vet ./..., andgofmtare clean, and each of the two commits builds and passes tests independently.Stack created with GitHub Stacks CLI • Give Feedback 💬