recoder-code 2.2.2 → 2.2.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.
package/README.md CHANGED
@@ -59,7 +59,7 @@ recoder-code
59
59
  ██║ ██║███████╗╚██████╗╚██████╔╝██████╔╝███████╗██║ ██║
60
60
  ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝
61
61
 
62
- Welcome to Recoder Code v2.2.2
62
+ Welcome to Recoder Code v2.2.3
63
63
  Your AI-powered development companion
64
64
 
65
65
  👋 What's your name? John
@@ -815,7 +815,7 @@ class DevToolsIntegration extends EventEmitter {
815
815
  };
816
816
 
817
817
  // Register commands with context engine if available
818
- if (this.contextEngine) {
818
+ if (this.contextEngine && typeof this.contextEngine.registerCommands === 'function') {
819
819
  this.contextEngine.registerCommands('docker', dockerCommands);
820
820
  }
821
821
  }
@@ -922,7 +922,7 @@ class DevToolsIntegration extends EventEmitter {
922
922
  }
923
923
  };
924
924
 
925
- if (this.contextEngine) {
925
+ if (this.contextEngine && typeof this.contextEngine.registerCommands === 'function') {
926
926
  this.contextEngine.registerCommands('k8s', k8sCommands);
927
927
  }
928
928
  }
@@ -1019,7 +1019,7 @@ class DevToolsIntegration extends EventEmitter {
1019
1019
  }
1020
1020
  };
1021
1021
 
1022
- if (this.contextEngine) {
1022
+ if (this.contextEngine && typeof this.contextEngine.registerCommands === 'function') {
1023
1023
  this.contextEngine.registerCommands('npm', npmCommands);
1024
1024
  }
1025
1025
  }
@@ -1156,7 +1156,7 @@ class DevToolsIntegration extends EventEmitter {
1156
1156
  }
1157
1157
  };
1158
1158
 
1159
- if (this.contextEngine) {
1159
+ if (this.contextEngine && typeof this.contextEngine.registerCommands === 'function') {
1160
1160
  this.contextEngine.registerCommands('git', gitCommands);
1161
1161
  }
1162
1162
  }
@@ -1373,7 +1373,7 @@ echo "✅ Pre-commit checks passed"
1373
1373
  }
1374
1374
  };
1375
1375
 
1376
- if (this.contextEngine) {
1376
+ if (this.contextEngine && typeof this.contextEngine.registerCommands === 'function') {
1377
1377
  this.contextEngine.registerCommands(database.name, dbCommands);
1378
1378
  }
1379
1379
 
@@ -1419,7 +1419,7 @@ echo "✅ Pre-commit checks passed"
1419
1419
  }
1420
1420
  };
1421
1421
 
1422
- if (this.contextEngine) {
1422
+ if (this.contextEngine && typeof this.contextEngine.registerCommands === 'function') {
1423
1423
  this.contextEngine.registerCommands('lighthouse', lighthouseCommands);
1424
1424
  }
1425
1425
  }
@@ -8,7 +8,7 @@ const fs = require('fs');
8
8
  const path = require('path');
9
9
  const crypto = require('crypto');
10
10
  const OpenAI = require('openai');
11
- const chokidar = require('chokidar');
11
+ // Removed direct chokidar import - use FileWatcherManager instead
12
12
  const config = require('../config.js');
13
13
  const PluginManager = require('../plugins/enhanced-plugin-manager.js');
14
14
  const VoiceManager = require('./voice-manager.js');
@@ -26,6 +26,7 @@ const DevToolsIntegration = require('./dev-tools-integration.js');
26
26
  const VisionAnalyzer = require('./vision-analyzer.js');
27
27
  const NaturalLanguageProcessor = require('./natural-language-processor.js');
28
28
  const TodoManager = require('./todo-manager.js');
29
+ const FileWatcherManager = require('./file-watcher-manager.js');
29
30
 
30
31
  // Create logs and sessions directories
31
32
  const logsDir = path.join(process.cwd(), 'logs');
@@ -66,7 +67,11 @@ class InteractiveRecoderChat {
66
67
  this.historyIndex = -1;
67
68
  this.keyboardShortcutsEnabled = true;
68
69
  this.watchedFiles = new Set();
69
- this.fileWatchEnabled = true;
70
+ // Disable file watching by default to prevent EMFILE errors in production
71
+ this.fileWatchEnabled = process.env.RECODER_ENABLE_FILE_WATCH === 'true' || false;
72
+
73
+ // Simple mode disables heavy systems to prevent resource exhaustion
74
+ this.simpleMode = process.env.RECODER_SIMPLE_MODE !== 'false'; // Default to simple mode
70
75
  this.projectContext = {
71
76
  packageJson: null,
72
77
  gitInfo: null,
@@ -161,6 +166,12 @@ class InteractiveRecoderChat {
161
166
  * Initialize advanced systems (Context Engine, MCP, etc.)
162
167
  */
163
168
  async initializeAdvancedSystems() {
169
+ // Skip advanced systems in simple mode to prevent resource exhaustion
170
+ if (this.simpleMode) {
171
+ console.log(chalk.gray('📱 Simple mode enabled - advanced features disabled for stability'));
172
+ return;
173
+ }
174
+
164
175
  try {
165
176
  // Silently initialize advanced features (no console.log for clean startup)
166
177
 
@@ -238,7 +249,7 @@ class InteractiveRecoderChat {
238
249
  async setupSystemIntegrations() {
239
250
  try {
240
251
  // Connect rules engine to context for AI prompts
241
- if (this.rulesEngine && this.contextEngine) {
252
+ if (this.rulesEngine && this.contextEngine && typeof this.contextEngine.addContextProvider === 'function') {
242
253
  this.contextEngine.addContextProvider('rules', () => {
243
254
  return this.rulesEngine.generateAIPromptContext();
244
255
  });
@@ -503,27 +514,44 @@ class InteractiveRecoderChat {
503
514
  }
504
515
 
505
516
  initializeFileWatcher() {
506
- if (!this.fileWatchEnabled) return;
507
-
508
- // Watch current directory and subdirectories, excluding node_modules, .git, etc.
509
- this.fileWatcher = chokidar.watch('.', {
510
- ignored: [
511
- '**/node_modules/**',
512
- '**/.git/**',
513
- '**/logs/**',
514
- '**/sessions/**',
515
- '**/.env',
516
- '**/.recoderrc',
517
- '**/.*'
518
- ],
519
- ignoreInitial: true,
520
- depth: 3
521
- });
517
+ if (!this.fileWatchEnabled || this.fileWatcher) return; // Prevent multiple initializations
518
+
519
+ try {
520
+ // Use FileWatcherManager to prevent EMFILE errors
521
+ this.fileWatcher = FileWatcherManager.instance.createWatcher(
522
+ 'interactive-chat',
523
+ '.',
524
+ {
525
+ ignored: [
526
+ '**/node_modules/**',
527
+ '**/.git/**',
528
+ '**/logs/**',
529
+ '**/sessions/**',
530
+ '**/.env',
531
+ '**/.recoderrc',
532
+ '**/.*'
533
+ ],
534
+ ignoreInitial: true,
535
+ depth: 2 // Reduced depth to prevent too many watchers
536
+ },
537
+ {
538
+ onChange: (filePath) => this.onFileChanged(filePath),
539
+ onAdd: (filePath) => this.onFileAdded(filePath),
540
+ onUnlink: (filePath) => this.onFileDeleted(filePath)
541
+ }
542
+ );
522
543
 
523
- this.fileWatcher
524
- .on('change', (filePath) => this.onFileChanged(filePath))
525
- .on('add', (filePath) => this.onFileAdded(filePath))
526
- .on('unlink', (filePath) => this.onFileDeleted(filePath));
544
+ if (this.fileWatcher) {
545
+ this.fileWatcher
546
+ .on('change', (filePath) => this.onFileChanged(filePath))
547
+ .on('add', (filePath) => this.onFileAdded(filePath))
548
+ .on('unlink', (filePath) => this.onFileDeleted(filePath));
549
+ }
550
+ } catch (error) {
551
+ // Silently fail file watcher initialization to prevent crashes
552
+ this.logger?.warn('File watcher initialization failed, continuing without file watching');
553
+ this.fileWatchEnabled = false;
554
+ }
527
555
  }
528
556
 
529
557
  onFileChanged(filePath) {
@@ -43,7 +43,7 @@ class UserOnboarding {
43
43
 
44
44
  `));
45
45
 
46
- console.log(chalk.white.bold('Welcome to Recoder Code v2.2.2'));
46
+ console.log(chalk.white.bold('Welcome to Recoder Code v2.2.3'));
47
47
  console.log(chalk.gray('Your AI-powered development companion\n'));
48
48
  }
49
49
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recoder-code",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "description": "Complete AI-powered development platform with ML model training, plugin registry, real-time collaboration, monitoring, infrastructure automation, and enterprise deployment capabilities",
5
5
  "main": "index.js",
6
6
  "scripts": {