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
|
|
@ -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,
|
||||
|
|
|
|||
17
packages/server/src/handlers/project.ts
Normal file
17
packages/server/src/handlers/project.ts
Normal 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 })),
|
||||
),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue