IsSkillPath reports whether a skill selector looks like a repo-relative path rather than a simple skill name.
(name string)
| 444 | // IsSkillPath reports whether a skill selector looks like a repo-relative path |
| 445 | // rather than a simple skill name. |
| 446 | func IsSkillPath(name string) bool { |
| 447 | name = strings.TrimSuffix(name, "/") |
| 448 | if name == "" { |
| 449 | return false |
| 450 | } |
| 451 | if strings.HasSuffix(name, "/SKILL.md") { |
| 452 | return true |
| 453 | } |
| 454 | if strings.HasPrefix(name, "skills/") || strings.HasPrefix(name, "plugins/") { |
| 455 | return true |
| 456 | } |
| 457 | if strings.Contains(name, "/skills/") || strings.Contains(name, "/plugins/") { |
| 458 | return true |
| 459 | } |
| 460 | if strings.Count(name, "/") >= 2 { |
| 461 | return true |
| 462 | } |
| 463 | return false |
| 464 | } |
| 465 | |
| 466 | // matchSkillConventions checks if a blob path matches any known skill convention. |
| 467 | func matchSkillConventions(entry treeEntry) *skillMatch { |