feat: merge a pull request from the terminal - #65
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adds PRMergeContext, which reads what the repository allows to merge (methods, delete-branch-on-merge, auto-merge) and what state the pull request is in (mergeable, mergeStateStatus, reviewDecision, whether auto-merge is already on), for the merge popup.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… box Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two fetches for the same pull request can be in flight -- r starts one while the first is still out, and a popup that was closed and opened again leaves another behind. Their answers were indistinguishable, so an older one could redraw the popup and move the cursor off the method the user had chosen, and an older failure could clear a second popup's loading flag and put a stale message in the detail view's footer. Every fetch now carries a number that never repeats, and what the user chose survives a refetch instead of being reset. The merge message now says which of the three things happened. Only the merge itself leaves nothing to read; joining or leaving the auto-merge queue leaves the pull request open, so the detail view stays and the popup asks GitHub what the state is now. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
An empty merge context reads as a repository with no auto-merge on a pull request GitHub is still working the answer out for -- none of which was measured. A failed fetch left one behind, and so did pressing m on a merged pull request, which GitHub answers UNKNOWN for, so the popup said "still computing" for ever and r never changed it. The key is now offered, and the popup opened, only while the pull request is open, and a popup with no answer draws no options at all; the holder shows the failure under it. The key bar named the same four keys in every state, three of which did nothing while merging was blocked, while auto-merge was unavailable, or while the fetch was still out. It is now built from the state. An auto-merge the viewer may not enable said auto-merge had nothing left to wait for, which is a different pull request's reason. It says why, and the scene is recorded: the goldens only ever had the two flags set together, so nothing was watching that line. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The wheel case sat above the forward that hands the merge popup every message the detail view cannot name, so it claimed the wheel while the popup was open. Nothing scrolled -- wheel() declines every mode but the body's -- but the reading "everything left over while it is open is its" was not true of the wheel. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
With the auto-merge box ticked, enter sends enablePullRequestAutoMerge, not the merge -- the same lie the bar told on a pull request whose auto-merge was already on. It now names the key by what it will do. The wording is at the width limit: at 80 columns the box leaves 46, and both catalogues' bars come to exactly that. Anything longer and FitKeyBar drops esc off the end. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Japanese key bar sits at exactly the width the box leaves, and FitKeyBar drops from the tail, so the first hint to vanish on any future wording change is esc -- the only way out of the popup. The key would go on working with nothing on screen to say so, and nothing caught it: TestGolden only if a human reads the diff, the golden refresh not at all, and the width guard measures columns rather than what survives. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Code Metrics Report
Code coverage of files in pull request scope (91.2%, patch 86.5%)
Reported by octocov |
This was referenced Sep 8, 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.
Phase 3 の 2 本目。詳細ビューの
mから PR をマージできるようにする。実装計画は
docs/superpowers/plans/2026-09-08-phase3-merge.md。入るもの
mergePullRequest/enablePullRequestAutoMerge/disablePullRequestAutoMerge(gh pr mergeは使わない)mergeable: UNKNOWNは「計算中」で、rで取り直せる3 本目(各スレッドの
commentsのページング)の計画も一緒に入っている。実装は次の PR。spec の誤りを 2 つ直した
どちらも 2026-09-08 の introspection の実測で分かったもので、
docs/superpowers/specs/2026-09-05-octoscope-standalone-design.md§4.4.4 を訂正してある。MergePullRequestInputに delete-branch の入力は無い。 モックアップの[x] ブランチを削除するは実装できない。削除はリポジトリのdeleteBranchOnMergeに従って GitHub 側が行うので、その値を読み取り専用の 1 行として見せるMergeStateStatusにDRAFTは無い。 draft はisDraftで見分け、enterを塞ぐ理由の 1 つとして扱うenablePullRequestAutoMergeはmergeStateStatusがCLEANの PR を GitHub が断るので、その場合は選択肢ごと落として理由を出す。全体レビューで見つけて直したもの
タスク別のレビューは全部通っていたが、継ぎ目を通しで見て 6 件出た。重いのは 1 件目:
rで取り直すとカーソルが squash に戻り、答えが 2 本走ると古いほうが後から上書きしていた。取り消せない操作なので、contextMsgに世代番号を持たせて古い答えを落とし、カーソルは 0 に戻さずクランプするErrorMsgが PR も世代も持たず、閉じたポップアップの失敗が次のポップアップに着地していたMergeContextが「計算中」と区別できず、**マージ済みの PR でmを押すと永久に「計算中です」**と出ていた。open な PR でだけmを出すenter:マージと出る等)。状態からヒントを組み立てる形にしたautoLine()が、権限が無いときに「待つものはありません」という別の理由を出していた確かめていないこと
実端末で見ていない。 このブランチを書いているあいだ
kukv/octoscopeに open な PR が 1 つも無く、ポップアップは golden の目視でしか確認できていない。autoMergeAllowed: falseなので auto-merge の 2 経路もこのリポジトリでは動かせない。受け渡しの手順は
docs/superpowers/2026-09-08-phase3-merge-handoff.mdにある。マージは戻せないので、試すなら捨ててよい PR を先に作ること。分かっていて残したもの
m:マージを入れた分だけx:クローズとr:更新がキーバーから落ちる(キー自体は効く)internal/tui/review/render.goのポップアップ幅に、merge 側で見つけたのと同じずれがあるかもしれない。範囲外として触っていない🤖 Generated with Claude Code