( root: string, relPath: string )
| 45 | * if the file is missing or lives outside a live folder — the caller still |
| 46 | * uses the return to drop stale rows. */ |
| 47 | export async function scanTasksForPath( |
| 48 | root: string, |
| 49 | relPath: string |
| 50 | ): Promise<VaultTask[]> { |
| 51 | const posix = relPath.split(path.sep).join('/') |
| 52 | const folder = folderForRelativePath(posix) |
| 53 | if (!folder || !LIVE_FOLDERS.has(folder)) return [] |
| 54 | |
| 55 | const abs = path.join(root, posix.split('/').join(path.sep)) |
| 56 | let body: string |
| 57 | try { |
| 58 | body = await fs.readFile(abs, 'utf8') |
| 59 | } catch { |
| 60 | return [] |
| 61 | } |
| 62 | const title = path.basename(posix, path.extname(posix)) |
| 63 | return parseTasksFromBody(body, { path: posix, title, folder }) |
| 64 | } |
no test coverage detected