feat(core): expose V2 VCS status and diff APIs (#35129)

This commit is contained in:
Shoubhit Dash 2026-07-03 16:49:03 +05:30 committed by GitHub
commit a1b6c84135
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 970 additions and 0 deletions

View file

@ -23,6 +23,7 @@ import { McpHandler } from "./handlers/mcp"
import { CredentialHandler } from "./handlers/credential"
import { ProjectHandler } from "./handlers/project"
import { ProjectCopyHandler } from "./handlers/project-copy"
import { VcsHandler } from "./handlers/vcs"
export const handlers = Layer.mergeAll(
HealthHandler,
@ -49,4 +50,5 @@ export const handlers = Layer.mergeAll(
QuestionHandler,
ReferenceHandler,
ProjectCopyHandler,
VcsHandler,
)

View file

@ -0,0 +1,27 @@
import { Vcs } from "@opencode-ai/core/vcs"
import { Effect } from "effect"
import { HttpApiBuilder } from "effect/unstable/httpapi"
import { Api } from "../api"
import { response } from "../location"
export const VcsHandler = HttpApiBuilder.group(Api, "server.vcs", (handlers) =>
Effect.gen(function* () {
return handlers
.handle("vcs.status", () =>
response(
Effect.gen(function* () {
const vcs = yield* Vcs.Service
return yield* vcs.status()
}),
),
)
.handle("vcs.diff", (ctx) =>
response(
Effect.gen(function* () {
const vcs = yield* Vcs.Service
return yield* vcs.diff(ctx.query.mode, { context: ctx.query.context })
}),
),
)
}),
)