22 Commits

Author SHA1 Message Date
Sameen Karim dcb5885053 Skip pushing branches with queued PRs
Detect merge queue status via the GitHub GraphQL API's mergeQueueEntry
field and temporarily skip queued branches in push, sync, and submit
commands. Unlike merged state (which is persisted permanently), queued
state is transient — held in-memory only via a json:"-" tagged field
on BranchRef. Each command run re-checks queue status from the API, so
if a PR is ejected from the queue it becomes active again on next run.

Changes:
- Add MergeQueueEntry to PullRequest GraphQL struct and PRDetails
- Add IsQueued()/IsSkipped()/QueuedBranches() to stack model
- Update ActiveBranches() family to exclude queued branches
- Skip queued branches in push, sync (rebase + push), and submit
- Add queued icon, style, and QUEUED state label in TUI view
- Add comprehensive tests for queued state handling

Closes github/pull-requests#24019

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-09 08:24:36 -04:00
Sameen Karim 629ea06d70 non-blocking saves for non-critical writes 2026-03-25 21:21:26 -04:00
Sameen Karim 37e32a5137 only lock for writes 2026-03-25 20:39:48 -04:00
Sameen Karim 211e563d1f lock failure exit code 2026-03-25 20:06:18 -04:00
Sameen Karim e568d7f005 add file locking to prevent concurrent stack file edits 2026-03-25 19:14:00 -04:00
Sameen Karim f03f9f3335 fix: return early from sync on rebase conflict
When a rebase conflict was detected during 'gh stack sync', the function
continued to push branches and reported 'Stack synced' with exit code 0.
Now it persists PR state and returns ErrConflict immediately, preventing
the confusing post-conflict push and success message.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 15:13:13 -04:00
Sameen Karim 1304670224 flag to specify remote and bypass interactive prompt 2026-03-24 01:36:05 -04:00
Sameen Karim 260497643a exit codes by error type 2026-03-24 00:38:04 -04:00
Sameen Karim 1a1f49f2fb exit with nonzero status on error 2026-03-23 04:22:45 -04:00
Sameen Karim 426ad11175 wrap example commands in quotes for non TTY 2026-03-22 20:27:37 -06:00
Sameen Karim 24e18bd088 Handle SIGINT gracefully during interactive prompts
When Ctrl+C is pressed during a prompter interaction, the CLI now prints
a friendly 'Received interrupt, aborting operation' message instead of
ugly wrapped errors like 'failed to read prefix: could not prompt:
interrupt'.

Changes:
- Add isInterruptError(), printInterrupt(), and errInterrupt sentinel
  to cmd/utils.go for centralized interrupt detection
- Update all 8 prompt sites (init, push, checkout, utils) to detect
  survey's terminal.InterruptErr and exit cleanly
- Update callers of resolveStack, pickRemote, and ensureRerere to
  propagate interrupt without double-printing errors
- Change ensureRerere signature to return error so callers can abort
  on interrupt
- Add tests for interrupt detection helpers

Closes td-746bdc

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-22 20:26:26 -06:00
Sameen Karim 7144d88d70 politely enable rerere and cache decline 2026-03-22 14:01:16 -07:00
Sameen Karim 22fa202522 shared loadStack helper for all cmds 2026-03-22 08:52:03 -07:00
Sameen Karim e874e26374 push all branches atomically and resolve remotes 2026-03-21 23:35:39 -07:00
Sameen Karim d5903fe4cd hyperlinked PRs in output 2026-03-13 02:30:52 -04:00
Sameen Karim 34eeac434f clean up duplicate msgs 2026-03-13 01:48:53 -04:00
Sameen Karim d5305eb4ba improved handling of merged branches 2026-03-12 09:24:32 -04:00
Sameen Karim 7767bb499d handle rebase restore failures 2026-03-12 00:37:51 -04:00
Sameen Karim 910b69ce71 force push with lease by default 2026-03-11 15:24:58 -04:00
Sameen Karim 03c4b92270 enable git rerere 2026-03-11 01:29:49 -04:00
Sameen Karim f1421adfb4 rebase onto for handling squashed prs 2026-03-11 00:01:14 -04:00
Sameen Karim 2661ee705f sync command to fetch, rebase, and push 2026-03-10 19:24:54 -04:00