#!/usr/bin/env node // ========================================== // MEEZAN - ميزان Setup Script // ========================================== const fs = require('fs'); const path = require('path'); const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); function ask(question) { return new Promise(resolve => rl.question(question, resolve)); } async function setup() { console.log(` ╔═══════════════════════════════════════╗ ║ ميزان MEEZAN - إعداد النظام ║ ║ Setup Wizard ║ ╚═══════════════════════════════════════╝ `); console.log('Welcome! Let\'s configure your Meezan assistant.\n'); const apiKey = await ask('1. Anthropic API Key (from console.anthropic.com): '); const telegramToken = await ask('2. Telegram Bot Token (from @BotFather, or press Enter to skip): '); const city = await ask('3. Your city (default: Kuwait City): ') || 'Kuwait City'; const country = await ask('4. Your country (default: Kuwait): ') || 'Kuwait'; const language = await ask('5. Default language ar/en/ur/ms (default: ar): ') || 'ar'; const madhab = await ask('6. Madhab hanafi/maliki/shafii/hanbali (default: shafii): ') || 'shafii'; const envContent = `# MEEZAN - ميزان Configuration # Generated by setup wizard on ${new Date().toISOString()} ANTHROPIC_API_KEY=${apiKey} TELEGRAM_BOT_TOKEN=${telegramToken || 'your_telegram_bot_token_here'} PORT=3000 NODE_ENV=development DEFAULT_CITY=${city} DEFAULT_COUNTRY=${country} DEFAULT_LATITUDE=29.3759 DEFAULT_LONGITUDE=47.9774 DEFAULT_LANGUAGE=${language} DEFAULT_MADHAB=${madhab} DB_PATH=./data/memory.json ASSISTANT_NAME=ميزان ASSISTANT_NAME_EN=Meezan LOG_LEVEL=info `; fs.writeFileSync(path.join(__dirname, '..', '.env'), envContent); // Create data directory const dataDir = path.join(__dirname, '..', 'data'); if (!fs.existsSync(dataDir)) { fs.mkdirSync(dataDir, { recursive: true }); } console.log(` ✅ Configuration saved to .env Next steps: 1. Run: npm install 2. Run: npm run dev 3. Open: http://localhost:3000 ${telegramToken ? '🤖 Telegram bot configured! Your bot will be live after starting.' : '📱 To add Telegram: Get a token from @BotFather and add to .env'} جزاك الله خيراً! بارك الله في مشروعك 🤲 `); rl.close(); } setup().catch(console.error);