pub struct FsSkill { /* private fields */ }Expand description
A filesystem-backed skill.
Each FsSkill owns its root directory and SKILL.md path. Resource loading
and script execution are performed relative to root_dir.
Use FsSkill::discover to scan a directory for skills, or
FsSkill::discover_roots for multiple directories.
Implementations§
Source§impl FsSkill
impl FsSkill
Sourcepub fn discover(root: impl Into<PathBuf>) -> Result<DiscoveryResult, SkillError>
pub fn discover(root: impl Into<PathBuf>) -> Result<DiscoveryResult, SkillError>
Discover all valid skills under a single root directory.
Sourcepub fn discover_roots(
roots: Vec<PathBuf>,
) -> Result<DiscoveryResult, SkillError>
pub fn discover_roots( roots: Vec<PathBuf>, ) -> Result<DiscoveryResult, SkillError>
Discover skills under multiple root directories.
Returns an error if duplicate skill IDs are found across roots.
Trait Implementations§
Source§impl Skill for FsSkill
impl Skill for FsSkill
Source§fn read_instructions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, SkillError>> + Send + 'async_trait>>where
'life0: 'async_trait,
FsSkill: 'async_trait,
fn read_instructions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, SkillError>> + Send + 'async_trait>>where
'life0: 'async_trait,
FsSkill: 'async_trait,
Read the raw SKILL.md content.
Source§fn load_resource<'life0, 'life1, 'async_trait>(
&'life0 self,
kind: SkillResourceKind,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<SkillResource, SkillError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FsSkill: 'async_trait,
fn load_resource<'life0, 'life1, 'async_trait>(
&'life0 self,
kind: SkillResourceKind,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<SkillResource, SkillError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FsSkill: 'async_trait,
Load a resource (reference or asset) by relative path.
Source§fn run_script<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
script: &'life1 str,
args: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<ScriptResult, SkillError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
FsSkill: 'async_trait,
fn run_script<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
script: &'life1 str,
args: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<ScriptResult, SkillError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
FsSkill: 'async_trait,
Run a script by relative path with arguments.
Auto Trait Implementations§
impl Freeze for FsSkill
impl RefUnwindSafe for FsSkill
impl Send for FsSkill
impl Sync for FsSkill
impl Unpin for FsSkill
impl UnwindSafe for FsSkill
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
Mutably borrows from an owned value. Read more