UNPKG

tlnt

Version:

TLNT - HMS-Powered Multi-Agent Platform with Government Agency Analysis, Deep Research, and Enterprise-Ready Deployment. Self-optimizing multi-domain AI agent with continuous learning and enterprise-grade performance monitoring.

202 lines 10 kB
/** * Panel Configuration Command * * CLI command for managing industry-specific panel modules */ import { Command } from 'commander'; import chalk from 'chalk'; import { INDUSTRY_PANELS, PANEL_CATEGORIES, INDUSTRIES, getPanelsByIndustry, getPanelsByCategory, getAvailableIndustries, getAvailableCategories } from '../config/industryPanels.js'; import TmuxConfigManager from '../config/tmuxConfig.js'; export function createPanelCommand() { return new Command('panel') .description('Manage industry-specific panel modules and configurations') .option('-l, --list', 'List available panel modules') .option('-i, --industry <name>', 'Filter by industry (healthcare, finance, legal, etc.)') .option('-c, --category <name>', 'Filter by category (compliance, data, workflow, etc.)') .option('--install <panel>', 'Install a specific panel module') .option('--remove <panel>', 'Remove a panel module') .option('-a, --active', 'Show currently active panels') .option('--preset <name>', 'Apply industry preset configuration') .action(async (options) => { await handlePanelCommand(options); }); } async function handlePanelCommand(options) { const configManager = new TmuxConfigManager(); const config = configManager.getConfig(); try { // List panels if (options.list) { console.log(chalk.cyan.bold('🎛️ Available Panel Modules\n')); if (options.industry) { const industryData = INDUSTRIES[options.industry]; if (!industryData) { console.error(chalk.red(`❌ Unknown industry: ${options.industry}`)); console.log(chalk.gray('Available industries:'), getAvailableIndustries().join(', ')); return; } console.log(chalk.blue.bold(`${industryData.icon} ${industryData.name} Industry\n`)); const panels = getPanelsByIndustry(options.industry); displayPanels(panels); } else if (options.category) { const categoryData = PANEL_CATEGORIES[options.category]; if (!categoryData) { console.error(chalk.red(`❌ Unknown category: ${options.category}`)); console.log(chalk.gray('Available categories:'), getAvailableCategories().join(', ')); return; } console.log(chalk.blue.bold(`${categoryData.icon} ${categoryData.name} Category\n`)); const panels = getPanelsByCategory(options.category); displayPanels(panels); } else { // List all industries and their panels for (const [industryKey, industryData] of Object.entries(INDUSTRIES)) { console.log(chalk.blue.bold(`${industryData.icon} ${industryData.name}`)); const panels = getPanelsByIndustry(industryKey); panels.forEach(panel => { const categoryData = PANEL_CATEGORIES[panel.category]; console.log(chalk.gray(` ${panel.icon} ${panel.name} ${chalk.dim(`(${categoryData.name})`)}`)); }); console.log(''); } } return; } // Show active panels if (options.active) { console.log(chalk.cyan.bold('🎛️ Active Panel Configuration\n')); // Get current panels from config const activePanels = config.panels.activePanels; if (activePanels.length === 0) { console.log(chalk.gray('No panels currently active')); console.log(chalk.gray('Use --install <panel> to add panels')); return; } activePanels.forEach(panelId => { const panel = INDUSTRY_PANELS[panelId]; if (panel) { console.log(chalk.green(`✓ ${panel.icon} ${panel.name}`)); console.log(chalk.gray(` Industry: ${panel.industry} | Category: ${panel.category}`)); console.log(chalk.gray(` Description: ${panel.description}`)); console.log(chalk.gray(` HMS Agents: ${panel.hmsAgents.join(', ')}`)); console.log(''); } }); return; } // Install panel if (options.install) { const panelId = options.install; const panel = INDUSTRY_PANELS[panelId]; if (!panel) { console.error(chalk.red(`❌ Unknown panel: ${panelId}`)); console.log(chalk.gray('Available panels:'), Object.keys(INDUSTRY_PANELS).join(', ')); return; } // Add to active panels const activePanels = config.panels.activePanels; if (!activePanels.includes(panelId)) { configManager.addPanel(panelId); console.log(chalk.green(`✅ Installed panel: ${chalk.bold(panel.name)}`)); console.log(chalk.gray(` Industry: ${panel.industry}`)); console.log(chalk.gray(` Category: ${panel.category}`)); console.log(chalk.gray(` Restart tmux interface to see changes`)); } else { console.log(chalk.yellow(`⚠️ Panel already installed: ${panel.name}`)); } return; } // Remove panel if (options.remove) { const panelId = options.remove; const panel = INDUSTRY_PANELS[panelId]; if (!panel) { console.error(chalk.red(`❌ Unknown panel: ${panelId}`)); return; } // Remove from active panels const activePanels = config.panels.activePanels; if (activePanels.includes(panelId)) { configManager.removePanel(panelId); console.log(chalk.green(`✅ Removed panel: ${chalk.bold(panel.name)}`)); console.log(chalk.gray(' Restart tmux interface to see changes')); } else { console.log(chalk.yellow(`⚠️ Panel not currently installed: ${panel.name}`)); } return; } // Apply industry preset if (options.preset) { const industryKey = options.preset; const industryData = INDUSTRIES[industryKey]; if (!industryData) { console.error(chalk.red(`❌ Unknown industry preset: ${industryKey}`)); console.log(chalk.gray('Available presets:'), getAvailableIndustries().join(', ')); return; } // Install all panels for the industry const industryPanels = industryData.panels; configManager.setActivePanels(industryPanels); configManager.setDefaultIndustry(industryKey); console.log(chalk.green(`✅ Applied ${industryData.name} preset`)); console.log(chalk.gray(` Installed ${industryPanels.length} panels:`)); industryPanels.forEach((panelId) => { const panel = INDUSTRY_PANELS[panelId]; if (panel) { console.log(chalk.gray(` - ${panel.icon} ${panel.name}`)); } }); console.log(chalk.gray(' Restart tmux interface to see changes')); return; } // No options provided - show help console.log(chalk.cyan.bold('🎛️ Panel Module Manager\n')); console.log(chalk.bold('Available Industries:')); Object.entries(INDUSTRIES).forEach(([key, industry]) => { console.log(chalk.gray(` ${industry.icon} ${key.padEnd(12)} - ${industry.name}`)); }); console.log(chalk.bold('\nAvailable Categories:')); Object.entries(PANEL_CATEGORIES).forEach(([key, category]) => { console.log(chalk.gray(` ${category.icon} ${key.padEnd(12)} - ${category.name}`)); }); console.log(chalk.bold('\nCommands:')); console.log(' --list List all available panels'); console.log(' --industry <name> Show panels for specific industry'); console.log(' --category <name> Show panels for specific category'); console.log(' --active Show currently active panels'); console.log(' --install <panel> Install a specific panel'); console.log(' --remove <panel> Remove a panel'); console.log(' --preset <industry> Apply complete industry preset'); console.log(chalk.gray('\nExamples:')); console.log(chalk.gray(' blax panel --list')); console.log(chalk.gray(' blax panel --industry healthcare')); console.log(chalk.gray(' blax panel --install medical-standards')); console.log(chalk.gray(' blax panel --preset finance')); console.log(chalk.gray(' tlnt panel --active')); } catch (error) { console.error(chalk.red('❌ Error:'), error instanceof Error ? error.message : String(error)); process.exit(1); } } function displayPanels(panels) { if (panels.length === 0) { console.log(chalk.gray('No panels found for this filter')); return; } panels.forEach(panel => { const categoryData = PANEL_CATEGORIES[panel.category]; console.log(chalk.green(`${panel.icon} ${chalk.bold(panel.name)}`)); console.log(chalk.gray(` Category: ${categoryData.name}`)); console.log(chalk.gray(` Description: ${panel.description}`)); console.log(chalk.gray(` Commands: ${panel.commands.join(', ')}`)); console.log(chalk.gray(` HMS Agents: ${panel.hmsAgents.join(', ')}`)); console.log(''); }); } export default createPanelCommand; //# sourceMappingURL=panelCommand.js.map