resolveProjectDir looks up a project in the global registry and returns its task directory. It also reloads viper config from the project's .taskmd.yaml.
(projectID string)
| 267 | // resolveProjectDir looks up a project in the global registry and returns its task directory. |
| 268 | // It also reloads viper config from the project's .taskmd.yaml. |
| 269 | func resolveProjectDir(projectID string) (string, error) { |
| 270 | entries, err := LoadGlobalRegistry() |
| 271 | if err != nil { |
| 272 | return "", fmt.Errorf("load global registry: %w", err) |
| 273 | } |
| 274 | |
| 275 | entry, found := findProjectEntry(entries, projectID) |
| 276 | if !found { |
| 277 | return "", fmt.Errorf("project %q not found in global registry", projectID) |
| 278 | } |
| 279 | |
| 280 | info, err := os.Stat(entry.Path) |
| 281 | if err != nil || !info.IsDir() { |
| 282 | return "", fmt.Errorf("project %q path does not exist: %s", projectID, entry.Path) |
| 283 | } |
| 284 | |
| 285 | return resolveProjectTaskDir(entry.Path) |
| 286 | } |
| 287 | |
| 288 | // findProjectEntry searches for a project by ID in the registry entries. |
| 289 | func findProjectEntry(entries []GlobalProjectEntry, id string) (GlobalProjectEntry, bool) { |