Repository navigation
Source Control
Source control and code hosting: two plugin seams, the surfaces core draws over them, and the rules around unfinished operations. Core runs no git and names no host (#804; see Core defines, plugins provide).
Two contribution points, each a protocol Studio defines and a plugin serves over stdio:
-
Version control (
versionControlpoint,src/shared/api/version-control-protocol.ts). Core's side issrc/shared/electron/version-control/: the host resolves which plugin owns a folder (by its markers), keeps the refcounted map of opened repositories, confines every path to an opened root, and intersects what the manifest declares with what the plugin confirms at its handshake. The Git plugin (plugins/git) runs the git CLI and does all the parsing (git-output.ts, status v2 / log / for-each-ref / stash / diff-tree) — the renderer parses nothing. Which program it runs is a Settings choice (installed, or a custom path). -
Code hosting (
hostingpoint,src/shared/api/hosting-protocol.ts). Core's side issrc/shared/electron/hosting/: the host routes each repository to the plugin serving its host, narrows the plugin's capabilities to what the repository allows, gates agents' writes through the usual permission posture, and answers a plugin's mid-request credential ask only for a host it declares. The GitHub plugin (plugins/github) serves github.com. How it signs in — the GitHub CLI's login, a token Studio keeps (forge-credentials.bin, encrypted with the OS's secure storage), or Automatic — is a per-host choice in Settings ▸ Source Control (hosting.json); changing it restarts the plugin. The renderer can store or clear a token but never read one back. -
Renderer (
src/shared/angular/services/):source-control/version-control-provider.tsspeaks the version-control channels;forge/forge.tsandforge-repository/speak the forge channels.Repository.supports()andForgeRepository.supports()read the confirmed capabilities, and the panels hide what the installed plugin or the repository does not allow. -
Per-tab state:
repository/repository.ts(Repository— the source-control tab: bind/refresh, selection, lazy commit files + diffs, stage/commit/stash/checkout/branch) ·workspace-git/(the directory tab's lightweight status decorations, infeatures/workspace) ·repositories/(Repositorieshandoff +RepositoryOpener) ·diffs/(Diffsstore +DiffOpener; diffs open in the document well). -
UI lives in
shared/angular/components/panels/(thesource-control-view+commit-graph/commit-detail/source-control-sidebarpanels +REPOSITORY_DOCK_BLUEPRINT); the generic diff panels (diff-view,diff-document-panel) are shared. - With nothing installed: a folder that is a repository no installed plugin reads raises a sticky offer to install one, and the Repository and Commit panels show only that; with no hosting plugin the Pull Requests, Issues and Actions sections are absent rather than broken.
Unfinished operations (merge/rebase/cherry-pick/revert) are state the panel can name, not just
failures. Three rules hold here, each of which has already cost a bug or would have. All three now
live in the Git plugin (plugins/git/src/git.ts, git-operation-state.ts):
- The state is read from
git rev-parse --absolute-git-dir, never<root>/.git— a linked worktree's merge state lives elsewhere, and the naive join reports every worktree as idle.classifyOperation(pure, tested) decides the kind; rebase is tested before cherry-pick, since replaying a commit leaves the same markers. - Merge, rebase, and the commands that finish them run through
runIntegration, which setsGIT_EDITOR/GIT_SEQUENCE_EDITOR/GIT_MERGE_AUTOEDIT. Without it git blocks on an editor that cannot open, and the timeout's kill lands mid-operation. A non-zero exit is then re-probed: still in flight meansSourceControlCode.Conflicted, which reloads without reporting an error. - Continue/skip/abort read the operation git is actually in rather than trusting the renderer, and
a squash merge is not a merge: it records no
MERGE_HEAD, so it aborts viareset --mergeand cannot be continued at all.
Conflicted paths come from status v2's u entries into ParsedStatus.conflicted, kept out of
staged/unstaged: staging one is what marks it resolved. Their diff is :2:path (ours) against the
worktree, because :path is ambiguous for an unmerged path.
The source-control tab opens a repository; the directory tab gets lightweight git (status
decorations + a few ops). Tab.resourceKey + Tabs.findByResource keep a resource single-instance
per tab type, so open flows focus an existing tab instead of duplicating.
Using Studio
Contributing
How it works
- Architecture
- Runtime seams
- Agent access and permissions
- Agent MCP capabilities
- Agent surfaces, prompts and skills
- Source control
- Plugins
- Package managers
- Language servers — capability matrix
- Language servers — adding a server
- Setup wizard
- Container engines
Decisions