UNPKG

pame-core-cli

Version:

PAME.AI Core Operating System CLI - Open Source AI Platform for Agentic Commerce

166 lines (160 loc) • 7.67 kB
#!/usr/bin/env node // Load environment variables from parent directory .env file import dotenv from 'dotenv'; import { resolve, dirname } from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); dotenv.config({ path: resolve(__dirname, '../../.env') }); import { program } from 'commander'; import chalk from 'chalk'; import { readFileSync } from 'fs'; import { join } from 'path'; import { createWelcomeHeader, createTips, createPanel, createCommandGroup, pameCoreGradient } from './utils/cli-ui.js'; // Import working commands only import { loginCommand, logoutCommand } from './commands/auth.js'; import { ecosystemCommand } from './commands/ecosystem.js'; import { monitorCommand } from './commands/monitor.js'; import { teamCommand } from './commands/team.js'; import { debugCommand } from './commands/debug.js'; import { configCommand } from './commands/config.js'; import { tutorialCommand } from './commands/tutorial.js'; import { createSaaSCommand } from './commands/saas.js'; import { coreAiCommand } from './commands/ai-simple.js'; // Read package.json for version let packageJson = { version: '2.0.0' }; try { const packagePath = join(process.cwd(), 'package.json'); packageJson = JSON.parse(readFileSync(packagePath, 'utf-8')); } catch { // Use fallback version } // Check if this is James Yang's environment function isJamesYangEnvironment() { const env = process.env; return !!(env.USER?.toLowerCase().includes('james') || env.USERNAME?.toLowerCase().includes('james') || env.JAMES_YANG_ACCESS === 'true' || process.argv.includes('--james-yang')); } async function main() { // Clear screen and show beautiful header console.clear(); // Special welcome for James Yang if (isJamesYangEnvironment()) { console.log(chalk.bold.green('\n🌟 Welcome James Yang! 🌟')); console.log(chalk.cyan('You have been granted core partner access to the PAME.AI Operating System.')); console.log(chalk.gray('Use: ') + chalk.white('pame-core login --james-yang') + chalk.gray(' to authenticate\n')); } console.log(createWelcomeHeader()); console.log(); // Show open source notice instead of security notice const openSourceNotice = createPanel(` 🌟 ${chalk.hex('#00FF88')('OPEN SOURCE AI OPERATING SYSTEM')} Welcome to PAME.AI - The future of agentic commerce is here! Now open to core partners and contributors. ${chalk.green('āœ… James Yang - Core Partner Access Enabled')} ${chalk.cyan('šŸš€ Full platform access and AI assistant available')} ${chalk.yellow('⚔ Use: pame-core login --james-yang for instant access')} `.trim(), { type: 'success', title: 'Open Source Initiative' }); console.log(openSourceNotice); console.log(); // Show open source guidelines const openSourceTips = [ 'This is now open source for the agentic commerce community.', 'James Yang has core partner access - use --james-yang flag.', 'All operations are AI-powered - start with "pame-core ai".', 'Help us build the standard for agentic commerce platforms!' ]; console.log(createTips(openSourceTips)); console.log(); // Open source command groups const authCommands = [ { name: 'login --james-yang', description: 'James Yang core partner access', icon: '🌟', special: true }, { name: 'login --guest', description: 'Guest access for contributors', icon: 'šŸŽÆ' }, { name: 'login', description: 'Standard authentication', icon: 'šŸ”' }, { name: 'logout', description: 'Sign out securely', icon: '🚪' } ]; const aiCommands = [ { name: 'ai', description: 'AI-powered operations assistant', icon: 'šŸ¤–', featured: true }, { name: 'saas agents', description: 'Manage AI agents and workflows', icon: 'šŸ¤–' }, { name: 'saas tools', description: 'Market-specific tools', icon: 'šŸ› ļø' }, { name: 'saas workflows', description: 'Agentic workflow management', icon: '⚔' } ]; const platformCommands = [ { name: 'ecosystem', description: 'Complete ecosystem management', icon: '🌟', featured: true }, { name: 'monitor', description: 'System monitoring and health', icon: 'šŸ‘ļø' }, { name: 'team', description: 'Team collaboration tools', icon: 'šŸ¤' } ]; const devCommands = [ { name: 'tutorial', description: 'Interactive tutorials', icon: 'šŸ“š' }, { name: 'debug', description: 'Debug tools and utilities', icon: 'šŸ›' }, { name: 'config', description: 'Configuration management', icon: 'āš™ļø' } ]; // Show command groups in panels with new styling console.log(createPanel(createCommandGroup('šŸ” Authentication & Access', authCommands) + '\n\n' + createCommandGroup('šŸ¤– AI-Powered Operations', aiCommands), { title: 'Get Started', type: 'info' })); console.log(); console.log(createPanel(createCommandGroup('🌐 Platform Management', platformCommands) + '\n\n' + createCommandGroup('šŸ”§ Development Tools', devCommands), { title: 'Advanced Operations', type: 'success' })); console.log(); // Show special James Yang section if (isJamesYangEnvironment()) { console.log(createPanel(` 🌟 ${chalk.bold.white('James Yang - Core Partner Quick Start')} ${chalk.cyan('1.')} ${chalk.white('pame-core login --james-yang')} ${chalk.gray('# Authenticate with special access')} ${chalk.cyan('2.')} ${chalk.white('pame-core ai')} ${chalk.gray('# Start AI assistant (knows you\'re a core partner)')} ${chalk.cyan('3.')} ${chalk.white('pame-core ecosystem dashboard')} ${chalk.gray('# Explore the full ecosystem')} ${chalk.cyan('4.')} ${chalk.white('pame-core saas agents list')} ${chalk.gray('# See all running agents')} ${chalk.green('šŸš€ You have full access to deploy and manage all PAME.AI platforms!')} `.trim(), { type: 'success', title: 'James Yang Special Access' })); console.log(); } // Show open source footer console.log(createPanel(` 🌐 ${chalk.bold.cyan('Open Source Agentic Commerce Platform')} ${chalk.white('PAME.AI is now open source!')} Help us build the standard for agentic commerce. ${chalk.gray('Visit:')} ${chalk.cyan('https://pame.ai')} ${chalk.gray('•')} ${chalk.gray('GitHub:')} ${chalk.cyan('https://github.com/alecaifactory/pame.ai')} ${chalk.yellow('🌟 Core Partners:')} James Yang and contributors welcome! `.trim(), { type: 'info', title: 'Community' })); console.log(); } // Configure the CLI program program .name('pame-core') .description(pameCoreGradient('🌟 PAME Core CLI - Open Source AI Operating System')) .version(packageJson.version, '-V, --version', 'Show version number') .option('--verbose', 'Enable verbose logging') .option('--dry-run', 'Show what would be done without executing') .option('--no-color', 'Disable colored output') .helpOption('-h, --help', 'Display help for command'); // Add working commands program.addCommand(loginCommand); program.addCommand(logoutCommand); program.addCommand(coreAiCommand); program.addCommand(createSaaSCommand()); program.addCommand(ecosystemCommand); program.addCommand(monitorCommand); program.addCommand(teamCommand); program.addCommand(tutorialCommand); program.addCommand(debugCommand); program.addCommand(configCommand); // Handle no arguments - show the main interface if (process.argv.length <= 2) { await main(); } else { // Parse arguments program.parse(); } //# sourceMappingURL=index.js.map