You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feat: Add --config CLI flag to specify custom config file path #2066
Currently, opencode supports specifying a custom config file path via the OPENCODE_CONFIG environment variable. It would be more convenient and intuitive to also support this functionality through a CLI flag like --config.
Current Behavior
To use a custom config file, users must set an environment variable:
export OPENCODE_CONFIG=/path/to/my/custom-config.json
opencode run "Hello world"
Proposed Enhancement
Add a --config CLI flag that accepts a file path:
opencode --config /path/to/my/custom-config.json run "Hello world"
opencode --config ./project-specific-config.jsonc run "Implement feature X"
Benefits
Better UX: More discoverable through --help and follows common CLI conventions
Per-command flexibility: Easier to use different configs for different commands without managing environment variables
Script-friendly: Cleaner in shell scripts and CI/CD pipelines
Consistency: Aligns with how most CLI tools handle config file specification
Implementation Notes
• The CLI flag should take precedence over the OPENCODE_CONFIG environment variable (or have the same precedence)
• Should maintain backward compatibility with the existing environment variable approach
• The flag should accept both absolute and relative paths
• Should support both .json and .jsonc formats like the current implementation
Activity
rekram1-node commentedon Dec 28, 2025
[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
misterdojo777 commentedon Jan 11, 2026
yes this would be useful for cleaner context worfklows