Skip to main content

Module opencode_config

Module opencode_config 

Source
Expand description

Single source of truth for locating OpenCode’s global config file.

OpenCode accepts both opencode.json and opencode.jsonc. lean-ctx used to hardcode opencode.json in every writer, so a user whose config was opencode.jsonc got a second, competing global config containing nothing but the lean-ctx MCP entry and shadow-mode denies — their providers, models and foreign MCP servers appeared to vanish (#1585).

Resolution rule, applied by init, setup, doctor, the shadow-mode permission updater and uninstall alike:

  1. exactly one of the two exists → that file
  2. both exist → opencode.json (OpenCode’s own default name), reported via Resolved::ambiguous so callers can warn instead of silently picking
  3. neither exists → opencode.json, to be created

Structs§

Resolved
Where the OpenCode config lives, plus whether the choice was ambiguous.

Functions§

config_dir
Resolve OpenCode’s global config directory.
resolve
Resolve the global OpenCode config for a given home directory.
resolve_in_dir
Resolve the config inside an OpenCode config directory.