Skip to content

fix(installer): use opencode config dir on Windows#192

Open
NgoQuocViet2001 wants to merge 1 commit into
colbymchenry:mainfrom
NgoQuocViet2001:ai/opencode-windows-config-dir
Open

fix(installer): use opencode config dir on Windows#192
NgoQuocViet2001 wants to merge 1 commit into
colbymchenry:mainfrom
NgoQuocViet2001:ai/opencode-windows-config-dir

Conversation

@NgoQuocViet2001

Copy link
Copy Markdown

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

@skywalker-35

Copy link
Copy Markdown

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?

@NgoQuocViet2001 NgoQuocViet2001 force-pushed the ai/opencode-windows-config-dir branch from 21c3015 to fab3f64 Compare May 25, 2026 15:51
@NgoQuocViet2001

Copy link
Copy Markdown
Author

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.

@accodev

accodev commented May 27, 2026

Copy link
Copy Markdown

Will this be merged soon? Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong OpenCode init

3 participants