@comfanion/usethis_search 3.0.0-dev.3 → 3.0.0-dev.4

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/index.ts +19 -7
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -4,22 +4,34 @@ import search from "./tools/search"
4
4
  import codeindex from "./tools/codeindex"
5
5
  import readInterceptor from "./tools/read-interceptor"
6
6
  import FileIndexerPlugin from "./file-indexer"
7
- import { getRelatedFiles, getGraphEntries, isGraphAPIAvailable } from "./api"
8
7
 
9
- const UsethisSearchPlugin: Plugin = async (ctx) => {
10
- const fileIndexerHooks = await FileIndexerPlugin(ctx as any)
8
+ const UsethisSearchPlugin: Plugin = async ({ directory, client }) => {
9
+ // Start file indexer (background indexing + event handling)
10
+ let fileIndexerEvent: ((args: any) => Promise<void>) | null = null
11
+ try {
12
+ const hooks = await FileIndexerPlugin({ directory, client } as any)
13
+ fileIndexerEvent = hooks?.event || null
14
+ } catch {
15
+ // file indexer init failed — tools still work, just no auto-indexing
16
+ }
11
17
 
12
18
  return {
13
- ...fileIndexerHooks,
14
19
  tool: {
15
20
  search,
16
21
  codeindex,
17
22
  read: readInterceptor,
18
23
  },
24
+
25
+ event: async (args: any) => {
26
+ if (fileIndexerEvent) {
27
+ try {
28
+ await fileIndexerEvent(args)
29
+ } catch {
30
+ // non-fatal
31
+ }
32
+ }
33
+ },
19
34
  }
20
35
  }
21
36
 
22
37
  export default UsethisSearchPlugin
23
-
24
- // Export graph API for other plugins (e.g., Mind)
25
- export { getRelatedFiles, getGraphEntries, isGraphAPIAvailable }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfanion/usethis_search",
3
- "version": "3.0.0-dev.3",
3
+ "version": "3.0.0-dev.4",
4
4
  "description": "OpenCode plugin: semantic search with graph-based context (v3: graph relations, 1-hop context, LSP + regex analyzers)",
5
5
  "type": "module",
6
6
  "main": "./index.ts",