MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / scanTasksForPath

Function scanTasksForPath

apps/desktop/src/main/tasks.ts:47–64  ·  view source on GitHub ↗
(
  root: string,
  relPath: string
)

Source from the content-addressed store, hash-verified

45 * if the file is missing or lives outside a live folder — the caller still
46 * uses the return to drop stale rows. */
47export 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}

Callers 1

registerIpcFunction · 0.90

Calls 2

folderForRelativePathFunction · 0.90
parseTasksFromBodyFunction · 0.90

Tested by

no test coverage detected