UNPKG

@codai/cbd

Version:

Codai Better Database - High-Performance Vector Memory System with HPKV-inspired architecture and MCP server

56 lines (44 loc) 1.6 kB
#!/usr/bin/env node /** * CBD Engine Service Startup Script * Starts the CBD Engine Service for MemorAI MCP integration */ import { CBDEngineService } from '../src/service-simple.js'; import { fileURLToPath } from 'url'; import { dirname, join } from 'path'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); // Configuration const config = { port: process.env.CBD_PORT || 4180, host: process.env.CBD_HOST || 'localhost', dataPath: process.env.CBD_DATA_PATH || join(__dirname, '../../cbd-data') }; console.log('🚀 Starting CBD Engine Service...'); console.log(`📊 Configuration:`, config); const service = new CBDEngineService(config); service.start().then((server) => { console.log('✅ CBD Engine Service is running and ready'); }).catch((error) => { console.error('❌ Failed to start CBD Engine Service:', error); process.exit(1); }); // Graceful shutdown handlers process.on('SIGINT', async () => { console.log('🔄 Received SIGINT, shutting down gracefully...'); await service.stop(); process.exit(0); }); process.on('SIGTERM', async () => { console.log('🔄 Received SIGTERM, shutting down gracefully...'); await service.stop(); process.exit(0); }); process.on('unhandledRejection', (reason, promise) => { console.error('❌ Unhandled Rejection at:', promise, 'reason:', reason); process.exit(1); }); process.on('uncaughtException', (error) => { console.error('❌ Uncaught Exception:', error); process.exit(1); });