mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-19 17:01:37 +03:00
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:
committed by
GitHub
Unverified
parent
5c25c38961
commit
4fb8a6038a
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user