@weavelogic/knowledge-graph-agent 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"sparc-planner.js","sources":["../../src/sparc/sparc-planner.ts"],"sourcesContent":["/**\n * SPARC Planner\n *\n * Main orchestrator for creating comprehensive SPARC plans.\n * Coordinates research, planning, consensus building, and review processes.\n *\n * @module sparc/sparc-planner\n */\n\nimport { existsSync, readdirSync, statSync, readFileSync, writeFileSync, mkdirSync } from 'fs';\nimport { join, dirname, extname, relative } from 'path';\nimport { createLogger } from '../utils/index.js';\nimport { createDecisionLogManager, DecisionLogManager } from './decision-log.js';\nimport { createConsensusBuilder, ConsensusBuilder } from './consensus.js';\nimport { createReviewProcess, ReviewProcessManager } from './review-process.js';\nimport type {\n SPARCPlan,\n SPARCPhase,\n SPARCTask,\n SpecificationDocument,\n ArchitectureDocument,\n AlgorithmDesign,\n ExistingCodeAnalysis,\n ResearchFinding,\n Requirement,\n Feature,\n ArchitectureComponent,\n KGReference,\n ContextLink,\n ConfidenceLevel,\n ReviewResult,\n} from './types.js';\n\nconst logger = createLogger('sparc-planner');\n\n/**\n * Planner options\n */\nexport interface SPARCPlannerOptions {\n /** Project root path */\n projectRoot: string;\n /** Output directory for plan artifacts */\n outputDir?: string;\n /** Plan name */\n name: string;\n /** Plan description */\n description: string;\n /** Enable parallel research */\n parallelResearch?: boolean;\n /** Number of review passes */\n reviewPasses?: number;\n /** Auto-build consensus for low confidence */\n autoConsensus?: boolean;\n /** Knowledge graph integration */\n kgEnabled?: boolean;\n /** Vector database integration */\n vectorEnabled?: boolean;\n}\n\n/**\n * Research task definition\n */\ninterface ResearchTask {\n /** Task ID */\n id: string;\n /** Agent type */\n agentType: string;\n /** Task description */\n description: string;\n /** Topics to research */\n topics: string[];\n /** Context to include */\n context: string[];\n}\n\n/**\n * SPARC Planner\n *\n * Orchestrates the full SPARC planning process.\n */\nexport class SPARCPlanner {\n private readonly options: Required<SPARCPlannerOptions>;\n private plan: SPARCPlan;\n private decisionLog: DecisionLogManager;\n private consensusBuilder: ConsensusBuilder;\n\n constructor(options: SPARCPlannerOptions) {\n this.options = {\n outputDir: join(options.projectRoot, '.sparc'),\n parallelResearch: true,\n reviewPasses: 3,\n autoConsensus: true,\n kgEnabled: true,\n vectorEnabled: true,\n ...options,\n };\n\n // Initialize plan\n this.plan = this.initializePlan();\n\n // Initialize decision log\n this.decisionLog = createDecisionLogManager({\n outputDir: this.options.outputDir,\n planId: this.plan.id,\n });\n\n // Initialize consensus builder\n this.consensusBuilder = createConsensusBuilder({\n defaultThreshold: 0.67,\n method: 'majority',\n });\n\n logger.info('SPARC Planner initialized', {\n planId: this.plan.id,\n projectRoot: this.options.projectRoot,\n });\n }\n\n /**\n * Initialize a new plan\n */\n private initializePlan(): SPARCPlan {\n const now = new Date();\n const id = `plan_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;\n\n return {\n id,\n name: this.options.name,\n description: this.options.description,\n status: 'draft',\n currentPhase: 'specification',\n projectRoot: this.options.projectRoot,\n outputDir: this.options.outputDir,\n tasks: [],\n parallelGroups: [],\n criticalPath: [],\n executionOrder: [],\n researchFindings: [],\n decisionLog: {\n id: `dlog_${id}`,\n planId: id,\n decisions: [],\n statistics: {\n total: 0,\n approved: 0,\n rejected: 0,\n deferred: 0,\n highConfidence: 0,\n lowConfidence: 0,\n consensusRequired: 0,\n },\n createdAt: now,\n updatedAt: now,\n },\n createdAt: now,\n updatedAt: now,\n version: '1.0.0',\n author: 'sparc-planner',\n statistics: {\n totalTasks: 0,\n completedTasks: 0,\n parallelizableTasks: 0,\n estimatedHours: 0,\n researchFindings: 0,\n decisions: 0,\n kgNodes: 0,\n },\n };\n }\n\n /**\n * Execute the full planning process\n */\n async executePlanning(): Promise<SPARCPlan> {\n logger.info('Starting SPARC planning process', { planId: this.plan.id });\n\n try {\n // Phase 1: Research\n this.plan.status = 'researching';\n await this.executeResearchPhase();\n\n // Phase 2: Planning (Specification, Pseudocode, Architecture)\n this.plan.status = 'planning';\n await this.executeSpecificationPhase();\n await this.executePseudocodePhase();\n await this.executeArchitecturePhase();\n\n // Phase 3: Refinement (Task breakdown)\n await this.executeRefinementPhase();\n\n // Phase 4: Review\n this.plan.status = 'reviewing';\n const reviewResult = await this.executeReviewPhase();\n this.plan.reviewResult = reviewResult;\n\n // Finalize\n if (reviewResult.overallStatus === 'approved') {\n this.plan.status = 'approved';\n } else if (reviewResult.overallStatus === 'rejected') {\n this.plan.status = 'failed';\n } else {\n this.plan.status = 'planning'; // Needs more work\n }\n\n // Update statistics\n this.updateStatistics();\n\n // Save plan\n this.savePlan();\n\n logger.info('SPARC planning completed', {\n planId: this.plan.id,\n status: this.plan.status,\n tasks: this.plan.tasks.length,\n });\n\n return this.plan;\n } catch (error) {\n this.plan.status = 'failed';\n logger.error('SPARC planning failed', error instanceof Error ? error : new Error(String(error)));\n throw error;\n }\n }\n\n /**\n * Execute research phase\n */\n private async executeResearchPhase(): Promise<void> {\n logger.info('Executing research phase');\n this.plan.currentPhase = 'specification';\n\n // Analyze existing code if present\n const srcPath = join(this.options.projectRoot, 'src');\n if (existsSync(srcPath)) {\n this.plan.existingCode = await this.analyzeExistingCode(srcPath);\n this.addDecision(\n 'Existing Code Integration',\n 'Integrate with existing codebase in src/',\n 'specification',\n 'high',\n 'Existing code found and analyzed for patterns and integration points',\n ['Start from scratch', 'Partial rewrite', 'Full integration']\n );\n }\n\n // Define research tasks\n const researchTasks = this.defineResearchTasks();\n\n // Execute research (would spawn agents in real implementation)\n for (const task of researchTasks) {\n const finding = await this.executeResearchTask(task);\n this.plan.researchFindings.push(finding);\n }\n\n logger.info('Research phase completed', {\n findings: this.plan.researchFindings.length,\n hasExistingCode: !!this.plan.existingCode,\n });\n }\n\n /**\n * Analyze existing code in src directory\n */\n private async analyzeExistingCode(srcPath: string): Promise<ExistingCodeAnalysis> {\n const analysis: ExistingCodeAnalysis = {\n hasSrcDirectory: true,\n srcPath,\n fileCount: 0,\n languages: {},\n keyFiles: [],\n patterns: [],\n dependencies: [],\n entryPoints: [],\n };\n\n // Recursively analyze files\n const analyzeDir = (dir: string) => {\n const entries = readdirSync(dir);\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n const stat = statSync(fullPath);\n\n if (stat.isDirectory()) {\n if (!entry.startsWith('.') && entry !== 'node_modules') {\n analyzeDir(fullPath);\n }\n } else if (stat.isFile()) {\n analysis.fileCount++;\n\n const ext = extname(entry);\n analysis.languages[ext] = (analysis.languages[ext] || 0) + 1;\n\n // Identify key files\n if (entry === 'index.ts' || entry === 'index.js') {\n analysis.entryPoints.push(relative(this.options.projectRoot, fullPath));\n }\n\n if (entry === 'package.json') {\n try {\n const pkg = JSON.parse(readFileSync(fullPath, 'utf-8'));\n analysis.dependencies = Object.keys(pkg.dependencies || {});\n } catch {\n // Ignore parse errors\n }\n }\n }\n }\n };\n\n analyzeDir(srcPath);\n\n // Identify patterns from file structure\n if (analysis.languages['.ts'] > 0 || analysis.languages['.tsx'] > 0) {\n analysis.patterns.push('TypeScript');\n }\n if (existsSync(join(this.options.projectRoot, 'tests')) ||\n existsSync(join(this.options.projectRoot, '__tests__'))) {\n analysis.patterns.push('Test-Driven Development');\n analysis.testCoverage = { hasTests: true };\n }\n\n return analysis;\n }\n\n /**\n * Define research tasks\n */\n private defineResearchTasks(): ResearchTask[] {\n return [\n {\n id: 'research-requirements',\n agentType: 'researcher',\n description: 'Research and analyze project requirements',\n topics: ['functional requirements', 'non-functional requirements', 'constraints'],\n context: [this.options.description],\n },\n {\n id: 'research-patterns',\n agentType: 'researcher',\n description: 'Research applicable design patterns',\n topics: ['design patterns', 'architecture patterns', 'best practices'],\n context: this.plan.existingCode?.patterns || [],\n },\n {\n id: 'research-technology',\n agentType: 'researcher',\n description: 'Research technology choices and alternatives',\n topics: ['technology stack', 'frameworks', 'libraries'],\n context: this.plan.existingCode?.dependencies || [],\n },\n ];\n }\n\n /**\n * Execute a research task (stub - would spawn agent)\n */\n private async executeResearchTask(task: ResearchTask): Promise<ResearchFinding> {\n // In real implementation, this would spawn a researcher agent\n return {\n id: `finding_${task.id}`,\n agent: task.agentType,\n topic: task.topics[0],\n summary: `Research findings for ${task.description}`,\n details: `Detailed research results for topics: ${task.topics.join(', ')}`,\n confidence: 'medium' as ConfidenceLevel,\n evidence: task.context,\n relatedFindings: [],\n kgReferences: [],\n timestamp: new Date(),\n };\n }\n\n /**\n * Execute specification phase\n */\n private async executeSpecificationPhase(): Promise<void> {\n logger.info('Executing specification phase');\n this.plan.currentPhase = 'specification';\n\n // Build specification document\n const spec: SpecificationDocument = {\n id: `spec_${this.plan.id}`,\n projectName: this.options.name,\n version: '1.0.0',\n createdAt: new Date(),\n updatedAt: new Date(),\n summary: this.options.description,\n problemStatement: this.extractProblemStatement(),\n goals: this.extractGoals(),\n requirements: this.generateRequirements(),\n features: this.generateFeatures(),\n constraints: this.extractConstraints(),\n assumptions: [],\n outOfScope: [],\n successMetrics: this.generateSuccessMetrics(),\n kgReferences: [],\n };\n\n this.plan.specification = spec;\n\n // Log decision about requirements\n this.addDecision(\n 'Requirements Definition',\n `Defined ${spec.requirements.length} requirements and ${spec.features.length} features`,\n 'specification',\n 'high',\n 'Requirements derived from research findings and project description'\n );\n\n logger.info('Specification phase completed', {\n requirements: spec.requirements.length,\n features: spec.features.length,\n });\n }\n\n /**\n * Execute pseudocode phase\n */\n private async executePseudocodePhase(): Promise<void> {\n logger.info('Executing pseudocode phase');\n this.plan.currentPhase = 'pseudocode';\n\n // Generate algorithm designs for each feature\n const algorithms: AlgorithmDesign[] = [];\n\n for (const feature of this.plan.specification?.features || []) {\n const algorithm = this.generateAlgorithmDesign(feature);\n algorithms.push(algorithm);\n }\n\n this.plan.algorithms = algorithms;\n\n logger.info('Pseudocode phase completed', {\n algorithms: algorithms.length,\n });\n }\n\n /**\n * Execute architecture phase\n */\n private async executeArchitecturePhase(): Promise<void> {\n logger.info('Executing architecture phase');\n this.plan.currentPhase = 'architecture';\n\n // Build architecture document\n const arch: ArchitectureDocument = {\n id: `arch_${this.plan.id}`,\n version: '1.0.0',\n createdAt: new Date(),\n overview: this.generateArchitectureOverview(),\n patterns: this.identifyArchitecturePatterns(),\n components: this.generateComponents(),\n decisions: [],\n dataFlow: this.describeDataFlow(),\n securityConsiderations: this.identifySecurityConsiderations(),\n scalabilityConsiderations: [],\n diagrams: [],\n };\n\n this.plan.architecture = arch;\n\n // Log architecture decision\n this.addDecision(\n 'Architecture Design',\n `Defined ${arch.components.length} components using ${arch.patterns.join(', ')} patterns`,\n 'architecture',\n 'medium',\n 'Architecture designed based on requirements and existing patterns',\n ['Microservices', 'Monolith', 'Modular monolith']\n );\n\n logger.info('Architecture phase completed', {\n components: arch.components.length,\n patterns: arch.patterns.length,\n });\n }\n\n /**\n * Execute refinement phase (task breakdown)\n */\n private async executeRefinementPhase(): Promise<void> {\n logger.info('Executing refinement phase');\n this.plan.currentPhase = 'refinement';\n\n // Generate tasks from features and components\n const tasks: SPARCTask[] = [];\n\n // Research tasks\n tasks.push(this.createTask(\n 'Research and Analysis',\n 'Comprehensive research on project requirements and patterns',\n 'specification',\n 'research',\n 'high',\n 4\n ));\n\n // Implementation tasks for each component\n for (const component of this.plan.architecture?.components || []) {\n tasks.push(this.createTask(\n `Implement ${component.name}`,\n `Implement the ${component.name} component: ${component.description}`,\n 'refinement',\n 'implementation',\n this.getComponentPriority(component),\n this.estimateComponentHours(component)\n ));\n }\n\n // Testing tasks\n tasks.push(this.createTask(\n 'Unit Testing',\n 'Create comprehensive unit tests for all components',\n 'refinement',\n 'testing',\n 'high',\n 8\n ));\n\n tasks.push(this.createTask(\n 'Integration Testing',\n 'Create integration tests for component interactions',\n 'refinement',\n 'testing',\n 'medium',\n 6\n ));\n\n // Documentation tasks\n tasks.push(this.createTask(\n 'API Documentation',\n 'Document all public APIs and interfaces',\n 'completion',\n 'documentation',\n 'medium',\n 4\n ));\n\n this.plan.tasks = tasks;\n\n // Calculate parallel groups and critical path\n this.calculateParallelGroups();\n this.calculateCriticalPath();\n\n logger.info('Refinement phase completed', {\n tasks: tasks.length,\n parallelGroups: this.plan.parallelGroups.length,\n });\n }\n\n /**\n * Execute review phase\n */\n private async executeReviewPhase(): Promise<ReviewResult> {\n logger.info('Executing review phase');\n this.plan.currentPhase = 'completion';\n\n // Sync decision log\n this.plan.decisionLog = this.decisionLog.getLog();\n\n // Create review process\n const reviewProcess = createReviewProcess({\n plan: this.plan,\n passes: this.options.reviewPasses,\n autoFix: false,\n strictMode: false,\n });\n\n // Execute review\n const result = await reviewProcess.executeReview();\n\n logger.info('Review phase completed', {\n status: result.overallStatus,\n totalFindings: result.totalFindings,\n criticalFindings: result.criticalFindings,\n });\n\n return result;\n }\n\n /**\n * Add a decision to the log\n */\n private addDecision(\n title: string,\n description: string,\n phase: SPARCPhase,\n confidence: ConfidenceLevel,\n rationale: string,\n alternatives?: string[]\n ): void {\n const decision = this.decisionLog.addDecision({\n title,\n description,\n phase,\n confidence,\n rationale,\n alternatives,\n decidedBy: 'sparc-planner',\n });\n\n // Build consensus if needed\n if (this.options.autoConsensus && ConsensusBuilder.needsConsensus(confidence)) {\n logger.info('Building consensus for low-confidence decision', {\n decisionId: decision.id,\n confidence,\n });\n // In real implementation, would spawn agents for consensus\n }\n }\n\n /**\n * Create a SPARC task\n */\n private createTask(\n name: string,\n description: string,\n phase: SPARCPhase,\n type: SPARCTask['type'],\n priority: SPARCTask['priority'],\n estimatedHours: number\n ): SPARCTask {\n return {\n id: `task_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,\n name,\n description,\n phase,\n type,\n priority,\n estimatedHours,\n dependencies: [],\n parallelizable: type === 'implementation' || type === 'testing',\n status: 'pending',\n contextLinks: [],\n kgReferences: [],\n };\n }\n\n /**\n * Calculate parallel task groups\n */\n private calculateParallelGroups(): void {\n const parallelizable = this.plan.tasks.filter(t => t.parallelizable);\n\n // Group by phase\n const groups: string[][] = [];\n const phases = ['specification', 'pseudocode', 'architecture', 'refinement', 'completion'];\n\n for (const phase of phases) {\n const phaseTasks = parallelizable.filter(t => t.phase === phase);\n if (phaseTasks.length > 0) {\n groups.push(phaseTasks.map(t => t.id));\n }\n }\n\n this.plan.parallelGroups = groups;\n }\n\n /**\n * Calculate critical path\n */\n private calculateCriticalPath(): void {\n // Simple critical path: high priority tasks in order\n const critical = this.plan.tasks\n .filter(t => t.priority === 'critical' || t.priority === 'high')\n .sort((a, b) => {\n const phaseOrder = ['specification', 'pseudocode', 'architecture', 'refinement', 'completion'];\n return phaseOrder.indexOf(a.phase) - phaseOrder.indexOf(b.phase);\n })\n .map(t => t.id);\n\n this.plan.criticalPath = critical;\n this.plan.executionOrder = this.plan.tasks.map(t => t.id);\n }\n\n /**\n * Update plan statistics\n */\n private updateStatistics(): void {\n this.plan.statistics = {\n totalTasks: this.plan.tasks.length,\n completedTasks: this.plan.tasks.filter(t => t.status === 'completed').length,\n parallelizableTasks: this.plan.tasks.filter(t => t.parallelizable).length,\n estimatedHours: this.plan.tasks.reduce((sum, t) => sum + t.estimatedHours, 0),\n researchFindings: this.plan.researchFindings.length,\n decisions: this.decisionLog.getDecisions().length,\n kgNodes: this.plan.tasks.reduce((sum, t) => sum + (t.kgReferences?.length || 0), 0),\n };\n this.plan.updatedAt = new Date();\n }\n\n /**\n * Save plan to disk\n */\n savePlan(): void {\n const dir = this.options.outputDir;\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n\n // Save JSON plan\n const planPath = join(dir, 'sparc-plan.json');\n writeFileSync(planPath, JSON.stringify(this.plan, null, 2));\n\n // Save markdown summary\n const mdPath = join(dir, 'sparc-plan.md');\n writeFileSync(mdPath, this.generateMarkdownSummary());\n\n // Save decision log\n this.decisionLog.save();\n this.decisionLog.saveMarkdown();\n\n logger.info('Plan saved', { dir });\n }\n\n /**\n * Generate markdown summary\n */\n private generateMarkdownSummary(): string {\n const lines: string[] = [\n `# SPARC Plan: ${this.plan.name}`,\n '',\n `**Status:** ${this.plan.status}`,\n `**Version:** ${this.plan.version}`,\n `**Created:** ${this.plan.createdAt.toISOString()}`,\n '',\n '## Summary',\n '',\n this.plan.description,\n '',\n '## Statistics',\n '',\n `| Metric | Value |`,\n `|--------|-------|`,\n `| Total Tasks | ${this.plan.statistics.totalTasks} |`,\n `| Parallelizable | ${this.plan.statistics.parallelizableTasks} |`,\n `| Estimated Hours | ${this.plan.statistics.estimatedHours} |`,\n `| Research Findings | ${this.plan.statistics.researchFindings} |`,\n `| Decisions | ${this.plan.statistics.decisions} |`,\n '',\n ];\n\n // Specification summary\n if (this.plan.specification) {\n lines.push('## Specification');\n lines.push('');\n lines.push(`- **Requirements:** ${this.plan.specification.requirements.length}`);\n lines.push(`- **Features:** ${this.plan.specification.features.length}`);\n lines.push('');\n }\n\n // Architecture summary\n if (this.plan.architecture) {\n lines.push('## Architecture');\n lines.push('');\n lines.push(`- **Components:** ${this.plan.architecture.components.length}`);\n lines.push(`- **Patterns:** ${this.plan.architecture.patterns.join(', ')}`);\n lines.push('');\n }\n\n // Tasks\n lines.push('## Tasks');\n lines.push('');\n for (const task of this.plan.tasks) {\n lines.push(`### ${task.name}`);\n lines.push('');\n lines.push(`- **Phase:** ${task.phase}`);\n lines.push(`- **Type:** ${task.type}`);\n lines.push(`- **Priority:** ${task.priority}`);\n lines.push(`- **Estimated:** ${task.estimatedHours}h`);\n lines.push(`- **Parallelizable:** ${task.parallelizable ? 'Yes' : 'No'}`);\n lines.push('');\n lines.push(task.description);\n lines.push('');\n }\n\n // Review result\n if (this.plan.reviewResult) {\n lines.push('## Review Result');\n lines.push('');\n lines.push(`- **Status:** ${this.plan.reviewResult.overallStatus}`);\n lines.push(`- **Total Findings:** ${this.plan.reviewResult.totalFindings}`);\n lines.push(`- **Critical Findings:** ${this.plan.reviewResult.criticalFindings}`);\n lines.push('');\n\n if (this.plan.reviewResult.recommendations.length > 0) {\n lines.push('### Recommendations');\n lines.push('');\n for (const rec of this.plan.reviewResult.recommendations) {\n lines.push(`- ${rec}`);\n }\n lines.push('');\n }\n }\n\n return lines.join('\\n');\n }\n\n // Helper methods for content generation\n\n private extractProblemStatement(): string {\n return `Problem to solve: ${this.options.description}`;\n }\n\n private extractGoals(): string[] {\n return [\n 'Implement all specified features',\n 'Ensure code quality and maintainability',\n 'Provide comprehensive documentation',\n 'Enable parallel development where possible',\n ];\n }\n\n private generateRequirements(): Requirement[] {\n // Generate basic requirements from description\n return [\n {\n id: 'req-001',\n type: 'functional',\n description: 'Core functionality as described',\n priority: 'must-have',\n source: 'User request',\n acceptanceCriteria: ['Feature works as specified'],\n relatedRequirements: [],\n },\n {\n id: 'req-002',\n type: 'non-functional',\n description: 'Code must be well-documented',\n priority: 'should-have',\n source: 'Best practices',\n acceptanceCriteria: ['API documentation exists'],\n relatedRequirements: [],\n },\n {\n id: 'req-003',\n type: 'non-functional',\n description: 'Test coverage must be adequate',\n priority: 'should-have',\n source: 'Best practices',\n acceptanceCriteria: ['Unit tests exist for core functionality'],\n relatedRequirements: [],\n },\n ];\n }\n\n private generateFeatures(): Feature[] {\n return [\n {\n id: 'feat-001',\n name: 'Core Implementation',\n description: 'Main feature implementation',\n userStories: [`As a user, I want ${this.options.description}`],\n requirements: ['req-001'],\n complexity: 'medium',\n dependencies: [],\n parallelizable: true,\n },\n ];\n }\n\n private extractConstraints(): string[] {\n return [\n 'Must follow existing code patterns if present',\n 'Must maintain backwards compatibility',\n ];\n }\n\n private generateSuccessMetrics(): string[] {\n return [\n 'All tests pass',\n 'Documentation is complete',\n 'Code review approved',\n ];\n }\n\n private generateAlgorithmDesign(feature: Feature): AlgorithmDesign {\n return {\n id: `algo_${feature.id}`,\n name: `${feature.name} Algorithm`,\n purpose: feature.description,\n steps: [\n {\n step: 1,\n description: 'Initialize',\n pseudocode: '// Initialize component',\n inputs: [],\n outputs: [],\n },\n {\n step: 2,\n description: 'Process',\n pseudocode: '// Process input',\n inputs: ['input'],\n outputs: ['result'],\n },\n {\n step: 3,\n description: 'Return',\n pseudocode: '// Return result',\n inputs: ['result'],\n outputs: ['output'],\n },\n ],\n timeComplexity: 'O(n)',\n spaceComplexity: 'O(1)',\n edgeCases: ['Empty input', 'Invalid input'],\n relatedFeatures: [feature.id],\n };\n }\n\n private generateArchitectureOverview(): string {\n return `Architecture for ${this.options.name}: ${this.options.description}`;\n }\n\n private identifyArchitecturePatterns(): string[] {\n const patterns: string[] = ['Modular'];\n\n if (this.plan.existingCode?.patterns.includes('TypeScript')) {\n patterns.push('Type-Safe');\n }\n if (this.plan.existingCode?.patterns.includes('Test-Driven Development')) {\n patterns.push('TDD');\n }\n\n return patterns;\n }\n\n private generateComponents(): ArchitectureComponent[] {\n return [\n {\n id: 'comp-core',\n name: 'Core Module',\n type: 'module',\n description: 'Core functionality module',\n responsibilities: ['Main feature implementation'],\n interfaces: [],\n dependencies: [],\n technologies: ['TypeScript'],\n },\n {\n id: 'comp-api',\n name: 'API Layer',\n type: 'api',\n description: 'Public API interface',\n responsibilities: ['Expose public API'],\n interfaces: [],\n dependencies: ['comp-core'],\n technologies: ['TypeScript'],\n },\n ];\n }\n\n private describeDataFlow(): string {\n return 'Input -> API Layer -> Core Module -> Output';\n }\n\n private identifySecurityConsiderations(): string[] {\n return [\n 'Input validation',\n 'Error handling',\n ];\n }\n\n private getComponentPriority(component: ArchitectureComponent): SPARCTask['priority'] {\n if (component.dependencies.length === 0) return 'high';\n return 'medium';\n }\n\n private estimateComponentHours(component: ArchitectureComponent): number {\n const base = 4;\n const depFactor = component.dependencies.length * 2;\n return base + depFactor;\n }\n\n /**\n * Get the current plan\n */\n getPlan(): SPARCPlan {\n return this.plan;\n }\n\n /**\n * Get decision log manager\n */\n getDecisionLog(): DecisionLogManager {\n return this.decisionLog;\n }\n}\n\n/**\n * Create a SPARC planner\n */\nexport function createSPARCPlanner(options: SPARCPlannerOptions): SPARCPlanner {\n return new SPARCPlanner(options);\n}\n"],"names":[],"mappings":";;;;;;AAiCA,MAAM,SAAS,aAAa,eAAe;AA+CpC,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;AAEA,WAAO;AAAA,EACT;AAAA,EAEQ,qBAA8C;AACpD,WAAO;AAAA,MACL;AAAA,QACE,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,MAAM;AAAA,QACN,aAAa;AAAA,QACb,kBAAkB,CAAC,6BAA6B;AAAA,QAChD,YAAY,CAAA;AAAA,QACZ,cAAc,CAAA;AAAA,QACd,cAAc,CAAC,YAAY;AAAA,MAAA;AAAA,MAE7B;AAAA,QACE,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,MAAM;AAAA,QACN,aAAa;AAAA,QACb,kBAAkB,CAAC,mBAAmB;AAAA,QACtC,YAAY,CAAA;AAAA,QACZ,cAAc,CAAC,WAAW;AAAA,QAC1B,cAAc,CAAC,YAAY;AAAA,MAAA;AAAA,IAC7B;AAAA,EAEJ;AAAA,EAEQ,mBAA2B;AACjC,WAAO;AAAA,EACT;AAAA,EAEQ,iCAA2C;AACjD,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEQ,qBAAqB,WAAyD;AACpF,QAAI,UAAU,aAAa,WAAW,EAAG,QAAO;AAChD,WAAO;AAAA,EACT;AAAA,EAEQ,uBAAuB,WAA0C;AACvE,UAAM,OAAO;AACb,UAAM,YAAY,UAAU,aAAa,SAAS;AAClD,WAAO,OAAO;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,UAAqB;AACnB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,iBAAqC;AACnC,WAAO,KAAK;AAAA,EACd;AACF;AAKO,SAAS,mBAAmB,SAA4C;AAC7E,SAAO,IAAI,aAAa,OAAO;AACjC;"}
1
+ {"version":3,"file":"sparc-planner.js","sources":["../../src/sparc/sparc-planner.ts"],"sourcesContent":["/**\n * SPARC Planner\n *\n * Main orchestrator for creating comprehensive SPARC plans.\n * Reads and analyzes documentation to build real development plans.\n *\n * @module sparc/sparc-planner\n */\n\nimport { existsSync, readdirSync, statSync, readFileSync, writeFileSync, mkdirSync } from 'fs';\nimport { join, dirname, extname, relative, basename } from 'path';\nimport matter from 'gray-matter';\nimport { createLogger } from '../utils/index.js';\nimport { createDecisionLogManager, DecisionLogManager } from './decision-log.js';\nimport { createConsensusBuilder, ConsensusBuilder } from './consensus.js';\nimport { createReviewProcess } from './review-process.js';\nimport type {\n SPARCPlan,\n SPARCPhase,\n SPARCTask,\n SpecificationDocument,\n ArchitectureDocument,\n AlgorithmDesign,\n ExistingCodeAnalysis,\n ResearchFinding,\n Requirement,\n Feature,\n ArchitectureComponent,\n ConfidenceLevel,\n ReviewResult,\n AlgorithmStep,\n} from './types.js';\n\nconst logger = createLogger('sparc-planner');\n\n/**\n * Parsed documentation file\n */\ninterface ParsedDoc {\n path: string;\n filename: string;\n title: string;\n content: string;\n frontmatter: Record<string, unknown>;\n headings: Array<{ level: number; text: string; line: number }>;\n sections: Array<{ heading: string; content: string; level: number }>;\n codeBlocks: Array<{ language: string; code: string }>;\n links: string[];\n type: 'feature' | 'requirement' | 'architecture' | 'api' | 'guide' | 'spec' | 'unknown';\n}\n\n/**\n * Planner options\n */\nexport interface SPARCPlannerOptions {\n /** Project root path */\n projectRoot: string;\n /** Output directory for plan artifacts */\n outputDir?: string;\n /** Plan name */\n name: string;\n /** Plan description */\n description: string;\n /** Docs directory to analyze */\n docsDir?: string;\n /** Enable parallel research */\n parallelResearch?: boolean;\n /** Number of review passes */\n reviewPasses?: number;\n /** Auto-build consensus for low confidence */\n autoConsensus?: boolean;\n /** Knowledge graph integration */\n kgEnabled?: boolean;\n /** Vector database integration */\n vectorEnabled?: boolean;\n}\n\n/**\n * SPARC Planner\n *\n * Orchestrates the full SPARC planning process by reading and analyzing documentation.\n */\nexport class SPARCPlanner {\n private readonly options: Required<SPARCPlannerOptions>;\n private plan: SPARCPlan;\n private decisionLog: DecisionLogManager;\n private consensusBuilder: ConsensusBuilder;\n private parsedDocs: ParsedDoc[] = [];\n\n constructor(options: SPARCPlannerOptions) {\n this.options = {\n outputDir: join(options.projectRoot, '.sparc'),\n docsDir: 'docs',\n parallelResearch: true,\n reviewPasses: 3,\n autoConsensus: true,\n kgEnabled: true,\n vectorEnabled: true,\n ...options,\n };\n\n // Initialize plan\n this.plan = this.initializePlan();\n\n // Initialize decision log\n this.decisionLog = createDecisionLogManager({\n outputDir: this.options.outputDir,\n planId: this.plan.id,\n });\n\n // Initialize consensus builder\n this.consensusBuilder = createConsensusBuilder({\n defaultThreshold: 0.67,\n method: 'majority',\n });\n\n logger.info('SPARC Planner initialized', {\n planId: this.plan.id,\n projectRoot: this.options.projectRoot,\n docsDir: this.options.docsDir,\n });\n }\n\n /**\n * Initialize a new plan\n */\n private initializePlan(): SPARCPlan {\n const now = new Date();\n const id = `plan_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;\n\n return {\n id,\n name: this.options.name,\n description: this.options.description,\n status: 'draft',\n currentPhase: 'specification',\n projectRoot: this.options.projectRoot,\n outputDir: this.options.outputDir,\n tasks: [],\n parallelGroups: [],\n criticalPath: [],\n executionOrder: [],\n researchFindings: [],\n decisionLog: {\n id: `dlog_${id}`,\n planId: id,\n decisions: [],\n statistics: {\n total: 0,\n approved: 0,\n rejected: 0,\n deferred: 0,\n highConfidence: 0,\n lowConfidence: 0,\n consensusRequired: 0,\n },\n createdAt: now,\n updatedAt: now,\n },\n createdAt: now,\n updatedAt: now,\n version: '1.0.0',\n author: 'sparc-planner',\n statistics: {\n totalTasks: 0,\n completedTasks: 0,\n parallelizableTasks: 0,\n estimatedHours: 0,\n researchFindings: 0,\n decisions: 0,\n kgNodes: 0,\n },\n };\n }\n\n /**\n * Execute the full planning process\n */\n async executePlanning(): Promise<SPARCPlan> {\n logger.info('Starting SPARC planning process', { planId: this.plan.id });\n\n try {\n // Phase 1: Read and analyze documentation\n this.plan.status = 'researching';\n await this.executeResearchPhase();\n\n // Phase 2: Build specification from docs\n this.plan.status = 'planning';\n await this.executeSpecificationPhase();\n await this.executePseudocodePhase();\n await this.executeArchitecturePhase();\n\n // Phase 3: Generate tasks from documentation\n await this.executeRefinementPhase();\n\n // Phase 4: Review\n this.plan.status = 'reviewing';\n const reviewResult = await this.executeReviewPhase();\n this.plan.reviewResult = reviewResult;\n\n // Finalize\n if (reviewResult.overallStatus === 'approved') {\n this.plan.status = 'approved';\n } else if (reviewResult.overallStatus === 'rejected') {\n this.plan.status = 'failed';\n } else {\n this.plan.status = 'planning';\n }\n\n // Update statistics\n this.updateStatistics();\n\n // Save plan\n this.savePlan();\n\n logger.info('SPARC planning completed', {\n planId: this.plan.id,\n status: this.plan.status,\n tasks: this.plan.tasks.length,\n docsAnalyzed: this.parsedDocs.length,\n });\n\n return this.plan;\n } catch (error) {\n this.plan.status = 'failed';\n logger.error('SPARC planning failed', error instanceof Error ? error : new Error(String(error)));\n throw error;\n }\n }\n\n /**\n * Execute research phase - read and parse all documentation\n */\n private async executeResearchPhase(): Promise<void> {\n logger.info('Executing research phase');\n this.plan.currentPhase = 'specification';\n\n // Read docs directory\n const docsPath = join(this.options.projectRoot, this.options.docsDir);\n if (existsSync(docsPath)) {\n this.parsedDocs = await this.readDocsDirectory(docsPath);\n\n // Create research findings from docs\n for (const doc of this.parsedDocs) {\n const finding = this.createFindingFromDoc(doc);\n this.plan.researchFindings.push(finding);\n }\n\n this.addDecision(\n 'Documentation Analysis',\n `Analyzed ${this.parsedDocs.length} documentation files from ${this.options.docsDir}/`,\n 'specification',\n 'high',\n `Found ${this.parsedDocs.filter(d => d.type === 'feature').length} feature docs, ` +\n `${this.parsedDocs.filter(d => d.type === 'requirement').length} requirement docs, ` +\n `${this.parsedDocs.filter(d => d.type === 'architecture').length} architecture docs`\n );\n } else {\n logger.warn('No docs directory found', { docsPath });\n }\n\n // Analyze existing code if present\n const srcPath = join(this.options.projectRoot, 'src');\n if (existsSync(srcPath)) {\n this.plan.existingCode = await this.analyzeExistingCode(srcPath);\n this.addDecision(\n 'Existing Code Integration',\n `Found ${this.plan.existingCode.fileCount} files in src/`,\n 'specification',\n 'high',\n `Languages: ${Object.entries(this.plan.existingCode.languages).map(([k, v]) => `${k}: ${v}`).join(', ')}`\n );\n }\n\n logger.info('Research phase completed', {\n docsAnalyzed: this.parsedDocs.length,\n findings: this.plan.researchFindings.length,\n hasExistingCode: !!this.plan.existingCode,\n });\n }\n\n /**\n * Read all documentation files from a directory\n */\n private async readDocsDirectory(docsPath: string): Promise<ParsedDoc[]> {\n const docs: ParsedDoc[] = [];\n\n const readDir = (dir: string) => {\n const entries = readdirSync(dir);\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n const stat = statSync(fullPath);\n\n if (stat.isDirectory()) {\n if (!entry.startsWith('.') && entry !== 'node_modules') {\n readDir(fullPath);\n }\n } else if (stat.isFile() && (entry.endsWith('.md') || entry.endsWith('.mdx'))) {\n try {\n const doc = this.parseDocFile(fullPath);\n docs.push(doc);\n } catch (error) {\n logger.warn('Failed to parse doc file', { path: fullPath, error });\n }\n }\n }\n };\n\n readDir(docsPath);\n return docs;\n }\n\n /**\n * Parse a markdown documentation file\n */\n private parseDocFile(filePath: string): ParsedDoc {\n const content = readFileSync(filePath, 'utf-8');\n const { data: frontmatter, content: body } = matter(content);\n\n const filename = basename(filePath);\n const headings = this.extractHeadings(body);\n const sections = this.extractSections(body, headings);\n const codeBlocks = this.extractCodeBlocks(body);\n const links = this.extractLinks(body);\n\n // Determine title from frontmatter or first heading\n let title = frontmatter.title as string || '';\n if (!title && headings.length > 0) {\n title = headings[0].text;\n }\n if (!title) {\n title = filename.replace(/\\.(md|mdx)$/, '');\n }\n\n // Classify document type\n const type = this.classifyDocument(filePath, frontmatter, title, body);\n\n return {\n path: filePath,\n filename,\n title,\n content: body,\n frontmatter,\n headings,\n sections,\n codeBlocks,\n links,\n type,\n };\n }\n\n /**\n * Extract headings from markdown content\n */\n private extractHeadings(content: string): Array<{ level: number; text: string; line: number }> {\n const headings: Array<{ level: number; text: string; line: number }> = [];\n const lines = content.split('\\n');\n\n lines.forEach((line, index) => {\n const match = line.match(/^(#{1,6})\\s+(.+)$/);\n if (match) {\n headings.push({\n level: match[1].length,\n text: match[2].trim(),\n line: index + 1,\n });\n }\n });\n\n return headings;\n }\n\n /**\n * Extract sections from markdown content based on headings\n */\n private extractSections(content: string, headings: Array<{ level: number; text: string; line: number }>): Array<{ heading: string; content: string; level: number }> {\n const sections: Array<{ heading: string; content: string; level: number }> = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < headings.length; i++) {\n const heading = headings[i];\n const nextHeading = headings[i + 1];\n const startLine = heading.line;\n const endLine = nextHeading ? nextHeading.line - 1 : lines.length;\n\n const sectionContent = lines.slice(startLine, endLine).join('\\n').trim();\n\n sections.push({\n heading: heading.text,\n content: sectionContent,\n level: heading.level,\n });\n }\n\n return sections;\n }\n\n /**\n * Extract code blocks from markdown\n */\n private extractCodeBlocks(content: string): Array<{ language: string; code: string }> {\n const blocks: Array<{ language: string; code: string }> = [];\n const regex = /```(\\w*)\\n([\\s\\S]*?)```/g;\n let match;\n\n while ((match = regex.exec(content)) !== null) {\n blocks.push({\n language: match[1] || 'text',\n code: match[2].trim(),\n });\n }\n\n return blocks;\n }\n\n /**\n * Extract links from markdown\n */\n private extractLinks(content: string): string[] {\n const links: string[] = [];\n const regex = /\\[([^\\]]+)\\]\\(([^)]+)\\)/g;\n let match;\n\n while ((match = regex.exec(content)) !== null) {\n links.push(match[2]);\n }\n\n return links;\n }\n\n /**\n * Classify document type based on content and path\n */\n private classifyDocument(\n filePath: string,\n frontmatter: Record<string, unknown>,\n title: string,\n content: string\n ): ParsedDoc['type'] {\n const lowerPath = filePath.toLowerCase();\n const lowerTitle = title.toLowerCase();\n const lowerContent = content.toLowerCase();\n\n // Check frontmatter type\n if (frontmatter.type) {\n const type = String(frontmatter.type).toLowerCase();\n if (type.includes('feature')) return 'feature';\n if (type.includes('require')) return 'requirement';\n if (type.includes('arch')) return 'architecture';\n if (type.includes('api')) return 'api';\n if (type.includes('spec')) return 'spec';\n if (type.includes('guide')) return 'guide';\n }\n\n // Check path patterns\n if (lowerPath.includes('/features/') || lowerPath.includes('/feature/')) return 'feature';\n if (lowerPath.includes('/requirements/') || lowerPath.includes('/req/')) return 'requirement';\n if (lowerPath.includes('/architecture/') || lowerPath.includes('/arch/')) return 'architecture';\n if (lowerPath.includes('/api/') || lowerPath.includes('/apis/')) return 'api';\n if (lowerPath.includes('/spec/') || lowerPath.includes('/specs/')) return 'spec';\n if (lowerPath.includes('/guide/') || lowerPath.includes('/guides/')) return 'guide';\n\n // Check title patterns\n if (lowerTitle.includes('feature') || lowerTitle.includes('epic')) return 'feature';\n if (lowerTitle.includes('requirement') || lowerTitle.includes('req-')) return 'requirement';\n if (lowerTitle.includes('architecture') || lowerTitle.includes('design')) return 'architecture';\n if (lowerTitle.includes('api') || lowerTitle.includes('endpoint')) return 'api';\n if (lowerTitle.includes('spec')) return 'spec';\n\n // Check content patterns\n const featureKeywords = ['user story', 'as a user', 'acceptance criteria', 'feature:', 'epic:'];\n const reqKeywords = ['shall', 'must', 'requirement', 'req-', 'functional requirement', 'non-functional'];\n const archKeywords = ['component', 'module', 'service', 'architecture', 'system design', 'data flow'];\n const apiKeywords = ['endpoint', 'request', 'response', 'http', 'rest', 'graphql', 'method:'];\n\n if (featureKeywords.some(kw => lowerContent.includes(kw))) return 'feature';\n if (reqKeywords.some(kw => lowerContent.includes(kw))) return 'requirement';\n if (archKeywords.some(kw => lowerContent.includes(kw))) return 'architecture';\n if (apiKeywords.some(kw => lowerContent.includes(kw))) return 'api';\n\n return 'unknown';\n }\n\n /**\n * Create a research finding from a parsed document\n */\n private createFindingFromDoc(doc: ParsedDoc): ResearchFinding {\n return {\n id: `finding_${doc.filename.replace(/[^a-z0-9]/gi, '_')}`,\n agent: 'doc-analyzer',\n topic: doc.type,\n summary: doc.title,\n details: this.summarizeDocContent(doc),\n confidence: doc.frontmatter.status === 'approved' ? 'high' : 'medium',\n evidence: [doc.path],\n relatedFindings: [],\n kgReferences: [],\n vectorResults: [],\n timestamp: new Date(),\n };\n }\n\n /**\n * Summarize document content\n */\n private summarizeDocContent(doc: ParsedDoc): string {\n const lines: string[] = [];\n lines.push(`**Document Type:** ${doc.type}`);\n lines.push(`**File:** ${relative(this.options.projectRoot, doc.path)}`);\n\n if (doc.headings.length > 0) {\n lines.push(`**Sections:** ${doc.headings.map(h => h.text).join(', ')}`);\n }\n\n if (doc.codeBlocks.length > 0) {\n lines.push(`**Code Examples:** ${doc.codeBlocks.length} blocks (${[...new Set(doc.codeBlocks.map(b => b.language))].join(', ')})`);\n }\n\n // Include first 500 chars of content\n const contentPreview = doc.content.substring(0, 500).replace(/\\n/g, ' ').trim();\n if (contentPreview) {\n lines.push(`**Preview:** ${contentPreview}...`);\n }\n\n return lines.join('\\n');\n }\n\n /**\n * Execute specification phase - extract requirements and features from docs\n */\n private async executeSpecificationPhase(): Promise<void> {\n logger.info('Executing specification phase');\n this.plan.currentPhase = 'specification';\n\n const requirements = this.extractRequirementsFromDocs();\n const features = this.extractFeaturesFromDocs();\n\n const spec: SpecificationDocument = {\n id: `spec_${this.plan.id}`,\n projectName: this.options.name,\n version: '1.0.0',\n createdAt: new Date(),\n updatedAt: new Date(),\n summary: this.options.description,\n problemStatement: this.extractProblemStatement(),\n goals: this.extractGoals(),\n requirements,\n features,\n constraints: this.extractConstraints(),\n assumptions: this.extractAssumptions(),\n outOfScope: [],\n successMetrics: this.extractSuccessMetrics(),\n kgReferences: [],\n };\n\n this.plan.specification = spec;\n\n this.addDecision(\n 'Requirements Extracted',\n `Extracted ${requirements.length} requirements and ${features.length} features from documentation`,\n 'specification',\n requirements.length > 0 ? 'high' : 'low',\n `Sources: ${this.parsedDocs.filter(d => d.type === 'requirement' || d.type === 'feature').map(d => d.filename).join(', ')}`\n );\n\n logger.info('Specification phase completed', {\n requirements: requirements.length,\n features: features.length,\n });\n }\n\n /**\n * Extract requirements from documentation\n */\n private extractRequirementsFromDocs(): Requirement[] {\n const requirements: Requirement[] = [];\n let reqCounter = 1;\n\n // Find requirement docs\n const reqDocs = this.parsedDocs.filter(d => d.type === 'requirement' || d.type === 'spec');\n\n for (const doc of reqDocs) {\n // Check for explicit requirements in sections\n for (const section of doc.sections) {\n const lowerHeading = section.heading.toLowerCase();\n\n // Requirements sections\n if (lowerHeading.includes('requirement') || lowerHeading.includes('shall') || lowerHeading.includes('must')) {\n requirements.push(this.createRequirement(\n `REQ-${String(reqCounter++).padStart(3, '0')}`,\n section.heading,\n section.content,\n 'functional',\n doc.path\n ));\n }\n\n // Non-functional requirements\n if (lowerHeading.includes('non-functional') || lowerHeading.includes('performance') ||\n lowerHeading.includes('security') || lowerHeading.includes('scalability')) {\n requirements.push(this.createRequirement(\n `NFR-${String(reqCounter++).padStart(3, '0')}`,\n section.heading,\n section.content,\n 'non-functional',\n doc.path\n ));\n }\n }\n\n // Parse bullet points that look like requirements\n const bulletReqs = this.extractBulletRequirements(doc.content);\n for (const req of bulletReqs) {\n requirements.push(this.createRequirement(\n `REQ-${String(reqCounter++).padStart(3, '0')}`,\n req.title,\n req.description,\n 'functional',\n doc.path\n ));\n }\n }\n\n // Also check feature docs for requirements\n const featureDocs = this.parsedDocs.filter(d => d.type === 'feature');\n for (const doc of featureDocs) {\n for (const section of doc.sections) {\n if (section.heading.toLowerCase().includes('requirement') ||\n section.heading.toLowerCase().includes('acceptance')) {\n requirements.push(this.createRequirement(\n `REQ-${String(reqCounter++).padStart(3, '0')}`,\n `${doc.title}: ${section.heading}`,\n section.content,\n 'functional',\n doc.path\n ));\n }\n }\n }\n\n return requirements;\n }\n\n /**\n * Extract bullet point requirements from content\n */\n private extractBulletRequirements(content: string): Array<{ title: string; description: string }> {\n const reqs: Array<{ title: string; description: string }> = [];\n const lines = content.split('\\n');\n\n for (const line of lines) {\n // Look for bullet points with \"shall\", \"must\", \"should\"\n const match = line.match(/^[-*]\\s+(.+(?:shall|must|should).+)$/i);\n if (match) {\n const text = match[1].trim();\n reqs.push({\n title: text.substring(0, 60) + (text.length > 60 ? '...' : ''),\n description: text,\n });\n }\n }\n\n return reqs;\n }\n\n /**\n * Create a requirement object\n */\n private createRequirement(\n id: string,\n title: string,\n description: string,\n type: Requirement['type'],\n source: string\n ): Requirement {\n // Extract acceptance criteria from description\n const criteria = this.extractAcceptanceCriteria(description);\n\n return {\n id,\n type,\n description: description.substring(0, 500),\n priority: this.inferPriority(description),\n source: relative(this.options.projectRoot, source),\n acceptanceCriteria: criteria.length > 0 ? criteria : [`${title} is implemented and working`],\n relatedRequirements: [],\n };\n }\n\n /**\n * Extract acceptance criteria from text\n */\n private extractAcceptanceCriteria(text: string): string[] {\n const criteria: string[] = [];\n const lines = text.split('\\n');\n\n let inCriteriaSection = false;\n for (const line of lines) {\n const lowerLine = line.toLowerCase();\n\n if (lowerLine.includes('acceptance criteria') || lowerLine.includes('criteria:')) {\n inCriteriaSection = true;\n continue;\n }\n\n if (inCriteriaSection) {\n const match = line.match(/^[-*]\\s+(.+)$/);\n if (match) {\n criteria.push(match[1].trim());\n } else if (line.match(/^#{1,6}\\s/)) {\n inCriteriaSection = false;\n }\n }\n\n // Also look for \"Given/When/Then\" patterns\n if (line.match(/^\\s*(Given|When|Then)\\s+/i)) {\n criteria.push(line.trim());\n }\n }\n\n return criteria.slice(0, 10); // Limit to 10 criteria\n }\n\n /**\n * Infer priority from text\n */\n private inferPriority(text: string): Requirement['priority'] {\n const lower = text.toLowerCase();\n if (lower.includes('critical') || lower.includes('must have') || lower.includes('p0')) {\n return 'must-have';\n }\n if (lower.includes('high priority') || lower.includes('should have') || lower.includes('p1')) {\n return 'should-have';\n }\n if (lower.includes('nice to have') || lower.includes('could have') || lower.includes('p2')) {\n return 'could-have';\n }\n if (lower.includes('future') || lower.includes('won\\'t') || lower.includes('p3')) {\n return 'won-t-have';\n }\n return 'should-have';\n }\n\n /**\n * Extract features from documentation\n */\n private extractFeaturesFromDocs(): Feature[] {\n const features: Feature[] = [];\n let featCounter = 1;\n\n // Feature docs become features\n const featureDocs = this.parsedDocs.filter(d => d.type === 'feature');\n for (const doc of featureDocs) {\n features.push(this.createFeatureFromDoc(doc, `FEAT-${String(featCounter++).padStart(3, '0')}`));\n }\n\n // Also extract features from spec docs\n const specDocs = this.parsedDocs.filter(d => d.type === 'spec' || d.type === 'unknown');\n for (const doc of specDocs) {\n for (const section of doc.sections) {\n const lowerHeading = section.heading.toLowerCase();\n if (lowerHeading.includes('feature') || lowerHeading.includes('capability') ||\n lowerHeading.includes('functionality')) {\n features.push({\n id: `FEAT-${String(featCounter++).padStart(3, '0')}`,\n name: section.heading,\n description: section.content.substring(0, 500),\n userStories: this.extractUserStories(section.content),\n requirements: [],\n complexity: this.inferComplexity(section.content),\n dependencies: [],\n parallelizable: true,\n });\n }\n }\n }\n\n // If no features found, create features from major sections in all docs\n if (features.length === 0) {\n for (const doc of this.parsedDocs) {\n if (doc.headings.length > 0) {\n for (const heading of doc.headings.filter(h => h.level <= 2)) {\n const section = doc.sections.find(s => s.heading === heading.text);\n if (section && section.content.length > 100) {\n features.push({\n id: `FEAT-${String(featCounter++).padStart(3, '0')}`,\n name: heading.text,\n description: section.content.substring(0, 500),\n userStories: this.extractUserStories(section.content),\n requirements: [],\n complexity: this.inferComplexity(section.content),\n dependencies: [],\n parallelizable: true,\n });\n }\n }\n }\n }\n }\n\n return features;\n }\n\n /**\n * Create a feature from a document\n */\n private createFeatureFromDoc(doc: ParsedDoc, id: string): Feature {\n return {\n id,\n name: doc.title,\n description: doc.content.substring(0, 1000),\n userStories: this.extractUserStories(doc.content),\n requirements: [],\n complexity: this.inferComplexity(doc.content),\n dependencies: this.extractDependencies(doc),\n parallelizable: true,\n };\n }\n\n /**\n * Extract user stories from text\n */\n private extractUserStories(text: string): string[] {\n const stories: string[] = [];\n\n // Look for \"As a... I want... So that...\" patterns\n const regex = /As a[n]?\\s+([^,]+),?\\s+I want\\s+([^,]+),?\\s+(?:so that|because)\\s+([^.]+)/gi;\n let match;\n while ((match = regex.exec(text)) !== null) {\n stories.push(match[0]);\n }\n\n // Also look for simpler patterns\n const lines = text.split('\\n');\n for (const line of lines) {\n if (line.toLowerCase().includes('user story') || line.match(/^[-*]\\s+As a/i)) {\n stories.push(line.replace(/^[-*]\\s+/, '').trim());\n }\n }\n\n return stories.slice(0, 5); // Limit to 5 stories\n }\n\n /**\n * Infer complexity from content\n */\n private inferComplexity(text: string): Feature['complexity'] {\n const lower = text.toLowerCase();\n const codeBlocks = (text.match(/```/g) || []).length / 2;\n const wordCount = text.split(/\\s+/).length;\n\n if (lower.includes('complex') || lower.includes('difficult') || codeBlocks > 5 || wordCount > 1000) {\n return 'very-high';\n }\n if (lower.includes('moderate') || codeBlocks > 3 || wordCount > 500) {\n return 'high';\n }\n if (lower.includes('simple') || lower.includes('basic') || wordCount < 200) {\n return 'low';\n }\n return 'medium';\n }\n\n /**\n * Extract dependencies from document links\n */\n private extractDependencies(doc: ParsedDoc): string[] {\n const deps: string[] = [];\n\n for (const link of doc.links) {\n if (link.startsWith('./') || link.startsWith('../') || !link.startsWith('http')) {\n // Internal link - might be a dependency\n const linkedDoc = this.parsedDocs.find(d => d.path.includes(link.replace('.md', '')));\n if (linkedDoc && linkedDoc.type === 'feature') {\n deps.push(linkedDoc.title);\n }\n }\n }\n\n return deps;\n }\n\n /**\n * Extract problem statement from docs\n */\n private extractProblemStatement(): string {\n // Look for problem statement in docs\n for (const doc of this.parsedDocs) {\n for (const section of doc.sections) {\n const lower = section.heading.toLowerCase();\n if (lower.includes('problem') || lower.includes('overview') || lower.includes('background')) {\n return section.content.substring(0, 1000);\n }\n }\n }\n return `Building: ${this.options.description}`;\n }\n\n /**\n * Extract goals from docs\n */\n private extractGoals(): string[] {\n const goals: string[] = [];\n\n for (const doc of this.parsedDocs) {\n for (const section of doc.sections) {\n const lower = section.heading.toLowerCase();\n if (lower.includes('goal') || lower.includes('objective') || lower.includes('outcome')) {\n // Extract bullet points\n const bullets = section.content.match(/^[-*]\\s+(.+)$/gm);\n if (bullets) {\n goals.push(...bullets.map(b => b.replace(/^[-*]\\s+/, '').trim()));\n }\n }\n }\n }\n\n return goals.length > 0 ? goals.slice(0, 10) : ['Complete implementation as documented'];\n }\n\n /**\n * Extract constraints from docs\n */\n private extractConstraints(): string[] {\n const constraints: string[] = [];\n\n for (const doc of this.parsedDocs) {\n for (const section of doc.sections) {\n const lower = section.heading.toLowerCase();\n if (lower.includes('constraint') || lower.includes('limitation') || lower.includes('restriction')) {\n const bullets = section.content.match(/^[-*]\\s+(.+)$/gm);\n if (bullets) {\n constraints.push(...bullets.map(b => b.replace(/^[-*]\\s+/, '').trim()));\n }\n }\n }\n }\n\n return constraints;\n }\n\n /**\n * Extract assumptions from docs\n */\n private extractAssumptions(): string[] {\n const assumptions: string[] = [];\n\n for (const doc of this.parsedDocs) {\n for (const section of doc.sections) {\n if (section.heading.toLowerCase().includes('assumption')) {\n const bullets = section.content.match(/^[-*]\\s+(.+)$/gm);\n if (bullets) {\n assumptions.push(...bullets.map(b => b.replace(/^[-*]\\s+/, '').trim()));\n }\n }\n }\n }\n\n return assumptions;\n }\n\n /**\n * Extract success metrics from docs\n */\n private extractSuccessMetrics(): string[] {\n const metrics: string[] = [];\n\n for (const doc of this.parsedDocs) {\n for (const section of doc.sections) {\n const lower = section.heading.toLowerCase();\n if (lower.includes('metric') || lower.includes('success') || lower.includes('kpi')) {\n const bullets = section.content.match(/^[-*]\\s+(.+)$/gm);\n if (bullets) {\n metrics.push(...bullets.map(b => b.replace(/^[-*]\\s+/, '').trim()));\n }\n }\n }\n }\n\n return metrics.length > 0 ? metrics : ['All documented features implemented', 'All tests passing'];\n }\n\n /**\n * Execute pseudocode phase\n */\n private async executePseudocodePhase(): Promise<void> {\n logger.info('Executing pseudocode phase');\n this.plan.currentPhase = 'pseudocode';\n\n const algorithms: AlgorithmDesign[] = [];\n\n // Create algorithm designs from API docs and code blocks\n const apiDocs = this.parsedDocs.filter(d => d.type === 'api');\n for (const doc of apiDocs) {\n algorithms.push(this.createAlgorithmFromDoc(doc));\n }\n\n // Also create from features with code examples\n for (const feature of this.plan.specification?.features || []) {\n const featureDoc = this.parsedDocs.find(d => d.title === feature.name);\n if (featureDoc && featureDoc.codeBlocks.length > 0) {\n algorithms.push(this.createAlgorithmFromDoc(featureDoc));\n }\n }\n\n this.plan.algorithms = algorithms;\n\n logger.info('Pseudocode phase completed', { algorithms: algorithms.length });\n }\n\n /**\n * Create algorithm design from document\n */\n private createAlgorithmFromDoc(doc: ParsedDoc): AlgorithmDesign {\n const steps: AlgorithmStep[] = [];\n let stepNum = 1;\n\n // Extract steps from sections\n for (const section of doc.sections) {\n if (section.level >= 2) {\n // Try to find a code block that might be in or near this section's content\n const relevantCodeBlock = doc.codeBlocks.find(block =>\n section.content.includes(block.code.substring(0, 50))\n );\n\n steps.push({\n step: stepNum++,\n description: section.heading,\n pseudocode: relevantCodeBlock?.code ?? `// Implement ${section.heading}`,\n inputs: [],\n outputs: [],\n });\n }\n }\n\n // Add code blocks as steps if no sections\n if (steps.length === 0 && doc.codeBlocks.length > 0) {\n for (const block of doc.codeBlocks) {\n steps.push({\n step: stepNum++,\n description: `${block.language} implementation`,\n pseudocode: block.code,\n inputs: [],\n outputs: [],\n });\n }\n }\n\n return {\n id: `algo_${doc.filename.replace(/[^a-z0-9]/gi, '_')}`,\n name: doc.title,\n purpose: doc.content.substring(0, 200),\n steps: steps.length > 0 ? steps : [{\n step: 1,\n description: 'Implement feature',\n pseudocode: '// Implementation needed',\n inputs: [],\n outputs: [],\n }],\n timeComplexity: 'O(n)',\n spaceComplexity: 'O(1)',\n edgeCases: [],\n relatedFeatures: [],\n };\n }\n\n /**\n * Execute architecture phase\n */\n private async executeArchitecturePhase(): Promise<void> {\n logger.info('Executing architecture phase');\n this.plan.currentPhase = 'architecture';\n\n const components = this.extractComponentsFromDocs();\n const patterns = this.extractPatternsFromDocs();\n\n const arch: ArchitectureDocument = {\n id: `arch_${this.plan.id}`,\n version: '1.0.0',\n createdAt: new Date(),\n overview: this.extractArchitectureOverview(),\n patterns,\n components,\n decisions: [],\n dataFlow: this.extractDataFlow(),\n securityConsiderations: this.extractSecurityConsiderations(),\n scalabilityConsiderations: [],\n diagrams: [],\n };\n\n this.plan.architecture = arch;\n\n this.addDecision(\n 'Architecture Defined',\n `Identified ${components.length} components with patterns: ${patterns.join(', ')}`,\n 'architecture',\n components.length > 0 ? 'medium' : 'low',\n `Based on analysis of ${this.parsedDocs.filter(d => d.type === 'architecture').length} architecture docs`\n );\n\n logger.info('Architecture phase completed', {\n components: components.length,\n patterns: patterns.length,\n });\n }\n\n /**\n * Extract components from documentation\n */\n private extractComponentsFromDocs(): ArchitectureComponent[] {\n const components: ArchitectureComponent[] = [];\n let compCounter = 1;\n\n // Architecture docs define components\n const archDocs = this.parsedDocs.filter(d => d.type === 'architecture');\n for (const doc of archDocs) {\n for (const section of doc.sections) {\n const lower = section.heading.toLowerCase();\n if (lower.includes('component') || lower.includes('module') ||\n lower.includes('service') || lower.includes('layer')) {\n components.push({\n id: `COMP-${String(compCounter++).padStart(3, '0')}`,\n name: section.heading,\n type: this.inferComponentType(section.heading, section.content),\n description: section.content.substring(0, 500),\n responsibilities: this.extractResponsibilities(section.content),\n interfaces: [],\n dependencies: [],\n technologies: this.extractTechnologies(section.content),\n path: doc.path,\n });\n }\n }\n }\n\n // Create components from features if no explicit architecture\n if (components.length === 0) {\n for (const feature of this.plan.specification?.features || []) {\n components.push({\n id: `COMP-${String(compCounter++).padStart(3, '0')}`,\n name: `${feature.name} Module`,\n type: 'module',\n description: feature.description.substring(0, 300),\n responsibilities: [`Implement ${feature.name}`],\n interfaces: [],\n dependencies: feature.dependencies,\n technologies: [],\n });\n }\n }\n\n return components;\n }\n\n /**\n * Infer component type\n */\n private inferComponentType(heading: string, content: string): ArchitectureComponent['type'] {\n const lower = (heading + ' ' + content).toLowerCase();\n if (lower.includes('service') || lower.includes('microservice')) return 'service';\n if (lower.includes('api') || lower.includes('endpoint')) return 'api';\n if (lower.includes('database') || lower.includes('storage') || lower.includes('db')) return 'database';\n if (lower.includes('ui') || lower.includes('frontend') || lower.includes('component')) return 'ui';\n if (lower.includes('library') || lower.includes('util')) return 'library';\n if (lower.includes('infrastructure') || lower.includes('deploy')) return 'infrastructure';\n return 'module';\n }\n\n /**\n * Extract responsibilities from content\n */\n private extractResponsibilities(content: string): string[] {\n const responsibilities: string[] = [];\n const lines = content.split('\\n');\n\n let inResponsibilitySection = false;\n for (const line of lines) {\n const lower = line.toLowerCase();\n if (lower.includes('responsibilit') || lower.includes('function') || lower.includes('purpose')) {\n inResponsibilitySection = true;\n continue;\n }\n\n if (inResponsibilitySection) {\n const match = line.match(/^[-*]\\s+(.+)$/);\n if (match) {\n responsibilities.push(match[1].trim());\n } else if (line.match(/^#{1,6}\\s/)) {\n inResponsibilitySection = false;\n }\n }\n }\n\n return responsibilities.slice(0, 5);\n }\n\n /**\n * Extract technologies mentioned\n */\n private extractTechnologies(content: string): string[] {\n const techs: string[] = [];\n const knownTechs = [\n 'TypeScript', 'JavaScript', 'Python', 'Go', 'Rust', 'Java',\n 'React', 'Vue', 'Angular', 'Node.js', 'Express', 'FastAPI',\n 'PostgreSQL', 'MongoDB', 'Redis', 'SQLite', 'MySQL',\n 'Docker', 'Kubernetes', 'AWS', 'GCP', 'Azure',\n 'GraphQL', 'REST', 'gRPC', 'WebSocket',\n ];\n\n for (const tech of knownTechs) {\n if (content.toLowerCase().includes(tech.toLowerCase())) {\n techs.push(tech);\n }\n }\n\n return techs;\n }\n\n /**\n * Extract patterns from documentation\n */\n private extractPatternsFromDocs(): string[] {\n const patterns: string[] = [];\n const knownPatterns = [\n 'MVC', 'MVVM', 'MVP', 'Microservices', 'Monolith', 'Serverless',\n 'Event-Driven', 'CQRS', 'Event Sourcing', 'Domain-Driven Design',\n 'Repository Pattern', 'Factory Pattern', 'Singleton', 'Observer',\n 'Clean Architecture', 'Hexagonal', 'Layered', 'Modular',\n ];\n\n const allContent = this.parsedDocs.map(d => d.content).join(' ').toLowerCase();\n for (const pattern of knownPatterns) {\n if (allContent.includes(pattern.toLowerCase())) {\n patterns.push(pattern);\n }\n }\n\n return patterns.length > 0 ? patterns : ['Modular'];\n }\n\n /**\n * Extract architecture overview\n */\n private extractArchitectureOverview(): string {\n const archDocs = this.parsedDocs.filter(d => d.type === 'architecture');\n if (archDocs.length > 0) {\n return archDocs[0].content.substring(0, 1000);\n }\n\n return `Architecture for ${this.options.name}: ${this.options.description}`;\n }\n\n /**\n * Extract data flow description\n */\n private extractDataFlow(): string {\n for (const doc of this.parsedDocs) {\n for (const section of doc.sections) {\n if (section.heading.toLowerCase().includes('data flow') ||\n section.heading.toLowerCase().includes('flow')) {\n return section.content;\n }\n }\n }\n return 'Data flow documentation not found';\n }\n\n /**\n * Extract security considerations\n */\n private extractSecurityConsiderations(): string[] {\n const considerations: string[] = [];\n\n for (const doc of this.parsedDocs) {\n for (const section of doc.sections) {\n if (section.heading.toLowerCase().includes('security')) {\n const bullets = section.content.match(/^[-*]\\s+(.+)$/gm);\n if (bullets) {\n considerations.push(...bullets.map(b => b.replace(/^[-*]\\s+/, '').trim()));\n }\n }\n }\n }\n\n return considerations;\n }\n\n /**\n * Execute refinement phase - generate development tasks\n */\n private async executeRefinementPhase(): Promise<void> {\n logger.info('Executing refinement phase');\n this.plan.currentPhase = 'refinement';\n\n const tasks: SPARCTask[] = [];\n\n // Research/analysis task\n tasks.push(this.createTask(\n 'Documentation Analysis Complete',\n `Analyze all ${this.parsedDocs.length} documentation files`,\n 'specification',\n 'research',\n 'high',\n 2,\n true\n ));\n\n // Create tasks for each feature\n for (const feature of this.plan.specification?.features || []) {\n // Design task\n tasks.push(this.createTask(\n `Design: ${feature.name}`,\n `Design the implementation approach for ${feature.name}: ${feature.description.substring(0, 200)}`,\n 'pseudocode',\n 'design',\n this.mapComplexityToPriority(feature.complexity),\n this.estimateDesignHours(feature.complexity),\n true\n ));\n\n // Implementation task\n tasks.push(this.createTask(\n `Implement: ${feature.name}`,\n `Implement ${feature.name}\\n\\nUser Stories:\\n${feature.userStories.map(s => `- ${s}`).join('\\n')}`,\n 'refinement',\n 'implementation',\n this.mapComplexityToPriority(feature.complexity),\n this.estimateImplementationHours(feature.complexity),\n true\n ));\n\n // Testing task for the feature\n tasks.push(this.createTask(\n `Test: ${feature.name}`,\n `Create tests for ${feature.name}`,\n 'refinement',\n 'testing',\n 'medium',\n this.estimateTestHours(feature.complexity),\n true\n ));\n }\n\n // Create tasks for each component\n for (const component of this.plan.architecture?.components || []) {\n if (!tasks.find(t => t.name.includes(component.name))) {\n tasks.push(this.createTask(\n `Build: ${component.name}`,\n `Implement the ${component.name} component\\n\\nResponsibilities:\\n${component.responsibilities.map(r => `- ${r}`).join('\\n')}`,\n 'refinement',\n 'implementation',\n 'medium',\n 4,\n true\n ));\n }\n }\n\n // Create tasks from requirements\n for (const req of this.plan.specification?.requirements || []) {\n if (!tasks.find(t => t.description.includes(req.description.substring(0, 50)))) {\n tasks.push(this.createTask(\n `Requirement: ${req.id}`,\n req.description,\n 'refinement',\n 'implementation',\n this.mapPriorityToTaskPriority(req.priority),\n 2,\n true\n ));\n }\n }\n\n // Integration testing\n tasks.push(this.createTask(\n 'Integration Testing',\n `Create integration tests for all ${(this.plan.specification?.features || []).length} features`,\n 'refinement',\n 'testing',\n 'high',\n 8,\n false\n ));\n\n // Documentation task\n tasks.push(this.createTask(\n 'API Documentation',\n 'Document all public APIs and interfaces',\n 'completion',\n 'documentation',\n 'medium',\n 4,\n true\n ));\n\n // Final review\n tasks.push(this.createTask(\n 'Final Review',\n 'Review all implementations against requirements and documentation',\n 'completion',\n 'review',\n 'high',\n 4,\n false\n ));\n\n this.plan.tasks = tasks;\n\n // Calculate parallel groups and critical path\n this.calculateParallelGroups();\n this.calculateCriticalPath();\n\n logger.info('Refinement phase completed', {\n tasks: tasks.length,\n parallelGroups: this.plan.parallelGroups.length,\n });\n }\n\n /**\n * Create a SPARC task\n */\n private createTask(\n name: string,\n description: string,\n phase: SPARCPhase,\n type: SPARCTask['type'],\n priority: SPARCTask['priority'],\n estimatedHours: number,\n parallelizable: boolean\n ): SPARCTask {\n return {\n id: `task_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,\n name,\n description,\n phase,\n type,\n priority,\n estimatedHours,\n dependencies: [],\n parallelizable,\n status: 'pending',\n contextLinks: [],\n kgReferences: [],\n };\n }\n\n /**\n * Map complexity to priority\n */\n private mapComplexityToPriority(complexity: Feature['complexity']): SPARCTask['priority'] {\n switch (complexity) {\n case 'very-high': return 'critical';\n case 'high': return 'high';\n case 'medium': return 'medium';\n case 'low': return 'low';\n default: return 'medium';\n }\n }\n\n /**\n * Map requirement priority to task priority\n */\n private mapPriorityToTaskPriority(priority: Requirement['priority']): SPARCTask['priority'] {\n switch (priority) {\n case 'must-have': return 'critical';\n case 'should-have': return 'high';\n case 'could-have': return 'medium';\n case 'won-t-have': return 'low';\n default: return 'medium';\n }\n }\n\n /**\n * Estimate design hours based on complexity\n */\n private estimateDesignHours(complexity: Feature['complexity']): number {\n switch (complexity) {\n case 'very-high': return 8;\n case 'high': return 4;\n case 'medium': return 2;\n case 'low': return 1;\n default: return 2;\n }\n }\n\n /**\n * Estimate implementation hours based on complexity\n */\n private estimateImplementationHours(complexity: Feature['complexity']): number {\n switch (complexity) {\n case 'very-high': return 40;\n case 'high': return 20;\n case 'medium': return 8;\n case 'low': return 4;\n default: return 8;\n }\n }\n\n /**\n * Estimate test hours based on complexity\n */\n private estimateTestHours(complexity: Feature['complexity']): number {\n switch (complexity) {\n case 'very-high': return 16;\n case 'high': return 8;\n case 'medium': return 4;\n case 'low': return 2;\n default: return 4;\n }\n }\n\n /**\n * Calculate parallel task groups\n */\n private calculateParallelGroups(): void {\n const parallelizable = this.plan.tasks.filter(t => t.parallelizable);\n\n const groups: string[][] = [];\n const phases: SPARCPhase[] = ['specification', 'pseudocode', 'architecture', 'refinement', 'completion'];\n\n for (const phase of phases) {\n const phaseTasks = parallelizable.filter(t => t.phase === phase);\n if (phaseTasks.length > 0) {\n groups.push(phaseTasks.map(t => t.id));\n }\n }\n\n this.plan.parallelGroups = groups;\n }\n\n /**\n * Calculate critical path\n */\n private calculateCriticalPath(): void {\n const critical = this.plan.tasks\n .filter(t => t.priority === 'critical' || t.priority === 'high')\n .sort((a, b) => {\n const phaseOrder = ['specification', 'pseudocode', 'architecture', 'refinement', 'completion'];\n return phaseOrder.indexOf(a.phase) - phaseOrder.indexOf(b.phase);\n })\n .map(t => t.id);\n\n this.plan.criticalPath = critical;\n this.plan.executionOrder = this.plan.tasks.map(t => t.id);\n }\n\n /**\n * Analyze existing code in src directory\n */\n private async analyzeExistingCode(srcPath: string): Promise<ExistingCodeAnalysis> {\n const analysis: ExistingCodeAnalysis = {\n hasSrcDirectory: true,\n srcPath,\n fileCount: 0,\n languages: {},\n keyFiles: [],\n patterns: [],\n dependencies: [],\n entryPoints: [],\n };\n\n const analyzeDir = (dir: string) => {\n const entries = readdirSync(dir);\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n const stat = statSync(fullPath);\n\n if (stat.isDirectory()) {\n if (!entry.startsWith('.') && entry !== 'node_modules') {\n analyzeDir(fullPath);\n }\n } else if (stat.isFile()) {\n analysis.fileCount++;\n\n const ext = extname(entry);\n analysis.languages[ext] = (analysis.languages[ext] || 0) + 1;\n\n if (entry === 'index.ts' || entry === 'index.js') {\n analysis.entryPoints.push(relative(this.options.projectRoot, fullPath));\n }\n\n if (entry === 'package.json') {\n try {\n const pkg = JSON.parse(readFileSync(fullPath, 'utf-8'));\n analysis.dependencies = Object.keys(pkg.dependencies || {});\n } catch {\n // Ignore\n }\n }\n }\n }\n };\n\n analyzeDir(srcPath);\n\n if (analysis.languages['.ts'] > 0 || analysis.languages['.tsx'] > 0) {\n analysis.patterns.push('TypeScript');\n }\n if (existsSync(join(this.options.projectRoot, 'tests')) ||\n existsSync(join(this.options.projectRoot, '__tests__'))) {\n analysis.patterns.push('Test-Driven Development');\n analysis.testCoverage = { hasTests: true };\n }\n\n return analysis;\n }\n\n /**\n * Execute review phase\n */\n private async executeReviewPhase(): Promise<ReviewResult> {\n logger.info('Executing review phase');\n this.plan.currentPhase = 'completion';\n\n this.plan.decisionLog = this.decisionLog.getLog();\n\n const reviewProcess = createReviewProcess({\n plan: this.plan,\n passes: this.options.reviewPasses,\n autoFix: false,\n strictMode: false,\n });\n\n const result = await reviewProcess.executeReview();\n\n logger.info('Review phase completed', {\n status: result.overallStatus,\n totalFindings: result.totalFindings,\n criticalFindings: result.criticalFindings,\n });\n\n return result;\n }\n\n /**\n * Add a decision to the log\n */\n private addDecision(\n title: string,\n description: string,\n phase: SPARCPhase,\n confidence: ConfidenceLevel,\n rationale: string,\n alternatives?: string[]\n ): void {\n this.decisionLog.addDecision({\n title,\n description,\n phase,\n confidence,\n rationale,\n alternatives,\n decidedBy: 'sparc-planner',\n });\n\n if (this.options.autoConsensus && ConsensusBuilder.needsConsensus(confidence)) {\n logger.info('Low confidence decision - would trigger consensus', { title, confidence });\n }\n }\n\n /**\n * Update plan statistics\n */\n private updateStatistics(): void {\n this.plan.statistics = {\n totalTasks: this.plan.tasks.length,\n completedTasks: this.plan.tasks.filter(t => t.status === 'completed').length,\n parallelizableTasks: this.plan.tasks.filter(t => t.parallelizable).length,\n estimatedHours: this.plan.tasks.reduce((sum, t) => sum + t.estimatedHours, 0),\n researchFindings: this.plan.researchFindings.length,\n decisions: this.decisionLog.getDecisions().length,\n kgNodes: this.plan.tasks.reduce((sum, t) => sum + (t.kgReferences?.length || 0), 0),\n };\n this.plan.updatedAt = new Date();\n }\n\n /**\n * Save plan to disk\n */\n savePlan(): void {\n const dir = this.options.outputDir;\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n\n const planPath = join(dir, 'sparc-plan.json');\n writeFileSync(planPath, JSON.stringify(this.plan, null, 2));\n\n const mdPath = join(dir, 'sparc-plan.md');\n writeFileSync(mdPath, this.generateMarkdownSummary());\n\n this.decisionLog.save();\n this.decisionLog.saveMarkdown();\n\n logger.info('Plan saved', { dir });\n }\n\n /**\n * Generate markdown summary\n */\n private generateMarkdownSummary(): string {\n const lines: string[] = [\n `# SPARC Plan: ${this.plan.name}`,\n '',\n `**Status:** ${this.plan.status}`,\n `**Version:** ${this.plan.version}`,\n `**Created:** ${this.plan.createdAt.toISOString()}`,\n `**Docs Analyzed:** ${this.parsedDocs.length} files`,\n '',\n '## Summary',\n '',\n this.plan.description,\n '',\n '## Statistics',\n '',\n `| Metric | Value |`,\n `|--------|-------|`,\n `| Total Tasks | ${this.plan.statistics.totalTasks} |`,\n `| Parallelizable | ${this.plan.statistics.parallelizableTasks} |`,\n `| Estimated Hours | ${this.plan.statistics.estimatedHours} |`,\n `| Documentation Files Analyzed | ${this.parsedDocs.length} |`,\n `| Research Findings | ${this.plan.statistics.researchFindings} |`,\n `| Decisions | ${this.plan.statistics.decisions} |`,\n '',\n ];\n\n // Documentation sources\n if (this.parsedDocs.length > 0) {\n lines.push('## Documentation Sources');\n lines.push('');\n const byType = new Map<string, ParsedDoc[]>();\n for (const doc of this.parsedDocs) {\n const existing = byType.get(doc.type) || [];\n existing.push(doc);\n byType.set(doc.type, existing);\n }\n for (const [type, docs] of byType.entries()) {\n lines.push(`### ${type.charAt(0).toUpperCase() + type.slice(1)} Documents (${docs.length})`);\n lines.push('');\n for (const doc of docs) {\n lines.push(`- **${doc.title}** - \\`${relative(this.options.projectRoot, doc.path)}\\``);\n }\n lines.push('');\n }\n }\n\n // Specification summary\n if (this.plan.specification) {\n lines.push('## Specification');\n lines.push('');\n lines.push(`- **Requirements:** ${this.plan.specification.requirements.length}`);\n lines.push(`- **Features:** ${this.plan.specification.features.length}`);\n lines.push('');\n\n if (this.plan.specification.features.length > 0) {\n lines.push('### Features');\n lines.push('');\n for (const feature of this.plan.specification.features) {\n lines.push(`#### ${feature.id}: ${feature.name}`);\n lines.push('');\n lines.push(feature.description.substring(0, 300) + '...');\n lines.push('');\n lines.push(`- **Complexity:** ${feature.complexity}`);\n if (feature.userStories.length > 0) {\n lines.push(`- **User Stories:** ${feature.userStories.length}`);\n }\n lines.push('');\n }\n }\n\n if (this.plan.specification.requirements.length > 0) {\n lines.push('### Requirements');\n lines.push('');\n for (const req of this.plan.specification.requirements) {\n lines.push(`- **${req.id}** (${req.type}, ${req.priority}): ${req.description.substring(0, 100)}...`);\n }\n lines.push('');\n }\n }\n\n // Architecture summary\n if (this.plan.architecture) {\n lines.push('## Architecture');\n lines.push('');\n lines.push(`- **Components:** ${this.plan.architecture.components.length}`);\n lines.push(`- **Patterns:** ${this.plan.architecture.patterns.join(', ')}`);\n lines.push('');\n\n if (this.plan.architecture.components.length > 0) {\n lines.push('### Components');\n lines.push('');\n for (const comp of this.plan.architecture.components) {\n lines.push(`#### ${comp.id}: ${comp.name}`);\n lines.push('');\n lines.push(`- **Type:** ${comp.type}`);\n lines.push(`- **Description:** ${comp.description.substring(0, 200)}`);\n if (comp.technologies.length > 0) {\n lines.push(`- **Technologies:** ${comp.technologies.join(', ')}`);\n }\n lines.push('');\n }\n }\n }\n\n // Tasks\n lines.push('## Development Tasks');\n lines.push('');\n\n const tasksByPhase = new Map<string, SPARCTask[]>();\n for (const task of this.plan.tasks) {\n const existing = tasksByPhase.get(task.phase) || [];\n existing.push(task);\n tasksByPhase.set(task.phase, existing);\n }\n\n for (const [phase, tasks] of tasksByPhase.entries()) {\n lines.push(`### ${phase.charAt(0).toUpperCase() + phase.slice(1)} Phase (${tasks.length} tasks)`);\n lines.push('');\n for (const task of tasks) {\n lines.push(`#### ${task.name}`);\n lines.push('');\n lines.push(`- **Type:** ${task.type}`);\n lines.push(`- **Priority:** ${task.priority}`);\n lines.push(`- **Estimated:** ${task.estimatedHours}h`);\n lines.push(`- **Parallelizable:** ${task.parallelizable ? 'Yes' : 'No'}`);\n lines.push('');\n lines.push(task.description.substring(0, 500));\n lines.push('');\n }\n }\n\n // Review result\n if (this.plan.reviewResult) {\n lines.push('## Review Result');\n lines.push('');\n lines.push(`- **Status:** ${this.plan.reviewResult.overallStatus}`);\n lines.push(`- **Total Findings:** ${this.plan.reviewResult.totalFindings}`);\n lines.push(`- **Critical Findings:** ${this.plan.reviewResult.criticalFindings}`);\n lines.push('');\n\n if (this.plan.reviewResult.recommendations.length > 0) {\n lines.push('### Recommendations');\n lines.push('');\n for (const rec of this.plan.reviewResult.recommendations) {\n lines.push(`- ${rec}`);\n }\n lines.push('');\n }\n }\n\n return lines.join('\\n');\n }\n\n /**\n * Get the current plan\n */\n getPlan(): SPARCPlan {\n return this.plan;\n }\n\n /**\n * Get decision log manager\n */\n getDecisionLog(): DecisionLogManager {\n return this.decisionLog;\n }\n\n /**\n * Get parsed documentation\n */\n getParsedDocs(): ParsedDoc[] {\n return this.parsedDocs;\n }\n}\n\n/**\n * Create a SPARC planner\n */\nexport function createSPARCPlanner(options: SPARCPlannerOptions): SPARCPlanner {\n return new SPARCPlanner(options);\n}\n"],"names":[],"mappings":";;;;;;;AAiCA,MAAM,SAAS,aAAa,eAAe;AAiDpC,MAAM,aAAa;AAAA,EACP;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAA0B,CAAA;AAAA,EAElC,YAAY,SAA8B;AACxC,SAAK,UAAU;AAAA,MACb,WAAW,KAAK,QAAQ,aAAa,QAAQ;AAAA,MAC7C,SAAS;AAAA,MACT,kBAAkB;AAAA,MAClB,cAAc;AAAA,MACd,eAAe;AAAA,MACf,WAAW;AAAA,MACX,eAAe;AAAA,MACf,GAAG;AAAA,IAAA;AAIL,SAAK,OAAO,KAAK,eAAA;AAGjB,SAAK,cAAc,yBAAyB;AAAA,MAC1C,WAAW,KAAK,QAAQ;AAAA,MACxB,QAAQ,KAAK,KAAK;AAAA,IAAA,CACnB;AAGD,SAAK,mBAAmB,uBAAuB;AAAA,MAC7C,kBAAkB;AAAA,MAClB,QAAQ;AAAA,IAAA,CACT;AAED,WAAO,KAAK,6BAA6B;AAAA,MACvC,QAAQ,KAAK,KAAK;AAAA,MAClB,aAAa,KAAK,QAAQ;AAAA,MAC1B,SAAS,KAAK,QAAQ;AAAA,IAAA,CACvB;AAAA,EACH;AAAA;AAAA;AAAA;AAAA,EAKQ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"version": "0.12.1",
4
4
  "description": "Knowledge graph agent for Claude Code - generates knowledge graphs, initializes docs, and integrates with claude-flow",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",