loadPhaseOrder reads phase identifiers from the viper config, preserving order. It uses the phase id when present, falling back to name for backwards compatibility.
()
| 284 | // loadPhaseOrder reads phase identifiers from the viper config, preserving order. |
| 285 | // It uses the phase id when present, falling back to name for backwards compatibility. |
| 286 | func loadPhaseOrder() []string { |
| 287 | raw := viper.Get("phases") |
| 288 | if raw == nil { |
| 289 | return nil |
| 290 | } |
| 291 | items, ok := raw.([]any) |
| 292 | if !ok { |
| 293 | return nil |
| 294 | } |
| 295 | var ids []string |
| 296 | for _, item := range items { |
| 297 | m, ok := item.(map[string]any) |
| 298 | if !ok { |
| 299 | continue |
| 300 | } |
| 301 | if id, ok := m["id"].(string); ok && id != "" { |
| 302 | ids = append(ids, id) |
| 303 | } |
| 304 | } |
| 305 | return ids |
| 306 | } |
| 307 | |
| 308 | func outputNextJSON(recs []Recommendation) error { |
| 309 | return WriteJSON(os.Stdout, recs) |
no outgoing calls