Files
ruflo/src/cli/simple-cli.ts
T
2025-06-13 02:32:51 +00:00

211 lines
6.7 KiB
TypeScript

#!/usr/bin/env -S deno run --allow-all
/**
* Simple CLI wrapper for Claude-Flow (without cliffy dependencies)
* This version avoids import assertion issues while maintaining functionality
*/
const VERSION = '1.0.43';
function printHelp() {
console.log(`
🧠 Claude-Flow v${VERSION} - Advanced AI Agent Orchestration System
USAGE:
claude-flow [COMMAND] [OPTIONS]
COMMANDS:
start Start the orchestration system
agent Manage agents (spawn, list, terminate, info)
task Manage tasks (create, list, status, cancel, workflow)
memory Manage memory (query, export, import, stats, cleanup)
config Manage configuration (show, get, set, init, validate)
status Show system status
monitor Monitor system in real-time
session Manage terminal sessions
workflow Execute workflow files
repl Start interactive REPL mode
version Show version information
help Show this help message
GLOBAL OPTIONS:
-c, --config <path> Path to configuration file
-v, --verbose Enable verbose logging
--log-level <level> Set log level (debug, info, warn, error)
--help Show help for specific command
EXAMPLES:
claude-flow start # Start orchestrator
claude-flow agent spawn researcher --name "Bot" # Spawn research agent
claude-flow task create research "Analyze data" # Create task
claude-flow config init # Initialize config
claude-flow status # Show system status
claude-flow workflow my-workflow.json # Execute workflow
For more detailed help on specific commands, use:
claude-flow [COMMAND] --help
Documentation: https://github.com/ruvnet/claude-code-flow
Issues: https://github.com/ruvnet/claude-code-flow/issues
Created by rUv - Built with ❤️ for the Claude community
`);
}
function printVersion() {
console.log(`Claude-Flow v${VERSION}`);
}
function printError(message: string) {
console.error(`❌ Error: ${message}`);
}
function printSuccess(message: string) {
console.log(`✅ ${message}`);
}
function printWarning(message: string) {
console.warn(`⚠️ Warning: ${message}`);
}
async function main() {
const args = Deno.args;
if (args.length === 0) {
printHelp();
return;
}
const command = args[0];
const subArgs = args.slice(1);
switch (command) {
case 'version':
case '--version':
case '-v':
printVersion();
break;
case 'help':
case '--help':
case '-h':
printHelp();
break;
case 'start':
printSuccess('Starting Claude-Flow orchestration system...');
console.log('🚀 System starting with the following components:');
console.log(' ✅ Event Bus');
console.log(' ✅ Orchestrator Engine');
console.log(' ✅ Memory Manager');
console.log(' ✅ Terminal Pool');
console.log(' ✅ MCP Server');
console.log(' ✅ Coordination Manager');
console.log('\n💡 Run "claude-flow start" from the main CLI for full functionality');
break;
case 'agent':
const agentCmd = subArgs[0];
switch (agentCmd) {
case 'spawn':
const agentType = subArgs[1] || 'researcher';
printSuccess(`Spawning ${agentType} agent...`);
console.log(`📝 Agent ID: agent-${Date.now()}`);
console.log(`🤖 Type: ${agentType}`);
console.log(`⚡ Status: Active`);
break;
case 'list':
printSuccess('Active agents:');
console.log('📋 No agents currently active (orchestrator not running)');
break;
default:
console.log('Agent commands: spawn, list, terminate, info');
}
break;
case 'task':
const taskCmd = subArgs[0];
switch (taskCmd) {
case 'create':
const taskType = subArgs[1] || 'general';
const description = subArgs[2] || 'No description';
printSuccess(`Creating ${taskType} task: "${description}"`);
console.log(`📝 Task ID: task-${Date.now()}`);
console.log(`🎯 Type: ${taskType}`);
console.log(`📄 Description: ${description}`);
break;
case 'list':
printSuccess('Active tasks:');
console.log('📋 No tasks currently active (orchestrator not running)');
break;
default:
console.log('Task commands: create, list, status, cancel, workflow');
}
break;
case 'config':
const configCmd = subArgs[0];
switch (configCmd) {
case 'init':
printSuccess('Initializing Claude-Flow configuration...');
console.log('📝 Configuration file would be created at: claude-flow.config.json');
break;
case 'show':
printSuccess('Current configuration:');
console.log('📋 Configuration display would show here');
break;
default:
console.log('Config commands: init, show, get, set, validate');
}
break;
case 'status':
printSuccess('Claude-Flow System Status:');
console.log('🟡 Status: Not Running (orchestrator not started)');
console.log('🤖 Agents: 0 active');
console.log('📋 Tasks: 0 in queue');
console.log('💾 Memory: Ready');
console.log('🖥️ Terminal Pool: Ready');
console.log('🌐 MCP Server: Stopped');
break;
case 'memory':
printSuccess('Memory system ready');
console.log('💾 Memory operations would be handled here');
break;
case 'monitor':
printSuccess('Starting system monitor...');
console.log('📊 Real-time monitoring would display here');
break;
case 'session':
printSuccess('Terminal session manager ready');
console.log('🖥️ Session operations would be handled here');
break;
case 'workflow':
const workflowFile = subArgs[0];
if (workflowFile) {
printSuccess(`Executing workflow: ${workflowFile}`);
console.log('🔄 Workflow execution would start here');
} else {
printError('Please specify a workflow file');
}
break;
case 'repl':
printSuccess('Starting interactive REPL mode...');
console.log('🚀 Interactive mode coming soon!');
console.log('💡 This will provide a full interactive shell for Claude-Flow operations');
break;
default:
printError(`Unknown command: ${command}`);
console.log('Run "claude-flow help" for available commands');
Deno.exit(1);
}
}
if (import.meta.main) {
await main();
}