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

Function httpapiInstance

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

Source from the content-addressed store, hash-verified

198}
199
200function httpapiInstance<A, E>(
201 name: string,
202 options: {
203 serverPath: ServerPath
204 git?: boolean
205 config?: Partial<ConfigV1.Info>
206 setup?: (dir: string) => Effect.Effect<void, E, TestServices>
207 },
208 run: (input: ProjectFixture) => Effect.Effect<A, E, TestScope>,
209) {
210 it.instance(
211 name,
212 Effect.gen(function* () {
213 const instance = yield* TestInstance
214 yield* options.setup?.(instance.directory) ?? Effect.void
215 return yield* run({ sdk: yield* client(options.serverPath, instance.directory), directory: instance.directory })
216 }),
217 { git: options.git ?? true, config: { formatter: false, lsp: false, ...options.config } },
218 )
219}
220
221function serverPathParity<A, E>(name: string, scenario: (serverPath: ServerPath) => Effect.Effect<A, E, TestScope>) {
222 it.live(name, scenario("raw"))

Callers 1

Calls 3

instanceMethod · 0.80
clientFunction · 0.70
runFunction · 0.50

Tested by

no test coverage detected