Elffuss BraidHub

kikocis/continue public

Highlight first incomplete item in CLI checklist display

- Added visual highlighting (cyan color and bold text) for the first incomplete checkbox item
- This helps users quickly identify what task is currently in progress
- Added comprehensive test coverage for the ChecklistDisplay component

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
Changeset1d0255b31268bab3ed59830109aed506e688c971212fed636dbbe8d1a44db8b2
AuthorContinue Agent <agent@continue.dev> · 2025-09-17 01:44 UTC
CommitterContinue Agent <agent@continue.dev> · 2025-09-17 01:44 UTC
Parents154c34fa9799

Browse the files at this changeset

2 files changed

added extensions/cli/src/ui/components/ChecklistDisplay.test.tsx +63 −0
@@ -0,0 +1,63 @@
1+import { render } from "ink-testing-library";
2+import React from "react";
3+
4+import { ChecklistDisplay } from "./ChecklistDisplay.js";
5+
6+describe("ChecklistDisplay", () => {
7+ it("should highlight the first incomplete item", () => {
8+ const content = `Task list status:
9+- [x] Completed task
10+- [ ] First incomplete task
11+- [ ] Second incomplete task`;
12+
13+ const { lastFrame } = render(<ChecklistDisplay content={content} />);
14+ const output = lastFrame();
15+
16+ // The output should contain the checkbox symbols and text
17+ expect(output).toContain("✓");
18+ expect(output).toContain("○");
19+ expect(output).toContain("Completed task");
20+ expect(output).toContain("First incomplete task");
21+ expect(output).toContain("Second incomplete task");
22+ });
23+
24+ it("should handle empty checklist", () => {
25+ const content = "Task list status:";
26+
27+ const { lastFrame } = render(<ChecklistDisplay content={content} />);
28+ const output = lastFrame();
29+
30+ expect(output).toBeDefined();
31+ });
32+
33+ it("should handle all completed tasks", () => {
34+ const content = `Task list status:
35+- [x] Completed task 1
36+- [x] Completed task 2`;
37+
38+ const { lastFrame } = render(<ChecklistDisplay content={content} />);
39+ const output = lastFrame();
40+
41+ expect(output).toContain("✓");
42+ expect(output).toContain("Completed task 1");
43+ expect(output).toContain("Completed task 2");
44+ });
45+
46+ it("should handle mixed content with headers", () => {
47+ const content = `Task list status:
48+## Important Tasks
49+- [x] Done task
50+- [ ] Todo task
51+
52+## Other Tasks
53+- [ ] Another todo`;
54+
55+ const { lastFrame } = render(<ChecklistDisplay content={content} />);
56+ const output = lastFrame();
57+
58+ expect(output).toContain("Important Tasks");
59+ expect(output).toContain("Other Tasks");
60+ expect(output).toContain("✓");
61+ expect(output).toContain("○");
62+ });
63+});
No newline at the end of the file
modified extensions/cli/src/ui/components/ChecklistDisplay.tsx +14 −1
@@ -13,6 +13,17 @@
1313 }) => {
1414 const lines = content.split("\n");
1515
16+ // Find the index of the first incomplete checkbox item
17+ let firstIncompleteIndex = -1;
18+ for (let i = 0; i < lines.length; i++) {
19+ const line = lines[i];
20+ const checkboxMatch = line.match(/^(\s*)-\s*\[([ x])\]\s*(.*)$/);
21+ if (checkboxMatch && checkboxMatch[2] === " ") {
22+ firstIncompleteIndex = i;
23+ break;
24+ }
25+ }
26+
1627 return (
1728 <Box flexDirection="column" paddingLeft={2}>
1829 {lines.map((line, index) => {
@@ -25,6 +36,7 @@
2536 if (checkboxMatch) {
2637 const [, indent, status, taskText] = checkboxMatch;
2738 const isCompleted = status === "x";
39+ const isFirstIncomplete = index === firstIncompleteIndex;
2840
2941 return (
3042 <Box key={index}>
@@ -34,8 +46,9 @@
3446 </Text>
3547 <Text> </Text>
3648 <Text
37- color={isCompleted ? "gray" : "white"}
49+ color={isCompleted ? "gray" : isFirstIncomplete ? "cyan" : "white"}
3850 strikethrough={isCompleted}
51+ bold={isFirstIncomplete}
3952 >
4053 {taskText}
4154 </Text>