Build the list of global instruction file paths to probe.
()
| 61 | |
| 62 | /// Build the list of global instruction file paths to probe. |
| 63 | fn global_files() -> Vec<PathBuf> { |
| 64 | let mut files = Vec::new(); |
| 65 | |
| 66 | // OPENCODE_CONFIG_DIR override comes first |
| 67 | if let Some(dir) = opencode_config_dir_env() { |
| 68 | files.push(PathBuf::from(&dir).join(AGENTS_MD)); |
| 69 | } |
| 70 | |
| 71 | // ~/.config/opencode/AGENTS.md |
| 72 | if let Some(cfg) = global_config_dir() { |
| 73 | files.push(cfg.join(AGENTS_MD)); |
| 74 | } |
| 75 | |
| 76 | // ~/.claude/CLAUDE.md |
| 77 | if !env_truthy("OPENCODE_DISABLE_CLAUDE_CODE_PROMPT") { |
| 78 | if let Some(home) = dirs::home_dir() { |
| 79 | files.push(home.join(".claude").join(CLAUDE_MD)); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | files |
| 84 | } |
| 85 | |
| 86 | /// Walk from `start` up to `stop` (inclusive), collecting every existing |
| 87 | /// occurrence of `target` (a relative path like "AGENTS.md"). |
no test coverage detected