(loc: Location)
| 175 | } |
| 176 | |
| 177 | function writeMcpEntry(loc: Location): WriteResult['files'][number] { |
| 178 | const file = mcpJsonPath(loc); |
| 179 | const existing = readJsonFile(file); |
| 180 | const before = existing.mcpServers?.codegraph; |
| 181 | const after = buildCursorMcpConfig(loc); |
| 182 | |
| 183 | if (jsonDeepEqual(before, after)) { |
| 184 | return { path: file, action: 'unchanged' }; |
| 185 | } |
| 186 | const action: 'created' | 'updated' = before ? 'updated' : (fs.existsSync(file) ? 'updated' : 'created'); |
| 187 | if (!existing.mcpServers) existing.mcpServers = {}; |
| 188 | existing.mcpServers.codegraph = after; |
| 189 | writeJsonFile(file, existing); |
| 190 | return { path: file, action }; |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * Remove the Cursor rules file on uninstall (and as a self-heal on |
no test coverage detected