claude-mpm 4.1.7__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/OUTPUT_STYLE.md +73 -0
- 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/agent-manager.md +248 -10
- 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 +223 -25
- claude_mpm/cli/commands/configure_tui.py +65 -61
- 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/configure_parser.py +23 -0
- claude_mpm/cli/parsers/debug_parser.py +319 -0
- claude_mpm/config/socketio_config.py +21 -21
- 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 +728 -0
- claude_mpm/scripts/claude-hook-handler.sh +161 -0
- claude_mpm/scripts/socketio_daemon.py +121 -8
- claude_mpm/services/agents/deployment/agent_config_provider.py +127 -27
- 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 +2 -5
- claude_mpm/services/event_bus/direct_relay.py +98 -20
- 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 +95 -65
- claude_mpm/services/socketio/server/core.py +125 -17
- claude_mpm/services/socketio/server/main.py +44 -5
- 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.7.dist-info → claude_mpm-4.1.10.dist-info}/METADATA +1 -1
- {claude_mpm-4.1.7.dist-info → claude_mpm-4.1.10.dist-info}/RECORD +108 -77
- claude_mpm/agents/schema/agent_schema.json +0 -314
- {claude_mpm-4.1.7.dist-info → claude_mpm-4.1.10.dist-info}/WHEEL +0 -0
- {claude_mpm-4.1.7.dist-info → claude_mpm-4.1.10.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.1.7.dist-info → claude_mpm-4.1.10.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.1.7.dist-info → claude_mpm-4.1.10.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Code Tree Analyzer CLI Module
|
|
4
|
+
==============================
|
|
5
|
+
|
|
6
|
+
WHY: Provides command-line interface for the code tree analyzer,
|
|
7
|
+
allowing it to be run as a subprocess from the dashboard.
|
|
8
|
+
|
|
9
|
+
DESIGN DECISIONS:
|
|
10
|
+
- Support JSON streaming output for real-time event processing
|
|
11
|
+
- Provide both file output and stdout streaming modes
|
|
12
|
+
- Include comprehensive error handling and logging
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import argparse
|
|
16
|
+
import json
|
|
17
|
+
import sys
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
from .code_tree_analyzer import CodeTreeAnalyzer
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def parse_arguments():
|
|
24
|
+
"""Parse command-line arguments."""
|
|
25
|
+
parser = argparse.ArgumentParser(
|
|
26
|
+
description="Analyze code structure and emit events"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
parser.add_argument(
|
|
30
|
+
"--path", type=str, required=True, help="Directory path to analyze"
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
parser.add_argument(
|
|
34
|
+
"--languages",
|
|
35
|
+
type=str,
|
|
36
|
+
help="Comma-separated list of languages to include (e.g., python,javascript)",
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
parser.add_argument(
|
|
40
|
+
"--max-depth", type=int, help="Maximum directory depth to traverse"
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
parser.add_argument(
|
|
44
|
+
"--ignore",
|
|
45
|
+
action="append",
|
|
46
|
+
help="Patterns to ignore (can be specified multiple times)",
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
parser.add_argument(
|
|
50
|
+
"--emit-events", action="store_true", help="Enable Socket.IO event emission"
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
parser.add_argument(
|
|
54
|
+
"--output-format",
|
|
55
|
+
choices=["json", "json-stream", "summary"],
|
|
56
|
+
default="summary",
|
|
57
|
+
help="Output format (default: summary)",
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
parser.add_argument(
|
|
61
|
+
"--output-file", type=str, help="Output file path (stdout if not specified)"
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
parser.add_argument(
|
|
65
|
+
"--cache-dir", type=str, help="Directory for caching analysis results"
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
return parser.parse_args()
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def emit_json_event(event_type: str, data: dict, file=None):
|
|
72
|
+
"""Emit a JSON event to stdout or file.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
event_type: Type of event
|
|
76
|
+
data: Event data
|
|
77
|
+
file: Output file handle (stdout if None)
|
|
78
|
+
"""
|
|
79
|
+
event = {"type": event_type, "data": data}
|
|
80
|
+
|
|
81
|
+
output = json.dumps(event)
|
|
82
|
+
if file:
|
|
83
|
+
file.write(output + "\n")
|
|
84
|
+
file.flush()
|
|
85
|
+
else:
|
|
86
|
+
print(output, flush=True)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def main():
|
|
90
|
+
"""Main entry point for the analyzer CLI."""
|
|
91
|
+
args = parse_arguments()
|
|
92
|
+
|
|
93
|
+
# Parse path
|
|
94
|
+
path = Path(args.path).resolve()
|
|
95
|
+
if not path.exists():
|
|
96
|
+
emit_json_event(
|
|
97
|
+
"code:analysis:error", {"message": f"Path does not exist: {args.path}"}
|
|
98
|
+
)
|
|
99
|
+
sys.exit(1)
|
|
100
|
+
|
|
101
|
+
if not path.is_dir():
|
|
102
|
+
emit_json_event(
|
|
103
|
+
"code:analysis:error", {"message": f"Path is not a directory: {args.path}"}
|
|
104
|
+
)
|
|
105
|
+
sys.exit(1)
|
|
106
|
+
|
|
107
|
+
# Parse languages
|
|
108
|
+
languages = None
|
|
109
|
+
if args.languages:
|
|
110
|
+
languages = [lang.strip() for lang in args.languages.split(",")]
|
|
111
|
+
|
|
112
|
+
# Parse cache directory
|
|
113
|
+
cache_dir = None
|
|
114
|
+
if args.cache_dir:
|
|
115
|
+
cache_dir = Path(args.cache_dir)
|
|
116
|
+
|
|
117
|
+
# Open output file if specified
|
|
118
|
+
output_file = None
|
|
119
|
+
if args.output_file:
|
|
120
|
+
try:
|
|
121
|
+
output_file = open(args.output_file, "w")
|
|
122
|
+
except Exception as e:
|
|
123
|
+
emit_json_event(
|
|
124
|
+
"code:analysis:error", {"message": f"Failed to open output file: {e}"}
|
|
125
|
+
)
|
|
126
|
+
sys.exit(1)
|
|
127
|
+
|
|
128
|
+
try:
|
|
129
|
+
# Create analyzer
|
|
130
|
+
analyzer = CodeTreeAnalyzer(emit_events=args.emit_events, cache_dir=cache_dir)
|
|
131
|
+
|
|
132
|
+
# Emit start event for JSON stream format
|
|
133
|
+
if args.output_format == "json-stream":
|
|
134
|
+
emit_json_event(
|
|
135
|
+
"code:analysis:start",
|
|
136
|
+
{
|
|
137
|
+
"path": str(path),
|
|
138
|
+
"languages": languages,
|
|
139
|
+
"max_depth": args.max_depth,
|
|
140
|
+
},
|
|
141
|
+
output_file,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
# Run analysis
|
|
145
|
+
result = analyzer.analyze_directory(
|
|
146
|
+
directory=path,
|
|
147
|
+
languages=languages,
|
|
148
|
+
ignore_patterns=args.ignore,
|
|
149
|
+
max_depth=args.max_depth,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
# Output results based on format
|
|
153
|
+
if args.output_format == "json":
|
|
154
|
+
# Full JSON output
|
|
155
|
+
output = json.dumps(result, indent=2, default=str)
|
|
156
|
+
if output_file:
|
|
157
|
+
output_file.write(output)
|
|
158
|
+
else:
|
|
159
|
+
print(output)
|
|
160
|
+
|
|
161
|
+
elif args.output_format == "json-stream":
|
|
162
|
+
# Streaming JSON events (already emitted during analysis)
|
|
163
|
+
emit_json_event(
|
|
164
|
+
"code:analysis:complete",
|
|
165
|
+
{"path": str(path), "stats": result.get("stats", {})},
|
|
166
|
+
output_file,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
else: # summary
|
|
170
|
+
# Human-readable summary
|
|
171
|
+
stats = result.get("stats", {})
|
|
172
|
+
summary = f"""
|
|
173
|
+
Code Analysis Summary
|
|
174
|
+
=====================
|
|
175
|
+
Path: {path}
|
|
176
|
+
Files processed: {stats.get('files_processed', 0)}
|
|
177
|
+
Total nodes: {stats.get('total_nodes', 0)}
|
|
178
|
+
Classes: {stats.get('classes', 0)}
|
|
179
|
+
Functions: {stats.get('functions', 0)}
|
|
180
|
+
Imports: {stats.get('imports', 0)}
|
|
181
|
+
Languages: {', '.join(stats.get('languages', []))}
|
|
182
|
+
Average complexity: {stats.get('avg_complexity', 0):.2f}
|
|
183
|
+
Duration: {stats.get('duration', 0):.2f}s
|
|
184
|
+
"""
|
|
185
|
+
if output_file:
|
|
186
|
+
output_file.write(summary)
|
|
187
|
+
else:
|
|
188
|
+
print(summary)
|
|
189
|
+
|
|
190
|
+
except KeyboardInterrupt:
|
|
191
|
+
emit_json_event(
|
|
192
|
+
"code:analysis:cancelled",
|
|
193
|
+
{"message": "Analysis cancelled by user"},
|
|
194
|
+
output_file,
|
|
195
|
+
)
|
|
196
|
+
sys.exit(130)
|
|
197
|
+
|
|
198
|
+
except Exception as e:
|
|
199
|
+
emit_json_event("code:analysis:error", {"message": str(e)}, output_file)
|
|
200
|
+
sys.exit(1)
|
|
201
|
+
|
|
202
|
+
finally:
|
|
203
|
+
if output_file:
|
|
204
|
+
output_file.close()
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
if __name__ == "__main__":
|
|
208
|
+
main()
|