UNPKG

pm-orchestrator-enhancement

Version:

PM Orchestrator Enhancement - Multi-agent parallel execution system

114 lines 3.88 kB
"use strict"; /** * PM Orchestrator Enhancement - Implementer Subagent * * 実装を実行します(ファイル作成・修正・削除) */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Implementer = void 0; class Implementer { constructor() { this.version = '1.0.0'; } /** * 実装を実行します * * @param design 設計書 * @param files ファイル操作 * @param tests テスト実行フラグ * @returns 実装結果 */ async implement(design, _files, _tests) { const filesCreated = []; const filesModified = []; const filesDeleted = []; let linesAdded = 0; let linesDeleted = 0; const errors = []; for (const file of _files) { try { switch (file.operation) { case 'create': { await this.createFile(file.path, file.content || ''); filesCreated.push(file.path); linesAdded += this.countLines(file.content || ''); } break; case 'modify': { const originalLines = await this.getFileLines(file.path); await this.modifyFile(file.path, file.content || ''); filesModified.push(file.path); const newLines = this.countLines(file.content || ''); linesAdded += Math.max(0, newLines - originalLines); linesDeleted += Math.max(0, originalLines - newLines); } break; case 'delete': { const deletedLines = await this.getFileLines(file.path); await this.deleteFile(file.path); filesDeleted.push(file.path); linesDeleted += deletedLines; } break; } } catch (error) { errors.push(`${file.path}: ${error.message}`); } } const status = errors.length === 0 ? 'success' : 'error'; const autoFixApplied = false; // 実装例: Lintやフォーマットの自動適用 return { status, filesCreated, filesModified, filesDeleted, linesAdded, linesDeleted, autoFixApplied, errors: errors.length > 0 ? errors : undefined }; } /** * ファイルを作成(プライベート) */ async createFile(_path, _content) { // 実装例: fs.writeFileでファイル作成 // ここではモック実装 } /** * ファイルを修正(プライベート) */ async modifyFile(_path, _content) { // 実装例: fs.writeFileでファイル上書き // ここではモック実装 } /** * ファイルを削除(プライベート) */ async deleteFile(_path) { // 実装例: fs.unlinkでファイル削除 // ここではモック実装 } /** * ファイルの行数を取得(プライベート) */ async getFileLines(_path) { // 実装例: fs.readFileで読み込んで行数カウント // ここではモック実装 return 0; } /** * コンテンツの行数をカウント(プライベート) */ countLines(content) { if (!content) return 0; return content.split('\n').length; } } exports.Implementer = Implementer; //# sourceMappingURL=implementer.js.map