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

Function discoverSkills

pkg/cmd/skills/install/install.go:634–657  ·  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 if treeTooLarge, ok := errors.AsType[*discovery.TreeTooLargeError](err); ok {
640 fmt.Fprintf(opts.IO.ErrOut, "%s\n Use path-based install instead: gh skill install %s/%s skills/<skill-name>\n",
641 err, treeTooLarge.Owner, treeTooLarge.Repo)
642 return nil, err
643 }
644 return nil, err
645 }
646 skills, filterErr := filterHiddenDirSkills(opts, allSkills)
647 if filterErr != nil {
648 return nil, filterErr
649 }
650 logConventions(opts.IO, skills)
651 for _, s := range skills {
652 if !discovery.IsSpecCompliant(s.Name) {
653 fmt.Fprintf(opts.IO.ErrOut, "Warning: skill %q does not follow the agentskills.io naming convention\n", s.DisplayName())
654 }
655 }
656 return skills, nil
657}
658
659func logConventions(io *iostreams.IOStreams, skills []discovery.Skill) {
660 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