MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / cleanupLegacyWindowsState

Function cleanupLegacyWindowsState

src/installer/targets/opencode.ts:322–334  ·  view source on GitHub ↗

* 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

()

Source from the content-addressed store, hash-verified

320 * genuinely keep other tools' state under %APPDATA%.
321 */
322function cleanupLegacyWindowsState(): WriteResult['files'] {
323 const dir = legacyWindowsConfigDir();
324 if (!dir || !fs.existsSync(dir)) return [];
325 const out: WriteResult['files'] = [];
326 for (const name of ['opencode.jsonc', 'opencode.json']) {
327 const res = removeMcpEntryAt(path.join(dir, name));
328 if (res.action === 'removed') out.push(res);
329 }
330 const agents = path.join(dir, 'AGENTS.md');
331 const action = removeMarkedSection(agents, CODEGRAPH_SECTION_START, CODEGRAPH_SECTION_END);
332 if (action === 'removed') out.push({ path: agents, action });
333 return out;
334}
335
336/**
337 * Strip the marker-delimited CodeGraph block from AGENTS.md if a prior

Callers 2

installMethod · 0.85
uninstallMethod · 0.85

Calls 5

removeMarkedSectionFunction · 0.90
legacyWindowsConfigDirFunction · 0.85
removeMcpEntryAtFunction · 0.85
pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected