Skip to main content

discover_plugin_roots

Function discover_plugin_roots 

Source
pub fn discover_plugin_roots(project_root: &Path) -> Vec<PluginRoot>
Expand description

Discover every plugin under the project’s resolved plugins/ directory.

Why: the single scan point agents::discover_plugin_agents, skills::discover_plugin_skills, and the namespaced-name resolvers in both submodules all build on. What: the directory comes from crate::paths::plugins_dir, so a project that has moved to .trusty-code/plugins/ is scanned there and one still on .claude/plugins/ keeps working (#5426). Each immediate subdirectory is one plugin root, resolved via load_plugin_root. A missing/unreadable directory yields an empty list (never an error — a project simply using no plugins is the common case, mirroring agents::discover_agents’s missing-dir handling). Non-directory entries are skipped. Sorted by resolved name. Test: tests::discover_plugin_roots_missing_dir_is_empty, tests::discover_plugin_roots_finds_subdirs, tests::discover_plugin_roots_honors_manifest_name_override, paths::tests::plugins_dir_prefers_trusty_code.