UNPKG

pm-orchestrator-enhancement

Version:

PM Orchestrator Enhancement - Multi-agent parallel execution system

222 lines (217 loc) 8.21 kB
#!/usr/bin/env node "use strict"; /** * PM Orchestrator Enhancement - CLI * * コマンドラインインターフェース */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.main = main; const pm_orchestrator_1 = require("../orchestrator/pm-orchestrator"); // import { ExecutionLogger } from '../logger/execution-logger'; const visualization_1 = require("../visualization"); const selfCheck_1 = require("../install/selfCheck"); const child_process_1 = require("child_process"); const path = __importStar(require("path")); const VERSION = '1.0.18'; async function main() { const args = process.argv.slice(2); if (args.length === 0 || args.includes('--help') || args.includes('-h')) { printHelp(); process.exit(0); } if (args.includes('--version') || args.includes('-v')) { console.log(`PM Orchestrator Enhancement v${VERSION}`); process.exit(0); } const command = args[0]; switch (command) { case 'install': runInstall(args.slice(1)); break; case 'uninstall': runUninstall(args.slice(1)); break; case 'execute': await executeTask(args.slice(1)); break; case 'analyze': await analyzeCode(args.slice(1)); break; case 'design': await createDesign(args.slice(1)); break; case 'implement': await implementFeature(args.slice(1)); break; case 'test': await runTests(args.slice(1)); break; case 'qa': await runQA(args.slice(1)); break; case 'selfcheck': await runSelfCheckCommand(args.slice(1)); break; default: console.error(`Unknown command: ${command}`); console.error('Run "pm-orchestrator --help" for usage information'); process.exit(1); } } function printHelp() { console.log(` PM Orchestrator Enhancement - Multi-Agent Development Orchestration System Usage: pm-orchestrator <command> [options] Commands: install Install PM Orchestrator to a project (.claude/ directory) uninstall Remove PM Orchestrator from a project selfcheck Verify installation integrity (8 checks) --repair: Auto-repair detected issues execute Execute a complete task with automatic subagent selection analyze Analyze code quality, similarity, or architecture design Create design documents based on requirements implement Implement features based on design test Create and run tests qa Run quality checks (lint, test, typecheck, build) Options: -h, --help Show this help message -v, --version Show version information Examples: pm-orchestrator install Install to current directory pm-orchestrator install ./my-project Install to specific directory pm-orchestrator uninstall Remove from current directory pm-orchestrator execute --task "Add user authentication" pm-orchestrator analyze --files "src/**/*.ts" --type quality pm-orchestrator design --requirements "User management system" pm-orchestrator implement --design design.md --files src/ pm-orchestrator test --type unit --coverage 80 pm-orchestrator qa --checks lint,test,typecheck,build For more information, visit: https://github.com/pm-orchestrator/pm-orchestrator-enhancement `); } function runInstall(args) { const targetDir = args[0] || '.'; const scriptPath = path.join(__dirname, '..', '..', 'scripts', 'install.sh'); console.log(`Installing PM Orchestrator to ${targetDir}...`); try { (0, child_process_1.execSync)(`bash "${scriptPath}" "${targetDir}"`, { stdio: 'inherit' }); } catch (error) { console.error('Installation failed'); process.exit(1); } } function runUninstall(args) { const targetDir = args[0] || '.'; const scriptPath = path.join(__dirname, '..', '..', 'scripts', 'uninstall.sh'); console.log(`Uninstalling PM Orchestrator from ${targetDir}...`); try { (0, child_process_1.execSync)(`bash "${scriptPath}" "${targetDir}"`, { stdio: 'inherit' }); } catch (error) { console.error('Uninstallation failed'); process.exit(1); } } async function executeTask(args) { const tracker = new visualization_1.ProgressTracker(); const ui = new visualization_1.TerminalUI(); const orchestrator = new pm_orchestrator_1.PMOrchestrator(); // リスナー登録 tracker.addListener(progress => { ui.displayProgress(progress); }); const taskDescription = args.join(' ') || 'Unnamed task'; console.log(`Executing task: ${taskDescription}\n`); try { const result = await orchestrator.executeTask({ userInput: taskDescription, detectedPattern: undefined }); console.log('\n' + '='.repeat(60)); console.log('Task Execution Complete'); console.log('='.repeat(60)); console.log(`Status: ${result.status}`); console.log(`Subagents: ${result.subagentResults.map(r => r.name).join(', ')}`); console.log(`Summary: ${result.summary}`); if (result.nextSteps.length > 0) { console.log('\nNext Steps:'); result.nextSteps.forEach((step) => console.log(` - ${step}`)); } } catch (error) { console.error('\nError executing task:', error.message); process.exit(1); } } async function analyzeCode(args) { console.log('Code analysis feature coming soon...'); console.log('Arguments:', args); } async function createDesign(args) { console.log('Design creation feature coming soon...'); console.log('Arguments:', args); } async function implementFeature(args) { console.log('Implementation feature coming soon...'); console.log('Arguments:', args); } async function runTests(args) { console.log('Test execution feature coming soon...'); console.log('Arguments:', args); } async function runQA(args) { console.log('QA checks feature coming soon...'); console.log('Arguments:', args); } async function runSelfCheckCommand(args) { const hasRepairFlag = args.includes('--repair'); const targetDir = args.find(arg => !arg.startsWith('--')) || '.'; console.log(`Running self-check on ${targetDir}...${hasRepairFlag ? ' (auto-repair enabled)' : ''}\n`); const result = await (0, selfCheck_1.runSelfCheck)(targetDir, { autoRepair: hasRepairFlag }); console.log((0, selfCheck_1.formatResult)(result)); process.exit(result.success ? 0 : 1); } // Run CLI if (require.main === module) { main().catch(error => { console.error('Fatal error:', error); process.exit(1); }); } //# sourceMappingURL=index.js.map