The open source coding agent.
TypeScript
lil branch refactor
Dax Raad98031173b6cb
diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsxindex 13b02154e85..7c72274addb 100644--- a/packages/opencode/src/cli/cmd/tui/app.tsx+++ b/packages/opencode/src/cli/cmd/tui/app.tsx@@ -480,7 +480,7 @@ function App() {<box paddingLeft={1} paddingRight={1}><text fg={theme.textMuted}>{process.cwd().replace(Global.Path.home, "~")}- {sync.data.vcs?.vcs?.branch ? `:${sync.data.vcs.vcs.branch}` : ""}+ {sync.data.vcs?.branch ? `:${sync.data.vcs.branch}` : ""}</text></box></box>diff --git a/packages/opencode/src/cli/cmd/tui/context/sync.tsx b/packages/opencode/src/cli/cmd/tui/context/sync.tsxindex 0293abace06..b7ef8a2214b 100644--- a/packages/opencode/src/cli/cmd/tui/context/sync.tsx+++ b/packages/opencode/src/cli/cmd/tui/context/sync.tsx@@ -244,7 +244,7 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({}case "vcs.branch.updated": {- setStore("vcs", "vcs", { branch: event.properties.branch })+ setStore("vcs", { branch: event.properties.branch })break}}diff --git a/packages/opencode/src/project/vcs.ts b/packages/opencode/src/project/vcs.tsindex 59b2f99b715..c3b21f3be2e 100644--- a/packages/opencode/src/project/vcs.ts+++ b/packages/opencode/src/project/vcs.ts@@ -18,6 +18,15 @@ export namespace Vcs {),}+ export const Info = z+ .object({+ branch: z.string(),+ })+ .meta({+ ref: "VcsInfo",+ })+ export type Info = z.infer<typeof Info>+async function currentBranch() {return $`git rev-parse --abbrev-ref HEAD`.quiet()diff --git a/packages/opencode/src/server/server.ts b/packages/opencode/src/server/server.tsindex 1c8d2a0036a..7743e3dbb83 100644--- a/packages/opencode/src/server/server.ts+++ b/packages/opencode/src/server/server.ts@@ -376,22 +376,7 @@ export namespace Server {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",- }),- ),+ schema: resolver(Vcs.Info),},},},@@ -400,10 +385,7 @@ export namespace Server {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,+ branch,})},)diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.tsindex 08335dd3978..efa5c994625 100644--- a/packages/sdk/js/src/gen/types.gen.ts+++ b/packages/sdk/js/src/gen/types.gen.ts@@ -1264,12 +1264,7 @@ export type Path = {}export type VcsInfo = {- worktree: string- directory: string- projectID: string- vcs?: {- branch: string- }+ branch: string}export type NotFoundError = {