MCPcopy Create free account
hub / github.com/AI45Lab/Code / from_file

Method from_file

core/src/skills/mod.rs:164–177  ·  view source on GitHub ↗

Load a skill from a file

(path: impl AsRef<Path>)

Source from the content-addressed store, hash-verified

162
163 /// Load a skill from a file
164 pub fn from_file(path: impl AsRef<Path>) -> anyhow::Result<Self> {
165 let content = std::fs::read_to_string(path.as_ref())?;
166 let mut skill =
167 Self::parse(&content).ok_or_else(|| anyhow::anyhow!("Failed to parse skill file"))?;
168
169 // Use filename as name if not specified
170 if skill.name.is_empty() {
171 if let Some(stem) = path.as_ref().file_stem() {
172 skill.name = stem.to_string_lossy().to_string();
173 }
174 }
175
176 Ok(skill)
177 }
178
179 /// Parse allowed tools into a set of tool permissions
180 ///

Callers

nothing calls this directly

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected