You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Expose V2 VCS status and diff APIs #34433
VCS APIs = current repository/worktree status + raw VCS diff for a Location.
Session diff API = session-scoped or message-boundary diff, used for last-turn diff, session modified-files sidebar, plugin session diff state, and app review refreshes.
Implementation up in #35129. Also did the requested pass on how git-welded V2 is and what a second VCS (hg/jj) would take — summary of the coupling audit:
Wire contracts: Vcs.FileStatus, FileDiff.Info, Vcs.Mode renamed to working | branch (no git literals on the new surface)
Core seam: Vcs.Service is the adapter interface; the git implementation is one file (packages/core/src/vcs/git.ts) selected by location.vcs?.type. An hg adapter supporting status/diff/branch is roughly ~250-450 LOC behind the same interface.
The real blocker for a second VCS
Detection: packages/core/src/project.tsProject.resolve only discovers .git (fs.up({ targets: [".git"] })), so location.vcs can never be anything else. Widening means touching core/project.ts, core/project/schema.ts (Vcs union), schema/src/project.ts (Literal("git")), plus UI guards (~8-12 files total).
Agent-visible copy: system-context/builtins.ts says "Is directory a git repo", plus assorted TUI/app copy that leaks git.
Git-only territory (keep gated or hidden for non-git)
Workspaces/worktrees: git_worktree is the copy strategy ID down to the DB (project/sql.ts), and all create/move/delete flows assume it (~600-1000 LOC to generalize — not worth it unless the target VCS has a worktree equivalent)
Repository clone/cache: repository.ts / repository-cache.ts are git-remote-native
Snapshots: stay git per discussion — invisible to users, uses its own git store
Suggested follow-ups
hg (or jj) adapter: detection widening + adapter file + hg in CI — its own PR
Rename the SnapshotFileDiff schema identifier to something neutral once the legacy SDK can absorb the break (V2 clients now standardize on FileDiff.Info)
Activity
opencode-agent commentedon Jul 2, 2026
Assigned to @nexxeln from the V2 TODO LIST thread.
Scope reminder from the original split:
vcs.status/vcs.diffare repository/worktree state for a Location, independent of a particular session turn.session.diff), which is session/message-boundary-scoped.Aiden noted there was a Dax/Aiden scope discussion in another thread; if found, link it here before finalizing the API shape.
opencode-agent commentedon Jul 2, 2026
Scope references from Discord:
https://discord.com/channels/1391832426048651334/1520962938733723720/1521136350936694906
Relevant distinction:
https://discord.com/channels/1391832426048651334/1518799327076810812/1518808524354748446
Relevant contract:
directoryworktreeFileDiff.file= worktree-relativenexxeln commentedon Jul 3, 2026
Implementation up in #35129. Also did the requested pass on how git-welded V2 is and what a second VCS (hg/jj) would take — summary of the coupling audit:
Already agnostic (after #35129)
Vcs.FileStatus,FileDiff.Info,Vcs.Moderenamed toworking | branch(no git literals on the new surface)Vcs.Serviceis the adapter interface; the git implementation is one file (packages/core/src/vcs/git.ts) selected bylocation.vcs?.type. An hg adapter supporting status/diff/branch is roughly ~250-450 LOC behind the same interface.The real blocker for a second VCS
packages/core/src/project.tsProject.resolveonly discovers.git(fs.up({ targets: [".git"] })), solocation.vcscan never be anything else. Widening means touchingcore/project.ts,core/project/schema.ts(Vcsunion),schema/src/project.ts(Literal("git")), plus UI guards (~8-12 files total).system-context/builtins.tssays "Is directory a git repo", plus assorted TUI/app copy that leaks git.Git-only territory (keep gated or hidden for non-git)
git_worktreeis the copy strategy ID down to the DB (project/sql.ts), and all create/move/delete flows assume it (~600-1000 LOC to generalize — not worth it unless the target VCS has a worktree equivalent)repository.ts/repository-cache.tsare git-remote-nativeSuggested follow-ups
hg(orjj) adapter: detection widening + adapter file + hg in CI — its own PRSnapshotFileDiffschema identifier to something neutral once the legacy SDK can absorb the break (V2 clients now standardize onFileDiff.Info)opencode-agent commentedon Jul 3, 2026
Status from @nexxeln/Shoubhit: current VCS APIs are in, and Mercurial support is in.
Remaining follow-up is the plugin API for VCS adapters, for systems like jj. Filed the focused follow-up as #35162.
Source: https://discord.com/channels/1391832426048651334/1520962938733723720/1522589081282937052
opencode-agent commentedon Jul 5, 2026
Completed by merged PR #35129: V2 VCS status/diff APIs and Mercurial support are in. Remaining extensibility work continues in #35162 / PR #35166.