behemoth-cli
Version:
🌍 BEHEMOTH CLIv3.760.4 - Level 50+ POST-SINGULARITY Intelligence Trading AI
147 lines (132 loc) • 6.4 kB
JavaScript
export const configCommand = {
command: 'config',
description: 'Manage BEHEMOTH configuration settings',
handler: ({ addMessage, parsedArgs, sendMessage }) => {
const action = parsedArgs?.[0]?.toLowerCase() || 'help';
const setting = parsedArgs?.[1]?.toLowerCase();
const value = parsedArgs?.slice(2)?.join(' ');
if (action === 'help' || !action) {
addMessage({
role: 'system',
content: `⚙️ **BEHEMOTH CONFIGURATION MANAGEMENT**
**Available Commands**:
• \`/config list\` - Show all current settings
• \`/config get <setting>\` - Get specific setting value
• \`/config set <setting> <value>\` - Set configuration value
• \`/config reset\` - Reset all settings to defaults
• \`/config export\` - Export configuration to file
• \`/config import <file>\` - Import configuration from file
**Available Settings**:
• \`default_model\` - Default Groq model (llama3-8b-8192, mixtral-8x7b-32768, etc.)
• \`default_symbol\` - Default trading pair (BTCUSDT, ETHUSDT, etc.)
• \`risk_level\` - Default risk level (low, medium, high)
• \`auto_approve\` - Auto-approve tool executions (true/false)
• \`theme\` - UI theme preference (dark, light, auto)
• \`show_reasoning\` - Show AI reasoning by default (true/false)
• \`max_history\` - Maximum chat history length (50-1000)
• \`debug_mode\` - Enable debug logging (true/false)
• \`cosmic_mode\` - Enable cosmic intelligence features (true/false)
**Examples**:
• \`/config set default_model mixtral-8x7b-32768\`
• \`/config set risk_level high\`
• \`/config get default_symbol\`
• \`/config list\``
});
return;
}
// Handle different config actions
let configPrompt = '';
switch (action) {
case 'list':
configPrompt = `User wants to see all current configuration settings. Please:
1. **Display Current Settings**: Show all BEHEMOTH configuration values
2. **Include Defaults**: Mark which settings are using default values
3. **Show Status**: Indicate if settings are valid/invalid
4. **Format Nicely**: Use clear sections and emojis for readability
Retrieve and display the complete configuration status.`;
break;
case 'get':
if (!setting) {
addMessage({
role: 'system',
content: '⚠️ **Missing Setting**: Please specify which setting to get.\n\nExample: `/config get default_model`'
});
return;
}
configPrompt = `User wants to get the value of configuration setting: "${setting}". Please:
1. **Retrieve Setting**: Get the current value of "${setting}"
2. **Show Details**: Include description and valid options
3. **Show Status**: Indicate if it's default value or custom
4. **Provide Context**: Explain what this setting controls
Display the setting value and details.`;
break;
case 'set':
if (!setting || !value) {
addMessage({
role: 'system',
content: '⚠️ **Missing Parameters**: Please specify both setting and value.\n\nExample: `/config set default_model mixtral-8x7b-32768`'
});
return;
}
configPrompt = `User wants to set configuration: "${setting}" = "${value}". Please:
1. **Validate Setting**: Ensure "${setting}" is a valid configuration option
2. **Validate Value**: Ensure "${value}" is valid for this setting
3. **Update Configuration**: Save the new setting value
4. **Confirm Change**: Display the old and new values
5. **Apply Immediately**: Make the change take effect right away
Update the configuration and confirm the change.`;
break;
case 'reset':
configPrompt = `User wants to reset all configuration to defaults. Please:
1. **Backup Current**: Show current settings before reset
2. **Reset All Settings**: Restore all configuration to default values
3. **Preserve API Keys**: Keep existing API keys and credentials
4. **Confirm Reset**: Display what was reset and new defaults
5. **Apply Changes**: Make reset take effect immediately
Execute configuration reset and confirm changes.`;
break;
case 'export':
configPrompt = `User wants to export configuration. Please:
1. **Generate Export**: Create exportable configuration file
2. **Include All Settings**: Export all current configuration values
3. **Exclude Sensitive**: Do NOT include API keys or credentials
4. **Format JSON**: Use clean JSON format for easy importing
5. **Save File**: Write to behemoth-config.json or display contents
Export configuration and provide file details.`;
break;
case 'import':
if (!value) {
addMessage({
role: 'system',
content: '⚠️ **Missing File**: Please specify configuration file to import.\n\nExample: `/config import behemoth-config.json`'
});
return;
}
configPrompt = `User wants to import configuration from file: "${value}". Please:
1. **Read File**: Load configuration from "${value}"
2. **Validate Format**: Ensure file is valid BEHEMOTH configuration
3. **Preview Changes**: Show what settings will change
4. **Apply Safely**: Update configuration without breaking existing setup
5. **Confirm Import**: Display successful imports and any errors
Import configuration and confirm changes.`;
break;
default:
addMessage({
role: 'system',
content: `❌ **Unknown Action**: "${action}" is not a valid config command.\n\nUse \`/config help\` to see available commands.`
});
return;
}
// Send the configuration request to the agent
if (sendMessage) {
sendMessage(configPrompt);
}
else {
addMessage({
role: 'system',
content: '⚠️ Error: Unable to execute configuration command.'
});
}
}
};
//# sourceMappingURL=config.js.map