parsePhasesForWeb reads phases from viper config and converts to web.PhaseInfo.
()
| 108 | |
| 109 | // parsePhasesForWeb reads phases from viper config and converts to web.PhaseInfo. |
| 110 | func parsePhasesForWeb() []web.PhaseInfo { |
| 111 | raw := viper.Get("phases") |
| 112 | if raw == nil { |
| 113 | return nil |
| 114 | } |
| 115 | items, ok := raw.([]any) |
| 116 | if !ok { |
| 117 | return nil |
| 118 | } |
| 119 | phases := make([]web.PhaseInfo, 0, len(items)) |
| 120 | for _, item := range items { |
| 121 | m, ok := item.(map[string]any) |
| 122 | if !ok { |
| 123 | continue |
| 124 | } |
| 125 | p := web.PhaseInfo{} |
| 126 | if id, ok := m["id"].(string); ok { |
| 127 | p.ID = id |
| 128 | } |
| 129 | if name, ok := m["name"].(string); ok { |
| 130 | p.Name = name |
| 131 | } |
| 132 | if desc, ok := m["description"].(string); ok { |
| 133 | p.Description = desc |
| 134 | } |
| 135 | if p.ID != "" { |
| 136 | phases = append(phases, p) |
| 137 | } |
| 138 | } |
| 139 | return phases |
| 140 | } |
| 141 | |
| 142 | // buildListProjects returns a function that loads the global project registry |
| 143 | // and converts entries to web.ProjectEntry values. |