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

Function withProject

packages/opencode/test/plugin/trigger.test.ts:32–57  ·  view source on GitHub ↗
(source: string, self: Effect.Effect<A, E, R>)

Source from the content-addressed store, hash-verified

30const systemHook = "experimental.chat.system.transform"
31
32function withProject<A, E, R>(source: string, self: Effect.Effect<A, E, R>) {
33 return Effect.gen(function* () {
34 const test = yield* TestInstance
35 const file = path.join(test.directory, "plugin.ts")
36 yield* Effect.all(
37 [
38 Effect.promise(() => Bun.write(file, source)),
39 Effect.promise(() =>
40 Bun.write(
41 path.join(test.directory, "opencode.json"),
42 JSON.stringify(
43 {
44 $schema: "https://opencode.ai/config.json",
45 plugin: [pathToFileURL(file).href],
46 },
47 null,
48 2,
49 ),
50 ),
51 ),
52 ],
53 { discard: true, concurrency: 2 },
54 )
55 return yield* self
56 })
57}
58
59const triggerSystemTransform = Effect.fn("PluginTriggerTest.triggerSystemTransform")(function* () {
60 const plugin = yield* Plugin.Service

Callers 1

trigger.test.tsFile · 0.70

Calls 2

writeMethod · 0.80
allMethod · 0.45

Tested by

no test coverage detected