claude-mpm 4.1.11__py3-none-any.whl → 4.1.12__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/mpm_init.py +125 -110
- 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/dist/components/code-tree.js +2593 -2
- claude_mpm/dashboard/static/js/components/build-tracker.js +15 -13
- claude_mpm/dashboard/static/js/components/code-tree.js +551 -143
- claude_mpm/dashboard/static/js/dashboard.js +31 -41
- claude_mpm/dashboard/templates/index.html +19 -12
- 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.12.dist-info}/METADATA +1 -1
- {claude_mpm-4.1.11.dist-info → claude_mpm-4.1.12.dist-info}/RECORD +25 -24
- {claude_mpm-4.1.11.dist-info → claude_mpm-4.1.12.dist-info}/WHEEL +0 -0
- {claude_mpm-4.1.11.dist-info → claude_mpm-4.1.12.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.1.11.dist-info → claude_mpm-4.1.12.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.1.11.dist-info → claude_mpm-4.1.12.dist-info}/top_level.txt +0 -0
claude_mpm/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.1.
|
|
1
|
+
4.1.12
|
|
@@ -15,6 +15,14 @@ You are a PROJECT MANAGER whose SOLE PURPOSE is to delegate work to specialized
|
|
|
15
15
|
- "no delegation"
|
|
16
16
|
- "PM do it"
|
|
17
17
|
- "handle it yourself"
|
|
18
|
+
- "handle this directly"
|
|
19
|
+
- "you implement this"
|
|
20
|
+
- "skip delegation"
|
|
21
|
+
- "do the work yourself"
|
|
22
|
+
- "directly implement"
|
|
23
|
+
- "bypass delegation"
|
|
24
|
+
- "manual implementation"
|
|
25
|
+
- "direct action required"
|
|
18
26
|
|
|
19
27
|
**🔴 THIS IS NOT A SUGGESTION - IT IS AN ABSOLUTE REQUIREMENT. NO EXCEPTIONS.**
|
|
20
28
|
|
claude_mpm/cli/__init__.py
CHANGED
|
@@ -390,7 +390,7 @@ def _execute_command(command: str, args) -> int:
|
|
|
390
390
|
|
|
391
391
|
result = execute_run_guarded(args)
|
|
392
392
|
return result if result is not None else 0
|
|
393
|
-
|
|
393
|
+
|
|
394
394
|
# Handle mpm-init command with lazy import
|
|
395
395
|
if command == "mpm-init":
|
|
396
396
|
# Lazy import to avoid loading unless needed
|
|
@@ -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,103 @@ 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
|
-
cmd,
|
|
231
|
-
capture_output=True,
|
|
232
|
-
text=True,
|
|
233
|
-
cwd=str(self.project_path)
|
|
237
|
+
cmd, capture_output=True, text=True, cwd=str(self.project_path), check=False
|
|
234
238
|
)
|
|
235
|
-
|
|
239
|
+
|
|
236
240
|
# Check for environment-specific errors
|
|
237
241
|
if "libmamba" in result.stderr or "tree-sitter" in result.stderr:
|
|
238
|
-
console.print(
|
|
239
|
-
|
|
240
|
-
|
|
242
|
+
console.print(
|
|
243
|
+
"\n[yellow]⚠️ Environment dependency issue detected.[/yellow]"
|
|
244
|
+
)
|
|
245
|
+
console.print(
|
|
246
|
+
"[yellow]Attempting alternative initialization method...[/yellow]\n"
|
|
247
|
+
)
|
|
248
|
+
|
|
241
249
|
# Try again with venv flag to bypass mamba
|
|
242
250
|
cmd_venv = self._build_claude_mpm_command(verbose, use_venv=True)
|
|
243
251
|
cmd_venv.extend(["-i", prompt_file])
|
|
244
|
-
|
|
252
|
+
|
|
245
253
|
if verbose:
|
|
246
254
|
console.print(f"[dim]Retrying with: {' '.join(cmd_venv)}[/dim]")
|
|
247
|
-
|
|
255
|
+
|
|
248
256
|
result = subprocess.run(
|
|
249
257
|
cmd_venv,
|
|
250
258
|
capture_output=not verbose,
|
|
251
259
|
text=True,
|
|
252
|
-
cwd=str(self.project_path)
|
|
260
|
+
cwd=str(self.project_path), check=False,
|
|
253
261
|
)
|
|
254
262
|
finally:
|
|
255
263
|
# Clean up temporary file
|
|
256
264
|
import os
|
|
265
|
+
|
|
257
266
|
try:
|
|
258
267
|
os.unlink(prompt_file)
|
|
259
268
|
except:
|
|
260
269
|
pass
|
|
261
|
-
|
|
270
|
+
|
|
262
271
|
# Display output if verbose
|
|
263
272
|
if verbose and result.stdout:
|
|
264
273
|
console.print(result.stdout)
|
|
265
274
|
if verbose and result.stderr:
|
|
266
275
|
console.print(f"[yellow]{result.stderr}[/yellow]")
|
|
267
|
-
|
|
276
|
+
|
|
268
277
|
# Check result - be more lenient with return codes
|
|
269
278
|
if result.returncode == 0 or (self.project_path / "CLAUDE.md").exists():
|
|
270
279
|
response = {
|
|
@@ -272,49 +281,56 @@ Focus on establishing ONE clear way to do ANYTHING in the project.
|
|
|
272
281
|
"message": "Project initialized successfully",
|
|
273
282
|
"files_created": [],
|
|
274
283
|
"files_updated": [],
|
|
275
|
-
"next_steps": []
|
|
284
|
+
"next_steps": [],
|
|
276
285
|
}
|
|
277
|
-
|
|
286
|
+
|
|
278
287
|
# Check if CLAUDE.md was created
|
|
279
288
|
claude_md = self.project_path / "CLAUDE.md"
|
|
280
289
|
if claude_md.exists():
|
|
281
290
|
response["files_created"].append("CLAUDE.md")
|
|
282
|
-
|
|
291
|
+
|
|
283
292
|
# Check for other common files
|
|
284
293
|
for file_name in ["CODE.md", "DEVELOPER.md", "STRUCTURE.md", "OPS.md"]:
|
|
285
294
|
file_path = self.project_path / file_name
|
|
286
295
|
if file_path.exists():
|
|
287
296
|
response["files_created"].append(file_name)
|
|
288
|
-
|
|
297
|
+
|
|
289
298
|
# Add next steps
|
|
290
299
|
response["next_steps"] = [
|
|
291
300
|
"Review the generated CLAUDE.md documentation",
|
|
292
301
|
"Verify the project structure meets your needs",
|
|
293
|
-
"Run 'claude-mpm run' to start using the optimized setup"
|
|
302
|
+
"Run 'claude-mpm run' to start using the optimized setup",
|
|
294
303
|
]
|
|
295
|
-
|
|
304
|
+
|
|
296
305
|
# Display results
|
|
297
306
|
self._display_results(response, verbose)
|
|
298
|
-
|
|
307
|
+
|
|
299
308
|
return response
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if "
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
309
|
+
# Extract meaningful error message
|
|
310
|
+
error_msg = (
|
|
311
|
+
result.stderr
|
|
312
|
+
if result.stderr
|
|
313
|
+
else result.stdout if result.stdout else "Unknown error occurred"
|
|
314
|
+
)
|
|
315
|
+
# Clean up mamba warnings from error message
|
|
316
|
+
if "libmamba" in error_msg:
|
|
317
|
+
lines = error_msg.split("\n")
|
|
318
|
+
error_lines = [
|
|
319
|
+
l for l in lines if not l.startswith("warning") and l.strip()
|
|
320
|
+
]
|
|
321
|
+
error_msg = "\n".join(error_lines) if error_lines else error_msg
|
|
322
|
+
|
|
323
|
+
logger.error(f"claude-mpm run failed: {error_msg}")
|
|
324
|
+
return {
|
|
325
|
+
"status": "error",
|
|
326
|
+
"message": f"Initialization failed: {error_msg}",
|
|
327
|
+
}
|
|
328
|
+
|
|
315
329
|
except FileNotFoundError:
|
|
316
330
|
logger.error("claude-mpm command not found")
|
|
317
|
-
console.print(
|
|
331
|
+
console.print(
|
|
332
|
+
"[red]Error: claude-mpm command not found. Ensure Claude MPM is properly installed.[/red]"
|
|
333
|
+
)
|
|
318
334
|
return {"status": "error", "message": "claude-mpm not found"}
|
|
319
335
|
except Exception as e:
|
|
320
336
|
logger.error(f"Initialization failed: {e}")
|
|
@@ -324,74 +340,76 @@ Focus on establishing ONE clear way to do ANYTHING in the project.
|
|
|
324
340
|
"""Display initialization results."""
|
|
325
341
|
if result["status"] == "success":
|
|
326
342
|
console.print("\n[green]✅ Project Initialization Complete![/green]\n")
|
|
327
|
-
|
|
343
|
+
|
|
328
344
|
if result.get("files_created"):
|
|
329
345
|
console.print("[bold]Files Created:[/bold]")
|
|
330
346
|
for file in result["files_created"]:
|
|
331
347
|
console.print(f" • {file}")
|
|
332
348
|
console.print()
|
|
333
|
-
|
|
349
|
+
|
|
334
350
|
if result.get("files_updated"):
|
|
335
351
|
console.print("[bold]Files Updated:[/bold]")
|
|
336
352
|
for file in result["files_updated"]:
|
|
337
353
|
console.print(f" • {file}")
|
|
338
354
|
console.print()
|
|
339
|
-
|
|
355
|
+
|
|
340
356
|
if result.get("next_steps"):
|
|
341
357
|
console.print("[bold]Next Steps:[/bold]")
|
|
342
358
|
for step in result["next_steps"]:
|
|
343
359
|
console.print(f" → {step}")
|
|
344
360
|
console.print()
|
|
345
|
-
|
|
346
|
-
console.print(
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
361
|
+
|
|
362
|
+
console.print(
|
|
363
|
+
Panel(
|
|
364
|
+
"[green]Your project is now optimized for Claude Code and Claude MPM![/green]\n\n"
|
|
365
|
+
"Key files:\n"
|
|
366
|
+
"• [cyan]CLAUDE.md[/cyan] - Main documentation for AI agents\n"
|
|
367
|
+
"• [cyan].claude-mpm/[/cyan] - Configuration and memories\n\n"
|
|
368
|
+
"[dim]Run 'claude-mpm run' to start using the optimized setup[/dim]",
|
|
369
|
+
title="Success",
|
|
370
|
+
border_style="green",
|
|
371
|
+
)
|
|
372
|
+
)
|
|
355
373
|
|
|
356
374
|
|
|
357
375
|
@click.command(name="mpm-init")
|
|
358
376
|
@click.option(
|
|
359
377
|
"--project-type",
|
|
360
|
-
type=click.Choice(
|
|
361
|
-
|
|
378
|
+
type=click.Choice(
|
|
379
|
+
["web", "api", "cli", "library", "mobile", "desktop", "fullstack"]
|
|
380
|
+
),
|
|
381
|
+
help="Type of project to initialize",
|
|
362
382
|
)
|
|
363
383
|
@click.option(
|
|
364
384
|
"--framework",
|
|
365
385
|
type=str,
|
|
366
|
-
help="Specific framework (e.g., react, django, fastapi, express)"
|
|
386
|
+
help="Specific framework (e.g., react, django, fastapi, express)",
|
|
367
387
|
)
|
|
368
388
|
@click.option(
|
|
369
389
|
"--force",
|
|
370
390
|
is_flag=True,
|
|
371
|
-
help="Force reinitialization even if project is already configured"
|
|
391
|
+
help="Force reinitialization even if project is already configured",
|
|
372
392
|
)
|
|
373
393
|
@click.option(
|
|
374
|
-
"--verbose",
|
|
375
|
-
is_flag=True,
|
|
376
|
-
help="Show detailed output during initialization"
|
|
394
|
+
"--verbose", is_flag=True, help="Show detailed output during initialization"
|
|
377
395
|
)
|
|
378
396
|
@click.argument(
|
|
379
397
|
"project_path",
|
|
380
398
|
type=click.Path(exists=True, file_okay=False, dir_okay=True),
|
|
381
399
|
required=False,
|
|
382
|
-
default="."
|
|
400
|
+
default=".",
|
|
383
401
|
)
|
|
384
402
|
def mpm_init(project_type, framework, force, verbose, project_path):
|
|
385
403
|
"""
|
|
386
404
|
Initialize a project for optimal use with Claude Code and Claude MPM.
|
|
387
|
-
|
|
405
|
+
|
|
388
406
|
This command uses the Agentic Coder Optimizer agent to:
|
|
389
407
|
- Create comprehensive CLAUDE.md documentation
|
|
390
408
|
- Establish single-path workflows (ONE way to do ANYTHING)
|
|
391
409
|
- Configure development tools and standards
|
|
392
410
|
- Set up memory systems for project knowledge
|
|
393
411
|
- Optimize for AI agent understanding
|
|
394
|
-
|
|
412
|
+
|
|
395
413
|
Examples:
|
|
396
414
|
claude-mpm mpm-init
|
|
397
415
|
claude-mpm mpm-init --project-type web --framework react
|
|
@@ -400,21 +418,18 @@ def mpm_init(project_type, framework, force, verbose, project_path):
|
|
|
400
418
|
try:
|
|
401
419
|
# Create command instance
|
|
402
420
|
command = MPMInitCommand(Path(project_path))
|
|
403
|
-
|
|
421
|
+
|
|
404
422
|
# Run initialization (now synchronous)
|
|
405
423
|
result = command.initialize_project(
|
|
406
|
-
project_type=project_type,
|
|
407
|
-
framework=framework,
|
|
408
|
-
force=force,
|
|
409
|
-
verbose=verbose
|
|
424
|
+
project_type=project_type, framework=framework, force=force, verbose=verbose
|
|
410
425
|
)
|
|
411
|
-
|
|
426
|
+
|
|
412
427
|
# Exit with appropriate code
|
|
413
428
|
if result["status"] == "success":
|
|
414
429
|
sys.exit(0)
|
|
415
430
|
else:
|
|
416
431
|
sys.exit(1)
|
|
417
|
-
|
|
432
|
+
|
|
418
433
|
except KeyboardInterrupt:
|
|
419
434
|
console.print("\n[yellow]Initialization cancelled by user[/yellow]")
|
|
420
435
|
sys.exit(130)
|
|
@@ -424,4 +439,4 @@ def mpm_init(project_type, framework, force, verbose, project_path):
|
|
|
424
439
|
|
|
425
440
|
|
|
426
441
|
# Export for CLI registration
|
|
427
|
-
__all__ = ["mpm_init"]
|
|
442
|
+
__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
|