MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / opencode_config_path

Function opencode_config_path

src/agents/opencode.rs:168–176  ·  view source on GitHub ↗

Returns the path to opencode config (global). Prefers `$HOME/.config/opencode/opencode.json`. Falls back to `$XDG_CONFIG_HOME/opencode/opencode.json` only when the XDG path is under `home` (so tests with temp-dir homes are never polluted by the real user's environment).

(home: &Path)

Source from the content-addressed store, hash-verified

166/// is under `home` (so tests with temp-dir homes are never polluted by
167/// the real user's environment).
168fn opencode_config_path(home: &Path) -> std::path::PathBuf {
169 if let Ok(xdg) = std::env::var("XDG_CONFIG_HOME") {
170 let xdg_path = std::path::PathBuf::from(&xdg);
171 if xdg_path.starts_with(home) {
172 return xdg_path.join("opencode/opencode.json");
173 }
174 }
175 home.join(".config/opencode/opencode.json")
176}
177
178/// Returns the path to the global AGENTS.md prompt file.
179fn opencode_prompt_path(home: &Path) -> std::path::PathBuf {

Callers 5

installMethod · 0.70
uninstallMethod · 0.70
primary_config_pathMethod · 0.70
has_tracedecayMethod · 0.70
doctor_check_configFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected