mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 06:12:26 +00:00
show current git branch in tui (#4765)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user