MCPcopy
hub / github.com/anomalyco/opencode / withProject

Function withProject

packages/opencode/test/server/httpapi-sdk.test.ts:225–242  ·  view source on GitHub ↗
(
  serverPath: ServerPath,
  options: {
    git?: boolean
    config?: Partial<ConfigV1.Info>
    setup?: (dir: string) => Effect.Effect<void, E2, TestServices>
  },
  run: (input: ProjectFixture) => Effect.Effect<A, E, TestScope>,
)

Source from the content-addressed store, hash-verified

223}
224
225function withProject<A, E, E2 = never>(
226 serverPath: ServerPath,
227 options: {
228 git?: boolean
229 config?: Partial<ConfigV1.Info>
230 setup?: (dir: string) => Effect.Effect<void, E2, TestServices>
231 },
232 run: (input: ProjectFixture) => Effect.Effect<A, E, TestScope>,
233) {
234 return Effect.gen(function* () {
235 const directory = yield* tmpdirScoped({
236 git: options.git ?? false,
237 config: { formatter: false, lsp: false, ...options.config },
238 })
239 yield* options.setup?.(directory) ?? Effect.void
240 return yield* run({ sdk: yield* client(serverPath, directory), directory })
241 })
242}
243
244function withStandardProject<A, E>(
245 serverPath: ServerPath,

Callers 4

withStandardProjectFunction · 0.70
withFakeLlmFunction · 0.70
withFakeLlmProjectFunction · 0.70

Calls 3

tmpdirScopedFunction · 0.90
clientFunction · 0.70
runFunction · 0.50

Tested by

no test coverage detected