feat(core): expose V2 VCS status and diff APIs (#35129)
This commit is contained in:
parent
85fde8c11d
commit
a1b6c84135
16 changed files with 970 additions and 0 deletions
|
|
@ -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,
|
||||
)
|
||||
|
|
|
|||
27
packages/server/src/handlers/vcs.ts
Normal file
27
packages/server/src/handlers/vcs.ts
Normal 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 })
|
||||
}),
|
||||
),
|
||||
)
|
||||
}),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue