claude-mpm 4.20.3__py3-none-any.whl → 5.1.8__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 (520) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/BASE_PM.md +35 -6
  3. claude_mpm/agents/OUTPUT_STYLE.md +3 -48
  4. claude_mpm/agents/PM_INSTRUCTIONS.md +1241 -667
  5. claude_mpm/agents/PM_INSTRUCTIONS_TEACH.md +1322 -0
  6. claude_mpm/agents/WORKFLOW.md +75 -2
  7. claude_mpm/agents/__init__.py +6 -0
  8. claude_mpm/agents/agent_loader.py +1 -4
  9. claude_mpm/agents/base_agent.json +6 -3
  10. claude_mpm/agents/base_agent_loader.py +10 -35
  11. claude_mpm/agents/frontmatter_validator.py +1 -1
  12. claude_mpm/agents/templates/circuit-breakers.md +1254 -0
  13. claude_mpm/agents/templates/context-management-examples.md +544 -0
  14. claude_mpm/agents/templates/{pm_red_flags.md → pm-red-flags.md} +89 -19
  15. claude_mpm/agents/templates/pr-workflow-examples.md +427 -0
  16. claude_mpm/agents/templates/research-gate-examples.md +669 -0
  17. claude_mpm/agents/templates/structured-questions-examples.md +615 -0
  18. claude_mpm/agents/templates/ticket-completeness-examples.md +139 -0
  19. claude_mpm/agents/templates/ticketing-examples.md +277 -0
  20. claude_mpm/cli/__init__.py +37 -2
  21. claude_mpm/cli/commands/__init__.py +2 -0
  22. claude_mpm/cli/commands/agent_source.py +774 -0
  23. claude_mpm/cli/commands/agent_state_manager.py +188 -30
  24. claude_mpm/cli/commands/agents.py +959 -36
  25. claude_mpm/cli/commands/agents_cleanup.py +210 -0
  26. claude_mpm/cli/commands/agents_discover.py +338 -0
  27. claude_mpm/cli/commands/aggregate.py +1 -1
  28. claude_mpm/cli/commands/analyze.py +3 -3
  29. claude_mpm/cli/commands/auto_configure.py +537 -239
  30. claude_mpm/cli/commands/cleanup.py +1 -1
  31. claude_mpm/cli/commands/config.py +7 -4
  32. claude_mpm/cli/commands/configure.py +924 -45
  33. claude_mpm/cli/commands/configure_agent_display.py +4 -4
  34. claude_mpm/cli/commands/configure_navigation.py +63 -46
  35. claude_mpm/cli/commands/debug.py +12 -12
  36. claude_mpm/cli/commands/doctor.py +10 -2
  37. claude_mpm/cli/commands/hook_errors.py +277 -0
  38. claude_mpm/cli/commands/local_deploy.py +1 -4
  39. claude_mpm/cli/commands/mcp_install_commands.py +1 -1
  40. claude_mpm/cli/commands/mpm_init/__init__.py +73 -0
  41. claude_mpm/cli/commands/mpm_init/core.py +573 -0
  42. claude_mpm/cli/commands/mpm_init/display.py +341 -0
  43. claude_mpm/cli/commands/mpm_init/git_activity.py +427 -0
  44. claude_mpm/cli/commands/mpm_init/modes.py +397 -0
  45. claude_mpm/cli/commands/mpm_init/prompts.py +442 -0
  46. claude_mpm/cli/commands/mpm_init_cli.py +396 -0
  47. claude_mpm/cli/commands/mpm_init_handler.py +67 -1
  48. claude_mpm/cli/commands/postmortem.py +401 -0
  49. claude_mpm/cli/commands/run.py +125 -167
  50. claude_mpm/cli/commands/skill_source.py +694 -0
  51. claude_mpm/cli/commands/skills.py +835 -44
  52. claude_mpm/cli/executor.py +78 -3
  53. claude_mpm/cli/interactive/agent_wizard.py +1032 -47
  54. claude_mpm/cli/parsers/agent_source_parser.py +171 -0
  55. claude_mpm/cli/parsers/agents_parser.py +256 -4
  56. claude_mpm/cli/parsers/auto_configure_parser.py +13 -0
  57. claude_mpm/cli/parsers/base_parser.py +53 -0
  58. claude_mpm/cli/parsers/config_parser.py +96 -43
  59. claude_mpm/cli/parsers/mpm_init_parser.py +42 -0
  60. claude_mpm/cli/parsers/skill_source_parser.py +169 -0
  61. claude_mpm/cli/parsers/skills_parser.py +145 -0
  62. claude_mpm/cli/parsers/source_parser.py +138 -0
  63. claude_mpm/cli/startup.py +564 -108
  64. claude_mpm/cli/startup_display.py +480 -0
  65. claude_mpm/cli/utils.py +1 -1
  66. claude_mpm/cli_module/commands.py +1 -1
  67. claude_mpm/commands/{mpm-auto-configure.md → mpm-agents-auto-configure.md} +9 -0
  68. claude_mpm/commands/mpm-agents-detect.md +9 -0
  69. claude_mpm/commands/{mpm-agents.md → mpm-agents-list.md} +9 -0
  70. claude_mpm/commands/mpm-agents-recommend.md +9 -0
  71. claude_mpm/commands/{mpm-config.md → mpm-config-view.md} +9 -0
  72. claude_mpm/commands/mpm-doctor.md +9 -0
  73. claude_mpm/commands/mpm-help.md +17 -2
  74. claude_mpm/commands/mpm-init.md +28 -3
  75. claude_mpm/commands/mpm-monitor.md +9 -0
  76. claude_mpm/commands/mpm-postmortem.md +123 -0
  77. claude_mpm/commands/mpm-session-resume.md +381 -0
  78. claude_mpm/commands/mpm-status.md +9 -0
  79. claude_mpm/commands/{mpm-organize.md → mpm-ticket-organize.md} +9 -0
  80. claude_mpm/commands/mpm-ticket-view.md +552 -0
  81. claude_mpm/commands/mpm-version.md +9 -0
  82. claude_mpm/commands/mpm.md +11 -0
  83. claude_mpm/config/agent_presets.py +488 -0
  84. claude_mpm/config/agent_sources.py +325 -0
  85. claude_mpm/config/skill_presets.py +392 -0
  86. claude_mpm/config/skill_sources.py +590 -0
  87. claude_mpm/constants.py +13 -0
  88. claude_mpm/core/api_validator.py +1 -1
  89. claude_mpm/core/claude_runner.py +19 -35
  90. claude_mpm/core/config.py +24 -0
  91. claude_mpm/core/constants.py +1 -1
  92. claude_mpm/core/framework/__init__.py +3 -16
  93. claude_mpm/core/framework/loaders/file_loader.py +54 -101
  94. claude_mpm/core/framework/loaders/instruction_loader.py +25 -5
  95. claude_mpm/core/framework/processors/metadata_processor.py +1 -1
  96. claude_mpm/core/hook_error_memory.py +381 -0
  97. claude_mpm/core/hook_manager.py +41 -2
  98. claude_mpm/core/interactive_session.py +131 -10
  99. claude_mpm/core/interfaces.py +56 -1
  100. claude_mpm/core/logger.py +3 -1
  101. claude_mpm/core/oneshot_session.py +110 -8
  102. claude_mpm/core/protocols/__init__.py +23 -0
  103. claude_mpm/core/protocols/runner_protocol.py +103 -0
  104. claude_mpm/core/protocols/session_protocol.py +131 -0
  105. claude_mpm/core/shared/singleton_manager.py +11 -4
  106. claude_mpm/core/system_context.py +38 -0
  107. claude_mpm/core/unified_config.py +22 -0
  108. claude_mpm/dashboard/static/css/activity.css +69 -69
  109. claude_mpm/dashboard/static/css/connection-status.css +10 -10
  110. claude_mpm/dashboard/static/css/dashboard.css +15 -15
  111. claude_mpm/dashboard/static/js/components/activity-tree.js +178 -178
  112. claude_mpm/dashboard/static/js/components/agent-hierarchy.js +101 -101
  113. claude_mpm/dashboard/static/js/components/agent-inference.js +31 -31
  114. claude_mpm/dashboard/static/js/components/build-tracker.js +59 -59
  115. claude_mpm/dashboard/static/js/components/code-simple.js +107 -107
  116. claude_mpm/dashboard/static/js/components/connection-debug.js +101 -101
  117. claude_mpm/dashboard/static/js/components/diff-viewer.js +113 -113
  118. claude_mpm/dashboard/static/js/components/event-viewer.js +12 -12
  119. claude_mpm/dashboard/static/js/components/file-change-tracker.js +57 -57
  120. claude_mpm/dashboard/static/js/components/file-change-viewer.js +74 -74
  121. claude_mpm/dashboard/static/js/components/file-tool-tracker.js +6 -6
  122. claude_mpm/dashboard/static/js/components/file-viewer.js +42 -42
  123. claude_mpm/dashboard/static/js/components/module-viewer.js +27 -27
  124. claude_mpm/dashboard/static/js/components/session-manager.js +14 -14
  125. claude_mpm/dashboard/static/js/components/socket-manager.js +1 -1
  126. claude_mpm/dashboard/static/js/components/ui-state-manager.js +14 -14
  127. claude_mpm/dashboard/static/js/components/unified-data-viewer.js +110 -110
  128. claude_mpm/dashboard/static/js/components/working-directory.js +8 -8
  129. claude_mpm/dashboard/static/js/connection-manager.js +76 -76
  130. claude_mpm/dashboard/static/js/dashboard.js +76 -58
  131. claude_mpm/dashboard/static/js/extension-error-handler.js +22 -22
  132. claude_mpm/dashboard/static/js/socket-client.js +138 -121
  133. claude_mpm/dashboard/templates/code_simple.html +23 -23
  134. claude_mpm/dashboard/templates/index.html +18 -18
  135. claude_mpm/experimental/cli_enhancements.py +1 -5
  136. claude_mpm/hooks/claude_hooks/__pycache__/__init__.cpython-313.pyc +0 -0
  137. claude_mpm/hooks/claude_hooks/__pycache__/event_handlers.cpython-313.pyc +0 -0
  138. claude_mpm/hooks/claude_hooks/__pycache__/hook_handler.cpython-313.pyc +0 -0
  139. claude_mpm/hooks/claude_hooks/__pycache__/memory_integration.cpython-313.pyc +0 -0
  140. claude_mpm/hooks/claude_hooks/__pycache__/response_tracking.cpython-313.pyc +0 -0
  141. claude_mpm/hooks/claude_hooks/__pycache__/tool_analysis.cpython-313.pyc +0 -0
  142. claude_mpm/hooks/claude_hooks/event_handlers.py +3 -1
  143. claude_mpm/hooks/claude_hooks/hook_handler.py +24 -7
  144. claude_mpm/hooks/claude_hooks/installer.py +45 -0
  145. claude_mpm/hooks/claude_hooks/memory_integration.py +12 -1
  146. claude_mpm/hooks/claude_hooks/services/__pycache__/__init__.cpython-313.pyc +0 -0
  147. claude_mpm/hooks/claude_hooks/services/__pycache__/connection_manager_http.cpython-313.pyc +0 -0
  148. claude_mpm/hooks/claude_hooks/services/__pycache__/duplicate_detector.cpython-313.pyc +0 -0
  149. claude_mpm/hooks/claude_hooks/services/__pycache__/state_manager.cpython-313.pyc +0 -0
  150. claude_mpm/hooks/claude_hooks/services/__pycache__/subagent_processor.cpython-313.pyc +0 -0
  151. claude_mpm/hooks/failure_learning/__init__.py +2 -8
  152. claude_mpm/hooks/failure_learning/failure_detection_hook.py +1 -6
  153. claude_mpm/hooks/failure_learning/fix_detection_hook.py +1 -6
  154. claude_mpm/hooks/failure_learning/learning_extraction_hook.py +1 -6
  155. claude_mpm/hooks/kuzu_response_hook.py +1 -5
  156. claude_mpm/hooks/templates/pre_tool_use_simple.py +78 -0
  157. claude_mpm/hooks/templates/pre_tool_use_template.py +323 -0
  158. claude_mpm/models/git_repository.py +198 -0
  159. claude_mpm/scripts/claude-hook-handler.sh +3 -3
  160. claude_mpm/scripts/start_activity_logging.py +3 -1
  161. claude_mpm/services/agents/agent_builder.py +45 -9
  162. claude_mpm/services/agents/agent_preset_service.py +238 -0
  163. claude_mpm/services/agents/agent_selection_service.py +484 -0
  164. claude_mpm/services/agents/auto_deploy_index_parser.py +569 -0
  165. claude_mpm/services/agents/cache_git_manager.py +621 -0
  166. claude_mpm/services/agents/deployment/agent_deployment.py +126 -2
  167. claude_mpm/services/agents/deployment/agent_discovery_service.py +105 -73
  168. claude_mpm/services/agents/deployment/agent_format_converter.py +1 -1
  169. claude_mpm/services/agents/deployment/agent_lifecycle_manager.py +1 -5
  170. claude_mpm/services/agents/deployment/agent_metrics_collector.py +3 -3
  171. claude_mpm/services/agents/deployment/agent_restore_handler.py +1 -4
  172. claude_mpm/services/agents/deployment/agent_template_builder.py +236 -15
  173. claude_mpm/services/agents/deployment/agents_directory_resolver.py +101 -15
  174. claude_mpm/services/agents/deployment/async_agent_deployment.py +2 -1
  175. claude_mpm/services/agents/deployment/facade/deployment_facade.py +3 -3
  176. claude_mpm/services/agents/deployment/multi_source_deployment_service.py +115 -15
  177. claude_mpm/services/agents/deployment/pipeline/pipeline_executor.py +2 -2
  178. claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +1 -4
  179. claude_mpm/services/agents/deployment/remote_agent_discovery_service.py +363 -0
  180. claude_mpm/services/agents/deployment/single_agent_deployer.py +2 -2
  181. claude_mpm/services/agents/deployment/system_instructions_deployer.py +168 -46
  182. claude_mpm/services/agents/deployment/validation/deployment_validator.py +2 -2
  183. claude_mpm/services/agents/git_source_manager.py +629 -0
  184. claude_mpm/services/agents/loading/framework_agent_loader.py +9 -12
  185. claude_mpm/services/agents/local_template_manager.py +50 -10
  186. claude_mpm/services/agents/single_tier_deployment_service.py +696 -0
  187. claude_mpm/services/agents/sources/__init__.py +13 -0
  188. claude_mpm/services/agents/sources/agent_sync_state.py +516 -0
  189. claude_mpm/services/agents/sources/git_source_sync_service.py +1087 -0
  190. claude_mpm/services/agents/startup_sync.py +239 -0
  191. claude_mpm/services/agents/toolchain_detector.py +474 -0
  192. claude_mpm/services/analysis/__init__.py +25 -0
  193. claude_mpm/services/analysis/postmortem_reporter.py +474 -0
  194. claude_mpm/services/analysis/postmortem_service.py +765 -0
  195. claude_mpm/services/cli/session_pause_manager.py +504 -0
  196. claude_mpm/services/cli/session_resume_helper.py +36 -16
  197. claude_mpm/services/cli/unified_dashboard_manager.py +1 -1
  198. claude_mpm/services/command_deployment_service.py +200 -6
  199. claude_mpm/services/core/base.py +31 -11
  200. claude_mpm/services/core/interfaces/__init__.py +1 -3
  201. claude_mpm/services/core/interfaces/health.py +1 -4
  202. claude_mpm/services/core/interfaces.py +56 -1
  203. claude_mpm/services/core/models/__init__.py +2 -11
  204. claude_mpm/services/core/models/agent_config.py +3 -0
  205. claude_mpm/services/core/models/process.py +4 -0
  206. claude_mpm/services/diagnostics/checks/__init__.py +4 -0
  207. claude_mpm/services/diagnostics/checks/agent_check.py +0 -2
  208. claude_mpm/services/diagnostics/checks/agent_sources_check.py +577 -0
  209. claude_mpm/services/diagnostics/checks/instructions_check.py +1 -2
  210. claude_mpm/services/diagnostics/checks/mcp_check.py +0 -1
  211. claude_mpm/services/diagnostics/checks/mcp_services_check.py +7 -15
  212. claude_mpm/services/diagnostics/checks/monitor_check.py +0 -1
  213. claude_mpm/services/diagnostics/checks/skill_sources_check.py +587 -0
  214. claude_mpm/services/diagnostics/diagnostic_runner.py +9 -0
  215. claude_mpm/services/diagnostics/doctor_reporter.py +40 -10
  216. claude_mpm/services/diagnostics/models.py +21 -0
  217. claude_mpm/services/event_bus/direct_relay.py +3 -3
  218. claude_mpm/services/event_bus/event_bus.py +36 -3
  219. claude_mpm/services/event_bus/relay.py +23 -7
  220. claude_mpm/services/events/consumers/logging.py +1 -2
  221. claude_mpm/services/git/__init__.py +21 -0
  222. claude_mpm/services/git/git_operations_service.py +494 -0
  223. claude_mpm/services/github/__init__.py +21 -0
  224. claude_mpm/services/github/github_cli_service.py +397 -0
  225. claude_mpm/services/infrastructure/monitoring/__init__.py +1 -5
  226. claude_mpm/services/infrastructure/monitoring/aggregator.py +1 -6
  227. claude_mpm/services/infrastructure/monitoring/resources.py +1 -1
  228. claude_mpm/services/instructions/__init__.py +9 -0
  229. claude_mpm/services/instructions/instruction_cache_service.py +374 -0
  230. claude_mpm/services/local_ops/__init__.py +5 -13
  231. claude_mpm/services/local_ops/health_checks/__init__.py +1 -3
  232. claude_mpm/services/local_ops/health_manager.py +1 -4
  233. claude_mpm/services/local_ops/process_manager.py +1 -1
  234. claude_mpm/services/local_ops/resource_monitor.py +2 -2
  235. claude_mpm/services/mcp_config_manager.py +75 -145
  236. claude_mpm/services/mcp_gateway/auto_configure.py +31 -25
  237. claude_mpm/services/mcp_gateway/config/configuration.py +1 -1
  238. claude_mpm/services/mcp_gateway/core/process_pool.py +41 -26
  239. claude_mpm/services/mcp_gateway/server/mcp_gateway.py +1 -6
  240. claude_mpm/services/mcp_gateway/server/stdio_server.py +0 -2
  241. claude_mpm/services/mcp_gateway/tools/document_summarizer.py +1 -1
  242. claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +26 -21
  243. claude_mpm/services/mcp_gateway/tools/kuzu_memory_service.py +6 -2
  244. claude_mpm/services/mcp_service_verifier.py +6 -3
  245. claude_mpm/services/memory/failure_tracker.py +19 -4
  246. claude_mpm/services/memory/optimizer.py +1 -1
  247. claude_mpm/services/model/model_router.py +8 -9
  248. claude_mpm/services/monitor/daemon.py +29 -9
  249. claude_mpm/services/monitor/daemon_manager.py +96 -19
  250. claude_mpm/services/monitor/server.py +2 -2
  251. claude_mpm/services/native_agent_converter.py +356 -0
  252. claude_mpm/services/port_manager.py +1 -1
  253. claude_mpm/services/pr/__init__.py +14 -0
  254. claude_mpm/services/pr/pr_template_service.py +329 -0
  255. claude_mpm/services/project/documentation_manager.py +2 -1
  256. claude_mpm/services/project/project_organizer.py +4 -0
  257. claude_mpm/services/project/toolchain_analyzer.py +3 -1
  258. claude_mpm/services/runner_configuration_service.py +17 -3
  259. claude_mpm/services/self_upgrade_service.py +165 -7
  260. claude_mpm/services/session_management_service.py +16 -4
  261. claude_mpm/services/skills/__init__.py +18 -0
  262. claude_mpm/services/skills/git_skill_source_manager.py +1169 -0
  263. claude_mpm/services/skills/skill_discovery_service.py +568 -0
  264. claude_mpm/services/skills_config.py +547 -0
  265. claude_mpm/services/skills_deployer.py +955 -0
  266. claude_mpm/services/socketio/handlers/connection.py +1 -1
  267. claude_mpm/services/socketio/handlers/git.py +2 -2
  268. claude_mpm/services/socketio/server/core.py +1 -4
  269. claude_mpm/services/socketio/server/main.py +1 -3
  270. claude_mpm/services/system_instructions_service.py +1 -3
  271. claude_mpm/services/unified/analyzer_strategies/performance_analyzer.py +0 -3
  272. claude_mpm/services/unified/analyzer_strategies/security_analyzer.py +0 -1
  273. claude_mpm/services/unified/deployment_strategies/cloud_strategies.py +1 -1
  274. claude_mpm/services/unified/deployment_strategies/vercel.py +1 -5
  275. claude_mpm/services/unified/unified_deployment.py +1 -5
  276. claude_mpm/services/version_control/conflict_resolution.py +6 -4
  277. claude_mpm/services/visualization/__init__.py +1 -5
  278. claude_mpm/services/visualization/mermaid_generator.py +2 -3
  279. claude_mpm/skills/__init__.py +3 -3
  280. claude_mpm/skills/agent_skills_injector.py +42 -49
  281. claude_mpm/skills/bundled/infrastructure/env-manager/scripts/validate_env.py +576 -0
  282. claude_mpm/skills/bundled/main/mcp-builder/scripts/connections.py +17 -10
  283. claude_mpm/skills/bundled/main/mcp-builder/scripts/evaluation.py +92 -39
  284. claude_mpm/skills/bundled/main/skill-creator/scripts/init_skill.py +13 -12
  285. claude_mpm/skills/bundled/main/skill-creator/scripts/package_skill.py +5 -3
  286. claude_mpm/skills/bundled/main/skill-creator/scripts/quick_validate.py +19 -12
  287. claude_mpm/skills/bundled/performance-profiling.md +6 -0
  288. claude_mpm/skills/bundled/testing/webapp-testing/examples/console_logging.py +6 -6
  289. claude_mpm/skills/bundled/testing/webapp-testing/examples/element_discovery.py +13 -9
  290. claude_mpm/skills/bundled/testing/webapp-testing/examples/static_html_automation.py +8 -8
  291. claude_mpm/skills/bundled/testing/webapp-testing/scripts/with_server.py +37 -15
  292. claude_mpm/skills/skills_registry.py +44 -48
  293. claude_mpm/skills/skills_service.py +117 -108
  294. claude_mpm/templates/questions/__init__.py +38 -0
  295. claude_mpm/templates/questions/base.py +193 -0
  296. claude_mpm/templates/questions/pr_strategy.py +311 -0
  297. claude_mpm/templates/questions/project_init.py +385 -0
  298. claude_mpm/templates/questions/ticket_mgmt.py +394 -0
  299. claude_mpm/tools/__main__.py +8 -8
  300. claude_mpm/tools/code_tree_analyzer/__init__.py +45 -0
  301. claude_mpm/tools/code_tree_analyzer/analysis.py +299 -0
  302. claude_mpm/tools/code_tree_analyzer/cache.py +131 -0
  303. claude_mpm/tools/code_tree_analyzer/core.py +380 -0
  304. claude_mpm/tools/code_tree_analyzer/discovery.py +403 -0
  305. claude_mpm/tools/code_tree_analyzer/events.py +168 -0
  306. claude_mpm/tools/code_tree_analyzer/gitignore.py +308 -0
  307. claude_mpm/tools/code_tree_analyzer/models.py +39 -0
  308. claude_mpm/tools/code_tree_analyzer/multilang_analyzer.py +224 -0
  309. claude_mpm/tools/code_tree_analyzer/python_analyzer.py +284 -0
  310. claude_mpm/utils/agent_dependency_loader.py +80 -13
  311. claude_mpm/utils/agent_filters.py +288 -0
  312. claude_mpm/utils/dependency_cache.py +3 -1
  313. claude_mpm/utils/gitignore.py +244 -0
  314. claude_mpm/utils/log_cleanup.py +3 -3
  315. claude_mpm/utils/migration.py +372 -0
  316. claude_mpm/utils/progress.py +387 -0
  317. claude_mpm/utils/robust_installer.py +3 -5
  318. claude_mpm/utils/structured_questions.py +619 -0
  319. {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/METADATA +496 -65
  320. {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/RECORD +328 -416
  321. claude_mpm/agents/templates/.claude-mpm/memories/README.md +0 -17
  322. claude_mpm/agents/templates/.claude-mpm/memories/engineer_memories.md +0 -3
  323. claude_mpm/agents/templates/agent-manager.json +0 -273
  324. claude_mpm/agents/templates/agentic-coder-optimizer.json +0 -248
  325. claude_mpm/agents/templates/api_qa.json +0 -180
  326. claude_mpm/agents/templates/circuit_breakers.md +0 -638
  327. claude_mpm/agents/templates/clerk-ops.json +0 -235
  328. claude_mpm/agents/templates/code_analyzer.json +0 -101
  329. claude_mpm/agents/templates/content-agent.json +0 -358
  330. claude_mpm/agents/templates/dart_engineer.json +0 -307
  331. claude_mpm/agents/templates/data_engineer.json +0 -225
  332. claude_mpm/agents/templates/documentation.json +0 -211
  333. claude_mpm/agents/templates/engineer.json +0 -210
  334. claude_mpm/agents/templates/gcp_ops_agent.json +0 -253
  335. claude_mpm/agents/templates/golang_engineer.json +0 -270
  336. claude_mpm/agents/templates/imagemagick.json +0 -264
  337. claude_mpm/agents/templates/java_engineer.json +0 -346
  338. claude_mpm/agents/templates/local_ops_agent.json +0 -1840
  339. claude_mpm/agents/templates/logs/prompts/agent_engineer_20250826_014258_728.md +0 -39
  340. claude_mpm/agents/templates/logs/prompts/agent_engineer_20250901_010124_142.md +0 -400
  341. claude_mpm/agents/templates/memory_manager.json +0 -158
  342. claude_mpm/agents/templates/nextjs_engineer.json +0 -285
  343. claude_mpm/agents/templates/ops.json +0 -185
  344. claude_mpm/agents/templates/php-engineer.json +0 -281
  345. claude_mpm/agents/templates/product_owner.json +0 -338
  346. claude_mpm/agents/templates/project_organizer.json +0 -140
  347. claude_mpm/agents/templates/prompt-engineer.json +0 -737
  348. claude_mpm/agents/templates/python_engineer.json +0 -387
  349. claude_mpm/agents/templates/qa.json +0 -242
  350. claude_mpm/agents/templates/react_engineer.json +0 -238
  351. claude_mpm/agents/templates/refactoring_engineer.json +0 -276
  352. claude_mpm/agents/templates/research.json +0 -188
  353. claude_mpm/agents/templates/ruby-engineer.json +0 -280
  354. claude_mpm/agents/templates/rust_engineer.json +0 -275
  355. claude_mpm/agents/templates/security.json +0 -202
  356. claude_mpm/agents/templates/svelte-engineer.json +0 -225
  357. claude_mpm/agents/templates/ticketing.json +0 -177
  358. claude_mpm/agents/templates/typescript_engineer.json +0 -285
  359. claude_mpm/agents/templates/vercel_ops_agent.json +0 -412
  360. claude_mpm/agents/templates/version_control.json +0 -157
  361. claude_mpm/agents/templates/web_qa.json +0 -399
  362. claude_mpm/agents/templates/web_ui.json +0 -189
  363. claude_mpm/cli/commands/mpm_init.py +0 -2093
  364. claude_mpm/commands/mpm-tickets.md +0 -102
  365. claude_mpm/dashboard/.claude-mpm/socketio-instances.json +0 -1
  366. claude_mpm/dashboard/react/components/DataInspector/DataInspector.module.css +0 -188
  367. claude_mpm/dashboard/react/components/EventViewer/EventViewer.module.css +0 -156
  368. claude_mpm/dashboard/react/components/shared/ConnectionStatus.module.css +0 -38
  369. claude_mpm/dashboard/react/components/shared/FilterBar.module.css +0 -92
  370. claude_mpm/dashboard/static/archive/activity_dashboard_fixed.html +0 -248
  371. claude_mpm/dashboard/static/archive/activity_dashboard_test.html +0 -61
  372. claude_mpm/dashboard/static/archive/test_activity_connection.html +0 -179
  373. claude_mpm/dashboard/static/archive/test_claude_tree_tab.html +0 -68
  374. claude_mpm/dashboard/static/archive/test_dashboard.html +0 -409
  375. claude_mpm/dashboard/static/archive/test_dashboard_fixed.html +0 -519
  376. claude_mpm/dashboard/static/archive/test_dashboard_verification.html +0 -181
  377. claude_mpm/dashboard/static/archive/test_file_data.html +0 -315
  378. claude_mpm/dashboard/static/archive/test_file_tree_empty_state.html +0 -243
  379. claude_mpm/dashboard/static/archive/test_file_tree_fix.html +0 -234
  380. claude_mpm/dashboard/static/archive/test_file_tree_rename.html +0 -117
  381. claude_mpm/dashboard/static/archive/test_file_tree_tab.html +0 -115
  382. claude_mpm/dashboard/static/archive/test_file_viewer.html +0 -224
  383. claude_mpm/dashboard/static/archive/test_final_activity.html +0 -220
  384. claude_mpm/dashboard/static/archive/test_tab_fix.html +0 -139
  385. claude_mpm/dashboard/static/built/assets/events.DjpNxWNo.css +0 -1
  386. claude_mpm/dashboard/static/built/components/activity-tree.js +0 -2
  387. claude_mpm/dashboard/static/built/components/agent-hierarchy.js +0 -777
  388. claude_mpm/dashboard/static/built/components/agent-inference.js +0 -2
  389. claude_mpm/dashboard/static/built/components/build-tracker.js +0 -333
  390. claude_mpm/dashboard/static/built/components/code-simple.js +0 -857
  391. claude_mpm/dashboard/static/built/components/code-tree/tree-breadcrumb.js +0 -353
  392. claude_mpm/dashboard/static/built/components/code-tree/tree-constants.js +0 -235
  393. claude_mpm/dashboard/static/built/components/code-tree/tree-search.js +0 -409
  394. claude_mpm/dashboard/static/built/components/code-tree/tree-utils.js +0 -435
  395. claude_mpm/dashboard/static/built/components/code-tree.js +0 -2
  396. claude_mpm/dashboard/static/built/components/code-viewer.js +0 -2
  397. claude_mpm/dashboard/static/built/components/connection-debug.js +0 -654
  398. claude_mpm/dashboard/static/built/components/diff-viewer.js +0 -891
  399. claude_mpm/dashboard/static/built/components/event-processor.js +0 -2
  400. claude_mpm/dashboard/static/built/components/event-viewer.js +0 -2
  401. claude_mpm/dashboard/static/built/components/export-manager.js +0 -2
  402. claude_mpm/dashboard/static/built/components/file-change-tracker.js +0 -443
  403. claude_mpm/dashboard/static/built/components/file-change-viewer.js +0 -690
  404. claude_mpm/dashboard/static/built/components/file-tool-tracker.js +0 -2
  405. claude_mpm/dashboard/static/built/components/file-viewer.js +0 -2
  406. claude_mpm/dashboard/static/built/components/hud-library-loader.js +0 -2
  407. claude_mpm/dashboard/static/built/components/hud-manager.js +0 -2
  408. claude_mpm/dashboard/static/built/components/hud-visualizer.js +0 -2
  409. claude_mpm/dashboard/static/built/components/module-viewer.js +0 -2
  410. claude_mpm/dashboard/static/built/components/nav-bar.js +0 -145
  411. claude_mpm/dashboard/static/built/components/page-structure.js +0 -429
  412. claude_mpm/dashboard/static/built/components/session-manager.js +0 -2
  413. claude_mpm/dashboard/static/built/components/socket-manager.js +0 -2
  414. claude_mpm/dashboard/static/built/components/ui-state-manager.js +0 -2
  415. claude_mpm/dashboard/static/built/components/unified-data-viewer.js +0 -2
  416. claude_mpm/dashboard/static/built/components/working-directory.js +0 -2
  417. claude_mpm/dashboard/static/built/connection-manager.js +0 -536
  418. claude_mpm/dashboard/static/built/dashboard.js +0 -2
  419. claude_mpm/dashboard/static/built/extension-error-handler.js +0 -164
  420. claude_mpm/dashboard/static/built/react/events.js +0 -30
  421. claude_mpm/dashboard/static/built/shared/dom-helpers.js +0 -396
  422. claude_mpm/dashboard/static/built/shared/event-bus.js +0 -330
  423. claude_mpm/dashboard/static/built/shared/event-filter-service.js +0 -540
  424. claude_mpm/dashboard/static/built/shared/logger.js +0 -385
  425. claude_mpm/dashboard/static/built/shared/page-structure.js +0 -249
  426. claude_mpm/dashboard/static/built/shared/tooltip-service.js +0 -253
  427. claude_mpm/dashboard/static/built/socket-client.js +0 -2
  428. claude_mpm/dashboard/static/built/tab-isolation-fix.js +0 -185
  429. claude_mpm/dashboard/static/dist/assets/events.DjpNxWNo.css +0 -1
  430. claude_mpm/dashboard/static/dist/components/activity-tree.js +0 -2
  431. claude_mpm/dashboard/static/dist/components/agent-inference.js +0 -2
  432. claude_mpm/dashboard/static/dist/components/code-tree.js +0 -2
  433. claude_mpm/dashboard/static/dist/components/code-viewer.js +0 -2
  434. claude_mpm/dashboard/static/dist/components/event-processor.js +0 -2
  435. claude_mpm/dashboard/static/dist/components/event-viewer.js +0 -2
  436. claude_mpm/dashboard/static/dist/components/export-manager.js +0 -2
  437. claude_mpm/dashboard/static/dist/components/file-tool-tracker.js +0 -2
  438. claude_mpm/dashboard/static/dist/components/file-viewer.js +0 -2
  439. claude_mpm/dashboard/static/dist/components/hud-library-loader.js +0 -2
  440. claude_mpm/dashboard/static/dist/components/hud-manager.js +0 -2
  441. claude_mpm/dashboard/static/dist/components/hud-visualizer.js +0 -2
  442. claude_mpm/dashboard/static/dist/components/module-viewer.js +0 -2
  443. claude_mpm/dashboard/static/dist/components/session-manager.js +0 -2
  444. claude_mpm/dashboard/static/dist/components/socket-manager.js +0 -2
  445. claude_mpm/dashboard/static/dist/components/ui-state-manager.js +0 -2
  446. claude_mpm/dashboard/static/dist/components/unified-data-viewer.js +0 -2
  447. claude_mpm/dashboard/static/dist/components/working-directory.js +0 -2
  448. claude_mpm/dashboard/static/dist/dashboard.js +0 -2
  449. claude_mpm/dashboard/static/dist/react/events.js +0 -30
  450. claude_mpm/dashboard/static/dist/socket-client.js +0 -2
  451. claude_mpm/dashboard/static/events.html +0 -607
  452. claude_mpm/dashboard/static/index.html +0 -635
  453. claude_mpm/dashboard/static/js/shared/dom-helpers.js +0 -396
  454. claude_mpm/dashboard/static/js/shared/event-bus.js +0 -330
  455. claude_mpm/dashboard/static/js/shared/logger.js +0 -385
  456. claude_mpm/dashboard/static/js/shared/tooltip-service.js +0 -253
  457. claude_mpm/dashboard/static/js/stores/dashboard-store.js +0 -562
  458. claude_mpm/dashboard/static/legacy/activity.html +0 -736
  459. claude_mpm/dashboard/static/legacy/agents.html +0 -786
  460. claude_mpm/dashboard/static/legacy/files.html +0 -747
  461. claude_mpm/dashboard/static/legacy/tools.html +0 -831
  462. claude_mpm/dashboard/static/monitors.html +0 -431
  463. claude_mpm/dashboard/static/production/events.html +0 -659
  464. claude_mpm/dashboard/static/production/main.html +0 -698
  465. claude_mpm/dashboard/static/production/monitors.html +0 -483
  466. claude_mpm/dashboard/static/test-archive/dashboard.html +0 -635
  467. claude_mpm/dashboard/static/test-archive/debug-events.html +0 -147
  468. claude_mpm/dashboard/static/test-archive/test-navigation.html +0 -256
  469. claude_mpm/dashboard/static/test-archive/test-react-exports.html +0 -180
  470. claude_mpm/dashboard/static/test-archive/test_debug.html +0 -25
  471. claude_mpm/skills/bundled/collaboration/brainstorming/SKILL.md +0 -75
  472. claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/SKILL.md +0 -184
  473. claude_mpm/skills/bundled/collaboration/requesting-code-review/SKILL.md +0 -107
  474. claude_mpm/skills/bundled/collaboration/requesting-code-review/code-reviewer.md +0 -146
  475. claude_mpm/skills/bundled/collaboration/writing-plans/SKILL.md +0 -118
  476. claude_mpm/skills/bundled/debugging/root-cause-tracing/SKILL.md +0 -177
  477. claude_mpm/skills/bundled/debugging/systematic-debugging/CREATION-LOG.md +0 -119
  478. claude_mpm/skills/bundled/debugging/systematic-debugging/SKILL.md +0 -148
  479. claude_mpm/skills/bundled/debugging/systematic-debugging/references/anti-patterns.md +0 -483
  480. claude_mpm/skills/bundled/debugging/systematic-debugging/references/examples.md +0 -452
  481. claude_mpm/skills/bundled/debugging/systematic-debugging/references/troubleshooting.md +0 -449
  482. claude_mpm/skills/bundled/debugging/systematic-debugging/references/workflow.md +0 -411
  483. claude_mpm/skills/bundled/debugging/systematic-debugging/test-academic.md +0 -14
  484. claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-1.md +0 -58
  485. claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-2.md +0 -68
  486. claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-3.md +0 -69
  487. claude_mpm/skills/bundled/debugging/verification-before-completion/SKILL.md +0 -175
  488. claude_mpm/skills/bundled/debugging/verification-before-completion/references/common-failures.md +0 -213
  489. claude_mpm/skills/bundled/debugging/verification-before-completion/references/gate-function.md +0 -314
  490. claude_mpm/skills/bundled/debugging/verification-before-completion/references/verification-patterns.md +0 -227
  491. claude_mpm/skills/bundled/main/artifacts-builder/SKILL.md +0 -74
  492. claude_mpm/skills/bundled/main/internal-comms/SKILL.md +0 -32
  493. claude_mpm/skills/bundled/main/internal-comms/examples/3p-updates.md +0 -47
  494. claude_mpm/skills/bundled/main/internal-comms/examples/company-newsletter.md +0 -65
  495. claude_mpm/skills/bundled/main/internal-comms/examples/faq-answers.md +0 -30
  496. claude_mpm/skills/bundled/main/internal-comms/examples/general-comms.md +0 -16
  497. claude_mpm/skills/bundled/main/mcp-builder/SKILL.md +0 -328
  498. claude_mpm/skills/bundled/main/mcp-builder/reference/evaluation.md +0 -602
  499. claude_mpm/skills/bundled/main/mcp-builder/reference/mcp_best_practices.md +0 -915
  500. claude_mpm/skills/bundled/main/mcp-builder/reference/node_mcp_server.md +0 -916
  501. claude_mpm/skills/bundled/main/mcp-builder/reference/python_mcp_server.md +0 -752
  502. claude_mpm/skills/bundled/main/skill-creator/SKILL.md +0 -209
  503. claude_mpm/skills/bundled/testing/condition-based-waiting/SKILL.md +0 -123
  504. claude_mpm/skills/bundled/testing/test-driven-development/SKILL.md +0 -145
  505. claude_mpm/skills/bundled/testing/test-driven-development/references/anti-patterns.md +0 -543
  506. claude_mpm/skills/bundled/testing/test-driven-development/references/examples.md +0 -741
  507. claude_mpm/skills/bundled/testing/test-driven-development/references/integration.md +0 -470
  508. claude_mpm/skills/bundled/testing/test-driven-development/references/philosophy.md +0 -458
  509. claude_mpm/skills/bundled/testing/test-driven-development/references/workflow.md +0 -639
  510. claude_mpm/skills/bundled/testing/testing-anti-patterns/SKILL.md +0 -304
  511. claude_mpm/skills/bundled/testing/webapp-testing/SKILL.md +0 -96
  512. claude_mpm/tools/code_tree_analyzer.py +0 -1825
  513. /claude_mpm/agents/templates/{git_file_tracking.md → git-file-tracking.md} +0 -0
  514. /claude_mpm/agents/templates/{pm_examples.md → pm-examples.md} +0 -0
  515. /claude_mpm/agents/templates/{response_format.md → response-format.md} +0 -0
  516. /claude_mpm/agents/templates/{validation_templates.md → validation-templates.md} +0 -0
  517. {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/WHEEL +0 -0
  518. {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/entry_points.txt +0 -0
  519. {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/licenses/LICENSE +0 -0
  520. {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/top_level.txt +0 -0
@@ -21,11 +21,9 @@ from ...services.cli.agent_dependency_service import AgentDependencyService
21
21
  from ...services.cli.agent_listing_service import AgentListingService
22
22
  from ...services.cli.agent_output_formatter import AgentOutputFormatter
23
23
  from ...services.cli.agent_validation_service import AgentValidationService
24
- from ..shared import (
25
- AgentCommand,
26
- CommandResult,
27
- )
24
+ from ..shared import AgentCommand, CommandResult
28
25
  from ..utils import get_agent_versions_display
26
+ from .agents_cleanup import handle_agents_cleanup
29
27
 
30
28
 
31
29
  def _is_structured_output(args) -> bool:
@@ -149,6 +147,7 @@ class AgentsCommand(AgentCommand):
149
147
  "deps-install": self._install_agent_dependencies,
150
148
  "deps-list": self._list_agent_dependencies,
151
149
  "deps-fix": self._fix_agent_dependencies,
150
+ "cleanup": lambda a: self._handle_cleanup_command(a),
152
151
  "cleanup-orphaned": self._cleanup_orphaned_agents,
153
152
  # Local agent management commands
154
153
  "create": self._create_local_agent,
@@ -156,9 +155,24 @@ class AgentsCommand(AgentCommand):
156
155
  "delete": self._delete_local_agent,
157
156
  "manage": self._manage_local_agents,
158
157
  "configure": self._configure_deployment,
158
+ # Migration command (DEPRECATION support)
159
+ "migrate-to-project": self._migrate_to_project,
159
160
  # Auto-configuration commands (TSK-0054 Phase 5)
160
161
  "detect": self._detect_toolchain,
161
162
  "recommend": self._recommend_agents,
163
+ # Agent selection modes (Phase 3: 1M-382)
164
+ "deploy-minimal": self._deploy_minimal_configuration,
165
+ "deploy-auto": self._deploy_auto_configure,
166
+ # Agent source management (Phase 2: 1M-442)
167
+ "available": self._list_available_from_sources,
168
+ # Agent discovery with rich filtering (Phase 1: Discovery & Browsing)
169
+ "discover": self._discover_agents,
170
+ # Cache git management commands
171
+ "cache-status": self._cache_status,
172
+ "cache-pull": self._cache_pull,
173
+ "cache-push": self._cache_push,
174
+ "cache-sync": self._cache_sync,
175
+ "cache-commit": self._cache_commit,
162
176
  }
163
177
 
164
178
  if args.agents_command in command_map:
@@ -396,31 +410,210 @@ class AgentsCommand(AgentCommand):
396
410
  self.logger.error(f"Error listing agents by tier: {e}", exc_info=True)
397
411
  return CommandResult.error_result(f"Error listing agents by tier: {e}")
398
412
 
413
+ def _list_available_from_sources(self, args) -> CommandResult:
414
+ """List available agents from all configured git sources.
415
+
416
+ This command shows agents discovered from configured agent sources
417
+ (Git repositories) after syncing their cache. Implements Phase 2 of 1M-442.
418
+
419
+ Args:
420
+ args: Command arguments with optional source filter and format
421
+
422
+ Returns:
423
+ CommandResult with agent list or error
424
+ """
425
+ try:
426
+ from ...config.agent_sources import AgentSourceConfiguration
427
+ from ...services.agents.git_source_manager import GitSourceManager
428
+
429
+ # Load agent sources configuration
430
+ config = AgentSourceConfiguration.load()
431
+ enabled_repos = [r for r in config.repositories if r.enabled]
432
+
433
+ if not enabled_repos:
434
+ message = (
435
+ "No agent sources configured.\n\n"
436
+ "Configure sources with:\n"
437
+ " claude-mpm agent-source add <url>\n\n"
438
+ "Example:\n"
439
+ " claude-mpm agent-source add https://github.com/owner/repo/agents"
440
+ )
441
+ print(message)
442
+ return CommandResult.error_result("No agent sources configured")
443
+
444
+ # Initialize git source manager
445
+ manager = GitSourceManager()
446
+
447
+ # Sync all configured sources (with timeout)
448
+ self.logger.info(f"Syncing {len(enabled_repos)} agent sources...")
449
+ sync_results = {}
450
+
451
+ for repo in enabled_repos:
452
+ try:
453
+ result = manager.sync_repository(repo, force=False)
454
+ sync_results[repo.identifier] = result
455
+ except Exception as e:
456
+ self.logger.warning(f"Failed to sync {repo.identifier}: {e}")
457
+ sync_results[repo.identifier] = {"synced": False, "error": str(e)}
458
+
459
+ # Get source filter from args
460
+ source_filter = getattr(args, "source", None)
461
+
462
+ # List all cached agents
463
+ all_agents = manager.list_cached_agents(repo_identifier=source_filter)
464
+
465
+ if not all_agents:
466
+ message = "No agents found in configured sources."
467
+ if sync_results:
468
+ failed_count = sum(
469
+ 1 for r in sync_results.values() if not r.get("synced")
470
+ )
471
+ if failed_count > 0:
472
+ message += f"\n\n{failed_count} source(s) failed to sync. Check logs for details."
473
+ print(message)
474
+ return CommandResult.success_result(message, data={"agents": []})
475
+
476
+ # Format output
477
+ output_format = getattr(args, "format", "table")
478
+
479
+ if output_format == "json":
480
+ import json
481
+
482
+ print(json.dumps(all_agents, indent=2))
483
+ elif output_format == "simple":
484
+ for agent in all_agents:
485
+ name = agent.get("metadata", {}).get(
486
+ "name", agent.get("agent_id", "unknown")
487
+ )
488
+ repo = agent.get("repository", "unknown")
489
+ print(f"{name} (from {repo})")
490
+ else: # table format
491
+ print(f"\n{'Agent Name':<30} {'Repository':<40} {'Version':<15}")
492
+ print("=" * 85)
493
+ for agent in all_agents:
494
+ name = agent.get("metadata", {}).get(
495
+ "name", agent.get("agent_id", "unknown")
496
+ )
497
+ repo = agent.get("repository", "unknown")
498
+ version = agent.get("version", "unknown")[:12]
499
+ print(f"{name:<30} {repo:<40} {version:<15}")
500
+ print(
501
+ f"\nTotal: {len(all_agents)} agents from {len(sync_results)} sources"
502
+ )
503
+
504
+ return CommandResult.success_result(
505
+ f"Listed {len(all_agents)} agents from sources",
506
+ data={"agents": all_agents, "sync_results": sync_results},
507
+ )
508
+
509
+ except Exception as e:
510
+ self.logger.error(f"Error listing available agents: {e}", exc_info=True)
511
+ return CommandResult.error_result(f"Error listing available agents: {e}")
512
+
513
+ def _discover_agents(self, args) -> CommandResult:
514
+ """Discover agents with rich filtering capabilities.
515
+
516
+ This command extends the 'available' command by adding semantic filtering
517
+ based on AUTO-DEPLOY-INDEX.md categories. Users can filter by category,
518
+ language, framework, platform, and specialization.
519
+
520
+ Design Decision: Delegate to agents_discover.py module
521
+
522
+ Rationale: Keep CLI command logic separate from routing logic for better
523
+ testability and maintainability. The discover_command function handles
524
+ all the complex filtering and formatting logic.
525
+
526
+ Args:
527
+ args: Command arguments with filter options:
528
+ - source: Source repository filter
529
+ - category: Category filter (e.g., 'engineer/backend')
530
+ - language: Language filter (e.g., 'python')
531
+ - framework: Framework filter (e.g., 'react')
532
+ - platform: Platform filter (e.g., 'vercel')
533
+ - specialization: Specialization filter (e.g., 'data')
534
+ - format: Output format (table, json, simple)
535
+ - verbose: Show descriptions and metadata
536
+
537
+ Returns:
538
+ CommandResult with filtered agent list or error
539
+
540
+ Example:
541
+ >>> # Called via: claude-mpm agents discover --category engineer/backend
542
+ >>> _discover_agents(args)
543
+ CommandResult(success=True, message="Discovered 8 agents")
544
+ """
545
+ try:
546
+ from .agents_discover import discover_command
547
+
548
+ # Call discover_command and convert exit code to CommandResult
549
+ exit_code = discover_command(args)
550
+
551
+ if exit_code == 0:
552
+ return CommandResult.success_result("Agent discovery complete")
553
+ return CommandResult.error_result("Agent discovery failed")
554
+
555
+ except Exception as e:
556
+ self.logger.error(f"Error discovering agents: {e}", exc_info=True)
557
+ return CommandResult.error_result(f"Error discovering agents: {e}")
558
+
399
559
  def _deploy_agents(self, args, force=False) -> CommandResult:
400
- """Deploy both system and project agents."""
560
+ """Deploy agents using two-phase sync: cache → deploy.
561
+
562
+ Phase 3 Integration (1M-486): Uses Git sync service for deployment.
563
+ - Phase 1: Sync agents to ~/.claude-mpm/cache/remote-agents/ (if needed)
564
+ - Phase 2: Deploy from cache to project .claude-mpm/agents/
565
+
566
+ This replaces the old single-tier deployment with a multi-project
567
+ architecture where one cache serves multiple project deployments.
568
+ """
401
569
  try:
402
- # Deploy system agents
403
- system_result = self.deployment_service.deploy_system_agents(force=force)
570
+ # Handle preset deployment (uses different path)
571
+ if hasattr(args, "preset") and args.preset:
572
+ return self._deploy_preset(args)
573
+
574
+ from ...services.agents.sources.git_source_sync_service import (
575
+ GitSourceSyncService,
576
+ )
577
+
578
+ # Initialize git sync service
579
+ git_sync = GitSourceSyncService()
580
+ project_dir = Path.cwd()
404
581
 
405
- # Deploy project agents if they exist
406
- project_result = self.deployment_service.deploy_project_agents(force=force)
582
+ self.logger.info("Phase 1: Syncing agents to cache...")
407
583
 
408
- # Combine results
584
+ # Sync to cache (downloads from GitHub if needed)
585
+ sync_result = git_sync.sync_repository(force=force)
586
+
587
+ if not sync_result.get("synced"):
588
+ error_msg = sync_result.get("error", "Unknown sync error")
589
+ self.logger.error(f"Sync failed: {error_msg}")
590
+ return CommandResult.error_result(f"Sync failed: {error_msg}")
591
+
592
+ self.logger.info(
593
+ f"Phase 1 complete: {sync_result.get('agent_count', 0)} agents in cache"
594
+ )
595
+ self.logger.info(f"Phase 2: Deploying agents to {project_dir}...")
596
+
597
+ # Deploy from cache to project directory
598
+ deploy_result = git_sync.deploy_agents_to_project(
599
+ project_dir=project_dir,
600
+ agent_list=None, # Deploy all cached agents
601
+ force=force,
602
+ )
603
+
604
+ # Format combined results for output
409
605
  combined_result = {
410
- "deployed_count": system_result.get("deployed_count", 0)
411
- + project_result.get("deployed_count", 0),
412
- "deployed": system_result.get("deployed", [])
413
- + project_result.get("deployed", []),
414
- "updated_count": system_result.get("updated_count", 0)
415
- + project_result.get("updated_count", 0),
416
- "updated": system_result.get("updated", [])
417
- + project_result.get("updated", []),
418
- "skipped": system_result.get("skipped", [])
419
- + project_result.get("skipped", []),
420
- "errors": system_result.get("errors", [])
421
- + project_result.get("errors", []),
422
- "target_dir": system_result.get("target_dir")
423
- or project_result.get("target_dir"),
606
+ "deployed_count": len(deploy_result.get("deployed", []))
607
+ + len(deploy_result.get("updated", [])),
608
+ "deployed": deploy_result.get("deployed", []),
609
+ "updated": deploy_result.get("updated", []),
610
+ "skipped": deploy_result.get("skipped", []),
611
+ "errors": deploy_result.get("failed", []),
612
+ "target_dir": deploy_result.get("deployment_dir", ""),
613
+ "sync_info": {
614
+ "cached_agents": sync_result.get("agent_count", 0),
615
+ "cache_dir": sync_result.get("cache_dir", ""),
616
+ },
424
617
  }
425
618
 
426
619
  output_format = self._get_output_format(args)
@@ -431,12 +624,15 @@ class AgentsCommand(AgentCommand):
431
624
  )
432
625
  print(formatted)
433
626
 
627
+ success_count = len(deploy_result["deployed"]) + len(
628
+ deploy_result["updated"]
629
+ )
434
630
  return CommandResult.success_result(
435
- f"Deployed {combined_result['deployed_count']} agents",
631
+ f"Deployed {success_count} agents from cache",
436
632
  data={
437
- "system_agents": system_result,
438
- "project_agents": project_result,
439
- "total_deployed": combined_result["deployed_count"],
633
+ "sync_result": sync_result,
634
+ "deploy_result": deploy_result,
635
+ "total_deployed": success_count,
440
636
  },
441
637
  )
442
638
 
@@ -444,6 +640,173 @@ class AgentsCommand(AgentCommand):
444
640
  self.logger.error(f"Error deploying agents: {e}", exc_info=True)
445
641
  return CommandResult.error_result(f"Error deploying agents: {e}")
446
642
 
643
+ def _deploy_preset(self, args) -> CommandResult:
644
+ """Deploy agents by preset name.
645
+
646
+ This method implements Phase 2 of the agents/skills CLI redesign,
647
+ enabling preset-based deployment like:
648
+ claude-mpm agents deploy --preset python-dev
649
+
650
+ Args:
651
+ args: Command arguments with preset name and optional flags
652
+
653
+ Returns:
654
+ CommandResult with deployment status
655
+ """
656
+ try:
657
+ from pathlib import Path
658
+
659
+ from ...config.agent_sources import AgentSourceConfiguration
660
+ from ...services.agents.agent_preset_service import AgentPresetService
661
+ from ...services.agents.git_source_manager import GitSourceManager
662
+ from ...services.agents.single_tier_deployment_service import (
663
+ SingleTierDeploymentService,
664
+ )
665
+
666
+ preset_name = args.preset
667
+ dry_run = getattr(args, "dry_run", False)
668
+
669
+ # Initialize services
670
+ config = AgentSourceConfiguration.load()
671
+ deployment_dir = Path.home() / ".claude" / "agents"
672
+ git_source_manager = GitSourceManager()
673
+ preset_service = AgentPresetService(git_source_manager)
674
+ deployment_service = SingleTierDeploymentService(config, deployment_dir)
675
+
676
+ # Validate preset
677
+ if not preset_service.validate_preset(preset_name):
678
+ available = preset_service.list_presets()
679
+ print(f"❌ Unknown preset: {preset_name}")
680
+ print("\n📚 Available presets:")
681
+ for preset in available:
682
+ print(
683
+ f" • {preset['name']}: {preset['description']} ({preset['agent_count']} agents)"
684
+ )
685
+ print(f" Use cases: {', '.join(preset['use_cases'])}")
686
+ return CommandResult.error_result(f"Unknown preset: {preset_name}")
687
+
688
+ # Resolve preset to agent list
689
+ print(f"\n🔍 Resolving preset: {preset_name}")
690
+ resolution = preset_service.resolve_agents(
691
+ preset_name, validate_availability=True
692
+ )
693
+
694
+ # Show preset info
695
+ preset_info = resolution["preset_info"]
696
+ print(f"\n🎯 Preset: {preset_info['description']}")
697
+ print(f" Agents: {preset_info['agent_count']}")
698
+ print(f" Use cases: {', '.join(preset_info['use_cases'])}")
699
+
700
+ # Show warnings for missing agents
701
+ if resolution["missing_agents"]:
702
+ print("\n⚠️ Missing agents (not found in configured sources):")
703
+ for agent_id in resolution["missing_agents"]:
704
+ print(f" • {agent_id}")
705
+ print("\n💡 These agents are not available in your configured sources.")
706
+ print(" Deployment will continue with available agents.")
707
+
708
+ # Show conflicts
709
+ if resolution["conflicts"]:
710
+ print("\n⚠️ Priority conflicts detected:")
711
+ for conflict in resolution["conflicts"]:
712
+ sources = ", ".join(conflict["sources"])
713
+ print(f" • {conflict['agent_id']} (found in: {sources})")
714
+ print(" Using highest priority source for each")
715
+
716
+ # Dry run mode
717
+ if dry_run:
718
+ print("\n🔍 DRY RUN: Preview agent deployment\n")
719
+ print("Agents to deploy:")
720
+ for agent in resolution["agents"]:
721
+ source = agent.get("source", "unknown")
722
+ print(f" ✓ {agent['agent_id']} (from {source})")
723
+ print(
724
+ "\n💡 This is a dry run. Run without --dry-run to actually deploy."
725
+ )
726
+ return CommandResult.success_result(
727
+ "Dry run complete",
728
+ data={
729
+ "preset": preset_name,
730
+ "agents": resolution["agents"],
731
+ "missing": resolution["missing_agents"],
732
+ },
733
+ )
734
+
735
+ # Deploy agents
736
+ print(f"\n📦 Deploying {len(resolution['agents'])} agents...")
737
+ deployed_count = 0
738
+ failed_count = 0
739
+ skipped_count = len(resolution["missing_agents"])
740
+ deployed_agents = []
741
+ failed_agents = []
742
+
743
+ for agent in resolution["agents"]:
744
+ agent_id = agent["agent_id"]
745
+ try:
746
+ # Deploy using single-tier deployment service
747
+ result = deployment_service.deploy_agent(
748
+ agent_id, source_repo=agent.get("source"), dry_run=False
749
+ )
750
+
751
+ if result.get("deployed"):
752
+ deployed_count += 1
753
+ deployed_agents.append(agent_id)
754
+ print(f" ✓ {agent_id}")
755
+ else:
756
+ failed_count += 1
757
+ failed_agents.append(
758
+ {
759
+ "agent_id": agent_id,
760
+ "error": result.get("error", "Unknown"),
761
+ }
762
+ )
763
+ print(f" ✗ {agent_id}: {result.get('error', 'Failed')}")
764
+
765
+ except Exception as e:
766
+ failed_count += 1
767
+ failed_agents.append({"agent_id": agent_id, "error": str(e)})
768
+ print(f" ✗ {agent_id}: {e}")
769
+
770
+ # Summary
771
+ print(f"\n{'=' * 60}")
772
+ print("📊 Deployment Summary")
773
+ print(f"{'=' * 60}")
774
+ print(f" ✅ Deployed: {deployed_count}")
775
+ print(f" ❌ Failed: {failed_count}")
776
+ print(f" ⏭️ Skipped: {skipped_count} (missing from sources)")
777
+ print(f"{'=' * 60}\n")
778
+
779
+ if failed_agents:
780
+ print("❌ Failed agents:")
781
+ for failure in failed_agents:
782
+ print(f" • {failure['agent_id']}: {failure['error']}")
783
+ print()
784
+
785
+ if deployed_count > 0:
786
+ print(f"✅ Successfully deployed {deployed_count} agents!")
787
+ return CommandResult.success_result(
788
+ f"Deployed {deployed_count} agents from preset '{preset_name}'",
789
+ data={
790
+ "preset": preset_name,
791
+ "deployed": deployed_agents,
792
+ "failed": failed_agents,
793
+ "skipped": resolution["missing_agents"],
794
+ },
795
+ )
796
+ return CommandResult.error_result(
797
+ f"No agents deployed from preset '{preset_name}'",
798
+ data={
799
+ "preset": preset_name,
800
+ "failed": failed_agents,
801
+ "skipped": resolution["missing_agents"],
802
+ },
803
+ )
804
+
805
+ except Exception as e:
806
+ self.logger.error(f"Error deploying preset: {e}", exc_info=True)
807
+ print(f"\n❌ Error deploying preset: {e}")
808
+ return CommandResult.error_result(f"Error deploying preset: {e}")
809
+
447
810
  def _clean_agents(self, args) -> CommandResult:
448
811
  """Clean deployed agents."""
449
812
  try:
@@ -904,6 +1267,16 @@ class AgentsCommand(AgentCommand):
904
1267
  self.logger.error(f"Error fixing dependencies: {e}", exc_info=True)
905
1268
  return CommandResult.error_result(f"Error fixing dependencies: {e}")
906
1269
 
1270
+ def _handle_cleanup_command(self, args) -> CommandResult:
1271
+ """Handle cleanup command with proper result wrapping."""
1272
+ exit_code = handle_agents_cleanup(args)
1273
+ return CommandResult(
1274
+ success=exit_code == 0,
1275
+ message=(
1276
+ "Agent cleanup complete" if exit_code == 0 else "Agent cleanup failed"
1277
+ ),
1278
+ )
1279
+
907
1280
  def _cleanup_orphaned_agents(self, args) -> CommandResult:
908
1281
  """Clean up orphaned agents that don't have templates."""
909
1282
  try:
@@ -1125,18 +1498,46 @@ class AgentsCommand(AgentCommand):
1125
1498
  return CommandResult.error_result(f"Error deleting local agents: {e}")
1126
1499
 
1127
1500
  def _manage_local_agents(self, args) -> CommandResult:
1128
- """Launch interactive management menu for local agents."""
1501
+ """Redirect to main configuration interface (DEPRECATED)."""
1129
1502
  try:
1130
- from ..interactive.agent_wizard import run_interactive_agent_manager
1503
+ from rich.console import Console
1504
+ from rich.prompt import Confirm
1131
1505
 
1132
- exit_code = run_interactive_agent_manager()
1133
- if exit_code == 0:
1134
- return CommandResult.success_result("Agent management completed")
1135
- return CommandResult.error_result("Agent management failed or cancelled")
1506
+ console = Console()
1507
+
1508
+ console.print(
1509
+ "\n[bold cyan]╭─────────────────────────────────────────╮[/bold cyan]"
1510
+ )
1511
+ console.print(
1512
+ "[bold cyan]│ Agent Management Has Moved! │[/bold cyan]"
1513
+ )
1514
+ console.print(
1515
+ "[bold cyan]╰─────────────────────────────────────────╯[/bold cyan]\n"
1516
+ )
1517
+
1518
+ console.print("For a better experience with integrated configuration:")
1519
+ console.print(" • Agent management")
1520
+ console.print(" • Skills management")
1521
+ console.print(" • Template editing")
1522
+ console.print(" • Behavior configuration")
1523
+ console.print(" • Startup settings\n")
1524
+
1525
+ console.print("Please use: [bold green]claude-mpm config[/bold green]\n")
1526
+
1527
+ if Confirm.ask("Launch configuration interface now?", default=True):
1528
+ # Import and run config command directly
1529
+ from claude_mpm.cli.commands.configure import ConfigureCommand
1530
+
1531
+ config_cmd = ConfigureCommand()
1532
+ return config_cmd.execute(args)
1533
+ console.print(
1534
+ "\n[dim]Run 'claude-mpm config' anytime to access agent management[/dim]"
1535
+ )
1536
+ return CommandResult.success_result("Redirected to config interface")
1136
1537
 
1137
1538
  except Exception as e:
1138
- self.logger.error(f"Error managing local agents: {e}", exc_info=True)
1139
- return CommandResult.error_result(f"Error managing local agents: {e}")
1539
+ self.logger.error(f"Error redirecting to config: {e}", exc_info=True)
1540
+ return CommandResult.error_result(f"Error redirecting to config: {e}")
1140
1541
 
1141
1542
  def _configure_deployment(self, args) -> CommandResult:
1142
1543
  """Configure agent deployment settings."""
@@ -1448,6 +1849,528 @@ class AgentsCommand(AgentCommand):
1448
1849
  self.logger.error(f"Error recommending agents: {e}", exc_info=True)
1449
1850
  return CommandResult.error_result(f"Error recommending agents: {e}")
1450
1851
 
1852
+ def _migrate_to_project(self, args) -> CommandResult:
1853
+ """Migrate user-level agents to project-level.
1854
+
1855
+ DEPRECATION: User-level agents (~/.claude-mpm/agents/) are deprecated and
1856
+ will be removed in v5.0.0. This command migrates them to project-level
1857
+ (.claude-mpm/agents/) where they belong.
1858
+
1859
+ Args:
1860
+ args: Command arguments with dry_run and force flags
1861
+
1862
+ Returns:
1863
+ CommandResult with migration status
1864
+ """
1865
+ import shutil
1866
+
1867
+ try:
1868
+ user_agents_dir = Path.home() / ".claude-mpm" / "agents"
1869
+ project_agents_dir = Path.cwd() / ".claude-mpm" / "agents"
1870
+
1871
+ dry_run = getattr(args, "dry_run", False)
1872
+ force = getattr(args, "force", False)
1873
+
1874
+ # Check if user agents directory exists
1875
+ if not user_agents_dir.exists():
1876
+ print("✅ No user-level agents found. Nothing to migrate.")
1877
+ return CommandResult.success_result("No user-level agents to migrate")
1878
+
1879
+ # Find all user agent files
1880
+ user_agent_files = list(user_agents_dir.glob("*.json")) + list(
1881
+ user_agents_dir.glob("*.md")
1882
+ )
1883
+
1884
+ if not user_agent_files:
1885
+ print("✅ No user-level agents found. Nothing to migrate.")
1886
+ return CommandResult.success_result("No user-level agents to migrate")
1887
+
1888
+ # Display what we found
1889
+ print(f"\n📦 Found {len(user_agent_files)} user-level agent(s) to migrate:")
1890
+ for agent_file in user_agent_files:
1891
+ print(f" - {agent_file.name}")
1892
+
1893
+ if dry_run:
1894
+ print("\n🔍 DRY RUN: Would migrate to:")
1895
+ print(f" → {project_agents_dir}")
1896
+ print("\nRun without --dry-run to perform the migration.")
1897
+ return CommandResult.success_result(
1898
+ "Dry run completed",
1899
+ data={
1900
+ "user_agents_found": len(user_agent_files),
1901
+ "target_directory": str(project_agents_dir),
1902
+ },
1903
+ )
1904
+
1905
+ # Create project agents directory
1906
+ project_agents_dir.mkdir(parents=True, exist_ok=True)
1907
+
1908
+ # Migrate agents
1909
+ migrated = 0
1910
+ skipped = 0
1911
+ errors = []
1912
+
1913
+ for agent_file in user_agent_files:
1914
+ target_file = project_agents_dir / agent_file.name
1915
+
1916
+ # Check for conflicts
1917
+ if target_file.exists() and not force:
1918
+ print(f"⚠️ Skipping {agent_file.name} (already exists in project)")
1919
+ print(" Use --force to overwrite existing agents")
1920
+ skipped += 1
1921
+ continue
1922
+
1923
+ try:
1924
+ # Copy agent to project directory
1925
+ shutil.copy2(agent_file, target_file)
1926
+ migrated += 1
1927
+ print(f"✅ Migrated {agent_file.name}")
1928
+ except Exception as e:
1929
+ error_msg = f"Failed to migrate {agent_file.name}: {e}"
1930
+ errors.append(error_msg)
1931
+ print(f"❌ {error_msg}")
1932
+
1933
+ # Summary
1934
+ print("\n📊 Migration Summary:")
1935
+ print(f" ✅ Migrated: {migrated}/{len(user_agent_files)}")
1936
+ if skipped > 0:
1937
+ print(f" ⏭️ Skipped: {skipped} (already exist)")
1938
+ if errors:
1939
+ print(f" ❌ Errors: {len(errors)}")
1940
+
1941
+ if migrated > 0:
1942
+ print(f"\n✅ Successfully migrated {migrated} agent(s) to:")
1943
+ print(f" {project_agents_dir}")
1944
+ print(
1945
+ "\n⚠️ IMPORTANT: Verify agents work correctly, then remove user-level agents:"
1946
+ )
1947
+ print(f" rm -rf {user_agents_dir}")
1948
+ print("\n💡 Why this change?")
1949
+ print(" - Project isolation: Each project has its own agents")
1950
+ print(" - Version control: Agents can be versioned with your code")
1951
+ print(" - Team consistency: Everyone uses the same agents")
1952
+
1953
+ return CommandResult.success_result(
1954
+ f"Migrated {migrated} agents",
1955
+ data={
1956
+ "migrated": migrated,
1957
+ "skipped": skipped,
1958
+ "errors": errors,
1959
+ "total": len(user_agent_files),
1960
+ },
1961
+ )
1962
+
1963
+ except Exception as e:
1964
+ self.logger.error(f"Error migrating agents: {e}", exc_info=True)
1965
+ return CommandResult.error_result(f"Error migrating agents: {e}")
1966
+
1967
+ def _deploy_minimal_configuration(self, args) -> CommandResult:
1968
+ """Deploy minimal configuration (6 core agents).
1969
+
1970
+ Part of Phase 3 (1M-382): Agent Selection Modes.
1971
+ Deploy exactly 6 agents for basic Claude MPM workflow:
1972
+ engineer, documentation, qa, research, ops, ticketing.
1973
+ """
1974
+ try:
1975
+ from ...config.agent_sources import AgentSourceConfiguration
1976
+ from ...services.agents.agent_selection_service import AgentSelectionService
1977
+ from ...services.agents.single_tier_deployment_service import (
1978
+ SingleTierDeploymentService,
1979
+ )
1980
+
1981
+ # Initialize services
1982
+ config = AgentSourceConfiguration.load()
1983
+ deployment_dir = Path.home() / ".claude" / "agents"
1984
+ deployment_service = SingleTierDeploymentService(config, deployment_dir)
1985
+ selection_service = AgentSelectionService(deployment_service)
1986
+
1987
+ # Get dry_run flag
1988
+ dry_run = getattr(args, "dry_run", False)
1989
+
1990
+ # Deploy minimal configuration
1991
+ print("🎯 Deploying minimal configuration (6 core agents)...")
1992
+ if dry_run:
1993
+ print("🔍 DRY RUN MODE - No agents will be deployed\n")
1994
+
1995
+ result = selection_service.deploy_minimal_configuration(dry_run=dry_run)
1996
+
1997
+ # Format output
1998
+ output_format = self._get_output_format(args)
1999
+ if self._is_structured_format(output_format):
2000
+ formatted = (
2001
+ self._formatter.format_as_json(result)
2002
+ if str(output_format).lower() == OutputFormat.JSON
2003
+ else self._formatter.format_as_yaml(result)
2004
+ )
2005
+ print(formatted)
2006
+ return CommandResult.success_result(
2007
+ f"Minimal configuration {result['status']}", data=result
2008
+ )
2009
+
2010
+ # Text output
2011
+ print(f"\n{'=' * 60}")
2012
+ print(f"Status: {result['status'].upper()}")
2013
+ print(f"Mode: {result['mode']}")
2014
+ print(f"{'=' * 60}")
2015
+ print(
2016
+ f"\n📊 Summary: {result['deployed_count']} deployed, "
2017
+ f"{result['failed_count']} failed, {result['missing_count']} missing"
2018
+ )
2019
+
2020
+ if result["deployed_agents"]:
2021
+ print(f"\n✅ Deployed agents ({len(result['deployed_agents'])}):")
2022
+ for agent in result["deployed_agents"]:
2023
+ print(f" • {agent}")
2024
+
2025
+ if result["failed_agents"]:
2026
+ print(f"\n❌ Failed agents ({len(result['failed_agents'])}):")
2027
+ for agent in result["failed_agents"]:
2028
+ print(f" • {agent}")
2029
+
2030
+ if result["missing_agents"]:
2031
+ print(f"\n⚠️ Missing agents ({len(result['missing_agents'])}):")
2032
+ for agent in result["missing_agents"]:
2033
+ print(f" • {agent}")
2034
+ print("\nThese agents are not available in configured sources.")
2035
+
2036
+ if dry_run:
2037
+ print(
2038
+ "\n💡 This was a dry run. Run without --dry-run to deploy agents."
2039
+ )
2040
+
2041
+ return CommandResult.success_result(
2042
+ f"Minimal configuration {result['status']}", data=result
2043
+ )
2044
+
2045
+ except Exception as e:
2046
+ self.logger.error(
2047
+ f"Error deploying minimal configuration: {e}", exc_info=True
2048
+ )
2049
+ return CommandResult.error_result(
2050
+ f"Error deploying minimal configuration: {e}"
2051
+ )
2052
+
2053
+ def _deploy_auto_configure(self, args) -> CommandResult:
2054
+ """Auto-detect toolchain and deploy matching agents.
2055
+
2056
+ Part of Phase 3 (1M-382): Agent Selection Modes.
2057
+ Detect project toolchain (languages, frameworks, build tools) and
2058
+ deploy matching specialized agents.
2059
+ """
2060
+ try:
2061
+ from ...config.agent_sources import AgentSourceConfiguration
2062
+ from ...services.agents.agent_selection_service import AgentSelectionService
2063
+ from ...services.agents.single_tier_deployment_service import (
2064
+ SingleTierDeploymentService,
2065
+ )
2066
+
2067
+ # Initialize services
2068
+ config = AgentSourceConfiguration.load()
2069
+ deployment_dir = Path.home() / ".claude" / "agents"
2070
+ deployment_service = SingleTierDeploymentService(config, deployment_dir)
2071
+ selection_service = AgentSelectionService(deployment_service)
2072
+
2073
+ # Get arguments
2074
+ project_path = getattr(args, "path", Path.cwd())
2075
+ dry_run = getattr(args, "dry_run", False)
2076
+
2077
+ # Deploy auto-configure
2078
+ print(f"🔍 Auto-detecting toolchain in {project_path}...")
2079
+ if dry_run:
2080
+ print("🔍 DRY RUN MODE - No agents will be deployed\n")
2081
+
2082
+ result = selection_service.deploy_auto_configure(
2083
+ project_path=project_path, dry_run=dry_run
2084
+ )
2085
+
2086
+ # Format output
2087
+ output_format = self._get_output_format(args)
2088
+ if self._is_structured_format(output_format):
2089
+ formatted = (
2090
+ self._formatter.format_as_json(result)
2091
+ if str(output_format).lower() == OutputFormat.JSON
2092
+ else self._formatter.format_as_yaml(result)
2093
+ )
2094
+ print(formatted)
2095
+ return CommandResult.success_result(
2096
+ f"Auto-configure {result['status']}", data=result
2097
+ )
2098
+
2099
+ # Text output
2100
+ print(f"\n{'=' * 60}")
2101
+ print(f"Status: {result['status'].upper()}")
2102
+ print(f"Mode: {result['mode']}")
2103
+ print(f"{'=' * 60}")
2104
+
2105
+ # Show detected toolchain
2106
+ toolchain = result.get("toolchain", {})
2107
+ print("\n🔧 Detected Toolchain:")
2108
+ if toolchain.get("languages"):
2109
+ print(f" Languages: {', '.join(toolchain['languages'])}")
2110
+ if toolchain.get("frameworks"):
2111
+ print(f" Frameworks: {', '.join(toolchain['frameworks'])}")
2112
+ if toolchain.get("build_tools"):
2113
+ print(f" Build Tools: {', '.join(toolchain['build_tools'])}")
2114
+
2115
+ if not any(toolchain.values()):
2116
+ print(" (No toolchain detected)")
2117
+
2118
+ # Show recommended agents
2119
+ recommended = result.get("recommended_agents", [])
2120
+ if recommended:
2121
+ print(f"\n🎯 Recommended agents ({len(recommended)}):")
2122
+ for agent in recommended:
2123
+ print(f" • {agent}")
2124
+
2125
+ # Show deployment summary
2126
+ print(
2127
+ f"\n📊 Summary: {result['deployed_count']} deployed, "
2128
+ f"{result['failed_count']} failed, {result['missing_count']} missing"
2129
+ )
2130
+
2131
+ if result.get("deployed_agents"):
2132
+ print(f"\n✅ Deployed agents ({len(result['deployed_agents'])}):")
2133
+ for agent in result["deployed_agents"]:
2134
+ print(f" • {agent}")
2135
+
2136
+ if result.get("failed_agents"):
2137
+ print(f"\n❌ Failed agents ({len(result['failed_agents'])}):")
2138
+ for agent in result["failed_agents"]:
2139
+ print(f" • {agent}")
2140
+
2141
+ if result.get("missing_agents"):
2142
+ print(f"\n⚠️ Missing agents ({len(result['missing_agents'])}):")
2143
+ for agent in result["missing_agents"]:
2144
+ print(f" • {agent}")
2145
+ print("\nThese agents are not available in configured sources.")
2146
+
2147
+ if dry_run:
2148
+ print(
2149
+ "\n💡 This was a dry run. Run without --dry-run to deploy agents."
2150
+ )
2151
+
2152
+ return CommandResult.success_result(
2153
+ f"Auto-configure {result['status']}", data=result
2154
+ )
2155
+
2156
+ except Exception as e:
2157
+ self.logger.error(f"Error in auto-configure: {e}", exc_info=True)
2158
+ return CommandResult.error_result(f"Error in auto-configure: {e}")
2159
+
2160
+ def _cache_status(self, args) -> CommandResult:
2161
+ """Show git status of agent cache.
2162
+
2163
+ Displays current branch, uncommitted changes, unpushed commits, and
2164
+ remote URL for the agent cache repository.
2165
+ """
2166
+ try:
2167
+ from ...services.agents.cache_git_manager import CacheGitManager
2168
+
2169
+ cache_dir = Path.home() / ".claude-mpm" / "cache" / "remote-agents"
2170
+ manager = CacheGitManager(cache_dir)
2171
+
2172
+ if not manager.is_git_repo():
2173
+ print("❌ Cache is not a git repository")
2174
+ print(f"\nCache location: {cache_dir}")
2175
+ print(
2176
+ "\n💡 This is expected if you haven't cloned the agents repository."
2177
+ )
2178
+ print(" The cache will be managed via HTTP sync instead.")
2179
+ return CommandResult.error_result("Cache is not a git repository")
2180
+
2181
+ status = manager.get_status()
2182
+ output_format = self._get_output_format(args)
2183
+
2184
+ if self._is_structured_format(output_format):
2185
+ formatted = (
2186
+ self._formatter.format_as_json(status)
2187
+ if str(output_format).lower() == OutputFormat.JSON
2188
+ else self._formatter.format_as_yaml(status)
2189
+ )
2190
+ print(formatted)
2191
+ return CommandResult.success_result(
2192
+ "Cache status retrieved", data=status
2193
+ )
2194
+
2195
+ # Text output
2196
+ print(f"\n📁 Cache: {manager.repo_path}")
2197
+ print(f"🌿 Branch: {status.get('branch', 'unknown')}")
2198
+
2199
+ if status.get("remote_url"):
2200
+ print(f"🔗 Remote: {status['remote_url']}")
2201
+
2202
+ # Show sync status
2203
+ ahead = status.get("ahead", 0)
2204
+ behind = status.get("behind", 0)
2205
+
2206
+ if ahead > 0:
2207
+ print(f"📤 Ahead of remote: {ahead} commit(s)")
2208
+ if behind > 0:
2209
+ print(f"📥 Behind remote: {behind} commit(s)")
2210
+
2211
+ if ahead == 0 and behind == 0:
2212
+ print("✅ In sync with remote")
2213
+
2214
+ # Show uncommitted changes
2215
+ uncommitted = status.get("uncommitted", [])
2216
+ if uncommitted:
2217
+ print(f"\n⚠️ Uncommitted changes: {len(uncommitted)}")
2218
+ for file in uncommitted[:10]: # Show max 10 files
2219
+ print(f" - {file}")
2220
+ if len(uncommitted) > 10:
2221
+ print(f" ... and {len(uncommitted) - 10} more")
2222
+ else:
2223
+ print("\n✅ No uncommitted changes")
2224
+
2225
+ # Overall status
2226
+ if status.get("is_clean"):
2227
+ print("\n✨ Cache is clean and up-to-date")
2228
+ else:
2229
+ print("\n💡 Run 'claude-mpm agents cache-sync' to sync with remote")
2230
+
2231
+ return CommandResult.success_result("Cache status displayed", data=status)
2232
+
2233
+ except Exception as e:
2234
+ self.logger.error(f"Error getting cache status: {e}", exc_info=True)
2235
+ return CommandResult.error_result(f"Error getting cache status: {e}")
2236
+
2237
+ def _cache_pull(self, args) -> CommandResult:
2238
+ """Pull latest agents from remote repository."""
2239
+ try:
2240
+ from ...services.agents.cache_git_manager import CacheGitManager
2241
+
2242
+ cache_dir = Path.home() / ".claude-mpm" / "cache" / "remote-agents"
2243
+ manager = CacheGitManager(cache_dir)
2244
+
2245
+ if not manager.is_git_repo():
2246
+ print("❌ Cache is not a git repository")
2247
+ return CommandResult.error_result("Cache is not a git repository")
2248
+
2249
+ branch = getattr(args, "branch", "main")
2250
+ print(f"🔄 Pulling latest changes from {branch}...")
2251
+
2252
+ success, msg = manager.pull_latest(branch)
2253
+
2254
+ if success:
2255
+ print(f"✅ {msg}")
2256
+ return CommandResult.success_result(msg)
2257
+ print(f"❌ {msg}")
2258
+ return CommandResult.error_result(msg)
2259
+
2260
+ except Exception as e:
2261
+ self.logger.error(f"Error pulling cache: {e}", exc_info=True)
2262
+ return CommandResult.error_result(f"Error pulling cache: {e}")
2263
+
2264
+ def _cache_commit(self, args) -> CommandResult:
2265
+ """Commit changes to cache repository."""
2266
+ try:
2267
+ from ...services.agents.cache_git_manager import CacheGitManager
2268
+
2269
+ cache_dir = Path.home() / ".claude-mpm" / "cache" / "remote-agents"
2270
+ manager = CacheGitManager(cache_dir)
2271
+
2272
+ if not manager.is_git_repo():
2273
+ print("❌ Cache is not a git repository")
2274
+ return CommandResult.error_result("Cache is not a git repository")
2275
+
2276
+ # Get commit message from args
2277
+ message = getattr(args, "message", None)
2278
+ if not message:
2279
+ # Default message
2280
+ message = "feat: update agents from local development"
2281
+
2282
+ print("💾 Committing changes...")
2283
+ success, msg = manager.commit_changes(message)
2284
+
2285
+ if success:
2286
+ print(f"✅ {msg}")
2287
+ print(f"\n💡 Commit message: {message}")
2288
+ return CommandResult.success_result(msg)
2289
+ print(f"❌ {msg}")
2290
+ return CommandResult.error_result(msg)
2291
+
2292
+ except Exception as e:
2293
+ self.logger.error(f"Error committing cache changes: {e}", exc_info=True)
2294
+ return CommandResult.error_result(f"Error committing cache changes: {e}")
2295
+
2296
+ def _cache_push(self, args) -> CommandResult:
2297
+ """Push local agent changes to remote."""
2298
+ try:
2299
+ from ...services.agents.cache_git_manager import CacheGitManager
2300
+
2301
+ cache_dir = Path.home() / ".claude-mpm" / "cache" / "remote-agents"
2302
+ manager = CacheGitManager(cache_dir)
2303
+
2304
+ if not manager.is_git_repo():
2305
+ print("❌ Cache is not a git repository")
2306
+ return CommandResult.error_result("Cache is not a git repository")
2307
+
2308
+ # Check for uncommitted changes
2309
+ if manager.has_uncommitted_changes():
2310
+ print("⚠️ You have uncommitted changes.")
2311
+ print("\n💡 Commit changes first with:")
2312
+ print(" claude-mpm agents cache-commit --message 'your message'")
2313
+
2314
+ # Ask if user wants to commit first
2315
+ auto_commit = getattr(args, "auto_commit", False)
2316
+ if auto_commit:
2317
+ print("\n📝 Auto-committing changes...")
2318
+ success, msg = manager.commit_changes("feat: update agents")
2319
+ if not success:
2320
+ print(f"❌ Commit failed: {msg}")
2321
+ return CommandResult.error_result(f"Commit failed: {msg}")
2322
+ print(f"✅ {msg}")
2323
+ else:
2324
+ return CommandResult.error_result(
2325
+ "Uncommitted changes detected. Commit first or use --auto-commit"
2326
+ )
2327
+
2328
+ # Push changes
2329
+ branch = getattr(args, "branch", "main")
2330
+ print(f"📤 Pushing changes to {branch}...")
2331
+
2332
+ success, msg = manager.push_changes(branch)
2333
+
2334
+ if success:
2335
+ print(f"✅ {msg}")
2336
+ return CommandResult.success_result(msg)
2337
+ print(f"❌ {msg}")
2338
+ return CommandResult.error_result(msg)
2339
+
2340
+ except Exception as e:
2341
+ self.logger.error(f"Error pushing cache: {e}", exc_info=True)
2342
+ return CommandResult.error_result(f"Error pushing cache: {e}")
2343
+
2344
+ def _cache_sync(self, args) -> CommandResult:
2345
+ """Full cache sync: pull, commit (if needed), push."""
2346
+ try:
2347
+ from ...services.agents.cache_git_manager import CacheGitManager
2348
+
2349
+ cache_dir = Path.home() / ".claude-mpm" / "cache" / "remote-agents"
2350
+ manager = CacheGitManager(cache_dir)
2351
+
2352
+ if not manager.is_git_repo():
2353
+ print("❌ Cache is not a git repository")
2354
+ return CommandResult.error_result("Cache is not a git repository")
2355
+
2356
+ print("🔄 Syncing cache with remote...\n")
2357
+
2358
+ success, msg = manager.sync_with_remote()
2359
+
2360
+ # Print detailed sync message
2361
+ print(msg)
2362
+
2363
+ if success:
2364
+ print("\n✨ Cache sync complete!")
2365
+ return CommandResult.success_result("Cache synced successfully")
2366
+
2367
+ print("\n❌ Cache sync failed. See details above.")
2368
+ return CommandResult.error_result("Cache sync failed")
2369
+
2370
+ except Exception as e:
2371
+ self.logger.error(f"Error syncing cache: {e}", exc_info=True)
2372
+ return CommandResult.error_result(f"Error syncing cache: {e}")
2373
+
1451
2374
 
1452
2375
  def manage_agents(args):
1453
2376
  """