Expand description
/vcs/* — git status/diff/info, freeze-parity (WEBUI-PLAN W5).
Shapes probed live against opencode 1.18.31 (2026-10-08):
GET /vcs→{branch, default_branch}(strings or null)GET /vcs/status→FileStatus[]{file, additions, deletions, status}(status∈ added|deleted|modified), sorted by fileGET /vcs/diff?mode=git|branch[&context=N]→FileDiff[]{file, patch, additions, deletions, status}GET /vcs/diff/raw→ the raw patch text (empty string when clean)- bad
mode→ 400 Effect Query envelope
Subprocess discipline (the “large diffs are slow” complaint): a single
status --porcelain + a single diff --numstat for stats, and ONE
batched diff --patch for all tracked files (git diff … -- .), split
by diff --git headers — never one spawn per file. Untracked files are
synthesized per-file like freeze (unavoidable: --no-index is per path),
capped. Total patch bytes capped at 10 MB (freeze MAX_TOTAL_PATCH_BYTES).
All git runs off the async workers via run_blocking at the call site.
/vcs/apply applies a patch to the worktree via git apply - (SNAPSHOT
§5); vcs::apply is the shell-out used by the v2 handler.
Functions§
- apply
git apply -indirwithpatchon stdin (upstreamGit.applyPatch).Nonewhendiris not inside a git work tree;Some(ok)otherwise.- diff
mode: git | branch.context: unified context lines (default full).- diff_
raw - diff_
raw_ bounded /vcs/diff/rawvariant: same patch text but bounded byMAX_TOTAL_PATCH_BYTES(the trackeddiff()caps its aggregate; the raw route concatenated the tracked patch AND one--no-indexper untracked file with no cap — an unbounded request-reachable allocation on a large dirty tree). Truncation is at a char boundary; the caller marks it truncated.- info
- status
- toplevel
- Git worktree toplevel for
dir(upstreamproject.worktree). None whendiris not inside a git work tree.