UNPKG

embedia

Version:

Zero-configuration AI chatbot integration CLI - direct file copy with embedded API keys

77 lines (61 loc) • 1.98 kB
const fs = require('fs-extra'); const path = require('path'); const chalk = require('chalk'); class HealthChecker { constructor(projectPath) { this.projectPath = projectPath; } async runHealthCheck() { console.log(chalk.cyan('\nšŸ„ Running Simple Health Check...\n')); const checks = [ { name: 'Embedia files present', fn: this.checkFiles }, { name: 'Basic setup complete', fn: this.checkBasicSetup } ]; const results = []; let passed = 0; for (const check of checks) { process.stdout.write(`Checking ${check.name}... `); try { const result = await check.fn.call(this); if (result.success) { console.log(chalk.green('āœ“')); passed++; } else { console.log(chalk.red('āœ—')); } results.push({ ...result, name: check.name }); } catch (error) { console.log(chalk.red('āœ—')); results.push({ name: check.name, success: false, error: error.message }); } } const score = Math.round((passed / checks.length) * 100); console.log(`\n${chalk.cyan('Health Score:')} ${score}%`); if (score === 100) { console.log(chalk.green('āœ… Everything looks good!')); } else { console.log(chalk.yellow('āš ļø Some issues detected')); } return { results, score, passed, total: checks.length }; } async checkFiles() { const embediaBotPath = path.join(this.projectPath, 'public', 'embedia-chatbot.js'); const exists = await fs.pathExists(embediaBotPath); return { success: exists, message: exists ? 'Embedia files found' : 'Embedia files missing' }; } async checkBasicSetup() { // Simple check - assume setup is good if files exist return { success: true, message: 'Basic setup complete' }; } } module.exports = HealthChecker;