MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / getLatestTodo

Function getLatestTodo

src/shared/todo.ts:3–25  ·  view source on GitHub ↗
(clineMessages: ClineMessage[])

Source from the content-addressed store, hash-verified

1import { ClineMessage } from "@roo-code/types"
2
3export function getLatestTodo(clineMessages: ClineMessage[]) {
4 const todos = clineMessages
5 .filter(
6 (msg) =>
7 (msg.type === "ask" && msg.ask === "tool") || (msg.type === "say" && msg.say === "user_edit_todos"),
8 )
9 .map((msg) => {
10 try {
11 return JSON.parse(msg.text ?? "{}")
12 } catch {
13 return null
14 }
15 })
16 .filter((item) => item && item.tool === "updateTodoList" && Array.isArray(item.todos))
17 .map((item) => item.todos)
18 .pop()
19
20 if (todos) {
21 return todos
22 } else {
23 return []
24 }
25}

Callers 2

restoreTodoListForTaskFunction · 0.90
ChatViewComponentFunction · 0.90

Calls 2

popMethod · 0.80
parseMethod · 0.80

Tested by

no test coverage detected