pub struct SkillConfig {
pub name: String,
pub content: String,
pub version: String,
pub path_resolver: Box<dyn Fn(&str) -> PathBuf + Send + Sync>,
}Expand description
Configuration for a skill to be managed.
Fields§
§name: StringThe tool name (e.g., “agent-doc”, “webmaster”).
content: StringThe bundled SKILL.md content (typically from include_str!).
version: StringThe tool version (typically from env!("CARGO_PKG_VERSION")).
path_resolver: Box<dyn Fn(&str) -> PathBuf + Send + Sync>The relative path resolver for the target environment.
Implementations§
Source§impl SkillConfig
impl SkillConfig
Sourcepub fn new(
name: impl Into<String>,
content: impl Into<String>,
version: impl Into<String>,
path_resolver: impl Fn(&str) -> PathBuf + Send + Sync + 'static,
) -> Self
pub fn new( name: impl Into<String>, content: impl Into<String>, version: impl Into<String>, path_resolver: impl Fn(&str) -> PathBuf + Send + Sync + 'static, ) -> Self
Create a new skill config with a custom path resolver.
Sourcepub fn generic(
name: impl Into<String>,
content: impl Into<String>,
version: impl Into<String>,
) -> Self
pub fn generic( name: impl Into<String>, content: impl Into<String>, version: impl Into<String>, ) -> Self
Create a skill config that installs to .agent/skills/<name>/SKILL.md.
Sourcepub fn for_harness(
name: impl Into<String>,
content: impl Into<String>,
version: impl Into<String>,
target: HarnessTarget,
) -> Self
pub fn for_harness( name: impl Into<String>, content: impl Into<String>, version: impl Into<String>, target: HarnessTarget, ) -> Self
Create a skill config for a specific harness target.
Sourcepub fn skill_path(&self, root: Option<&Path>) -> PathBuf
pub fn skill_path(&self, root: Option<&Path>) -> PathBuf
Resolve the skill file path under the given root (or CWD if None).
Sourcepub fn install(&self, root: Option<&Path>) -> Result<()>
pub fn install(&self, root: Option<&Path>) -> Result<()>
Install the bundled SKILL.md to the project.
Sourcepub fn install_directory(
&self,
source_dir: &Path,
root: Option<&Path>,
) -> Result<()>
pub fn install_directory( &self, source_dir: &Path, root: Option<&Path>, ) -> Result<()>
Install every file from a portable skill directory into the target skill directory.
Sourcepub fn check(&self, root: Option<&Path>) -> Result<bool>
pub fn check(&self, root: Option<&Path>) -> Result<bool>
Check if the installed skill matches the bundled version.
Auto Trait Implementations§
impl !RefUnwindSafe for SkillConfig
impl !UnwindSafe for SkillConfig
impl Freeze for SkillConfig
impl Send for SkillConfig
impl Sync for SkillConfig
impl Unpin for SkillConfig
impl UnsafeUnpin for SkillConfig
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