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

Function load_plugins_from_dir

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

Load plugin paths from .ts/.js files in {plugin,plugins}/*.{ts,js}

(dir: &Path)

Source from the content-addressed store, hash-verified

657
658/// Load plugin paths from .ts/.js files in {plugin,plugins}/*.{ts,js}
659fn load_plugins_from_dir(dir: &Path) -> Vec<String> {
660 let mut plugins = Vec::new();
661
662 for subdir_name in &["plugin", "plugins"] {
663 let subdir = dir.join(subdir_name);
664 if !subdir.is_dir() {
665 continue;
666 }
667 if let Ok(entries) = fs::read_dir(&subdir) {
668 for entry in entries.flatten() {
669 let path = entry.path();
670 if let Some(ext) = path.extension() {
671 if ext == "ts" || ext == "js" {
672 // Convert to file:// URL like TS does
673 let url = format!("file://{}", path.display());
674 plugins.push(url);
675 }
676 }
677 }
678 }
679 }
680
681 plugins
682}
683
684/// Recursively find all .md files in a directory.
685fn glob_md_files(dir: &Path) -> Result<Vec<PathBuf>> {

Callers 1

load_allMethod · 0.85

Calls 2

newFunction · 0.85
is_dirMethod · 0.80

Tested by

no test coverage detected