MCPcopy Create free account
hub / github.com/cortexkit/magic-context / readConfig

Function readConfig

packages/cli/src/lib/diagnostics-opencode.ts:269–278  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

267// ── Config + plugin entry detection ────────────────────────────────
268
269function readConfig(path: string): { value: Record<string, unknown> | null; error?: string } {
270 if (!existsSync(path)) return { value: null };
271 try {
272 const raw = readFileSync(path, "utf-8");
273 const value = parseJsonc(raw) as Record<string, unknown>;
274 return { value };
275 } catch (error) {
276 return { value: null, error: error instanceof Error ? error.message : String(error) };
277 }
278}
279
280function configHasPluginEntry(config: Record<string, unknown> | null): boolean {
281 const plugins = Array.isArray(config?.plugin) ? config.plugin : [];

Callers 1

collectDiagnosticsFunction · 0.70

Calls 1

parseJsoncFunction · 0.50

Tested by

no test coverage detected