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

Method extractTaskInfoFromNative

src/utils/TaskManager.ts:320–361  ·  view source on GitHub ↗

* Extract task info from native frontmatter

(path: string, frontmatter: unknown)

Source from the content-addressed store, hash-verified

318 * Extract task info from native frontmatter
319 */
320 private extractTaskInfoFromNative(path: string, frontmatter: unknown): TaskInfo | null {
321 if (!frontmatter || !this.fieldMapper) return null;
322
323 // Validate that the file is actually a task
324 if (!this.isTaskFile(frontmatter)) return null;
325
326 try {
327 // Use FieldMapper to properly map all fields from frontmatter
328 const mappedTask = this.fieldMapper.mapFromFrontmatter(
329 frontmatter,
330 path,
331 this.storeTitleInFilename
332 );
333
334 // Get dependency information from DependencyCache
335 let isBlocked = false;
336 let blockingTasks: string[] = [];
337 if (this._dependencyCache) {
338 // Use DependencyCache for status-aware blocking check
339 isBlocked = this._dependencyCache.isTaskBlocked(path);
340 blockingTasks = this._dependencyCache.getBlockedTaskPaths(path);
341 } else {
342 // Fallback when dependency cache not available: use simple existence check
343 isBlocked = Array.isArray(mappedTask.blockedBy) && mappedTask.blockedBy.length > 0;
344 }
345
346 return buildTaskInfoFromMappedTask({
347 path,
348 mappedTask,
349 defaultTaskStatus: this.settings.defaultTaskStatus,
350 isBlocked,
351 blockingTasks,
352 });
353 } catch (error) {
354 tasknotesLogger.error(`Error extracting task info from native metadata for ${path}:`, {
355 category: "persistence",
356 operation: "extracting-task-info-native-metadata",
357 error: error,
358 });
359 return null;
360 }
361 }
362
363 private ensureFilterIndexes(): void {
364 if (this.filterIndexesBuilt) {

Callers 3

handleFileChangedMethod · 0.95
getTaskInfoMethod · 0.95
getCachedTaskInfoSyncMethod · 0.95

Calls 6

isTaskFileMethod · 0.95
mapFromFrontmatterMethod · 0.80
errorMethod · 0.80
isTaskBlockedMethod · 0.45
getBlockedTaskPathsMethod · 0.45

Tested by

no test coverage detected