Add version control command center#3177
Conversation
- Query open change requests across supported remotes - Surface actionable branch rows only when local branch is behind the MR/PR base - Pass remote repository context to GitHub, GitLab, and Azure DevOps CLIs
…ol-panel-work # Conflicts: # apps/web/src/components/ChatView.tsx # apps/web/src/environmentApi.ts # apps/web/src/environments/runtime/service.threadSubscriptions.test.ts # packages/client-runtime/src/wsRpcClient.ts
- Extract shared source control panel state and API wiring - Move VS Code project scope and subagent parent resolution into runtime helpers - Add tests for presentation state and subagent control resolution
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review Diff is too large for automated approval analysis. A human reviewer should evaluate this PR. You can customize Macroscope's approvability policy. Learn more. |
- Treat same-name remotes as publish/pull upstreams - Split sync-state logic into shared web module - Cover publish target behavior with tests and docs
- Add `forceRefresh` support to query runners and runtime execution - Refresh cached SWR atoms before resolving so panel data stays current - Cover first-run and cached-refresh behavior with runtime tests
- Move sync refresh feedback into a compact spinner icon - Keep the banner for non-refresh sync messages
- Sum merged working-tree row stats across both sides - Keep default compare ref on the repository default branch - Restrict diverged merge sync to the checked-out branch - Surface tracked discard failures and rename sources - Move shared panel logic into the logic module
- Infer rename status for numstat fallback entries - Align diverged merge sync guard and disabled state - Clarify aggregate working-tree stats and date buckets
…ol-panel-work # Conflicts: # apps/desktop/src/electron/ElectronMenu.ts # apps/server/src/sourceControl/AzureDevOpsCli.ts # apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts # apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts # apps/server/src/sourceControl/GitHubCli.ts # apps/server/src/sourceControl/GitHubSourceControlProvider.test.ts # apps/server/src/sourceControl/GitHubSourceControlProvider.ts # apps/server/src/sourceControl/GitLabCli.ts # apps/server/src/sourceControl/SourceControlProvider.ts # apps/server/src/vcs/VcsStatusBroadcaster.ts # apps/server/src/ws.ts # apps/web/src/components/ChatView.tsx # apps/web/src/components/Sidebar.logic.ts # apps/web/src/hooks/useHandleNewThread.ts
There was a problem hiding this comment.
Effect Service Conventions: one finding in DesktopBackendManager.ts. See inline comment.
Posted via Macroscope — Effect Service Conventions
- Refresh upstream refs and branch delta counts - Note preview and desktop backend merge impact
- Track the first fetched cwd to avoid repeats - Trigger actionable branch loading when the panel mounts or cwd changes
- Key the source control panel by environment, thread, and cwd - Ensure it resets when switching chat threads or repos
- Move Source Control panel availability into a helper - Keep ChatView focused on rendering and wiring - Add tests for visibility and availability rules
- Cache panel snapshot and UI state by environment/thread/worktree - Restore expanded trees, selections, diffs, and enrichment data on reopen
- Describe context-keyed remounts and bounded panel state cache - Note initial fetch-all-remotes behavior when opening a cwd - Clarify which UI state is restored versus reloaded
- Show refresh state while cached snapshots revalidate - Hydrate restored branch and stash expansions when details are missing - Document cached panel refresh behavior in SOURCE_CONTROL.md
- Use stash commit hashes for expansion and detail cache keys - Keep positional refs for Git stash operations - Document and test restored stash expansion behavior
- Share add-surface metadata between the empty state and menu - Preserve Version Control availability, labels, and disabled reasons - Refresh the source-control merge note to reflect the latest merge
- Preserve menu order while sharing action metadata - Add coverage for action order, callbacks, and disabled reasons
- Record the latest upstream merge refs and branch deltas - Note preserved Version Control panel customizations
- Add Android-native mobile interfaces and Ghostty terminal support - Preserve Version Control behavior and refresh its merge notes - Adopt responsive thread-error and platform shortcut updates
Summary
Adds a Git-backed Version Control command center to the right panel. It is scoped to the active project/repository cwd, works from draft or existing conversations once repository context is available, and keeps Git operations server-authoritative across browser, desktop, VS Code, and remote clients.
The panel focuses on actionable repository work rather than being a full Git dashboard: dirty working trees, local branch sync state, stashes, remotes, sibling worktrees, likely fork branches, and open change-request bases.
What Changed
SOURCE_CONTROL.mdas the branch-specific behavior and validation reference for the Version Control panel.SourceControlPanelServiceRPC support for snapshots, branch/stash/commit/compare data, selected-file commit and stash flows, discard operations, branch actions, remote actions, and provider-derived PR/MR base checks.VcsStatusBroadcasterandVcsLocalWatch, including ref-counted local watchers,.git/event filtering, gitignore-aware suppression, explicit local refreshes, and sibling worktree watcher retention.ActionableandRemotessections, working-tree file selection, inline diffs, branch/stash/commit rows, searchable compare bases, guarded destructive actions, context menus, manual fetch controls, and a conservative five-minute Actionable remote fetch.mainormaster.stash@{n}renumbering after stash create/drop operations does not show details for the wrong stash.Why
T3 Code needs a compact place to answer "what repository work needs attention now?" without forcing users into a full external Git UI. This change keeps the surface decision-oriented: commit or stash selected changes, inspect branch sync state, publish or sync branches, review stashes, and notice when a PR/MR base has moved.
The server-owned design keeps behavior consistent across clients and avoids browser-side Git execution, while the periodic fetch and local watchers keep the panel current without introducing a high-frequency polling loop.
Validation
pnpm exec vp test run apps/server/src/sourceControl/SourceControlPanelService.test.ts apps/server/src/sourceControl/GitHubSourceControlProvider.test.ts apps/server/src/sourceControl/GitLabSourceControlProvider.test.ts apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts apps/web/src/components/source-control/SourceControlPanel.logic.test.tspassed: 5 files, 74 tests.pnpm exec vp test run apps/server/src/sourceControl/SourceControlPanelService.test.ts apps/server/src/vcs/VcsStatusBroadcaster.test.ts apps/server/src/vcs/GitVcsDriverCore.test.tspassed: 3 files, 82 tests.pnpm exec vp test run apps/web/src/components/source-control/SourceControlPanel.logic.test.ts apps/web/src/state/sourceControlPanel.test.tspassed: 2 files, 14 tests.pnpm exec vp test run packages/contracts/src/git.test.ts packages/shared/src/git.test.ts packages/client-runtime/src/state/vcsAction.test.tspassed: 3 files, 30 tests.pnpm exec vp test run apps/server/src/sourceControl/SourceControlPanelService.test.tspassed: 1 file, 43 tests.pnpm exec vp test run apps/web/src/components/ChatView.sourceControl.test.tspassed: 1 file, 11 tests.pnpm exec vp test run apps/server/src/sourceControl/SourceControlPanelService.test.ts apps/server/src/vcs/VcsStatusBroadcaster.test.ts apps/server/src/vcs/GitVcsDriverCore.test.tspassed: 3 files, 85 tests.pnpm exec vp test run apps/web/src/components/source-control/SourceControlPanel.logic.test.tspassed: 1 file, 12 tests.pnpm exec vp test run apps/web/src/components/source-control/SourceControlPanel.logic.test.ts apps/web/src/state/sourceControlPanel.test.tspassed: 2 files, 16 tests.pnpm exec vp test run packages/contracts/src/git.test.ts packages/shared/src/git.test.ts packages/client-runtime/src/state/vcsAction.test.tspassed: 3 files, 30 tests.pnpm exec vp test run apps/web/src/components/RightPanelTabs.test.tsxpassed: 1 file, 3 tests.pnpm exec vp checkpassed with 0 errors and 9 existing warnings in unrelated web files.pnpm exec vp run typecheckpassed.Proof
Note
Medium Risk
Touches server Git workflows, multi-provider PR/MR queries, and error payloads crossing RPC; behavior is heavily tested but mistakes could affect publish/pull or provider-derived actionable rows.
Overview
Adds
SOURCE_CONTROL.mdas the canonical reference for the Version Control right-panel behavior, merge status, and validation commands.Provider and diagnostics hardening: Introduces
sanitizeErrorCauseand routes GitHub, GitLab, Azure DevOps, and Bitbucket failures throughsourceControlProviderErrorso RPC-facing errors carry bounded causes instead of raw CLI objects. Change-request listing now passes remote repository context (--repo/ project) parsed from each remote URL. Opt-in commit author avatars are added viagetCommitAvatarUrlon all four providers (GitHub commit API, GitLab Avatar API, Azure DevOps commitimageUrl, Bitbucket avatar links), with GitLab CLI error classification tightened.Desktop menus: Electron and web context menus honor explicit
separatoritems and insert a separator before the first destructive action even when it leads the menu.Tests: Adds a large
SourceControlPanelService.test.tssuite covering snapshots, renames, discard/commit/merge/push/pull, worktrees, fork/PR actionable rows, avatars, and error wrapping; extends provider andGitHubCli/GitLabClitests for the new APIs.Reviewed by Cursor Bugbot for commit 41b4d6c. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add Version Control command center panel to the right panel UI
SourceControlPanelReact component with working tree management, file diffs, staging, commits, branch operations, remotes, and stash support.SourceControlPanelServiceon the server exposing ~25 VCS operations, wired into the WebSocket RPC layer with read/operate scope enforcement and git status refresh after mutating calls.packages/contracts) with newVcsPanel*schemas, websocket method identifiers, andEnvironmentApisurface for all panel operations.getCommitAvatarUrlto all source control providers (GitHub, GitLab, Bitbucket, Azure DevOps) with a per-provider toggle in server settings (showCommitAuthorAvatar, default off).VcsStatusBroadcasterthat debounces non-.gitpath changes and triggers forced local status refreshes, including sibling worktree discovery.ChatViewwith git-cwd awareness, thread metadata routing for branch/worktree changes, and right panel surface filtering when Version Control is unavailable.Macroscope summarized 41b4d6c.