MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / relevanceScore

Function relevanceScore

internal/cli/management.go:948–969  ·  view source on GitHub ↗

============================================================================ Relevance scoring — rank results by multi-signal score (mirroring gh skill search) ============================================================================ relevanceScore computes a numeric ranking score for a search re

(name, description, repo string, stars int, query string)

Source from the content-addressed store, hash-verified

946// - Description contains query (100 points)
947// - Repository stars (sqrt bonus, ~2400 for 6k stars)
948func relevanceScore(name, description, repo string, stars int, query string) int {
949 term := strings.ToLower(query)
950 termHyphen := strings.ReplaceAll(term, " ", "-")
951 score := 0
952
953 nameLower := strings.ToLower(name)
954 if nameLower == term || nameLower == termHyphen {
955 score += 3_000
956 } else if strings.Contains(nameLower, term) || strings.Contains(nameLower, termHyphen) {
957 score += 1_000
958 }
959
960 if strings.Contains(strings.ToLower(description), term) {
961 score += 100
962 }
963
964 if stars > 0 {
965 score += int(math.Sqrt(float64(stars)) * 30)
966 }
967
968 return score
969}
970
971// ============================================================================
972// list — show what's installed across code agents

Callers 2

TestRelevanceScoreFunction · 0.85
rankGHResultsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestRelevanceScoreFunction · 0.68