claude-mpm 4.12.1__py3-none-any.whl → 4.13.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.

Potentially problematic release.


This version of claude-mpm might be problematic. Click here for more details.

Files changed (38) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/PM_INSTRUCTIONS.md +110 -459
  3. claude_mpm/agents/templates/README.md +465 -0
  4. claude_mpm/agents/templates/circuit_breakers.md +638 -0
  5. claude_mpm/agents/templates/git_file_tracking.md +584 -0
  6. claude_mpm/agents/templates/pm_examples.md +474 -0
  7. claude_mpm/agents/templates/pm_red_flags.md +240 -0
  8. claude_mpm/agents/templates/response_format.md +583 -0
  9. claude_mpm/agents/templates/validation_templates.md +312 -0
  10. claude_mpm/cli/__init__.py +10 -0
  11. claude_mpm/cli/commands/agents.py +31 -0
  12. claude_mpm/cli/commands/agents_detect.py +380 -0
  13. claude_mpm/cli/commands/agents_recommend.py +309 -0
  14. claude_mpm/cli/commands/auto_configure.py +564 -0
  15. claude_mpm/cli/parsers/agents_parser.py +9 -0
  16. claude_mpm/cli/parsers/auto_configure_parser.py +253 -0
  17. claude_mpm/cli/parsers/base_parser.py +7 -0
  18. claude_mpm/core/log_manager.py +2 -0
  19. claude_mpm/services/agents/__init__.py +18 -5
  20. claude_mpm/services/agents/auto_config_manager.py +797 -0
  21. claude_mpm/services/agents/observers.py +547 -0
  22. claude_mpm/services/agents/recommender.py +568 -0
  23. claude_mpm/services/core/__init__.py +33 -1
  24. claude_mpm/services/core/interfaces/__init__.py +16 -1
  25. claude_mpm/services/core/interfaces/agent.py +184 -0
  26. claude_mpm/services/core/interfaces/project.py +121 -0
  27. claude_mpm/services/core/models/__init__.py +46 -0
  28. claude_mpm/services/core/models/agent_config.py +397 -0
  29. claude_mpm/services/core/models/toolchain.py +306 -0
  30. claude_mpm/services/project/__init__.py +23 -0
  31. claude_mpm/services/project/detection_strategies.py +719 -0
  32. claude_mpm/services/project/toolchain_analyzer.py +581 -0
  33. {claude_mpm-4.12.1.dist-info → claude_mpm-4.13.0.dist-info}/METADATA +1 -1
  34. {claude_mpm-4.12.1.dist-info → claude_mpm-4.13.0.dist-info}/RECORD +38 -18
  35. {claude_mpm-4.12.1.dist-info → claude_mpm-4.13.0.dist-info}/WHEEL +0 -0
  36. {claude_mpm-4.12.1.dist-info → claude_mpm-4.13.0.dist-info}/entry_points.txt +0 -0
  37. {claude_mpm-4.12.1.dist-info → claude_mpm-4.13.0.dist-info}/licenses/LICENSE +0 -0
  38. {claude_mpm-4.12.1.dist-info → claude_mpm-4.13.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,253 @@
1
+ """
2
+ Auto-Configuration Parser for Claude MPM CLI
3
+ ============================================
4
+
5
+ WHY: This module provides argument parsing for auto-configuration commands,
6
+ enabling users to customize detection, recommendation, and deployment behavior.
7
+
8
+ DESIGN DECISION: Follows existing parser patterns in the codebase, using
9
+ add_common_arguments for consistency. Provides sensible defaults while
10
+ allowing full customization.
11
+
12
+ Part of TSK-0054: Auto-Configuration Feature - Phase 5
13
+ """
14
+
15
+ import argparse
16
+ from pathlib import Path
17
+
18
+ from .base_parser import add_common_arguments
19
+
20
+
21
+ def add_auto_configure_subparser(subparsers) -> argparse.ArgumentParser:
22
+ """
23
+ Add the auto-configure subparser for automated agent configuration.
24
+
25
+ WHY: Auto-configuration simplifies onboarding by detecting project toolchain
26
+ and deploying appropriate agents automatically.
27
+
28
+ Args:
29
+ subparsers: The subparsers object from the main parser
30
+
31
+ Returns:
32
+ The configured auto-configure subparser
33
+ """
34
+ # Auto-configure command
35
+ auto_configure_parser = subparsers.add_parser(
36
+ "auto-configure",
37
+ help="Auto-configure agents based on project toolchain detection",
38
+ description="""
39
+ Auto-configure agents for your project based on detected toolchain.
40
+
41
+ This command analyzes your project to detect languages, frameworks, and
42
+ deployment targets, then recommends and deploys appropriate specialized
43
+ agents automatically.
44
+
45
+ The command provides safety features including:
46
+ • Preview mode to see changes before applying
47
+ • Confidence thresholds to ensure quality matches
48
+ • Validation gates to block invalid configurations
49
+ • Rollback on failure to maintain consistency
50
+ """,
51
+ formatter_class=argparse.RawDescriptionHelpFormatter,
52
+ epilog="""
53
+ Examples:
54
+ # Interactive configuration with confirmation
55
+ claude-mpm auto-configure
56
+
57
+ # Preview configuration without deploying
58
+ claude-mpm auto-configure --preview
59
+
60
+ # Auto-approve deployment (for scripts)
61
+ claude-mpm auto-configure --yes
62
+
63
+ # Require 90% confidence for recommendations
64
+ claude-mpm auto-configure --min-confidence 0.9
65
+
66
+ # JSON output for scripting
67
+ claude-mpm auto-configure --json
68
+
69
+ # Configure specific project directory
70
+ claude-mpm auto-configure --project-path /path/to/project
71
+ """,
72
+ )
73
+ add_common_arguments(auto_configure_parser)
74
+
75
+ # Configuration mode
76
+ mode_group = auto_configure_parser.add_mutually_exclusive_group()
77
+ mode_group.add_argument(
78
+ "--preview",
79
+ "--dry-run",
80
+ dest="preview",
81
+ action="store_true",
82
+ help="Show what would be configured without deploying (preview mode)",
83
+ )
84
+ mode_group.add_argument(
85
+ "--yes",
86
+ "-y",
87
+ action="store_true",
88
+ help="Skip confirmation prompts and deploy automatically",
89
+ )
90
+
91
+ # Configuration options
92
+ auto_configure_parser.add_argument(
93
+ "--min-confidence",
94
+ type=float,
95
+ default=0.8,
96
+ metavar="FLOAT",
97
+ help="Minimum confidence threshold for recommendations (0.0-1.0, default: 0.8)",
98
+ )
99
+
100
+ auto_configure_parser.add_argument(
101
+ "--project-path",
102
+ type=Path,
103
+ metavar="PATH",
104
+ help="Project path to analyze (default: current directory)",
105
+ )
106
+
107
+ # Add dry-run as an alias for --preview
108
+ auto_configure_parser.add_argument(
109
+ "--dry-run",
110
+ dest="dry_run",
111
+ action="store_true",
112
+ help=argparse.SUPPRESS, # Hidden, use --preview instead
113
+ )
114
+
115
+ return auto_configure_parser
116
+
117
+
118
+ def add_agents_detect_subparser(agents_subparsers) -> argparse.ArgumentParser:
119
+ """
120
+ Add the agents detect subparser for toolchain detection.
121
+
122
+ WHY: Allows users to see what toolchain is detected without making changes,
123
+ useful for debugging and verification.
124
+
125
+ Args:
126
+ agents_subparsers: The agents subparsers object
127
+
128
+ Returns:
129
+ The configured detect subparser
130
+ """
131
+ detect_parser = agents_subparsers.add_parser(
132
+ "detect",
133
+ help="Detect project toolchain without deploying",
134
+ description="""
135
+ Detect and display project toolchain without making any changes.
136
+
137
+ This command analyzes your project to detect:
138
+ • Programming languages and versions
139
+ • Frameworks and libraries
140
+ • Deployment targets and platforms
141
+
142
+ Useful for debugging toolchain detection and verifying what would be
143
+ detected before running auto-configure.
144
+ """,
145
+ formatter_class=argparse.RawDescriptionHelpFormatter,
146
+ epilog="""
147
+ Examples:
148
+ # Detect toolchain in current directory
149
+ claude-mpm agents detect
150
+
151
+ # Detect with verbose output showing evidence
152
+ claude-mpm agents detect --verbose
153
+
154
+ # JSON output for scripting
155
+ claude-mpm agents detect --json
156
+
157
+ # Detect specific project
158
+ claude-mpm agents detect --project-path /path/to/project
159
+ """,
160
+ )
161
+ add_common_arguments(detect_parser)
162
+
163
+ detect_parser.add_argument(
164
+ "--project-path",
165
+ type=Path,
166
+ metavar="PATH",
167
+ help="Project path to analyze (default: current directory)",
168
+ )
169
+
170
+ return detect_parser
171
+
172
+
173
+ def add_agents_recommend_subparser(
174
+ agents_subparsers,
175
+ ) -> argparse.ArgumentParser:
176
+ """
177
+ Add the agents recommend subparser for agent recommendations.
178
+
179
+ WHY: Allows users to see what agents would be recommended without deploying,
180
+ useful for reviewing recommendations before committing to deployment.
181
+
182
+ Args:
183
+ agents_subparsers: The agents subparsers object
184
+
185
+ Returns:
186
+ The configured recommend subparser
187
+ """
188
+ recommend_parser = agents_subparsers.add_parser(
189
+ "recommend",
190
+ help="Show recommended agents without deploying",
191
+ description="""
192
+ Show recommended agents based on project toolchain without deploying.
193
+
194
+ This command analyzes your project toolchain and recommends appropriate
195
+ agents with detailed reasoning for each recommendation. No changes are
196
+ made to your project.
197
+
198
+ Useful for:
199
+ • Reviewing recommendations before deployment
200
+ • Understanding why agents are recommended
201
+ • Adjusting confidence thresholds
202
+ """,
203
+ formatter_class=argparse.RawDescriptionHelpFormatter,
204
+ epilog="""
205
+ Examples:
206
+ # Show recommendations with reasoning
207
+ claude-mpm agents recommend
208
+
209
+ # Require 90% confidence for recommendations
210
+ claude-mpm agents recommend --min-confidence 0.9
211
+
212
+ # JSON output for scripting
213
+ claude-mpm agents recommend --json
214
+
215
+ # Hide detailed reasoning
216
+ claude-mpm agents recommend --no-reasoning
217
+
218
+ # Recommend for specific project
219
+ claude-mpm agents recommend --project-path /path/to/project
220
+ """,
221
+ )
222
+ add_common_arguments(recommend_parser)
223
+
224
+ recommend_parser.add_argument(
225
+ "--project-path",
226
+ type=Path,
227
+ metavar="PATH",
228
+ help="Project path to analyze (default: current directory)",
229
+ )
230
+
231
+ recommend_parser.add_argument(
232
+ "--min-confidence",
233
+ type=float,
234
+ default=0.8,
235
+ metavar="FLOAT",
236
+ help="Minimum confidence threshold for recommendations (0.0-1.0, default: 0.8)",
237
+ )
238
+
239
+ recommend_parser.add_argument(
240
+ "--show-reasoning",
241
+ action="store_true",
242
+ default=True,
243
+ help="Show detailed reasoning for recommendations (default)",
244
+ )
245
+
246
+ recommend_parser.add_argument(
247
+ "--no-reasoning",
248
+ dest="show_reasoning",
249
+ action="store_false",
250
+ help="Hide detailed reasoning for recommendations",
251
+ )
252
+
253
+ return recommend_parser
@@ -301,6 +301,13 @@ def create_parser(
301
301
  except ImportError:
302
302
  pass
303
303
 
304
+ try:
305
+ from .auto_configure_parser import add_auto_configure_subparser
306
+
307
+ add_auto_configure_subparser(subparsers)
308
+ except ImportError:
309
+ pass
310
+
304
311
  try:
305
312
  from .memory_parser import add_memory_subparser
306
313
 
@@ -588,6 +588,8 @@ class LogManager:
588
588
 
589
589
  def write_task():
590
590
  try:
591
+ # Ensure directory exists before writing (race condition with cleanup)
592
+ log_dir.mkdir(parents=True, exist_ok=True)
591
593
  with log_file.open("a", encoding="utf-8") as f:
592
594
  f.write(log_entry)
593
595
  except Exception as e:
@@ -1,5 +1,8 @@
1
1
  """Agent services module - hierarchical organization of agent-related services."""
2
2
 
3
+ # Auto-configuration exports
4
+ from .auto_config_manager import AutoConfigManagerService
5
+
3
6
  # Registry exports
4
7
  # Deployment exports
5
8
  from .deployment.agent_deployment import AgentDeploymentService
@@ -29,6 +32,15 @@ from .memory.agent_persistence_service import (
29
32
  PersistenceRecord,
30
33
  PersistenceStrategy,
31
34
  )
35
+ from .observers import (
36
+ CompositeObserver,
37
+ ConsoleProgressObserver,
38
+ IDeploymentObserver,
39
+ NullObserver,
40
+ )
41
+
42
+ # Recommender exports
43
+ from .recommender import AgentRecommenderService
32
44
  from .registry import AgentMetadata, AgentRegistry, AgentTier, AgentType
33
45
  from .registry.deployed_agent_discovery import DeployedAgentDiscovery
34
46
  from .registry.modification_tracker import (
@@ -41,34 +53,35 @@ from .registry.modification_tracker import (
41
53
 
42
54
  __all__ = [
43
55
  "AgentCapabilitiesGenerator",
44
- # Deployment
45
56
  "AgentDeploymentService",
46
57
  "AgentLifecycleManager",
47
58
  "AgentLifecycleRecord",
48
- # Management
49
59
  "AgentManager",
50
- # Memory
51
60
  "AgentMemoryManager",
52
61
  "AgentMetadata",
53
62
  "AgentModification",
54
63
  "AgentModificationTracker",
55
64
  "AgentPersistenceService",
56
65
  "AgentProfileLoader",
57
- # Registry
66
+ "AgentRecommenderService",
58
67
  "AgentRegistry",
59
68
  "AgentTier",
60
69
  "AgentType",
61
70
  "AgentVersionManager",
71
+ "AutoConfigManagerService",
62
72
  "BaseAgentManager",
73
+ "CompositeObserver",
74
+ "ConsoleProgressObserver",
63
75
  "DeployedAgentDiscovery",
64
- # Loading
65
76
  "FrameworkAgentLoader",
77
+ "IDeploymentObserver",
66
78
  "LifecycleOperation",
67
79
  "LifecycleOperationResult",
68
80
  "LifecycleState",
69
81
  "ModificationHistory",
70
82
  "ModificationTier",
71
83
  "ModificationType",
84
+ "NullObserver",
72
85
  "PersistenceOperation",
73
86
  "PersistenceRecord",
74
87
  "PersistenceStrategy",