MCPcopy Create free account
hub / github.com/driangle/taskmd / resolveProjectDir

Function resolveProjectDir

apps/cli/internal/cli/root.go:269–286  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
269func 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.
289func findProjectEntry(entries []GlobalProjectEntry, id string) (GlobalProjectEntry, bool) {

Calls 3

LoadGlobalRegistryFunction · 0.85
findProjectEntryFunction · 0.85
resolveProjectTaskDirFunction · 0.85