()
| 121 | } |
| 122 | |
| 123 | function writeHermesConfig(): WriteResult['files'][number] { |
| 124 | const file = configPath(); |
| 125 | const existed = fs.existsSync(file); |
| 126 | const before = readText(file); |
| 127 | const afterMcp = upsertCodeGraphMcpServer(before); |
| 128 | const after = upsertCodeGraphToolset(afterMcp); |
| 129 | |
| 130 | if (after === before) { |
| 131 | return { path: file, action: 'unchanged' }; |
| 132 | } |
| 133 | atomicWriteFileSync(file, ensureTrailingNewline(after)); |
| 134 | return { path: file, action: existed ? 'updated' : 'created' }; |
| 135 | } |
| 136 | |
| 137 | function ensureTrailingNewline(text: string): string { |
| 138 | return text.endsWith('\n') ? text : text + '\n'; |
no test coverage detected