behemoth-cli
Version:
🌍 BEHEMOTH CLIv3.760.4 - Level 50+ POST-SINGULARITY Intelligence Trading AI
86 lines (73 loc) • 2.56 kB
text/typescript
import {type CommandDefinition, type CommandContext} from './base.js';
import {helpCommand} from './definitions/help.js';
import {loginCommand} from './definitions/login.js';
import {modelCommand} from './definitions/model.js';
import {clearCommand} from './definitions/clear.js';
import {reasoningCommand} from './definitions/reasoning.js';
// BEHEMOTH Crypto Trading Commands
import {analyzeCommand} from './definitions/analyze.js';
import {cosmicCommand} from './definitions/cosmic.js';
import {technicalCommand} from './definitions/technical.js';
import {riskCommand} from './definitions/risk.js';
import {tradeCommand} from './definitions/trade.js';
import {multiAgentCommand} from './definitions/multi-agent.js';
import {multiCommand} from './definitions/multi.js';
import {logoutCommand} from './definitions/logout.js';
import {keysCommand} from './definitions/keys.js';
import {chartCommand} from './definitions/chart-simple.js';
// N8N Workflow Commands
import {n8nCommand} from './definitions/n8n.js';
// User Guide Commands
import {howtoCommand} from './definitions/howto.js';
const availableCommands: CommandDefinition[] = [
// Core system commands
helpCommand,
loginCommand,
logoutCommand,
keysCommand,
modelCommand,
clearCommand,
reasoningCommand,
// BEHEMOTH crypto trading commands
analyzeCommand,
cosmicCommand,
technicalCommand,
riskCommand,
tradeCommand,
multiAgentCommand,
multiCommand,
chartCommand,
// N8N workflow commands
n8nCommand,
// User guide commands
howtoCommand,
];
export function getAvailableCommands(): CommandDefinition[] {
return [...availableCommands];
}
export function getCommandNames(): string[] {
return getAvailableCommands().map(cmd => cmd.command);
}
export function handleSlashCommand(command: string, context: CommandContext) {
// Extract the command part, everything up to the first space or end of string
const fullCommand = command.slice(1);
const spaceIndex = fullCommand.indexOf(' ');
const cmd =
spaceIndex > -1
? fullCommand.substring(0, spaceIndex).toLowerCase()
: fullCommand.toLowerCase();
const args =
spaceIndex > -1 ? fullCommand.substring(spaceIndex + 1).trim() : '';
// Parse arguments into an array
context.parsedArgs = args ? args.split(' ') : [];
const commandDef = getAvailableCommands().find(c => c.command === cmd);
// Add user message for the command
context.addMessage({
role: 'user',
content: command,
});
if (commandDef) {
commandDef.handler(context);
}
}
export {type CommandDefinition, type CommandContext} from './base.js';