mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-10-18 05:41:18 +08:00
98718cf6db
`readJsonFile` copied an unparseable file to `<path>.backup` and warned that it was about to be overwritten. That is the right thing to do just before a write, but every target's `detect()` reads its agent's config through the same helper — and `install --refresh` detects every target in order to skip the ones codegraph was never installed into. So an empty `~/.gemini/config/mcp_config.json`, sitting beside an Antigravity install codegraph does not manage, got a 0-byte `mcp_config.json.backup` and a warning about an overwrite that never came. Detection is meant to be read-only. `readJsonFile` is now a pure read. Preserving an unparseable config moves to `writeJsonFile`, the one place a target replaces a JSON config — so the backup still happens wherever it mattered, and only there. Reads that decide not to write (the legacy-entry cleanups, the uninstall sweeps) no longer leave one behind either. Unchanged on purpose: an install that really does overwrite an empty config still backs it up. Skipping the copy when there is nothing to preserve is a separate call.