claude-mpm 4.3.22__py3-none-any.whl → 4.4.0__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/cli/commands/doctor.py +2 -2
- claude_mpm/hooks/memory_integration_hook.py +1 -1
- claude_mpm/services/agents/memory/content_manager.py +5 -2
- claude_mpm/services/agents/memory/memory_file_service.py +1 -0
- claude_mpm/services/agents/memory/memory_limits_service.py +1 -0
- claude_mpm/services/unified/__init__.py +65 -0
- claude_mpm/services/unified/analyzer_strategies/__init__.py +44 -0
- claude_mpm/services/unified/analyzer_strategies/code_analyzer.py +473 -0
- claude_mpm/services/unified/analyzer_strategies/dependency_analyzer.py +643 -0
- claude_mpm/services/unified/analyzer_strategies/performance_analyzer.py +804 -0
- claude_mpm/services/unified/analyzer_strategies/security_analyzer.py +661 -0
- claude_mpm/services/unified/analyzer_strategies/structure_analyzer.py +696 -0
- claude_mpm/services/unified/deployment_strategies/__init__.py +97 -0
- claude_mpm/services/unified/deployment_strategies/base.py +557 -0
- claude_mpm/services/unified/deployment_strategies/cloud_strategies.py +486 -0
- claude_mpm/services/unified/deployment_strategies/local.py +594 -0
- claude_mpm/services/unified/deployment_strategies/utils.py +672 -0
- claude_mpm/services/unified/deployment_strategies/vercel.py +471 -0
- claude_mpm/services/unified/interfaces.py +499 -0
- claude_mpm/services/unified/migration.py +532 -0
- claude_mpm/services/unified/strategies.py +551 -0
- claude_mpm/services/unified/unified_analyzer.py +534 -0
- claude_mpm/services/unified/unified_config.py +688 -0
- claude_mpm/services/unified/unified_deployment.py +470 -0
- {claude_mpm-4.3.22.dist-info → claude_mpm-4.4.0.dist-info}/METADATA +1 -1
- {claude_mpm-4.3.22.dist-info → claude_mpm-4.4.0.dist-info}/RECORD +31 -12
- {claude_mpm-4.3.22.dist-info → claude_mpm-4.4.0.dist-info}/WHEEL +0 -0
- {claude_mpm-4.3.22.dist-info → claude_mpm-4.4.0.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.3.22.dist-info → claude_mpm-4.4.0.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.3.22.dist-info → claude_mpm-4.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,499 @@
|
|
1
|
+
"""
|
2
|
+
Base Service Interfaces for Unified Services
|
3
|
+
============================================
|
4
|
+
|
5
|
+
This module provides the foundational interfaces for the Phase 2 service consolidation
|
6
|
+
effort. These interfaces establish common contracts for consolidated service categories,
|
7
|
+
enabling the reduction of 314 service files to approximately 180 more maintainable services.
|
8
|
+
|
9
|
+
Design Principles:
|
10
|
+
1. Common operations are standardized across service types
|
11
|
+
2. Strategy pattern support for pluggable implementations
|
12
|
+
3. Backward compatibility with existing service interfaces
|
13
|
+
4. Rich metadata for service discovery and management
|
14
|
+
5. Support for async operations where appropriate
|
15
|
+
|
16
|
+
Service Categories:
|
17
|
+
- Deployment Services: Agent deployment, configuration deployment, etc.
|
18
|
+
- Analyzer Services: Code analysis, complexity analysis, dependency analysis, etc.
|
19
|
+
- Configuration Services: Project config, agent config, environment config, etc.
|
20
|
+
"""
|
21
|
+
|
22
|
+
from abc import ABC, abstractmethod
|
23
|
+
from dataclasses import dataclass, field
|
24
|
+
from enum import Enum
|
25
|
+
from pathlib import Path
|
26
|
+
from typing import Any, Dict, List, Optional, Set, TypeVar, Union
|
27
|
+
|
28
|
+
# Type variables for generic interfaces
|
29
|
+
T = TypeVar("T")
|
30
|
+
ConfigType = TypeVar("ConfigType", bound=Dict[str, Any])
|
31
|
+
|
32
|
+
|
33
|
+
class ServiceCapability(Enum):
|
34
|
+
"""Enumeration of service capabilities for feature discovery."""
|
35
|
+
|
36
|
+
ASYNC_OPERATIONS = "async_operations"
|
37
|
+
BATCH_PROCESSING = "batch_processing"
|
38
|
+
CACHING = "caching"
|
39
|
+
VALIDATION = "validation"
|
40
|
+
MONITORING = "monitoring"
|
41
|
+
HEALTH_CHECK = "health_check"
|
42
|
+
HOT_RELOAD = "hot_reload"
|
43
|
+
VERSIONING = "versioning"
|
44
|
+
ROLLBACK = "rollback"
|
45
|
+
METRICS = "metrics"
|
46
|
+
|
47
|
+
|
48
|
+
@dataclass
|
49
|
+
class ServiceMetadata:
|
50
|
+
"""
|
51
|
+
Metadata for unified services providing rich service information.
|
52
|
+
|
53
|
+
Attributes:
|
54
|
+
name: Service identifier name
|
55
|
+
version: Service implementation version
|
56
|
+
capabilities: Set of supported capabilities
|
57
|
+
dependencies: List of required service dependencies
|
58
|
+
description: Human-readable service description
|
59
|
+
tags: Additional categorization tags
|
60
|
+
deprecated_services: List of legacy services this replaces
|
61
|
+
"""
|
62
|
+
|
63
|
+
name: str
|
64
|
+
version: str
|
65
|
+
capabilities: Set[ServiceCapability] = field(default_factory=set)
|
66
|
+
dependencies: List[str] = field(default_factory=list)
|
67
|
+
description: str = ""
|
68
|
+
tags: Set[str] = field(default_factory=set)
|
69
|
+
deprecated_services: List[str] = field(default_factory=list)
|
70
|
+
|
71
|
+
|
72
|
+
@dataclass
|
73
|
+
class DeploymentResult:
|
74
|
+
"""Result of a deployment operation."""
|
75
|
+
|
76
|
+
success: bool
|
77
|
+
deployed_path: Optional[Path] = None
|
78
|
+
message: str = ""
|
79
|
+
metadata: Dict[str, Any] = field(default_factory=dict)
|
80
|
+
rollback_info: Optional[Dict[str, Any]] = None
|
81
|
+
|
82
|
+
|
83
|
+
@dataclass
|
84
|
+
class AnalysisResult:
|
85
|
+
"""Result of an analysis operation."""
|
86
|
+
|
87
|
+
success: bool
|
88
|
+
findings: List[Dict[str, Any]] = field(default_factory=list)
|
89
|
+
metrics: Dict[str, Any] = field(default_factory=dict)
|
90
|
+
summary: str = ""
|
91
|
+
severity: str = "info" # info, warning, error, critical
|
92
|
+
recommendations: List[str] = field(default_factory=list)
|
93
|
+
|
94
|
+
|
95
|
+
@dataclass
|
96
|
+
class ConfigurationResult:
|
97
|
+
"""Result of a configuration operation."""
|
98
|
+
|
99
|
+
success: bool
|
100
|
+
config: Dict[str, Any] = field(default_factory=dict)
|
101
|
+
validation_errors: List[str] = field(default_factory=list)
|
102
|
+
applied_defaults: Dict[str, Any] = field(default_factory=dict)
|
103
|
+
source: str = "" # file, environment, default, etc.
|
104
|
+
|
105
|
+
|
106
|
+
class IDeploymentService(ABC):
|
107
|
+
"""
|
108
|
+
Common interface for all deployment services.
|
109
|
+
|
110
|
+
This interface consolidates deployment operations across various service types
|
111
|
+
including agent deployment, configuration deployment, and resource deployment.
|
112
|
+
Implementations should use the strategy pattern for specific deployment types.
|
113
|
+
"""
|
114
|
+
|
115
|
+
@abstractmethod
|
116
|
+
def get_metadata(self) -> ServiceMetadata:
|
117
|
+
"""
|
118
|
+
Get service metadata including capabilities and dependencies.
|
119
|
+
|
120
|
+
Returns:
|
121
|
+
ServiceMetadata: Complete service metadata
|
122
|
+
"""
|
123
|
+
pass
|
124
|
+
|
125
|
+
@abstractmethod
|
126
|
+
def validate_deployment(
|
127
|
+
self, target: Union[str, Path], config: Dict[str, Any]
|
128
|
+
) -> List[str]:
|
129
|
+
"""
|
130
|
+
Validate deployment configuration before execution.
|
131
|
+
|
132
|
+
Args:
|
133
|
+
target: Deployment target (path, identifier, etc.)
|
134
|
+
config: Deployment configuration
|
135
|
+
|
136
|
+
Returns:
|
137
|
+
List[str]: List of validation errors (empty if valid)
|
138
|
+
"""
|
139
|
+
pass
|
140
|
+
|
141
|
+
@abstractmethod
|
142
|
+
def deploy(
|
143
|
+
self,
|
144
|
+
source: Union[str, Path],
|
145
|
+
target: Union[str, Path],
|
146
|
+
config: Optional[Dict[str, Any]] = None,
|
147
|
+
force: bool = False,
|
148
|
+
) -> DeploymentResult:
|
149
|
+
"""
|
150
|
+
Execute deployment operation.
|
151
|
+
|
152
|
+
Args:
|
153
|
+
source: Source to deploy from
|
154
|
+
target: Target to deploy to
|
155
|
+
config: Optional deployment configuration
|
156
|
+
force: Force deployment even if target exists
|
157
|
+
|
158
|
+
Returns:
|
159
|
+
DeploymentResult: Result of the deployment operation
|
160
|
+
"""
|
161
|
+
pass
|
162
|
+
|
163
|
+
@abstractmethod
|
164
|
+
def rollback(
|
165
|
+
self, deployment_id: str, rollback_info: Dict[str, Any]
|
166
|
+
) -> DeploymentResult:
|
167
|
+
"""
|
168
|
+
Rollback a previous deployment.
|
169
|
+
|
170
|
+
Args:
|
171
|
+
deployment_id: Identifier of deployment to rollback
|
172
|
+
rollback_info: Information needed for rollback
|
173
|
+
|
174
|
+
Returns:
|
175
|
+
DeploymentResult: Result of the rollback operation
|
176
|
+
"""
|
177
|
+
pass
|
178
|
+
|
179
|
+
@abstractmethod
|
180
|
+
def list_deployments(
|
181
|
+
self, target: Optional[Union[str, Path]] = None
|
182
|
+
) -> List[Dict[str, Any]]:
|
183
|
+
"""
|
184
|
+
List existing deployments.
|
185
|
+
|
186
|
+
Args:
|
187
|
+
target: Optional target to filter deployments
|
188
|
+
|
189
|
+
Returns:
|
190
|
+
List[Dict[str, Any]]: List of deployment information
|
191
|
+
"""
|
192
|
+
pass
|
193
|
+
|
194
|
+
@abstractmethod
|
195
|
+
def get_deployment_status(self, deployment_id: str) -> Dict[str, Any]:
|
196
|
+
"""
|
197
|
+
Get status of a specific deployment.
|
198
|
+
|
199
|
+
Args:
|
200
|
+
deployment_id: Identifier of deployment
|
201
|
+
|
202
|
+
Returns:
|
203
|
+
Dict[str, Any]: Deployment status information
|
204
|
+
"""
|
205
|
+
pass
|
206
|
+
|
207
|
+
|
208
|
+
class IAnalyzerService(ABC):
|
209
|
+
"""
|
210
|
+
Common interface for all analyzer services.
|
211
|
+
|
212
|
+
This interface consolidates analysis operations across various service types
|
213
|
+
including code analysis, complexity analysis, dependency analysis, and performance analysis.
|
214
|
+
Implementations should use the strategy pattern for specific analysis types.
|
215
|
+
"""
|
216
|
+
|
217
|
+
@abstractmethod
|
218
|
+
def get_metadata(self) -> ServiceMetadata:
|
219
|
+
"""
|
220
|
+
Get service metadata including capabilities and dependencies.
|
221
|
+
|
222
|
+
Returns:
|
223
|
+
ServiceMetadata: Complete service metadata
|
224
|
+
"""
|
225
|
+
pass
|
226
|
+
|
227
|
+
@abstractmethod
|
228
|
+
def analyze(
|
229
|
+
self,
|
230
|
+
target: Union[str, Path, Any],
|
231
|
+
options: Optional[Dict[str, Any]] = None,
|
232
|
+
) -> AnalysisResult:
|
233
|
+
"""
|
234
|
+
Perform analysis on the target.
|
235
|
+
|
236
|
+
Args:
|
237
|
+
target: Target to analyze (file, directory, object, etc.)
|
238
|
+
options: Analysis options and parameters
|
239
|
+
|
240
|
+
Returns:
|
241
|
+
AnalysisResult: Result of the analysis
|
242
|
+
"""
|
243
|
+
pass
|
244
|
+
|
245
|
+
@abstractmethod
|
246
|
+
def batch_analyze(
|
247
|
+
self,
|
248
|
+
targets: List[Union[str, Path, Any]],
|
249
|
+
options: Optional[Dict[str, Any]] = None,
|
250
|
+
) -> List[AnalysisResult]:
|
251
|
+
"""
|
252
|
+
Perform batch analysis on multiple targets.
|
253
|
+
|
254
|
+
Args:
|
255
|
+
targets: List of targets to analyze
|
256
|
+
options: Analysis options and parameters
|
257
|
+
|
258
|
+
Returns:
|
259
|
+
List[AnalysisResult]: Results for each target
|
260
|
+
"""
|
261
|
+
pass
|
262
|
+
|
263
|
+
@abstractmethod
|
264
|
+
def get_metrics(self, target: Union[str, Path, Any]) -> Dict[str, Any]:
|
265
|
+
"""
|
266
|
+
Get analysis metrics for a target.
|
267
|
+
|
268
|
+
Args:
|
269
|
+
target: Target to get metrics for
|
270
|
+
|
271
|
+
Returns:
|
272
|
+
Dict[str, Any]: Analysis metrics
|
273
|
+
"""
|
274
|
+
pass
|
275
|
+
|
276
|
+
@abstractmethod
|
277
|
+
def compare(
|
278
|
+
self,
|
279
|
+
target1: Union[str, Path, Any],
|
280
|
+
target2: Union[str, Path, Any],
|
281
|
+
options: Optional[Dict[str, Any]] = None,
|
282
|
+
) -> Dict[str, Any]:
|
283
|
+
"""
|
284
|
+
Compare two targets and analyze differences.
|
285
|
+
|
286
|
+
Args:
|
287
|
+
target1: First target
|
288
|
+
target2: Second target
|
289
|
+
options: Comparison options
|
290
|
+
|
291
|
+
Returns:
|
292
|
+
Dict[str, Any]: Comparison results
|
293
|
+
"""
|
294
|
+
pass
|
295
|
+
|
296
|
+
@abstractmethod
|
297
|
+
def get_recommendations(
|
298
|
+
self, analysis_result: AnalysisResult
|
299
|
+
) -> List[Dict[str, Any]]:
|
300
|
+
"""
|
301
|
+
Get recommendations based on analysis results.
|
302
|
+
|
303
|
+
Args:
|
304
|
+
analysis_result: Previous analysis result
|
305
|
+
|
306
|
+
Returns:
|
307
|
+
List[Dict[str, Any]]: List of recommendations
|
308
|
+
"""
|
309
|
+
pass
|
310
|
+
|
311
|
+
|
312
|
+
class IConfigurationService(ABC):
|
313
|
+
"""
|
314
|
+
Common interface for configuration services.
|
315
|
+
|
316
|
+
This interface consolidates configuration management operations across various
|
317
|
+
service types including project configuration, agent configuration, and environment configuration.
|
318
|
+
Implementations should use the strategy pattern for specific configuration types.
|
319
|
+
"""
|
320
|
+
|
321
|
+
@abstractmethod
|
322
|
+
def get_metadata(self) -> ServiceMetadata:
|
323
|
+
"""
|
324
|
+
Get service metadata including capabilities and dependencies.
|
325
|
+
|
326
|
+
Returns:
|
327
|
+
ServiceMetadata: Complete service metadata
|
328
|
+
"""
|
329
|
+
pass
|
330
|
+
|
331
|
+
@abstractmethod
|
332
|
+
def load_config(
|
333
|
+
self, source: Union[str, Path, Dict[str, Any]]
|
334
|
+
) -> ConfigurationResult:
|
335
|
+
"""
|
336
|
+
Load configuration from source.
|
337
|
+
|
338
|
+
Args:
|
339
|
+
source: Configuration source (file path, dict, etc.)
|
340
|
+
|
341
|
+
Returns:
|
342
|
+
ConfigurationResult: Loaded configuration result
|
343
|
+
"""
|
344
|
+
pass
|
345
|
+
|
346
|
+
@abstractmethod
|
347
|
+
def save_config(
|
348
|
+
self, config: Dict[str, Any], target: Union[str, Path]
|
349
|
+
) -> ConfigurationResult:
|
350
|
+
"""
|
351
|
+
Save configuration to target.
|
352
|
+
|
353
|
+
Args:
|
354
|
+
config: Configuration to save
|
355
|
+
target: Target location
|
356
|
+
|
357
|
+
Returns:
|
358
|
+
ConfigurationResult: Save operation result
|
359
|
+
"""
|
360
|
+
pass
|
361
|
+
|
362
|
+
@abstractmethod
|
363
|
+
def validate_config(self, config: Dict[str, Any]) -> List[str]:
|
364
|
+
"""
|
365
|
+
Validate configuration against schema.
|
366
|
+
|
367
|
+
Args:
|
368
|
+
config: Configuration to validate
|
369
|
+
|
370
|
+
Returns:
|
371
|
+
List[str]: List of validation errors (empty if valid)
|
372
|
+
"""
|
373
|
+
pass
|
374
|
+
|
375
|
+
@abstractmethod
|
376
|
+
def merge_configs(
|
377
|
+
self, *configs: Dict[str, Any], strategy: str = "deep"
|
378
|
+
) -> Dict[str, Any]:
|
379
|
+
"""
|
380
|
+
Merge multiple configurations.
|
381
|
+
|
382
|
+
Args:
|
383
|
+
*configs: Configurations to merge
|
384
|
+
strategy: Merge strategy ('deep', 'shallow', 'override')
|
385
|
+
|
386
|
+
Returns:
|
387
|
+
Dict[str, Any]: Merged configuration
|
388
|
+
"""
|
389
|
+
pass
|
390
|
+
|
391
|
+
@abstractmethod
|
392
|
+
def get_config_value(
|
393
|
+
self, key: str, default: Any = None, config: Optional[Dict[str, Any]] = None
|
394
|
+
) -> Any:
|
395
|
+
"""
|
396
|
+
Get configuration value by key with optional default.
|
397
|
+
|
398
|
+
Args:
|
399
|
+
key: Configuration key (supports dot notation)
|
400
|
+
default: Default value if key not found
|
401
|
+
config: Optional config dict (uses loaded config if None)
|
402
|
+
|
403
|
+
Returns:
|
404
|
+
Any: Configuration value
|
405
|
+
"""
|
406
|
+
pass
|
407
|
+
|
408
|
+
@abstractmethod
|
409
|
+
def set_config_value(
|
410
|
+
self, key: str, value: Any, config: Optional[Dict[str, Any]] = None
|
411
|
+
) -> ConfigurationResult:
|
412
|
+
"""
|
413
|
+
Set configuration value by key.
|
414
|
+
|
415
|
+
Args:
|
416
|
+
key: Configuration key (supports dot notation)
|
417
|
+
value: Value to set
|
418
|
+
config: Optional config dict to modify
|
419
|
+
|
420
|
+
Returns:
|
421
|
+
ConfigurationResult: Result of set operation
|
422
|
+
"""
|
423
|
+
pass
|
424
|
+
|
425
|
+
@abstractmethod
|
426
|
+
def get_schema(self) -> Dict[str, Any]:
|
427
|
+
"""
|
428
|
+
Get configuration schema definition.
|
429
|
+
|
430
|
+
Returns:
|
431
|
+
Dict[str, Any]: Configuration schema
|
432
|
+
"""
|
433
|
+
pass
|
434
|
+
|
435
|
+
@abstractmethod
|
436
|
+
def apply_defaults(self, config: Dict[str, Any]) -> Dict[str, Any]:
|
437
|
+
"""
|
438
|
+
Apply default values to configuration.
|
439
|
+
|
440
|
+
Args:
|
441
|
+
config: Configuration to apply defaults to
|
442
|
+
|
443
|
+
Returns:
|
444
|
+
Dict[str, Any]: Configuration with defaults applied
|
445
|
+
"""
|
446
|
+
pass
|
447
|
+
|
448
|
+
|
449
|
+
class IUnifiedService(ABC):
|
450
|
+
"""
|
451
|
+
Base interface for all unified services providing common lifecycle operations.
|
452
|
+
|
453
|
+
This interface ensures all unified services support basic lifecycle management,
|
454
|
+
health checking, and service discovery capabilities.
|
455
|
+
"""
|
456
|
+
|
457
|
+
@abstractmethod
|
458
|
+
async def initialize(self) -> bool:
|
459
|
+
"""
|
460
|
+
Initialize the service and its dependencies.
|
461
|
+
|
462
|
+
Returns:
|
463
|
+
bool: True if initialization successful
|
464
|
+
"""
|
465
|
+
pass
|
466
|
+
|
467
|
+
@abstractmethod
|
468
|
+
async def shutdown(self) -> None:
|
469
|
+
"""
|
470
|
+
Gracefully shutdown the service.
|
471
|
+
"""
|
472
|
+
pass
|
473
|
+
|
474
|
+
@abstractmethod
|
475
|
+
def health_check(self) -> Dict[str, Any]:
|
476
|
+
"""
|
477
|
+
Perform health check on the service.
|
478
|
+
|
479
|
+
Returns:
|
480
|
+
Dict[str, Any]: Health status information
|
481
|
+
"""
|
482
|
+
pass
|
483
|
+
|
484
|
+
@abstractmethod
|
485
|
+
def get_metrics(self) -> Dict[str, Any]:
|
486
|
+
"""
|
487
|
+
Get service metrics.
|
488
|
+
|
489
|
+
Returns:
|
490
|
+
Dict[str, Any]: Service metrics
|
491
|
+
"""
|
492
|
+
pass
|
493
|
+
|
494
|
+
@abstractmethod
|
495
|
+
def reset(self) -> None:
|
496
|
+
"""
|
497
|
+
Reset service to initial state.
|
498
|
+
"""
|
499
|
+
pass
|