feat: add git-backed session review modes (#17961)

This commit is contained in:
Shoubhit Dash
2026-03-19 19:29:29 +05:30
committed by GitHub
parent 84f60d97a0
commit e6f5214779
26 changed files with 1072 additions and 183 deletions

View File

@@ -41,6 +41,7 @@ import { websocket } from "hono/bun"
import { HTTPException } from "hono/http-exception"
import { errors } from "./error"
import { Filesystem } from "@/util/filesystem"
import { Snapshot } from "@/snapshot"
import { QuestionRoutes } from "./routes/question"
import { PermissionRoutes } from "./routes/permission"
import { GlobalRoutes } from "./routes/global"
@@ -332,10 +333,39 @@ export namespace Server {
},
}),
async (c) => {
const branch = await runPromiseInstance(Vcs.Service.use((s) => s.branch()))
return c.json({
branch,
})
const [branch, default_branch] = await Promise.all([
runPromiseInstance(Vcs.Service.use((s) => s.branch())),
runPromiseInstance(Vcs.Service.use((s) => s.defaultBranch())),
])
return c.json({ branch, default_branch })
},
)
.get(
"/vcs/diff",
describeRoute({
summary: "Get VCS diff",
description: "Retrieve the current git diff for the working tree or against the default branch.",
operationId: "vcs.diff",
responses: {
200: {
description: "VCS diff",
content: {
"application/json": {
schema: resolver(Snapshot.FileDiff.array()),
},
},
},
},
}),
validator(
"query",
z.object({
mode: Vcs.Mode,
}),
),
async (c) => {
const mode = c.req.valid("query").mode
return c.json(await runPromiseInstance(Vcs.Service.use((s) => s.diff(mode))))
},
)
.get(