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

Function buildDependencyInfo

apps/cli/internal/cli/get.go:357–390  ·  view source on GitHub ↗

buildDependencyInfo resolves depends-on and blocks lists for a task.

(task *model.Task, allTasks []*model.Task)

Source from the content-addressed store, hash-verified

355
356// buildDependencyInfo resolves depends-on and blocks lists for a task.
357func buildDependencyInfo(task *model.Task, allTasks []*model.Task) dependencyInfo {
358 taskMap := buildTaskMap(allTasks)
359 g := graph.NewGraph(allTasks)
360
361 var info dependencyInfo
362 for _, depID := range task.Dependencies {
363 entry := depEntry{ID: depID}
364 if dep, ok := taskMap[depID]; ok {
365 entry.Title = dep.Title
366 }
367 info.DependsOn = append(info.DependsOn, entry)
368 }
369 for _, blockedID := range g.Adjacency[task.ID] {
370 entry := depEntry{ID: blockedID}
371 if dep, ok := taskMap[blockedID]; ok {
372 entry.Title = dep.Title
373 }
374 info.Blocks = append(info.Blocks, entry)
375 }
376 if task.Parent != "" {
377 entry := depEntry{ID: task.Parent}
378 if p, ok := taskMap[task.Parent]; ok {
379 entry.Title = p.Title
380 }
381 info.Parent = &entry
382 }
383 for _, t := range allTasks {
384 if t.Parent == task.ID {
385 entry := depEntry{ID: t.ID, Title: t.Title, Status: string(t.Status)}
386 info.Children = append(info.Children, entry)
387 }
388 }
389 return info
390}
391
392// outputGet routes to the appropriate formatter.
393func outputGet(task *model.Task, deps dependencyInfo, ctxFiles []taskcontext.FileEntry, wl *worklogInfo, format string) error {

Callers 1

runGetFunction · 0.85

Calls 1

buildTaskMapFunction · 0.85

Tested by

no test coverage detected