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

Function cleanupLegacyWindowsState

src/installer/targets/opencode.ts:263–275  ·  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

261 * genuinely keep other tools' state under %APPDATA%.
262 */
263function 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

Callers 2

installMethod · 0.85
uninstallMethod · 0.85

Calls 4

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

Tested by

no test coverage detected