UNPKG

jay-code

Version:

Streamlined AI CLI orchestration engine with mathematical rigor and enterprise-grade reliability

74 lines (60 loc) • 1.87 kB
#!/usr/bin/env node /** * Safe wrapper for ruv-swarm MCP server * Handles known logger issue in v1.0.8 */ import { spawn } from 'child_process'; import { createInterface } from 'readline'; console.log('šŸš€ Starting ruv-swarm MCP server with error handling...'); const ruvSwarmProcess = spawn('npx', ['ruv-swarm', 'mcp', 'start'], { stdio: ['pipe', 'pipe', 'pipe'], env: { ...process.env, MCP_MODE: 'stdio', LOG_LEVEL: 'WARN' } }); // Forward stdin to ruv-swarm process.stdin.pipe(ruvSwarmProcess.stdin); // Handle stdout (JSON-RPC messages) ruvSwarmProcess.stdout.pipe(process.stdout); // Handle stderr with filtering const rlErr = createInterface({ input: ruvSwarmProcess.stderr, crlfDelay: Infinity }); let errorHandled = false; rlErr.on('line', (line) => { // Filter out the known logger error if (line.includes('logger.logMemoryUsage is not a function')) { if (!errorHandled) { console.error('āš ļø Known ruv-swarm v1.0.8 logger issue detected - continuing normally'); console.error('šŸ’” This error does not affect functionality'); errorHandled = true; } return; } // Forward other stderr output process.stderr.write(line + '\n'); }); // Handle process exit ruvSwarmProcess.on('exit', (code, signal) => { if (code !== null && code !== 0) { console.error(`\nāŒ ruv-swarm exited with code ${code}`); console.error('šŸ’” Try using: npx jay-code@alpha mcp start'); } process.exit(code || 0); }); // Handle errors ruvSwarmProcess.on('error', (error) => { console.error('āŒ Failed to start ruv-swarm:', error.message); console.error('šŸ’” Try using: npx jay-code@alpha mcp start'); process.exit(1); }); // Handle termination signals process.on('SIGTERM', () => { ruvSwarmProcess.kill('SIGTERM'); }); process.on('SIGINT', () => { ruvSwarmProcess.kill('SIGINT'); });