normalize cursor todo items (#1473)

This commit is contained in:
Solomon
2025-12-09 10:54:21 +00:00
committed by GitHub
parent e83e0ee169
commit 1ee05ea862
2 changed files with 18 additions and 2 deletions

View File

@@ -872,7 +872,7 @@ impl CursorToolCall {
.iter() .iter()
.map(|t| TodoItem { .map(|t| TodoItem {
content: t.content.clone(), content: t.content.clone(),
status: t.status.clone(), status: normalize_todo_status(&t.status),
priority: None, // CursorTodoItem doesn't have priority field priority: None, // CursorTodoItem doesn't have priority field
}) })
.collect() .collect()
@@ -921,6 +921,16 @@ impl CursorToolCall {
} }
} }
fn normalize_todo_status(status: &str) -> String {
match status.to_lowercase().as_str() {
"todo_status_pending" => "pending".to_string(),
"todo_status_in_progress" => "in_progress".to_string(),
"todo_status_completed" => "completed".to_string(),
"todo_status_cancelled" => "cancelled".to_string(),
other => other.to_string(),
}
}
/* =========================== /* ===========================
Typed tool results for Cursor Typed tool results for Cursor
=========================== */ =========================== */

View File

@@ -13,6 +13,8 @@ function getStatusIcon(status?: string) {
return <Check aria-hidden className="h-4 w-4 text-success" />; return <Check aria-hidden className="h-4 w-4 text-success" />;
if (s === 'in_progress' || s === 'in-progress') if (s === 'in_progress' || s === 'in-progress')
return <CircleDot aria-hidden className="h-4 w-4 text-blue-500" />; return <CircleDot aria-hidden className="h-4 w-4 text-blue-500" />;
if (s === 'cancelled')
return <Circle aria-hidden className="h-4 w-4 text-gray-400" />;
return <Circle aria-hidden className="h-4 w-4 text-muted-foreground" />; return <Circle aria-hidden className="h-4 w-4 text-muted-foreground" />;
} }
@@ -57,7 +59,11 @@ function TodoPanel() {
{getStatusIcon(todo.status)} {getStatusIcon(todo.status)}
</span> </span>
<span className="text-sm leading-5 break-words"> <span className="text-sm leading-5 break-words">
{todo.content} {todo.status?.toLowerCase() === 'cancelled' ? (
<s className="text-gray-400">{todo.content}</s>
) : (
todo.content
)}
</span> </span>
</li> </li>
))} ))}