* Remove whatever a pre-#535 install left in `%APPDATA%/opencode` — an MCP * entry opencode never reads, plus our marker-fenced AGENTS.md block. Returns * only files actually changed, so install output stays quiet when there is * nothing to heal. Never touches anything else in the legacy dir: a u
()
| 323 | * genuinely keep other tools' state under %APPDATA%. |
| 324 | */ |
| 325 | function cleanupLegacyWindowsState(): WriteResult['files'] { |
| 326 | const dir = legacyWindowsConfigDir(); |
| 327 | if (!dir || !fs.existsSync(dir)) return []; |
| 328 | const out: WriteResult['files'] = []; |
| 329 | for (const name of ['opencode.jsonc', 'opencode.json']) { |
| 330 | const res = removeMcpEntryAt(path.join(dir, name)); |
| 331 | if (res.action === 'removed') out.push(res); |
| 332 | } |
| 333 | const agents = path.join(dir, 'AGENTS.md'); |
| 334 | const action = removeMarkedSection(agents, CODEGRAPH_SECTION_START, CODEGRAPH_SECTION_END); |
| 335 | if (action === 'removed') out.push({ path: agents, action }); |
| 336 | return out; |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * Strip the marker-delimited CodeGraph block from AGENTS.md if a prior |
no test coverage detected