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

Function buildGetOutput

apps/cli/internal/mcp/get.go:95–150  ·  view source on GitHub ↗
(task *model.Task, allTasks []*model.Task)

Source from the content-addressed store, hash-verified

93}
94
95func buildGetOutput(task *model.Task, allTasks []*model.Task) getOutput {
96 taskMap := make(map[string]*model.Task, len(allTasks))
97 for _, t := range allTasks {
98 taskMap[t.ID] = t
99 }
100
101 g := graph.NewGraph(allTasks)
102
103 var dependsOn []depRef
104 for _, depID := range task.Dependencies {
105 ref := depRef{ID: depID}
106 if dep, ok := taskMap[depID]; ok {
107 ref.Title = dep.Title
108 }
109 dependsOn = append(dependsOn, ref)
110 }
111
112 var blocks []depRef
113 for _, blockedID := range g.Adjacency[task.ID] {
114 ref := depRef{ID: blockedID}
115 if dep, ok := taskMap[blockedID]; ok {
116 ref.Title = dep.Title
117 }
118 blocks = append(blocks, ref)
119 }
120
121 var children []depRef
122 for _, t := range allTasks {
123 if t.Parent == task.ID {
124 children = append(children, depRef{ID: t.ID, Title: t.Title})
125 }
126 }
127
128 created := ""
129 if !task.Created.IsZero() {
130 created = task.Created.Format("2006-01-02")
131 }
132
133 return getOutput{
134 ID: task.ID,
135 Title: task.Title,
136 Status: string(task.Status),
137 Priority: string(task.Priority),
138 Effort: string(task.Effort),
139 Tags: task.Tags,
140 Dependencies: task.Dependencies,
141 Touches: task.Touches,
142 Parent: task.Parent,
143 Created: created,
144 FilePath: task.FilePath,
145 Content: task.Body,
146 DependsOn: dependsOn,
147 Blocks: blocks,
148 Children: children,
149 }
150}

Callers 1

handleGetFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected