claude-mpm 4.4.0__py3-none-any.whl → 4.4.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- claude_mpm/VERSION +1 -1
- claude_mpm/agents/WORKFLOW.md +2 -14
- claude_mpm/agents/agent_loader.py +3 -2
- claude_mpm/agents/agent_loader_integration.py +2 -1
- claude_mpm/agents/async_agent_loader.py +2 -2
- claude_mpm/agents/base_agent_loader.py +2 -2
- claude_mpm/agents/frontmatter_validator.py +1 -0
- claude_mpm/agents/system_agent_config.py +2 -1
- claude_mpm/cli/commands/configure.py +2 -29
- claude_mpm/cli/commands/doctor.py +44 -5
- claude_mpm/cli/commands/mpm_init.py +117 -63
- claude_mpm/cli/parsers/configure_parser.py +6 -15
- claude_mpm/cli/startup_logging.py +1 -3
- claude_mpm/config/agent_config.py +1 -1
- claude_mpm/config/paths.py +2 -1
- claude_mpm/core/agent_name_normalizer.py +1 -0
- claude_mpm/core/config.py +2 -1
- claude_mpm/core/config_aliases.py +2 -1
- claude_mpm/core/file_utils.py +0 -1
- claude_mpm/core/framework/__init__.py +38 -0
- claude_mpm/core/framework/formatters/__init__.py +11 -0
- claude_mpm/core/framework/formatters/capability_generator.py +367 -0
- claude_mpm/core/framework/formatters/content_formatter.py +288 -0
- claude_mpm/core/framework/formatters/context_generator.py +184 -0
- claude_mpm/core/framework/loaders/__init__.py +13 -0
- claude_mpm/core/framework/loaders/agent_loader.py +206 -0
- claude_mpm/core/framework/loaders/file_loader.py +223 -0
- claude_mpm/core/framework/loaders/instruction_loader.py +161 -0
- claude_mpm/core/framework/loaders/packaged_loader.py +232 -0
- claude_mpm/core/framework/processors/__init__.py +11 -0
- claude_mpm/core/framework/processors/memory_processor.py +230 -0
- claude_mpm/core/framework/processors/metadata_processor.py +146 -0
- claude_mpm/core/framework/processors/template_processor.py +244 -0
- claude_mpm/core/framework_loader.py +298 -1795
- claude_mpm/core/log_manager.py +2 -1
- claude_mpm/core/tool_access_control.py +1 -0
- claude_mpm/core/unified_agent_registry.py +2 -1
- claude_mpm/core/unified_paths.py +1 -0
- claude_mpm/experimental/cli_enhancements.py +1 -0
- claude_mpm/hooks/__init__.py +9 -1
- claude_mpm/hooks/base_hook.py +1 -0
- claude_mpm/hooks/instruction_reinforcement.py +1 -0
- claude_mpm/hooks/kuzu_memory_hook.py +359 -0
- claude_mpm/hooks/validation_hooks.py +1 -1
- claude_mpm/scripts/mpm_doctor.py +1 -0
- claude_mpm/services/agents/loading/agent_profile_loader.py +1 -1
- claude_mpm/services/agents/loading/base_agent_manager.py +1 -1
- claude_mpm/services/agents/loading/framework_agent_loader.py +1 -1
- claude_mpm/services/agents/management/agent_capabilities_generator.py +1 -0
- claude_mpm/services/agents/management/agent_management_service.py +1 -1
- claude_mpm/services/agents/memory/memory_categorization_service.py +0 -1
- claude_mpm/services/agents/memory/memory_file_service.py +6 -2
- claude_mpm/services/agents/memory/memory_format_service.py +0 -1
- claude_mpm/services/agents/registry/deployed_agent_discovery.py +1 -1
- claude_mpm/services/async_session_logger.py +1 -1
- claude_mpm/services/claude_session_logger.py +1 -0
- claude_mpm/services/core/path_resolver.py +2 -0
- claude_mpm/services/diagnostics/checks/__init__.py +2 -0
- claude_mpm/services/diagnostics/checks/installation_check.py +126 -25
- claude_mpm/services/diagnostics/checks/mcp_services_check.py +399 -0
- claude_mpm/services/diagnostics/diagnostic_runner.py +4 -0
- claude_mpm/services/diagnostics/doctor_reporter.py +259 -32
- claude_mpm/services/event_bus/direct_relay.py +2 -1
- claude_mpm/services/event_bus/event_bus.py +1 -0
- claude_mpm/services/event_bus/relay.py +3 -2
- claude_mpm/services/framework_claude_md_generator/content_assembler.py +1 -1
- claude_mpm/services/infrastructure/daemon_manager.py +1 -1
- claude_mpm/services/mcp_config_manager.py +67 -4
- claude_mpm/services/mcp_gateway/core/process_pool.py +320 -0
- claude_mpm/services/mcp_gateway/core/startup_verification.py +2 -2
- claude_mpm/services/mcp_gateway/main.py +3 -13
- claude_mpm/services/mcp_gateway/server/stdio_server.py +4 -10
- claude_mpm/services/mcp_gateway/tools/__init__.py +14 -2
- claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +38 -6
- claude_mpm/services/mcp_gateway/tools/kuzu_memory_service.py +527 -0
- claude_mpm/services/memory/cache/simple_cache.py +1 -1
- claude_mpm/services/project/archive_manager.py +159 -96
- claude_mpm/services/project/documentation_manager.py +64 -45
- claude_mpm/services/project/enhanced_analyzer.py +132 -89
- claude_mpm/services/project/project_organizer.py +225 -131
- claude_mpm/services/response_tracker.py +1 -1
- claude_mpm/services/shared/__init__.py +2 -1
- claude_mpm/services/shared/service_factory.py +8 -5
- claude_mpm/services/socketio/server/eventbus_integration.py +1 -1
- claude_mpm/services/unified/__init__.py +1 -1
- claude_mpm/services/unified/analyzer_strategies/__init__.py +3 -3
- claude_mpm/services/unified/analyzer_strategies/code_analyzer.py +97 -53
- claude_mpm/services/unified/analyzer_strategies/dependency_analyzer.py +81 -40
- claude_mpm/services/unified/analyzer_strategies/performance_analyzer.py +277 -178
- claude_mpm/services/unified/analyzer_strategies/security_analyzer.py +196 -112
- claude_mpm/services/unified/analyzer_strategies/structure_analyzer.py +83 -49
- claude_mpm/services/unified/config_strategies/__init__.py +175 -0
- claude_mpm/services/unified/config_strategies/config_schema.py +735 -0
- claude_mpm/services/unified/config_strategies/context_strategy.py +750 -0
- claude_mpm/services/unified/config_strategies/error_handling_strategy.py +1009 -0
- claude_mpm/services/unified/config_strategies/file_loader_strategy.py +879 -0
- claude_mpm/services/unified/config_strategies/unified_config_service.py +814 -0
- claude_mpm/services/unified/config_strategies/validation_strategy.py +1144 -0
- claude_mpm/services/unified/deployment_strategies/__init__.py +7 -7
- claude_mpm/services/unified/deployment_strategies/base.py +24 -28
- claude_mpm/services/unified/deployment_strategies/cloud_strategies.py +168 -88
- claude_mpm/services/unified/deployment_strategies/local.py +49 -34
- claude_mpm/services/unified/deployment_strategies/utils.py +39 -43
- claude_mpm/services/unified/deployment_strategies/vercel.py +30 -24
- claude_mpm/services/unified/interfaces.py +0 -26
- claude_mpm/services/unified/migration.py +17 -40
- claude_mpm/services/unified/strategies.py +9 -26
- claude_mpm/services/unified/unified_analyzer.py +48 -44
- claude_mpm/services/unified/unified_config.py +21 -19
- claude_mpm/services/unified/unified_deployment.py +21 -26
- claude_mpm/storage/state_storage.py +1 -0
- claude_mpm/utils/agent_dependency_loader.py +18 -6
- claude_mpm/utils/common.py +14 -12
- claude_mpm/utils/database_connector.py +15 -12
- claude_mpm/utils/error_handler.py +1 -0
- claude_mpm/utils/log_cleanup.py +1 -0
- claude_mpm/utils/path_operations.py +1 -0
- claude_mpm/utils/session_logging.py +1 -1
- claude_mpm/utils/subprocess_utils.py +1 -0
- claude_mpm/validation/agent_validator.py +1 -1
- {claude_mpm-4.4.0.dist-info → claude_mpm-4.4.4.dist-info}/METADATA +23 -17
- {claude_mpm-4.4.0.dist-info → claude_mpm-4.4.4.dist-info}/RECORD +126 -105
- claude_mpm/cli/commands/configure_tui.py +0 -1927
- claude_mpm/services/mcp_gateway/tools/ticket_tools.py +0 -645
- claude_mpm/services/mcp_gateway/tools/unified_ticket_tool.py +0 -602
- {claude_mpm-4.4.0.dist-info → claude_mpm-4.4.4.dist-info}/WHEEL +0 -0
- {claude_mpm-4.4.0.dist-info → claude_mpm-4.4.4.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.4.0.dist-info → claude_mpm-4.4.4.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.4.0.dist-info → claude_mpm-4.4.4.dist-info}/top_level.txt +0 -0
@@ -10,13 +10,17 @@ Created: 2025-01-26
|
|
10
10
|
"""
|
11
11
|
|
12
12
|
import fnmatch
|
13
|
-
import os
|
14
13
|
from pathlib import Path
|
15
|
-
from typing import Any, Dict, List, Optional,
|
14
|
+
from typing import Any, Dict, List, Optional, Tuple
|
16
15
|
|
17
16
|
from claude_mpm.core.logging_utils import get_logger
|
18
17
|
|
19
|
-
from ..strategies import
|
18
|
+
from ..strategies import (
|
19
|
+
AnalyzerStrategy,
|
20
|
+
StrategyContext,
|
21
|
+
StrategyMetadata,
|
22
|
+
StrategyPriority,
|
23
|
+
)
|
20
24
|
|
21
25
|
logger = get_logger(__name__)
|
22
26
|
|
@@ -87,11 +91,26 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
87
91
|
|
88
92
|
# Common ignore patterns
|
89
93
|
IGNORE_PATTERNS = [
|
90
|
-
"*.pyc",
|
91
|
-
"
|
92
|
-
"
|
93
|
-
".
|
94
|
-
".
|
94
|
+
"*.pyc",
|
95
|
+
"__pycache__",
|
96
|
+
".git",
|
97
|
+
".svn",
|
98
|
+
".hg",
|
99
|
+
"node_modules",
|
100
|
+
"venv",
|
101
|
+
".venv",
|
102
|
+
"env",
|
103
|
+
"dist",
|
104
|
+
"build",
|
105
|
+
"target",
|
106
|
+
"bin",
|
107
|
+
"obj",
|
108
|
+
".idea",
|
109
|
+
".vscode",
|
110
|
+
"*.egg-info",
|
111
|
+
".pytest_cache",
|
112
|
+
".coverage",
|
113
|
+
".tox",
|
95
114
|
]
|
96
115
|
|
97
116
|
def __init__(self):
|
@@ -166,7 +185,9 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
166
185
|
"message": f"Unsupported target type: {type(target).__name__}",
|
167
186
|
}
|
168
187
|
|
169
|
-
def _analyze_structure(
|
188
|
+
def _analyze_structure(
|
189
|
+
self, root_path: Path, options: Dict[str, Any]
|
190
|
+
) -> Dict[str, Any]:
|
170
191
|
"""Analyze the structure of a project directory."""
|
171
192
|
results = {
|
172
193
|
"status": "success",
|
@@ -264,7 +285,9 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
264
285
|
# Track file types
|
265
286
|
ext = item.suffix.lower()
|
266
287
|
if ext:
|
267
|
-
statistics["file_types"][ext] =
|
288
|
+
statistics["file_types"][ext] = (
|
289
|
+
statistics["file_types"].get(ext, 0) + 1
|
290
|
+
)
|
268
291
|
|
269
292
|
# Get file info
|
270
293
|
try:
|
@@ -321,8 +344,9 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
321
344
|
config_files = {
|
322
345
|
child["name"].lower()
|
323
346
|
for child in tree.get("children", [])
|
324
|
-
if child["type"] == "file"
|
325
|
-
and child["name"].startswith(".")
|
347
|
+
if (child["type"] == "file"
|
348
|
+
and child["name"].startswith("."))
|
349
|
+
or child["name"].endswith(".config.js")
|
326
350
|
}
|
327
351
|
patterns["has_config"] = len(config_files) > 0
|
328
352
|
|
@@ -338,7 +362,11 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
338
362
|
def collect_names(node: Dict[str, Any]) -> None:
|
339
363
|
"""Collect all file and directory names."""
|
340
364
|
if node["type"] == "file":
|
341
|
-
name =
|
365
|
+
name = (
|
366
|
+
node["name"].rsplit(".", 1)[0]
|
367
|
+
if "." in node["name"]
|
368
|
+
else node["name"]
|
369
|
+
)
|
342
370
|
file_names.append(name)
|
343
371
|
elif node["type"] == "directory":
|
344
372
|
file_names.append(node["name"])
|
@@ -353,8 +381,12 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
353
381
|
# Count naming patterns
|
354
382
|
snake_case = sum(1 for n in file_names if "_" in n and n.islower())
|
355
383
|
kebab_case = sum(1 for n in file_names if "-" in n)
|
356
|
-
camel_case = sum(
|
357
|
-
|
384
|
+
camel_case = sum(
|
385
|
+
1 for n in file_names if n[0].islower() and any(c.isupper() for c in n)
|
386
|
+
)
|
387
|
+
pascal_case = sum(
|
388
|
+
1 for n in file_names if n[0].isupper() and any(c.islower() for c in n)
|
389
|
+
)
|
358
390
|
|
359
391
|
# Determine dominant pattern
|
360
392
|
patterns = {
|
@@ -411,9 +443,7 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
411
443
|
)
|
412
444
|
|
413
445
|
# Check file distribution
|
414
|
-
avg_files_per_dir = (
|
415
|
-
stats["total_files"] / max(stats["total_dirs"], 1)
|
416
|
-
)
|
446
|
+
avg_files_per_dir = stats["total_files"] / max(stats["total_dirs"], 1)
|
417
447
|
if avg_files_per_dir > 20:
|
418
448
|
score -= 10
|
419
449
|
organization["recommendations"].append(
|
@@ -472,17 +502,18 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
472
502
|
found_dirs = required_dirs & dir_names
|
473
503
|
|
474
504
|
if len(found_dirs) >= len(required_dirs) * pattern_info["confidence"]:
|
475
|
-
architecture["detected_patterns"].append(
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
505
|
+
architecture["detected_patterns"].append(
|
506
|
+
{
|
507
|
+
"name": pattern_name,
|
508
|
+
"confidence": len(found_dirs) / len(required_dirs),
|
509
|
+
"matched_dirs": list(found_dirs),
|
510
|
+
}
|
511
|
+
)
|
480
512
|
|
481
513
|
# Select the pattern with highest confidence
|
482
514
|
if architecture["detected_patterns"]:
|
483
515
|
best_pattern = max(
|
484
|
-
architecture["detected_patterns"],
|
485
|
-
key=lambda x: x["confidence"]
|
516
|
+
architecture["detected_patterns"], key=lambda x: x["confidence"]
|
486
517
|
)
|
487
518
|
architecture["pattern"] = best_pattern["name"]
|
488
519
|
architecture["confidence"] = best_pattern["confidence"]
|
@@ -502,14 +533,12 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
502
533
|
|
503
534
|
# Structural complexity based on file and directory count
|
504
535
|
total_nodes = stats["total_files"] + stats["total_dirs"]
|
505
|
-
complexity["structural_complexity"] = (
|
506
|
-
|
536
|
+
complexity["structural_complexity"] = (total_nodes / 100) * (
|
537
|
+
stats["max_depth"] / 3
|
507
538
|
)
|
508
539
|
|
509
540
|
# Nesting complexity
|
510
|
-
complexity["nesting_complexity"] = min(
|
511
|
-
100, (stats["max_depth"] / 7) * 100
|
512
|
-
)
|
541
|
+
complexity["nesting_complexity"] = min(100, (stats["max_depth"] / 7) * 100)
|
513
542
|
|
514
543
|
# File dispersion (how spread out files are)
|
515
544
|
if stats["total_dirs"] > 0:
|
@@ -562,10 +591,7 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
562
591
|
|
563
592
|
file_counts = {}
|
564
593
|
for language, extensions in language_extensions.items():
|
565
|
-
count = sum(
|
566
|
-
len(list(root_path.rglob(f"*{ext}")))
|
567
|
-
for ext in extensions
|
568
|
-
)
|
594
|
+
count = sum(len(list(root_path.rglob(f"*{ext}"))) for ext in extensions)
|
569
595
|
if count > 0:
|
570
596
|
file_counts[language] = count
|
571
597
|
|
@@ -621,12 +647,14 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
621
647
|
# Extract structure statistics
|
622
648
|
if "statistics" in analysis_result:
|
623
649
|
stats = analysis_result["statistics"]
|
624
|
-
metrics.update(
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
650
|
+
metrics.update(
|
651
|
+
{
|
652
|
+
"total_files": stats.get("total_files", 0),
|
653
|
+
"total_directories": stats.get("total_dirs", 0),
|
654
|
+
"max_depth": stats.get("max_depth", 0),
|
655
|
+
"unique_file_types": len(stats.get("file_types", {})),
|
656
|
+
}
|
657
|
+
)
|
630
658
|
|
631
659
|
# Extract organization metrics
|
632
660
|
if "organization" in analysis_result:
|
@@ -636,12 +664,14 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
636
664
|
# Extract complexity metrics
|
637
665
|
if "complexity" in analysis_result:
|
638
666
|
complexity = analysis_result["complexity"]
|
639
|
-
metrics.update(
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
667
|
+
metrics.update(
|
668
|
+
{
|
669
|
+
"structural_complexity": complexity.get("structural_complexity", 0),
|
670
|
+
"nesting_complexity": complexity.get("nesting_complexity", 0),
|
671
|
+
"file_dispersion": complexity.get("file_dispersion", 0),
|
672
|
+
"coupling_indicator": complexity.get("coupling_indicator", 0),
|
673
|
+
}
|
674
|
+
)
|
645
675
|
|
646
676
|
return metrics
|
647
677
|
|
@@ -668,7 +698,8 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
668
698
|
"change": diff,
|
669
699
|
"percent_change": (
|
670
700
|
(diff / baseline_metrics[key] * 100)
|
671
|
-
if baseline_metrics[key]
|
701
|
+
if baseline_metrics[key]
|
702
|
+
else 0
|
672
703
|
),
|
673
704
|
}
|
674
705
|
|
@@ -687,10 +718,13 @@ class StructureAnalyzerStrategy(AnalyzerStrategy):
|
|
687
718
|
|
688
719
|
# Compare architecture
|
689
720
|
if "architecture" in baseline and "architecture" in current:
|
690
|
-
if
|
721
|
+
if (
|
722
|
+
baseline["architecture"]["pattern"]
|
723
|
+
!= current["architecture"]["pattern"]
|
724
|
+
):
|
691
725
|
comparison["architecture_change"] = {
|
692
726
|
"baseline": baseline["architecture"]["pattern"],
|
693
727
|
"current": current["architecture"]["pattern"],
|
694
728
|
}
|
695
729
|
|
696
|
-
return comparison
|
730
|
+
return comparison
|
@@ -0,0 +1,175 @@
|
|
1
|
+
"""
|
2
|
+
Unified Configuration Strategies - Phase 3 Consolidation
|
3
|
+
Reduces 15,000+ lines of configuration code by 65-75%
|
4
|
+
|
5
|
+
This package consolidates:
|
6
|
+
- 15+ configuration services → 1 unified service
|
7
|
+
- 215 file loading instances → 5 strategic loaders
|
8
|
+
- 236 validation functions → 15 composable validators
|
9
|
+
- 99 error handling patterns → Unified error strategy
|
10
|
+
|
11
|
+
Target: 10,000-11,000 line reduction with 20-30% performance improvement
|
12
|
+
"""
|
13
|
+
|
14
|
+
from .config_schema import (
|
15
|
+
ConfigMigration,
|
16
|
+
ConfigSchema,
|
17
|
+
SchemaBuilder,
|
18
|
+
SchemaFormat,
|
19
|
+
SchemaProperty,
|
20
|
+
SchemaRegistry,
|
21
|
+
SchemaType,
|
22
|
+
SchemaValidator,
|
23
|
+
TypedConfig,
|
24
|
+
create_api_schema,
|
25
|
+
create_database_schema,
|
26
|
+
create_logging_schema,
|
27
|
+
)
|
28
|
+
from .context_strategy import (
|
29
|
+
CachingContextManager,
|
30
|
+
ContextLifecycle,
|
31
|
+
ContextScope,
|
32
|
+
ContextStrategy,
|
33
|
+
HierarchicalContextManager,
|
34
|
+
IsolatedContextManager,
|
35
|
+
ScopedConfigManager,
|
36
|
+
ThreadLocalContextManager,
|
37
|
+
)
|
38
|
+
from .error_handling_strategy import (
|
39
|
+
CompositeErrorHandler,
|
40
|
+
ErrorCategory,
|
41
|
+
ErrorContext,
|
42
|
+
ErrorHandlingResult,
|
43
|
+
ErrorHandlingStrategy,
|
44
|
+
ErrorSeverity,
|
45
|
+
FileIOErrorHandler,
|
46
|
+
NetworkErrorHandler,
|
47
|
+
ParsingErrorHandler,
|
48
|
+
TypeConversionErrorHandler,
|
49
|
+
ValidationErrorHandler,
|
50
|
+
)
|
51
|
+
from .file_loader_strategy import (
|
52
|
+
CompositeFileLoader,
|
53
|
+
EnvironmentFileLoader,
|
54
|
+
FileLoadContext,
|
55
|
+
FileLoaderStrategy,
|
56
|
+
LegacyFileLoader,
|
57
|
+
LoaderType,
|
58
|
+
ProgrammaticFileLoader,
|
59
|
+
StructuredFileLoader,
|
60
|
+
)
|
61
|
+
from .unified_config_service import (
|
62
|
+
ConfigContext,
|
63
|
+
ConfigFormat,
|
64
|
+
ConfigMetadata,
|
65
|
+
IConfigStrategy,
|
66
|
+
UnifiedConfigService,
|
67
|
+
)
|
68
|
+
from .validation_strategy import (
|
69
|
+
CompositeValidator,
|
70
|
+
ConditionalValidator,
|
71
|
+
CrossFieldValidator,
|
72
|
+
CustomValidator,
|
73
|
+
DependencyValidator,
|
74
|
+
EnumValidator,
|
75
|
+
FormatValidator,
|
76
|
+
LengthValidator,
|
77
|
+
PatternValidator,
|
78
|
+
RangeValidator,
|
79
|
+
RecursiveValidator,
|
80
|
+
RequiredValidator,
|
81
|
+
SchemaValidator,
|
82
|
+
TypeValidator,
|
83
|
+
UniqueValidator,
|
84
|
+
ValidationResult,
|
85
|
+
ValidationRule,
|
86
|
+
ValidationStrategy,
|
87
|
+
ValidationType,
|
88
|
+
)
|
89
|
+
|
90
|
+
# Create singleton instance for global use
|
91
|
+
unified_config = UnifiedConfigService()
|
92
|
+
|
93
|
+
# Backward compatibility aliases
|
94
|
+
ConfigService = UnifiedConfigService
|
95
|
+
ConfigManager = UnifiedConfigService
|
96
|
+
ConfigLoader = UnifiedConfigService
|
97
|
+
|
98
|
+
# Export all public APIs
|
99
|
+
__all__ = [
|
100
|
+
# Main service
|
101
|
+
"UnifiedConfigService",
|
102
|
+
"unified_config",
|
103
|
+
# Strategies
|
104
|
+
"FileLoaderStrategy",
|
105
|
+
"ValidationStrategy",
|
106
|
+
"ErrorHandlingStrategy",
|
107
|
+
"ContextStrategy",
|
108
|
+
# Core types
|
109
|
+
"ConfigFormat",
|
110
|
+
"ConfigContext",
|
111
|
+
"ConfigMetadata",
|
112
|
+
"IConfigStrategy",
|
113
|
+
# File loading
|
114
|
+
"LoaderType",
|
115
|
+
"FileLoadContext",
|
116
|
+
"StructuredFileLoader",
|
117
|
+
"EnvironmentFileLoader",
|
118
|
+
"ProgrammaticFileLoader",
|
119
|
+
"LegacyFileLoader",
|
120
|
+
"CompositeFileLoader",
|
121
|
+
# Validation
|
122
|
+
"ValidationRule",
|
123
|
+
"ValidationResult",
|
124
|
+
"ValidationType",
|
125
|
+
# Error handling
|
126
|
+
"ErrorContext",
|
127
|
+
"ErrorHandlingResult",
|
128
|
+
"ErrorCategory",
|
129
|
+
"ErrorSeverity",
|
130
|
+
# Context management
|
131
|
+
"ContextScope",
|
132
|
+
"ContextLifecycle",
|
133
|
+
"HierarchicalContextManager",
|
134
|
+
"ScopedConfigManager",
|
135
|
+
# Schema
|
136
|
+
"ConfigSchema",
|
137
|
+
"SchemaProperty",
|
138
|
+
"SchemaBuilder",
|
139
|
+
"SchemaValidator",
|
140
|
+
"SchemaRegistry",
|
141
|
+
"ConfigMigration",
|
142
|
+
"TypedConfig",
|
143
|
+
"SchemaType",
|
144
|
+
"SchemaFormat",
|
145
|
+
# Backward compatibility
|
146
|
+
"ConfigService",
|
147
|
+
"ConfigManager",
|
148
|
+
"ConfigLoader",
|
149
|
+
]
|
150
|
+
|
151
|
+
|
152
|
+
# Module initialization
|
153
|
+
def initialize():
|
154
|
+
"""Initialize the unified configuration system"""
|
155
|
+
# Register default strategies
|
156
|
+
unified_config.register_strategy("file", FileLoaderStrategy())
|
157
|
+
unified_config.register_strategy("validation", ValidationStrategy())
|
158
|
+
unified_config.register_strategy("error", ErrorHandlingStrategy())
|
159
|
+
unified_config.register_strategy("context", ContextStrategy())
|
160
|
+
|
161
|
+
# Set up default error handlers
|
162
|
+
error_strategy = ErrorHandlingStrategy()
|
163
|
+
|
164
|
+
# Register recovery strategies
|
165
|
+
error_strategy.register_recovery_strategy(
|
166
|
+
"default_fallback", lambda ctx: ctx.metadata.get("default_config", {})
|
167
|
+
)
|
168
|
+
|
169
|
+
error_strategy.register_recovery_strategy("empty_fallback", lambda ctx: {})
|
170
|
+
|
171
|
+
return unified_config
|
172
|
+
|
173
|
+
|
174
|
+
# Auto-initialize on import
|
175
|
+
_unified_instance = initialize()
|