@comfanion/usethis_search 4.3.0-dev.1 → 4.3.0-dev.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comfanion/usethis_search",
3
- "version": "4.3.0-dev.1",
4
- "description": "OpenCode plugin: semantic search with auto-attach, line numbers in workspace, simplified API (v4.3: auto-detect modes, read() caching, tool call compaction, 99% token reduction, no grep needed)",
3
+ "version": "4.3.0-dev.2",
4
+ "description": "OpenCode plugin: semantic search with auto-attach, line numbers in workspace, simplified API (v4.3: auto-detect modes, read() caching, tool call compaction, 99% token reduction, no grep needed, LSP memory leak fixed)",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
7
7
  "exports": {
@@ -288,6 +288,18 @@ export class GraphBuilder {
288
288
  return result
289
289
  }
290
290
 
291
+ /**
292
+ * Cleanup: shutdown LSP analyzer to prevent memory leaks.
293
+ * MUST be called after indexing to close LSP server processes.
294
+ */
295
+ async cleanup(): Promise<void> {
296
+ try {
297
+ await this.lspAnalyzer.shutdown()
298
+ } catch {
299
+ // Best effort — don't throw if already closed
300
+ }
301
+ }
302
+
291
303
  // ---- FR-005: Semantic similarity edges ------------------------------------
292
304
 
293
305
  /**
@@ -571,11 +571,15 @@ class CodebaseIndexer {
571
571
  try { this.chunkStore.close(); } catch { /* best effort */ }
572
572
  this.chunkStore = null;
573
573
  }
574
+ // Cleanup GraphBuilder (shutdown LSP to prevent memory leaks)
575
+ if (this.graphBuilder) {
576
+ try { await this.graphBuilder.cleanup(); } catch { /* best effort */ }
577
+ this.graphBuilder = null;
578
+ }
574
579
  // Close graph DB to release LevelDB lock
575
580
  if (this.graphDB) {
576
581
  try { await this.graphDB.close(); } catch { /* best effort */ }
577
582
  this.graphDB = null;
578
- this.graphBuilder = null;
579
583
  }
580
584
  // Save & release usage tracker
581
585
  if (this.usageTracker) {
@@ -1623,6 +1627,15 @@ class CodebaseIndexer {
1623
1627
  }
1624
1628
  }
1625
1629
 
1630
+ // Cleanup: shutdown LSP to prevent memory leaks after bulk indexing
1631
+ if (this.graphBuilder) {
1632
+ try {
1633
+ await this.graphBuilder.cleanup();
1634
+ } catch {
1635
+ // Best effort — continue even if cleanup fails
1636
+ }
1637
+ }
1638
+
1626
1639
  return { indexed, skipped, total, semanticEdges };
1627
1640
  }
1628
1641