MCPcopy
hub / github.com/callumalpass/tasknotes / hydrateTaskDetailsFromFile

Function hydrateTaskDetailsFromFile

src/utils/taskDetails.ts:7–23  ·  view source on GitHub ↗
(
	app: App,
	task: TaskInfo
)

Source from the content-addressed store, hash-verified

5import { splitFrontmatterAndBody } from "./helpers";
6
7export async function hydrateTaskDetailsFromFile(
8 app: App,
9 task: TaskInfo
10): Promise<TaskInfo> {
11 const file = app.vault.getAbstractFileByPath(task.path);
12 if (!(file instanceof TFile)) {
13 return task;
14 }
15
16 const content = await app.vault.read(file);
17 const { body } = splitFrontmatterAndBody(content);
18
19 return {
20 ...task,
21 details: body.replace(/\r\n/g, "\n").trimEnd(),
22 };
23}

Callers 3

registerTaskToolsMethod · 0.90
getTaskMethod · 0.90

Calls 3

splitFrontmatterAndBodyFunction · 0.90
getAbstractFileByPathMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected