Skip to content

feat: show open PR badge in each command center cell#2292

Merged
charlesvien merged 7 commits into
mainfrom
posthog-code/command-center-pr-button
May 21, 2026
Merged

feat: show open PR badge in each command center cell#2292
charlesvien merged 7 commits into
mainfrom
posthog-code/command-center-pr-button

Conversation

@pauldambra
Copy link
Copy Markdown
Member

@pauldambra pauldambra commented May 21, 2026

CleanShot 2026-05-21 at 19 57 28@2x

so much real estate we could put a PR button in and save me a click

Problem

The command center grid shows each task's status, environment, and repo, but it does not surface whether the task has an open PR — even on a wide screen with plenty of room. To check or jump to a PR from the command center you have to expand the task first.

Changes

Add a small colored PR badge to each populated cell's header (next to the status / environment / repo badges). Clicking it opens the PR on GitHub in a new tab.

Resolution mirrors the rules used by the task page (TaskActionsMenu):

  • Cloud tasks: PR URL from useCloudPrUrl (run output / SSE).
  • Local tasks: linked-branch lookup first, then a local git.getPrStatus fallback against the focused repo path.
  • In all cases, gated by usePrDetails returning a non-null state, and colored via getPrVisualConfig (green / gray / red / purple for open / draft / closed / merged), so the badge only appears when there's a real PR.

The badge matches the existing cell-header badge sizing (text-[9px], 10px icon), with bg/text-(--{color}-3/-11) so it picks up the active Radix theme.

How did you test this?

  • pnpm install + pnpm build for the workspace.
  • pnpm exec tsc -p tsconfig.web.json --noEmit for the renderer — clean.
  • pnpm exec biome check on the two touched files — no warnings.
  • Did NOT exercise the UI in a browser; the change is a small badge added to an existing render path, so manual smoke-test in a populated command center grid (cloud task, local task with PR, local task without PR) is the next thing to do before un-drafting.

Publish to changelog?

no


Created with PostHog Code

Each populated cell in the command center now shows a small colored PR badge next to the status/environment/repo badges, mirroring the same resolution rules used by the task header (cloud pr_url for cloud tasks, linked-branch lookup → local getPrStatus fallback for local tasks, gated by usePrDetails state).

Clicking the badge opens the PR on GitHub in a new tab.

Generated-By: PostHog Code
Task-Id: 4706ea08-92b3-4063-a175-13b30a7c7c17
@pauldambra pauldambra requested a review from a team May 21, 2026 19:14
Copy link
Copy Markdown
Member Author

Note

🤖 Automated comment by QA Swarm — not written by a human

Multi-perspective review (degraded: only security-audit reviewer was available in this environment).

Verdict: ✅ APPROVE

Small UI-only change adding a read-only PR-badge component. No new sinks, no privileged paths, no new data flows beyond the existing TaskActionsMenu pattern.

Reviewer summaries

Reviewer Assessment
🔍 qa-team skipped — skill files not available in this environment
👤 paul skipped — skill files not available in this environment
📐 xp skipped — skill files not available in this environment
🛡 security-audit No findings. `prUrl` is rendered as ``, sources are inside the app's trust boundary, and the same sink already exists in `TaskActionsMenu` — no new exposure introduced.

Automated by QA Swarm — not a human review

@pauldambra pauldambra added the Stamphog This will request an autostamp by stamphog on small changes label May 21, 2026 — with PostHog
@pauldambra pauldambra marked this pull request as ready for review May 21, 2026 19:41
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 21, 2026

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
apps/code/src/renderer/features/command-center/components/CommandCenterPrButton.tsx:63-65
The icon-component derivation (`merged ? GitMerge : GitPullRequest`) duplicates logic already inside `getPrVisualConfig`, which returns an icon React element for exactly the same cases. The only reason it can't be reused is that `getPrVisualConfig` hard-codes `size={12}` inside the element. Consider exporting the icon component type separately or accepting a size parameter in the utility so the badge doesn't have to re-implement the same `merged`-based branch.

```suggestion
  const config = getPrVisualConfig(state, merged, draft);
  const prNumber = parsePrNumber(prUrl);
  // config.icon is sized for the task-detail panel (12px); derive the
  // component type here so we can render it at 10px for the badge.
  const Icon = merged ? GitMerge : GitPullRequest;
```

### Issue 2 of 2
apps/code/src/renderer/features/command-center/components/CommandCenterPrButton.tsx:33-44
`useWorkspace(taskId)` is called twice per render: once directly here (to get `worktreePath`/`folderPath` for the focus-path logic), and again inside `useLinkedBranchPrUrl(taskId)`, which calls the same hook internally. If `useWorkspace` reads from a store this is harmless, but it's still a redundant call — extracting the `linkedBranch` / `folderPath` needed by the linked-URL lookup from the workspace already in scope would keep things DRY.

Reviews (1): Last reviewed commit: "feat: show open PR badge in each command..." | Re-trigger Greptile

pauldambra and others added 3 commits May 21, 2026 20:49
Pull the existing PR badge anchor out of `TaskActionsMenu`'s `PrBadgeControl` into a shared `PRBadgeLink` component, and rewrite `CommandCenterPRButton` (renamed from `CommandCenterPrButton` — PR is an acronym) to render that same component instead of a hand-rolled colored anchor with its own color-class map.

Resolution logic is unchanged; the command center still mirrors the task page's source chain (cloud `pr_url` → linked branch → local `getPrStatus`) and gates on `usePrDetails` returning a non-null state.

Generated-By: PostHog Code
Task-Id: 4706ea08-92b3-4063-a175-13b30a7c7c17
@charlesvien charlesvien self-requested a review May 21, 2026 20:03
@charlesvien charlesvien enabled auto-merge (squash) May 21, 2026 20:18
Copy link
Copy Markdown
Member

@charlesvien charlesvien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made some changes, lgtm

@charlesvien charlesvien merged commit 98ae2bd into main May 21, 2026
15 checks passed
@charlesvien charlesvien deleted the posthog-code/command-center-pr-button branch May 21, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants