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

Function resolveProjectTaskDir

apps/cli/internal/cli/root.go:299–316  ·  view source on GitHub ↗

resolveProjectTaskDir loads the project's .taskmd.yaml and returns the task directory.

(projectPath string)

Source from the content-addressed store, hash-verified

297
298// resolveProjectTaskDir loads the project's .taskmd.yaml and returns the task directory.
299func resolveProjectTaskDir(projectPath string) (string, error) {
300 projectConfig := filepath.Join(projectPath, ".taskmd.yaml")
301 if _, err := os.Stat(projectConfig); err == nil {
302 viper.SetConfigFile(projectConfig)
303 if err := viper.ReadInConfig(); err != nil {
304 return "", fmt.Errorf("read project config: %w", err)
305 }
306 }
307
308 if viper.InConfig("task-dir") {
309 return resolveRelativeToConfig(viper.GetString("task-dir")), nil
310 }
311 if viper.InConfig("dir") {
312 return resolveRelativeToConfig(viper.GetString("dir")), nil
313 }
314
315 return projectPath, nil
316}
317
318// resolveDefaultProject checks the global config for a default_project setting
319// and resolves it to a task directory. Returns empty string if not set or invalid.

Callers 1

resolveProjectDirFunction · 0.85

Calls 1

resolveRelativeToConfigFunction · 0.85

Tested by

no test coverage detected