(filePath: string)
| 68 | * (where project-root is the config file's directory, or the workspace root) |
| 69 | */ |
| 70 | export function resolveTaskDir(filePath: string): string | null { |
| 71 | const fileDir = path.dirname(filePath); |
| 72 | const configPath = findConfigFile(fileDir); |
| 73 | |
| 74 | if (configPath) { |
| 75 | const projectRoot = path.dirname(configPath); |
| 76 | const taskDirValue = readTaskDirFromConfig(configPath); |
| 77 | |
| 78 | if (taskDirValue) { |
| 79 | // Resolve relative to project root (where .taskmd.yaml lives) |
| 80 | return path.resolve(projectRoot, taskDirValue); |
| 81 | } |
| 82 | |
| 83 | // Config exists but no dir key — default to <project-root>/tasks |
| 84 | return path.join(projectRoot, DEFAULT_TASK_DIR); |
| 85 | } |
| 86 | |
| 87 | // No config found — can't determine task directory |
| 88 | return null; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Check whether a file path falls under the resolved task directory. |
no test coverage detected