MCPcopy Create free account
hub / github.com/anomalyco/opencode / mergeFile

Function mergeFile

packages/opencode/src/config/tui.ts:149–169  ·  view source on GitHub ↗
(acc: Acc, file: string)

Source from the content-addressed store, hash-verified

147 })
148
149 const mergeFile = (acc: Acc, file: string) =>
150 Effect.gen(function* () {
151 const data = yield* loadFile(file)
152 if (Object.keys(data).length) {
153 appliedOrder += 1
154 yield* Effect.logInfo("applying tui config", { path: file, order: appliedOrder })
155 }
156 acc.result = mergeDeep(acc.result, data)
157 if (!data.plugin?.length) return
158
159 const scope = pluginScope(file, ctx)
160 const plugins = ConfigPlugin.deduplicatePluginOrigins([
161 ...acc.plugin_origins,
162 ...data.plugin.map((spec) => ({ spec: spec as ConfigPlugin.Origin["spec"], scope, source: file })),
163 ])
164 acc.result = {
165 ...acc.result,
166 plugin: plugins.map((item) => item.spec),
167 }
168 acc.plugin_origins = plugins
169 })
170
171 // Every config dir we may read from: global config dir, any `.opencode`
172 // folders between cwd and home, and OPENCODE_CONFIG_DIR.

Callers 1

tui.tsFile · 0.85

Calls 2

loadFileFunction · 0.85
pluginScopeFunction · 0.85

Tested by

no test coverage detected