From 13b2575dfef8aa76ba67b465aa7489a8433cf38e Mon Sep 17 00:00:00 2001 From: Colby Mchenry Date: Fri, 12 Jun 2026 11:43:18 -0500 Subject: [PATCH] fix(installer): opencode global config goes to ~/.config/opencode on every platform (#535) (#836) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(installer): opencode global config goes to ~/.config/opencode on every platform (#535) opencode resolves its config dir with xdg-basedir (XDG_CONFIG_HOME ?? ~/.config) unconditionally — it never reads %APPDATA%; that layout belonged to the discontinued Go fork. Writing there on Windows meant opencode never saw the MCP entry. - globalConfigDir(): drop the win32 APPDATA branch; XDG resolution everywhere - install/uninstall (global): sweep a stale codegraph entry + AGENTS.md block out of the legacy %APPDATA%/opencode location (siblings/comments untouched) - detect(global): a legacy-only dir still counts as installed so the sweep is reachable - tests are env-gated, not platform-gated, so the whole matrix runs on any OS; the suite previously pointed APPDATA and XDG_CONFIG_HOME at the same dir, which is exactly how the divergence stayed invisible Supersedes the prefer-if-exists approach of #670 (greenfield installs -- before opencode's first run -- would still have fallen back to APPDATA). Co-Authored-By: Claude Opus 4.8 * test(installer): match legacy sweep paths by dir prefix, not 'AppData' substring On Windows os.tmpdir() lives under AppData\Local\Temp, so every harness path contains 'AppData' and the substring assertions false-positive. Caught on the real Windows VM. Co-Authored-By: Claude Opus 4.8 --------- Co-authored-by: Claude Opus 4.8 --- CHANGELOG.md | 1 + __tests__/installer-targets.test.ts | 149 ++++++++++++++++++++++++++++ src/installer/targets/opencode.ts | 123 ++++++++++++++++------- 3 files changed, 236 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1527a55..90bd115 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Fixes +- **opencode on Windows now finds CodeGraph.** The installer wrote opencode's global MCP entry to `%APPDATA%\opencode\`, but opencode reads its config from `~/.config/opencode/` on every platform (honoring `XDG_CONFIG_HOME`), so the entry was invisible to it. Installs now write where opencode actually looks, and `codegraph install` / `codegraph uninstall` both clean a stale CodeGraph entry out of the old `%APPDATA%` location — other servers and comments in that file are left untouched. Thanks @fucknoobhanzo for the report and @WodenJay for the first patch. (#535) - The `codegraph_search` tool's `kind: "type"` filter — a value its own schema advertises — silently matched nothing; it now correctly finds type aliases. The `codegraph_explore` tool's parameter guidance also no longer suggests running `codegraph_search` first, which contradicted explore's call-it-first design and cost agents an extra round-trip. - Symbols defined in Svelte and Vue `