MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / global_files

Function global_files

crates/opencode-session/src/instruction.rs:63–84  ·  view source on GitHub ↗

Build the list of global instruction file paths to probe.

()

Source from the content-addressed store, hash-verified

61
62/// Build the list of global instruction file paths to probe.
63fn 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").

Callers 1

Calls 5

newFunction · 0.85
opencode_config_dir_envFunction · 0.85
global_config_dirFunction · 0.85
env_truthyFunction · 0.85
home_dirFunction · 0.85

Tested by

no test coverage detected