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

42 lines 1.9 kB
import { AIProcessor } from '../../ai/AIProcessor.js'; import { ProgramCharterTemplate } from './ProgramCharterTemplate.js'; /** * Processor for the Program Project Charter document. */ export class ProgramCharterProcessor { aiProcessor; constructor() { this.aiProcessor = AIProcessor.getInstance(); } /** * Detects [AI_SYNTHESIS: ...] tags and generates text for each, replacing the tag with AI-generated content. */ async synthesizeSectionContent(sectionContent, context) { const synthesisRegex = /\[AI_SYNTHESIS:([^\]]+)\]/g; let result = sectionContent; let match; while ((match = synthesisRegex.exec(sectionContent)) !== null) { const prompt = match[1].trim(); // Use AIProcessor to generate content for the prompt const aiContent = await this.aiProcessor.makeAICall([ { role: 'system', content: `You are a PMO Director and Executive Sponsor. Synthesize content for the Program/Project Charter section based on the following prompt and context.` }, { role: 'user', content: `Prompt: ${prompt}\nContext: ${JSON.stringify(context)}` } ]).then(res => typeof res === 'string' ? res : res.content); result = result.replace(match[0], aiContent); } return result; } async process(context) { const sections = ProgramCharterTemplate.getSections(context); let content = `# ${ProgramCharterTemplate.title}\n\n`; for (const section of sections) { const synthesizedContent = await this.synthesizeSectionContent(section.content, context); content += `## ${section.title}\n\n${synthesizedContent}\n\n`; } return { title: ProgramCharterTemplate.title, content }; } } //# sourceMappingURL=ProgramCharterProcessor.js.map