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

Function load_agents_from_dir

crates/opencode-config/src/loader.rs:615–633  ·  view source on GitHub ↗

Load agent definitions from markdown files in {agent,agents}/**/*.md

(dir: &Path)

Source from the content-addressed store, hash-verified

613
614/// Load agent definitions from markdown files in {agent,agents}/**/*.md
615fn load_agents_from_dir(dir: &Path) -> HashMap<String, AgentConfig> {
616 let mut result = HashMap::new();
617
618 for subdir_name in &["agent", "agents"] {
619 let subdir = dir.join(subdir_name);
620 if !subdir.is_dir() {
621 continue;
622 }
623 if let Ok(entries) = glob_md_files(&subdir) {
624 for entry in entries {
625 if let Some((name, config)) = parse_markdown_agent(&entry, dir) {
626 result.insert(name, config);
627 }
628 }
629 }
630 }
631
632 result
633}
634
635/// Load mode definitions from markdown files in {mode,modes}/*.md
636fn load_modes_from_dir(dir: &Path) -> HashMap<String, AgentConfig> {

Callers 1

load_allMethod · 0.85

Calls 4

newFunction · 0.85
glob_md_filesFunction · 0.85
parse_markdown_agentFunction · 0.85
is_dirMethod · 0.80

Tested by

no test coverage detected