Commit 74a8f62d5940

Vincent Demeester <vincent@sbr.pm>
2026-02-11 16:21:03
feat(org-todos): added color-coded TODO state keywords
Applied theme colors to TODO states for better visual scanning. TODO states now render with distinct colors matching their status.
1 parent 1ae0c7d
Changed files (1)
dots
pi
agent
extensions
org-todos
dots/pi/agent/extensions/org-todos/index.ts
@@ -35,6 +35,7 @@ import { execSync } from "node:child_process";
 import { homedir } from "node:os";
 import { join } from "node:path";
 import * as chrono from "chrono-node";
+import { Text } from "@mariozechner/pi-tui";
 
 // Configuration
 const DEFAULT_ORG_FILE = join(homedir(), "desktop/org/todos.org");
@@ -252,6 +253,35 @@ function parseCommandArgs(args: string): {
 }
 
 export default function (pi: ExtensionAPI) {
+  // Register message renderers for custom TODO messages
+  // These apply color-coding to TODO state keywords
+  const customTypes = [
+    "org-todos",
+    "org-todos-search",
+    "org-todos-add",
+    "org-todos-done",
+    "org-todos-next",
+    "org-todos-upcoming",
+    "org-todos-update",
+    "org-todos-note",
+  ];
+
+  for (const customType of customTypes) {
+    pi.registerMessageRenderer(customType, (message, options, theme) => {
+      let text = message.content;
+      
+      // Apply colors to TODO state keywords
+      text = text.replace(/\[TODO\]/g, theme.fg("warning", "[TODO]"));       // Yellow - needs action
+      text = text.replace(/\[NEXT\]/g, theme.fg("accent", "[NEXT]"));        // Cyan - queued next
+      text = text.replace(/\[STRT\]/g, theme.fg("toolTitle", "[STRT]"));     // Bright - in progress
+      text = text.replace(/\[WAIT\]/g, theme.fg("muted", "[WAIT]"));         // Muted - waiting
+      text = text.replace(/\[DONE\]/g, theme.fg("success", "[DONE]"));       // Green - completed
+      text = text.replace(/\[CANX\]/g, theme.fg("error", "[CANX]"));         // Red - cancelled
+      
+      return new Text(text, 0, 0);
+    });
+  }
+
   // Register the org_todo tool
   pi.registerTool({
     name: "org_todo",