embedia
Version:
Zero-configuration AI chatbot integration CLI - direct file copy with embedded API keys
73 lines (62 loc) • 3.31 kB
JavaScript
const { program } = require('commander');
const chalk = require('chalk');
const { simpleInit } = require('../src/commands/simpleInit');
const HealthChecker = require('../src/health/healthChecker');
const EmbediaDevServer = require('../src/dev/devServer');
const SecurityScanner = require('../src/security/securityScanner');
// ASCII Art banner
const banner = `
███████╗███╗ ███╗██████╗ ███████╗██████╗ ██╗ █████╗ ██████╗██╗ ██╗
██╔════╝████╗ ████║██╔══██╗██╔════╝██╔══██╗██║██╔══██╗ ██╔════╝██║ ██║
█████╗ ██╔████╔██║██████╔╝█████╗ ██║ ██║██║███████║ ██║ ██║ ██║
██╔══╝ ██║╚██╔╝██║██╔══██╗██╔══╝ ██║ ██║██║██╔══██║ ██║ ██║ ██║
███████╗██║ ╚═╝ ██║██████╔╝███████╗██████╔╝██║██║ ██║ ╚██████╗███████╗██║
╚══════╝╚═╝ ╚═╝╚═════╝ ╚══════╝╚═════╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚══════╝╚═╝
`;
console.log(chalk.hex('#6B46C1')(banner));
console.log(chalk.gray('Zero-Configuration AI Chatbot Integration CLI v4.1 - Powered by Embedia\n'));
program
.name('embedia')
.description('Integrate AI chatbots into your existing projects using tokens from Embedia webapp')
.version('4.1.3');
program
.command('init')
.description('Simple chatbot integration')
.option('-t, --token <token>', 'Integration token from Embedia webapp (starts with ac_)')
.action(simpleInit);
program
.command('doctor')
.description('Run health checks and diagnostics')
.option('--fix', 'Attempt to fix issues automatically')
.option('--conflicts', 'Show detailed conflict report')
.action(async (options) => {
const healthChecker = new HealthChecker(process.cwd());
await healthChecker.runHealthCheck();
});
// Custom help
program.on('--help', () => {
console.log('');
console.log(chalk.yellow('Examples:'));
console.log(' $ embedia init --token=ac_xyz123456');
console.log(' $ npx embedia@latest init --token=ac_abc789');
console.log('');
console.log(chalk.yellow('How to get a token:'));
console.log(' 1. Visit the Embedia webapp');
console.log(' 2. Generate your chatbot');
console.log(' 3. Copy the generated token');
console.log(' 4. Use it with this CLI');
console.log('');
});
// Handle unknown commands
program.on('command:*', () => {
console.error(chalk.red(`Unknown command: ${program.args.join(' ')}`));
console.log(chalk.yellow('Use --help to see available commands'));
process.exit(1);
});
// Parse command line arguments
program.parse(process.argv);
// Show help if no command provided
if (!process.argv.slice(2).length) {
program.outputHelp();
}