MCPcopy Create free account
hub / github.com/anomalyco/opencode / snapTodo

Function snapTodo

packages/opencode/src/cli/cmd/run/tool.ts:585–605  ·  view source on GitHub ↗
(p: ToolProps<typeof TodoWriteTool>)

Source from the content-addressed store, hash-verified

583}
584
585function snapTodo(p: ToolProps<typeof TodoWriteTool>): ToolSnapshot {
586 const items = list<{ status?: string; content?: string }>(p.frame.input.todos).flatMap((item) => {
587 const content = typeof item?.content === "string" ? item.content : ""
588 if (!content) {
589 return []
590 }
591
592 return [
593 {
594 status: typeof item.status === "string" ? item.status : "",
595 content,
596 },
597 ]
598 })
599
600 return {
601 kind: "todo",
602 items,
603 tail: "",
604 }
605}
606
607function snapQuestion(p: ToolProps<typeof QuestionTool>): ToolSnapshot {
608 const answers = list<unknown[]>(p.frame.meta.answers)

Callers

nothing calls this directly

Calls 1

listFunction · 0.70

Tested by

no test coverage detected