pub struct FsSkillResolver { /* private fields */ }Expand description
Filesystem-backed SkillResolver over a .claude/skills/ directory.
Why: Gives the tool-registry layer (the use_skill tool) a ready
concrete resolver: metadata is discovered once at construction (cheap,
cached); resolve reads a single skill’s body lazily, on demand.
What: Wraps skills_dir plus the metadata discovered from it at
construction time. metadata()/list() return the cached catalog;
resolve() calls load_skill_body per invocation.
As of #3539 (Phase 1 Claude Code plugin support), also namespaces and
resolves plugin skills (<plugin>:<name>) — see plugins::skills,
which this struct delegates to additively (never suppressing, never
suppressed by, the project/embedded threshold above).
Test: fs_skill_resolver_resolves_known_skill,
fs_skill_resolver_list_matches_metadata_names,
fs_skill_resolver_resolve_unknown_returns_none,
fs_skill_resolver_resolves_namespaced_plugin_skill,
fs_skill_resolver_metadata_includes_plugin_skills_alongside_project_skill.
Implementations§
Source§impl FsSkillResolver
impl FsSkillResolver
Sourcepub fn new(skills_dir: impl Into<PathBuf>) -> Self
pub fn new(skills_dir: impl Into<PathBuf>) -> Self
Construct a resolver, eagerly discovering (cheap) metadata.
Why: Metadata discovery is a directory scan plus frontmatter parsing
only — cheap enough to do once at construction so every later
metadata()/list() call is a clone of an in-memory Vec.
What: Calls discover_skill_metadata(&skills_dir), then additively
extends it with plugins::skills::discover_plugin_skills when a
project root can be recovered from skills_dir (#3539) — plugin
skills are independent of the project/embedded threshold
discover_skill_metadata applies, so they are appended regardless
of whether that call returned the project’s own catalog or the
embedded fallback.
Test: fs_skill_resolver_resolves_known_skill,
fs_skill_resolver_metadata_includes_plugin_skills_alongside_project_skill.
Trait Implementations§
Source§impl SkillResolver for FsSkillResolver
impl SkillResolver for FsSkillResolver
Source§fn resolve(&self, name: &str) -> Option<String>
fn resolve(&self, name: &str) -> Option<String>
A namespaced <plugin>:<name> (the exact shape a plugin skill
listing surfaces, and — via tools::skill::UseSkillTool — the exact
shape an LLM’s raw use_skill argument can be) routes to
plugins::skills::resolve_plugin_skill_body, which is itself the
authoritative traversal guard (validates the namespaced shape and
discovered-catalog membership before ever building a path — issue
#3547 CRITICAL 2). This wrapper does not re-validate; it only
recovers the cached project_root (None short-circuits to None
rather than falling through to the plain-name path below, since a
namespaced name is never a valid plain skill name either way).
Source§fn metadata(&self) -> Vec<SkillMetadata>
fn metadata(&self) -> Vec<SkillMetadata>
Auto Trait Implementations§
impl Freeze for FsSkillResolver
impl RefUnwindSafe for FsSkillResolver
impl Send for FsSkillResolver
impl Sync for FsSkillResolver
impl Unpin for FsSkillResolver
impl UnsafeUnpin for FsSkillResolver
impl UnwindSafe for FsSkillResolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more