feat(client): expose v2 project APIs (#34456)

This commit is contained in:
Kit Langton 2026-06-29 14:10:11 -04:00 committed by GitHub
commit 935ac2db91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 473 additions and 244 deletions

View file

@ -18,6 +18,7 @@ import { ReferenceHandler } from "./handlers/reference"
import { LocationHandler } from "./handlers/location"
import { IntegrationHandler } from "./handlers/integration"
import { CredentialHandler } from "./handlers/credential"
import { ProjectHandler } from "./handlers/project"
import { ProjectCopyHandler } from "./handlers/project-copy"
export const handlers = Layer.mergeAll(
@ -31,6 +32,7 @@ export const handlers = Layer.mergeAll(
ProviderHandler,
IntegrationHandler,
CredentialHandler,
ProjectHandler,
PermissionHandler,
FileSystemHandler,
CommandHandler,

View file

@ -0,0 +1,17 @@
import { Location } from "@opencode-ai/core/location"
import { Project } from "@opencode-ai/core/project"
import { Effect } from "effect"
import { HttpApiBuilder } from "effect/unstable/httpapi"
import { Api } from "../api"
export const ProjectHandler = HttpApiBuilder.group(Api, "server.project", (handlers) =>
handlers
.handle("project.current", () =>
Location.Service.use((location) =>
Effect.succeed({ id: location.project.id, directory: location.project.directory }),
),
)
.handle("project.directories", (ctx) =>
Project.Service.use((project) => project.directories({ projectID: ctx.params.projectID })),
),
)