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
- Surface non-root dirty worktrees as separate actionable change sets - Scope diffs, stash, commit, and discard to each worktree cwd - Update shared contracts and tests for worktree snapshots
- Force local VCS refreshes to publish even when the status fingerprint is unchanged - Reload expanded working-tree diffs and keep source control panel diffs in sync
- Fingerprint panel snapshots by cwd to avoid cross-repo collisions - Preserve loaded file diffs across no-op refreshes - Reuse diff load state transitions in source control panel
There was a problem hiding this comment.
Effect Service Conventions: 1 issue found
SourceControlPanelService is defined with a standalone SourceControlPanelServiceShape interface that the Context.Service tag then references. The service conventions require the interface to be declared inline in the Context.Service declaration, with no retained FooShape/FooServiceShape type. Every other service in this same directory (AzureDevOpsCli, GitHubCli, GitLabCli, SourceControlProvider, SourceControlProviderRegistry, SourceControlRepositoryService, SourceControlDiscovery) already inlines its interface, so this new module is the lone deviation.
Posted via Macroscope — Effect Service Conventions
- Scope local watcher retention to stream lifetime - Open sibling worktree file previews from their source cwd - Inline the source control panel service interface
- Key pending file surfaces with cwd overrides - Keep explorer file opens in the active preview cwd
There was a problem hiding this comment.
The Effect service conventions disallow standalone FooShape service-interface aliases; the inferred interface should be referenced as Foo["Service"] everywhere, including tests. This PR adds four such aliases (each used only by tests that could use Foo["Service"] directly). Details inline.
Posted via Macroscope — Effect Service Conventions
- Thread original rename paths through the web and contract layers - Diff renames against the deleted source side, including staged and unstaged working-tree rows - Reuse a temporary intent-to-add index for unstaged rename diffs
- Resolve commit author avatar URLs via GitHub, GitLab, Azure DevOps, and Bitbucket when enabled - Default to initials when lookup is disabled or unavailable - Update source control settings and tests for the new avatar flow
- Extract source control metadata handling into a hook - Keep stale metadata errors keyed by active server thread - Update source-control docs to reference the new module
- Persist draft branch context before server ref guards
- Catch thrown thread metadata update failures - Add focused routing and error-formatting coverage
- Return Stale for superseded metadata update rejections - Cover stale thrown errors in source control metadata tests
- Refresh upstream refs and branch delta counts - Note preview and desktop backend merge impact
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.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, 8 tests.pnpm exec vp checkpassed with 0 errors and 20 existing warnings in unrelated web/mobile files.pnpm exec vp run typecheckpassed.Proof
Note
High Risk
Broad server-authoritative Git mutation surface plus multi-provider API/CLI integration; regressions could affect checkout, push/pull, or data shown across all clients.
Overview
Introduces a Git-backed Version Control surface in the right panel (
source-control), driven by server RPCs and documented inSOURCE_CONTROL.md. Users get actionable working tree, branch sync, stashes, remotes, sibling worktrees, fork branches, and open PR/MR base rows without browser-side Git.Server and contracts:
SourceControlPanelServiceowns snapshots and mutations (selected-file commit/stash/discard, branch/remote/stash actions, diffs, compare/history). Live refresh usesVcsStatusBroadcaster/VcsLocalWatch(debounced, ignore-aware, sibling worktree watchers). Automatic remote fetch defaults to 5 minutes via settings.Providers: GitHub, GitLab, Azure DevOps, and Bitbucket gain
getCommitAvatarUrland remote-scoped change-request listing; per-providershowCommitAuthorAvataris opt-in (off by default). Errors route throughsourceControlProviderErrorandsanitizeErrorCauseso panel diagnostics stay bounded.Client/host: Panel UI, thread metadata routing, cwd-scoped file previews for extra worktrees.
ContextMenuItem.separatoris honored in Electron menus (including destructive grouping when the first item is destructive).Tests: Large
SourceControlPanelService.test.tscoverage for publish/sync semantics, renames, discards, worktrees, fork/PR actionable rows, and avatar gating.Reviewed by Cursor Bugbot for commit 59621bc. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add Version Control panel with VCS operations across GitHub, GitLab, Azure DevOps, and Bitbucket
SourceControlPanel) with working tree changes, branch details, diffs, commit/pull/push/merge/rebase/stash operations, and remote management.SourceControlPanelServiceon the server exposing VCS panel operations over WebSocket RPC, with scope-gated endpoints and git status refresh after mutations.getCommitAvatarUrland repository/project scoping for PR/MR listing; avatar display per provider is toggled via newshowCommitAuthorAvatarsettings.VcsStatusBroadcasterthat debounce events, respect.gitignoreviagit check-ignore, and track sibling worktrees; explicit local refreshes now publish even when the status fingerprint is unchanged.RightPanelSurfacewith asource-controlsingleton kind and scopes file surfaces bycwdso the same relative path can open as distinct panels per repository root.Macroscope summarized 59621bc.