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

Function readConfig

packages/plugin/src/shared/conflict-fixer.ts:38–49  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

36}
37
38function readConfig(filePath: string): JsonObject | null {
39 if (!existsSync(filePath)) {
40 return null;
41 }
42
43 try {
44 const parsed = parse(readFileSync(filePath, "utf-8"));
45 return isRecord(parsed) ? parsed : null;
46 } catch {
47 return null;
48 }
49}
50
51function writeConfig(filePath: string, config: JsonObject): void {
52 writeFileSync(filePath, `${stringify(config, null, 2)}\n`);

Callers 1

fixConflictsFunction · 0.70

Calls 2

isRecordFunction · 0.70
parseFunction · 0.50

Tested by

no test coverage detected