feat(client): expose v2 project APIs (#34456)
This commit is contained in:
parent
01edae4a7f
commit
935ac2db91
23 changed files with 473 additions and 244 deletions
|
|
@ -22,6 +22,7 @@ import { Authorization } from "./middleware/authorization"
|
|||
import { LocationGroup } from "./groups/location"
|
||||
import { IntegrationGroup } from "./groups/integration"
|
||||
import { CredentialGroup } from "./groups/credential"
|
||||
import { ProjectGroup } from "./groups/project"
|
||||
import { ProjectCopyGroup } from "./groups/project-copy"
|
||||
|
||||
// Protocol owns middleware placement, while Server injects concrete keys so Core service identities stay downstream.
|
||||
|
|
@ -47,6 +48,7 @@ const makeApiFromGroup = <
|
|||
.add(ProviderGroup.middleware(locationMiddleware))
|
||||
.add(IntegrationGroup.middleware(locationMiddleware))
|
||||
.add(CredentialGroup.middleware(locationMiddleware))
|
||||
.add(ProjectGroup.middleware(locationMiddleware))
|
||||
.add(makePermissionGroup(locationMiddleware, sessionLocationMiddleware))
|
||||
.add(FileSystemGroup.middleware(locationMiddleware))
|
||||
.add(CommandGroup.middleware(locationMiddleware))
|
||||
|
|
|
|||
42
packages/protocol/src/groups/project.ts
Normal file
42
packages/protocol/src/groups/project.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { Project } from "@opencode-ai/schema/project"
|
||||
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
|
||||
import { LocationQuery, locationQueryOpenApi } from "./location"
|
||||
|
||||
const root = "/api/project"
|
||||
|
||||
export const ProjectGroup = HttpApiGroup.make("server.project")
|
||||
.add(
|
||||
HttpApiEndpoint.get("project.current", `${root}/current`, {
|
||||
query: LocationQuery,
|
||||
success: Project.Current,
|
||||
})
|
||||
.annotateMerge(locationQueryOpenApi)
|
||||
.annotateMerge(
|
||||
OpenApi.annotations({
|
||||
identifier: "v2.project.current",
|
||||
summary: "Get current project",
|
||||
description: "Resolve the project for the requested location.",
|
||||
}),
|
||||
),
|
||||
)
|
||||
.add(
|
||||
HttpApiEndpoint.get("project.directories", `${root}/:projectID/directories`, {
|
||||
params: { projectID: Project.ID },
|
||||
query: LocationQuery,
|
||||
success: Project.Directories,
|
||||
})
|
||||
.annotateMerge(locationQueryOpenApi)
|
||||
.annotateMerge(
|
||||
OpenApi.annotations({
|
||||
identifier: "v2.project.directories",
|
||||
summary: "List project directories",
|
||||
description: "List known local absolute directories for a project.",
|
||||
}),
|
||||
),
|
||||
)
|
||||
.annotateMerge(
|
||||
OpenApi.annotations({
|
||||
title: "projects",
|
||||
description: "Location-scoped project routes.",
|
||||
}),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue