feat(app): select worktree base branch (#44906)

Co-authored-by: Brendonovich <14191578+Brendonovich@users.noreply.github.com>
Co-authored-by: Brendan Allan <git@brendonovich.dev>
This commit is contained in:
opencode-agent[bot]
2026-08-25 21:05:52 +08:00
committed by GitHub
Unverified
parent 5c25c38961
commit 4fb8a6038a
31 changed files with 477 additions and 45 deletions
+21 -1
View File
@@ -1,11 +1,17 @@
import { FileDiff } from "@opencode-ai/schema/file-diff"
import { Location } from "@opencode-ai/schema/location"
import { NonNegativeInt } from "@opencode-ai/schema/schema"
import { NonNegativeInt, PositiveInt } from "@opencode-ai/schema/schema"
import { Vcs } from "@opencode-ai/schema/vcs"
import { Schema } from "effect"
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
import { LocationQuery, locationQueryOpenApi } from "./location.js"
const BranchesQuery = Schema.Struct({
...LocationQuery.fields,
search: Schema.optional(Schema.String),
limit: Schema.NumberFromString.pipe(Schema.decodeTo(PositiveInt), Schema.optional),
})
const DiffQuery = Schema.Struct({
...LocationQuery.fields,
mode: Vcs.Mode,
@@ -41,6 +47,20 @@ export const VcsGroup = HttpApiGroup.make("server.vcs")
}),
),
)
.add(
HttpApiEndpoint.get("vcs.branches", "/api/vcs/branches", {
query: BranchesQuery,
success: Location.response(Vcs.BranchList),
})
.annotateMerge(locationQueryOpenApi)
.annotateMerge(
OpenApi.annotations({
identifier: "v2.vcs.branches",
summary: "VCS branches",
description: "List local and remote branches available at the requested location.",
}),
),
)
.add(
HttpApiEndpoint.get("vcs.diff", "/api/vcs/diff", {
query: DiffQuery,