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

183 lines (139 loc) 9.06 kB
# Requirements Gathering Agent - Architecture Documentation ## Overview The Requirements Gathering Agent is an AI-driven system designed to automate and enhance the requirements gathering process for software projects. It leverages multiple AI providers and context management techniques to generate comprehensive project documentation, user stories, and strategic planning artifacts. ## System Architecture ### Core Components #### 1. Context Management System - **Context Manager**: Central component for managing project context and AI interactions - **Provider Abstraction**: Support for multiple AI providers (OpenAI, Google AI, GitHub Copilot, Ollama) - **Context Injection**: Direct context injection capabilities for efficient AI processing #### 2. AI Provider Integration - **Multi-Provider Support**: Flexible architecture supporting various AI services - **Provider Synchronization**: Coordinated AI provider management - **Fallback Mechanisms**: Robust handling of provider failures #### 3. Document Generation Engine - **Template-Based Generation**: Structured document creation using predefined templates - **PMBOK Compliance**: Project management artifacts following PMBOK guidelines - **Automated Workflows**: End-to-end document generation pipelines #### 4. CLI Interface - **Command-Line Tools**: `cli.ts` and `cli-main.ts` for system interaction - **Batch Processing**: Support for bulk document generation - **Configuration Management**: Flexible configuration options ### Technology Stack #### Core Technologies - **TypeScript**: Primary development language for type safety and maintainability - **Node.js**: Runtime environment for server-side execution - **Jest**: Testing framework for unit and integration tests #### AI Integration - **OpenAI API**: GPT models for text generation and analysis - **Google AI**: Gemini models for alternative AI processing - **GitHub Copilot**: Code generation and assistance - **Ollama**: Local AI model execution #### Development Tools - **ESLint**: Code quality and consistency - **TypeScript Compiler**: Type checking and compilation - **PowerShell/Bash**: Cross-platform scripting support ### Module Structure ``` src/ ├── cli.ts # Main CLI interface ├── cli-main.ts # CLI entry point ├── index.ts # Main application entry ├── modules/ # Core functionality modules └── examples/ # Usage examples and templates ``` ### Data Flow 1. **Input Processing**: Project context and requirements input 2. **AI Analysis**: Multi-provider AI processing for content generation 3. **Document Generation**: Structured output creation 4. **Validation**: Quality checks and compliance verification 5. **Output Management**: File organization and documentation structure ### Key Features #### Context Management - **Large Context Handling**: Efficient processing of extensive project documentation - **Context Validation**: Automated verification of context completeness - **Priority Implementation**: Focused processing of critical components #### Document Generation - **Strategic Statements**: Mission, vision, and strategic planning documents - **User Stories**: AI-generated user stories with acceptance criteria - **Technical Analysis**: Architecture and implementation documentation - **Project Management**: PMBOK-compliant project artifacts #### Quality Assurance - **Automated Testing**: Comprehensive test suite for reliability - **Document Validation**: Automated checks for generated content - **Configuration Validation**: System configuration verification ## Design Principles ### Modularity - **Separation of Concerns**: Clear boundaries between system components - **Plugin Architecture**: Extensible provider and module system - **Reusable Components**: Shared functionality across modules ### Scalability - **Async Processing**: Non-blocking operations for performance - **Batch Operations**: Efficient handling of multiple documents - **Resource Management**: Optimized memory and API usage ### Reliability - **Error Handling**: Comprehensive error management and recovery - **Fallback Systems**: Redundancy for critical operations - **Validation Layers**: Multiple verification points ### Extensibility - **Provider Abstraction**: Easy addition of new AI providers - **Template System**: Customizable document generation - **Configuration Framework**: Flexible system configuration ## Implementation Notes ### Setup and Configuration - **Environment Variables**: AI provider API keys and configuration - **Package Dependencies**: Managed through npm/package.json - **Cross-Platform Support**: Windows and Unix-like systems ### Development Workflow - **TypeScript Compilation**: Source code compilation and type checking - **Testing Strategy**: Unit tests, integration tests, and validation scripts - **Documentation Generation**: Automated documentation updates ### Deployment Considerations - **Dependency Management**: Careful handling of AI provider dependencies - **Configuration Security**: Secure handling of API keys and credentials - **Performance Optimization**: Efficient AI provider usage and caching ## Future Enhancements ### Planned Features - **Web Interface**: Browser-based user interface - **Advanced Analytics**: Project metrics and insights - **Collaboration Tools**: Multi-user project management - **Template Marketplace**: Shared document templates ### Technical Improvements - **Caching System**: Improved performance through intelligent caching - **Streaming Support**: Real-time document generation - **Advanced Validation**: Enhanced quality assurance mechanisms - **Monitoring Tools**: System health and performance monitoring --- ## Modular Processor Architecture (2025 Update) The Requirements Gathering Agent now uses a modular, configuration-driven processor factory for all document generation. This architecture is designed for scalability, maintainability, and ease of extension. Below are the key architectural details and rationale: ### 1. Processor Factory Pattern - All document processors are registered in a central factory, which loads processor classes dynamically based on a configuration file (`processor-config.json`). - The factory uses a registry/map pattern, allowing new processors to be added or swapped without modifying core orchestration code. - Processors are instantiated with dependency injection, supporting testability and future extensibility. ### 2. Configuration-Driven Registration - The processor registry is populated at runtime from a JSON configuration file, mapping document task keys to module/class pairs. - This enables dynamic loading via `import()` and supports hot-swapping or extension of processors without code changes. - Example config entry: `"mission-vision-core-values": "../documentTemplates/strategic-statements/strategicStatementsProcessor.ts#MissionVisionCoreValuesProcessor"` ### 3. ESM/TypeScript Compatibility - All source imports are extensionless or use `.ts` in development, and `.js` in the built output, ensuring compatibility with Node ESM resolution. - This avoids runtime errors and supports modern JavaScript/TypeScript best practices. ### 4. Error Handling and Logging - The factory and processors use custom error classes (e.g., `ProcessorNotFoundError`, `ProcessorInstantiationError`) for granular error reporting. - All errors are logged with context, and the system fails fast if a processor cannot be loaded or instantiated. ### 5. Testing and Mocking - The architecture is designed for testability: all processors and the factory can be mocked in Jest or other test frameworks. - All async methods in processor mocks must return Promises to avoid teardown errors. - The test suite includes unit and integration tests for processor loading, error handling, and orchestration. ### 6. Backward Compatibility and Migration - Adapter layers are provided for legacy import paths, ensuring a smooth transition for existing code. - Legacy processor files are marked as deprecated and will be removed after full migration. ### 7. Extending the System - To add a new document type, create a processor class, register it in `processor-config.json`, and ensure it implements the required interface. - Update `generationTasks.ts` and context relationships as needed. - Follow the `strategic-statements` category as a reference implementation. ### 8. Lessons Learned - Strict ESM/TypeScript import discipline is essential for runtime stability. - Clean builds and careful management of the `dist/` directory prevent missing module errors. - Dynamic imports and configuration-driven registration provide flexibility for future growth. - Comprehensive documentation and migration notes are critical for onboarding new contributors and maintaining architectural integrity. ---