Skip to main content

FsSkillResolver

Struct FsSkillResolver 

Source
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

Source

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

Source§

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 list(&self) -> Vec<String>

List all discoverable skill names.
Source§

fn metadata(&self) -> Vec<SkillMetadata>

Cached metadata (name + description) for every discoverable skill.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more