@comfanion/usethis_todo 0.1.15-dev.13 → 0.1.15-dev.14

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 (3) hide show
  1. package/index.ts +4 -1
  2. package/package.json +1 -1
  3. package/tools.ts +6 -1
package/index.ts CHANGED
@@ -2,7 +2,7 @@ import type { Plugin } from "@opencode-ai/plugin"
2
2
  import path from "path"
3
3
  import fs from "fs/promises"
4
4
 
5
- import { write, read, read_five, read_by_id, update, setNativeStorageBase } from "./tools"
5
+ import { write, read, read_five, read_by_id, update, setNativeStorageBase, setClient } from "./tools"
6
6
 
7
7
  interface TodoPruneState {
8
8
  lastToolCallId: string | null
@@ -11,6 +11,9 @@ interface TodoPruneState {
11
11
  const pruneStates = new Map<string, TodoPruneState>()
12
12
 
13
13
  const UsethisTodoPlugin: Plugin = async ({ directory, client }) => {
14
+ // Pass client to tools for event emitting
15
+ setClient(client)
16
+
14
17
  // Resolve the authoritative state path from OpenCode server (non-blocking).
15
18
  // Must NOT await — server may block until plugin init completes → deadlock.
16
19
  client.path.get().then((pathInfo: any) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfanion/usethis_todo",
3
- "version": "0.1.15-dev.13",
3
+ "version": "0.1.15-dev.14",
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
@@ -103,10 +103,11 @@ interface TodoGraph {
103
103
  }
104
104
 
105
105
  // ============================================================================
106
- // Storage — Unified Global
106
+ // Storage — Dual Write
107
107
  // ============================================================================
108
108
 
109
109
  let _nativeStorageBase: string | null = null
110
+ let _client: any = null
110
111
 
111
112
  /**
112
113
  * Set the native storage base path (OpenCode's state directory).
@@ -116,6 +117,10 @@ export function setNativeStorageBase(statePath: string): void {
116
117
  _nativeStorageBase = statePath
117
118
  }
118
119
 
120
+ export function setClient(client: any): void {
121
+ _client = client
122
+ }
123
+
119
124
  // Resolve project directory (context.directory may be undefined via MCP)
120
125
  function dir(directory?: string): string {
121
126
  return directory || process.env.OPENCODE_PROJECT_DIR || process.cwd()