MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / sample_skill_files

Function sample_skill_files

crates/opencode-tool/src/skill.rs:195–216  ·  view source on GitHub ↗
(skill: &SkillInfo, limit: usize)

Source from the content-addressed store, hash-verified

193}
194
195fn sample_skill_files(skill: &SkillInfo, limit: usize) -> Vec<PathBuf> {
196 let Some(base_dir) = skill.location.parent() else {
197 return Vec::new();
198 };
199
200 let mut files: Vec<PathBuf> = WalkDir::new(base_dir)
201 .follow_links(false)
202 .into_iter()
203 .filter_map(Result::ok)
204 .filter(|entry| entry.file_type().is_file())
205 .map(|entry| entry.path().to_path_buf())
206 .filter(|path| {
207 path.file_name()
208 .and_then(|name| name.to_str())
209 .map(|name| name != "SKILL.md")
210 .unwrap_or(false)
211 })
212 .collect();
213 files.sort();
214 files.truncate(limit);
215 files
216}
217
218#[async_trait]
219impl Tool for SkillTool {

Callers 1

executeMethod · 0.85

Calls 3

newFunction · 0.85
is_fileMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected