Skip to content

[BUG] Config and logger ignore XDG base directory environment variables #349

@NamedIdentity

Description

@NamedIdentity

Description

The DCP config loader and logger hardcode homedir()/.config/opencode for resolving paths, ignoring the XDG_CONFIG_HOME and XDG_DATA_HOME environment variables. This causes DCP to fail to find its config file and fail to write debug logs for any user running with custom XDG base directories.

Affected Files

  • lib/config.tsGLOBAL_CONFIG_DIR uses join(homedir(), ".config", "opencode") instead of checking XDG_CONFIG_HOME
  • lib/logger.tslogDir uses join(homedir(), ".config", "opencode") instead of checking XDG_DATA_HOME

Expected Behavior

DCP should respect XDG base directory environment variables per the XDG Base Directory Specification:

  • XDG_CONFIG_HOME → config files (default: ~/.config)
  • XDG_DATA_HOME → data/log files (default: ~/.local/share)

OpenCode itself respects these variables. DCP should too, otherwise its config and logs end up in a different location than the rest of OpenCode when users set custom XDG paths.

Steps to Reproduce

  1. Set XDG_CONFIG_HOME to a custom path (e.g., /tmp/test-config)
  2. Place dcp.jsonc at $XDG_CONFIG_HOME/opencode/dcp.jsonc with "debug": true
  3. Run OpenCode — DCP ignores the config and uses defaults
  4. No debug logs appear at $XDG_DATA_HOME/opencode/logs/dcp/

Environment

  • OS: Windows 10 (also affects Linux/macOS users with custom XDG paths)
  • OpenCode: 1.1.48
  • DCP: 1.2.7+

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