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

Function loadFile

packages/opencode/src/config/tui.ts:131–147  ·  view source on GitHub ↗
(filepath: string)

Source from the content-addressed store, hash-verified

129 )
130
131 const loadFile = (filepath: string): Effect.Effect<Info> =>
132 Effect.gen(function* () {
133 // Silent-swallow non-NotFound read errors (perms, EISDIR, IO) → log + skip.
134 // Matches how parse/schema/plugin failures in load() are handled — every
135 // broken-config path degrades gracefully rather than crashing TUI startup.
136 const text = yield* afs.readFileStringSafe(filepath).pipe(
137 Effect.catchCause((cause) =>
138 Effect.logWarning("failed to read tui config", {
139 path: filepath,
140 reason: FormatError(Cause.squash(cause)) ?? FormatUnknownError(Cause.squash(cause)),
141 }).pipe(Effect.as(undefined)),
142 ),
143 )
144 if (!text) return {} as Info
145 yield* Effect.logInfo("loading tui config", { path: filepath })
146 return yield* load(text, filepath)
147 })
148
149 const mergeFile = (acc: Acc, file: string) =>
150 Effect.gen(function* () {

Callers 3

config.tsFile · 0.85
mergeFileFunction · 0.85
config.tsFile · 0.85

Calls 4

FormatErrorFunction · 0.90
FormatUnknownErrorFunction · 0.90
asMethod · 0.80
loadFunction · 0.70

Tested by

no test coverage detected