ensureTaskDir creates the task directory if it doesn't exist.
(path string, quiet bool)
| 613 | |
| 614 | // ensureTaskDir creates the task directory if it doesn't exist. |
| 615 | func ensureTaskDir(path string, quiet bool) (created bool, err error) { |
| 616 | info, statErr := os.Stat(path) |
| 617 | if statErr == nil { |
| 618 | if !info.IsDir() { |
| 619 | return false, fmt.Errorf("not a directory: %s", path) |
| 620 | } |
| 621 | if !quiet { |
| 622 | fmt.Fprintf(os.Stderr, "Task directory already exists: %s\n", path) |
| 623 | } |
| 624 | return false, nil |
| 625 | } |
| 626 | |
| 627 | if err := os.MkdirAll(path, 0755); err != nil { |
| 628 | return false, fmt.Errorf("failed to create task directory: %w", err) |
| 629 | } |
| 630 | return true, nil |
| 631 | } |
| 632 | |
| 633 | // writeConfigFile writes .taskmd.yaml to the project root. |
| 634 | func writeConfigFile(root, taskDirPath string, idStrategy idStrategyConfig, quiet bool) (created bool, err error) { |