codegraph icon indicating copy to clipboard operation
codegraph copied to clipboard

fix(installer): use opencode config dir on Windows

Open NgoQuocViet2001 opened this issue 6 months ago • 3 comments

Summary

  • Route global opencode installs to ~/.config/opencode on Windows instead of %APPDATA%/opencode.
  • Keep the existing XDG_CONFIG_HOME override behavior for global installs.
  • Add a Windows regression test that sets APPDATA and verifies CodeGraph writes both opencode.jsonc and AGENTS.md under ~/.config/opencode.
  • Make one existing local opencode path assertion separator-agnostic so the installer target test runs cleanly on Windows.

Closes #186.

Why

OpenCode documents the global config path as ~/.config/opencode/opencode.json, and #186 reports that the installer-created %APPDATA%/opencode config is not the file OpenCode reads on Windows. That makes codegraph install --target=opencode appear successful while the MCP server and instructions do not load.

Duplicate check

Checked recent/open PRs for opencode. #162 and #163 already merged the multi-target installer and .jsonc/AGENTS.md support, but they do not address the Windows %APPDATA% path. I did not find an open PR covering #186.

Test plan

  • node node_modules/vitest/vitest.mjs run __tests__/installer-targets.test.ts — 57 passed
  • node node_modules/typescript/bin/tsc --noEmit

NgoQuocViet2001 avatar May 20 '26 03:05 NgoQuocViet2001

Confirmed this fixes a real bug — hit it today on Windows with OpenCode v1.15.10 and CodeGraph v0.9.4. The installer's %APPDATA%\opencode\ output looks successful but OpenCode silently ignores it. Had to manually move config to ~\.config\opencode\ to get the MCP server loading.

Tests pass cleanly, and this is blocking every Windows + OpenCode user from a working install. Any chance this can be merged soon?

skywalker-35 avatar May 25 '26 15:05 skywalker-35

Thanks for confirming, @skywalker-35. I rebased this on the latest main and resolved the test conflict; GitHub now shows the PR as mergeable again.

Validation:

  • node node_modules/vitest/vitest.mjs run __tests__/installer-targets.test.ts (83 passed)
  • node node_modules/typescript/bin/tsc --noEmit

@colbymchenry this should be ready for another look/merge when you have a chance.

NgoQuocViet2001 avatar May 25 '26 15:05 NgoQuocViet2001

Will this be merged soon? Thank you :)

accodev avatar May 27 '26 07:05 accodev