claude-mpm 5.1.9__py3-none-any.whl → 5.4.48__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.
- claude_mpm/VERSION +1 -1
- claude_mpm/__init__.py +4 -0
- claude_mpm/agents/BASE_AGENT.md +164 -0
- claude_mpm/agents/CLAUDE_MPM_TEACHER_OUTPUT_STYLE.md +1 -1
- claude_mpm/agents/MEMORY.md +1 -1
- claude_mpm/agents/PM_INSTRUCTIONS.md +843 -900
- claude_mpm/agents/WORKFLOW.md +5 -254
- claude_mpm/agents/agent_loader.py +13 -44
- claude_mpm/agents/base_agent.json +1 -1
- claude_mpm/agents/frontmatter_validator.py +2 -2
- claude_mpm/agents/templates/circuit-breakers.md +138 -1
- claude_mpm/cli/__main__.py +4 -0
- claude_mpm/cli/chrome_devtools_installer.py +175 -0
- claude_mpm/cli/commands/agent_state_manager.py +18 -27
- claude_mpm/cli/commands/agents.py +9 -40
- claude_mpm/cli/commands/auto_configure.py +210 -25
- claude_mpm/cli/commands/config.py +88 -2
- claude_mpm/cli/commands/configure.py +1098 -159
- claude_mpm/cli/commands/configure_agent_display.py +25 -6
- claude_mpm/cli/commands/mpm_init/core.py +225 -46
- claude_mpm/cli/commands/mpm_init/knowledge_extractor.py +481 -0
- claude_mpm/cli/commands/mpm_init/prompts.py +280 -0
- claude_mpm/cli/commands/postmortem.py +1 -1
- claude_mpm/cli/commands/profile.py +277 -0
- claude_mpm/cli/commands/skills.py +218 -197
- claude_mpm/cli/commands/summarize.py +413 -0
- claude_mpm/cli/executor.py +21 -3
- claude_mpm/cli/interactive/agent_wizard.py +2 -2
- claude_mpm/cli/parsers/agents_parser.py +0 -9
- claude_mpm/cli/parsers/auto_configure_parser.py +0 -138
- claude_mpm/cli/parsers/base_parser.py +12 -0
- claude_mpm/cli/parsers/config_parser.py +153 -83
- claude_mpm/cli/parsers/profile_parser.py +148 -0
- claude_mpm/cli/parsers/skills_parser.py +0 -5
- claude_mpm/cli/startup.py +876 -149
- claude_mpm/commands/mpm-config.md +28 -0
- claude_mpm/commands/mpm-doctor.md +9 -22
- claude_mpm/commands/mpm-help.md +5 -287
- claude_mpm/commands/mpm-init.md +81 -507
- claude_mpm/commands/mpm-monitor.md +15 -402
- claude_mpm/commands/mpm-organize.md +120 -0
- claude_mpm/commands/mpm-postmortem.md +6 -108
- claude_mpm/commands/mpm-session-resume.md +12 -363
- claude_mpm/commands/mpm-status.md +5 -69
- claude_mpm/commands/mpm-ticket-view.md +52 -495
- claude_mpm/commands/mpm-version.md +5 -107
- claude_mpm/config/agent_sources.py +27 -0
- claude_mpm/core/config.py +2 -4
- claude_mpm/core/framework/formatters/content_formatter.py +3 -13
- claude_mpm/core/framework/loaders/agent_loader.py +8 -5
- claude_mpm/core/framework/loaders/instruction_loader.py +52 -11
- claude_mpm/core/framework_loader.py +4 -2
- claude_mpm/core/logger.py +13 -0
- claude_mpm/core/optimized_startup.py +59 -0
- claude_mpm/core/shared/config_loader.py +1 -1
- claude_mpm/core/socketio_pool.py +3 -3
- claude_mpm/core/unified_agent_registry.py +5 -15
- claude_mpm/dashboard/static/svelte-build/_app/env.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/assets/0.B_FtCwCQ.css +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/assets/2.Cl_eSA4x.css +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/BgChzWQ1.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/CIXEwuWe.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/CWc5urbQ.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/DMkZpdF2.js +2 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/DjhvlsAc.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/N4qtv3Hx.js +2 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/uj46x2Wr.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/entry/app.DTL5mJO-.js +2 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/entry/start.DzuEhzqh.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/nodes/0.CAGBuiOw.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/nodes/1.DFLC8jdE.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/nodes/2.DPvEihJJ.js +10 -0
- claude_mpm/dashboard/static/svelte-build/_app/version.json +1 -0
- claude_mpm/dashboard/static/svelte-build/favicon.svg +7 -0
- claude_mpm/dashboard/static/svelte-build/index.html +36 -0
- claude_mpm/hooks/claude_hooks/__pycache__/__init__.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/correlation_manager.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/event_handlers.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/hook_handler.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/installer.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/memory_integration.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/response_tracking.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/tool_analysis.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/correlation_manager.py +60 -0
- claude_mpm/hooks/claude_hooks/event_handlers.py +211 -78
- claude_mpm/hooks/claude_hooks/hook_handler.py +155 -1
- claude_mpm/hooks/claude_hooks/installer.py +33 -10
- claude_mpm/hooks/claude_hooks/memory_integration.py +26 -9
- claude_mpm/hooks/claude_hooks/response_tracking.py +2 -3
- claude_mpm/hooks/claude_hooks/services/__pycache__/__init__.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/connection_manager.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/connection_manager_http.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/duplicate_detector.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/state_manager.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/subagent_processor.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/connection_manager.py +30 -6
- claude_mpm/hooks/kuzu_memory_hook.py +5 -5
- claude_mpm/hooks/memory_integration_hook.py +46 -1
- claude_mpm/init.py +63 -19
- claude_mpm/models/git_repository.py +3 -3
- claude_mpm/scripts/claude-hook-handler.sh +58 -18
- claude_mpm/scripts/launch_monitor.py +93 -13
- claude_mpm/services/agents/agent_builder.py +3 -3
- claude_mpm/services/agents/agent_recommendation_service.py +278 -0
- claude_mpm/services/agents/agent_review_service.py +280 -0
- claude_mpm/services/agents/cache_git_manager.py +6 -6
- claude_mpm/services/agents/deployment/agent_deployment.py +29 -7
- claude_mpm/services/agents/deployment/agent_discovery_service.py +4 -5
- claude_mpm/services/agents/deployment/agent_format_converter.py +23 -13
- claude_mpm/services/agents/deployment/agent_template_builder.py +32 -20
- claude_mpm/services/agents/deployment/agents_directory_resolver.py +2 -2
- claude_mpm/services/agents/deployment/async_agent_deployment.py +31 -27
- claude_mpm/services/agents/deployment/local_template_deployment.py +3 -1
- claude_mpm/services/agents/deployment/multi_source_deployment_service.py +247 -35
- claude_mpm/services/agents/deployment/remote_agent_discovery_service.py +392 -87
- claude_mpm/services/agents/git_source_manager.py +53 -4
- claude_mpm/services/agents/loading/base_agent_manager.py +1 -13
- claude_mpm/services/agents/recommender.py +5 -3
- claude_mpm/services/agents/single_tier_deployment_service.py +2 -2
- claude_mpm/services/agents/sources/git_source_sync_service.py +120 -7
- claude_mpm/services/agents/startup_sync.py +22 -2
- claude_mpm/services/agents/toolchain_detector.py +10 -6
- claude_mpm/services/analysis/__init__.py +11 -1
- claude_mpm/services/analysis/clone_detector.py +1030 -0
- claude_mpm/services/command_deployment_service.py +81 -10
- claude_mpm/services/diagnostics/checks/agent_check.py +2 -2
- claude_mpm/services/diagnostics/checks/agent_sources_check.py +1 -1
- claude_mpm/services/event_bus/config.py +3 -1
- claude_mpm/services/git/git_operations_service.py +101 -16
- claude_mpm/services/monitor/daemon.py +9 -2
- claude_mpm/services/monitor/daemon_manager.py +39 -3
- claude_mpm/services/monitor/management/lifecycle.py +8 -1
- claude_mpm/services/monitor/server.py +698 -22
- claude_mpm/services/pm_skills_deployer.py +711 -0
- claude_mpm/services/profile_manager.py +331 -0
- claude_mpm/services/self_upgrade_service.py +120 -12
- claude_mpm/services/skills/__init__.py +3 -0
- claude_mpm/services/skills/git_skill_source_manager.py +130 -2
- claude_mpm/services/skills/selective_skill_deployer.py +704 -0
- claude_mpm/services/skills/skill_to_agent_mapper.py +406 -0
- claude_mpm/services/skills_deployer.py +127 -9
- claude_mpm/services/socketio/dashboard_server.py +1 -0
- claude_mpm/services/socketio/event_normalizer.py +51 -6
- claude_mpm/services/socketio/server/core.py +386 -108
- claude_mpm/services/version_control/git_operations.py +103 -0
- claude_mpm/skills/skill_manager.py +92 -3
- claude_mpm/utils/agent_dependency_loader.py +14 -2
- claude_mpm/utils/agent_filters.py +17 -44
- claude_mpm/utils/migration.py +4 -4
- claude_mpm/utils/robust_installer.py +47 -3
- {claude_mpm-5.1.9.dist-info → claude_mpm-5.4.48.dist-info}/METADATA +53 -87
- {claude_mpm-5.1.9.dist-info → claude_mpm-5.4.48.dist-info}/RECORD +157 -197
- claude_mpm-5.4.48.dist-info/entry_points.txt +5 -0
- claude_mpm-5.4.48.dist-info/licenses/LICENSE +94 -0
- claude_mpm-5.4.48.dist-info/licenses/LICENSE-FAQ.md +153 -0
- claude_mpm/agents/BASE_AGENT_TEMPLATE.md +0 -292
- claude_mpm/agents/BASE_DOCUMENTATION.md +0 -53
- claude_mpm/agents/BASE_OPS.md +0 -219
- claude_mpm/agents/BASE_PM.md +0 -480
- claude_mpm/agents/BASE_PROMPT_ENGINEER.md +0 -787
- claude_mpm/agents/BASE_QA.md +0 -167
- claude_mpm/agents/BASE_RESEARCH.md +0 -53
- claude_mpm/agents/base_agent_loader.py +0 -601
- claude_mpm/cli/commands/agents_detect.py +0 -380
- claude_mpm/cli/commands/agents_recommend.py +0 -309
- claude_mpm/cli/ticket_cli.py +0 -35
- claude_mpm/commands/mpm-agents-auto-configure.md +0 -278
- claude_mpm/commands/mpm-agents-detect.md +0 -177
- claude_mpm/commands/mpm-agents-list.md +0 -131
- claude_mpm/commands/mpm-agents-recommend.md +0 -223
- claude_mpm/commands/mpm-config-view.md +0 -150
- claude_mpm/commands/mpm-ticket-organize.md +0 -304
- claude_mpm/dashboard/analysis_runner.py +0 -455
- claude_mpm/dashboard/index.html +0 -13
- claude_mpm/dashboard/open_dashboard.py +0 -66
- claude_mpm/dashboard/static/css/activity.css +0 -1958
- claude_mpm/dashboard/static/css/connection-status.css +0 -370
- claude_mpm/dashboard/static/css/dashboard.css +0 -4701
- claude_mpm/dashboard/static/js/components/activity-tree.js +0 -1871
- claude_mpm/dashboard/static/js/components/agent-hierarchy.js +0 -777
- claude_mpm/dashboard/static/js/components/agent-inference.js +0 -956
- claude_mpm/dashboard/static/js/components/build-tracker.js +0 -333
- claude_mpm/dashboard/static/js/components/code-simple.js +0 -857
- claude_mpm/dashboard/static/js/components/connection-debug.js +0 -654
- claude_mpm/dashboard/static/js/components/diff-viewer.js +0 -891
- claude_mpm/dashboard/static/js/components/event-processor.js +0 -542
- claude_mpm/dashboard/static/js/components/event-viewer.js +0 -1155
- claude_mpm/dashboard/static/js/components/export-manager.js +0 -368
- claude_mpm/dashboard/static/js/components/file-change-tracker.js +0 -443
- claude_mpm/dashboard/static/js/components/file-change-viewer.js +0 -690
- claude_mpm/dashboard/static/js/components/file-tool-tracker.js +0 -724
- claude_mpm/dashboard/static/js/components/file-viewer.js +0 -580
- claude_mpm/dashboard/static/js/components/hud-library-loader.js +0 -211
- claude_mpm/dashboard/static/js/components/hud-manager.js +0 -671
- claude_mpm/dashboard/static/js/components/hud-visualizer.js +0 -1718
- claude_mpm/dashboard/static/js/components/module-viewer.js +0 -2764
- claude_mpm/dashboard/static/js/components/session-manager.js +0 -579
- claude_mpm/dashboard/static/js/components/socket-manager.js +0 -368
- claude_mpm/dashboard/static/js/components/ui-state-manager.js +0 -749
- claude_mpm/dashboard/static/js/components/unified-data-viewer.js +0 -1824
- claude_mpm/dashboard/static/js/components/working-directory.js +0 -920
- claude_mpm/dashboard/static/js/connection-manager.js +0 -536
- claude_mpm/dashboard/static/js/dashboard.js +0 -1914
- claude_mpm/dashboard/static/js/extension-error-handler.js +0 -164
- claude_mpm/dashboard/static/js/socket-client.js +0 -1474
- claude_mpm/dashboard/static/js/tab-isolation-fix.js +0 -185
- claude_mpm/dashboard/static/socket.io.min.js +0 -7
- claude_mpm/dashboard/static/socket.io.v4.8.1.backup.js +0 -7
- claude_mpm/dashboard/templates/code_simple.html +0 -153
- claude_mpm/dashboard/templates/index.html +0 -606
- claude_mpm/dashboard/test_dashboard.html +0 -372
- claude_mpm/scripts/mcp_server.py +0 -75
- claude_mpm/scripts/mcp_wrapper.py +0 -39
- claude_mpm/services/mcp_gateway/__init__.py +0 -159
- claude_mpm/services/mcp_gateway/auto_configure.py +0 -369
- claude_mpm/services/mcp_gateway/config/__init__.py +0 -17
- claude_mpm/services/mcp_gateway/config/config_loader.py +0 -296
- claude_mpm/services/mcp_gateway/config/config_schema.py +0 -243
- claude_mpm/services/mcp_gateway/config/configuration.py +0 -429
- claude_mpm/services/mcp_gateway/core/__init__.py +0 -43
- claude_mpm/services/mcp_gateway/core/base.py +0 -312
- claude_mpm/services/mcp_gateway/core/exceptions.py +0 -253
- claude_mpm/services/mcp_gateway/core/interfaces.py +0 -443
- claude_mpm/services/mcp_gateway/core/process_pool.py +0 -977
- claude_mpm/services/mcp_gateway/core/singleton_manager.py +0 -315
- claude_mpm/services/mcp_gateway/core/startup_verification.py +0 -316
- claude_mpm/services/mcp_gateway/main.py +0 -589
- claude_mpm/services/mcp_gateway/registry/__init__.py +0 -12
- claude_mpm/services/mcp_gateway/registry/service_registry.py +0 -412
- claude_mpm/services/mcp_gateway/registry/tool_registry.py +0 -489
- claude_mpm/services/mcp_gateway/server/__init__.py +0 -15
- claude_mpm/services/mcp_gateway/server/mcp_gateway.py +0 -414
- claude_mpm/services/mcp_gateway/server/stdio_handler.py +0 -372
- claude_mpm/services/mcp_gateway/server/stdio_server.py +0 -712
- claude_mpm/services/mcp_gateway/tools/__init__.py +0 -36
- claude_mpm/services/mcp_gateway/tools/base_adapter.py +0 -485
- claude_mpm/services/mcp_gateway/tools/document_summarizer.py +0 -789
- claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +0 -654
- claude_mpm/services/mcp_gateway/tools/health_check_tool.py +0 -456
- claude_mpm/services/mcp_gateway/tools/hello_world.py +0 -551
- claude_mpm/services/mcp_gateway/tools/kuzu_memory_service.py +0 -555
- claude_mpm/services/mcp_gateway/utils/__init__.py +0 -14
- claude_mpm/services/mcp_gateway/utils/package_version_checker.py +0 -160
- claude_mpm/services/mcp_gateway/utils/update_preferences.py +0 -170
- claude_mpm-5.1.9.dist-info/entry_points.txt +0 -10
- claude_mpm-5.1.9.dist-info/licenses/LICENSE +0 -21
- {claude_mpm-5.1.9.dist-info → claude_mpm-5.4.48.dist-info}/WHEEL +0 -0
- {claude_mpm-5.1.9.dist-info → claude_mpm-5.4.48.dist-info}/top_level.txt +0 -0
|
@@ -59,12 +59,15 @@ class AgentDisplay:
|
|
|
59
59
|
Shows:
|
|
60
60
|
- Agent ID (for selection)
|
|
61
61
|
- Name and description
|
|
62
|
-
-
|
|
62
|
+
- Installed/Available status
|
|
63
63
|
- Model or tools information
|
|
64
64
|
|
|
65
65
|
Args:
|
|
66
66
|
agents: List of agent configurations to display
|
|
67
67
|
"""
|
|
68
|
+
|
|
69
|
+
from ...utils.agent_filters import get_deployed_agent_ids
|
|
70
|
+
|
|
68
71
|
table = Table(
|
|
69
72
|
title=f"Available Agents ({len(agents)} total)",
|
|
70
73
|
box=ROUNDED,
|
|
@@ -77,12 +80,25 @@ class AgentDisplay:
|
|
|
77
80
|
table.add_column("Description", style="bold", width=45)
|
|
78
81
|
table.add_column("Model/Tools", style="dim", width=20)
|
|
79
82
|
|
|
83
|
+
# Get deployed agent IDs
|
|
84
|
+
deployed_ids = get_deployed_agent_ids()
|
|
85
|
+
|
|
86
|
+
# Track installed count for summary
|
|
87
|
+
installed_count = 0
|
|
88
|
+
|
|
80
89
|
for idx, agent in enumerate(agents, 1):
|
|
81
|
-
# Check if agent is
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
# Check if agent is deployed to .claude/agents/
|
|
91
|
+
# Use agent_id (technical ID) for comparison, not display name
|
|
92
|
+
agent_id = getattr(agent, "agent_id", agent.name)
|
|
93
|
+
agent_leaf_name = agent_id.split("/")[-1]
|
|
94
|
+
is_deployed = agent_leaf_name in deployed_ids
|
|
95
|
+
|
|
96
|
+
# Increment installed count
|
|
97
|
+
if is_deployed:
|
|
98
|
+
installed_count += 1
|
|
99
|
+
|
|
100
|
+
# Show "Installed" for deployed agents, "Available" otherwise
|
|
101
|
+
status = "[green]Installed[/green]" if is_deployed else "Available"
|
|
86
102
|
|
|
87
103
|
# Format tools/dependencies - show first 2 tools
|
|
88
104
|
tools_display = ""
|
|
@@ -115,6 +131,9 @@ class AgentDisplay:
|
|
|
115
131
|
|
|
116
132
|
self.console.print(table)
|
|
117
133
|
|
|
134
|
+
# Display summary count
|
|
135
|
+
self.console.print(f"\n📊 Agents: {installed_count} Installed / {len(agents)} Total")
|
|
136
|
+
|
|
118
137
|
def display_agents_with_pending_states(self, agents: List[AgentConfig]) -> None:
|
|
119
138
|
"""Display agents table with pending state indicators.
|
|
120
139
|
|
|
@@ -24,6 +24,7 @@ from claude_mpm.utils.display_helper import DisplayHelper
|
|
|
24
24
|
|
|
25
25
|
# Import from sibling modules in the mpm_init package
|
|
26
26
|
from . import display, git_activity, modes, prompts
|
|
27
|
+
from .knowledge_extractor import ProjectKnowledgeExtractor
|
|
27
28
|
|
|
28
29
|
logger = get_logger(__name__)
|
|
29
30
|
|
|
@@ -34,6 +35,7 @@ class MPMInitCommand:
|
|
|
34
35
|
def __init__(self, project_path: Optional[Path] = None):
|
|
35
36
|
"""Initialize the MPM-Init command."""
|
|
36
37
|
self.project_path = project_path or Path.cwd()
|
|
38
|
+
self.claude_mpm_dir = self.project_path / ".claude-mpm"
|
|
37
39
|
self.claude_mpm_script = self._find_claude_mpm_script()
|
|
38
40
|
self.console = Console()
|
|
39
41
|
|
|
@@ -155,9 +157,8 @@ class MPMInitCommand:
|
|
|
155
157
|
if pre_check_result.get("status") == OperationResult.ERROR:
|
|
156
158
|
return pre_check_result
|
|
157
159
|
|
|
158
|
-
#
|
|
159
|
-
|
|
160
|
-
self._update_gitignore()
|
|
160
|
+
# Note: .gitignore recommendations are now shown in 'mpm config' command
|
|
161
|
+
# instead of automatic updates during initialization
|
|
161
162
|
|
|
162
163
|
# Build the delegation prompt
|
|
163
164
|
if update_mode:
|
|
@@ -202,6 +203,10 @@ class MPMInitCommand:
|
|
|
202
203
|
if update_mode and result.get("status") == OperationResult.SUCCESS:
|
|
203
204
|
self._handle_update_post_processing()
|
|
204
205
|
|
|
206
|
+
# Deploy PM skills after successful initialization
|
|
207
|
+
if result.get("status") == OperationResult.SUCCESS:
|
|
208
|
+
self._deploy_pm_skills()
|
|
209
|
+
|
|
205
210
|
return result
|
|
206
211
|
|
|
207
212
|
except Exception as e:
|
|
@@ -399,48 +404,6 @@ class MPMInitCommand:
|
|
|
399
404
|
"warnings": warnings,
|
|
400
405
|
}
|
|
401
406
|
|
|
402
|
-
def _update_gitignore(self) -> None:
|
|
403
|
-
"""Update .gitignore to exclude claude-mpm configuration directories.
|
|
404
|
-
|
|
405
|
-
Ensures that claude-mpm configuration directories are added to .gitignore
|
|
406
|
-
to prevent them from being committed to version control.
|
|
407
|
-
|
|
408
|
-
This is a non-destructive operation that:
|
|
409
|
-
- Creates .gitignore if it doesn't exist
|
|
410
|
-
- Appends missing entries only (never duplicates)
|
|
411
|
-
- Preserves all existing content
|
|
412
|
-
|
|
413
|
-
Standard entries added:
|
|
414
|
-
- .claude-mpm/: Main configuration directory
|
|
415
|
-
- .claude/agents/: Agent runtime files
|
|
416
|
-
"""
|
|
417
|
-
from claude_mpm.utils.gitignore import ensure_claude_mpm_gitignore
|
|
418
|
-
|
|
419
|
-
try:
|
|
420
|
-
result = ensure_claude_mpm_gitignore(str(self.project_path))
|
|
421
|
-
|
|
422
|
-
if result.get("status") == "success":
|
|
423
|
-
if result.get("added"):
|
|
424
|
-
self.console.print(
|
|
425
|
-
f"[green]✓[/green] Updated .gitignore: {', '.join(result['added'])}"
|
|
426
|
-
)
|
|
427
|
-
logger.info(f"Added to .gitignore: {result['added']}")
|
|
428
|
-
elif result.get("existing"):
|
|
429
|
-
logger.debug(f".gitignore already contains: {result['existing']}")
|
|
430
|
-
else:
|
|
431
|
-
# Non-critical error - log but don't fail initialization
|
|
432
|
-
logger.warning(
|
|
433
|
-
f"Could not update .gitignore: {result.get('error', 'Unknown error')}"
|
|
434
|
-
)
|
|
435
|
-
self.console.print(
|
|
436
|
-
f"[yellow]⚠️ Could not update .gitignore: {result.get('error')}[/yellow]"
|
|
437
|
-
)
|
|
438
|
-
|
|
439
|
-
except Exception as e:
|
|
440
|
-
# Non-critical error - log but don't fail initialization
|
|
441
|
-
logger.warning(f"Error updating .gitignore: {e}")
|
|
442
|
-
self.console.print(f"[yellow]⚠️ Could not update .gitignore: {e}[/yellow]")
|
|
443
|
-
|
|
444
407
|
def _build_initialization_prompt(
|
|
445
408
|
self,
|
|
446
409
|
project_type: Optional[str] = None,
|
|
@@ -452,6 +415,10 @@ class MPMInitCommand:
|
|
|
452
415
|
self.project_path, project_type, framework, ast_analysis
|
|
453
416
|
)
|
|
454
417
|
|
|
418
|
+
def _is_initialized(self) -> bool:
|
|
419
|
+
"""Check if project is already initialized with .claude-mpm directory."""
|
|
420
|
+
return self.claude_mpm_dir.exists()
|
|
421
|
+
|
|
455
422
|
def _build_update_prompt(
|
|
456
423
|
self,
|
|
457
424
|
project_type: Optional[str],
|
|
@@ -459,10 +426,65 @@ class MPMInitCommand:
|
|
|
459
426
|
ast_analysis: bool,
|
|
460
427
|
preserve_custom: bool,
|
|
461
428
|
) -> str:
|
|
462
|
-
"""Build prompt for update mode."""
|
|
429
|
+
"""Build prompt for update mode with optional knowledge extraction."""
|
|
463
430
|
# Get existing content analysis
|
|
464
431
|
doc_analysis = self.doc_manager.analyze_existing_content()
|
|
465
432
|
|
|
433
|
+
# Check if project is initialized (.claude-mpm exists)
|
|
434
|
+
# If so, use enhanced update mode with knowledge extraction
|
|
435
|
+
if self._is_initialized():
|
|
436
|
+
self.console.print(
|
|
437
|
+
"[cyan]✓ Detected initialized project - activating enhanced update mode[/cyan]"
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
# Extract knowledge from all sources
|
|
441
|
+
extractor = ProjectKnowledgeExtractor(self.project_path)
|
|
442
|
+
|
|
443
|
+
self.console.print("[cyan]✓ Analyzing git history (last 90 days)...[/cyan]")
|
|
444
|
+
git_insights = extractor.extract_from_git(days=90)
|
|
445
|
+
|
|
446
|
+
if git_insights.get("available"):
|
|
447
|
+
arch_count = len(git_insights.get("architectural_decisions", []))
|
|
448
|
+
workflow_count = len(git_insights.get("workflow_patterns", []))
|
|
449
|
+
self.console.print(f" - Found {arch_count} architectural decisions")
|
|
450
|
+
self.console.print(f" - Detected {workflow_count} workflow patterns")
|
|
451
|
+
|
|
452
|
+
self.console.print("[cyan]✓ Analyzing session logs...[/cyan]")
|
|
453
|
+
log_insights = extractor.extract_from_logs()
|
|
454
|
+
|
|
455
|
+
if log_insights.get("available"):
|
|
456
|
+
learning_count = len(log_insights.get("learnings", []))
|
|
457
|
+
self.console.print(f" - Found {learning_count} learning entries")
|
|
458
|
+
|
|
459
|
+
self.console.print("[cyan]✓ Analyzing memory files...[/cyan]")
|
|
460
|
+
memory_insights = extractor.extract_from_memory()
|
|
461
|
+
|
|
462
|
+
if memory_insights.get("available"):
|
|
463
|
+
total_insights = (
|
|
464
|
+
len(memory_insights.get("architectural_knowledge", []))
|
|
465
|
+
+ len(memory_insights.get("implementation_guidelines", []))
|
|
466
|
+
+ len(memory_insights.get("common_mistakes", []))
|
|
467
|
+
+ len(memory_insights.get("technical_context", []))
|
|
468
|
+
)
|
|
469
|
+
self.console.print(f" - Found {total_insights} accumulated insights")
|
|
470
|
+
|
|
471
|
+
self.console.print(
|
|
472
|
+
"[green]✓ Knowledge extraction complete - building enhanced prompt[/green]\n"
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
# Build enhanced prompt with extracted knowledge
|
|
476
|
+
return prompts.build_enhanced_update_prompt(
|
|
477
|
+
self.project_path,
|
|
478
|
+
doc_analysis,
|
|
479
|
+
git_insights,
|
|
480
|
+
log_insights,
|
|
481
|
+
memory_insights,
|
|
482
|
+
project_type,
|
|
483
|
+
framework,
|
|
484
|
+
ast_analysis,
|
|
485
|
+
preserve_custom,
|
|
486
|
+
)
|
|
487
|
+
# Standard update mode (no .claude-mpm directory)
|
|
466
488
|
return prompts.build_update_prompt(
|
|
467
489
|
self.project_path,
|
|
468
490
|
doc_analysis,
|
|
@@ -548,6 +570,11 @@ class MPMInitCommand:
|
|
|
548
570
|
self.archive_manager,
|
|
549
571
|
)
|
|
550
572
|
|
|
573
|
+
# Optimize CLAUDE.md with prompt-engineer if it exists
|
|
574
|
+
claude_md = self.project_path / "CLAUDE.md"
|
|
575
|
+
if claude_md.exists():
|
|
576
|
+
self._optimize_claude_md_with_prompt_engineer()
|
|
577
|
+
|
|
551
578
|
def _display_results(self, result: Dict, verbose: bool):
|
|
552
579
|
"""Display initialization results."""
|
|
553
580
|
display.display_results(self.display, self.console, result, verbose)
|
|
@@ -569,5 +596,157 @@ class MPMInitCommand:
|
|
|
569
596
|
"""Build structured Research agent delegation prompt from git analysis."""
|
|
570
597
|
return prompts.build_research_context_prompt(git_analysis, days)
|
|
571
598
|
|
|
599
|
+
def _optimize_claude_md_with_prompt_engineer(self) -> None:
|
|
600
|
+
"""Optimize CLAUDE.md with prompt-engineer for conciseness and clarity."""
|
|
601
|
+
claude_md_path = self.project_path / "CLAUDE.md"
|
|
602
|
+
if not claude_md_path.exists():
|
|
603
|
+
return
|
|
604
|
+
|
|
605
|
+
try:
|
|
606
|
+
# Read current content
|
|
607
|
+
original_content = claude_md_path.read_text()
|
|
608
|
+
original_tokens = self._estimate_tokens(original_content)
|
|
609
|
+
|
|
610
|
+
# Create backup
|
|
611
|
+
backup_path = self.archive_manager.auto_archive_before_update(
|
|
612
|
+
claude_md_path, update_reason="Before prompt-engineer optimization"
|
|
613
|
+
)
|
|
614
|
+
|
|
615
|
+
if not backup_path:
|
|
616
|
+
logger.warning("Could not create backup before optimization")
|
|
617
|
+
self.console.print(
|
|
618
|
+
"[yellow]⚠️ Skipping optimization - backup failed[/yellow]"
|
|
619
|
+
)
|
|
620
|
+
return
|
|
621
|
+
|
|
622
|
+
self.console.print(
|
|
623
|
+
"\n[cyan]✓ Optimizing CLAUDE.md with prompt-engineer...[/cyan]"
|
|
624
|
+
)
|
|
625
|
+
self.console.print(f" - Original: {original_tokens:,} tokens (estimated)")
|
|
626
|
+
self.console.print(f" - Backup created: {backup_path}")
|
|
627
|
+
|
|
628
|
+
# Build optimization prompt
|
|
629
|
+
prompt = prompts.build_prompt_engineer_optimization_prompt(
|
|
630
|
+
original_content, original_tokens
|
|
631
|
+
)
|
|
632
|
+
|
|
633
|
+
# Run optimization through subprocess
|
|
634
|
+
with Progress(
|
|
635
|
+
SpinnerColumn(),
|
|
636
|
+
TextColumn("[progress.description]{task.description}"),
|
|
637
|
+
console=self.console,
|
|
638
|
+
) as progress:
|
|
639
|
+
task = progress.add_task(
|
|
640
|
+
"[cyan]Running prompt-engineer optimization...", total=None
|
|
641
|
+
)
|
|
642
|
+
|
|
643
|
+
result = self._run_initialization(
|
|
644
|
+
prompt, verbose=False, update_mode=True
|
|
645
|
+
)
|
|
646
|
+
|
|
647
|
+
progress.update(task, description="[green]✓ Optimization complete")
|
|
648
|
+
|
|
649
|
+
# Check if optimization succeeded
|
|
650
|
+
if result.get("status") == OperationResult.SUCCESS:
|
|
651
|
+
# Read optimized content
|
|
652
|
+
optimized_content = claude_md_path.read_text()
|
|
653
|
+
optimized_tokens = self._estimate_tokens(optimized_content)
|
|
654
|
+
|
|
655
|
+
# Calculate reduction
|
|
656
|
+
token_reduction = original_tokens - optimized_tokens
|
|
657
|
+
reduction_percent = (
|
|
658
|
+
(token_reduction / original_tokens * 100)
|
|
659
|
+
if original_tokens > 0
|
|
660
|
+
else 0
|
|
661
|
+
)
|
|
662
|
+
|
|
663
|
+
self.console.print(
|
|
664
|
+
f" - Optimized: {optimized_tokens:,} tokens ({reduction_percent:.1f}% reduction)"
|
|
665
|
+
)
|
|
666
|
+
self.console.print("[green]✓ CLAUDE.md optimization complete[/green]\n")
|
|
667
|
+
# Restore from backup on failure
|
|
668
|
+
elif backup_path and backup_path.exists():
|
|
669
|
+
import shutil
|
|
670
|
+
|
|
671
|
+
shutil.copy2(backup_path, claude_md_path)
|
|
672
|
+
self.console.print(
|
|
673
|
+
"[yellow]⚠️ Optimization failed - restored from backup[/yellow]\n"
|
|
674
|
+
)
|
|
675
|
+
|
|
676
|
+
except Exception as e:
|
|
677
|
+
logger.error(f"Failed to optimize CLAUDE.md: {e}")
|
|
678
|
+
self.console.print(
|
|
679
|
+
f"[yellow]⚠️ Could not optimize CLAUDE.md: {e}[/yellow]\n"
|
|
680
|
+
)
|
|
681
|
+
|
|
682
|
+
def _estimate_tokens(self, text: str) -> int:
|
|
683
|
+
"""Estimate token count for text (rough approximation).
|
|
684
|
+
|
|
685
|
+
Uses a simple heuristic: ~4 characters per token for English text.
|
|
686
|
+
This is a rough estimate but sufficient for displaying progress.
|
|
687
|
+
"""
|
|
688
|
+
return len(text) // 4
|
|
689
|
+
|
|
690
|
+
def _deploy_pm_skills(self) -> None:
|
|
691
|
+
"""Deploy PM skills templates to project .claude-mpm directory.
|
|
692
|
+
|
|
693
|
+
Copies PM skills from bundled templates to .claude-mpm/skills/pm/
|
|
694
|
+
with version tracking and checksum validation.
|
|
695
|
+
"""
|
|
696
|
+
try:
|
|
697
|
+
from rich.progress import BarColumn, Progress, TaskProgressColumn, TextColumn
|
|
698
|
+
|
|
699
|
+
from claude_mpm.services.pm_skills_deployer import PMSkillsDeployerService
|
|
700
|
+
|
|
701
|
+
deployer = PMSkillsDeployerService()
|
|
702
|
+
|
|
703
|
+
# Use progress bar for deployment
|
|
704
|
+
with Progress(
|
|
705
|
+
TextColumn("[cyan]Deploying PM skills[/cyan]"),
|
|
706
|
+
BarColumn(bar_width=30),
|
|
707
|
+
TaskProgressColumn(),
|
|
708
|
+
TextColumn("[dim]{task.description}[/dim]"),
|
|
709
|
+
console=self.console,
|
|
710
|
+
) as progress:
|
|
711
|
+
task = progress.add_task("", total=None) # Unknown total initially
|
|
712
|
+
|
|
713
|
+
def update_progress(skill_name: str, current: int, total: int) -> None:
|
|
714
|
+
progress.update(task, total=total, completed=current, description=skill_name)
|
|
715
|
+
|
|
716
|
+
result = deployer.deploy_pm_skills(
|
|
717
|
+
self.project_path, progress_callback=update_progress
|
|
718
|
+
)
|
|
719
|
+
|
|
720
|
+
if result.success:
|
|
721
|
+
if result.deployed:
|
|
722
|
+
self.console.print(
|
|
723
|
+
f"[green]✓ Deployed {len(result.deployed)} PM skills[/green]"
|
|
724
|
+
)
|
|
725
|
+
|
|
726
|
+
if result.skipped:
|
|
727
|
+
self.console.print(
|
|
728
|
+
f"[dim] Skipped {len(result.skipped)} (already deployed)[/dim]"
|
|
729
|
+
)
|
|
730
|
+
|
|
731
|
+
if result.errors:
|
|
732
|
+
self.console.print(f"[yellow]⚠️ {len(result.errors)} errors:[/yellow]")
|
|
733
|
+
for error in result.errors[:3]: # Show first 3 errors
|
|
734
|
+
self.console.print(f" • {error['skill']}: {error['error']}")
|
|
735
|
+
else:
|
|
736
|
+
self.console.print(
|
|
737
|
+
f"[yellow]⚠️ PM skills deployment had errors: {result.message}[/yellow]"
|
|
738
|
+
)
|
|
739
|
+
|
|
740
|
+
except ImportError as e:
|
|
741
|
+
logger.warning(f"PM skills deployer not available: {e}")
|
|
742
|
+
self.console.print(
|
|
743
|
+
"[yellow]⚠️ PM skills deployment skipped (service not available)[/yellow]"
|
|
744
|
+
)
|
|
745
|
+
except Exception as e:
|
|
746
|
+
logger.error(f"Failed to deploy PM skills: {e}")
|
|
747
|
+
self.console.print(
|
|
748
|
+
f"[yellow]⚠️ PM skills deployment failed: {e}[/yellow]"
|
|
749
|
+
)
|
|
750
|
+
|
|
572
751
|
|
|
573
752
|
__all__ = ["MPMInitCommand"]
|