Skip to content

Navigation Menu

Sign in
Sign up

zg install --target opencode writes opencode.json even when the active config is opencode.jsonc #103

Open

Description

Environment

  • zg 0.2.1, Linux, Node 24
  • OpenCode v2 with the config at ~/.config/opencode/opencode.jsonc (JSONC, with comments)
  • OPENCODE_CONFIG not set

What happened
zg install --target opencode wrote a managed zvec_grep MCP entry into ~/.config/opencode/opencode.json. OpenCode reads our opencode.jsonc, so the installer created a shadow file that the agent never loads -- the integration silently does nothing until the entry is added to the .jsonc manually.

Repro

  1. Have ~/.config/opencode/opencode.jsonc as your active OpenCode config (no opencode.json present).
  2. Run zg install --target opencode --yes.
  3. ~/.config/opencode/opencode.json is created with the managed entry; the agent still has no zvec-grep tool.

Expected
The installer should detect an existing opencode.jsonc (or an OPENCODE_CONFIG pointing at one) and write the managed entry there, preserving JSONC comments and unrelated settings the way the Qwen/Qoder paths already do. If both exist, prefer the one OpenCode actually loads and say so in the output.

Workaround we use
Hand-adding the flat entry to opencode.jsonc: "zvec_grep": { "type": "local"|"remote", ... , "enabled": true }. Everything else about the integration (agent toolset, guidance, server) works great once the entry lands in the real config -- thanks for a genuinely useful tool.

Suggested fix
In the opencode target resolution, stat opencode.jsonc before defaulting to opencode.json, and route managed-block writes through a JSONC-preserving editor (the Qwen settings.json path already preserves comments, so the machinery seems to exist).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      AltStyle によって変換されたページ (->オリジナル) /