claude-mpm 4.1.8__py3-none-any.whl → 4.1.10__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 +4 -0
- claude_mpm/cli/commands/__init__.py +6 -0
- claude_mpm/cli/commands/analyze.py +547 -0
- claude_mpm/cli/commands/analyze_code.py +524 -0
- claude_mpm/cli/commands/configure.py +77 -28
- claude_mpm/cli/commands/configure_tui.py +60 -60
- claude_mpm/cli/commands/debug.py +1387 -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 +29 -0
- claude_mpm/cli/parsers/debug_parser.py +319 -0
- claude_mpm/constants.py +3 -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 +428 -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/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 +846 -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 +1139 -0
- claude_mpm/dashboard/static/js/components/code-tree.js +1357 -0
- claude_mpm/dashboard/static/js/components/code-viewer.js +480 -0
- claude_mpm/dashboard/static/js/components/event-viewer.js +11 -0
- 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 +39 -0
- claude_mpm/dashboard/static/js/socket-client.js +414 -20
- claude_mpm/dashboard/templates/index.html +184 -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 -5
- claude_mpm/services/cli/agent_cleanup_service.py +1 -2
- 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 -10
- claude_mpm/services/core/cache_manager.py +1 -2
- 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/handlers/__init__.py +2 -0
- claude_mpm/services/socketio/handlers/code_analysis.py +170 -0
- claude_mpm/services/socketio/handlers/registry.py +2 -0
- claude_mpm/services/socketio/server/connection_manager.py +4 -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 +778 -0
- claude_mpm/tools/code_tree_builder.py +632 -0
- claude_mpm/tools/code_tree_events.py +318 -0
- claude_mpm/tools/socketio_debug.py +671 -0
- {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.10.dist-info}/METADATA +1 -1
- {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.10.dist-info}/RECORD +102 -73
- claude_mpm/agents/schema/agent_schema.json +0 -314
- {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.10.dist-info}/WHEEL +0 -0
- {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.10.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.10.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.1.8.dist-info → claude_mpm-4.1.10.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Analyze Code Parser
|
|
4
|
+
===================
|
|
5
|
+
|
|
6
|
+
WHY: Provides argument parsing for the analyze-code command,
|
|
7
|
+
defining available options and their validation.
|
|
8
|
+
|
|
9
|
+
DESIGN DECISIONS:
|
|
10
|
+
- Support multiple output formats for flexibility
|
|
11
|
+
- Enable Socket.IO event emission for dashboard integration
|
|
12
|
+
- Allow language and pattern filtering
|
|
13
|
+
- Include caching control options
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
import argparse
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
from typing import Optional
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class AnalyzeCodeParser:
|
|
22
|
+
"""Parser for analyze-code command arguments.
|
|
23
|
+
|
|
24
|
+
WHY: Centralizes argument definition and validation for the
|
|
25
|
+
code analysis command, ensuring consistent interface.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
def __init__(self):
|
|
29
|
+
self.command_name = "analyze-code"
|
|
30
|
+
self.help_text = "Analyze code structure and generate AST tree with metrics"
|
|
31
|
+
|
|
32
|
+
def add_arguments(self, parser: argparse.ArgumentParser) -> None:
|
|
33
|
+
"""Add analyze-code specific arguments.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
parser: Argument parser to configure
|
|
37
|
+
"""
|
|
38
|
+
# Required arguments
|
|
39
|
+
parser.add_argument(
|
|
40
|
+
"path",
|
|
41
|
+
type=str,
|
|
42
|
+
default=".",
|
|
43
|
+
nargs="?",
|
|
44
|
+
help="Path to analyze (default: current directory)",
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
# Output options
|
|
48
|
+
output_group = parser.add_argument_group("output options")
|
|
49
|
+
output_group.add_argument(
|
|
50
|
+
"-o",
|
|
51
|
+
"--output",
|
|
52
|
+
choices=["json", "tree", "stats"],
|
|
53
|
+
help="Output format (default: summary)",
|
|
54
|
+
)
|
|
55
|
+
output_group.add_argument(
|
|
56
|
+
"--save", type=str, metavar="PATH", help="Save analysis results to file"
|
|
57
|
+
)
|
|
58
|
+
output_group.add_argument(
|
|
59
|
+
"--emit-events",
|
|
60
|
+
action="store_true",
|
|
61
|
+
help="Emit real-time events to dashboard via Socket.IO",
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# Filter options
|
|
65
|
+
filter_group = parser.add_argument_group("filter options")
|
|
66
|
+
filter_group.add_argument(
|
|
67
|
+
"-l",
|
|
68
|
+
"--languages",
|
|
69
|
+
type=str,
|
|
70
|
+
metavar="LANGS",
|
|
71
|
+
help="Comma-separated list of languages to analyze (e.g., python,javascript)",
|
|
72
|
+
)
|
|
73
|
+
filter_group.add_argument(
|
|
74
|
+
"-i",
|
|
75
|
+
"--ignore",
|
|
76
|
+
type=str,
|
|
77
|
+
metavar="PATTERNS",
|
|
78
|
+
help="Comma-separated list of patterns to ignore",
|
|
79
|
+
)
|
|
80
|
+
filter_group.add_argument(
|
|
81
|
+
"--max-depth",
|
|
82
|
+
type=int,
|
|
83
|
+
metavar="N",
|
|
84
|
+
help="Maximum directory depth to traverse",
|
|
85
|
+
)
|
|
86
|
+
filter_group.add_argument(
|
|
87
|
+
"--no-tree", action="store_true", help="Skip file tree building phase"
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# Performance options
|
|
91
|
+
perf_group = parser.add_argument_group("performance options")
|
|
92
|
+
perf_group.add_argument(
|
|
93
|
+
"--no-cache",
|
|
94
|
+
action="store_true",
|
|
95
|
+
help="Disable caching of analysis results",
|
|
96
|
+
)
|
|
97
|
+
perf_group.add_argument(
|
|
98
|
+
"--parallel",
|
|
99
|
+
action="store_true",
|
|
100
|
+
help="Use parallel processing for large codebases",
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
# Metric options
|
|
104
|
+
metric_group = parser.add_argument_group("metric options")
|
|
105
|
+
metric_group.add_argument(
|
|
106
|
+
"--complexity-threshold",
|
|
107
|
+
type=int,
|
|
108
|
+
default=10,
|
|
109
|
+
metavar="N",
|
|
110
|
+
help="Complexity threshold for warnings (default: 10)",
|
|
111
|
+
)
|
|
112
|
+
metric_group.add_argument(
|
|
113
|
+
"--include-metrics",
|
|
114
|
+
action="store_true",
|
|
115
|
+
help="Include detailed metrics in output",
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
# Note: --verbose and --debug are already defined in base_parser
|
|
119
|
+
# so we don't add them here to avoid conflicts
|
|
120
|
+
|
|
121
|
+
def validate_args(self, args: argparse.Namespace) -> Optional[str]:
|
|
122
|
+
"""Validate parsed arguments.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
args: Parsed arguments
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
Error message if validation fails, None otherwise
|
|
129
|
+
"""
|
|
130
|
+
# Validate path
|
|
131
|
+
path = Path(args.path)
|
|
132
|
+
if not path.exists():
|
|
133
|
+
return f"Path does not exist: {path}"
|
|
134
|
+
|
|
135
|
+
if not path.is_dir():
|
|
136
|
+
return f"Path is not a directory: {path}"
|
|
137
|
+
|
|
138
|
+
# Validate save path if provided
|
|
139
|
+
if args.save:
|
|
140
|
+
save_path = Path(args.save)
|
|
141
|
+
save_dir = save_path.parent
|
|
142
|
+
if not save_dir.exists():
|
|
143
|
+
return f"Save directory does not exist: {save_dir}"
|
|
144
|
+
|
|
145
|
+
# Validate max depth
|
|
146
|
+
if args.max_depth is not None and args.max_depth < 0:
|
|
147
|
+
return "Max depth must be non-negative"
|
|
148
|
+
|
|
149
|
+
# Validate complexity threshold
|
|
150
|
+
if args.complexity_threshold < 1:
|
|
151
|
+
return "Complexity threshold must be at least 1"
|
|
152
|
+
|
|
153
|
+
return None
|
|
154
|
+
|
|
155
|
+
def get_examples(self) -> list:
|
|
156
|
+
"""Get usage examples.
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
List of example command strings
|
|
160
|
+
"""
|
|
161
|
+
return [
|
|
162
|
+
"claude-mpm analyze-code",
|
|
163
|
+
"claude-mpm analyze-code /path/to/project",
|
|
164
|
+
"claude-mpm analyze-code -l python,javascript",
|
|
165
|
+
"claude-mpm analyze-code --output json --save analysis.json",
|
|
166
|
+
"claude-mpm analyze-code --emit-events",
|
|
167
|
+
"claude-mpm analyze-code --ignore test,vendor --max-depth 3",
|
|
168
|
+
"claude-mpm analyze-code -o tree",
|
|
169
|
+
"claude-mpm analyze-code -o stats --include-metrics",
|
|
170
|
+
]
|
|
@@ -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)
|
|
@@ -338,6 +338,35 @@ def create_parser(
|
|
|
338
338
|
except ImportError:
|
|
339
339
|
pass
|
|
340
340
|
|
|
341
|
+
# Add debug command parser
|
|
342
|
+
try:
|
|
343
|
+
from .debug_parser import add_debug_subparser
|
|
344
|
+
|
|
345
|
+
add_debug_subparser(subparsers)
|
|
346
|
+
except ImportError:
|
|
347
|
+
pass
|
|
348
|
+
|
|
349
|
+
# Add analyze command parser
|
|
350
|
+
try:
|
|
351
|
+
from .analyze_parser import add_analyze_subparser
|
|
352
|
+
|
|
353
|
+
add_analyze_subparser(subparsers)
|
|
354
|
+
except ImportError:
|
|
355
|
+
pass
|
|
356
|
+
|
|
357
|
+
# Add analyze-code command parser
|
|
358
|
+
try:
|
|
359
|
+
from .analyze_code_parser import AnalyzeCodeParser
|
|
360
|
+
|
|
361
|
+
parser_obj = AnalyzeCodeParser()
|
|
362
|
+
analyze_code_parser = subparsers.add_parser(
|
|
363
|
+
"analyze-code", help=parser_obj.help_text
|
|
364
|
+
)
|
|
365
|
+
parser_obj.add_arguments(analyze_code_parser)
|
|
366
|
+
analyze_code_parser.set_defaults(command="analyze-code")
|
|
367
|
+
except ImportError:
|
|
368
|
+
pass
|
|
369
|
+
|
|
341
370
|
# Import and add additional command parsers from commands module
|
|
342
371
|
try:
|
|
343
372
|
from ..commands.aggregate import add_aggregate_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
|
+
)
|
claude_mpm/constants.py
CHANGED
|
@@ -38,6 +38,8 @@ class CLICommands(str, Enum):
|
|
|
38
38
|
CONFIG = "config"
|
|
39
39
|
CONFIGURE = "configure"
|
|
40
40
|
AGGREGATE = "aggregate"
|
|
41
|
+
ANALYZE = "analyze"
|
|
42
|
+
ANALYZE_CODE = "analyze-code"
|
|
41
43
|
CLEANUP = "cleanup-memory"
|
|
42
44
|
MCP = "mcp"
|
|
43
45
|
DOCTOR = "doctor"
|
|
@@ -217,7 +219,7 @@ class Paths(str, Enum):
|
|
|
217
219
|
|
|
218
220
|
CLAUDE_AGENTS_DIR = ".claude/agents"
|
|
219
221
|
CLAUDE_CONFIG_DIR = ".claude"
|
|
220
|
-
MPM_LOG_DIR = "
|
|
222
|
+
MPM_LOG_DIR = "logs/mpm"
|
|
221
223
|
MPM_SESSION_DIR = ".claude-mpm/session"
|
|
222
224
|
MPM_PROMPTS_DIR = ".claude-mpm/prompts"
|
|
223
225
|
|