@comfanion/usethis_todo 0.1.6 → 0.1.7-dev.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/tools.ts +75 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfanion/usethis_todo",
3
- "version": "0.1.6",
3
+ "version": "0.1.7-dev.0",
4
4
  "description": "OpenCode plugin: enhanced TODO tools (dual storage + dependency graph)",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
package/tools.ts CHANGED
@@ -29,6 +29,45 @@ import fs from "fs/promises"
29
29
  // Types
30
30
  // ============================================================================
31
31
 
32
+ interface TodoFile {
33
+ path: string // File path (relative to project root)
34
+ role: "input" | "output" | "test" | "doc" | "config" | "main" | "graph"
35
+ addedAt: string // ISO timestamp when linked
36
+ addedBy: "manual" | "auto" // How it was added
37
+ lastAccessed?: string // Last read/write timestamp
38
+ toolIds?: number[] // Tool call IDs that touched this file
39
+ preserve?: boolean // Don't prune even on TODO complete
40
+ }
41
+
42
+ interface TodoTool {
43
+ toolName: string // Tool name (read, write, search, etc.)
44
+ callId: number // Tool call ID in session history
45
+ timestamp: string // ISO timestamp
46
+ filePath?: string // If tool operated on file
47
+ status: "success" | "error" // Tool execution status
48
+ tokens?: number // Tokens used by this tool result
49
+ }
50
+
51
+ interface TodoSearch {
52
+ query: string // Search query text
53
+ toolId: number // search() tool call ID
54
+ resultsCount: number // Number of results returned
55
+ timestamp: string // ISO timestamp
56
+ topResults?: string[] // Top file paths found
57
+ }
58
+
59
+ interface TodoContext {
60
+ totalTokens: number // Total tokens in all linked tools
61
+ createdAt: string // Task creation timestamp
62
+ startedAt?: string // When status → in_progress
63
+ completedAt?: string // When status → completed
64
+ estimatedCleanup: number // Estimated tokens prunable on complete
65
+
66
+ // Tracking
67
+ activeTracking: boolean // Is Mind currently tracking this TODO?
68
+ lastSync: string // Last time Mind synced metadata
69
+ }
70
+
32
71
  interface Todo {
33
72
  id: string // E01-S01-T01
34
73
  content: string // Short task summary
@@ -39,6 +78,19 @@ interface Todo {
39
78
  blockedBy?: string[] // IDs of blocking tasks
40
79
  createdAt?: number
41
80
  updatedAt?: number
81
+
82
+ // Mind extensions (backward compatible - optional)
83
+ files?: TodoFile[] // Associated files
84
+ tools?: TodoTool[] // Associated tool calls
85
+ searches?: TodoSearch[] // Associated searches
86
+ context?: TodoContext // Context metadata
87
+
88
+ // Cleanup configuration (optional)
89
+ cleanup?: {
90
+ onComplete?: "auto" | "manual" | "extract"
91
+ preserveFiles?: string[] // Glob patterns to preserve
92
+ preserveTools?: string[] // Tool names to preserve
93
+ }
42
94
  }
43
95
 
44
96
  interface NativeTodo {
@@ -260,11 +312,21 @@ function normalizeTodo(input: any): Todo {
260
312
  // Auto transition: ready -> done when releases exist
261
313
  const promotedStatus = status === "ready" && releases?.length ? "done" : status
262
314
 
263
- return {
315
+ // Initialize Mind extensions if provided (backward compatible)
316
+ const normalized: Todo = {
264
317
  ...input,
265
318
  status: promotedStatus,
266
319
  releases,
267
320
  }
321
+
322
+ // Preserve existing Mind extensions if they exist
323
+ if (input.files) normalized.files = input.files
324
+ if (input.tools) normalized.tools = input.tools
325
+ if (input.searches) normalized.searches = input.searches
326
+ if (input.context) normalized.context = input.context
327
+ if (input.cleanup) normalized.cleanup = input.cleanup
328
+
329
+ return normalized
268
330
  }
269
331
 
270
332
  function prioRank(p?: string): number {
@@ -294,9 +356,14 @@ function todoLine(todo: Todo, byId: Map<string, Todo>): string {
294
356
  const desc = todo.description?.trim() ? ` — ${todo.description.trim()}` : ""
295
357
  const rel = todo.releases?.length ? ` [rel: ${todo.releases.join(", ")}]` : ""
296
358
  const deps = todo.blockedBy?.length ? ` ← ${todo.blockedBy.join(", ")}` : ""
359
+
360
+ // Mind extensions
361
+ const files = todo.files?.length ? ` 📄${todo.files.length}` : ""
362
+ const tokens = todo.context?.totalTokens ? ` (${todo.context.totalTokens}t)` : ""
363
+
297
364
  const ns = normalizeStatus(todo.status)
298
365
  const icon = isBlocked(todo, byId) ? "⊗" : SI(ns)
299
- return `${icon} ${PE(todo.priority)} ${todo.id}: ${todo.content}${desc}${rel}${deps}`
366
+ return `${icon} ${PE(todo.priority)} ${todo.id}: ${todo.content}${desc}${rel}${files}${tokens}${deps}`
300
367
  }
301
368
 
302
369
  function renderNestedTodoList(todos: Todo[], allTodos?: Todo[]): string {
@@ -411,17 +478,17 @@ function formatGraph(graph: TodoGraph): string {
411
478
  // ============================================================================
412
479
 
413
480
  export const write = tool({
414
- description: "Create or update TODO list. TODOv2 (Prefer this instead of TODO)",
481
+ description: "Create or update TODO list. Use this for TODO. For better performance use ID for task relation",
415
482
  args: {
416
483
  todos: tool.schema.array(
417
484
  tool.schema.object({
418
- id: tool.schema.string().describe("Task ID in concat format: E01-S01-T01"),
419
- content: tool.schema.string().describe("Short task summary"),
420
- description: tool.schema.string().optional().describe("Full task description"),
421
- releases: tool.schema.array(tool.schema.string()).optional().describe("Release identifiers"),
485
+ id: tool.schema.string().describe("Task ID in concat format: E01-S01-T01(for graph dependency)"),
486
+ content: tool.schema.string().describe("Short task summary or title"),
487
+ description: tool.schema.string().optional().describe("Full task description. Helps to remember what should be done"),
488
+ releases: tool.schema.array(tool.schema.string()).optional().describe("Set IDs for AUTO Release task from ready -> done(after review)"),
422
489
  status: tool.schema.string().describe("todo | in_progress | ready | done"),
423
490
  priority: tool.schema.string().describe("CRIT | HIGH | MED | LOW"),
424
- blockedBy: tool.schema.array(tool.schema.string()).optional().describe("IDs of blocking tasks"),
491
+ blockedBy: tool.schema.array(tool.schema.string()).optional().describe("IDs of blocking tasks. this help you understand scope better"),
425
492
  }),
426
493
  ).describe("Array of todos"),
427
494
  },