pub struct SkillsService<'a> { /* private fields */ }Expand description
Single source of truth for skill + skill-bundle operations.
Holds an immutable reference to Config and the install-root path. Reads
are filesystem operations against the resolved bundle directories;
writes go through the matching helpers in super::scaffold,
super::bundle, and super::document so a single rule lives in a
single place.
Implementations§
Source§impl<'a> SkillsService<'a>
impl<'a> SkillsService<'a>
pub fn new(config: &'a Config, install_root: impl Into<PathBuf>) -> Self
pub fn install_root(&self) -> &Path
Sourcepub fn resolve_ref(
&self,
name: &str,
bundle: Option<&str>,
) -> Result<SkillRef, ServiceError>
pub fn resolve_ref( &self, name: &str, bundle: Option<&str>, ) -> Result<SkillRef, ServiceError>
Resolve a (name, bundle?) pair into a unique SkillRef per the
disambiguation rule defined in super::reference::resolve.
Sourcepub fn list_bundles(&self) -> Result<Vec<BundleSummary>, ServiceError>
pub fn list_bundles(&self) -> Result<Vec<BundleSummary>, ServiceError>
One BundleSummary per configured bundle, in HashMap order.
Sourcepub fn list_skills(
&self,
bundle_filter: Option<&str>,
) -> Result<Vec<SkillSummary>, ServiceError>
pub fn list_skills( &self, bundle_filter: Option<&str>, ) -> Result<Vec<SkillSummary>, ServiceError>
All skills in bundle_filter (or all bundles when None). Skips any
child directory that’s missing a canonical or deprecated manifest.
Sourcepub fn read_skill(
&self,
target: &SkillRef,
) -> Result<SkillDocument, ServiceError>
pub fn read_skill( &self, target: &SkillRef, ) -> Result<SkillDocument, ServiceError>
Read the SKILL.md for a resolved skill.
Sourcepub fn write_skill(
&self,
target: &SkillRef,
doc: &SkillDocument,
) -> Result<(), ServiceError>
pub fn write_skill( &self, target: &SkillRef, doc: &SkillDocument, ) -> Result<(), ServiceError>
Overwrite the SKILL.md for a resolved skill.
Sourcepub fn scaffold_skill(
&self,
target: &SkillRef,
frontmatter: SkillFrontmatter,
opts: ScaffoldOptions,
) -> Result<PathBuf, ServiceError>
pub fn scaffold_skill( &self, target: &SkillRef, frontmatter: SkillFrontmatter, opts: ScaffoldOptions, ) -> Result<PathBuf, ServiceError>
Materialize a brand-new skill on disk per the canonical layout.
Sourcepub fn remove_skill(
&self,
target: &SkillRef,
mode: RemoveMode,
) -> Result<(), ServiceError>
pub fn remove_skill( &self, target: &SkillRef, mode: RemoveMode, ) -> Result<(), ServiceError>
Archive or purge a skill directory.
Auto Trait Implementations§
impl<'a> Freeze for SkillsService<'a>
impl<'a> RefUnwindSafe for SkillsService<'a>
impl<'a> Send for SkillsService<'a>
impl<'a> Sync for SkillsService<'a>
impl<'a> Unpin for SkillsService<'a>
impl<'a> UnsafeUnpin for SkillsService<'a>
impl<'a> UnwindSafe for SkillsService<'a>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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