buildResolveProject returns a function that resolves a project ID to its scan directory and phases, reading directly from the project's .taskmd.yaml.
()
| 158 | // buildResolveProject returns a function that resolves a project ID to its |
| 159 | // scan directory and phases, reading directly from the project's .taskmd.yaml. |
| 160 | func buildResolveProject() web.ProjectResolverFunc { |
| 161 | return func(id string) (string, []web.PhaseInfo, error) { |
| 162 | entries, err := LoadGlobalRegistry() |
| 163 | if err != nil { |
| 164 | return "", nil, fmt.Errorf("load global registry: %w", err) |
| 165 | } |
| 166 | |
| 167 | entry, found := findProjectEntry(entries, id) |
| 168 | if !found { |
| 169 | return "", nil, web.ErrProjectNotFound |
| 170 | } |
| 171 | |
| 172 | info, statErr := os.Stat(entry.Path) |
| 173 | if statErr != nil || !info.IsDir() { |
| 174 | return "", nil, fmt.Errorf("project path does not exist: %s", entry.Path) |
| 175 | } |
| 176 | |
| 177 | scanDir, err := resolveProjectTaskDirStandalone(entry.Path) |
| 178 | if err != nil { |
| 179 | return "", nil, err |
| 180 | } |
| 181 | |
| 182 | phases := loadProjectPhases(entry.Path) |
| 183 | return scanDir, phases, nil |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | // resolveProjectTaskDirStandalone reads a project's .taskmd.yaml without viper |
| 188 | // to determine the task directory. |
no test coverage detected