(base: &Path)
| 57 | } |
| 58 | |
| 59 | fn collect_skill_roots(base: &Path) -> Vec<PathBuf> { |
| 60 | let mut roots = Vec::new(); |
| 61 | if let Some(home) = home_dir() { |
| 62 | roots.push(home.join(".agents/skills")); |
| 63 | roots.push(home.join(".claude/skills")); |
| 64 | } |
| 65 | |
| 66 | // Global config directory (e.g. ~/.config/opencode/skills) |
| 67 | if let Some(config_dir) = dirs::config_dir() { |
| 68 | roots.push(config_dir.join("opencode/skill")); |
| 69 | roots.push(config_dir.join("opencode/skills")); |
| 70 | } |
| 71 | |
| 72 | // Home .opencode directory |
| 73 | if let Some(home) = home_dir() { |
| 74 | roots.push(home.join(".opencode/skill")); |
| 75 | roots.push(home.join(".opencode/skills")); |
| 76 | } |
| 77 | |
| 78 | roots.push(base.join(".agents/skills")); |
| 79 | roots.push(base.join(".claude/skills")); |
| 80 | roots.push(base.join(".opencode/skill")); |
| 81 | roots.push(base.join(".opencode/skills")); |
| 82 | |
| 83 | if let Ok(config) = load_config(base) { |
| 84 | if let Some(skills) = config.skills { |
| 85 | for raw in skills.paths { |
| 86 | roots.push(resolve_skill_path(base, &raw)); |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | let mut deduped = Vec::new(); |
| 92 | for root in roots { |
| 93 | if !deduped.contains(&root) { |
| 94 | deduped.push(root); |
| 95 | } |
| 96 | } |
| 97 | deduped |
| 98 | } |
| 99 | |
| 100 | fn parse_frontmatter_value(frontmatter: &str, key: &str) -> Option<String> { |
| 101 | for line in frontmatter.lines() { |
no test coverage detected