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

Function readJsonFile

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

Source from the content-addressed store, hash-verified

88 * only where one is actually about to be overwritten.
89 */
90export function readJsonFile(filePath: string): Record<string, any> {
91 if (!fs.existsSync(filePath)) {
92 return {};
93 }
94 try {
95 return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
96 } catch {
97 return {};
98 }
99}
100
101/**
102 * 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