/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/core/test/fixture/location.ts
26 строк
956 B
Dax
refactor(core): simplify integration test fixtures (#33292)
22 июн 2026, 07:15
Не верифицирован
22 июн 2026, 07:15
2bb4311
Код
Авторство
О чём код?
import { Location } from "@opencode-ai/core/location" import { Project } from "@opencode-ai/core/project" import { AbsolutePath } from "@opencode-ai/core/schema" import { Effect, Layer } from "effect" import { tmpdir } from "./tmpdir" export function location(ref: Location.Ref, input: { projectDirectory?: AbsolutePath; vcs?: Project.Vcs } = {}) { return { directory: ref.directory, workspaceID: ref.workspaceID, project: { id: Project.ID.global, directory: input.projectDirectory ?? ref.directory }, vcs: input.vcs, } satisfies Location.Interface } export const tempLocationLayer = Layer.unwrap( Effect.acquireRelease( Effect.promise(() => tmpdir()), (tmp) => Effect.promise(() => tmp[Symbol.asyncDispose]()), ).pipe( Effect.map((tmp) => { const ref = Location.Ref.make({ directory: AbsolutePath.make(tmp.path) }) return Layer.succeed(Location.Service, Location.Service.of(location(ref))) }), ), )