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.
168 lines • 8.66 kB
JavaScript
/**
* Theme Configuration Command
*
* CLI command for managing tmux-style themes and configurations
*/
import { Command } from 'commander';
import chalk from 'chalk';
import { listThemes, getTheme } from '../config/tmuxThemes.js';
import TmuxConfigManager from '../config/tmuxConfig.js';
export function createThemeCommand() {
return new Command('theme')
.description('Manage tmux-style themes and configurations')
.option('-l, --list', 'List available themes')
.option('-s, --set <theme>', 'Set active theme')
.option('-p, --preview <theme>', 'Preview theme colors')
.option('-c, --config', 'Show current configuration')
.option('--preset <name>', 'Apply configuration preset')
.option('--reset', 'Reset to default configuration')
.action(async (options) => {
await handleThemeCommand(options);
});
}
async function handleThemeCommand(options) {
const configManager = new TmuxConfigManager();
const config = configManager.getConfig();
try {
// List themes
if (options.list) {
console.log(chalk.cyan.bold('🎨 Available Themes:\n'));
const themes = listThemes();
for (const themeName of themes) {
const theme = getTheme(themeName);
const isActive = themeName === config.theme;
const prefix = isActive ? chalk.green('✓') : ' ';
console.log(`${prefix} ${chalk.bold(themeName.padEnd(15))} - ${theme.description}`);
// Show color preview
const colorBar = [
chalk.hex(theme.colors.primary)('█'),
chalk.hex(theme.colors.secondary)('█'),
chalk.hex(theme.colors.accent)('█'),
chalk.hex(theme.colors.success)('█'),
chalk.hex(theme.colors.warning)('█'),
chalk.hex(theme.colors.error)('█'),
].join('');
console.log(` ${colorBar} ${chalk.gray(theme.borders.style + ' borders')}`);
if (isActive) {
console.log(chalk.green(' (currently active)\n'));
}
else {
console.log('');
}
}
console.log(chalk.gray('Use --set <theme> to change theme\n'));
return;
}
// Set theme
if (options.set) {
const themeName = options.set;
if (!listThemes().includes(themeName)) {
console.error(chalk.red(`❌ Unknown theme: ${themeName}`));
console.log(chalk.gray('Available themes:'), listThemes().join(', '));
return;
}
configManager.setTheme(themeName);
const theme = getTheme(themeName);
console.log(chalk.green(`✅ Theme set to: ${chalk.bold(themeName)}`));
console.log(chalk.gray(` Description: ${theme.description}`));
console.log(chalk.gray(' Restart tmux interface to see changes'));
return;
}
// Preview theme
if (options.preview) {
const themeName = options.preview;
if (!listThemes().includes(themeName)) {
console.error(chalk.red(`❌ Unknown theme: ${themeName}`));
return;
}
const theme = getTheme(themeName);
console.log(chalk.bold(`🎨 Theme Preview: ${themeName}\n`));
// Color palette
console.log(chalk.bold('Colors:'));
console.log(` Background: ${chalk.bgHex(theme.colors.background).hex(theme.colors.foreground)(' ' + theme.colors.background + ' ')}`);
console.log(` Foreground: ${chalk.hex(theme.colors.foreground)('█ ' + theme.colors.foreground)}`);
console.log(` Primary: ${chalk.hex(theme.colors.primary)('█ ' + theme.colors.primary)}`);
console.log(` Secondary: ${chalk.hex(theme.colors.secondary)('█ ' + theme.colors.secondary)}`);
console.log(` Accent: ${chalk.hex(theme.colors.accent)('█ ' + theme.colors.accent)}`);
console.log(` Success: ${chalk.hex(theme.colors.success)('█ ' + theme.colors.success)}`);
console.log(` Warning: ${chalk.hex(theme.colors.warning)('█ ' + theme.colors.warning)}`);
console.log(` Error: ${chalk.hex(theme.colors.error)('█ ' + theme.colors.error)}`);
console.log(` Muted: ${chalk.hex(theme.colors.muted)('█ ' + theme.colors.muted)}`);
// Border style preview
console.log(chalk.bold('\\nBorder Style:'), theme.borders.style);
// Status bar preview
console.log(chalk.bold('\\nStatus Bar:'));
console.log(` Position: ${theme.statusBar.position}`);
console.log(` Separator: ${theme.statusBar.separator}`);
console.log(` Format: ${theme.statusBar.format}`);
return;
}
// Show configuration
if (options.config) {
console.log(chalk.cyan.bold('⚙️ Current Configuration:\\n'));
console.log(chalk.bold('Theme:'), config.theme);
console.log(chalk.bold('Layout:'));
console.log(` Split Ratio: ${config.layout.splitRatio} (${Math.round(config.layout.splitRatio * 100)}% main)`);
console.log(` Orientation: ${config.layout.orientation}`);
console.log(` Show Borders: ${config.layout.showBorders}`);
console.log(` Show Titles: ${config.layout.showTitles}`);
console.log(chalk.bold('\\nFeatures:'));
console.log(` HMS Integration: ${config.features.hmsIntegration}`);
console.log(` Auto Refresh: ${config.features.autoRefresh}`);
console.log(` Refresh Interval: ${config.features.refreshInterval}s`);
console.log(` Notifications: ${config.features.enableNotifications}`);
console.log(chalk.bold('\\nDisplay:'));
console.log(` Show Timestamp: ${config.display.showTimestamp}`);
console.log(` Timestamp Format: ${config.display.timestampFormat}`);
console.log(` Max History: ${config.display.maxHistory}`);
console.log(` Word Wrap: ${config.display.wordWrap}`);
console.log(chalk.gray('\\nConfiguration file: ~/.blax-tmux.json'));
return;
}
// Apply preset
if (options.preset) {
const presetName = options.preset;
const presets = TmuxConfigManager.getPresets();
if (!presets[presetName]) {
console.error(chalk.red(`❌ Unknown preset: ${presetName}`));
console.log(chalk.gray('Available presets:'), Object.keys(presets).join(', '));
return;
}
if (configManager.applyPreset(presetName)) {
console.log(chalk.green(`✅ Applied preset: ${chalk.bold(presetName)}`));
console.log(chalk.gray(' Restart tmux interface to see changes'));
}
else {
console.error(chalk.red(`❌ Failed to apply preset: ${presetName}`));
}
return;
}
// Reset configuration
if (options.reset) {
configManager.resetToDefaults();
console.log(chalk.green('✅ Configuration reset to defaults'));
console.log(chalk.gray(' Restart tmux interface to see changes'));
return;
}
// No options provided - show help
console.log(chalk.cyan.bold('🎨 Tmux Theme Manager\\n'));
console.log('Available options:');
console.log(' --list List available themes');
console.log(' --set <theme> Set active theme');
console.log(' --preview <theme> Preview theme colors');
console.log(' --config Show current configuration');
console.log(' --preset <name> Apply configuration preset');
console.log(' --reset Reset to default configuration');
console.log(chalk.gray('\\nExamples:'));
console.log(chalk.gray(' blax theme --list'));
console.log(chalk.gray(' blax theme --set dracula'));
console.log(chalk.gray(' blax theme --preset developer'));
console.log(chalk.gray(' tlnt theme --config'));
}
catch (error) {
console.error(chalk.red('❌ Error:'), error instanceof Error ? error.message : String(error));
process.exit(1);
}
}
export default createThemeCommand;
//# sourceMappingURL=themeCommand.js.map