claude-mpm 5.4.64__py3-none-any.whl → 5.4.96__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 (163) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/CLAUDE_MPM_FOUNDERS_OUTPUT_STYLE.md +405 -0
  3. claude_mpm/agents/CLAUDE_MPM_OUTPUT_STYLE.md +66 -241
  4. claude_mpm/agents/CLAUDE_MPM_TEACHER_OUTPUT_STYLE.md +107 -1928
  5. claude_mpm/agents/PM_INSTRUCTIONS.md +82 -686
  6. claude_mpm/cli/__init__.py +5 -1
  7. claude_mpm/cli/commands/agents.py +2 -4
  8. claude_mpm/cli/commands/agents_reconcile.py +197 -0
  9. claude_mpm/cli/commands/autotodos.py +526 -0
  10. claude_mpm/cli/commands/configure.py +620 -21
  11. claude_mpm/cli/commands/monitor.py +2 -2
  12. claude_mpm/cli/commands/mpm_init/core.py +2 -2
  13. claude_mpm/cli/commands/skills.py +166 -14
  14. claude_mpm/cli/executor.py +89 -0
  15. claude_mpm/cli/interactive/__init__.py +10 -0
  16. claude_mpm/cli/interactive/agent_wizard.py +30 -50
  17. claude_mpm/cli/interactive/questionary_styles.py +65 -0
  18. claude_mpm/cli/interactive/skill_selector.py +481 -0
  19. claude_mpm/cli/parsers/base_parser.py +59 -1
  20. claude_mpm/cli/startup.py +202 -367
  21. claude_mpm/cli/startup_display.py +72 -5
  22. claude_mpm/cli/startup_logging.py +2 -2
  23. claude_mpm/commands/mpm-session-resume.md +1 -1
  24. claude_mpm/constants.py +1 -0
  25. claude_mpm/core/claude_runner.py +2 -2
  26. claude_mpm/core/hook_manager.py +51 -3
  27. claude_mpm/core/interactive_session.py +7 -7
  28. claude_mpm/core/output_style_manager.py +21 -13
  29. claude_mpm/core/unified_config.py +50 -8
  30. claude_mpm/core/unified_paths.py +30 -13
  31. claude_mpm/dashboard/static/svelte-build/_app/immutable/assets/0.C33zOoyM.css +1 -0
  32. claude_mpm/dashboard/static/svelte-build/_app/immutable/assets/2.CW1J-YuA.css +1 -0
  33. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{Cs_tUR18.js → 1WZnGYqX.js} +1 -1
  34. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{CDuw-vjf.js → 67pF3qNn.js} +1 -1
  35. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{bTOqqlTd.js → 6RxdMKe4.js} +1 -1
  36. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{DwBR2MJi.js → 8cZrfX0h.js} +1 -1
  37. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{ZGh7QtNv.js → 9a6T2nm-.js} +1 -1
  38. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{D9lljYKQ.js → B443AUzu.js} +1 -1
  39. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{RJiighC3.js → B8AwtY2H.js} +1 -1
  40. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{uuIeMWc-.js → BF15LAsF.js} +1 -1
  41. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{D3k0OPJN.js → BRcwIQNr.js} +1 -1
  42. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{CyWMqx4W.js → BV6nKitt.js} +1 -1
  43. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{CiIAseT4.js → BViJ8lZt.js} +5 -5
  44. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{CBBdVcY8.js → BcQ-Q0FE.js} +1 -1
  45. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{BovzEFCE.js → Bpyvgze_.js} +1 -1
  46. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/BzTRqg-z.js +1 -0
  47. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/C0Fr8dve.js +1 -0
  48. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{eNVUfhuA.js → C3rbW_a-.js} +1 -1
  49. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{GYwsonyD.js → C8WYN38h.js} +1 -1
  50. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{BIF9m_hv.js → C9I8FlXH.js} +1 -1
  51. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{B0uc0UOD.js → CIQcWgO2.js} +3 -3
  52. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{Be7GpZd6.js → CIctN7YN.js} +1 -1
  53. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{Bh0LDWpI.js → CKrS_JZW.js} +2 -2
  54. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{DUrLdbGD.js → CR6P9C4A.js} +1 -1
  55. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{B7xVLGWV.js → CRRR9MD_.js} +1 -1
  56. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/CRcR2DqT.js +334 -0
  57. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{Dhb8PKl3.js → CSXtMOf0.js} +1 -1
  58. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{BPYeabCQ.js → CT-sbxSk.js} +1 -1
  59. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{sQeU3Y1z.js → CWm6DJsp.js} +1 -1
  60. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{CnA0NrzZ.js → CpqQ1Kzn.js} +1 -1
  61. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{C4B-KCzX.js → D2nGpDRe.js} +1 -1
  62. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{DGkLK5U1.js → D9iCMida.js} +1 -1
  63. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{BofRWZRR.js → D9ykgMoY.js} +1 -1
  64. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{DmxopI1J.js → DL2Ldur1.js} +1 -1
  65. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{C30mlcqg.js → DPfltzjH.js} +1 -1
  66. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{Vzk33B_K.js → DR8nis88.js} +2 -2
  67. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{DI7hHRFL.js → DUliQN2b.js} +1 -1
  68. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{C4JcI4KD.js → DXlhR01x.js} +1 -1
  69. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{bT1r9zLR.js → D_lyTybS.js} +1 -1
  70. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{DZX00Y4g.js → DngoTTgh.js} +1 -1
  71. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{CzZX-COe.js → DqkmHtDC.js} +1 -1
  72. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{B7RN905-.js → DsDh8EYs.js} +1 -1
  73. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{DLVjFsZ3.js → DypDmXgd.js} +1 -1
  74. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{iEWssX7S.js → IPYC-LnN.js} +1 -1
  75. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/JTLiF7dt.js +24 -0
  76. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{DaimHw_p.js → JpevfAFt.js} +1 -1
  77. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{DY1XQ8fi.js → R8CEIRAd.js} +1 -1
  78. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{Dle-35c7.js → Zxy7qc-l.js} +2 -2
  79. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/q9Hm6zAU.js +1 -0
  80. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{C_Usid8X.js → qtd3IeO4.js} +2 -2
  81. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{CzeYkLYB.js → ulBFON_C.js} +2 -2
  82. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/{Cfqx1Qun.js → wQVh1CoA.js} +1 -1
  83. claude_mpm/dashboard/static/svelte-build/_app/immutable/entry/{app.D6-I5TpK.js → app.Dr7t0z2J.js} +2 -2
  84. claude_mpm/dashboard/static/svelte-build/_app/immutable/entry/start.BGhZHUS3.js +1 -0
  85. claude_mpm/dashboard/static/svelte-build/_app/immutable/nodes/{0.m1gL8KXf.js → 0.RgBboRvH.js} +1 -1
  86. claude_mpm/dashboard/static/svelte-build/_app/immutable/nodes/{1.CgNOuw-d.js → 1.DG-KkbDf.js} +1 -1
  87. claude_mpm/dashboard/static/svelte-build/_app/immutable/nodes/2.D_jnf-x6.js +1 -0
  88. claude_mpm/dashboard/static/svelte-build/_app/version.json +1 -1
  89. claude_mpm/dashboard/static/svelte-build/index.html +9 -9
  90. claude_mpm/hooks/claude_hooks/INTEGRATION_EXAMPLE.md +243 -0
  91. claude_mpm/hooks/claude_hooks/README_AUTO_PAUSE.md +403 -0
  92. claude_mpm/hooks/claude_hooks/__pycache__/auto_pause_handler.cpython-311.pyc +0 -0
  93. claude_mpm/hooks/claude_hooks/__pycache__/event_handlers.cpython-311.pyc +0 -0
  94. claude_mpm/hooks/claude_hooks/__pycache__/hook_handler.cpython-311.pyc +0 -0
  95. claude_mpm/hooks/claude_hooks/__pycache__/response_tracking.cpython-311.pyc +0 -0
  96. claude_mpm/hooks/claude_hooks/auto_pause_handler.py +486 -0
  97. claude_mpm/hooks/claude_hooks/event_handlers.py +216 -11
  98. claude_mpm/hooks/claude_hooks/hook_handler.py +28 -4
  99. claude_mpm/hooks/claude_hooks/response_tracking.py +3 -1
  100. claude_mpm/hooks/claude_hooks/services/__pycache__/connection_manager.cpython-311.pyc +0 -0
  101. claude_mpm/hooks/claude_hooks/services/__pycache__/subagent_processor.cpython-311.pyc +0 -0
  102. claude_mpm/hooks/claude_hooks/services/connection_manager.py +20 -0
  103. claude_mpm/hooks/claude_hooks/services/subagent_processor.py +30 -6
  104. claude_mpm/hooks/session_resume_hook.py +85 -1
  105. claude_mpm/init.py +1 -1
  106. claude_mpm/services/agents/cache_git_manager.py +1 -1
  107. claude_mpm/services/agents/deployment/deployment_reconciler.py +577 -0
  108. claude_mpm/services/agents/deployment/remote_agent_discovery_service.py +3 -0
  109. claude_mpm/services/agents/deployment/startup_reconciliation.py +138 -0
  110. claude_mpm/services/agents/startup_sync.py +5 -2
  111. claude_mpm/services/cli/__init__.py +3 -0
  112. claude_mpm/services/cli/incremental_pause_manager.py +561 -0
  113. claude_mpm/services/cli/session_resume_helper.py +10 -2
  114. claude_mpm/services/delegation_detector.py +175 -0
  115. claude_mpm/services/diagnostics/checks/agent_sources_check.py +30 -0
  116. claude_mpm/services/diagnostics/checks/configuration_check.py +24 -0
  117. claude_mpm/services/diagnostics/checks/installation_check.py +22 -0
  118. claude_mpm/services/diagnostics/checks/mcp_services_check.py +23 -0
  119. claude_mpm/services/diagnostics/doctor_reporter.py +31 -1
  120. claude_mpm/services/diagnostics/models.py +14 -1
  121. claude_mpm/services/event_log.py +317 -0
  122. claude_mpm/services/infrastructure/__init__.py +4 -0
  123. claude_mpm/services/infrastructure/context_usage_tracker.py +291 -0
  124. claude_mpm/services/infrastructure/resume_log_generator.py +24 -5
  125. claude_mpm/services/monitor/daemon_manager.py +15 -4
  126. claude_mpm/services/monitor/management/lifecycle.py +8 -2
  127. claude_mpm/services/monitor/server.py +106 -16
  128. claude_mpm/services/pm_skills_deployer.py +177 -83
  129. claude_mpm/services/skills/git_skill_source_manager.py +5 -1
  130. claude_mpm/services/skills/selective_skill_deployer.py +114 -26
  131. claude_mpm/services/socketio/handlers/hook.py +14 -7
  132. claude_mpm/services/socketio/server/main.py +12 -4
  133. claude_mpm/skills/bundled/pm/mpm-agent-update-workflow/SKILL.md +75 -0
  134. claude_mpm/skills/bundled/pm/mpm-bug-reporting/SKILL.md +248 -0
  135. claude_mpm/skills/bundled/pm/mpm-circuit-breaker-enforcement/SKILL.md +476 -0
  136. claude_mpm/skills/bundled/pm/mpm-session-management/SKILL.md +312 -0
  137. claude_mpm/skills/bundled/pm/mpm-teaching-mode/SKILL.md +657 -0
  138. claude_mpm/skills/bundled/pm/mpm-tool-usage-guide/SKILL.md +386 -0
  139. claude_mpm/skills/skill_manager.py +4 -4
  140. claude_mpm/utils/agent_dependency_loader.py +103 -4
  141. claude_mpm/utils/robust_installer.py +45 -24
  142. claude_mpm-5.4.96.dist-info/METADATA +377 -0
  143. {claude_mpm-5.4.64.dist-info → claude_mpm-5.4.96.dist-info}/RECORD +153 -131
  144. claude_mpm/dashboard/static/svelte-build/_app/immutable/assets/0.DWzvg0-y.css +0 -1
  145. claude_mpm/dashboard/static/svelte-build/_app/immutable/assets/2.ThTw9_ym.css +0 -1
  146. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/4TdZjIqw.js +0 -1
  147. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/5shd3_w0.js +0 -24
  148. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/BKjSRqUr.js +0 -1
  149. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/Da0KfYnO.js +0 -1
  150. claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/Dfy6j1xT.js +0 -323
  151. claude_mpm/dashboard/static/svelte-build/_app/immutable/entry/start.NWzMBYRp.js +0 -1
  152. claude_mpm/dashboard/static/svelte-build/_app/immutable/nodes/2.C0GcWctS.js +0 -1
  153. claude_mpm-5.4.64.dist-info/METADATA +0 -999
  154. /claude_mpm/skills/bundled/pm/{pm-delegation-patterns → mpm-delegation-patterns}/SKILL.md +0 -0
  155. /claude_mpm/skills/bundled/pm/{pm-git-file-tracking → mpm-git-file-tracking}/SKILL.md +0 -0
  156. /claude_mpm/skills/bundled/pm/{pm-pr-workflow → mpm-pr-workflow}/SKILL.md +0 -0
  157. /claude_mpm/skills/bundled/pm/{pm-ticketing-integration → mpm-ticketing-integration}/SKILL.md +0 -0
  158. /claude_mpm/skills/bundled/pm/{pm-verification-protocols → mpm-verification-protocols}/SKILL.md +0 -0
  159. {claude_mpm-5.4.64.dist-info → claude_mpm-5.4.96.dist-info}/WHEEL +0 -0
  160. {claude_mpm-5.4.64.dist-info → claude_mpm-5.4.96.dist-info}/entry_points.txt +0 -0
  161. {claude_mpm-5.4.64.dist-info → claude_mpm-5.4.96.dist-info}/licenses/LICENSE +0 -0
  162. {claude_mpm-5.4.64.dist-info → claude_mpm-5.4.96.dist-info}/licenses/LICENSE-FAQ.md +0 -0
  163. {claude_mpm-5.4.64.dist-info → claude_mpm-5.4.96.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,481 @@
1
+ """Interactive Skill Selector for Claude MPM.
2
+
3
+ This module provides a two-tier interactive skill selection wizard:
4
+ 1. Select topic groups (toolchains) to explore
5
+ 2. Multi-select skills within each topic group
6
+
7
+ Features:
8
+ - Groups skills by toolchain (universal, python, typescript, etc.)
9
+ - Shows skills auto-included by agent dependencies
10
+ - Displays token counts for each skill
11
+ - Uses questionary with cyan style for consistency
12
+ - Matches agent selector UI pattern with table display
13
+ """
14
+
15
+ import json
16
+ import shutil
17
+ from dataclasses import dataclass
18
+ from typing import Dict, List, Optional, Set
19
+
20
+ import questionary
21
+
22
+ from claude_mpm.cli.interactive.questionary_styles import (
23
+ BANNER_WIDTH,
24
+ MPM_STYLE,
25
+ print_banner,
26
+ )
27
+ from claude_mpm.core.logging_utils import get_logger
28
+ from claude_mpm.core.unified_config import UnifiedConfig
29
+ from claude_mpm.core.unified_paths import get_path_manager
30
+
31
+ logger = get_logger(__name__)
32
+
33
+ # Topic/toolchain icons
34
+ TOPIC_ICONS = {
35
+ "universal": "🌐",
36
+ "python": "🐍",
37
+ "typescript": "📘",
38
+ "javascript": "📒",
39
+ "rust": "⚙️",
40
+ "go": "🔷",
41
+ "java": "☕",
42
+ "ruby": "💎",
43
+ "php": "🐘",
44
+ "csharp": "🔷",
45
+ "cpp": "⚙️",
46
+ "swift": "🍎",
47
+ None: "🌐", # Default for null toolchain (universal)
48
+ }
49
+
50
+
51
+ @dataclass
52
+ class SkillInfo:
53
+ """Information about a skill from manifest."""
54
+
55
+ name: str
56
+ toolchain: Optional[str]
57
+ framework: Optional[str]
58
+ tags: List[str]
59
+ full_tokens: int
60
+ description: str = ""
61
+
62
+ @property
63
+ def display_name(self) -> str:
64
+ """Get display name with token count."""
65
+ tokens_k = self.full_tokens // 1000
66
+ return f"{self.name} ({tokens_k}K tokens)"
67
+
68
+
69
+ class SkillSelector:
70
+ """Interactive skill selector with topic grouping."""
71
+
72
+ def __init__(
73
+ self,
74
+ skills_manifest: Dict,
75
+ agent_skill_deps: Optional[List[str]] = None,
76
+ deployed_skills: Optional[Set[str]] = None,
77
+ ):
78
+ """Initialize skill selector.
79
+
80
+ Args:
81
+ skills_manifest: Full manifest dict with all skills
82
+ agent_skill_deps: Skills required by deployed agents (auto-included)
83
+ deployed_skills: Skills currently deployed in .claude/skills/
84
+ """
85
+ self.manifest = skills_manifest
86
+ self.agent_skill_deps = set(agent_skill_deps or [])
87
+ self.deployed_skills = deployed_skills or set()
88
+ self.skills_by_toolchain: Dict[str, List[SkillInfo]] = {}
89
+ self._parse_manifest()
90
+
91
+ def _parse_manifest(self) -> None:
92
+ """Parse manifest and group skills by toolchain."""
93
+ # Handle both old and new manifest formats
94
+ skills_data = self.manifest.get("skills", {})
95
+
96
+ # Flatten skills from grouped format to flat list
97
+ all_skills = []
98
+ if isinstance(skills_data, dict):
99
+ for toolchain, skills_list in skills_data.items():
100
+ all_skills.extend(skills_list)
101
+ elif isinstance(skills_data, list):
102
+ all_skills = skills_data
103
+
104
+ # Group by toolchain
105
+ for skill_data in all_skills:
106
+ try:
107
+ skill = SkillInfo(
108
+ name=skill_data.get("name", ""),
109
+ toolchain=skill_data.get("toolchain"),
110
+ framework=skill_data.get("framework"),
111
+ tags=skill_data.get("tags", []),
112
+ full_tokens=skill_data.get("full_tokens", 0),
113
+ description=skill_data.get("description", ""),
114
+ )
115
+
116
+ # Group by toolchain (null -> universal)
117
+ toolchain_key = skill.toolchain or "universal"
118
+
119
+ if toolchain_key not in self.skills_by_toolchain:
120
+ self.skills_by_toolchain[toolchain_key] = []
121
+
122
+ self.skills_by_toolchain[toolchain_key].append(skill)
123
+ except Exception as e:
124
+ logger.warning(
125
+ f"Failed to parse skill: {skill_data.get('name', 'unknown')}: {e}"
126
+ )
127
+
128
+ # Sort skills within each toolchain by name
129
+ for toolchain in self.skills_by_toolchain:
130
+ self.skills_by_toolchain[toolchain].sort(key=lambda s: s.name)
131
+
132
+ @staticmethod
133
+ def _calculate_column_widths(
134
+ terminal_width: int, columns: Dict[str, int]
135
+ ) -> Dict[str, int]:
136
+ """Calculate dynamic column widths based on terminal size.
137
+
138
+ Args:
139
+ terminal_width: Current terminal width in characters
140
+ columns: Dict mapping column names to minimum widths
141
+
142
+ Returns:
143
+ Dict mapping column names to calculated widths
144
+
145
+ Design:
146
+ - Ensures minimum widths are respected
147
+ - Distributes extra space proportionally
148
+ - Handles narrow terminals gracefully (minimum 80 chars)
149
+ """
150
+ # Ensure minimum terminal width
151
+ min_terminal_width = 80
152
+ terminal_width = max(terminal_width, min_terminal_width)
153
+
154
+ # Calculate total minimum width needed
155
+ total_min_width = sum(columns.values())
156
+
157
+ # Account for spacing between columns
158
+ overhead = len(columns) + 1
159
+ available_width = terminal_width - overhead
160
+
161
+ # If we have extra space, distribute proportionally
162
+ if available_width > total_min_width:
163
+ extra_space = available_width - total_min_width
164
+ total_weight = sum(columns.values())
165
+
166
+ result = {}
167
+ for col_name, min_width in columns.items():
168
+ # Distribute extra space based on minimum width proportion
169
+ proportion = min_width / total_weight
170
+ extra = int(extra_space * proportion)
171
+ result[col_name] = min_width + extra
172
+ return result
173
+ # Terminal too narrow, use minimum widths
174
+ return columns.copy()
175
+
176
+ def _display_skills_table(self, skills: List[SkillInfo]) -> None:
177
+ """Display skills in a table with status (matches agent selector pattern).
178
+
179
+ Args:
180
+ skills: List of skills to display
181
+ """
182
+ if not skills:
183
+ print("\n📭 No skills found.")
184
+ return
185
+
186
+ # Calculate dynamic column widths based on terminal size
187
+ terminal_width = shutil.get_terminal_size().columns
188
+ min_widths = {
189
+ "#": 4,
190
+ "Skill ID": 30,
191
+ "Description": 35,
192
+ "Toolchain": 12,
193
+ "Status": 12,
194
+ }
195
+ widths = self._calculate_column_widths(terminal_width, min_widths)
196
+
197
+ # Print header with dynamic widths
198
+ print(
199
+ f"\n{'#':<{widths['#']}} "
200
+ f"{'Skill ID':<{widths['Skill ID']}} "
201
+ f"{'Description':<{widths['Description']}} "
202
+ f"{'Toolchain':<{widths['Toolchain']}} "
203
+ f"{'Status':<{widths['Status']}}"
204
+ )
205
+ separator_width = sum(widths.values()) + len(widths) - 1
206
+ print("-" * separator_width)
207
+
208
+ for i, skill in enumerate(skills, 1):
209
+ # Truncate to fit dynamic width
210
+ skill_id = skill.name
211
+ if len(skill_id) > widths["Skill ID"]:
212
+ skill_id = skill_id[: widths["Skill ID"] - 1] + "…"
213
+
214
+ description = skill.description or skill.name
215
+ if len(description) > widths["Description"]:
216
+ description = description[: widths["Description"] - 1] + "…"
217
+
218
+ toolchain = skill.toolchain or "universal"
219
+ if len(toolchain) > widths["Toolchain"]:
220
+ toolchain = toolchain[: widths["Toolchain"] - 1] + "…"
221
+
222
+ # Determine status
223
+ if skill.name in self.agent_skill_deps:
224
+ status = "✓ Required"
225
+ elif skill.name in self.deployed_skills:
226
+ status = "✓ Installed"
227
+ else:
228
+ status = "Available"
229
+
230
+ print(
231
+ f"{i:<{widths['#']}} "
232
+ f"{skill_id:<{widths['Skill ID']}} "
233
+ f"{description:<{widths['Description']}} "
234
+ f"{toolchain:<{widths['Toolchain']}} "
235
+ f"{status:<{widths['Status']}}"
236
+ )
237
+
238
+ def select_skills(self) -> List[str]:
239
+ """Run interactive selection and return selected skill IDs.
240
+
241
+ Returns:
242
+ List of selected skill IDs (names)
243
+ """
244
+ print_banner("SKILL CONFIGURATION", width=BANNER_WIDTH)
245
+
246
+ # Show agent-required skills (auto-included)
247
+ if self.agent_skill_deps:
248
+ self._show_agent_required_skills()
249
+
250
+ # Get all skills for table display
251
+ all_skills = []
252
+ for toolchain_skills in self.skills_by_toolchain.values():
253
+ all_skills.extend(toolchain_skills)
254
+ all_skills.sort(key=lambda s: s.name)
255
+
256
+ # Display skills table
257
+ print(f"\n📋 Found {len(all_skills)} skill(s) available:")
258
+ self._display_skills_table(all_skills)
259
+
260
+ # Select topic groups to explore
261
+ selected_groups = self._select_topic_groups()
262
+
263
+ if not selected_groups:
264
+ print("\n⚠️ No topic groups selected. Using only agent-required skills.")
265
+ return list(self.agent_skill_deps)
266
+
267
+ # Multi-select skills from each group
268
+ selected_skills = set(self.agent_skill_deps) # Start with auto-included
269
+
270
+ for group in selected_groups:
271
+ group_skills = self._select_skills_from_group(group)
272
+ selected_skills.update(group_skills)
273
+
274
+ # Confirm selection
275
+ print(f"\n✅ Total skills selected: {len(selected_skills)}")
276
+ print(f" - Auto-included (from agents): {len(self.agent_skill_deps)}")
277
+ print(f" - Manually selected: {len(selected_skills - self.agent_skill_deps)}")
278
+
279
+ return list(selected_skills)
280
+
281
+ def _show_agent_required_skills(self) -> None:
282
+ """Display skills that are auto-included from agent dependencies."""
283
+ print("\n📦 Agent-Required Skills (auto-included):")
284
+ for skill_name in sorted(self.agent_skill_deps):
285
+ print(f" ✓ {skill_name}")
286
+ print()
287
+
288
+ def _select_topic_groups(self) -> List[str]:
289
+ """First tier: Select which toolchain groups to browse.
290
+
291
+ Returns:
292
+ List of selected toolchain keys
293
+ """
294
+ # Build choices with counts
295
+ choices = []
296
+ for toolchain in sorted(self.skills_by_toolchain.keys()):
297
+ skills = self.skills_by_toolchain[toolchain]
298
+ icon = TOPIC_ICONS.get(toolchain, "📦")
299
+ display_name = toolchain.capitalize() if toolchain else "Universal"
300
+ choice_text = f"{icon} {display_name} ({len(skills)} skills)"
301
+ choices.append(questionary.Choice(title=choice_text, value=toolchain))
302
+
303
+ if not choices:
304
+ print("\n⚠️ No skills available in manifest.")
305
+ return []
306
+
307
+ # Multi-select groups
308
+ selected = questionary.checkbox(
309
+ "📂 Select Topic Groups to Add Skills From:",
310
+ choices=choices,
311
+ style=MPM_STYLE,
312
+ ).ask()
313
+
314
+ if selected is None: # User cancelled
315
+ return []
316
+
317
+ return selected
318
+
319
+ def _select_skills_from_group(self, toolchain: str) -> List[str]:
320
+ """Second tier: Multi-select skills within a toolchain group.
321
+
322
+ Args:
323
+ toolchain: Toolchain key to select from
324
+
325
+ Returns:
326
+ List of selected skill names
327
+ """
328
+ skills = self.skills_by_toolchain.get(toolchain, [])
329
+ if not skills:
330
+ return []
331
+
332
+ icon = TOPIC_ICONS.get(toolchain, "📦")
333
+ display_name = toolchain.capitalize() if toolchain else "Universal"
334
+
335
+ print(f"\n{icon} {display_name} Skills:")
336
+
337
+ # Build choices with numbered format like agent selector
338
+ choices = []
339
+ for i, skill in enumerate(skills, 1):
340
+ # Mark if already selected (from agent deps)
341
+ already_selected = skill.name in self.agent_skill_deps
342
+
343
+ # Format: "1. skill-name - toolchain (XK tokens)"
344
+ tokens_k = skill.full_tokens // 1000
345
+ desc = skill.description[:50] if skill.description else skill.name
346
+ choice_text = f"{i}. {skill.name} - {desc}... ({tokens_k}K tokens)"
347
+
348
+ choice = questionary.Choice(
349
+ title=choice_text,
350
+ value=skill.name,
351
+ checked=already_selected,
352
+ )
353
+ choices.append(choice)
354
+
355
+ # Multi-select skills
356
+ selected = questionary.checkbox(
357
+ f"Select {display_name} skills to include:",
358
+ choices=choices,
359
+ style=MPM_STYLE,
360
+ ).ask()
361
+
362
+ if selected is None: # User cancelled
363
+ return []
364
+
365
+ return selected
366
+
367
+
368
+ def load_skills_manifest() -> Optional[Dict]:
369
+ """Load skills manifest from cache.
370
+
371
+ Returns:
372
+ Manifest dict or None if not found
373
+ """
374
+ try:
375
+ path_manager = get_path_manager()
376
+ manifest_path = (
377
+ path_manager.get_cache_dir() / "skills" / "system" / "manifest.json"
378
+ )
379
+
380
+ if not manifest_path.exists():
381
+ logger.error(f"Skills manifest not found at {manifest_path}")
382
+ print("\n❌ Skills manifest not found. Run 'claude-mpm skills sync' first.")
383
+ return None
384
+
385
+ with open(manifest_path, encoding="utf-8") as f:
386
+ return json.load(f)
387
+
388
+ except Exception as e:
389
+ logger.error(f"Failed to load skills manifest: {e}")
390
+ print(f"\n❌ Failed to load skills manifest: {e}")
391
+ return None
392
+
393
+
394
+ def get_agent_skill_dependencies(config: UnifiedConfig) -> List[str]:
395
+ """Get skill dependencies from deployed agents.
396
+
397
+ Args:
398
+ config: UnifiedConfig instance
399
+
400
+ Returns:
401
+ List of skill IDs required by enabled agents
402
+ """
403
+ try:
404
+ from claude_mpm.services.agents.deployment.deployment_reconciler import (
405
+ DeploymentReconciler,
406
+ )
407
+
408
+ reconciler = DeploymentReconciler(config)
409
+ enabled_agents = config.agents.enabled
410
+
411
+ if not enabled_agents:
412
+ logger.debug("No enabled agents, no skill dependencies")
413
+ return []
414
+
415
+ # Get skill dependencies
416
+ skill_deps = reconciler._get_agent_skill_dependencies(enabled_agents)
417
+ return list(skill_deps)
418
+
419
+ except Exception as e:
420
+ logger.warning(f"Failed to get agent skill dependencies: {e}")
421
+ return []
422
+
423
+
424
+ def get_deployed_skills() -> Set[str]:
425
+ """Get skills currently deployed in .claude/skills/ directory.
426
+
427
+ Returns:
428
+ Set of deployed skill IDs
429
+ """
430
+ try:
431
+ from claude_mpm.services.agents.deployment.deployment_reconciler import (
432
+ DeploymentReconciler,
433
+ )
434
+
435
+ config = UnifiedConfig()
436
+ reconciler = DeploymentReconciler(config)
437
+
438
+ # Get path to deployed skills directory
439
+ path_manager = get_path_manager()
440
+ deploy_dir = path_manager.get_deploy_dir() / "skills"
441
+
442
+ # Use reconciler's method to list deployed skills
443
+ return reconciler._list_deployed_skills(deploy_dir)
444
+
445
+ except Exception as e:
446
+ logger.warning(f"Failed to get deployed skills: {e}")
447
+ return set()
448
+
449
+
450
+ def run_skill_selector() -> Optional[List[str]]:
451
+ """Main entry point for skill selector.
452
+
453
+ Returns:
454
+ List of selected skill IDs, or None if cancelled
455
+ """
456
+ try:
457
+ # Load config
458
+ config = UnifiedConfig()
459
+
460
+ # Load manifest
461
+ manifest = load_skills_manifest()
462
+ if not manifest:
463
+ return None
464
+
465
+ # Get agent skill dependencies
466
+ agent_deps = get_agent_skill_dependencies(config)
467
+
468
+ # Get deployed skills
469
+ deployed = get_deployed_skills()
470
+
471
+ # Run selector
472
+ selector = SkillSelector(manifest, agent_deps, deployed)
473
+ return selector.select_skills()
474
+
475
+ except KeyboardInterrupt:
476
+ print("\n\n❌ Skill selection cancelled")
477
+ return None
478
+ except Exception as e:
479
+ logger.error(f"Skill selection error: {e}", exc_info=True)
480
+ print(f"\n❌ Skill selection error: {e}")
481
+ return None
@@ -125,7 +125,7 @@ def _get_enhanced_version(base_version: str) -> str:
125
125
 
126
126
  if enhanced and enhanced != base_version:
127
127
  return enhanced
128
- except Exception:
128
+ except Exception: # nosec B110
129
129
  # If anything fails, fall back to base version
130
130
  pass
131
131
 
@@ -292,6 +292,11 @@ def add_top_level_run_arguments(parser: argparse.ArgumentParser) -> None:
292
292
  action="store_true",
293
293
  help="Force rebuild of all system agents by deleting local claude-mpm agents",
294
294
  )
295
+ run_group.add_argument(
296
+ "--force-sync",
297
+ action="store_true",
298
+ help="Force refresh agents and skills from remote repos, bypassing ETag cache",
299
+ )
295
300
 
296
301
  # Dependency checking options (for backward compatibility at top level)
297
302
  dep_group_top = parser.add_argument_group(
@@ -602,6 +607,59 @@ def create_parser(
602
607
  help="Skip confirmation prompts",
603
608
  )
604
609
 
610
+ # Add autotodos command for auto-generating todos from hook errors
611
+ autotodos_parser = subparsers.add_parser(
612
+ "autotodos",
613
+ help="Auto-generate todos from hook errors and delegation patterns",
614
+ )
615
+ autotodos_parser.add_argument(
616
+ "autotodos_command",
617
+ nargs="?",
618
+ choices=["list", "inject", "clear", "status", "scan", "violations"],
619
+ help="AutoTodos subcommand",
620
+ )
621
+ autotodos_parser.add_argument(
622
+ "text",
623
+ nargs="?",
624
+ help="Text to scan for delegation patterns (scan command only)",
625
+ )
626
+ autotodos_parser.add_argument(
627
+ "--format",
628
+ choices=["table", "json"],
629
+ default="table",
630
+ help="Output format for list/scan commands",
631
+ )
632
+ autotodos_parser.add_argument(
633
+ "--output",
634
+ help="Output file path for inject command",
635
+ )
636
+ autotodos_parser.add_argument(
637
+ "--error-key",
638
+ help="Specific error key to clear",
639
+ )
640
+ autotodos_parser.add_argument(
641
+ "--event-type",
642
+ choices=["error", "violation", "all"],
643
+ default="all",
644
+ help="Type of events to clear (clear command only)",
645
+ )
646
+ autotodos_parser.add_argument(
647
+ "--file",
648
+ "-f",
649
+ help="Scan text from file (scan command only)",
650
+ )
651
+ autotodos_parser.add_argument(
652
+ "--save",
653
+ action="store_true",
654
+ help="Save detections to event log (scan command only)",
655
+ )
656
+ autotodos_parser.add_argument(
657
+ "-y",
658
+ "--yes",
659
+ action="store_true",
660
+ help="Skip confirmation prompts",
661
+ )
662
+
605
663
  # Add summarize command
606
664
  from ..commands.summarize import add_summarize_parser
607
665