diff --git a/extensions/cli/src/ui/components/ChecklistDisplay.test.tsx b/extensions/cli/src/ui/components/ChecklistDisplay.test.tsx
new file mode 100644
index 000000000..dbbe0245c
--- /dev/null
+++ b/extensions/cli/src/ui/components/ChecklistDisplay.test.tsx
@@ -0,0 +1,63 @@
+import { render } from "ink-testing-library";
+import React from "react";
+
+import { ChecklistDisplay } from "./ChecklistDisplay.js";
+
+describe("ChecklistDisplay", () => {
+ it("should highlight the first incomplete item", () => {
+ const content = `Task list status:
+- [x] Completed task
+- [ ] First incomplete task
+- [ ] Second incomplete task`;
+
+ const { lastFrame } = render();
+ const output = lastFrame();
+
+ // The output should contain the checkbox symbols and text
+ expect(output).toContain("✓");
+ expect(output).toContain("○");
+ expect(output).toContain("Completed task");
+ expect(output).toContain("First incomplete task");
+ expect(output).toContain("Second incomplete task");
+ });
+
+ it("should handle empty checklist", () => {
+ const content = "Task list status:";
+
+ const { lastFrame } = render();
+ const output = lastFrame();
+
+ expect(output).toBeDefined();
+ });
+
+ it("should handle all completed tasks", () => {
+ const content = `Task list status:
+- [x] Completed task 1
+- [x] Completed task 2`;
+
+ const { lastFrame } = render();
+ const output = lastFrame();
+
+ expect(output).toContain("✓");
+ expect(output).toContain("Completed task 1");
+ expect(output).toContain("Completed task 2");
+ });
+
+ it("should handle mixed content with headers", () => {
+ const content = `Task list status:
+## Important Tasks
+- [x] Done task
+- [ ] Todo task
+
+## Other Tasks
+- [ ] Another todo`;
+
+ const { lastFrame } = render();
+ const output = lastFrame();
+
+ expect(output).toContain("Important Tasks");
+ expect(output).toContain("Other Tasks");
+ expect(output).toContain("✓");
+ expect(output).toContain("○");
+ });
+});
diff --git a/extensions/cli/src/ui/components/ChecklistDisplay.tsx b/extensions/cli/src/ui/components/ChecklistDisplay.tsx
index 926a4193f..458e3a7cb 100644
--- a/extensions/cli/src/ui/components/ChecklistDisplay.tsx
+++ b/extensions/cli/src/ui/components/ChecklistDisplay.tsx
@@ -13,6 +13,17 @@ export const ChecklistDisplay: React.FC = ({
}) => {
const lines = content.split("\n");
+ // Find the index of the first incomplete checkbox item
+ let firstIncompleteIndex = -1;
+ for (let i = 0; i < lines.length; i++) {
+ const line = lines[i];
+ const checkboxMatch = line.match(/^(\s*)-\s*\[([ x])\]\s*(.*)$/);
+ if (checkboxMatch && checkboxMatch[2] === " ") {
+ firstIncompleteIndex = i;
+ break;
+ }
+ }
+
return (
{lines.map((line, index) => {
@@ -25,6 +36,7 @@ export const ChecklistDisplay: React.FC = ({
if (checkboxMatch) {
const [, indent, status, taskText] = checkboxMatch;
const isCompleted = status === "x";
+ const isFirstIncomplete = index === firstIncompleteIndex;
return (
@@ -34,8 +46,11 @@ export const ChecklistDisplay: React.FC = ({
{taskText}