Skip to content

Commit bb218b6

Browse files
committed
Fixes
1 parent 15a4bdd commit bb218b6

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

packages/types/src/todo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export type TodoStatus = z.infer<typeof todoStatusSchema>
1111
* TodoItem
1212
*/
1313
export const todoItemSchema = z.object({
14-
id: z.string().optional(),
14+
id: z.string(),
1515
content: z.string(),
1616
status: todoStatusSchema,
1717
})

src/core/tools/updateTodoListTool.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ import { formatResponse } from "../prompts/responses"
44

55
import cloneDeep from "clone-deep"
66
import crypto from "crypto"
7-
import { TodoItem, TodoStatus } from "@roo-code/types"
7+
import { TodoItem, TodoStatus, todoStatusSchema } from "@roo-code/types"
88
import { getLatestTodo } from "../../shared/todo"
99

10-
const VALID_STATUS: string[] = ["pending", "in_progress", "completed", "todo", "doing", "done"]
1110
let approvedTodoList: TodoItem[] | undefined = undefined
1211

1312
/**
@@ -96,8 +95,8 @@ function todoListToMarkdown(todos: TodoItem[]): string {
9695
}
9796

9897
function normalizeStatus(status: string | undefined): TodoStatus {
99-
if (status === "completed" || status === "done") return "completed"
100-
if (status === "in_progress" || status === "doing" || status === "working") return "in_progress"
98+
if (status === "completed") return "completed"
99+
if (status === "in_progress") return "in_progress"
101100
return "pending"
102101
}
103102

@@ -138,7 +137,7 @@ function validateTodos(todos: any[]): { valid: boolean; error?: string } {
138137
if (!t.id || typeof t.id !== "string") return { valid: false, error: `Item ${i + 1} is missing id` }
139138
if (!t.content || typeof t.content !== "string")
140139
return { valid: false, error: `Item ${i + 1} is missing content` }
141-
if (t.status && !VALID_STATUS.includes(t.status))
140+
if (t.status && !todoStatusSchema.options.includes(t.status as TodoStatus))
142141
return { valid: false, error: `Item ${i + 1} has invalid status` }
143142
}
144143
return { valid: true }
@@ -152,7 +151,7 @@ function validateTodos(todos: any[]): { valid: boolean; error?: string } {
152151
* @param handleError HandleError function
153152
* @param pushToolResult PushToolResult function
154153
* @param removeClosingTag RemoveClosingTag function
155-
* @param userEdited If true, only show "User Edit Succee" and do nothing else
154+
* @param userEdited If true, only show "User Edit Succeeded" and do nothing else
156155
*/
157156
export async function updateTodoListTool(
158157
cline: Task,
@@ -163,7 +162,7 @@ export async function updateTodoListTool(
163162
removeClosingTag: RemoveClosingTag,
164163
userEdited?: boolean,
165164
) {
166-
// If userEdited is true, only show "User Edit Succee" and do nothing else
165+
// If userEdited is true, only show "User Edit Succeeded" and do nothing else
167166
if (userEdited === true) {
168167
pushToolResult("User Edit Succeeded")
169168
return

0 commit comments

Comments
 (0)