claude-mpm 4.1.8__py3-none-any.whl → 4.1.11__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.
- claude_mpm/VERSION +1 -1
- claude_mpm/agents/INSTRUCTIONS.md +26 -1
- claude_mpm/agents/agents_metadata.py +57 -0
- claude_mpm/agents/templates/.claude-mpm/memories/README.md +17 -0
- claude_mpm/agents/templates/.claude-mpm/memories/engineer_memories.md +3 -0
- claude_mpm/agents/templates/agent-manager.json +263 -17
- claude_mpm/agents/templates/agentic_coder_optimizer.json +222 -0
- claude_mpm/agents/templates/code_analyzer.json +18 -8
- claude_mpm/agents/templates/engineer.json +1 -1
- claude_mpm/agents/templates/logs/prompts/agent_engineer_20250826_014258_728.md +39 -0
- claude_mpm/agents/templates/qa.json +1 -1
- claude_mpm/agents/templates/research.json +1 -1
- claude_mpm/cli/__init__.py +15 -0
- claude_mpm/cli/commands/__init__.py +6 -0
- claude_mpm/cli/commands/analyze.py +548 -0
- claude_mpm/cli/commands/analyze_code.py +524 -0
- claude_mpm/cli/commands/configure.py +78 -28
- claude_mpm/cli/commands/configure_tui.py +62 -60
- claude_mpm/cli/commands/dashboard.py +288 -0
- claude_mpm/cli/commands/debug.py +1386 -0
- claude_mpm/cli/commands/mpm_init.py +427 -0
- claude_mpm/cli/commands/mpm_init_handler.py +83 -0
- claude_mpm/cli/parsers/analyze_code_parser.py +170 -0
- claude_mpm/cli/parsers/analyze_parser.py +135 -0
- claude_mpm/cli/parsers/base_parser.py +44 -0
- claude_mpm/cli/parsers/dashboard_parser.py +113 -0
- claude_mpm/cli/parsers/debug_parser.py +319 -0
- claude_mpm/cli/parsers/mpm_init_parser.py +122 -0
- claude_mpm/constants.py +13 -1
- claude_mpm/core/framework_loader.py +148 -6
- claude_mpm/core/log_manager.py +16 -13
- claude_mpm/core/logger.py +1 -1
- claude_mpm/core/unified_agent_registry.py +1 -1
- claude_mpm/dashboard/.claude-mpm/socketio-instances.json +1 -0
- claude_mpm/dashboard/analysis_runner.py +455 -0
- claude_mpm/dashboard/static/built/components/activity-tree.js +2 -0
- claude_mpm/dashboard/static/built/components/agent-inference.js +1 -1
- claude_mpm/dashboard/static/built/components/code-tree.js +2 -0
- claude_mpm/dashboard/static/built/components/code-viewer.js +2 -0
- claude_mpm/dashboard/static/built/components/event-viewer.js +1 -1
- claude_mpm/dashboard/static/built/components/file-tool-tracker.js +1 -1
- claude_mpm/dashboard/static/built/components/module-viewer.js +1 -1
- claude_mpm/dashboard/static/built/components/session-manager.js +1 -1
- claude_mpm/dashboard/static/built/components/working-directory.js +1 -1
- claude_mpm/dashboard/static/built/dashboard.js +1 -1
- claude_mpm/dashboard/static/built/socket-client.js +1 -1
- claude_mpm/dashboard/static/css/activity.css +549 -0
- claude_mpm/dashboard/static/css/code-tree.css +1175 -0
- claude_mpm/dashboard/static/css/dashboard.css +245 -0
- claude_mpm/dashboard/static/dist/components/activity-tree.js +2 -0
- claude_mpm/dashboard/static/dist/components/code-tree.js +2 -0
- claude_mpm/dashboard/static/dist/components/code-viewer.js +2 -0
- claude_mpm/dashboard/static/dist/components/event-viewer.js +1 -1
- claude_mpm/dashboard/static/dist/components/session-manager.js +1 -1
- claude_mpm/dashboard/static/dist/components/working-directory.js +1 -1
- claude_mpm/dashboard/static/dist/dashboard.js +1 -1
- claude_mpm/dashboard/static/dist/socket-client.js +1 -1
- claude_mpm/dashboard/static/js/components/activity-tree.js +1338 -0
- claude_mpm/dashboard/static/js/components/code-tree.js +2535 -0
- claude_mpm/dashboard/static/js/components/code-viewer.js +480 -0
- claude_mpm/dashboard/static/js/components/event-viewer.js +59 -9
- claude_mpm/dashboard/static/js/components/session-manager.js +40 -4
- claude_mpm/dashboard/static/js/components/socket-manager.js +12 -0
- claude_mpm/dashboard/static/js/components/ui-state-manager.js +4 -0
- claude_mpm/dashboard/static/js/components/working-directory.js +17 -1
- claude_mpm/dashboard/static/js/dashboard.js +51 -0
- claude_mpm/dashboard/static/js/socket-client.js +465 -29
- claude_mpm/dashboard/templates/index.html +182 -4
- claude_mpm/hooks/claude_hooks/hook_handler.py +182 -5
- claude_mpm/hooks/claude_hooks/installer.py +386 -113
- claude_mpm/scripts/claude-hook-handler.sh +161 -0
- claude_mpm/scripts/socketio_daemon.py +121 -8
- claude_mpm/services/agents/deployment/agent_lifecycle_manager_refactored.py +2 -2
- claude_mpm/services/agents/deployment/agent_record_service.py +1 -2
- claude_mpm/services/agents/memory/memory_format_service.py +1 -3
- claude_mpm/services/cli/agent_cleanup_service.py +1 -5
- claude_mpm/services/cli/agent_dependency_service.py +1 -1
- claude_mpm/services/cli/agent_validation_service.py +3 -4
- claude_mpm/services/cli/dashboard_launcher.py +2 -3
- claude_mpm/services/cli/startup_checker.py +0 -11
- claude_mpm/services/core/cache_manager.py +1 -3
- claude_mpm/services/core/path_resolver.py +1 -4
- claude_mpm/services/core/service_container.py +2 -2
- claude_mpm/services/diagnostics/checks/instructions_check.py +1 -2
- claude_mpm/services/infrastructure/monitoring/__init__.py +11 -11
- claude_mpm/services/infrastructure/monitoring.py +11 -11
- claude_mpm/services/project/architecture_analyzer.py +1 -1
- claude_mpm/services/project/dependency_analyzer.py +4 -4
- claude_mpm/services/project/language_analyzer.py +3 -3
- claude_mpm/services/project/metrics_collector.py +3 -6
- claude_mpm/services/socketio/event_normalizer.py +64 -0
- claude_mpm/services/socketio/handlers/__init__.py +2 -0
- claude_mpm/services/socketio/handlers/code_analysis.py +672 -0
- claude_mpm/services/socketio/handlers/registry.py +2 -0
- claude_mpm/services/socketio/server/connection_manager.py +6 -4
- claude_mpm/services/socketio/server/core.py +100 -11
- claude_mpm/services/socketio/server/main.py +8 -2
- claude_mpm/services/visualization/__init__.py +19 -0
- claude_mpm/services/visualization/mermaid_generator.py +938 -0
- claude_mpm/tools/__main__.py +208 -0
- claude_mpm/tools/code_tree_analyzer.py +1596 -0
- claude_mpm/tools/code_tree_builder.py +631 -0
- claude_mpm/tools/code_tree_events.py +416 -0
- claude_mpm/tools/socketio_debug.py +671 -0
- {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.11.dist-info}/METADATA +2 -1
- {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.11.dist-info}/RECORD +110 -74
- claude_mpm/agents/schema/agent_schema.json +0 -314
- {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.11.dist-info}/WHEEL +0 -0
- {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.11.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.11.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.11.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Parser configuration for analyze command.
|
|
3
|
+
|
|
4
|
+
WHY: This module adds the analyze subcommand to the CLI for code analysis
|
|
5
|
+
with mermaid diagram generation capabilities.
|
|
6
|
+
|
|
7
|
+
DESIGN DECISIONS:
|
|
8
|
+
- Support mermaid diagram generation via flags
|
|
9
|
+
- Allow specification of diagram types
|
|
10
|
+
- Enable target directory/file selection
|
|
11
|
+
- Follow existing parser patterns
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
from .base_parser import add_common_arguments
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def add_analyze_subparser(subparsers):
|
|
20
|
+
"""Add analyze command parser.
|
|
21
|
+
|
|
22
|
+
WHY: Provides CLI interface for code analysis with mermaid diagram
|
|
23
|
+
generation, allowing users to visualize their codebase architecture.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
subparsers: The subparsers object from argparse
|
|
27
|
+
"""
|
|
28
|
+
parser = subparsers.add_parser(
|
|
29
|
+
"analyze",
|
|
30
|
+
aliases=["analysis", "code-analyze"],
|
|
31
|
+
help="Analyze code and generate mermaid diagrams",
|
|
32
|
+
description="Run code analysis with optional mermaid diagram generation",
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
# Add common arguments
|
|
36
|
+
add_common_arguments(parser)
|
|
37
|
+
|
|
38
|
+
# Analysis target options
|
|
39
|
+
parser.add_argument(
|
|
40
|
+
"--target",
|
|
41
|
+
type=Path,
|
|
42
|
+
default=Path.cwd(),
|
|
43
|
+
help="Directory or file to analyze (default: current directory)",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
parser.add_argument(
|
|
47
|
+
"--recursive",
|
|
48
|
+
action="store_true",
|
|
49
|
+
default=True,
|
|
50
|
+
help="Recursively analyze subdirectories (default: True)",
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# Mermaid diagram options
|
|
54
|
+
mermaid_group = parser.add_argument_group("mermaid diagram options")
|
|
55
|
+
mermaid_group.add_argument(
|
|
56
|
+
"--mermaid", action="store_true", help="Enable mermaid diagram generation"
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
mermaid_group.add_argument(
|
|
60
|
+
"--mermaid-types",
|
|
61
|
+
nargs="+",
|
|
62
|
+
choices=[
|
|
63
|
+
"entry_points",
|
|
64
|
+
"class_diagram",
|
|
65
|
+
"sequence",
|
|
66
|
+
"flowchart",
|
|
67
|
+
"state",
|
|
68
|
+
"entity_relationship",
|
|
69
|
+
"component",
|
|
70
|
+
"dependency_graph",
|
|
71
|
+
"call_graph",
|
|
72
|
+
"architecture",
|
|
73
|
+
],
|
|
74
|
+
default=["entry_points"],
|
|
75
|
+
help="Types of mermaid diagrams to generate (default: entry_points)",
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
mermaid_group.add_argument(
|
|
79
|
+
"--save-diagrams", action="store_true", help="Save generated diagrams to files"
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
mermaid_group.add_argument(
|
|
83
|
+
"--diagram-output",
|
|
84
|
+
type=Path,
|
|
85
|
+
help="Directory to save diagrams (default: ./diagrams/)",
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
# Analysis options
|
|
89
|
+
analysis_group = parser.add_argument_group("analysis options")
|
|
90
|
+
analysis_group.add_argument(
|
|
91
|
+
"--agent",
|
|
92
|
+
default="code-analyzer",
|
|
93
|
+
help="Agent to use for analysis (default: code-analyzer)",
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
analysis_group.add_argument(
|
|
97
|
+
"--prompt", type=str, help="Additional prompt/instructions for the analysis"
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
analysis_group.add_argument(
|
|
101
|
+
"--focus",
|
|
102
|
+
nargs="+",
|
|
103
|
+
choices=["security", "performance", "architecture", "quality", "documentation"],
|
|
104
|
+
help="Focus areas for analysis",
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
# Session options
|
|
108
|
+
session_group = parser.add_argument_group("session options")
|
|
109
|
+
session_group.add_argument(
|
|
110
|
+
"--session-id", type=str, help="Use specific session ID for analysis"
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
session_group.add_argument(
|
|
114
|
+
"--no-session", action="store_true", help="Run without session management"
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
# Output options
|
|
118
|
+
output_group = parser.add_argument_group("output options")
|
|
119
|
+
output_group.add_argument(
|
|
120
|
+
"--format",
|
|
121
|
+
choices=["text", "json", "markdown"],
|
|
122
|
+
default="text",
|
|
123
|
+
help="Output format (default: text)",
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
output_group.add_argument(
|
|
127
|
+
"--output", "-o", type=Path, help="Save analysis output to file"
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
# Note: --verbose/-v is already defined in base_parser, so removed to avoid conflict
|
|
131
|
+
|
|
132
|
+
# Import the command function
|
|
133
|
+
from ..commands.analyze import analyze_command
|
|
134
|
+
|
|
135
|
+
parser.set_defaults(func=analyze_command)
|
|
@@ -317,6 +317,13 @@ def create_parser(
|
|
|
317
317
|
except ImportError:
|
|
318
318
|
pass
|
|
319
319
|
|
|
320
|
+
try:
|
|
321
|
+
from .dashboard_parser import add_dashboard_subparser
|
|
322
|
+
|
|
323
|
+
add_dashboard_subparser(subparsers)
|
|
324
|
+
except ImportError:
|
|
325
|
+
pass
|
|
326
|
+
|
|
320
327
|
try:
|
|
321
328
|
from .mcp_parser import add_mcp_subparser
|
|
322
329
|
|
|
@@ -338,6 +345,43 @@ def create_parser(
|
|
|
338
345
|
except ImportError:
|
|
339
346
|
pass
|
|
340
347
|
|
|
348
|
+
# Add debug command parser
|
|
349
|
+
try:
|
|
350
|
+
from .debug_parser import add_debug_subparser
|
|
351
|
+
|
|
352
|
+
add_debug_subparser(subparsers)
|
|
353
|
+
except ImportError:
|
|
354
|
+
pass
|
|
355
|
+
|
|
356
|
+
# Add analyze command parser
|
|
357
|
+
try:
|
|
358
|
+
from .analyze_parser import add_analyze_subparser
|
|
359
|
+
|
|
360
|
+
add_analyze_subparser(subparsers)
|
|
361
|
+
except ImportError:
|
|
362
|
+
pass
|
|
363
|
+
|
|
364
|
+
# Add analyze-code command parser
|
|
365
|
+
try:
|
|
366
|
+
from .analyze_code_parser import AnalyzeCodeParser
|
|
367
|
+
|
|
368
|
+
parser_obj = AnalyzeCodeParser()
|
|
369
|
+
analyze_code_parser = subparsers.add_parser(
|
|
370
|
+
"analyze-code", help=parser_obj.help_text
|
|
371
|
+
)
|
|
372
|
+
parser_obj.add_arguments(analyze_code_parser)
|
|
373
|
+
analyze_code_parser.set_defaults(command="analyze-code")
|
|
374
|
+
except ImportError:
|
|
375
|
+
pass
|
|
376
|
+
|
|
377
|
+
# Add mpm-init command parser
|
|
378
|
+
try:
|
|
379
|
+
from .mpm_init_parser import add_mpm_init_subparser
|
|
380
|
+
|
|
381
|
+
add_mpm_init_subparser(subparsers)
|
|
382
|
+
except ImportError:
|
|
383
|
+
pass
|
|
384
|
+
|
|
341
385
|
# Import and add additional command parsers from commands module
|
|
342
386
|
try:
|
|
343
387
|
from ..commands.aggregate import add_aggregate_parser
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Dashboard command parser for claude-mpm CLI.
|
|
3
|
+
|
|
4
|
+
WHY: This module contains all arguments specific to dashboard management,
|
|
5
|
+
providing a clean interface for starting, stopping, and managing the web dashboard.
|
|
6
|
+
|
|
7
|
+
DESIGN DECISION: Dashboard commands handle web interface management and
|
|
8
|
+
have their own subcommand structure similar to monitor commands.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
|
|
13
|
+
from ...constants import CLICommands, DashboardCommands
|
|
14
|
+
from .base_parser import add_common_arguments
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def add_dashboard_subparser(subparsers) -> argparse.ArgumentParser:
|
|
18
|
+
"""
|
|
19
|
+
Add the dashboard subparser with all dashboard management commands.
|
|
20
|
+
|
|
21
|
+
WHY: Dashboard management has multiple subcommands for starting, stopping,
|
|
22
|
+
checking status, and opening the web interface in a browser.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
subparsers: The subparsers object from the main parser
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
The configured dashboard subparser
|
|
29
|
+
"""
|
|
30
|
+
# Dashboard command with subcommands
|
|
31
|
+
dashboard_parser = subparsers.add_parser(
|
|
32
|
+
CLICommands.DASHBOARD.value,
|
|
33
|
+
help="Manage the web dashboard interface for monitoring and analysis",
|
|
34
|
+
)
|
|
35
|
+
add_common_arguments(dashboard_parser)
|
|
36
|
+
|
|
37
|
+
dashboard_subparsers = dashboard_parser.add_subparsers(
|
|
38
|
+
dest="dashboard_command", help="Dashboard commands", metavar="SUBCOMMAND"
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# Start dashboard
|
|
42
|
+
start_dashboard_parser = dashboard_subparsers.add_parser(
|
|
43
|
+
DashboardCommands.START.value,
|
|
44
|
+
help="Start the web dashboard server",
|
|
45
|
+
)
|
|
46
|
+
start_dashboard_parser.add_argument(
|
|
47
|
+
"--port",
|
|
48
|
+
type=int,
|
|
49
|
+
default=8765,
|
|
50
|
+
help="Port to start dashboard on (default: 8765)",
|
|
51
|
+
)
|
|
52
|
+
start_dashboard_parser.add_argument(
|
|
53
|
+
"--host",
|
|
54
|
+
default="localhost",
|
|
55
|
+
help="Host to bind to (default: localhost)",
|
|
56
|
+
)
|
|
57
|
+
start_dashboard_parser.add_argument(
|
|
58
|
+
"--background",
|
|
59
|
+
action="store_true",
|
|
60
|
+
help="Run dashboard server in background",
|
|
61
|
+
)
|
|
62
|
+
start_dashboard_parser.add_argument(
|
|
63
|
+
"--no-browser",
|
|
64
|
+
action="store_true",
|
|
65
|
+
help="Don't open browser automatically",
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# Stop dashboard
|
|
69
|
+
stop_dashboard_parser = dashboard_subparsers.add_parser(
|
|
70
|
+
DashboardCommands.STOP.value,
|
|
71
|
+
help="Stop the web dashboard server",
|
|
72
|
+
)
|
|
73
|
+
stop_dashboard_parser.add_argument(
|
|
74
|
+
"--port",
|
|
75
|
+
type=int,
|
|
76
|
+
default=8765,
|
|
77
|
+
help="Port of dashboard to stop (default: 8765)",
|
|
78
|
+
)
|
|
79
|
+
stop_dashboard_parser.add_argument(
|
|
80
|
+
"--all",
|
|
81
|
+
action="store_true",
|
|
82
|
+
help="Stop all running dashboard instances",
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
# Status dashboard
|
|
86
|
+
status_dashboard_parser = dashboard_subparsers.add_parser(
|
|
87
|
+
DashboardCommands.STATUS.value,
|
|
88
|
+
help="Check dashboard server status",
|
|
89
|
+
)
|
|
90
|
+
status_dashboard_parser.add_argument(
|
|
91
|
+
"--verbose",
|
|
92
|
+
action="store_true",
|
|
93
|
+
help="Show detailed status information",
|
|
94
|
+
)
|
|
95
|
+
status_dashboard_parser.add_argument(
|
|
96
|
+
"--show-ports",
|
|
97
|
+
action="store_true",
|
|
98
|
+
help="Show status of all ports in the range (8765-8785)",
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# Open dashboard
|
|
102
|
+
open_dashboard_parser = dashboard_subparsers.add_parser(
|
|
103
|
+
DashboardCommands.OPEN.value,
|
|
104
|
+
help="Open the dashboard in a web browser (starts if not running)",
|
|
105
|
+
)
|
|
106
|
+
open_dashboard_parser.add_argument(
|
|
107
|
+
"--port",
|
|
108
|
+
type=int,
|
|
109
|
+
default=8765,
|
|
110
|
+
help="Port of dashboard to open (default: 8765)",
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
return dashboard_parser
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Debug command parser for claude-mpm CLI.
|
|
3
|
+
|
|
4
|
+
This module contains all arguments specific to debugging tools,
|
|
5
|
+
providing developer-focused commands for monitoring and analysis.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import argparse
|
|
9
|
+
|
|
10
|
+
from .base_parser import add_common_arguments
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def add_debug_subparser(subparsers) -> argparse.ArgumentParser:
|
|
14
|
+
"""
|
|
15
|
+
Add the debug subparser with all debugging commands.
|
|
16
|
+
|
|
17
|
+
This provides professional debugging tools for developers working
|
|
18
|
+
on claude-mpm, particularly for dashboard and event monitoring.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
subparsers: The subparsers object from the main parser
|
|
22
|
+
|
|
23
|
+
Returns:
|
|
24
|
+
The configured debug subparser
|
|
25
|
+
"""
|
|
26
|
+
# Main debug parser
|
|
27
|
+
debug_parser = subparsers.add_parser(
|
|
28
|
+
"debug",
|
|
29
|
+
help="Development debugging tools",
|
|
30
|
+
description="Professional debugging tools for claude-mpm developers",
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
# Add common arguments (logging, etc.)
|
|
34
|
+
add_common_arguments(debug_parser)
|
|
35
|
+
|
|
36
|
+
# Create subparsers for debug commands
|
|
37
|
+
debug_subparsers = debug_parser.add_subparsers(
|
|
38
|
+
dest="debug_command", help="Debug commands", metavar="SUBCOMMAND", required=True
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# SocketIO event debugging
|
|
42
|
+
_add_socketio_parser(debug_subparsers)
|
|
43
|
+
|
|
44
|
+
# Connection debugging
|
|
45
|
+
_add_connections_parser(debug_subparsers)
|
|
46
|
+
|
|
47
|
+
# Services debugging
|
|
48
|
+
_add_services_parser(debug_subparsers)
|
|
49
|
+
|
|
50
|
+
# Agents debugging
|
|
51
|
+
_add_agents_parser(debug_subparsers)
|
|
52
|
+
|
|
53
|
+
# Hooks debugging
|
|
54
|
+
_add_hooks_parser(debug_subparsers)
|
|
55
|
+
|
|
56
|
+
# Cache debugging
|
|
57
|
+
_add_cache_parser(debug_subparsers)
|
|
58
|
+
|
|
59
|
+
# Performance debugging
|
|
60
|
+
_add_performance_parser(debug_subparsers)
|
|
61
|
+
|
|
62
|
+
return debug_parser
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _add_socketio_parser(subparsers):
|
|
66
|
+
"""Add SocketIO debugging subcommand."""
|
|
67
|
+
socketio_parser = subparsers.add_parser(
|
|
68
|
+
"socketio",
|
|
69
|
+
help="Monitor and debug SocketIO events in real-time",
|
|
70
|
+
aliases=["events", "socket"],
|
|
71
|
+
description="""
|
|
72
|
+
Professional SocketIO event monitoring tool for dashboard development.
|
|
73
|
+
|
|
74
|
+
This tool provides real-time monitoring of all SocketIO events with:
|
|
75
|
+
- Live event streaming with formatted output
|
|
76
|
+
- Event statistics and aggregation
|
|
77
|
+
- Tool usage tracking
|
|
78
|
+
- Session monitoring
|
|
79
|
+
- Connection health checks
|
|
80
|
+
- Event filtering and export capabilities
|
|
81
|
+
|
|
82
|
+
Examples:
|
|
83
|
+
# Monitor all events in real-time
|
|
84
|
+
claude-mpm debug socketio
|
|
85
|
+
|
|
86
|
+
# Show event summary statistics
|
|
87
|
+
claude-mpm debug socketio --summary
|
|
88
|
+
|
|
89
|
+
# Filter specific event types
|
|
90
|
+
claude-mpm debug socketio --filter PreToolUse PostToolUse
|
|
91
|
+
|
|
92
|
+
# Save events to file for analysis
|
|
93
|
+
claude-mpm debug socketio --output events.jsonl
|
|
94
|
+
|
|
95
|
+
# Connect to specific server
|
|
96
|
+
claude-mpm debug socketio --host localhost --port 8765
|
|
97
|
+
""",
|
|
98
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# Connection settings
|
|
102
|
+
conn_group = socketio_parser.add_argument_group("connection settings")
|
|
103
|
+
conn_group.add_argument(
|
|
104
|
+
"--host", default="localhost", help="SocketIO server host (default: localhost)"
|
|
105
|
+
)
|
|
106
|
+
conn_group.add_argument(
|
|
107
|
+
"--port", type=int, default=8765, help="SocketIO server port (default: 8765)"
|
|
108
|
+
)
|
|
109
|
+
conn_group.add_argument(
|
|
110
|
+
"--max-reconnect",
|
|
111
|
+
type=int,
|
|
112
|
+
default=10,
|
|
113
|
+
help="Maximum reconnection attempts (default: 10)",
|
|
114
|
+
)
|
|
115
|
+
conn_group.add_argument(
|
|
116
|
+
"--reconnect-delay",
|
|
117
|
+
type=float,
|
|
118
|
+
default=1.0,
|
|
119
|
+
help="Reconnection delay in seconds (default: 1.0)",
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
# Display modes (mutually exclusive)
|
|
123
|
+
display_group = socketio_parser.add_argument_group("display modes")
|
|
124
|
+
mode_group = display_group.add_mutually_exclusive_group()
|
|
125
|
+
mode_group.add_argument(
|
|
126
|
+
"--live",
|
|
127
|
+
action="store_true",
|
|
128
|
+
help="Live event monitoring with formatted output (default)",
|
|
129
|
+
)
|
|
130
|
+
mode_group.add_argument(
|
|
131
|
+
"--summary",
|
|
132
|
+
action="store_true",
|
|
133
|
+
help="Show aggregated event statistics and summary",
|
|
134
|
+
)
|
|
135
|
+
mode_group.add_argument(
|
|
136
|
+
"--raw", action="store_true", help="Display raw JSON output for each event"
|
|
137
|
+
)
|
|
138
|
+
mode_group.add_argument(
|
|
139
|
+
"--pretty",
|
|
140
|
+
action="store_true",
|
|
141
|
+
help="Enhanced formatted output with colors and icons",
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
# Filtering and output
|
|
145
|
+
filter_group = socketio_parser.add_argument_group("filtering and output")
|
|
146
|
+
filter_group.add_argument(
|
|
147
|
+
"--filter",
|
|
148
|
+
nargs="+",
|
|
149
|
+
dest="filter_types",
|
|
150
|
+
metavar="TYPE",
|
|
151
|
+
help="Filter specific event types (e.g., PreToolUse PostToolUse)",
|
|
152
|
+
)
|
|
153
|
+
filter_group.add_argument(
|
|
154
|
+
"--output", "-o", metavar="FILE", help="Save events to file in JSONL format"
|
|
155
|
+
)
|
|
156
|
+
filter_group.add_argument(
|
|
157
|
+
"--quiet",
|
|
158
|
+
"-q",
|
|
159
|
+
action="store_true",
|
|
160
|
+
help="Suppress output except errors (useful with --output)",
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def _add_connections_parser(subparsers):
|
|
165
|
+
"""Add connections debugging subcommand."""
|
|
166
|
+
connections_parser = subparsers.add_parser(
|
|
167
|
+
"connections",
|
|
168
|
+
help="Show active SocketIO server connections",
|
|
169
|
+
aliases=["conn", "servers"],
|
|
170
|
+
description="""
|
|
171
|
+
Display information about active SocketIO servers and their status.
|
|
172
|
+
|
|
173
|
+
This command shows:
|
|
174
|
+
- All running SocketIO server instances
|
|
175
|
+
- Port numbers and process IDs
|
|
176
|
+
- Connection health status
|
|
177
|
+
- Server start times
|
|
178
|
+
|
|
179
|
+
Examples:
|
|
180
|
+
# Show all active servers
|
|
181
|
+
claude-mpm debug connections
|
|
182
|
+
|
|
183
|
+
# Show detailed information
|
|
184
|
+
claude-mpm debug connections --verbose
|
|
185
|
+
""",
|
|
186
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
connections_parser.add_argument(
|
|
190
|
+
"--verbose",
|
|
191
|
+
"-v",
|
|
192
|
+
action="store_true",
|
|
193
|
+
help="Show detailed connection information in JSON format",
|
|
194
|
+
)
|
|
195
|
+
connections_parser.add_argument(
|
|
196
|
+
"--check-health",
|
|
197
|
+
action="store_true",
|
|
198
|
+
help="Perform health checks on each server",
|
|
199
|
+
)
|
|
200
|
+
connections_parser.add_argument(
|
|
201
|
+
"--cleanup", action="store_true", help="Clean up stale server entries"
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def _add_services_parser(subparsers):
|
|
206
|
+
"""Add services debugging subcommand."""
|
|
207
|
+
services_parser = subparsers.add_parser(
|
|
208
|
+
"services",
|
|
209
|
+
help="Debug service container and dependencies",
|
|
210
|
+
description="Inspect services, dependencies, and health status",
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
services_group = services_parser.add_mutually_exclusive_group()
|
|
214
|
+
services_group.add_argument(
|
|
215
|
+
"--list", action="store_true", help="List all registered services"
|
|
216
|
+
)
|
|
217
|
+
services_group.add_argument(
|
|
218
|
+
"--status", action="store_true", help="Show service health status"
|
|
219
|
+
)
|
|
220
|
+
services_group.add_argument(
|
|
221
|
+
"--dependencies", action="store_true", help="Show service dependency graph"
|
|
222
|
+
)
|
|
223
|
+
services_group.add_argument(
|
|
224
|
+
"--trace",
|
|
225
|
+
metavar="SERVICE",
|
|
226
|
+
help="Trace service resolution for specific service",
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def _add_agents_parser(subparsers):
|
|
231
|
+
"""Add agents debugging subcommand."""
|
|
232
|
+
agents_parser = subparsers.add_parser(
|
|
233
|
+
"agents",
|
|
234
|
+
help="Debug deployed agents and memory",
|
|
235
|
+
description="Inspect deployed agents, memory, and traces",
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
agents_group = agents_parser.add_mutually_exclusive_group()
|
|
239
|
+
agents_group.add_argument(
|
|
240
|
+
"--deployed", action="store_true", help="List all deployed agents"
|
|
241
|
+
)
|
|
242
|
+
agents_group.add_argument(
|
|
243
|
+
"--memory", action="store_true", help="Show agent memory status"
|
|
244
|
+
)
|
|
245
|
+
agents_group.add_argument(
|
|
246
|
+
"--trace", metavar="AGENT", help="Trace specific agent execution"
|
|
247
|
+
)
|
|
248
|
+
agents_parser.add_argument(
|
|
249
|
+
"--verbose", "-v", action="store_true", help="Show detailed information"
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def _add_hooks_parser(subparsers):
|
|
254
|
+
"""Add hooks debugging subcommand."""
|
|
255
|
+
hooks_parser = subparsers.add_parser(
|
|
256
|
+
"hooks",
|
|
257
|
+
help="Debug hook system",
|
|
258
|
+
description="List hooks, trace execution, analyze performance",
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
hooks_group = hooks_parser.add_mutually_exclusive_group()
|
|
262
|
+
hooks_group.add_argument(
|
|
263
|
+
"--list", action="store_true", help="List all registered hooks"
|
|
264
|
+
)
|
|
265
|
+
hooks_group.add_argument(
|
|
266
|
+
"--trace", metavar="HOOK", help="Trace specific hook execution"
|
|
267
|
+
)
|
|
268
|
+
hooks_group.add_argument(
|
|
269
|
+
"--performance", action="store_true", help="Analyze hook performance"
|
|
270
|
+
)
|
|
271
|
+
hooks_parser.add_argument(
|
|
272
|
+
"--test", action="store_true", help="Run test execution when tracing"
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def _add_cache_parser(subparsers):
|
|
277
|
+
"""Add cache debugging subcommand."""
|
|
278
|
+
cache_parser = subparsers.add_parser(
|
|
279
|
+
"cache",
|
|
280
|
+
help="Debug cache system",
|
|
281
|
+
description="Inspect, clear, and analyze cache",
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
cache_group = cache_parser.add_mutually_exclusive_group()
|
|
285
|
+
cache_group.add_argument(
|
|
286
|
+
"--inspect", action="store_true", help="Inspect cache contents"
|
|
287
|
+
)
|
|
288
|
+
cache_group.add_argument("--clear", action="store_true", help="Clear all cache")
|
|
289
|
+
cache_group.add_argument(
|
|
290
|
+
"--stats", action="store_true", help="Show cache performance statistics"
|
|
291
|
+
)
|
|
292
|
+
cache_parser.add_argument(
|
|
293
|
+
"--verbose", "-v", action="store_true", help="Show detailed cache information"
|
|
294
|
+
)
|
|
295
|
+
cache_parser.add_argument(
|
|
296
|
+
"--confirm",
|
|
297
|
+
"-y",
|
|
298
|
+
action="store_true",
|
|
299
|
+
help="Skip confirmation for clear operation",
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def _add_performance_parser(subparsers):
|
|
304
|
+
"""Add performance debugging subcommand."""
|
|
305
|
+
performance_parser = subparsers.add_parser(
|
|
306
|
+
"performance",
|
|
307
|
+
help="Performance profiling and analysis",
|
|
308
|
+
description="Profile operations and analyze bottlenecks",
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
perf_group = performance_parser.add_mutually_exclusive_group()
|
|
312
|
+
perf_group.add_argument(
|
|
313
|
+
"--profile",
|
|
314
|
+
metavar="OPERATION",
|
|
315
|
+
help="Profile specific operation (agent_load, service_init, cache_ops, memory_ops)",
|
|
316
|
+
)
|
|
317
|
+
perf_group.add_argument(
|
|
318
|
+
"--benchmark", action="store_true", help="Run performance benchmarks"
|
|
319
|
+
)
|