claude-mpm 4.1.11__py3-none-any.whl → 4.1.13__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 +8 -0
- claude_mpm/cli/__init__.py +1 -1
- claude_mpm/cli/commands/monitor.py +88 -627
- claude_mpm/cli/commands/mpm_init.py +127 -107
- claude_mpm/cli/commands/mpm_init_handler.py +24 -23
- claude_mpm/cli/parsers/mpm_init_parser.py +34 -28
- claude_mpm/core/config.py +18 -0
- claude_mpm/core/instruction_reinforcement_hook.py +266 -0
- claude_mpm/core/pm_hook_interceptor.py +105 -8
- claude_mpm/dashboard/static/built/components/activity-tree.js +1 -1
- claude_mpm/dashboard/static/built/components/code-tree.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 +1239 -267
- claude_mpm/dashboard/static/css/dashboard.css +511 -0
- claude_mpm/dashboard/static/dist/components/activity-tree.js +1 -1
- claude_mpm/dashboard/static/dist/components/code-tree.js +1 -1
- claude_mpm/dashboard/static/dist/components/module-viewer.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 +1193 -892
- claude_mpm/dashboard/static/js/components/build-tracker.js +15 -13
- claude_mpm/dashboard/static/js/components/code-tree.js +534 -143
- claude_mpm/dashboard/static/js/components/module-viewer.js +21 -7
- claude_mpm/dashboard/static/js/components/unified-data-viewer.js +1066 -0
- claude_mpm/dashboard/static/js/connection-manager.js +1 -1
- claude_mpm/dashboard/static/js/dashboard.js +227 -84
- claude_mpm/dashboard/static/js/socket-client.js +2 -2
- claude_mpm/dashboard/templates/index.html +100 -23
- claude_mpm/services/agents/deployment/agent_template_builder.py +11 -7
- claude_mpm/services/cli/socketio_manager.py +39 -8
- claude_mpm/services/infrastructure/monitoring.py +1 -1
- claude_mpm/services/socketio/handlers/code_analysis.py +83 -136
- claude_mpm/tools/code_tree_analyzer.py +290 -202
- {claude_mpm-4.1.11.dist-info → claude_mpm-4.1.13.dist-info}/METADATA +1 -1
- {claude_mpm-4.1.11.dist-info → claude_mpm-4.1.13.dist-info}/RECORD +41 -39
- {claude_mpm-4.1.11.dist-info → claude_mpm-4.1.13.dist-info}/WHEEL +0 -0
- {claude_mpm-4.1.11.dist-info → claude_mpm-4.1.13.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.1.11.dist-info → claude_mpm-4.1.13.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.1.11.dist-info → claude_mpm-4.1.13.dist-info}/top_level.txt +0 -0
|
@@ -5,7 +5,6 @@ This command delegates to the Agentic Coder Optimizer agent to establish clear,
|
|
|
5
5
|
single-path project standards for documentation, tooling, and workflows.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
import json
|
|
9
8
|
import logging
|
|
10
9
|
import subprocess
|
|
11
10
|
import sys
|
|
@@ -35,17 +34,17 @@ class MPMInitCommand:
|
|
|
35
34
|
framework: Optional[str] = None,
|
|
36
35
|
force: bool = False,
|
|
37
36
|
verbose: bool = False,
|
|
38
|
-
use_venv: bool = False
|
|
37
|
+
use_venv: bool = False,
|
|
39
38
|
) -> Dict:
|
|
40
39
|
"""
|
|
41
40
|
Initialize project with Agentic Coder Optimizer standards.
|
|
42
|
-
|
|
41
|
+
|
|
43
42
|
Args:
|
|
44
43
|
project_type: Type of project (web, api, cli, library, etc.)
|
|
45
44
|
framework: Specific framework if applicable
|
|
46
45
|
force: Force initialization even if project already configured
|
|
47
46
|
verbose: Show detailed output
|
|
48
|
-
|
|
47
|
+
|
|
49
48
|
Returns:
|
|
50
49
|
Dict containing initialization results
|
|
51
50
|
"""
|
|
@@ -53,29 +52,31 @@ class MPMInitCommand:
|
|
|
53
52
|
# Check if project already initialized
|
|
54
53
|
claude_md = self.project_path / "CLAUDE.md"
|
|
55
54
|
if claude_md.exists() and not force:
|
|
55
|
+
console.print("[yellow]⚠️ Project already has CLAUDE.md file.[/yellow]")
|
|
56
56
|
console.print(
|
|
57
|
-
"[yellow]
|
|
57
|
+
"[yellow]Use --force to reinitialize the project.[/yellow]"
|
|
58
58
|
)
|
|
59
|
-
console.print("[yellow]Use --force to reinitialize the project.[/yellow]")
|
|
60
59
|
return {"status": "cancelled", "message": "Initialization cancelled"}
|
|
61
60
|
|
|
62
61
|
# Build the delegation prompt
|
|
63
62
|
prompt = self._build_initialization_prompt(project_type, framework)
|
|
64
|
-
|
|
63
|
+
|
|
65
64
|
# Show initialization plan
|
|
66
|
-
console.print(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
65
|
+
console.print(
|
|
66
|
+
Panel(
|
|
67
|
+
"[bold cyan]🤖👥 Claude MPM Project Initialization[/bold cyan]\n\n"
|
|
68
|
+
"This will set up your project with:\n"
|
|
69
|
+
"• Clear CLAUDE.md documentation for AI agents\n"
|
|
70
|
+
"• Single-path workflows (ONE way to do ANYTHING)\n"
|
|
71
|
+
"• Optimized project structure\n"
|
|
72
|
+
"• Tool configurations (linting, formatting, testing)\n"
|
|
73
|
+
"• GitHub workflows and CI/CD setup\n"
|
|
74
|
+
"• Memory system initialization\n\n"
|
|
75
|
+
"[dim]Powered by Agentic Coder Optimizer Agent[/dim]",
|
|
76
|
+
title="MPM-Init",
|
|
77
|
+
border_style="cyan",
|
|
78
|
+
)
|
|
79
|
+
)
|
|
79
80
|
|
|
80
81
|
# Execute via claude-mpm run command
|
|
81
82
|
with Progress(
|
|
@@ -83,11 +84,13 @@ class MPMInitCommand:
|
|
|
83
84
|
TextColumn("[progress.description]{task.description}"),
|
|
84
85
|
console=console,
|
|
85
86
|
) as progress:
|
|
86
|
-
task = progress.add_task(
|
|
87
|
-
|
|
87
|
+
task = progress.add_task(
|
|
88
|
+
"[cyan]Delegating to Agentic Coder Optimizer...", total=None
|
|
89
|
+
)
|
|
90
|
+
|
|
88
91
|
# Run the initialization through subprocess
|
|
89
92
|
result = self._run_initialization(prompt, verbose, use_venv)
|
|
90
|
-
|
|
93
|
+
|
|
91
94
|
progress.update(task, description="[green]✓ Initialization complete")
|
|
92
95
|
|
|
93
96
|
return result
|
|
@@ -108,9 +111,7 @@ class MPMInitCommand:
|
|
|
108
111
|
return Path("claude-mpm")
|
|
109
112
|
|
|
110
113
|
def _build_initialization_prompt(
|
|
111
|
-
self,
|
|
112
|
-
project_type: Optional[str] = None,
|
|
113
|
-
framework: Optional[str] = None
|
|
114
|
+
self, project_type: Optional[str] = None, framework: Optional[str] = None
|
|
114
115
|
) -> str:
|
|
115
116
|
"""Build the initialization prompt for the agent."""
|
|
116
117
|
base_prompt = f"""Please delegate this task to the Agentic Coder Optimizer agent:
|
|
@@ -119,13 +120,13 @@ Initialize this project for optimal use with Claude Code and Claude MPM.
|
|
|
119
120
|
|
|
120
121
|
Project Path: {self.project_path}
|
|
121
122
|
"""
|
|
122
|
-
|
|
123
|
+
|
|
123
124
|
if project_type:
|
|
124
125
|
base_prompt += f"Project Type: {project_type}\n"
|
|
125
|
-
|
|
126
|
+
|
|
126
127
|
if framework:
|
|
127
128
|
base_prompt += f"Framework: {framework}\n"
|
|
128
|
-
|
|
129
|
+
|
|
129
130
|
base_prompt += """
|
|
130
131
|
Please perform the following initialization tasks:
|
|
131
132
|
|
|
@@ -176,95 +177,108 @@ Please perform the following initialization tasks:
|
|
|
176
177
|
Please ensure all documentation is clear, concise, and optimized for AI agents to understand and follow.
|
|
177
178
|
Focus on establishing ONE clear way to do ANYTHING in the project.
|
|
178
179
|
"""
|
|
179
|
-
|
|
180
|
+
|
|
180
181
|
return base_prompt
|
|
181
182
|
|
|
182
|
-
def _build_claude_mpm_command(
|
|
183
|
+
def _build_claude_mpm_command(
|
|
184
|
+
self, verbose: bool, use_venv: bool = False
|
|
185
|
+
) -> List[str]:
|
|
183
186
|
"""Build the claude-mpm run command with appropriate arguments."""
|
|
184
187
|
cmd = [str(self.claude_mpm_script)]
|
|
185
|
-
|
|
188
|
+
|
|
186
189
|
# Add venv flag if requested or if mamba issues detected
|
|
187
190
|
# This goes BEFORE the subcommand
|
|
188
191
|
if use_venv:
|
|
189
192
|
cmd.append("--use-venv")
|
|
190
|
-
|
|
193
|
+
|
|
191
194
|
# Add top-level flags that go before 'run' subcommand
|
|
192
195
|
cmd.append("--no-check-dependencies")
|
|
193
|
-
|
|
196
|
+
|
|
194
197
|
# Now add the run subcommand
|
|
195
198
|
cmd.append("run")
|
|
196
|
-
|
|
199
|
+
|
|
197
200
|
# Add non-interactive mode
|
|
198
201
|
# We'll pass the prompt via stdin instead of -i flag
|
|
199
202
|
cmd.append("--non-interactive")
|
|
200
|
-
|
|
203
|
+
|
|
201
204
|
# Add verbose flag if requested (run subcommand argument)
|
|
202
205
|
if verbose:
|
|
203
206
|
cmd.append("--verbose")
|
|
204
|
-
|
|
207
|
+
|
|
205
208
|
return cmd
|
|
206
209
|
|
|
207
|
-
def _run_initialization(
|
|
210
|
+
def _run_initialization(
|
|
211
|
+
self, prompt: str, verbose: bool, use_venv: bool = False
|
|
212
|
+
) -> Dict:
|
|
208
213
|
"""Run the initialization through subprocess calling claude-mpm."""
|
|
209
214
|
import tempfile
|
|
210
|
-
|
|
215
|
+
|
|
211
216
|
try:
|
|
212
217
|
# Write prompt to temporary file
|
|
213
|
-
with tempfile.NamedTemporaryFile(
|
|
218
|
+
with tempfile.NamedTemporaryFile(
|
|
219
|
+
mode="w", suffix=".txt", delete=False
|
|
220
|
+
) as tmp_file:
|
|
214
221
|
tmp_file.write(prompt)
|
|
215
222
|
prompt_file = tmp_file.name
|
|
216
|
-
|
|
223
|
+
|
|
217
224
|
try:
|
|
218
225
|
# Build the command
|
|
219
226
|
cmd = self._build_claude_mpm_command(verbose, use_venv)
|
|
220
227
|
# Add the input file flag
|
|
221
228
|
cmd.extend(["-i", prompt_file])
|
|
222
|
-
|
|
229
|
+
|
|
223
230
|
# Log the command if verbose
|
|
224
231
|
if verbose:
|
|
225
232
|
console.print(f"[dim]Running: {' '.join(cmd)}[/dim]")
|
|
226
233
|
console.print(f"[dim]Prompt file: {prompt_file}[/dim]")
|
|
227
|
-
|
|
234
|
+
|
|
228
235
|
# Execute the command
|
|
229
236
|
result = subprocess.run(
|
|
230
237
|
cmd,
|
|
231
238
|
capture_output=True,
|
|
232
239
|
text=True,
|
|
233
|
-
cwd=str(self.project_path)
|
|
240
|
+
cwd=str(self.project_path),
|
|
241
|
+
check=False,
|
|
234
242
|
)
|
|
235
|
-
|
|
243
|
+
|
|
236
244
|
# Check for environment-specific errors
|
|
237
245
|
if "libmamba" in result.stderr or "tree-sitter" in result.stderr:
|
|
238
|
-
console.print(
|
|
239
|
-
|
|
240
|
-
|
|
246
|
+
console.print(
|
|
247
|
+
"\n[yellow]⚠️ Environment dependency issue detected.[/yellow]"
|
|
248
|
+
)
|
|
249
|
+
console.print(
|
|
250
|
+
"[yellow]Attempting alternative initialization method...[/yellow]\n"
|
|
251
|
+
)
|
|
252
|
+
|
|
241
253
|
# Try again with venv flag to bypass mamba
|
|
242
254
|
cmd_venv = self._build_claude_mpm_command(verbose, use_venv=True)
|
|
243
255
|
cmd_venv.extend(["-i", prompt_file])
|
|
244
|
-
|
|
256
|
+
|
|
245
257
|
if verbose:
|
|
246
258
|
console.print(f"[dim]Retrying with: {' '.join(cmd_venv)}[/dim]")
|
|
247
|
-
|
|
259
|
+
|
|
248
260
|
result = subprocess.run(
|
|
249
261
|
cmd_venv,
|
|
250
262
|
capture_output=not verbose,
|
|
251
263
|
text=True,
|
|
252
|
-
cwd=str(self.project_path)
|
|
264
|
+
cwd=str(self.project_path),
|
|
265
|
+
check=False,
|
|
253
266
|
)
|
|
254
267
|
finally:
|
|
255
268
|
# Clean up temporary file
|
|
256
269
|
import os
|
|
270
|
+
|
|
257
271
|
try:
|
|
258
272
|
os.unlink(prompt_file)
|
|
259
273
|
except:
|
|
260
274
|
pass
|
|
261
|
-
|
|
275
|
+
|
|
262
276
|
# Display output if verbose
|
|
263
277
|
if verbose and result.stdout:
|
|
264
278
|
console.print(result.stdout)
|
|
265
279
|
if verbose and result.stderr:
|
|
266
280
|
console.print(f"[yellow]{result.stderr}[/yellow]")
|
|
267
|
-
|
|
281
|
+
|
|
268
282
|
# Check result - be more lenient with return codes
|
|
269
283
|
if result.returncode == 0 or (self.project_path / "CLAUDE.md").exists():
|
|
270
284
|
response = {
|
|
@@ -272,49 +286,56 @@ Focus on establishing ONE clear way to do ANYTHING in the project.
|
|
|
272
286
|
"message": "Project initialized successfully",
|
|
273
287
|
"files_created": [],
|
|
274
288
|
"files_updated": [],
|
|
275
|
-
"next_steps": []
|
|
289
|
+
"next_steps": [],
|
|
276
290
|
}
|
|
277
|
-
|
|
291
|
+
|
|
278
292
|
# Check if CLAUDE.md was created
|
|
279
293
|
claude_md = self.project_path / "CLAUDE.md"
|
|
280
294
|
if claude_md.exists():
|
|
281
295
|
response["files_created"].append("CLAUDE.md")
|
|
282
|
-
|
|
296
|
+
|
|
283
297
|
# Check for other common files
|
|
284
298
|
for file_name in ["CODE.md", "DEVELOPER.md", "STRUCTURE.md", "OPS.md"]:
|
|
285
299
|
file_path = self.project_path / file_name
|
|
286
300
|
if file_path.exists():
|
|
287
301
|
response["files_created"].append(file_name)
|
|
288
|
-
|
|
302
|
+
|
|
289
303
|
# Add next steps
|
|
290
304
|
response["next_steps"] = [
|
|
291
305
|
"Review the generated CLAUDE.md documentation",
|
|
292
306
|
"Verify the project structure meets your needs",
|
|
293
|
-
"Run 'claude-mpm run' to start using the optimized setup"
|
|
307
|
+
"Run 'claude-mpm run' to start using the optimized setup",
|
|
294
308
|
]
|
|
295
|
-
|
|
309
|
+
|
|
296
310
|
# Display results
|
|
297
311
|
self._display_results(response, verbose)
|
|
298
|
-
|
|
312
|
+
|
|
299
313
|
return response
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if "
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
# Extract meaningful error message
|
|
315
|
+
error_msg = (
|
|
316
|
+
result.stderr
|
|
317
|
+
if result.stderr
|
|
318
|
+
else result.stdout if result.stdout else "Unknown error occurred"
|
|
319
|
+
)
|
|
320
|
+
# Clean up mamba warnings from error message
|
|
321
|
+
if "libmamba" in error_msg:
|
|
322
|
+
lines = error_msg.split("\n")
|
|
323
|
+
error_lines = [
|
|
324
|
+
l for l in lines if not l.startswith("warning") and l.strip()
|
|
325
|
+
]
|
|
326
|
+
error_msg = "\n".join(error_lines) if error_lines else error_msg
|
|
327
|
+
|
|
328
|
+
logger.error(f"claude-mpm run failed: {error_msg}")
|
|
329
|
+
return {
|
|
330
|
+
"status": "error",
|
|
331
|
+
"message": f"Initialization failed: {error_msg}",
|
|
332
|
+
}
|
|
333
|
+
|
|
315
334
|
except FileNotFoundError:
|
|
316
335
|
logger.error("claude-mpm command not found")
|
|
317
|
-
console.print(
|
|
336
|
+
console.print(
|
|
337
|
+
"[red]Error: claude-mpm command not found. Ensure Claude MPM is properly installed.[/red]"
|
|
338
|
+
)
|
|
318
339
|
return {"status": "error", "message": "claude-mpm not found"}
|
|
319
340
|
except Exception as e:
|
|
320
341
|
logger.error(f"Initialization failed: {e}")
|
|
@@ -324,74 +345,76 @@ Focus on establishing ONE clear way to do ANYTHING in the project.
|
|
|
324
345
|
"""Display initialization results."""
|
|
325
346
|
if result["status"] == "success":
|
|
326
347
|
console.print("\n[green]✅ Project Initialization Complete![/green]\n")
|
|
327
|
-
|
|
348
|
+
|
|
328
349
|
if result.get("files_created"):
|
|
329
350
|
console.print("[bold]Files Created:[/bold]")
|
|
330
351
|
for file in result["files_created"]:
|
|
331
352
|
console.print(f" • {file}")
|
|
332
353
|
console.print()
|
|
333
|
-
|
|
354
|
+
|
|
334
355
|
if result.get("files_updated"):
|
|
335
356
|
console.print("[bold]Files Updated:[/bold]")
|
|
336
357
|
for file in result["files_updated"]:
|
|
337
358
|
console.print(f" • {file}")
|
|
338
359
|
console.print()
|
|
339
|
-
|
|
360
|
+
|
|
340
361
|
if result.get("next_steps"):
|
|
341
362
|
console.print("[bold]Next Steps:[/bold]")
|
|
342
363
|
for step in result["next_steps"]:
|
|
343
364
|
console.print(f" → {step}")
|
|
344
365
|
console.print()
|
|
345
|
-
|
|
346
|
-
console.print(
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
366
|
+
|
|
367
|
+
console.print(
|
|
368
|
+
Panel(
|
|
369
|
+
"[green]Your project is now optimized for Claude Code and Claude MPM![/green]\n\n"
|
|
370
|
+
"Key files:\n"
|
|
371
|
+
"• [cyan]CLAUDE.md[/cyan] - Main documentation for AI agents\n"
|
|
372
|
+
"• [cyan].claude-mpm/[/cyan] - Configuration and memories\n\n"
|
|
373
|
+
"[dim]Run 'claude-mpm run' to start using the optimized setup[/dim]",
|
|
374
|
+
title="Success",
|
|
375
|
+
border_style="green",
|
|
376
|
+
)
|
|
377
|
+
)
|
|
355
378
|
|
|
356
379
|
|
|
357
380
|
@click.command(name="mpm-init")
|
|
358
381
|
@click.option(
|
|
359
382
|
"--project-type",
|
|
360
|
-
type=click.Choice(
|
|
361
|
-
|
|
383
|
+
type=click.Choice(
|
|
384
|
+
["web", "api", "cli", "library", "mobile", "desktop", "fullstack"]
|
|
385
|
+
),
|
|
386
|
+
help="Type of project to initialize",
|
|
362
387
|
)
|
|
363
388
|
@click.option(
|
|
364
389
|
"--framework",
|
|
365
390
|
type=str,
|
|
366
|
-
help="Specific framework (e.g., react, django, fastapi, express)"
|
|
391
|
+
help="Specific framework (e.g., react, django, fastapi, express)",
|
|
367
392
|
)
|
|
368
393
|
@click.option(
|
|
369
394
|
"--force",
|
|
370
395
|
is_flag=True,
|
|
371
|
-
help="Force reinitialization even if project is already configured"
|
|
396
|
+
help="Force reinitialization even if project is already configured",
|
|
372
397
|
)
|
|
373
398
|
@click.option(
|
|
374
|
-
"--verbose",
|
|
375
|
-
is_flag=True,
|
|
376
|
-
help="Show detailed output during initialization"
|
|
399
|
+
"--verbose", is_flag=True, help="Show detailed output during initialization"
|
|
377
400
|
)
|
|
378
401
|
@click.argument(
|
|
379
402
|
"project_path",
|
|
380
403
|
type=click.Path(exists=True, file_okay=False, dir_okay=True),
|
|
381
404
|
required=False,
|
|
382
|
-
default="."
|
|
405
|
+
default=".",
|
|
383
406
|
)
|
|
384
407
|
def mpm_init(project_type, framework, force, verbose, project_path):
|
|
385
408
|
"""
|
|
386
409
|
Initialize a project for optimal use with Claude Code and Claude MPM.
|
|
387
|
-
|
|
410
|
+
|
|
388
411
|
This command uses the Agentic Coder Optimizer agent to:
|
|
389
412
|
- Create comprehensive CLAUDE.md documentation
|
|
390
413
|
- Establish single-path workflows (ONE way to do ANYTHING)
|
|
391
414
|
- Configure development tools and standards
|
|
392
415
|
- Set up memory systems for project knowledge
|
|
393
416
|
- Optimize for AI agent understanding
|
|
394
|
-
|
|
417
|
+
|
|
395
418
|
Examples:
|
|
396
419
|
claude-mpm mpm-init
|
|
397
420
|
claude-mpm mpm-init --project-type web --framework react
|
|
@@ -400,21 +423,18 @@ def mpm_init(project_type, framework, force, verbose, project_path):
|
|
|
400
423
|
try:
|
|
401
424
|
# Create command instance
|
|
402
425
|
command = MPMInitCommand(Path(project_path))
|
|
403
|
-
|
|
426
|
+
|
|
404
427
|
# Run initialization (now synchronous)
|
|
405
428
|
result = command.initialize_project(
|
|
406
|
-
project_type=project_type,
|
|
407
|
-
framework=framework,
|
|
408
|
-
force=force,
|
|
409
|
-
verbose=verbose
|
|
429
|
+
project_type=project_type, framework=framework, force=force, verbose=verbose
|
|
410
430
|
)
|
|
411
|
-
|
|
431
|
+
|
|
412
432
|
# Exit with appropriate code
|
|
413
433
|
if result["status"] == "success":
|
|
414
434
|
sys.exit(0)
|
|
415
435
|
else:
|
|
416
436
|
sys.exit(1)
|
|
417
|
-
|
|
437
|
+
|
|
418
438
|
except KeyboardInterrupt:
|
|
419
439
|
console.print("\n[yellow]Initialization cancelled by user[/yellow]")
|
|
420
440
|
sys.exit(130)
|
|
@@ -424,4 +444,4 @@ def mpm_init(project_type, framework, force, verbose, project_path):
|
|
|
424
444
|
|
|
425
445
|
|
|
426
446
|
# Export for CLI registration
|
|
427
|
-
__all__ = ["mpm_init"]
|
|
447
|
+
__all__ = ["mpm_init"]
|
|
@@ -4,7 +4,6 @@ MPM-Init command handler for claude-mpm CLI.
|
|
|
4
4
|
This module handles the execution of the mpm-init command.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
import sys
|
|
8
7
|
from pathlib import Path
|
|
9
8
|
|
|
10
9
|
from rich.console import Console
|
|
@@ -15,19 +14,19 @@ console = Console()
|
|
|
15
14
|
def manage_mpm_init(args):
|
|
16
15
|
"""
|
|
17
16
|
Handle mpm-init command execution.
|
|
18
|
-
|
|
17
|
+
|
|
19
18
|
Args:
|
|
20
19
|
args: Parsed command line arguments
|
|
21
|
-
|
|
20
|
+
|
|
22
21
|
Returns:
|
|
23
22
|
Exit code (0 for success, non-zero for errors)
|
|
24
23
|
"""
|
|
25
24
|
try:
|
|
26
25
|
# Import the command implementation
|
|
27
26
|
from .mpm_init import MPMInitCommand
|
|
28
|
-
|
|
27
|
+
|
|
29
28
|
# Handle special flags
|
|
30
|
-
if getattr(args,
|
|
29
|
+
if getattr(args, "list_templates", False):
|
|
31
30
|
# List available templates
|
|
32
31
|
console.print("\n[bold cyan]Available Project Templates:[/bold cyan]")
|
|
33
32
|
console.print(" • web-react: React web application")
|
|
@@ -41,33 +40,34 @@ def manage_mpm_init(args):
|
|
|
41
40
|
console.print(" • data-pipeline: Data pipeline with ETL")
|
|
42
41
|
console.print()
|
|
43
42
|
return 0
|
|
44
|
-
|
|
43
|
+
|
|
45
44
|
# Get project path
|
|
46
|
-
project_path =
|
|
47
|
-
|
|
45
|
+
project_path = (
|
|
46
|
+
Path(args.project_path) if hasattr(args, "project_path") else Path.cwd()
|
|
47
|
+
)
|
|
48
|
+
|
|
48
49
|
# Create command instance
|
|
49
50
|
command = MPMInitCommand(project_path)
|
|
50
|
-
|
|
51
|
+
|
|
51
52
|
# Prepare initialization parameters
|
|
52
53
|
init_params = {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
"project_type": getattr(args, "project_type", None),
|
|
55
|
+
"framework": getattr(args, "framework", None),
|
|
56
|
+
"force": getattr(args, "force", False),
|
|
57
|
+
"verbose": getattr(args, "verbose", False),
|
|
58
|
+
"use_venv": getattr(args, "use_venv", False),
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
|
|
60
61
|
# Execute initialization (now synchronous)
|
|
61
62
|
result = command.initialize_project(**init_params)
|
|
62
|
-
|
|
63
|
+
|
|
63
64
|
# Return appropriate exit code
|
|
64
|
-
if result.get(
|
|
65
|
+
if result.get("status") == "success":
|
|
65
66
|
return 0
|
|
66
|
-
|
|
67
|
+
if result.get("status") == "cancelled":
|
|
67
68
|
return 130 # User cancelled
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
return 1 # Error
|
|
70
|
+
|
|
71
71
|
except ImportError as e:
|
|
72
72
|
console.print(f"[red]Error: Required module not available: {e}[/red]")
|
|
73
73
|
console.print("[yellow]Ensure claude-mpm is properly installed[/yellow]")
|
|
@@ -78,6 +78,7 @@ def manage_mpm_init(args):
|
|
|
78
78
|
except Exception as e:
|
|
79
79
|
console.print(f"[red]Error executing mpm-init: {e}[/red]")
|
|
80
80
|
import traceback
|
|
81
|
-
|
|
81
|
+
|
|
82
|
+
if getattr(args, "verbose", False):
|
|
82
83
|
traceback.print_exc()
|
|
83
|
-
return 1
|
|
84
|
+
return 1
|