* 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
()
| 261 | * genuinely keep other tools' state under %APPDATA%. |
| 262 | */ |
| 263 | function cleanupLegacyWindowsState(): WriteResult['files'] { |
| 264 | const dir = legacyWindowsConfigDir(); |
| 265 | if (!dir || !fs.existsSync(dir)) return []; |
| 266 | const out: WriteResult['files'] = []; |
| 267 | for (const name of ['opencode.jsonc', 'opencode.json']) { |
| 268 | const res = removeMcpEntryAt(path.join(dir, name)); |
| 269 | if (res.action === 'removed') out.push(res); |
| 270 | } |
| 271 | const agents = path.join(dir, 'AGENTS.md'); |
| 272 | const action = removeMarkedSection(agents, CODEGRAPH_SECTION_START, CODEGRAPH_SECTION_END); |
| 273 | if (action === 'removed') out.push({ path: agents, action }); |
| 274 | return out; |
| 275 | } |
| 276 | |
| 277 | /** |
| 278 | * Strip the marker-delimited CodeGraph block from AGENTS.md if a prior |
no test coverage detected