@comfanion/usethis_todo 0.1.15-dev.11 → 0.1.15-dev.12
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 -1
- package/tools.ts +19 -16
package/package.json
CHANGED
package/tools.ts
CHANGED
|
@@ -237,8 +237,14 @@ async function readTodos(sid: string, directory?: string): Promise<Todo[]> {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
+
// Enhanced storage path (project-local) - restored for visibility/backup
|
|
241
|
+
function getEnhancedPath(sid: string, directory?: string): string {
|
|
242
|
+
return path.join(dir(directory), ".opencode", "session-todo", `${sid || "current"}.json`)
|
|
243
|
+
}
|
|
244
|
+
|
|
240
245
|
async function writeTodos(todos: Todo[], sid: string, directory?: string): Promise<void> {
|
|
241
246
|
const storagePath = await getStoragePath(sid)
|
|
247
|
+
const enhancedPath = getEnhancedPath(sid, directory)
|
|
242
248
|
|
|
243
249
|
// Prepare for storage:
|
|
244
250
|
// 1. Set native-compatible fields (status, priority)
|
|
@@ -249,25 +255,11 @@ async function writeTodos(todos: Todo[], sid: string, directory?: string): Promi
|
|
|
249
255
|
const nativeStatus = toNativeStatus(t.status)
|
|
250
256
|
const nativePriority = toNativePriority(t.priority)
|
|
251
257
|
|
|
252
|
-
const deps = t.blockedBy?.length ? ` [← ${t.blockedBy.join(", ")}]` : ""
|
|
253
|
-
const desc = t.description?.trim() ? ` — ${t.description.trim()}` : ""
|
|
254
|
-
const rel = t.releases?.length ? ` [rel: ${t.releases.join(", ")}]` : ""
|
|
255
|
-
|
|
256
258
|
return {
|
|
257
259
|
...t,
|
|
258
|
-
// Native fields
|
|
260
|
+
// Native fields for Sidebar compatibility
|
|
259
261
|
status: nativeStatus,
|
|
260
262
|
priority: nativePriority,
|
|
261
|
-
content: t.content, // Keep content clean? Or append deps?
|
|
262
|
-
// Sidebar usually displays 'content'. If we want deps visible in sidebar, we should append them.
|
|
263
|
-
// But if we append them, we dirty the content for next read.
|
|
264
|
-
// Let's NOT append to content in the object, but maybe the sidebar reads 'content'.
|
|
265
|
-
// Wait, if we don't append deps to content, sidebar won't show them.
|
|
266
|
-
// But if we do, 'content' grows every time we read/write?
|
|
267
|
-
// Solution: We store 'originalContent' or just assume we can parse it back?
|
|
268
|
-
// Better: The sidebar likely just shows 'content'.
|
|
269
|
-
// Let's keep 'content' clean in the JSON. If the sidebar supports 'description', great.
|
|
270
|
-
// If not, the user sees just the title. That's acceptable for "Native Status".
|
|
271
263
|
|
|
272
264
|
// Shadow fields (our source of truth)
|
|
273
265
|
usethisStatus: t.status,
|
|
@@ -275,8 +267,19 @@ async function writeTodos(todos: Todo[], sid: string, directory?: string): Promi
|
|
|
275
267
|
}
|
|
276
268
|
})
|
|
277
269
|
|
|
270
|
+
const json = JSON.stringify(storageTodos, null, 2)
|
|
271
|
+
|
|
272
|
+
// 1. Write to Global Storage (for Sidebar)
|
|
278
273
|
await fs.mkdir(path.dirname(storagePath), { recursive: true })
|
|
279
|
-
await fs.writeFile(storagePath,
|
|
274
|
+
await fs.writeFile(storagePath, json, "utf-8")
|
|
275
|
+
|
|
276
|
+
// 2. Write to Local Storage (for User visibility/Git)
|
|
277
|
+
try {
|
|
278
|
+
await fs.mkdir(path.dirname(enhancedPath), { recursive: true })
|
|
279
|
+
await fs.writeFile(enhancedPath, json, "utf-8")
|
|
280
|
+
} catch {
|
|
281
|
+
// ignore local write errors (non-fatal)
|
|
282
|
+
}
|
|
280
283
|
}
|
|
281
284
|
|
|
282
285
|
// ============================================================================
|