IsSkillPath reports whether a skill selector looks like a repo-relative path rather than a simple skill name.
(name string)
| 415 | // IsSkillPath reports whether a skill selector looks like a repo-relative path |
| 416 | // rather than a simple skill name. |
| 417 | func IsSkillPath(name string) bool { |
| 418 | name = strings.TrimSuffix(name, "/") |
| 419 | if name == "" { |
| 420 | return false |
| 421 | } |
| 422 | if strings.HasSuffix(name, "/SKILL.md") { |
| 423 | return true |
| 424 | } |
| 425 | if strings.HasPrefix(name, "skills/") || strings.HasPrefix(name, "plugins/") { |
| 426 | return true |
| 427 | } |
| 428 | if strings.Contains(name, "/skills/") || strings.Contains(name, "/plugins/") { |
| 429 | return true |
| 430 | } |
| 431 | if strings.Count(name, "/") >= 2 { |
| 432 | return true |
| 433 | } |
| 434 | return false |
| 435 | } |
| 436 | |
| 437 | // matchSkillConventions checks if a blob path matches any known skill convention. |
| 438 | func matchSkillConventions(entry treeEntry) *skillMatch { |