MCPcopy
hub / github.com/cli/cli / DiscoverLocalSkills

Function DiscoverLocalSkills

internal/skills/discovery/discovery.go:900–920  ·  view source on GitHub ↗

DiscoverLocalSkills finds non-hidden-dir skills in a local directory using the same conventions as remote discovery. Hidden-dir skills are excluded; use DiscoverLocalSkillsWithOptions to retrieve all skills including those in hidden directories.

(dir string)

Source from the content-addressed store, hash-verified

898// DiscoverLocalSkillsWithOptions to retrieve all skills including those in
899// hidden directories.
900func DiscoverLocalSkills(dir string) ([]Skill, error) {
901 all, err := DiscoverLocalSkillsWithOptions(dir, DiscoverOptions{})
902 if err != nil {
903 return nil, err
904 }
905 var skills []Skill
906 for _, s := range all {
907 if !s.IsHiddenDirConvention() {
908 skills = append(skills, s)
909 }
910 }
911 if len(skills) == 0 {
912 return nil, fmt.Errorf(
913 "no skills found in %s\n"+
914 " Expected SKILL.md in the directory, or skills in skills/*/SKILL.md,\n"+
915 " skills/{scope}/*/SKILL.md, */SKILL.md, or plugins/*/skills/*/SKILL.md",
916 dir,
917 )
918 }
919 return skills, nil
920}
921
922// DiscoverLocalSkillsWithOptions finds skills in a local directory using the
923// same conventions as remote discovery, with configurable discovery behavior.

Callers 2

publishRunFunction · 0.92
TestDiscoverLocalSkillsFunction · 0.85

Calls 3

IsHiddenDirConventionMethod · 0.80
ErrorfMethod · 0.65

Tested by 1

TestDiscoverLocalSkillsFunction · 0.68