#!/usr/bin/env node

/**
 * Ignite Memory Startup Script
 */

const path = require('path');
const { spawn } = require('child_process');

// Start the worker service
const workerPath = path.join(__dirname, 'worker-service.js');
const worker = spawn('node', [workerPath], {
  stdio: 'inherit',
  env: { ...process.env, IGNITE_MEMORY_PORT: process.env.PORT || 37777 }
});

worker.on('error', (err) => {
  console.error('Failed to start memory worker:', err);
  process.exit(1);
});

worker.on('exit', (code) => {
  process.exit(code);
});

console.log('Ignite Memory System starting...');
