@xynogen/pix-todo 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/todo.test.ts +15 -2
- package/src/todo.ts +5 -2
package/package.json
CHANGED
package/src/todo.test.ts
CHANGED
|
@@ -27,6 +27,7 @@ function makeHost(
|
|
|
27
27
|
}> = [],
|
|
28
28
|
) {
|
|
29
29
|
let capturedParameters: unknown;
|
|
30
|
+
let capturedRenderShell: unknown;
|
|
30
31
|
let capturedExecute:
|
|
31
32
|
| ((
|
|
32
33
|
id: string,
|
|
@@ -57,10 +58,12 @@ function makeHost(
|
|
|
57
58
|
name: string;
|
|
58
59
|
parameters: unknown;
|
|
59
60
|
execute: typeof capturedExecute;
|
|
61
|
+
renderShell?: unknown;
|
|
60
62
|
renderCall?: typeof capturedRenderCall;
|
|
61
63
|
renderResult?: typeof capturedRender;
|
|
62
64
|
}) {
|
|
63
65
|
capturedParameters = def.parameters;
|
|
66
|
+
capturedRenderShell = def.renderShell;
|
|
64
67
|
capturedExecute = def.execute;
|
|
65
68
|
if (def.renderCall) capturedRenderCall = def.renderCall;
|
|
66
69
|
if (def.renderResult) capturedRender = def.renderResult;
|
|
@@ -99,6 +102,9 @@ function makeHost(
|
|
|
99
102
|
if (!capturedExecute) throw new Error("execute not captured");
|
|
100
103
|
return capturedExecute;
|
|
101
104
|
},
|
|
105
|
+
get renderShell() {
|
|
106
|
+
return capturedRenderShell;
|
|
107
|
+
},
|
|
102
108
|
get renderCall() {
|
|
103
109
|
if (!capturedRenderCall) throw new Error("renderCall not captured");
|
|
104
110
|
return capturedRenderCall;
|
|
@@ -777,13 +783,20 @@ describe("renderTodoLines (colored TUI render)", () => {
|
|
|
777
783
|
expect(out).toContain("[text]3. charlie[/]"); // pending body text
|
|
778
784
|
});
|
|
779
785
|
|
|
780
|
-
test("shows the done/total count header", () => {
|
|
786
|
+
test("shows the done/total count header in blue", () => {
|
|
781
787
|
const out = renderTodoLines(items, tagTheme);
|
|
782
|
-
expect(out).toContain("[
|
|
788
|
+
expect(out).toContain("[accent]Todos 1/4 done:[/]");
|
|
789
|
+
expect(out).not.toContain("[muted]Todos 1/4 done:[/]");
|
|
783
790
|
});
|
|
784
791
|
});
|
|
785
792
|
|
|
786
793
|
describe("todo card layout", () => {
|
|
794
|
+
test("uses the self-rendered shell so the compact checkmark has no leading space", () => {
|
|
795
|
+
const host = makeHost();
|
|
796
|
+
registerTodo(host.pi);
|
|
797
|
+
expect(host.renderShell).toBe("self");
|
|
798
|
+
});
|
|
799
|
+
|
|
787
800
|
test("keeps the call row empty so the collapsed card is one line", () => {
|
|
788
801
|
const host = makeHost();
|
|
789
802
|
registerTodo(host.pi);
|
package/src/todo.ts
CHANGED
|
@@ -54,7 +54,7 @@ export type TodoTheme = {
|
|
|
54
54
|
bold: (text: string) => string;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
/** One-line
|
|
57
|
+
/** One-line shared summary used once a card has collapsed. */
|
|
58
58
|
export function renderTodoSummaryLine(items: TodoItem[], theme: TodoTheme): string {
|
|
59
59
|
if (!items.length) return formatCollapsedToolRow(theme, "todo", "empty");
|
|
60
60
|
const done = items.filter((t) => t.status === "done").length;
|
|
@@ -75,7 +75,7 @@ export function renderTodoSummaryLine(items: TodoItem[], theme: TodoTheme): stri
|
|
|
75
75
|
export function renderTodoLines(items: TodoItem[], theme: TodoTheme): string {
|
|
76
76
|
if (!items.length) return theme.fg("muted", "(no todos)");
|
|
77
77
|
const done = items.filter((t) => t.status === "done").length;
|
|
78
|
-
const head = theme.fg("
|
|
78
|
+
const head = theme.fg("accent", `Todos ${done}/${items.length} done:`);
|
|
79
79
|
const lines = items.map((t) => {
|
|
80
80
|
const color = TODO_COLOR[t.status];
|
|
81
81
|
const glyph = theme.fg(color, TODO_GLYPH[t.status]);
|
|
@@ -134,6 +134,9 @@ export default function registerTodo(pi: ExtensionAPI): void {
|
|
|
134
134
|
pi.registerTool({
|
|
135
135
|
name: "todo",
|
|
136
136
|
label: "Todo",
|
|
137
|
+
// Avoid the default Box shell's one-cell x padding: Todo owns its compact
|
|
138
|
+
// result row and should align its status glyph with other compact tools.
|
|
139
|
+
renderShell: "self",
|
|
137
140
|
description:
|
|
138
141
|
"Track BUILD-phase execution progress. Durable across context compaction. Actions: list, set (replace all items from newline/numbered text), add, update (change one item's status), clear.",
|
|
139
142
|
promptSnippet:
|