collectAllProjectRecs gathers recommendations from every registered project.
()
| 177 | |
| 178 | // collectAllProjectRecs gathers recommendations from every registered project. |
| 179 | func collectAllProjectRecs() ([]ProjectRecommendation, error) { |
| 180 | entries, err := LoadGlobalRegistry() |
| 181 | if err != nil { |
| 182 | return nil, fmt.Errorf("load global registry: %w", err) |
| 183 | } |
| 184 | if len(entries) == 0 { |
| 185 | return nil, fmt.Errorf("no projects registered in global registry") |
| 186 | } |
| 187 | |
| 188 | var allRecs []ProjectRecommendation |
| 189 | for _, entry := range entries { |
| 190 | recs, recErr := recommendForProject(entry) |
| 191 | if recErr != nil { |
| 192 | fmt.Fprintf(os.Stderr, "Warning: skipping project %q: %v\n", entry.ID, recErr) |
| 193 | continue |
| 194 | } |
| 195 | for _, rec := range recs { |
| 196 | allRecs = append(allRecs, ProjectRecommendation{ProjectID: entry.ID, Recommendation: rec}) |
| 197 | } |
| 198 | } |
| 199 | return allRecs, nil |
| 200 | } |
| 201 | |
| 202 | // recommendForProject scans a project and returns recommendations. |
| 203 | func recommendForProject(entry GlobalProjectEntry) ([]Recommendation, error) { |
no test coverage detected