| 12345678910111213141516171819202122232425262728 |
- import { Context, Effect, Layer } from "effect"
- import { Info, Ref, response } from "@opencode-ai/schema/location"
- import { Project } from "./project"
- export * as Location from "./location"
- export { Info, Ref, response }
- export interface Interface extends Info {
- readonly vcs?: Project.Vcs
- }
- export class Service extends Context.Service<Service, Interface>()("@opencode/Location") {}
- export const layer = (ref: Ref) =>
- Layer.effect(
- Service,
- Effect.gen(function* () {
- const project = yield* Project.Service
- const resolved = yield* project.resolve(ref.directory)
- return Service.of({
- directory: ref.directory,
- workspaceID: ref.workspaceID,
- project: { id: resolved.id, directory: resolved.directory },
- vcs: resolved.vcs,
- })
- }),
- )
|