MCPcopy Create free account
hub / github.com/cli/cli / discoverSkills

Function discoverSkills

pkg/cmd/skills/install/install.go:634–658  ·  view source on GitHub ↗
(opts *InstallOptions, client *api.Client, hostname string, resolved *discovery.ResolvedRef)

Source from the content-addressed store, hash-verified

632}
633
634func discoverSkills(opts *InstallOptions, client *api.Client, hostname string, resolved *discovery.ResolvedRef) ([]discovery.Skill, error) {
635 opts.IO.StartProgressIndicatorWithLabel("Discovering skills")
636 allSkills, err := discovery.DiscoverSkillsWithOptions(client, hostname, opts.repo.RepoOwner(), opts.repo.RepoName(), resolved.SHA, discovery.DiscoverOptions{})
637 opts.IO.StopProgressIndicator()
638 if err != nil {
639 var treeTooLarge *discovery.TreeTooLargeError
640 if errors.As(err, &treeTooLarge) {
641 fmt.Fprintf(opts.IO.ErrOut, "%s\n Use path-based install instead: gh skill install %s/%s skills/<skill-name>\n",
642 err, treeTooLarge.Owner, treeTooLarge.Repo)
643 return nil, err
644 }
645 return nil, err
646 }
647 skills, filterErr := filterHiddenDirSkills(opts, allSkills)
648 if filterErr != nil {
649 return nil, filterErr
650 }
651 logConventions(opts.IO, skills)
652 for _, s := range skills {
653 if !discovery.IsSpecCompliant(s.Name) {
654 fmt.Fprintf(opts.IO.ErrOut, "Warning: skill %q does not follow the agentskills.io naming convention\n", s.DisplayName())
655 }
656 }
657 return skills, nil
658}
659
660func logConventions(io *iostreams.IOStreams, skills []discovery.Skill) {
661 conventions := make(map[string]int)

Callers 1

installRunFunction · 0.85

Calls 9

IsSpecCompliantFunction · 0.92
logConventionsFunction · 0.85
filterHiddenDirSkillsFunction · 0.70
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
StopProgressIndicatorMethod · 0.65
DisplayNameMethod · 0.65

Tested by

no test coverage detected