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
61 lines (58 loc) • 2.07 kB
JavaScript
import { AIProcessor } from '../../ai/AIProcessor.js';
export class CodingStandardsProcessor {
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 a senior developer with expertise in coding standards and best practices.' },
{ role: 'user', content: prompt }
]).then(res => typeof res === 'string' ? res : res.content);
await this.validateOutput(content);
return {
title: 'Coding Standards Guide',
content
};
}
catch (error) {
console.error('Error processing Coding Standards Guide:', error);
throw new Error(`Failed to generate Coding Standards Guide: ${error instanceof Error ? error.message : String(error)}`);
}
}
createPrompt(context) {
return `Based on the following project context, generate a comprehensive Coding Standards Guide.
Project Context:
- Name: ${context.projectName}
- Type: ${context.projectType}
- Description: ${context.description}
The document should include:
1. Code Style Guidelines
2. Naming Conventions
3. File Organization
4. Code Documentation
5. Error Handling
6. Testing Requirements
7. Performance Guidelines
8. Security Guidelines
9. Code Review Process
10. Best Practices
Requirements:
1. Clear coding standards
2. Language-specific rules
3. Include examples
4. Address maintainability
5. Define review process`;
}
async validateOutput(content) {
if (!content || content.trim().length === 0) {
throw new Error('Generated content is empty');
}
if (content.length < 500) {
console.warn('Generated content seems unusually short for coding standards guide');
}
}
}
//# sourceMappingURL=CodingStandardsProcessor.js.map