Skip to content

Commit d0452d0

Browse files
authored
Add telemetry for todos (#5746)
1 parent ab17569 commit d0452d0

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

packages/types/src/telemetry.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ export const taskPropertiesSchema = z.object({
8989
modelId: z.string().optional(),
9090
diffStrategy: z.string().optional(),
9191
isSubtask: z.boolean().optional(),
92+
todos: z
93+
.object({
94+
total: z.number(),
95+
completed: z.number(),
96+
inProgress: z.number(),
97+
pending: z.number(),
98+
})
99+
.optional(),
92100
})
93101

94102
export const gitPropertiesSchema = z.object({

src/core/webview/ClineProvider.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,6 +1853,19 @@ export class ClineProvider
18531853
// Get git repository information
18541854
const gitInfo = await getWorkspaceGitInfo()
18551855

1856+
// Calculate todo list statistics
1857+
const todoList = task?.todoList
1858+
let todos: { total: number; completed: number; inProgress: number; pending: number } | undefined
1859+
1860+
if (todoList && todoList.length > 0) {
1861+
todos = {
1862+
total: todoList.length,
1863+
completed: todoList.filter((todo) => todo.status === "completed").length,
1864+
inProgress: todoList.filter((todo) => todo.status === "in_progress").length,
1865+
pending: todoList.filter((todo) => todo.status === "pending").length,
1866+
}
1867+
}
1868+
18561869
// Return all properties including git info - clients will filter as needed
18571870
return {
18581871
appName: packageJSON?.name ?? Package.name,
@@ -1867,6 +1880,7 @@ export class ClineProvider
18671880
diffStrategy: task?.diffStrategy?.getName(),
18681881
isSubtask: task ? !!task.parentTask : undefined,
18691882
cloudIsAuthenticated,
1883+
...(todos && { todos }),
18701884
...gitInfo,
18711885
}
18721886
}

0 commit comments

Comments
 (0)