MCPcopy Create free account
hub / github.com/diillson/chatcli / selectRichestRemote

Function selectRichestRemote

cli/skill_handler.go:667–685  ·  view source on GitHub ↗

selectRichestRemote picks the most useful remote-meta entry from a slice of candidates. Preference order: 1. any skills.sh-sourced entry (canonical registry — wins outright), 2. the entry with the highest install count, 3. an entry with a non-empty description when the current pick has none. Retur

(candidates []*registry.SkillMeta)

Source from the content-addressed store, hash-verified

665//
666// Returns nil when the slice is empty.
667func selectRichestRemote(candidates []*registry.SkillMeta) *registry.SkillMeta {
668 if len(candidates) == 0 {
669 return nil
670 }
671 best := candidates[0]
672 for _, m := range candidates {
673 if registry.IsSkillsShSource(m.RegistryName) {
674 return m
675 }
676 if m.Downloads > best.Downloads {
677 best = m
678 continue
679 }
680 if best.Description == "" && m.Description != "" {
681 best = m
682 }
683 }
684 return best
685}
686
687// printSkillInfoHeader prints the always-present Name line, preferring the
688// remote-meta name when both sides know it.

Calls 1

IsSkillsShSourceFunction · 0.92