MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / load_commands_from_dir

Function load_commands_from_dir

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

Load command definitions from markdown files in {command,commands}/**/*.md

(dir: &Path)

Source from the content-addressed store, hash-verified

592
593/// Load command definitions from markdown files in {command,commands}/**/*.md
594fn load_commands_from_dir(dir: &Path) -> HashMap<String, CommandConfig> {
595 let mut result = HashMap::new();
596
597 for subdir_name in &["command", "commands"] {
598 let subdir = dir.join(subdir_name);
599 if !subdir.is_dir() {
600 continue;
601 }
602 if let Ok(entries) = glob_md_files(&subdir) {
603 for entry in entries {
604 if let Some((name, content)) = parse_markdown_command(&entry, dir) {
605 result.insert(name, content);
606 }
607 }
608 }
609 }
610
611 result
612}
613
614/// Load agent definitions from markdown files in {agent,agents}/**/*.md
615fn load_agents_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_commandFunction · 0.85
is_dirMethod · 0.80

Tested by

no test coverage detected