UNPKG

@mmlotfy/intellicodemcp

Version:

IntelliCodeMCP - Advanced AI Model Context Protocol System for intelligent code management and orchestration

86 lines 3.51 kB
#!/usr/bin/env node "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = __importDefault(require("./index")); async function main() { const args = process.argv.slice(2); // Parse command line arguments const toolName = args.find((arg, i) => arg === '--tool' && args[i + 1]) ? args[args.indexOf('--tool') + 1] : ''; const toolArgs = {}; // Parse all arguments for (let i = 0; i < args.length; i++) { if (args[i].startsWith('--') && args[i + 1] && !args[i + 1].startsWith('--')) { const key = args[i].slice(2); let value = args[i + 1]; // Try to parse JSON for complex objects if (value.startsWith('{') || value.startsWith('[')) { try { value = JSON.parse(value); } catch { // Keep as string if JSON parsing fails } } // Convert string booleans if (value === 'true') value = true; if (value === 'false') value = false; toolArgs[key] = value; } } // Show help if no tool specified if (!toolName) { console.log('IntelliCodeMCP - Model Context Protocol System'); console.log(''); console.log('Usage: node dist/main/cli.js --tool <tool_name> [options]'); console.log(''); console.log('Available tools:'); const tools = index_1.default.listTools(); tools.forEach(tool => { const info = index_1.default.getToolInfo(tool); console.log(` ${tool}: ${info?.description || 'No description'}`); }); console.log(''); console.log('Examples:'); console.log(' # Write to memory bank'); console.log(' node dist/main/cli.js --tool memory_bank --action write --category docs --file_name test.txt --content "Hello World"'); console.log(''); console.log(' # Run code trace'); console.log(' node dist/main/cli.js --tool code_trace --project_path . --check_type all'); console.log(''); console.log(' # Execute performance orchestrator'); console.log(' node dist/main/cli.js --tool performance_orchestrator --task \'{"id":"task1","type":"simple","input":"Fix typo","priority":"low"}\''); process.exit(0); } try { console.log(`\n=== Executing ${toolName} ===`); console.log('Arguments:', JSON.stringify(toolArgs, null, 2)); console.log(''); const result = await index_1.default.execute(toolName, toolArgs); console.log('\n=== Result ==='); console.log(JSON.stringify(result, null, 2)); console.log('\n=== Execution Complete ==='); } catch (err) { console.error('\n=== Error ==='); console.error(`Error: ${err.message}`); console.error('\n=== Execution Failed ==='); process.exit(1); } } // Handle unhandled promise rejections process.on('unhandledRejection', (reason, promise) => { console.error('Unhandled Rejection at:', promise, 'reason:', reason); process.exit(1); }); // Handle uncaught exceptions process.on('uncaughtException', (error) => { console.error('Uncaught Exception:', error); process.exit(1); }); main(); //# sourceMappingURL=cli.js.map