(loc: Location)
| 129 | } |
| 130 | |
| 131 | function writeMcpEntry(loc: Location): WriteResult['files'][number] { |
| 132 | const file = settingsJsonPath(loc); |
| 133 | const dir = path.dirname(file); |
| 134 | if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true }); |
| 135 | |
| 136 | const existing = readJsonFile(file); |
| 137 | const before = existing.mcpServers?.codegraph; |
| 138 | const after = getMcpServerConfig(); |
| 139 | |
| 140 | if (jsonDeepEqual(before, after)) { |
| 141 | return { path: file, action: 'unchanged' }; |
| 142 | } |
| 143 | const action: 'created' | 'updated' = |
| 144 | before ? 'updated' : (fs.existsSync(file) ? 'updated' : 'created'); |
| 145 | if (!existing.mcpServers) existing.mcpServers = {}; |
| 146 | existing.mcpServers.codegraph = after; |
| 147 | writeJsonFile(file, existing); |
| 148 | return { path: file, action }; |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * Strip the marker-delimited CodeGraph block from GEMINI.md if a prior |
no test coverage detected