UNPKG

adpa-enterprise-framework-automation

Version:

Modular, standards-compliant Node.js/TypeScript automation framework for enterprise requirements, project, and data management. Provides CLI and API for BABOK v3, PMBOK 7th Edition, and DMBOK 2.0 (in progress). Production-ready Express.js API with TypeSpe

94 lines (90 loc) 3.51 kB
import { AIProcessor } from '../../ai/AIProcessor.js'; import { ControlscopeTemplate } from '../scope-management/ControlscopeTemplate.js'; class ExpectedError extends Error { constructor(message) { super(message); this.name = 'ExpectedError'; } } /** * Processor for the Control Scope Process document. */ export class ControlscopeProcessor { aiProcessor; constructor() { this.aiProcessor = AIProcessor.getInstance(); } async process(context) { try { const prompt = this.createPrompt(context); const content = await this.aiProcessor.makeAICall([ { role: 'system', content: 'You are an expert consultant specializing in scope management documentation. Generate comprehensive, professional content based on the project context.' }, { role: 'user', content: prompt } ]).then(res => typeof res === 'string' ? res : res.content); await this.validateOutput(content); return { title: 'Control Scope Process', content }; } catch (error) { if (error instanceof ExpectedError) { console.warn('Expected error in Control Scope Process processing:', error.message); throw new Error(`Failed to generate Control Scope Process: ${error.message}`); } else { console.error('Unexpected error in Control Scope Process processing:', error); throw new Error('An unexpected error occurred while generating Control Scope Process'); } } } createPrompt(context) { // Get the template as an example structure const template = new ControlscopeTemplate(context); const exampleStructure = template.generateContent(); return `Based on the following project context, generate a comprehensive Control Scope Process document. Project Context: - Name: ${context.projectName || 'Untitled Project'} - Type: ${context.projectType || 'Not specified'} - Description: ${context.description || 'No description provided'} Use this structure as a reference (but customize the content for the specific project): ${exampleStructure} Important Instructions: - Make the content specific to the project context provided - Ensure the language is professional and appropriate for scope management - Include practical guidance where applicable - Focus on what makes this project unique - Use markdown formatting for proper structure - Keep content concise but comprehensive`; } async validateOutput(content) { if (!content || content.trim().length === 0) { throw new ExpectedError('Generated content is empty'); } // Basic validation - ensure content has some structure if (!content.includes('#')) { throw new ExpectedError('Generated content lacks proper markdown structure'); } } getRequiredContext() { return [ 'projectScope', 'deliverables', 'requirements', 'stakeholders' ]; } getName() { return 'Control Scope Process'; } getDescription() { return 'Generates a comprehensive Control Scope Process document following PMBOK guidelines'; } getVersion() { return '1.0.0'; } getDependencies() { return []; } } //# sourceMappingURL=ControlscopeProcessor.js.map