Returns the path to the global AGENTS.md prompt file.
(home: &Path)
| 177 | |
| 178 | /// Returns the path to the global AGENTS.md prompt file. |
| 179 | fn opencode_prompt_path(home: &Path) -> std::path::PathBuf { |
| 180 | let modern = home.join(".config/opencode/AGENTS.md"); |
| 181 | if modern.exists() || home.join(".config/opencode").exists() { |
| 182 | return modern; |
| 183 | } |
| 184 | if let Ok(xdg) = std::env::var("XDG_CONFIG_HOME") { |
| 185 | let xdg_path = std::path::PathBuf::from(&xdg); |
| 186 | if xdg_path.starts_with(home) { |
| 187 | let xdg_dir = xdg_path.join("opencode"); |
| 188 | if xdg_dir.exists() { |
| 189 | return xdg_dir.join("AGENTS.md"); |
| 190 | } |
| 191 | } |
| 192 | } |
| 193 | home.join("AGENTS.md") |
| 194 | } |
| 195 | |
| 196 | // --------------------------------------------------------------------------- |
| 197 | // Install helpers |
no test coverage detected