Slice 3: the PR flow

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-05-24 12:37:54 -07:00
parent 33d9d7a482
commit a2bf89e90b
15 changed files with 2928 additions and 141 deletions
+45
View File
@@ -38,6 +38,7 @@ import PromptBar from './PromptBar.jsx'
import ChatPanel from './ChatPanel.jsx'
import ChangePanel from './ChangePanel.jsx'
import DiffView from './DiffView.jsx'
import PRModal from './PRModal.jsx'
const MANUAL_IDLE_MS = 5 * 60 * 1000 // §8.6 idle window; exact value is impl detail.
const MANUAL_DEBOUNCE_MS = 800
@@ -82,6 +83,7 @@ export default function RFCView({ viewer }) {
const [isStreaming, setIsStreaming] = useState(false)
const [focusedChangeId, setFocusedChangeId] = useState(null)
const [showVisibility, setShowVisibility] = useState(false)
const [showPRModal, setShowPRModal] = useState(false)
// Manual-edit buffer state per §8.11.
const [manualPending, setManualPending] = useState(null)
@@ -451,6 +453,17 @@ export default function RFCView({ viewer }) {
const inDiscuss = mode === 'discuss'
const pendingCount = changes.filter(c => c.state === 'pending').length
// §10.1: the Open PR affordance only surfaces on a non-main branch
// that has commits ahead of main and no open PR already.
const openPRForBranch = mainView?.open_prs?.find(p => p.head_branch === branchParam) || null
const branchHasCommitsAhead = branchView && mainView && branchView.body !== (mainView.body || '')
const canOpenPR = (
branchParam !== 'main'
&& canContribute
&& !openPRForBranch
&& branchHasCommitsAhead
)
return (
<div className="rfc-view">
{/* Breadcrumb */}
@@ -493,6 +506,25 @@ export default function RFCView({ viewer }) {
{!viewer && (
<a className="btn-link" href="/auth/login">Sign in</a>
)}
{canOpenPR && (
<button
type="button"
className="btn-primary btn-open-pr"
onClick={() => setShowPRModal(true)}
title="§10.1 — open a PR from this branch against main"
>
Open PR
</button>
)}
{openPRForBranch && (
<a
className="btn-link"
href={`/rfc/${slug}/pr/${openPRForBranch.pr_number}`}
title="View the open PR for this branch"
>
PR #{openPRForBranch.pr_number}
</a>
)}
{canChangeSettings && branchParam !== 'main' && (
<button
type="button"
@@ -627,6 +659,19 @@ export default function RFCView({ viewer }) {
</div>
</div>
{showPRModal && (
<PRModal
slug={slug}
branch={branchParam}
branchIsPrivate={!branchView.visibility?.read_public}
onClose={() => setShowPRModal(false)}
onOpened={(prNumber) => {
setShowPRModal(false)
navigate(`/rfc/${slug}/pr/${prNumber}`)
}}
/>
)}
{showVisibility && (
<BranchVisibilityModal
slug={slug}