x-fidelity-core
The core analysis engine and utilities that power all X-Fidelity functionality.
Overview
x-fidelity-core
(@x-fidelity/core
) is the heart of the X-Fidelity framework, providing the fundamental analysis engine, configuration management, and utility functions that all other packages depend on.
Key Components
Analysis Engine
- Analyzer (
core/engine/analyzer.ts
): Main entry point for codebase analysis - Engine Setup/Runner (
core/engine/
): Sets up and executes the rules engine - Facts/Operators: Extensible system for data collection and rule evaluation
Configuration Management
- ConfigManager (
core/configManager.ts
): Manages archetype configurations and rules - Local Configuration: Support for project-specific
.xfi-config.json
files - Remote Configuration: Integration with configuration servers
- Exemption System: Time-limited rule exemptions with expiration tracking
Plugin System
- Plugin Registry (
core/pluginRegistry.ts
): Dynamically loads and manages plugins - Dynamic Loading: Support for both built-in and external plugins
- Extensible Architecture: Plugin-based facts and operators
Utilities and Infrastructure
- Logging System (
utils/logger.ts
): Structured logging with multiple transports - Performance Monitoring (
utils/performanceMonitor.ts
): Built-in performance tracking - Telemetry (
utils/telemetry.ts
): Usage analytics and performance metrics - OpenAI Integration (
utils/openai.ts
): AI-powered code analysis capabilities
Notification System
- Email Notifications (
notifications/emailNotificationProvider.ts
) - Slack Integration (
notifications/slackNotificationProvider.ts
) - Microsoft Teams (
notifications/teamsNotificationProvider.ts
) - Code Owners Integration (
notifications/codeOwnersProvider.ts
)
Architecture
The core package follows a modular architecture:
core/
├── engine/ # Analysis engine and execution
├── configManager.ts # Configuration management
├── pluginRegistry.ts # Plugin system
└── index.ts # Public API exports
utils/
├── logger.ts # Logging infrastructure
├── telemetry.ts # Analytics and metrics
├── openai.ts # AI integration