@leo-alvarenga/pi-todo-list 0.6.3 → 0.7.2
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 -2
- package/src/core.ts +1 -2
- package/src/index.ts +14 -0
- package/src/tool.ts +15 -5
- package/skills/track-progress.md +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leo-alvarenga/pi-todo-list",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Session-aware todo list overlay for Pi: todo tool, /todos command, and a live TUI panel",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "github.com/leo-alvarenga/pi-mono",
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"src",
|
|
18
18
|
"!src/test",
|
|
19
|
-
"skills",
|
|
20
19
|
"README.md",
|
|
21
20
|
"LICENSE"
|
|
22
21
|
],
|
package/src/core.ts
CHANGED
|
@@ -227,8 +227,7 @@ function list(state: TodoState): { text: string } {
|
|
|
227
227
|
return {
|
|
228
228
|
text: state.todos
|
|
229
229
|
.map(
|
|
230
|
-
(t) =>
|
|
231
|
-
`[${t.status === "completed" ? "x" : " "}] #${t.id}: ${t.text}`,
|
|
230
|
+
(t) => `[${t.status === "completed" ? "x" : " "}] #${t.id}: ${t.text}`,
|
|
232
231
|
)
|
|
233
232
|
.join("\n"),
|
|
234
233
|
};
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,13 @@ import { createTodoStore } from "./state";
|
|
|
6
6
|
import { registerTodoTool, registerTodoCompleteAllTool } from "./tool";
|
|
7
7
|
import { registerTodoWidget } from "./widget";
|
|
8
8
|
|
|
9
|
+
const TRACK_PROGRESS_PROMPT = `\
|
|
10
|
+
Track work with the todo tools unless the user explicitly says not to:
|
|
11
|
+
- \`todo add\` — record each item the user wants tracked (text or texts).
|
|
12
|
+
- \`todo update\` — set \`status: completed\` as items finish; update status on every progress change (in-progress, blocked, …).
|
|
13
|
+
- \`todo remove\` — drop tasks that are no longer relevant.
|
|
14
|
+
- "complete everything" / "done with all" → \`todo_complete_all\`, not a loop of \`todo update\`.`;
|
|
15
|
+
|
|
9
16
|
export default function (pi: ExtensionAPI): void {
|
|
10
17
|
const store = createTodoStore((snapshot) =>
|
|
11
18
|
pi.appendEntry(STATE_ENTRY, snapshot),
|
|
@@ -21,11 +28,18 @@ export default function (pi: ExtensionAPI): void {
|
|
|
21
28
|
store.replay(ctx);
|
|
22
29
|
panelControls.refresh(ctx);
|
|
23
30
|
});
|
|
31
|
+
|
|
24
32
|
pi.on("session_tree", (_event, ctx) => {
|
|
25
33
|
store.replay(ctx);
|
|
26
34
|
panelControls.refresh(ctx);
|
|
27
35
|
});
|
|
36
|
+
|
|
28
37
|
pi.on("session_before_compact", (_event, ctx) => store.persistSnapshot(ctx));
|
|
38
|
+
|
|
39
|
+
pi.on("before_agent_start", (event) => ({
|
|
40
|
+
systemPrompt: event.systemPrompt + "\n\n" + TRACK_PROGRESS_PROMPT,
|
|
41
|
+
}));
|
|
42
|
+
|
|
29
43
|
pi.on("session_shutdown", (_event, ctx) => {
|
|
30
44
|
if (ctx.hasUI) ctx.ui.setWidget(WIDGET_KEY, undefined);
|
|
31
45
|
});
|
package/src/tool.ts
CHANGED
|
@@ -88,20 +88,30 @@ export function registerTodoTool(
|
|
|
88
88
|
let text =
|
|
89
89
|
theme.fg("toolTitle", theme.bold("todo ")) +
|
|
90
90
|
theme.fg("muted", args.action);
|
|
91
|
+
|
|
91
92
|
if (args.text) text += ` ${theme.fg("dim", `"${args.text}"`)}`;
|
|
92
|
-
|
|
93
|
+
|
|
94
|
+
if (args.id !== undefined) {
|
|
93
95
|
text += ` ${theme.fg("accent", `#${args.id}`)}`;
|
|
96
|
+
}
|
|
97
|
+
|
|
94
98
|
return new Text(text, 0, 0);
|
|
95
99
|
},
|
|
96
100
|
|
|
97
101
|
renderResult(result, _options, theme, _context) {
|
|
98
102
|
const details = result.details as TodoDetails | undefined;
|
|
99
|
-
|
|
103
|
+
|
|
104
|
+
if (details?.error) {
|
|
100
105
|
return new Text(theme.fg("error", `Error: ${details.error}`), 0, 0);
|
|
106
|
+
}
|
|
107
|
+
|
|
101
108
|
const text = result.content[0];
|
|
102
109
|
const msg = text?.type === "text" ? text.text : "";
|
|
103
|
-
|
|
110
|
+
|
|
111
|
+
if (details?.action === "list") {
|
|
104
112
|
return new Text(theme.fg("muted", msg), 0, 0);
|
|
113
|
+
}
|
|
114
|
+
|
|
105
115
|
return new Text(theme.fg("success", "✓ ") + theme.fg("muted", msg), 0, 0);
|
|
106
116
|
},
|
|
107
117
|
});
|
|
@@ -133,9 +143,9 @@ export function registerTodoCompleteAllTool(
|
|
|
133
143
|
{ type: "text", text: `All ${n} todos completed and cleared` },
|
|
134
144
|
],
|
|
135
145
|
details: {
|
|
136
|
-
action: "clear",
|
|
137
|
-
todos: [],
|
|
138
146
|
nextId: 1,
|
|
147
|
+
todos: [],
|
|
148
|
+
action: "clear",
|
|
139
149
|
} satisfies TodoDetails,
|
|
140
150
|
};
|
|
141
151
|
},
|
package/skills/track-progress.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: track-progress
|
|
3
|
-
description: Track task progress through the todo tools (todo / todo_complete_all). Use for any multi-step task, plan execution, or ongoing work.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Track Progress
|
|
7
|
-
|
|
8
|
-
Track work with the todo tools unless the user explicitly says not to:
|
|
9
|
-
|
|
10
|
-
- `todo add` — record each item the user wants tracked (text or texts).
|
|
11
|
-
- `todo update` — set `status: completed` as items finish; update status on every progress change (in-progress, blocked, …).
|
|
12
|
-
- `todo remove` — drop tasks that are no longer relevant.
|
|
13
|
-
- "complete everything" / "done with all" → `todo_complete_all`, not a loop of `todo update`.
|