searchConfiguredReposTiered searches configured repos and returns results split into two tiers: local (from skill_repos.json) and remote (from config.yaml).
(kind entities.Kind, query string)
| 730 | // searchConfiguredReposTiered searches configured repos and returns results |
| 731 | // split into two tiers: local (from skill_repos.json) and remote (from config.yaml). |
| 732 | func searchConfiguredReposTiered(kind entities.Kind, query string) (localMatches, remoteMatches []repoSearchResult) { |
| 733 | // Identify which keys come from local sources vs remote sources. |
| 734 | localKeys := identifyLocalRepoKeys(kind) |
| 735 | |
| 736 | repos, err := repoconfig.LoadEnabled(kind) |
| 737 | if err != nil { |
| 738 | return nil, nil |
| 739 | } |
| 740 | |
| 741 | for key, r := range repos { |
| 742 | rOwner := r.EffectiveOwner() |
| 743 | name := r.EffectiveName() |
| 744 | if rOwner == "" || name == "" { |
| 745 | continue |
| 746 | } |
| 747 | keyLower := strings.ToLower(key) |
| 748 | ownerLower := strings.ToLower(rOwner) |
| 749 | nameLower := strings.ToLower(name) |
| 750 | descLower := strings.ToLower(r.Description) |
| 751 | if strings.Contains(keyLower, query) || |
| 752 | strings.Contains(ownerLower, query) || |
| 753 | strings.Contains(nameLower, query) || |
| 754 | strings.Contains(descLower, query) { |
| 755 | match := repoSearchResult{ |
| 756 | Key: key, |
| 757 | Owner: rOwner, |
| 758 | Name: name, |
| 759 | Branch: r.EffectiveBranch(), |
| 760 | Description: r.Description, |
| 761 | } |
| 762 | if localKeys[key] { |
| 763 | localMatches = append(localMatches, match) |
| 764 | } else { |
| 765 | remoteMatches = append(remoteMatches, match) |
| 766 | } |
| 767 | } |
| 768 | } |
| 769 | return localMatches, remoteMatches |
| 770 | } |
| 771 | |
| 772 | // identifyLocalRepoKeys returns the set of repo keys that come from local |
| 773 | // sources (skill_repos.json files), as opposed to remote/bundled sources. |
no test coverage detected