cf-memory-mcp 3.8.4 → 3.8.5

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.
@@ -302,49 +302,41 @@ class IncrementalIndexer {
302
302
  // Initial index
303
303
  await this.index();
304
304
 
305
- // Watch for changes
306
- const chokidar = await this.loadChokidar();
307
-
308
- const watcher = chokidar.watch(this.projectPath, {
309
- ignored: this.exclude,
310
- persistent: true,
311
- ignoreInitial: true
312
- });
313
-
314
- let debounceTimer = null;
315
-
316
- const handleChange = async () => {
317
- if (debounceTimer) clearTimeout(debounceTimer);
318
- debounceTimer = setTimeout(async () => {
319
- console.log('\nšŸ”„ Changes detected, re-indexing...');
320
- await this.index();
321
- console.log('');
322
- }, 1000);
305
+ // Use Node's built-in fs.watch (no external deps needed)
306
+ const fs = require('fs');
307
+ const watchDir = (dir) => {
308
+ let watcher;
309
+ try {
310
+ watcher = fs.watch(dir, { recursive: true }, (eventType, filename) => {
311
+ if (filename) {
312
+ this.handleFileChange(dir, filename);
313
+ }
314
+ });
315
+ } catch (err) {
316
+ // Ignore errors for now
317
+ }
318
+ return watcher;
323
319
  };
324
320
 
325
- watcher
326
- .on('add', path => handleChange())
327
- .on('change', path => handleChange())
328
- .on('unlink', path => handleChange());
321
+ const watcher = watchDir(this.projectPath);
329
322
 
330
323
  // Keep process alive
331
324
  process.on('SIGINT', () => {
332
325
  console.log('\nšŸ‘‹ Stopping watcher...');
333
- watcher.close();
326
+ if (watcher) watcher.close();
334
327
  process.exit(0);
335
328
  });
336
329
  }
337
330
 
338
- async loadChokidar() {
339
- try {
340
- return require('chokidar');
341
- } catch (err) {
342
- console.log('Installing chokidar for file watching...');
343
- const { execSync } = require('child_process');
344
- execSync('npm install chokidar --save-dev', { cwd: __dirname, stdio: 'inherit' });
345
- return require('chokidar');
346
- }
331
+ handleFileChange(baseDir, filename) {
332
+ // Debounce rapid changes
333
+ if (this._debounceTimer) clearTimeout(this._debounceTimer);
334
+ this._debounceTimer = setTimeout(async () => {
335
+ console.log(`\nšŸ”„ File changed: ${filename}`);
336
+ await this.index();
337
+ }, 1000);
347
338
  }
339
+
348
340
  }
349
341
 
350
342
  // CLI
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cf-memory-mcp",
3
- "version": "3.8.4",
3
+ "version": "3.8.5",
4
4
  "description": "Best-in-class MCP server with CONTEXTUAL CHUNKING (Anthropic-style, 35-67% better retrieval), Optimized LLM stack (Llama-3.1-8B), BGE-M3 embeddings, Query Expansion Caching, Hybrid Embedding Strategy, and Unified Project Intelligence",
5
5
  "main": "bin/cf-memory-mcp.js",
6
6
  "bin": {