const { execSync } = require('child_process'); const fs = require('fs'); const path = require('path'); console.log('🚀 Starting Titan Nexus Quantum v10.0 deployment...'); try { // 1. التحقق من المتغيرات البيئية if (!process.env.GEMINI_API_KEY) { console.error('❌ GEMINI_API_KEY is not set in environment variables'); process.exit(1); } // 2. التحقق من ملف Firebase Service Account if (!fs.existsSync('./serviceAccountKey.json')) { console.error('❌ serviceAccountKey.json not found'); process.exit(1); } // 3. تثبيت التبعيات console.log('📦 Installing dependencies...'); execSync('npm install --production', { stdio: 'inherit' }); // 4. إنشاء مجلدات النظام console.log('📁 Creating system directories...'); ['logs', 'backups', 'uploads'].forEach(dir => { if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); } }); // 5. التحقق من صحة الإعدادات console.log('🔍 Validating configuration...'); const requiredFiles = ['server.js', 'serviceAccountKey.json']; requiredFiles.forEach(file => { if (!fs.existsSync(file)) { throw new Error(`Missing required file: ${file}`); } }); // 6. بدء السيرفر console.log('⚡ Starting Titan Nexus Quantum Server...'); console.log('✅ Deployment completed successfully!'); console.log('\n📊 System Information:'); console.log(' - Port: 7860'); console.log(' - AI Model: gemma-3-27b-it'); console.log(' - Publish Interval: 30 minutes'); console.log(' - Security: Sentinel MK2 + Janitor MK2'); } catch (error) { console.error('❌ Deployment failed:', error.message); process.exit(1); }