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

Function resolveTaskDir

apps/vscode/src/config.ts:70–89  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

68 * (where project-root is the config file's directory, or the workspace root)
69 */
70export 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.

Callers 3

config.test.tsFile · 0.90
isUnderTaskDirFunction · 0.70
scanTaskIdsFunction · 0.70

Calls 2

findConfigFileFunction · 0.85
readTaskDirFromConfigFunction · 0.85

Tested by

no test coverage detected