MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / readJsonFile

Function readJsonFile

src/installer/targets/shared.ts:89–98  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

87 * only where one is actually about to be overwritten.
88 */
89export function readJsonFile(filePath: string): Record<string, any> {
90 if (!fs.existsSync(filePath)) {
91 return {};
92 }
93 try {
94 return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
95 } catch {
96 return {};
97 }
98}
99
100/**
101 * Write a file atomically: write to `<path>.tmp.<pid>`, then rename.

Callers 15

hasMcpConfigFunction · 0.90
hasPermissionsFunction · 0.90
detectMethod · 0.90
uninstallMethod · 0.90
writeMcpEntryFunction · 0.90
detectMethod · 0.90
uninstallMethod · 0.90
writeMcpEntryFunction · 0.90
cleanupLegacyLocalMcpFunction · 0.90
writePermissionsEntryFunction · 0.90
writePromptHookEntryFunction · 0.90

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected