IsSkillPath reports whether a skill selector looks like a repo-relative path rather than a simple skill name.
(name string)
| 393 | // IsSkillPath reports whether a skill selector looks like a repo-relative path |
| 394 | // rather than a simple skill name. |
| 395 | func IsSkillPath(name string) bool { |
| 396 | name = strings.TrimSuffix(name, "/") |
| 397 | if name == "" { |
| 398 | return false |
| 399 | } |
| 400 | if strings.HasSuffix(name, "/SKILL.md") { |
| 401 | return true |
| 402 | } |
| 403 | if strings.HasPrefix(name, "skills/") || strings.HasPrefix(name, "plugins/") { |
| 404 | return true |
| 405 | } |
| 406 | if strings.Contains(name, "/skills/") || strings.Contains(name, "/plugins/") { |
| 407 | return true |
| 408 | } |
| 409 | if strings.Count(name, "/") >= 2 { |
| 410 | return true |
| 411 | } |
| 412 | return false |
| 413 | } |
| 414 | |
| 415 | // matchSkillConventions checks if a blob path matches any known skill convention. |
| 416 | func matchSkillConventions(entry treeEntry) *skillMatch { |