@comfanion/usethis_todo 0.1.15-dev.13 → 0.1.15-dev.15
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/index.ts +5 -34
- package/package.json +1 -1
- package/tools.ts +1 -1
package/index.ts
CHANGED
|
@@ -42,8 +42,6 @@ const UsethisTodoPlugin: Plugin = async ({ directory, client }) => {
|
|
|
42
42
|
"usethis_todo_read",
|
|
43
43
|
"usethis_todo_read_five",
|
|
44
44
|
"usethis_todo_read_by_id",
|
|
45
|
-
"todowrite",
|
|
46
|
-
"todoread",
|
|
47
45
|
])
|
|
48
46
|
|
|
49
47
|
// Collect all TODO-related tool parts
|
|
@@ -69,20 +67,18 @@ const UsethisTodoPlugin: Plugin = async ({ directory, client }) => {
|
|
|
69
67
|
},
|
|
70
68
|
|
|
71
69
|
tool: {
|
|
72
|
-
// Enhanced tools
|
|
70
|
+
// Enhanced tools — coexist with native todowrite/todoread
|
|
71
|
+
// Native tools handle sidebar updates (Bus.publish), we handle graph/priority/blockedBy
|
|
73
72
|
usethis_todo_write: write,
|
|
74
73
|
usethis_todo_read: read,
|
|
75
74
|
usethis_todo_read_five: read_five,
|
|
76
75
|
usethis_todo_read_by_id: read_by_id,
|
|
77
76
|
usethis_todo_update: update,
|
|
78
|
-
// Override native tools — same implementation, native names
|
|
79
|
-
todowrite: write,
|
|
80
|
-
todoread: read,
|
|
81
77
|
},
|
|
82
78
|
|
|
83
79
|
// Set nicer titles in TUI + track prune state
|
|
84
80
|
"tool.execute.after": async (input, output) => {
|
|
85
|
-
if (!input.tool.startsWith("usethis_todo_")
|
|
81
|
+
if (!input.tool.startsWith("usethis_todo_")) return
|
|
86
82
|
|
|
87
83
|
// Update prune state with latest call ID
|
|
88
84
|
const sessionID = input.sessionID
|
|
@@ -95,13 +91,13 @@ const UsethisTodoPlugin: Plugin = async ({ directory, client }) => {
|
|
|
95
91
|
const out = output.output || ""
|
|
96
92
|
|
|
97
93
|
// Set a nicer title in TUI
|
|
98
|
-
if (input.tool === "usethis_todo_write"
|
|
94
|
+
if (input.tool === "usethis_todo_write") {
|
|
99
95
|
const match = out.match(/\[(\d+)\/(\d+) done/)
|
|
100
96
|
output.title = match ? `TODO: ${match[2]} tasks` : "TODO updated"
|
|
101
97
|
} else if (input.tool === "usethis_todo_update") {
|
|
102
98
|
const match = out.match(/^✅ (.+)$/m)
|
|
103
99
|
output.title = match ? match[1] : "Task updated"
|
|
104
|
-
} else if (input.tool === "usethis_todo_read"
|
|
100
|
+
} else if (input.tool === "usethis_todo_read") {
|
|
105
101
|
const match = out.match(/\[(\d+)\/(\d+) done, (\d+) in progress\]/)
|
|
106
102
|
output.title = match ? `TODO [${match[1]}/${match[2]} done]` : "TODO list"
|
|
107
103
|
} else if (input.tool === "usethis_todo_read_five") {
|
|
@@ -109,31 +105,6 @@ const UsethisTodoPlugin: Plugin = async ({ directory, client }) => {
|
|
|
109
105
|
} else if (input.tool === "usethis_todo_read_by_id") {
|
|
110
106
|
output.title = "Task details"
|
|
111
107
|
}
|
|
112
|
-
|
|
113
|
-
// Publish snapshot into chat (helps when sidebar doesn't refresh)
|
|
114
|
-
const publishTools = new Set([
|
|
115
|
-
"usethis_todo_write",
|
|
116
|
-
"usethis_todo_update",
|
|
117
|
-
"usethis_todo_read",
|
|
118
|
-
"usethis_todo_read_five",
|
|
119
|
-
"usethis_todo_read_by_id",
|
|
120
|
-
])
|
|
121
|
-
|
|
122
|
-
if (!publishTools.has(input.tool)) return
|
|
123
|
-
|
|
124
|
-
const text = ["## TODO", "", out].join("\n")
|
|
125
|
-
|
|
126
|
-
try {
|
|
127
|
-
await client?.session?.prompt?.({
|
|
128
|
-
path: { id: input.sessionID },
|
|
129
|
-
body: {
|
|
130
|
-
noReply: true,
|
|
131
|
-
parts: [{ type: "text", text }],
|
|
132
|
-
},
|
|
133
|
-
})
|
|
134
|
-
} catch {
|
|
135
|
-
// non-fatal
|
|
136
|
-
}
|
|
137
108
|
},
|
|
138
109
|
}
|
|
139
110
|
}
|
package/package.json
CHANGED
package/tools.ts
CHANGED
|
@@ -103,7 +103,7 @@ interface TodoGraph {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// ============================================================================
|
|
106
|
-
// Storage —
|
|
106
|
+
// Storage — Dual Write
|
|
107
107
|
// ============================================================================
|
|
108
108
|
|
|
109
109
|
let _nativeStorageBase: string | null = null
|