Skip to content

Add version control command center#3177

Open
Quicksaver wants to merge 54 commits into
pingdotgg:mainfrom
Quicksaver:split/version-control-panel-work
Open

Add version control command center#3177
Quicksaver wants to merge 54 commits into
pingdotgg:mainfrom
Quicksaver:split/version-control-panel-work

Conversation

@Quicksaver

@Quicksaver Quicksaver commented Jun 19, 2026

Copy link
Copy Markdown

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

  • Added SOURCE_CONTROL.md as the branch-specific behavior and validation reference for the Version Control panel.
  • Added server-side SourceControlPanelService RPC 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.
  • Extended GitHub, GitLab, Azure DevOps, and Bitbucket source-control provider plumbing so actionable rows can account for open change-request bases while preserving bounded provider diagnostics.
  • Added live VCS refresh support through VcsStatusBroadcaster and VcsLocalWatch, including ref-counted local watchers, .git/ event filtering, gitignore-aware suppression, explicit local refreshes, and sibling worktree watcher retention.
  • Added the React Version Control panel UI with Actionable and Remotes sections, 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.
  • Added dirty sibling worktree rows and cwd-scoped right-panel File previews so Git operations and file reads target the checkout that owns the displayed changes.
  • Hardened branch sync behavior around same-name remote tracking, fork branches, open PR/MR base branches, local-only publishing, diverged branch actions, branch names containing slashes, and branch worktree cwd routing.
  • Hardened working-tree handling for renamed files, quoted porcelain paths, mixed staged/unstaged rows, selected-file commit pathspec semantics, discard failures, generated commit failures, and branch deletion resolution.
  • Hardened review follow-ups for source-control thread metadata sequencing after a thread is closed/reopened and default compare ref selection for repositories whose checked-out default branch is not named main or master.
  • Extended shared RPC, IPC, Git, settings, client-runtime, and VCS contracts for the source-control snapshot and operation protocol.
  • Added desktop and web context-menu separator support so destructive source-control actions can be grouped consistently.
  • Added focused tests for source-control service behavior, provider base detection, VCS broadcaster/watch behavior, source-control panel state, shared Git contracts, and client-runtime VCS action helpers.

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.ts passed: 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.ts passed: 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.ts passed: 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.ts passed: 3 files, 30 tests.
  • pnpm exec vp test run apps/server/src/sourceControl/SourceControlPanelService.test.ts passed: 1 file, 43 tests.
  • pnpm exec vp test run apps/web/src/components/ChatView.sourceControl.test.ts passed: 1 file, 8 tests.
  • pnpm exec vp check passed with 0 errors and 20 existing warnings in unrelated web/mobile files.
  • pnpm exec vp run typecheck passed.

Proof

Screenshot 2026-06-16 at 19 26 39

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 in SOURCE_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: SourceControlPanelService owns snapshots and mutations (selected-file commit/stash/discard, branch/remote/stash actions, diffs, compare/history). Live refresh uses VcsStatusBroadcaster / VcsLocalWatch (debounced, ignore-aware, sibling worktree watchers). Automatic remote fetch defaults to 5 minutes via settings.

Providers: GitHub, GitLab, Azure DevOps, and Bitbucket gain getCommitAvatarUrl and remote-scoped change-request listing; per-provider showCommitAuthorAvatar is opt-in (off by default). Errors route through sourceControlProviderError and sanitizeErrorCause so panel diagnostics stay bounded.

Client/host: Panel UI, thread metadata routing, cwd-scoped file previews for extra worktrees. ContextMenuItem.separator is honored in Electron menus (including destructive grouping when the first item is destructive).

Tests: Large SourceControlPanelService.test.ts coverage 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

  • Introduces a full-featured Source Control right-panel UI (SourceControlPanel) with working tree changes, branch details, diffs, commit/pull/push/merge/rebase/stash operations, and remote management.
  • Adds SourceControlPanelService on the server exposing VCS panel operations over WebSocket RPC, with scope-gated endpoints and git status refresh after mutations.
  • Extends all four source control providers (GitHub, GitLab, Azure DevOps, Bitbucket) with getCommitAvatarUrl and repository/project scoping for PR/MR listing; avatar display per provider is toggled via new showCommitAuthorAvatar settings.
  • Adds file-system watchers in VcsStatusBroadcaster that debounce events, respect .gitignore via git check-ignore, and track sibling worktrees; explicit local refreshes now publish even when the status fingerprint is unchanged.
  • Extends RightPanelSurface with a source-control singleton kind and scopes file surfaces by cwd so the same relative path can open as distinct panels per repository root.
  • Adds a large set of VCS panel contract types, RPC codec definitions, and WebSocket method identifiers in the contracts package.
  • Changes the default automatic git fetch interval from 30 seconds to 5 minutes.
  • Risk: The fetch interval change affects all existing deployments without a settings migration.

Macroscope summarized 59621bc.

- 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
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c17718e3-b9df-4663-8b5e-4957bc9769e9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Jun 19, 2026
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts
Comment thread apps/web/src/components/source-control/SourceControlPanel.tsx
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts
Comment thread apps/web/src/components/source-control/SourceControlPanel.tsx Outdated
Comment thread apps/web/src/components/source-control/SourceControlPanel.tsx Outdated
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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
Comment thread apps/vscode-extension/scripts/package-dependencies.mjs Outdated
Comment thread apps/vscode-extension/src/extension.ts Outdated
Comment thread apps/vscode-extension/scripts/package.mjs Outdated
Comment thread apps/web/src/session-logic.ts Outdated
Comment thread apps/server/src/vscodeWorkspaceBootstrap/http.ts Outdated
Comment thread apps/web/src/session-logic.ts Outdated
Comment thread apps/vscode-extension/src/backendManager.ts Outdated
Comment thread apps/vscode-extension/src/webview.ts Outdated
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts
Comment thread apps/web/src/components/ChatView.tsx Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Effect Service Conventions: one finding in DesktopBackendManager.ts. See inline comment.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/desktop/src/backend/DesktopBackendManager.ts
- 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
Comment thread apps/web/src/components/source-control/SourceControlPanel.tsx
Comment thread apps/web/src/components/source-control/SourceControlPanel.tsx
Comment thread apps/web/src/components/source-control/SourceControlPanel.tsx Outdated
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts Outdated
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts Outdated
Comment thread apps/server/src/vcs/VcsStatusBroadcaster.ts Outdated
Comment thread apps/web/src/components/source-control/SourceControlPanel.tsx Outdated

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts Outdated
- Scope local watcher retention to stream lifetime

- Open sibling worktree file previews from their source cwd

- Inline the source control panel service interface
Comment thread apps/web/src/components/ChatView.tsx
Comment thread apps/web/src/components/ChatView.tsx
- Key pending file surfaces with cwd overrides

- Keep explorer file opens in the active preview cwd
Comment thread apps/server/src/vcs/VcsStatusBroadcaster.ts
Comment thread apps/web/src/components/source-control/SourceControlPanel.tsx
Comment thread apps/web/src/components/source-control/SourceControlPanel.logic.ts

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Comment thread apps/server/src/sourceControl/GitHubCli.ts Outdated
Comment thread apps/server/src/sourceControl/GitLabCli.ts Outdated
Comment thread apps/server/src/vcs/GitVcsDriver.ts Outdated
Comment thread apps/server/src/sourceControl/AzureDevOpsCli.ts Outdated
- 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
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts
- 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
Comment thread apps/web/src/components/ChatView.sourceControl.ts
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts
- Refresh upstream refs and branch delta counts
- Note preview and desktop backend merge impact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant