UNPKG

maia-cli

Version:

Command-line interface for MAIA (Modern AI Assistant)

86 lines (71 loc) 2.8 kB
#!/usr/bin/env node /** * MAIA CLI - Command-line interface for Modern AI Assistant */ // Suppress punycode deprecation warnings process.removeAllListeners('warning'); process.on('warning', (warning) => { if (warning.name === 'DeprecationWarning' && warning.message.includes('punycode')) { return; // Ignore punycode deprecation warnings } console.warn(warning.message); }); import { Command } from 'commander'; import chalk from 'chalk'; import { readFileSync } from 'fs'; import { join, dirname } from 'path'; import { fileURLToPath } from 'url'; // Import commands import { initCommand } from '../src/commands/init.js'; import { chatCommand } from '../src/commands/chat.js'; import { configCommand } from '../src/commands/config.js'; import { toolsCommand } from '../src/commands/tools.js'; import { statusCommand } from '../src/commands/status.js'; import { externalToolsCommand } from '../src/commands/external-tools.js'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); // Read package.json for version const packageJson = JSON.parse( readFileSync(join(__dirname, '..', 'package.json'), 'utf-8') ); const program = new Command(); // Configure main program program .name('maia') .description('MAIA - Modern AI Assistant CLI') .version(packageJson.version) .option('-v, --verbose', 'enable verbose logging') .option('--config <path>', 'path to config file'); // Add commands program.addCommand(initCommand); program.addCommand(chatCommand); program.addCommand(configCommand); program.addCommand(toolsCommand); program.addCommand(statusCommand); program.addCommand(externalToolsCommand); // Show help if no command provided program.action(() => { console.log(chalk.cyan('🤖 MAIA - Modern AI Assistant')); console.log(chalk.gray('Your next-generation AI assistant with MCP protocol support\n')); console.log(chalk.yellow('Quick Start:')); console.log(' maia init Initialize MAIA in current directory'); console.log(' maia chat Start interactive chat session'); console.log(' maia config Manage configuration'); console.log(' maia tools Manage MCP tools'); console.log(' maia external-tools Manage external API integrations'); console.log(' maia status Show system status\n'); console.log(chalk.gray('For more information, run: maia --help')); console.log(chalk.gray('Documentation: https://docs.maia-ai.net')); console.log(chalk.gray('GitHub: https://github.com/maia-ai-net/maia')); }); // Error handling program.exitOverride(); try { program.parse(); } catch (err) { if (err.code === 'commander.help' || err.code === 'commander.helpDisplayed') { process.exit(0); } console.error(chalk.red('Error:'), err.message); process.exit(1); }