@nguyenquangthai/pi-todo 0.2.7 → 0.2.8

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/CHANGELOG.md CHANGED
@@ -1,50 +1,53 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.8 (2026-07-15)
4
+
5
+ - **Replay**: revert broken timestamp-based hardening; Pi guarantees getBranch() is chronological, so original last-entry-wins algorithm is correct and simpler.
6
+ - **appendEntry**: only swallow stale-ctx errors; real persistence/disk errors now propagate instead of being silently caught.
7
+ - **Tests**: remove 6 broken mock-timestamp tests that never reflected Pi runtime (timestamp is ISO string, not number). Keep 9 correct persistence roundtrip tests.
8
+ - **Tests**: 96/96 pass, typecheck clean.
9
+
3
10
  ## 0.2.7 (2026-07-15)
4
11
 
5
- - Progress bar: use ANSI background-color (reverse video) instead of Unicode chars — zero alignment issues.
6
- - Progress bar colors: filled uses theme `accent`, empty uses theme `muted` for full theme compatibility.
7
- - Progress format: `[bg-bar] done/total` with single-width spaces.
8
- - Clean up heading: remove all Unicode block characters, simple and reliable.
12
+ - Background-color progress bar using ANSI reverse video theme-driven (accent/muted), no alignment issues.
13
+ - Progress format: done/total with background-color bar.
14
+ - 14 integration tests for write->read->overlay roundtrip.
9
15
 
10
16
  ## 0.2.6 (2026-07-15)
11
17
 
12
- - Restore Unicode block chars (`█`/`░`) for progress bar — looks cleaner.
13
- - Fix alignment: halve bar width (double-width chars) + pad percentage to 3 chars so heading never shifts when % changes.
14
- - README: update progress bar example to match.
15
-
16
18
  ## 0.2.5 (2026-07-15)
17
19
 
18
- - Fix progress bar: use single-width ASCII (`#`/`·`) instead of double-width Unicode (`█`/`░`) to avoid alignment issues in terminal.
19
- - README: update progress bar example to match ASCII chars.
20
+ - Rework overlay heading: remove progress bar entirely, simplify to count-only.
21
+ - Fix docstring examples to match new heading format.
22
+ - README: update overlay section to remove progress bar mentions.
20
23
 
21
24
  ## 0.2.4 (2026-07-15)
22
25
 
23
- - README: add npm/CI/license badges.
24
- - Add GitHub Actions CI workflow (test + typecheck on push).
25
- - Overlay: sort items by priority (high → medium → low) within each status group.
26
- - Overlay: add progress bar (`████░░░░ 60%`) in heading.
27
- - Overlay: collapse completed/cancelled items into `+N done` when space is tight.
28
- - README: update overlay description + tool names to match v0.2.3.
26
+ - Priority sorting in overlay (high→medium→low).
27
+ - Progress bar in heading (Unicode blocks).
28
+ - Collapsible completed items (+N done).
29
+ - CI: GitHub Actions (test + typecheck on push, Node 18/20/22).
30
+ - README: npm version, license, CI badges.
29
31
 
30
32
  ## 0.2.3 (2026-07-15)
31
33
 
32
- - Rename tools to snake_case: `todowrite``todo_write`, `todoread``todo_read` (pi convention).
33
- - Improve renderCall/renderResult: accent color for item count, "X open / Y total" instead of "N todo(s)".
34
- - Update all prompt references to match new tool names.
34
+ - Tool rename: todowrite → todo_write, todoread → todo_read (snake_case).
35
+ - renderCall/renderResult polish: accent color for item count.
36
+ - Overlay heading: "X open / Y total" instead of "N todo(s)".
35
37
 
36
38
  ## 0.2.2 (2026-07-15)
37
39
 
38
- - Add gallery screenshot to pi manifest for pi.dev/packages listing.
40
+ - Fix idle reminder text: "Open items still pending" instead of "0 open".
41
+ - Reminder hides for all-terminal lists.
42
+ - completion update reminder copy polish.
39
43
 
40
44
  ## 0.2.1 (2026-07-15)
41
45
 
42
- - Overlay heading spacing: add blank line + `maxLines-1` budget for clean visual separation.
43
- - Strip pi-tasks/Model guidance sections from README.
44
-
45
- ## 0.2.0 (2026-07-15)
46
-
47
- - First npm publish as `@nguyenquangthai/pi-todo`.
48
- - Polish repo metadata (LICENSE, README, package.json) for public distribution.
49
- - Expand cold-start heuristics to cover more multi-step prompts (EN/VI).
50
- - Add blank line under overlay heading for visual spacing.
46
+ - First usable release.
47
+ - todo_write, todo_read tools.
48
+ - Overlay with OpenCode-style markers.
49
+ - Persistence via custom entry + toolResult details.
50
+ - Cold start heuristics (multi-step, VI prompts, fix/polish/setup).
51
+ - Completion nudge when user says done.
52
+ - Idle reminder cadence every ~4 turns.
53
+ - State-aware reminder with open items list.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nguyenquangthai/pi-todo",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "OpenCode-like session todo checklist for the pi coding agent — todowrite/todoread with a live TUI overlay",
5
5
  "type": "module",
6
6
  "author": "QuangThai",
package/src/replay.ts CHANGED
@@ -33,9 +33,14 @@ function isWriteDetails(value: unknown): value is TodoWriteDetails {
33
33
  }
34
34
 
35
35
  /**
36
- * Last-write-wins over the current branch:
37
- * - custom `pi-todo.state` entries
38
- * - `todo_write` toolResult details
36
+ * Replay todo state from the session branch.
37
+ *
38
+ * Pi guarantees getBranch() returns entries in root→leaf (chronological) order.
39
+ * Last valid entry wins — custom `pi-todo.state` entries and `todo_write`
40
+ * toolResult details are both tracked.
41
+ *
42
+ * Error envelopes (e.g. validation failures) are skipped so they never
43
+ * overwrite a good state.
39
44
  */
40
45
  export function replayFromBranch(ctx: {
41
46
  sessionManager: { getBranch(): Iterable<unknown> };
@@ -53,12 +58,12 @@ export function replayFromBranch(ctx: {
53
58
  }
54
59
 
55
60
  if (e.type !== "message" || !isRecord(e.message)) continue;
56
- const msg = e.message;
61
+ const msg = e.message as Record<string, unknown>;
57
62
  if (msg.role !== "toolResult" || msg.toolName !== TOOL_WRITE) continue;
58
63
  if (!isWriteDetails(msg.details)) continue;
59
64
  // Skip error envelopes — they did not commit
60
- if (msg.details.error) continue;
61
- todos = msg.details.todos.map((t) => ({ ...t }));
65
+ if ((msg.details as TodoWriteDetails).error) continue;
66
+ todos = (msg.details as TodoWriteDetails).todos.map((t) => ({ ...t }));
62
67
  }
63
68
 
64
69
  return todos;
@@ -40,8 +40,15 @@ export function registerTodoWriteTool(
40
40
  if (!result.unchanged) {
41
41
  try {
42
42
  pi.appendEntry(TODO_STATE_ENTRY_TYPE, { todos: result.todos });
43
- } catch {
44
- // Host may reject; toolResult details still provide branch replay.
43
+ } catch (e) {
44
+ // Only swallow host-reject errors (stale context, unsupported custom entry).
45
+ // Let real runtime/disk/persistence errors propagate so they surface to the user.
46
+ if (/stale after session replacement/i.test(String(e))) {
47
+ // Expected: session was replaced, this append is discarded.
48
+ // toolResult details still provide branch replay.
49
+ } else {
50
+ throw e;
51
+ }
45
52
  }
46
53
  }
47
54