Skip to content

OpenCode config output path mismatch (global mode) #835

@Hzbeta

Description

@Hzbeta

When running:

rulesync generate --targets opencode --features mcp --global

Rulesync writes the OpenCode MCP config to ~/opencode.json.

But OpenCode reads its config from ~/.config/opencode/opencode.json (Windows: %USERPROFILE%\.config\opencode\opencode.json). As a result, the generated MCP servers are not picked up unless the file is copied/moved.

Suggested fix: in global mode, write OpenCode MCP output to ~/.config/opencode/opencode.json (align with other OpenCode global outputs like skills/commands).

(edited) clarified that the underlying issue affects other global outputs (e.g., agents.md) in addition to MCP.


Code pointers (v5.4.0):

  • src/features/mcp/opencode-mcp.ts: OpenCodeMcp.getSettablePaths({ global }) returns relativeDirPath: "." and relativeFilePath: "opencode.json" (same for global/project).
  • src/config/config-resolver.ts: when global is enabled, baseDirs is forced to [os.homedir()].
  • src/types/ai-file.ts: final output path is path.join(baseDir, relativeDirPath, relativeFilePath).

So in global mode the computed path becomes os.homedir() + /opencode.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions