show current git branch in tui (#4765)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Aiden Cline
2025-11-25 19:39:20 -08:00
committed by GitHub
parent d95f724303
commit 09bc8d9ca4
7 changed files with 193 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ import { MessageV2 } from "../session/message-v2"
import { TuiRoute } from "./tui"
import { Permission } from "../permission"
import { Instance } from "../project/instance"
import { Vcs } from "../project/vcs"
import { Agent } from "../agent/agent"
import { Auth } from "../auth"
import { Command } from "../command"
@@ -365,6 +366,47 @@ export namespace Server {
})
},
)
.get(
"/vcs",
describeRoute({
description: "Get VCS info for the current instance",
operationId: "vcs.get",
responses: {
200: {
description: "VCS info",
content: {
"application/json": {
schema: resolver(
z
.object({
worktree: z.string(),
directory: z.string(),
projectID: z.string(),
vcs: z
.object({
branch: z.string(),
})
.optional(),
})
.meta({
ref: "VcsInfo",
}),
),
},
},
},
},
}),
async (c) => {
const branch = await Vcs.branch()
return c.json({
worktree: Instance.worktree,
directory: Instance.directory,
projectID: Instance.project.id,
vcs: Instance.project.vcs ? { branch } : undefined,
})
},
)
.get(
"/session",
describeRoute({