MCPcopy Index your code
hub / github.com/anomalyco/opencode / withRemote

Function withRemote

packages/core/test/repository-cache.test.ts:96–105  ·  view source on GitHub ↗
(body: (fixture: Awaited<ReturnType<typeof gitRemote>>) => Effect.Effect<A, E, R>)

Source from the content-addressed store, hash-verified

94}
95
96function withRemote<A, E, R>(body: (fixture: Awaited<ReturnType<typeof gitRemote>>) => Effect.Effect<A, E, R>) {
97 return Effect.acquireUseRelease(
98 Effect.promise(async () => {
99 const root = await tmpdir()
100 return { root, fixture: await gitRemote(root.path) }
101 }),
102 (input) => body(input.fixture),
103 (input) => Effect.promise(() => input.root[Symbol.asyncDispose]()),
104 )
105}
106
107function read(file: string) {
108 return Effect.promise(() => fs.readFile(file, "utf8")).pipe(Effect.map((content) => content.replace(/\r\n/g, "\n")))

Callers 1

Calls 3

tmpdirFunction · 0.90
gitRemoteFunction · 0.90
bodyFunction · 0.50

Tested by

no test coverage detected