Skip to content

feat(zsh): handle draft PRs in ghsq/ghrb and compact the picker preview#335

Merged
laurigates merged 1 commit into
mainfrom
feat/gh-picker-draft-handling
Jul 18, 2026
Merged

feat(zsh): handle draft PRs in ghsq/ghrb and compact the picker preview#335
laurigates merged 1 commit into
mainfrom
feat/gh-picker-draft-handling

Conversation

@laurigates

Copy link
Copy Markdown
Owner

What

Fixes ghsq/ghrb stumbling on draft PRs, surfaces drafts in the fzf pickers, and tidies the PR-picker preview.

Why

A draft PR reports mergeable=MERGEABLE — that GraphQL field tracks merge conflicts, not draft state — so the sequential-merge poll loop (_gh_poll_merge) never noticed the draft and handed it straight to gh pr merge, which GitHub rejects. The user saw a generic "merge failed" with no indication that draftness was the cause, and nothing in the picker flagged which PRs were drafts.

How

  • Merge engine (_gh_poll_merge) — detect isDraft up front and prompt per draft: r = gh pr ready then merge, s = skip. (Chosen behaviour: prompt per draft, for max control without silently flipping PR state.)
  • Picker (_gh_paint) — colour the state column: draft → bold magenta, ready → dim, so drafts pop. Space-delimited match avoids painting ready inside a title word like already.
  • Preview — drop the 100-line raw diff for a compact git apply --stat filestat (rendered locally from the same gh pr diff call — no extra API request), narrow the window to 60%, and scroll by half-page on ^d/^u for smoother reading.

Verification

  • zsh -n on the rendered ~/.zshrc: clean.
  • Painter unit-tested against a row with a draft/ready state column plus a title containing both Already and a trailing ready? — only the state column colourises.
  • git apply --stat confirmed to render a diffstat from gh pr diff output with no repo/tool dependency.
  • Applied via chezmoi apply ~/.zshrc; chezmoi status clean.

🤖 Generated with Claude Code

Draft PRs report mergeable=MERGEABLE (that field tracks conflicts, not
draft state), so the sequential-merge poll loop never caught them and
`gh pr merge` failed with a generic "merge failed" line. `_gh_poll_merge`
now detects `isDraft` up front and prompts per draft: mark ready & merge
(`gh pr ready`) or skip.

Also surface drafts in the fzf pickers and tidy the preview:
- `_gh_paint` colours the state column — draft → bold magenta, ready →
  dim — so drafts pop. Space-delimited match avoids painting "ready"
  inside a title word like "already".
- PR-picker preview drops the 100-line raw diff for a compact `git apply
  --stat` filestat (same two API calls, rendered locally), narrows to
  60% width, and scrolls by half-page on ^d/^u.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017P6zLTE5zek8KnDJtBp9ig
@github-actions github-actions Bot added the shell label Jul 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Broken Links Detected

Summary

Status Count
🔍 Total 170
✅ Successful 160
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 9
❓ Unknown 0
🚫 Errors 1

Errors per input

Errors in exact_dot_claude/docs/prds/daily-catchup.PRD.md


Please fix the broken links before merging.

@laurigates
laurigates merged commit 7d90c29 into main Jul 18, 2026
7 of 8 checks passed
@laurigates
laurigates deleted the feat/gh-picker-draft-handling branch July 18, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant