Skip to content

[Bug]: XDG Base Directory Spec violation — node_modules installed in ~/.config instead of ~/.local/share #27786

@ilyachch

Description

@ilyachch

Description

When running opencode, the application installs runtime dependencies (node_modules, package.json, and package-lock.json) into ~/.config/opencode.

This is a violation of the XDG Base Directory Specification. The ~/.config directory ($XDG_CONFIG_HOME) is strictly reserved for user-specific configuration files. Runtime data, dependencies, and state files should be stored in ~/.local/share ($XDG_DATA_HOME).

Why this is a problem

  • Many users back up their ~/.config directory using tools like git (dotfiles), stow, or chezmoi. Placing node_modules in this directory causes massive repository bloat, sync issues, and forces users to manually add workarounds to their .gitignore files.
  • Broken File Watchers: Applications, background daemons, or text editors that monitor ~/.config for configuration changes get overwhelmed or stuck in infinite reload loops due to the massive number of files and rapid I/O operations within node_modules.
  • Loss of Configuration Portability: Mixing mutable runtime dependencies with immutable configuration files breaks portability across different environments (Linux, macOS). It prevents users from symlinking their configs using tools like stow, as the application attempts to write heavy runtime data directly into the clean config structure.

Plugins

None

OpenCode version

1.15.0

Steps to reproduce

  1. Launch opencode.
  2. Check the contents of the config directory: ls ~/.config/opencode.
  3. Notice that node_modules, package.json, and package-lock.json are created there.

Expected behavior

  • Configuration files stay in ~/.config/opencode/ (or $XDG_CONFIG_HOME/opencode/).
  • Runtime dependencies, packages, and downloaded data should be placed in ~/.local/share/opencode/ (or $XDG_DATA_HOME/opencode/).

Actual behavior

Runtime dependencies and package tracking files are placed in ~/.config/opencode/.

Operating System

Arch Linux

Terminal

Ghostty

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions