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

Function withConfigTree

packages/opencode/test/config/config.test.ts:193–210  ·  view source on GitHub ↗
(
  input: { global?: object; project?: object; local?: object },
  effect: Effect.Effect<A, E, R>,
)

Source from the content-addressed store, hash-verified

191 })
192
193const withConfigTree = <A, E, R>(
194 input: { global?: object; project?: object; local?: object },
195 effect: Effect.Effect<A, E, R>,
196) =>
197 Effect.gen(function* () {
198 const root = yield* tmpdirScoped()
199 const global = yield* tmpdirScoped()
200 const directory = path.join(root, "project")
201 yield* Effect.all(
202 [
203 input.global ? writeConfigEffect(global, schemaConfig(input.global)) : undefined,
204 input.project ? writeConfigEffect(directory, schemaConfig(input.project)) : undefined,
205 input.local ? writeConfigEffect(path.join(directory, ".opencode"), schemaConfig(input.local)) : undefined,
206 ].filter((effect): effect is Effect.Effect<void, FSUtil.Error, FSUtil.Service> => effect !== undefined),
207 { concurrency: "unbounded" },
208 )
209 return yield* withGlobalConfigDir(global, withInstanceDir(directory, effect))
210 })
211
212const wellKnown = (input: {
213 authUrl?: string

Callers 1

config.test.tsFile · 0.85

Calls 6

tmpdirScopedFunction · 0.90
writeConfigEffectFunction · 0.85
schemaConfigFunction · 0.85
withGlobalConfigDirFunction · 0.85
withInstanceDirFunction · 0.85
allMethod · 0.45

Tested by

no test coverage detected