claude-mpm 4.7.4__py3-none-any.whl → 4.18.2__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.
Files changed (308) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/BASE_AGENT_TEMPLATE.md +118 -0
  3. claude_mpm/agents/BASE_ENGINEER.md +286 -0
  4. claude_mpm/agents/BASE_PM.md +106 -1
  5. claude_mpm/agents/OUTPUT_STYLE.md +329 -11
  6. claude_mpm/agents/PM_INSTRUCTIONS.md +397 -459
  7. claude_mpm/agents/agent_loader.py +17 -5
  8. claude_mpm/agents/frontmatter_validator.py +284 -253
  9. claude_mpm/agents/templates/README.md +465 -0
  10. claude_mpm/agents/templates/agent-manager.json +4 -1
  11. claude_mpm/agents/templates/agentic-coder-optimizer.json +13 -3
  12. claude_mpm/agents/templates/api_qa.json +11 -2
  13. claude_mpm/agents/templates/circuit_breakers.md +638 -0
  14. claude_mpm/agents/templates/clerk-ops.json +12 -2
  15. claude_mpm/agents/templates/code_analyzer.json +8 -2
  16. claude_mpm/agents/templates/content-agent.json +358 -0
  17. claude_mpm/agents/templates/dart_engineer.json +15 -2
  18. claude_mpm/agents/templates/data_engineer.json +15 -2
  19. claude_mpm/agents/templates/documentation.json +10 -2
  20. claude_mpm/agents/templates/engineer.json +21 -1
  21. claude_mpm/agents/templates/gcp_ops_agent.json +12 -2
  22. claude_mpm/agents/templates/git_file_tracking.md +584 -0
  23. claude_mpm/agents/templates/golang_engineer.json +270 -0
  24. claude_mpm/agents/templates/imagemagick.json +4 -1
  25. claude_mpm/agents/templates/java_engineer.json +346 -0
  26. claude_mpm/agents/templates/local_ops_agent.json +1227 -6
  27. claude_mpm/agents/templates/memory_manager.json +4 -1
  28. claude_mpm/agents/templates/nextjs_engineer.json +141 -133
  29. claude_mpm/agents/templates/ops.json +12 -2
  30. claude_mpm/agents/templates/php-engineer.json +270 -174
  31. claude_mpm/agents/templates/pm_examples.md +474 -0
  32. claude_mpm/agents/templates/pm_red_flags.md +240 -0
  33. claude_mpm/agents/templates/product_owner.json +338 -0
  34. claude_mpm/agents/templates/project_organizer.json +14 -4
  35. claude_mpm/agents/templates/prompt-engineer.json +13 -2
  36. claude_mpm/agents/templates/python_engineer.json +174 -81
  37. claude_mpm/agents/templates/qa.json +11 -2
  38. claude_mpm/agents/templates/react_engineer.json +16 -3
  39. claude_mpm/agents/templates/refactoring_engineer.json +12 -2
  40. claude_mpm/agents/templates/research.json +34 -21
  41. claude_mpm/agents/templates/response_format.md +583 -0
  42. claude_mpm/agents/templates/ruby-engineer.json +129 -192
  43. claude_mpm/agents/templates/rust_engineer.json +270 -0
  44. claude_mpm/agents/templates/security.json +10 -2
  45. claude_mpm/agents/templates/svelte-engineer.json +225 -0
  46. claude_mpm/agents/templates/ticketing.json +10 -2
  47. claude_mpm/agents/templates/typescript_engineer.json +116 -125
  48. claude_mpm/agents/templates/validation_templates.md +312 -0
  49. claude_mpm/agents/templates/vercel_ops_agent.json +12 -2
  50. claude_mpm/agents/templates/version_control.json +12 -2
  51. claude_mpm/agents/templates/web_qa.json +11 -2
  52. claude_mpm/agents/templates/web_ui.json +15 -2
  53. claude_mpm/cli/__init__.py +34 -614
  54. claude_mpm/cli/commands/agent_manager.py +25 -12
  55. claude_mpm/cli/commands/agent_state_manager.py +186 -0
  56. claude_mpm/cli/commands/agents.py +235 -148
  57. claude_mpm/cli/commands/agents_detect.py +380 -0
  58. claude_mpm/cli/commands/agents_recommend.py +309 -0
  59. claude_mpm/cli/commands/aggregate.py +7 -3
  60. claude_mpm/cli/commands/analyze.py +9 -4
  61. claude_mpm/cli/commands/analyze_code.py +7 -2
  62. claude_mpm/cli/commands/auto_configure.py +570 -0
  63. claude_mpm/cli/commands/config.py +47 -13
  64. claude_mpm/cli/commands/configure.py +419 -1571
  65. claude_mpm/cli/commands/configure_agent_display.py +261 -0
  66. claude_mpm/cli/commands/configure_behavior_manager.py +204 -0
  67. claude_mpm/cli/commands/configure_hook_manager.py +225 -0
  68. claude_mpm/cli/commands/configure_models.py +18 -0
  69. claude_mpm/cli/commands/configure_navigation.py +167 -0
  70. claude_mpm/cli/commands/configure_paths.py +104 -0
  71. claude_mpm/cli/commands/configure_persistence.py +254 -0
  72. claude_mpm/cli/commands/configure_startup_manager.py +646 -0
  73. claude_mpm/cli/commands/configure_template_editor.py +497 -0
  74. claude_mpm/cli/commands/configure_validators.py +73 -0
  75. claude_mpm/cli/commands/local_deploy.py +537 -0
  76. claude_mpm/cli/commands/memory.py +54 -20
  77. claude_mpm/cli/commands/mpm_init.py +585 -196
  78. claude_mpm/cli/commands/mpm_init_handler.py +37 -3
  79. claude_mpm/cli/commands/search.py +170 -4
  80. claude_mpm/cli/commands/upgrade.py +152 -0
  81. claude_mpm/cli/executor.py +202 -0
  82. claude_mpm/cli/helpers.py +105 -0
  83. claude_mpm/cli/interactive/__init__.py +3 -0
  84. claude_mpm/cli/interactive/skills_wizard.py +491 -0
  85. claude_mpm/cli/parsers/__init__.py +7 -1
  86. claude_mpm/cli/parsers/agents_parser.py +9 -0
  87. claude_mpm/cli/parsers/auto_configure_parser.py +245 -0
  88. claude_mpm/cli/parsers/base_parser.py +110 -3
  89. claude_mpm/cli/parsers/local_deploy_parser.py +227 -0
  90. claude_mpm/cli/parsers/mpm_init_parser.py +65 -5
  91. claude_mpm/cli/shared/output_formatters.py +28 -19
  92. claude_mpm/cli/startup.py +481 -0
  93. claude_mpm/cli/utils.py +52 -1
  94. claude_mpm/commands/mpm-agents-detect.md +168 -0
  95. claude_mpm/commands/mpm-agents-recommend.md +214 -0
  96. claude_mpm/commands/mpm-agents.md +75 -1
  97. claude_mpm/commands/mpm-auto-configure.md +217 -0
  98. claude_mpm/commands/mpm-help.md +163 -0
  99. claude_mpm/commands/mpm-init.md +148 -3
  100. claude_mpm/commands/mpm-version.md +113 -0
  101. claude_mpm/commands/mpm.md +1 -0
  102. claude_mpm/config/agent_config.py +2 -2
  103. claude_mpm/config/model_config.py +428 -0
  104. claude_mpm/constants.py +1 -0
  105. claude_mpm/core/base_service.py +13 -12
  106. claude_mpm/core/enums.py +452 -0
  107. claude_mpm/core/factories.py +1 -1
  108. claude_mpm/core/instruction_reinforcement_hook.py +2 -1
  109. claude_mpm/core/interactive_session.py +9 -3
  110. claude_mpm/core/log_manager.py +2 -0
  111. claude_mpm/core/logging_config.py +6 -2
  112. claude_mpm/core/oneshot_session.py +8 -4
  113. claude_mpm/core/optimized_agent_loader.py +3 -3
  114. claude_mpm/core/output_style_manager.py +12 -192
  115. claude_mpm/core/service_registry.py +5 -1
  116. claude_mpm/core/types.py +2 -9
  117. claude_mpm/core/typing_utils.py +7 -6
  118. claude_mpm/dashboard/static/js/dashboard.js +0 -14
  119. claude_mpm/dashboard/templates/index.html +3 -41
  120. claude_mpm/hooks/__init__.py +20 -0
  121. claude_mpm/hooks/claude_hooks/event_handlers.py +4 -2
  122. claude_mpm/hooks/claude_hooks/response_tracking.py +35 -1
  123. claude_mpm/hooks/claude_hooks/services/connection_manager_http.py +23 -2
  124. claude_mpm/hooks/failure_learning/__init__.py +60 -0
  125. claude_mpm/hooks/failure_learning/failure_detection_hook.py +235 -0
  126. claude_mpm/hooks/failure_learning/fix_detection_hook.py +217 -0
  127. claude_mpm/hooks/failure_learning/learning_extraction_hook.py +286 -0
  128. claude_mpm/hooks/instruction_reinforcement.py +7 -2
  129. claude_mpm/hooks/kuzu_enrichment_hook.py +263 -0
  130. claude_mpm/hooks/kuzu_memory_hook.py +37 -12
  131. claude_mpm/hooks/kuzu_response_hook.py +183 -0
  132. claude_mpm/models/resume_log.py +340 -0
  133. claude_mpm/services/agents/__init__.py +18 -5
  134. claude_mpm/services/agents/auto_config_manager.py +796 -0
  135. claude_mpm/services/agents/deployment/agent_configuration_manager.py +1 -1
  136. claude_mpm/services/agents/deployment/agent_record_service.py +1 -1
  137. claude_mpm/services/agents/deployment/agent_validator.py +17 -1
  138. claude_mpm/services/agents/deployment/async_agent_deployment.py +1 -1
  139. claude_mpm/services/agents/deployment/interface_adapter.py +3 -2
  140. claude_mpm/services/agents/deployment/local_template_deployment.py +1 -1
  141. claude_mpm/services/agents/deployment/pipeline/steps/agent_processing_step.py +7 -6
  142. claude_mpm/services/agents/deployment/pipeline/steps/base_step.py +7 -16
  143. claude_mpm/services/agents/deployment/pipeline/steps/configuration_step.py +4 -3
  144. claude_mpm/services/agents/deployment/pipeline/steps/target_directory_step.py +5 -3
  145. claude_mpm/services/agents/deployment/pipeline/steps/validation_step.py +6 -5
  146. claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +9 -6
  147. claude_mpm/services/agents/deployment/validation/__init__.py +3 -1
  148. claude_mpm/services/agents/deployment/validation/validation_result.py +1 -9
  149. claude_mpm/services/agents/local_template_manager.py +1 -1
  150. claude_mpm/services/agents/memory/agent_memory_manager.py +5 -2
  151. claude_mpm/services/agents/observers.py +547 -0
  152. claude_mpm/services/agents/recommender.py +568 -0
  153. claude_mpm/services/agents/registry/modification_tracker.py +5 -2
  154. claude_mpm/services/command_handler_service.py +11 -5
  155. claude_mpm/services/core/__init__.py +33 -1
  156. claude_mpm/services/core/interfaces/__init__.py +90 -3
  157. claude_mpm/services/core/interfaces/agent.py +184 -0
  158. claude_mpm/services/core/interfaces/health.py +172 -0
  159. claude_mpm/services/core/interfaces/model.py +281 -0
  160. claude_mpm/services/core/interfaces/process.py +372 -0
  161. claude_mpm/services/core/interfaces/project.py +121 -0
  162. claude_mpm/services/core/interfaces/restart.py +307 -0
  163. claude_mpm/services/core/interfaces/stability.py +260 -0
  164. claude_mpm/services/core/memory_manager.py +11 -24
  165. claude_mpm/services/core/models/__init__.py +79 -0
  166. claude_mpm/services/core/models/agent_config.py +381 -0
  167. claude_mpm/services/core/models/health.py +162 -0
  168. claude_mpm/services/core/models/process.py +235 -0
  169. claude_mpm/services/core/models/restart.py +302 -0
  170. claude_mpm/services/core/models/stability.py +264 -0
  171. claude_mpm/services/core/models/toolchain.py +306 -0
  172. claude_mpm/services/core/path_resolver.py +23 -7
  173. claude_mpm/services/diagnostics/__init__.py +2 -2
  174. claude_mpm/services/diagnostics/checks/agent_check.py +25 -24
  175. claude_mpm/services/diagnostics/checks/claude_code_check.py +24 -23
  176. claude_mpm/services/diagnostics/checks/common_issues_check.py +25 -24
  177. claude_mpm/services/diagnostics/checks/configuration_check.py +24 -23
  178. claude_mpm/services/diagnostics/checks/filesystem_check.py +18 -17
  179. claude_mpm/services/diagnostics/checks/installation_check.py +30 -29
  180. claude_mpm/services/diagnostics/checks/instructions_check.py +20 -19
  181. claude_mpm/services/diagnostics/checks/mcp_check.py +50 -36
  182. claude_mpm/services/diagnostics/checks/mcp_services_check.py +38 -33
  183. claude_mpm/services/diagnostics/checks/monitor_check.py +23 -22
  184. claude_mpm/services/diagnostics/checks/startup_log_check.py +9 -8
  185. claude_mpm/services/diagnostics/diagnostic_runner.py +6 -5
  186. claude_mpm/services/diagnostics/doctor_reporter.py +28 -25
  187. claude_mpm/services/diagnostics/models.py +19 -24
  188. claude_mpm/services/infrastructure/monitoring/__init__.py +1 -1
  189. claude_mpm/services/infrastructure/monitoring/aggregator.py +12 -12
  190. claude_mpm/services/infrastructure/monitoring/base.py +5 -13
  191. claude_mpm/services/infrastructure/monitoring/network.py +7 -6
  192. claude_mpm/services/infrastructure/monitoring/process.py +13 -12
  193. claude_mpm/services/infrastructure/monitoring/resources.py +7 -6
  194. claude_mpm/services/infrastructure/monitoring/service.py +16 -15
  195. claude_mpm/services/infrastructure/resume_log_generator.py +439 -0
  196. claude_mpm/services/local_ops/__init__.py +163 -0
  197. claude_mpm/services/local_ops/crash_detector.py +257 -0
  198. claude_mpm/services/local_ops/health_checks/__init__.py +28 -0
  199. claude_mpm/services/local_ops/health_checks/http_check.py +224 -0
  200. claude_mpm/services/local_ops/health_checks/process_check.py +236 -0
  201. claude_mpm/services/local_ops/health_checks/resource_check.py +255 -0
  202. claude_mpm/services/local_ops/health_manager.py +430 -0
  203. claude_mpm/services/local_ops/log_monitor.py +396 -0
  204. claude_mpm/services/local_ops/memory_leak_detector.py +294 -0
  205. claude_mpm/services/local_ops/process_manager.py +595 -0
  206. claude_mpm/services/local_ops/resource_monitor.py +331 -0
  207. claude_mpm/services/local_ops/restart_manager.py +401 -0
  208. claude_mpm/services/local_ops/restart_policy.py +387 -0
  209. claude_mpm/services/local_ops/state_manager.py +372 -0
  210. claude_mpm/services/local_ops/unified_manager.py +600 -0
  211. claude_mpm/services/mcp_config_manager.py +9 -4
  212. claude_mpm/services/mcp_gateway/core/__init__.py +1 -2
  213. claude_mpm/services/mcp_gateway/core/base.py +18 -31
  214. claude_mpm/services/mcp_gateway/main.py +30 -0
  215. claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +206 -32
  216. claude_mpm/services/mcp_gateway/tools/health_check_tool.py +30 -28
  217. claude_mpm/services/mcp_gateway/tools/kuzu_memory_service.py +25 -5
  218. claude_mpm/services/mcp_service_verifier.py +1 -1
  219. claude_mpm/services/memory/failure_tracker.py +563 -0
  220. claude_mpm/services/memory_hook_service.py +165 -4
  221. claude_mpm/services/model/__init__.py +147 -0
  222. claude_mpm/services/model/base_provider.py +365 -0
  223. claude_mpm/services/model/claude_provider.py +412 -0
  224. claude_mpm/services/model/model_router.py +453 -0
  225. claude_mpm/services/model/ollama_provider.py +415 -0
  226. claude_mpm/services/monitor/daemon_manager.py +3 -2
  227. claude_mpm/services/monitor/handlers/dashboard.py +2 -1
  228. claude_mpm/services/monitor/handlers/hooks.py +2 -1
  229. claude_mpm/services/monitor/management/lifecycle.py +3 -2
  230. claude_mpm/services/monitor/server.py +2 -1
  231. claude_mpm/services/project/__init__.py +23 -0
  232. claude_mpm/services/project/detection_strategies.py +719 -0
  233. claude_mpm/services/project/toolchain_analyzer.py +581 -0
  234. claude_mpm/services/self_upgrade_service.py +342 -0
  235. claude_mpm/services/session_management_service.py +3 -2
  236. claude_mpm/services/session_manager.py +205 -1
  237. claude_mpm/services/shared/async_service_base.py +16 -27
  238. claude_mpm/services/shared/lifecycle_service_base.py +1 -14
  239. claude_mpm/services/socketio/handlers/__init__.py +5 -2
  240. claude_mpm/services/socketio/handlers/hook.py +13 -2
  241. claude_mpm/services/socketio/handlers/registry.py +4 -2
  242. claude_mpm/services/socketio/server/main.py +10 -8
  243. claude_mpm/services/subprocess_launcher_service.py +14 -5
  244. claude_mpm/services/unified/analyzer_strategies/code_analyzer.py +8 -7
  245. claude_mpm/services/unified/analyzer_strategies/dependency_analyzer.py +6 -5
  246. claude_mpm/services/unified/analyzer_strategies/performance_analyzer.py +8 -7
  247. claude_mpm/services/unified/analyzer_strategies/security_analyzer.py +7 -6
  248. claude_mpm/services/unified/analyzer_strategies/structure_analyzer.py +5 -4
  249. claude_mpm/services/unified/config_strategies/validation_strategy.py +13 -9
  250. claude_mpm/services/unified/deployment_strategies/cloud_strategies.py +10 -3
  251. claude_mpm/services/unified/deployment_strategies/local.py +6 -5
  252. claude_mpm/services/unified/deployment_strategies/utils.py +6 -5
  253. claude_mpm/services/unified/deployment_strategies/vercel.py +7 -6
  254. claude_mpm/services/unified/interfaces.py +3 -1
  255. claude_mpm/services/unified/unified_analyzer.py +14 -10
  256. claude_mpm/services/unified/unified_config.py +2 -1
  257. claude_mpm/services/unified/unified_deployment.py +9 -4
  258. claude_mpm/services/version_service.py +104 -1
  259. claude_mpm/skills/__init__.py +21 -0
  260. claude_mpm/skills/bundled/__init__.py +6 -0
  261. claude_mpm/skills/bundled/api-documentation.md +393 -0
  262. claude_mpm/skills/bundled/async-testing.md +571 -0
  263. claude_mpm/skills/bundled/code-review.md +143 -0
  264. claude_mpm/skills/bundled/database-migration.md +199 -0
  265. claude_mpm/skills/bundled/docker-containerization.md +194 -0
  266. claude_mpm/skills/bundled/express-local-dev.md +1429 -0
  267. claude_mpm/skills/bundled/fastapi-local-dev.md +1199 -0
  268. claude_mpm/skills/bundled/git-workflow.md +414 -0
  269. claude_mpm/skills/bundled/imagemagick.md +204 -0
  270. claude_mpm/skills/bundled/json-data-handling.md +223 -0
  271. claude_mpm/skills/bundled/nextjs-local-dev.md +807 -0
  272. claude_mpm/skills/bundled/pdf.md +141 -0
  273. claude_mpm/skills/bundled/performance-profiling.md +567 -0
  274. claude_mpm/skills/bundled/refactoring-patterns.md +180 -0
  275. claude_mpm/skills/bundled/security-scanning.md +327 -0
  276. claude_mpm/skills/bundled/systematic-debugging.md +473 -0
  277. claude_mpm/skills/bundled/test-driven-development.md +378 -0
  278. claude_mpm/skills/bundled/vite-local-dev.md +1061 -0
  279. claude_mpm/skills/bundled/web-performance-optimization.md +2305 -0
  280. claude_mpm/skills/bundled/xlsx.md +157 -0
  281. claude_mpm/skills/registry.py +286 -0
  282. claude_mpm/skills/skill_manager.py +310 -0
  283. claude_mpm/storage/state_storage.py +15 -15
  284. claude_mpm/tools/code_tree_analyzer.py +177 -141
  285. claude_mpm/tools/code_tree_events.py +4 -2
  286. claude_mpm/utils/agent_dependency_loader.py +40 -20
  287. claude_mpm/utils/display_helper.py +260 -0
  288. claude_mpm/utils/git_analyzer.py +407 -0
  289. claude_mpm/utils/robust_installer.py +73 -19
  290. {claude_mpm-4.7.4.dist-info → claude_mpm-4.18.2.dist-info}/METADATA +129 -12
  291. {claude_mpm-4.7.4.dist-info → claude_mpm-4.18.2.dist-info}/RECORD +295 -193
  292. claude_mpm/dashboard/static/css/code-tree.css +0 -1639
  293. claude_mpm/dashboard/static/index-hub-backup.html +0 -713
  294. claude_mpm/dashboard/static/js/components/code-tree/tree-breadcrumb.js +0 -353
  295. claude_mpm/dashboard/static/js/components/code-tree/tree-constants.js +0 -235
  296. claude_mpm/dashboard/static/js/components/code-tree/tree-search.js +0 -409
  297. claude_mpm/dashboard/static/js/components/code-tree/tree-utils.js +0 -435
  298. claude_mpm/dashboard/static/js/components/code-tree.js +0 -5869
  299. claude_mpm/dashboard/static/js/components/code-viewer.js +0 -1386
  300. claude_mpm/hooks/claude_hooks/hook_handler_eventbus.py +0 -425
  301. claude_mpm/hooks/claude_hooks/hook_handler_original.py +0 -1041
  302. claude_mpm/hooks/claude_hooks/hook_handler_refactored.py +0 -347
  303. claude_mpm/services/agents/deployment/agent_lifecycle_manager_refactored.py +0 -575
  304. claude_mpm/services/project/analyzer_refactored.py +0 -450
  305. {claude_mpm-4.7.4.dist-info → claude_mpm-4.18.2.dist-info}/WHEEL +0 -0
  306. {claude_mpm-4.7.4.dist-info → claude_mpm-4.18.2.dist-info}/entry_points.txt +0 -0
  307. {claude_mpm-4.7.4.dist-info → claude_mpm-4.18.2.dist-info}/licenses/LICENSE +0 -0
  308. {claude_mpm-4.7.4.dist-info → claude_mpm-4.18.2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,245 @@
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
+ return auto_configure_parser
108
+
109
+
110
+ def add_agents_detect_subparser(agents_subparsers) -> argparse.ArgumentParser:
111
+ """
112
+ Add the agents detect subparser for toolchain detection.
113
+
114
+ WHY: Allows users to see what toolchain is detected without making changes,
115
+ useful for debugging and verification.
116
+
117
+ Args:
118
+ agents_subparsers: The agents subparsers object
119
+
120
+ Returns:
121
+ The configured detect subparser
122
+ """
123
+ detect_parser = agents_subparsers.add_parser(
124
+ "detect",
125
+ help="Detect project toolchain without deploying",
126
+ description="""
127
+ Detect and display project toolchain without making any changes.
128
+
129
+ This command analyzes your project to detect:
130
+ • Programming languages and versions
131
+ • Frameworks and libraries
132
+ • Deployment targets and platforms
133
+
134
+ Useful for debugging toolchain detection and verifying what would be
135
+ detected before running auto-configure.
136
+ """,
137
+ formatter_class=argparse.RawDescriptionHelpFormatter,
138
+ epilog="""
139
+ Examples:
140
+ # Detect toolchain in current directory
141
+ claude-mpm agents detect
142
+
143
+ # Detect with verbose output showing evidence
144
+ claude-mpm agents detect --verbose
145
+
146
+ # JSON output for scripting
147
+ claude-mpm agents detect --json
148
+
149
+ # Detect specific project
150
+ claude-mpm agents detect --project-path /path/to/project
151
+ """,
152
+ )
153
+ add_common_arguments(detect_parser)
154
+
155
+ detect_parser.add_argument(
156
+ "--project-path",
157
+ type=Path,
158
+ metavar="PATH",
159
+ help="Project path to analyze (default: current directory)",
160
+ )
161
+
162
+ return detect_parser
163
+
164
+
165
+ def add_agents_recommend_subparser(
166
+ agents_subparsers,
167
+ ) -> argparse.ArgumentParser:
168
+ """
169
+ Add the agents recommend subparser for agent recommendations.
170
+
171
+ WHY: Allows users to see what agents would be recommended without deploying,
172
+ useful for reviewing recommendations before committing to deployment.
173
+
174
+ Args:
175
+ agents_subparsers: The agents subparsers object
176
+
177
+ Returns:
178
+ The configured recommend subparser
179
+ """
180
+ recommend_parser = agents_subparsers.add_parser(
181
+ "recommend",
182
+ help="Show recommended agents without deploying",
183
+ description="""
184
+ Show recommended agents based on project toolchain without deploying.
185
+
186
+ This command analyzes your project toolchain and recommends appropriate
187
+ agents with detailed reasoning for each recommendation. No changes are
188
+ made to your project.
189
+
190
+ Useful for:
191
+ • Reviewing recommendations before deployment
192
+ • Understanding why agents are recommended
193
+ • Adjusting confidence thresholds
194
+ """,
195
+ formatter_class=argparse.RawDescriptionHelpFormatter,
196
+ epilog="""
197
+ Examples:
198
+ # Show recommendations with reasoning
199
+ claude-mpm agents recommend
200
+
201
+ # Require 90% confidence for recommendations
202
+ claude-mpm agents recommend --min-confidence 0.9
203
+
204
+ # JSON output for scripting
205
+ claude-mpm agents recommend --json
206
+
207
+ # Hide detailed reasoning
208
+ claude-mpm agents recommend --no-reasoning
209
+
210
+ # Recommend for specific project
211
+ claude-mpm agents recommend --project-path /path/to/project
212
+ """,
213
+ )
214
+ add_common_arguments(recommend_parser)
215
+
216
+ recommend_parser.add_argument(
217
+ "--project-path",
218
+ type=Path,
219
+ metavar="PATH",
220
+ help="Project path to analyze (default: current directory)",
221
+ )
222
+
223
+ recommend_parser.add_argument(
224
+ "--min-confidence",
225
+ type=float,
226
+ default=0.8,
227
+ metavar="FLOAT",
228
+ help="Minimum confidence threshold for recommendations (0.0-1.0, default: 0.8)",
229
+ )
230
+
231
+ recommend_parser.add_argument(
232
+ "--show-reasoning",
233
+ action="store_true",
234
+ default=True,
235
+ help="Show detailed reasoning for recommendations (default)",
236
+ )
237
+
238
+ recommend_parser.add_argument(
239
+ "--no-reasoning",
240
+ dest="show_reasoning",
241
+ action="store_false",
242
+ help="Hide detailed reasoning for recommendations",
243
+ )
244
+
245
+ return recommend_parser
@@ -11,11 +11,96 @@ and reduce duplication across command parsers.
11
11
  """
12
12
 
13
13
  import argparse
14
+ import sys
14
15
  from typing import List, Optional
15
16
 
16
17
  from ...constants import CLICommands, CLIPrefix, LogLevel
17
18
 
18
19
 
20
+ class SuggestingArgumentParser(argparse.ArgumentParser):
21
+ """
22
+ Custom ArgumentParser that suggests similar commands on error.
23
+
24
+ WHY: Provides better user experience by suggesting corrections for typos
25
+ and invalid commands instead of just showing an error message.
26
+
27
+ DESIGN DECISION: Extends ArgumentParser.error() to add suggestions before
28
+ exiting. This catches all parser errors including invalid subcommands and
29
+ invalid options.
30
+ """
31
+
32
+ def error(self, message: str) -> None:
33
+ """
34
+ Override error method to add command suggestions.
35
+
36
+ Args:
37
+ message: Error message from argparse
38
+ """
39
+ from ..utils import suggest_similar_commands
40
+
41
+ # Try to extract the invalid command/option from the error message
42
+ invalid_value = None
43
+ valid_choices = []
44
+
45
+ # Handle invalid subcommand errors
46
+ # Format: "argument COMMAND: invalid choice: 'tickts' (choose from ...)"
47
+ if "invalid choice:" in message:
48
+ try:
49
+ # Extract the invalid choice
50
+ parts = message.split("invalid choice: '")
51
+ if len(parts) > 1:
52
+ invalid_value = parts[1].split("'")[0]
53
+
54
+ # Extract valid choices
55
+ if "(choose from" in message:
56
+ choices_part = message.split("(choose from")[1]
57
+ # Remove trailing parenthesis and split
58
+ choices_str = choices_part.rstrip(")")
59
+ # Parse choices - they may be quoted or unquoted
60
+ valid_choices = [
61
+ c.strip().strip("'\"")
62
+ for c in choices_str.split(",")
63
+ if c.strip()
64
+ ]
65
+ except (IndexError, ValueError):
66
+ pass
67
+
68
+ # Handle unrecognized arguments (invalid options)
69
+ # Format: "unrecognized arguments: --verbos"
70
+ elif "unrecognized arguments:" in message:
71
+ try:
72
+ parts = message.split("unrecognized arguments:")
73
+ if len(parts) > 1:
74
+ invalid_value = parts[1].strip().split()[0]
75
+
76
+ # Get common options from parser
77
+ valid_choices = []
78
+ for action in self._actions:
79
+ for option in action.option_strings:
80
+ valid_choices.append(option)
81
+ except (IndexError, ValueError):
82
+ pass
83
+
84
+ # Build error message with suggestions
85
+ from rich.console import Console
86
+
87
+ console = Console(stderr=True)
88
+
89
+ console.print(f"\n[red]Error:[/red] {message}\n", style="bold")
90
+
91
+ # Add suggestions if we found valid choices
92
+ if invalid_value and valid_choices:
93
+ suggestion = suggest_similar_commands(invalid_value, valid_choices)
94
+ if suggestion:
95
+ console.print(f"[yellow]{suggestion}[/yellow]\n")
96
+
97
+ # Show help hint
98
+ console.print(f"[dim]Run '{self.prog} --help' for usage information.[/dim]\n")
99
+
100
+ # Exit with error code
101
+ sys.exit(2)
102
+
103
+
19
104
  def _get_enhanced_version(base_version: str) -> str:
20
105
  """
21
106
  Get enhanced version string with build number if available.
@@ -111,15 +196,18 @@ def create_main_parser(
111
196
  WHY: This creates the foundation parser that other modules will extend
112
197
  with their specific subcommands and arguments.
113
198
 
199
+ DESIGN DECISION: Uses SuggestingArgumentParser to provide helpful suggestions
200
+ for typos and invalid commands, improving user experience.
201
+
114
202
  Args:
115
203
  prog_name: The program name to use
116
204
  version: The version string to display
117
205
 
118
206
  Returns:
119
- Configured ArgumentParser instance ready for subparser addition
207
+ Configured SuggestingArgumentParser instance ready for subparser addition
120
208
  """
121
- # Main parser
122
- parser = argparse.ArgumentParser(
209
+ # Main parser with suggestion support
210
+ parser = SuggestingArgumentParser(
123
211
  prog=prog_name,
124
212
  description=f"Claude Multi-Agent Project Manager v{version} - Orchestrate Claude with agent delegation and ticket tracking",
125
213
  epilog="By default, runs an orchestrated Claude session. Use 'claude-mpm' for interactive mode or 'claude-mpm -i \"prompt\"' for non-interactive mode.\n\nTo pass arguments to Claude CLI, use -- separator: claude-mpm run -- --model sonnet --temperature 0.1",
@@ -301,6 +389,13 @@ def create_parser(
301
389
  except ImportError:
302
390
  pass
303
391
 
392
+ try:
393
+ from .auto_configure_parser import add_auto_configure_subparser
394
+
395
+ add_auto_configure_subparser(subparsers)
396
+ except ImportError:
397
+ pass
398
+
304
399
  try:
305
400
  from .memory_parser import add_memory_subparser
306
401
 
@@ -329,6 +424,13 @@ def create_parser(
329
424
  except ImportError:
330
425
  pass
331
426
 
427
+ try:
428
+ from .local_deploy_parser import add_local_deploy_arguments
429
+
430
+ add_local_deploy_arguments(subparsers)
431
+ except ImportError:
432
+ pass
433
+
332
434
  try:
333
435
  from .mcp_parser import add_mcp_subparser
334
436
 
@@ -423,6 +525,11 @@ def create_parser(
423
525
 
424
526
  add_doctor_parser(subparsers)
425
527
 
528
+ # Add upgrade command
529
+ from ..commands.upgrade import add_upgrade_parser
530
+
531
+ add_upgrade_parser(subparsers)
532
+
426
533
  # Add verify command for MCP service verification
427
534
  from ..commands.verify import add_parser as add_verify_parser
428
535
 
@@ -0,0 +1,227 @@
1
+ """
2
+ Local Deploy parser module for claude-mpm CLI.
3
+
4
+ WHY: Provides argument parsing for local deployment management commands.
5
+ Extracted from the monolithic parser.py for better organization.
6
+
7
+ DESIGN DECISION: Supports multiple subcommands (start, stop, restart, status, etc.)
8
+ with command-specific arguments for comprehensive process management.
9
+ """
10
+
11
+ from pathlib import Path
12
+
13
+
14
+ def add_local_deploy_arguments(subparsers) -> None:
15
+ """
16
+ Add local-deploy command and its subcommands to the parser.
17
+
18
+ WHY: Provides a comprehensive CLI for managing local development deployments
19
+ with process monitoring, health checks, and auto-restart capabilities.
20
+
21
+ Args:
22
+ subparsers: The subparsers object to add commands to
23
+ """
24
+ # Main local-deploy command
25
+ local_deploy_parser = subparsers.add_parser(
26
+ "local-deploy",
27
+ help="Manage local development deployments with process monitoring",
28
+ description=(
29
+ "Manage local development deployments with comprehensive process management, "
30
+ "health monitoring, and auto-restart capabilities."
31
+ ),
32
+ )
33
+
34
+ # Create subparsers for local-deploy subcommands
35
+ local_deploy_subparsers = local_deploy_parser.add_subparsers(
36
+ dest="local_deploy_command",
37
+ help="Local deployment commands",
38
+ )
39
+
40
+ # ===== START command =====
41
+ start_parser = local_deploy_subparsers.add_parser(
42
+ "start",
43
+ help="Start a new local deployment",
44
+ description="Start a new local deployment with process monitoring and optional auto-restart",
45
+ )
46
+ start_parser.add_argument(
47
+ "--command",
48
+ "-c",
49
+ required=True,
50
+ help="Command to execute (e.g., 'npm run dev' or 'python manage.py runserver')",
51
+ )
52
+ start_parser.add_argument(
53
+ "--working-directory",
54
+ "-d",
55
+ type=Path,
56
+ help="Working directory for the process (default: current directory)",
57
+ )
58
+ start_parser.add_argument(
59
+ "--port",
60
+ "-p",
61
+ type=int,
62
+ help="Port number for the deployment",
63
+ )
64
+ start_parser.add_argument(
65
+ "--auto-find-port",
66
+ action="store_true",
67
+ default=True,
68
+ help="Automatically find alternative port if specified port is unavailable (default: enabled)",
69
+ )
70
+ start_parser.add_argument(
71
+ "--no-auto-find-port",
72
+ action="store_false",
73
+ dest="auto_find_port",
74
+ help="Disable automatic port finding",
75
+ )
76
+ start_parser.add_argument(
77
+ "--auto-restart",
78
+ action="store_true",
79
+ help="Enable automatic restart on crashes",
80
+ )
81
+ start_parser.add_argument(
82
+ "--log-file",
83
+ type=Path,
84
+ help="Path to log file for monitoring error patterns",
85
+ )
86
+ start_parser.add_argument(
87
+ "--env",
88
+ "-e",
89
+ action="append",
90
+ help="Environment variables in KEY=VALUE format (can be specified multiple times)",
91
+ )
92
+
93
+ # ===== STOP command =====
94
+ stop_parser = local_deploy_subparsers.add_parser(
95
+ "stop",
96
+ help="Stop a running deployment",
97
+ description="Stop a running deployment with graceful shutdown",
98
+ )
99
+ stop_parser.add_argument(
100
+ "deployment_id",
101
+ help="Deployment ID to stop",
102
+ )
103
+ stop_parser.add_argument(
104
+ "--timeout",
105
+ "-t",
106
+ type=int,
107
+ default=10,
108
+ help="Timeout in seconds for graceful shutdown (default: 10)",
109
+ )
110
+ stop_parser.add_argument(
111
+ "--force",
112
+ "-f",
113
+ action="store_true",
114
+ help="Force kill immediately without graceful shutdown",
115
+ )
116
+
117
+ # ===== RESTART command =====
118
+ restart_parser = local_deploy_subparsers.add_parser(
119
+ "restart",
120
+ help="Restart a deployment",
121
+ description="Restart a deployment with the same configuration",
122
+ )
123
+ restart_parser.add_argument(
124
+ "deployment_id",
125
+ help="Deployment ID to restart",
126
+ )
127
+ restart_parser.add_argument(
128
+ "--timeout",
129
+ "-t",
130
+ type=int,
131
+ default=10,
132
+ help="Timeout in seconds for graceful shutdown (default: 10)",
133
+ )
134
+
135
+ # ===== STATUS command =====
136
+ status_parser = local_deploy_subparsers.add_parser(
137
+ "status",
138
+ help="Show comprehensive deployment status",
139
+ description="Show comprehensive status including process info, health, and restart history",
140
+ )
141
+ status_parser.add_argument(
142
+ "deployment_id",
143
+ help="Deployment ID to check",
144
+ )
145
+ status_parser.add_argument(
146
+ "--json",
147
+ action="store_true",
148
+ help="Output status in JSON format",
149
+ )
150
+
151
+ # ===== HEALTH command =====
152
+ health_parser = local_deploy_subparsers.add_parser(
153
+ "health",
154
+ help="Show health status",
155
+ description="Show health check status including HTTP, process, and resource checks",
156
+ )
157
+ health_parser.add_argument(
158
+ "deployment_id",
159
+ help="Deployment ID to check",
160
+ )
161
+
162
+ # ===== LIST command =====
163
+ list_parser = local_deploy_subparsers.add_parser(
164
+ "list",
165
+ help="List all deployments",
166
+ description="List all local deployments with their status",
167
+ )
168
+ list_parser.add_argument(
169
+ "--status",
170
+ "-s",
171
+ choices=["running", "stopped", "crashed", "stopping"],
172
+ help="Filter deployments by status",
173
+ )
174
+
175
+ # ===== MONITOR command =====
176
+ monitor_parser = local_deploy_subparsers.add_parser(
177
+ "monitor",
178
+ help="Live monitoring dashboard",
179
+ description="Display live monitoring dashboard for a deployment",
180
+ )
181
+ monitor_parser.add_argument(
182
+ "deployment_id",
183
+ help="Deployment ID to monitor",
184
+ )
185
+ monitor_parser.add_argument(
186
+ "--refresh",
187
+ "-r",
188
+ type=int,
189
+ default=2,
190
+ help="Refresh interval in seconds (default: 2)",
191
+ )
192
+
193
+ # ===== HISTORY command =====
194
+ history_parser = local_deploy_subparsers.add_parser(
195
+ "history",
196
+ help="Show restart history",
197
+ description="Show restart history and statistics for a deployment",
198
+ )
199
+ history_parser.add_argument(
200
+ "deployment_id",
201
+ help="Deployment ID to check",
202
+ )
203
+
204
+ # ===== ENABLE-AUTO-RESTART command =====
205
+ enable_auto_restart_parser = local_deploy_subparsers.add_parser(
206
+ "enable-auto-restart",
207
+ help="Enable auto-restart for a deployment",
208
+ description="Enable automatic restart on crashes for a deployment",
209
+ )
210
+ enable_auto_restart_parser.add_argument(
211
+ "deployment_id",
212
+ help="Deployment ID to enable auto-restart for",
213
+ )
214
+
215
+ # ===== DISABLE-AUTO-RESTART command =====
216
+ disable_auto_restart_parser = local_deploy_subparsers.add_parser(
217
+ "disable-auto-restart",
218
+ help="Disable auto-restart for a deployment",
219
+ description="Disable automatic restart on crashes for a deployment",
220
+ )
221
+ disable_auto_restart_parser.add_argument(
222
+ "deployment_id",
223
+ help="Deployment ID to disable auto-restart for",
224
+ )
225
+
226
+
227
+ __all__ = ["add_local_deploy_arguments"]