claude-mpm 4.4.3__py3-none-any.whl → 4.4.5__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/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/doctor.py +44 -5
- claude_mpm/cli/commands/mpm_init.py +116 -62
- claude_mpm/cli/parsers/configure_parser.py +3 -1
- 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 +6 -6
- claude_mpm/core/framework/formatters/__init__.py +2 -2
- claude_mpm/core/framework/formatters/capability_generator.py +19 -8
- claude_mpm/core/framework/formatters/content_formatter.py +8 -3
- claude_mpm/core/framework/formatters/context_generator.py +7 -3
- claude_mpm/core/framework/loaders/__init__.py +3 -3
- claude_mpm/core/framework/loaders/agent_loader.py +7 -3
- claude_mpm/core/framework/loaders/file_loader.py +16 -6
- claude_mpm/core/framework/loaders/instruction_loader.py +16 -6
- claude_mpm/core/framework/loaders/packaged_loader.py +36 -12
- claude_mpm/core/framework/processors/__init__.py +2 -2
- claude_mpm/core/framework/processors/memory_processor.py +14 -6
- claude_mpm/core/framework/processors/metadata_processor.py +5 -5
- claude_mpm/core/framework/processors/template_processor.py +12 -6
- claude_mpm/core/framework_loader.py +44 -20
- 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/base_hook.py +1 -0
- claude_mpm/hooks/instruction_reinforcement.py +1 -0
- claude_mpm/hooks/kuzu_memory_hook.py +20 -13
- 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 +1 -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 +451 -0
- claude_mpm/services/diagnostics/diagnostic_runner.py +3 -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 +301 -54
- claude_mpm/services/mcp_gateway/core/process_pool.py +62 -23
- claude_mpm/services/mcp_gateway/tools/__init__.py +6 -5
- claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +3 -1
- claude_mpm/services/mcp_gateway/tools/kuzu_memory_service.py +16 -31
- 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/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 +111 -126
- claude_mpm/services/unified/config_strategies/config_schema.py +157 -111
- claude_mpm/services/unified/config_strategies/context_strategy.py +91 -89
- claude_mpm/services/unified/config_strategies/error_handling_strategy.py +183 -173
- claude_mpm/services/unified/config_strategies/file_loader_strategy.py +160 -152
- claude_mpm/services/unified/config_strategies/unified_config_service.py +124 -112
- claude_mpm/services/unified/config_strategies/validation_strategy.py +298 -259
- 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.3.dist-info → claude_mpm-4.4.5.dist-info}/METADATA +35 -15
- {claude_mpm-4.4.3.dist-info → claude_mpm-4.4.5.dist-info}/RECORD +118 -117
- {claude_mpm-4.4.3.dist-info → claude_mpm-4.4.5.dist-info}/WHEEL +0 -0
- {claude_mpm-4.4.3.dist-info → claude_mpm-4.4.5.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.4.3.dist-info → claude_mpm-4.4.5.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.4.3.dist-info → claude_mpm-4.4.5.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
|
@@ -11,85 +11,80 @@ This package consolidates:
|
|
11
11
|
Target: 10,000-11,000 line reduction with 20-30% performance improvement
|
12
12
|
"""
|
13
13
|
|
14
|
-
from .
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
EnvironmentFileLoader,
|
28
|
-
ProgrammaticFileLoader,
|
29
|
-
LegacyFileLoader,
|
30
|
-
CompositeFileLoader
|
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,
|
31
27
|
)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
LengthValidator,
|
42
|
-
PatternValidator,
|
43
|
-
EnumValidator,
|
44
|
-
FormatValidator,
|
45
|
-
DependencyValidator,
|
46
|
-
UniqueValidator,
|
47
|
-
CustomValidator,
|
48
|
-
ConditionalValidator,
|
49
|
-
RecursiveValidator,
|
50
|
-
CrossFieldValidator,
|
51
|
-
CompositeValidator,
|
52
|
-
SchemaValidator
|
28
|
+
from .context_strategy import (
|
29
|
+
CachingContextManager,
|
30
|
+
ContextLifecycle,
|
31
|
+
ContextScope,
|
32
|
+
ContextStrategy,
|
33
|
+
HierarchicalContextManager,
|
34
|
+
IsolatedContextManager,
|
35
|
+
ScopedConfigManager,
|
36
|
+
ThreadLocalContextManager,
|
53
37
|
)
|
54
|
-
|
55
38
|
from .error_handling_strategy import (
|
56
|
-
|
39
|
+
CompositeErrorHandler,
|
40
|
+
ErrorCategory,
|
57
41
|
ErrorContext,
|
58
42
|
ErrorHandlingResult,
|
59
|
-
|
43
|
+
ErrorHandlingStrategy,
|
60
44
|
ErrorSeverity,
|
61
45
|
FileIOErrorHandler,
|
62
|
-
ParsingErrorHandler,
|
63
|
-
ValidationErrorHandler,
|
64
46
|
NetworkErrorHandler,
|
47
|
+
ParsingErrorHandler,
|
65
48
|
TypeConversionErrorHandler,
|
66
|
-
|
49
|
+
ValidationErrorHandler,
|
67
50
|
)
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
CachingContextManager
|
51
|
+
from .file_loader_strategy import (
|
52
|
+
CompositeFileLoader,
|
53
|
+
EnvironmentFileLoader,
|
54
|
+
FileLoadContext,
|
55
|
+
FileLoaderStrategy,
|
56
|
+
LegacyFileLoader,
|
57
|
+
LoaderType,
|
58
|
+
ProgrammaticFileLoader,
|
59
|
+
StructuredFileLoader,
|
78
60
|
)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
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,
|
84
81
|
SchemaValidator,
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
create_api_schema,
|
92
|
-
create_logging_schema
|
82
|
+
TypeValidator,
|
83
|
+
UniqueValidator,
|
84
|
+
ValidationResult,
|
85
|
+
ValidationRule,
|
86
|
+
ValidationStrategy,
|
87
|
+
ValidationType,
|
93
88
|
)
|
94
89
|
|
95
90
|
# Create singleton instance for global use
|
@@ -103,88 +98,78 @@ ConfigLoader = UnifiedConfigService
|
|
103
98
|
# Export all public APIs
|
104
99
|
__all__ = [
|
105
100
|
# Main service
|
106
|
-
|
107
|
-
|
108
|
-
|
101
|
+
"UnifiedConfigService",
|
102
|
+
"unified_config",
|
109
103
|
# Strategies
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
104
|
+
"FileLoaderStrategy",
|
105
|
+
"ValidationStrategy",
|
106
|
+
"ErrorHandlingStrategy",
|
107
|
+
"ContextStrategy",
|
115
108
|
# Core types
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
109
|
+
"ConfigFormat",
|
110
|
+
"ConfigContext",
|
111
|
+
"ConfigMetadata",
|
112
|
+
"IConfigStrategy",
|
121
113
|
# File loading
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
114
|
+
"LoaderType",
|
115
|
+
"FileLoadContext",
|
116
|
+
"StructuredFileLoader",
|
117
|
+
"EnvironmentFileLoader",
|
118
|
+
"ProgrammaticFileLoader",
|
119
|
+
"LegacyFileLoader",
|
120
|
+
"CompositeFileLoader",
|
130
121
|
# Validation
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
122
|
+
"ValidationRule",
|
123
|
+
"ValidationResult",
|
124
|
+
"ValidationType",
|
135
125
|
# Error handling
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
126
|
+
"ErrorContext",
|
127
|
+
"ErrorHandlingResult",
|
128
|
+
"ErrorCategory",
|
129
|
+
"ErrorSeverity",
|
141
130
|
# Context management
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
131
|
+
"ContextScope",
|
132
|
+
"ContextLifecycle",
|
133
|
+
"HierarchicalContextManager",
|
134
|
+
"ScopedConfigManager",
|
147
135
|
# Schema
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
136
|
+
"ConfigSchema",
|
137
|
+
"SchemaProperty",
|
138
|
+
"SchemaBuilder",
|
139
|
+
"SchemaValidator",
|
140
|
+
"SchemaRegistry",
|
141
|
+
"ConfigMigration",
|
142
|
+
"TypedConfig",
|
143
|
+
"SchemaType",
|
144
|
+
"SchemaFormat",
|
158
145
|
# Backward compatibility
|
159
|
-
|
160
|
-
|
161
|
-
|
146
|
+
"ConfigService",
|
147
|
+
"ConfigManager",
|
148
|
+
"ConfigLoader",
|
162
149
|
]
|
163
150
|
|
151
|
+
|
164
152
|
# Module initialization
|
165
153
|
def initialize():
|
166
154
|
"""Initialize the unified configuration system"""
|
167
155
|
# Register default strategies
|
168
|
-
unified_config.register_strategy(
|
169
|
-
unified_config.register_strategy(
|
170
|
-
unified_config.register_strategy(
|
171
|
-
unified_config.register_strategy(
|
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())
|
172
160
|
|
173
161
|
# Set up default error handlers
|
174
162
|
error_strategy = ErrorHandlingStrategy()
|
175
163
|
|
176
164
|
# Register recovery strategies
|
177
165
|
error_strategy.register_recovery_strategy(
|
178
|
-
|
179
|
-
lambda ctx: ctx.metadata.get('default_config', {})
|
166
|
+
"default_fallback", lambda ctx: ctx.metadata.get("default_config", {})
|
180
167
|
)
|
181
168
|
|
182
|
-
error_strategy.register_recovery_strategy(
|
183
|
-
'empty_fallback',
|
184
|
-
lambda ctx: {}
|
185
|
-
)
|
169
|
+
error_strategy.register_recovery_strategy("empty_fallback", lambda ctx: {})
|
186
170
|
|
187
171
|
return unified_config
|
188
172
|
|
173
|
+
|
189
174
|
# Auto-initialize on import
|
190
|
-
_unified_instance = initialize()
|
175
|
+
_unified_instance = initialize()
|