22CodeFlow Engine - Automated Code Review and Quality Management System
33
44This package provides AI-powered code analysis, automated fixes, and quality assurance workflows.
5+
6+ Main Components:
7+ - CodeFlowEngine: Main orchestrator for all automation activities
8+ - ActionRegistry: Registry for managing action plugins
9+ - WorkflowEngine: Workflow execution engine
10+ - LLMProviderManager: Multi-provider LLM abstraction
11+ - MetricsCollector: Quality metrics collection
512"""
613
714import logging
815import os
916from typing import Any , cast
1017
1118from codeflow_engine .actions .registry import ActionRegistry
12- # from codeflow_engine.agents.agents import AgentManager # Not implemented yet
1319from codeflow_engine .ai .core .base import LLMProvider
1420from codeflow_engine .ai .core .providers .manager import LLMProviderManager
1521from codeflow_engine .config import CodeFlowConfig
1622from codeflow_engine .engine import CodeFlowEngine
17- from codeflow_engine .exceptions import (CodeFlowException , ConfigurationError ,
18- IntegrationError )
23+ from codeflow_engine .exceptions import (
24+ ActionError ,
25+ AuthenticationError ,
26+ CodeFlowException ,
27+ CodeFlowPermissionError ,
28+ ConfigurationError ,
29+ IntegrationError ,
30+ LLMProviderError ,
31+ RateLimitError ,
32+ ValidationError ,
33+ WorkflowError ,
34+ )
1935from codeflow_engine .integrations .base import Integration
20- # from codeflow_engine.integrations.bitbucket.bitbucket_integration import \
21- # BitbucketIntegration # Not implemented yet
22- # from codeflow_engine.integrations.github.github_integration import GitHubIntegration # Not implemented yet
23- # from codeflow_engine.integrations.gitlab.gitlab_integration import GitLabIntegration # Not implemented yet
24- # from codeflow_engine.integrations.jira.jira_integration import JiraIntegration # Not implemented yet
25- # from codeflow_engine.integrations.registry import IntegrationRegistry # Not implemented yet
26- # from codeflow_engine.integrations.slack.slack_integration import SlackIntegration # Not implemented yet
2736from codeflow_engine .quality .metrics_collector import MetricsCollector
28- # from codeflow_engine.reporting.report_generator import ReportGenerator # Not implemented yet
29- from codeflow_engine .security .authorization .enterprise_manager import \
30- EnterpriseAuthorizationManager
37+
38+ # Security - guarded import
39+ EnterpriseAuthorizationManager : type [Any ] | None = None
40+ try :
41+ from codeflow_engine .security .authorization .enterprise_manager import (
42+ EnterpriseAuthorizationManager ,
43+ )
44+ except (ImportError , OSError ):
45+ pass
46+
3147from codeflow_engine .workflows .base import Workflow
3248from codeflow_engine .workflows .engine import WorkflowEngine
3349
34- # from codeflow_engine.workflows.workflow_manager import WorkflowManager # Not implemented yet
35-
3650# Import structlog with error handling
3751STRUCTLOG_AVAILABLE : bool
3852try :
4862
4963# Public API exports
5064__all__ = [
51- "ActionRegistry" ,
65+ # Core engine
5266 "CodeFlowEngine" ,
53- "MetricsCollector" ,
54- "EnterpriseAuthorizationManager" ,
67+ "CodeFlowConfig" ,
68+ # Registries
69+ "ActionRegistry" ,
70+ # AI/LLM
5571 "LLMProvider" ,
5672 "LLMProviderManager" ,
73+ # Integrations
74+ "Integration" ,
75+ # Workflows
76+ "Workflow" ,
77+ "WorkflowEngine" ,
78+ # Quality
79+ "MetricsCollector" ,
80+ # Security
81+ "EnterpriseAuthorizationManager" ,
82+ # Exceptions
83+ "ActionError" ,
84+ "AuthenticationError" ,
85+ "CodeFlowException" ,
86+ "CodeFlowPermissionError" ,
87+ "ConfigurationError" ,
88+ "IntegrationError" ,
89+ "LLMProviderError" ,
90+ "RateLimitError" ,
91+ "ValidationError" ,
92+ "WorkflowError" ,
93+ # Utilities
94+ "configure_logging" ,
5795]
5896
59- # Setup logging defaults
60-
6197
6298def configure_logging (level : str = "INFO" , * , format_json : bool = False ) -> None :
63- """Configure default logging for CodeFlow Engine."""
99+ """
100+ Configure default logging for CodeFlow Engine.
64101
102+ Args:
103+ level: Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
104+ format_json: If True and structlog is available, use JSON logging
105+ """
65106 if format_json and STRUCTLOG_AVAILABLE and structlog_module :
66107 # Structured JSON logging
67108 structlog_module .configure (
@@ -86,6 +127,7 @@ def configure_logging(level: str = "INFO", *, format_json: bool = False) -> None
86127 )
87128
88129
130+ # Configure logging on import
89131log_level = os .getenv ("CODEFLOW_LOG_LEVEL" , "INFO" )
90132json_logging = os .getenv ("CODEFLOW_JSON_LOGGING" , "false" ).lower () == "true"
91133configure_logging (level = log_level , format_json = json_logging )
0 commit comments