claude-mpm 3.1.0__py3-none-any.whl → 3.1.2__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/__main__.py +10 -3
- claude_mpm/agents/templates/test-integration-agent.md +34 -0
- claude_mpm/cli/README.md +109 -0
- claude_mpm/cli/__init__.py +163 -0
- claude_mpm/cli/commands/__init__.py +20 -0
- claude_mpm/cli/commands/agents.py +191 -0
- claude_mpm/cli/commands/info.py +89 -0
- claude_mpm/cli/commands/run.py +80 -0
- claude_mpm/cli/commands/tickets.py +63 -0
- claude_mpm/cli/commands/ui.py +57 -0
- claude_mpm/cli/parser.py +337 -0
- claude_mpm/cli/utils.py +171 -0
- claude_mpm/cli_enhancements.py +19 -0
- claude_mpm/core/simple_runner.py +40 -2
- claude_mpm/models/__init__.py +24 -0
- claude_mpm/models/agent_definition.py +196 -0
- claude_mpm/services/agent_lifecycle_manager.py +183 -20
- claude_mpm/services/agent_modification_tracker.py +10 -2
- claude_mpm/services/agent_persistence_service.py +94 -0
- claude_mpm/services/agent_versioning.py +37 -0
- {claude_mpm-3.1.0.dist-info → claude_mpm-3.1.2.dist-info}/METADATA +1 -1
- {claude_mpm-3.1.0.dist-info → claude_mpm-3.1.2.dist-info}/RECORD +27 -13
- claude_mpm/cli_main.py +0 -13
- /claude_mpm/{cli.py → cli_old.py} +0 -0
- {claude_mpm-3.1.0.dist-info → claude_mpm-3.1.2.dist-info}/WHEEL +0 -0
- {claude_mpm-3.1.0.dist-info → claude_mpm-3.1.2.dist-info}/entry_points.txt +0 -0
- {claude_mpm-3.1.0.dist-info → claude_mpm-3.1.2.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-3.1.0.dist-info → claude_mpm-3.1.2.dist-info}/top_level.txt +0 -0
claude_mpm/__main__.py
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Main entry point for claude-mpm package.
|
|
3
|
+
|
|
4
|
+
WHY: This module enables running claude-mpm as a Python module via `python -m claude_mpm`.
|
|
5
|
+
It's the standard Python pattern for making packages executable.
|
|
6
|
+
|
|
7
|
+
DESIGN DECISION: We only import and call the main function from the CLI module,
|
|
8
|
+
keeping this file minimal and focused on its single responsibility.
|
|
9
|
+
"""
|
|
2
10
|
|
|
3
11
|
import sys
|
|
4
|
-
import os
|
|
5
12
|
from pathlib import Path
|
|
6
13
|
|
|
7
14
|
# Add parent directory to path to ensure proper imports
|
|
8
15
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
9
16
|
|
|
10
|
-
# Import main function from
|
|
17
|
+
# Import main function from the new CLI module structure
|
|
11
18
|
from claude_mpm.cli import main
|
|
12
19
|
|
|
13
20
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
author: test-script
|
|
3
|
+
model_preference: claude-3-sonnet
|
|
4
|
+
specializations: []
|
|
5
|
+
tags:
|
|
6
|
+
- test
|
|
7
|
+
- integration
|
|
8
|
+
type: custom
|
|
9
|
+
version: 1.0.0
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Test Integration Agent
|
|
13
|
+
|
|
14
|
+
## 🎯 Primary Role
|
|
15
|
+
test-integration-agent agent
|
|
16
|
+
|
|
17
|
+
## 🎯 When to Use This Agent
|
|
18
|
+
|
|
19
|
+
**Select this agent when:**
|
|
20
|
+
|
|
21
|
+
**Do NOT select for:**
|
|
22
|
+
|
|
23
|
+
## 🔧 Core Capabilities
|
|
24
|
+
|
|
25
|
+
## 🔑 Authority & Permissions
|
|
26
|
+
|
|
27
|
+
### ✅ Exclusive Write Access
|
|
28
|
+
|
|
29
|
+
### ❌ Forbidden Operations
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
**Agent Type**: custom
|
|
33
|
+
**Model Preference**: claude-3-sonnet
|
|
34
|
+
**Version**: 1.0.0
|
claude_mpm/cli/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Claude MPM CLI Architecture
|
|
2
|
+
|
|
3
|
+
This document describes the refactored CLI architecture for claude-mpm.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The CLI has been refactored from a single monolithic `cli.py` file into a modular structure that improves maintainability and code organization.
|
|
8
|
+
|
|
9
|
+
## Directory Structure
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
cli/
|
|
13
|
+
├── __init__.py # Main entry point - orchestrates the CLI flow
|
|
14
|
+
├── parser.py # Argument parsing logic - single source of truth for CLI arguments
|
|
15
|
+
├── utils.py # Shared utility functions
|
|
16
|
+
├── commands/ # Individual command implementations
|
|
17
|
+
│ ├── __init__.py
|
|
18
|
+
│ ├── run.py # Default command - runs Claude sessions
|
|
19
|
+
│ ├── tickets.py # Lists tickets
|
|
20
|
+
│ ├── info.py # Shows system information
|
|
21
|
+
│ ├── agents.py # Manages agent deployments
|
|
22
|
+
│ └── ui.py # Terminal UI launcher
|
|
23
|
+
└── README.md # This file
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Key Design Decisions
|
|
27
|
+
|
|
28
|
+
### 1. Modular Command Structure
|
|
29
|
+
Each command is implemented in its own module under `commands/`. This makes it easy to:
|
|
30
|
+
- Add new commands without touching existing code
|
|
31
|
+
- Test commands in isolation
|
|
32
|
+
- Understand what each command does
|
|
33
|
+
|
|
34
|
+
### 2. Centralized Argument Parsing
|
|
35
|
+
All argument definitions are in `parser.py`. This provides:
|
|
36
|
+
- Single source of truth for CLI arguments
|
|
37
|
+
- Reusable argument groups (common arguments, run arguments)
|
|
38
|
+
- Clear separation of parsing from execution
|
|
39
|
+
|
|
40
|
+
### 3. Shared Utilities
|
|
41
|
+
Common functions are in `utils.py`:
|
|
42
|
+
- `get_user_input()` - Handles input from files, stdin, or command line
|
|
43
|
+
- `get_agent_versions_display()` - Formats agent version information
|
|
44
|
+
- `setup_logging()` - Configures logging based on arguments
|
|
45
|
+
- `ensure_directories()` - Creates required directories on first run
|
|
46
|
+
|
|
47
|
+
### 4. Backward Compatibility
|
|
48
|
+
The refactoring maintains full backward compatibility:
|
|
49
|
+
- `__main__.py` still imports from `claude_mpm.cli`
|
|
50
|
+
- The main `cli/__init__.py` exports the same `main()` function
|
|
51
|
+
- All existing commands and arguments work exactly as before
|
|
52
|
+
|
|
53
|
+
## Entry Points
|
|
54
|
+
|
|
55
|
+
1. **Package execution**: `python -m claude_mpm`
|
|
56
|
+
- Uses `__main__.py` which imports from `cli/__init__.py`
|
|
57
|
+
|
|
58
|
+
2. **Direct import**: `from claude_mpm.cli import main`
|
|
59
|
+
- Imports the main function from `cli/__init__.py`
|
|
60
|
+
|
|
61
|
+
3. **Shell script**: `claude-mpm` command
|
|
62
|
+
- Calls `python -m claude_mpm` with proper environment setup
|
|
63
|
+
|
|
64
|
+
## Adding New Commands
|
|
65
|
+
|
|
66
|
+
To add a new command:
|
|
67
|
+
|
|
68
|
+
1. Create a new module in `commands/`:
|
|
69
|
+
```python
|
|
70
|
+
# commands/mycommand.py
|
|
71
|
+
def my_command(args):
|
|
72
|
+
"""Execute my command."""
|
|
73
|
+
# Implementation here
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
2. Add the command to `commands/__init__.py`:
|
|
77
|
+
```python
|
|
78
|
+
from .mycommand import my_command
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. Add parser configuration in `parser.py`:
|
|
82
|
+
```python
|
|
83
|
+
# In create_parser()
|
|
84
|
+
mycommand_parser = subparsers.add_parser(
|
|
85
|
+
"mycommand",
|
|
86
|
+
help="Description of my command"
|
|
87
|
+
)
|
|
88
|
+
# Add command-specific arguments
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
4. Add the command mapping in `cli/__init__.py`:
|
|
92
|
+
```python
|
|
93
|
+
# In _execute_command()
|
|
94
|
+
command_map = {
|
|
95
|
+
# ... existing commands ...
|
|
96
|
+
"mycommand": my_command,
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Removed Files
|
|
101
|
+
|
|
102
|
+
- `cli_main.py` - Redundant entry point, functionality moved to `__main__.py`
|
|
103
|
+
- Original `cli.py` - Split into the modular structure described above
|
|
104
|
+
|
|
105
|
+
## Preserved Files
|
|
106
|
+
|
|
107
|
+
- `cli_enhancements.py` - Experimental Click-based CLI with enhanced features
|
|
108
|
+
- Kept for reference and future enhancement ideas
|
|
109
|
+
- Not currently used in production
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Claude MPM Command-Line Interface.
|
|
3
|
+
|
|
4
|
+
WHY: This module serves as the main entry point for the CLI, coordinating
|
|
5
|
+
argument parsing and command execution. It replaces the monolithic cli.py
|
|
6
|
+
with a more modular structure.
|
|
7
|
+
|
|
8
|
+
DESIGN DECISION: We maintain backward compatibility by keeping the same
|
|
9
|
+
interface while organizing code into logical modules. The main() function
|
|
10
|
+
remains the primary entry point for both direct execution and package imports.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Optional
|
|
16
|
+
|
|
17
|
+
from ..constants import CLICommands, LogLevel
|
|
18
|
+
from .parser import create_parser, preprocess_args
|
|
19
|
+
from .utils import ensure_directories, setup_logging
|
|
20
|
+
from .commands import (
|
|
21
|
+
run_session,
|
|
22
|
+
list_tickets,
|
|
23
|
+
show_info,
|
|
24
|
+
manage_agents,
|
|
25
|
+
run_terminal_ui
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# Get version from VERSION file - single source of truth
|
|
29
|
+
version_file = Path(__file__).parent.parent.parent / "VERSION"
|
|
30
|
+
if version_file.exists():
|
|
31
|
+
__version__ = version_file.read_text().strip()
|
|
32
|
+
else:
|
|
33
|
+
# Try to import from package as fallback
|
|
34
|
+
try:
|
|
35
|
+
from .. import __version__
|
|
36
|
+
except ImportError:
|
|
37
|
+
# Default version if all else fails
|
|
38
|
+
__version__ = "0.0.0"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def main(argv: Optional[list] = None):
|
|
42
|
+
"""
|
|
43
|
+
Main CLI entry point.
|
|
44
|
+
|
|
45
|
+
WHY: This function orchestrates the entire CLI flow:
|
|
46
|
+
1. Ensures directories exist
|
|
47
|
+
2. Preprocesses arguments (handling --mpm: prefix)
|
|
48
|
+
3. Parses arguments
|
|
49
|
+
4. Sets up logging
|
|
50
|
+
5. Executes the appropriate command
|
|
51
|
+
|
|
52
|
+
DESIGN DECISION: We keep error handling at this level to provide consistent
|
|
53
|
+
error messages and exit codes across all commands.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
argv: Optional list of command line arguments for testing
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
Exit code (0 for success, non-zero for errors)
|
|
60
|
+
"""
|
|
61
|
+
# Ensure directories are initialized on first run
|
|
62
|
+
ensure_directories()
|
|
63
|
+
|
|
64
|
+
# Create parser with version
|
|
65
|
+
parser = create_parser(version=__version__)
|
|
66
|
+
|
|
67
|
+
# Preprocess and parse arguments
|
|
68
|
+
processed_argv = preprocess_args(argv)
|
|
69
|
+
args = parser.parse_args(processed_argv)
|
|
70
|
+
|
|
71
|
+
# Set up logging
|
|
72
|
+
logger = setup_logging(args)
|
|
73
|
+
|
|
74
|
+
# Debug output if requested
|
|
75
|
+
if hasattr(args, 'debug') and args.debug:
|
|
76
|
+
logger.debug(f"Command: {args.command}")
|
|
77
|
+
logger.debug(f"Arguments: {args}")
|
|
78
|
+
|
|
79
|
+
# Hook system note: Claude Code hooks are handled externally via the
|
|
80
|
+
# hook_handler.py script installed in ~/.claude/settings.json
|
|
81
|
+
# The --no-hooks flag is kept for backward compatibility but doesn't affect
|
|
82
|
+
# Claude Code hooks which are configured separately.
|
|
83
|
+
|
|
84
|
+
# Default to run command if no command specified
|
|
85
|
+
if not args.command:
|
|
86
|
+
args.command = CLICommands.RUN.value
|
|
87
|
+
# Ensure run-specific attributes exist when defaulting to run
|
|
88
|
+
_ensure_run_attributes(args)
|
|
89
|
+
|
|
90
|
+
# Execute command
|
|
91
|
+
try:
|
|
92
|
+
exit_code = _execute_command(args.command, args)
|
|
93
|
+
return exit_code
|
|
94
|
+
except KeyboardInterrupt:
|
|
95
|
+
logger.info("Session interrupted by user")
|
|
96
|
+
return 0
|
|
97
|
+
except Exception as e:
|
|
98
|
+
logger.error(f"Error: {e}")
|
|
99
|
+
if args.debug:
|
|
100
|
+
import traceback
|
|
101
|
+
traceback.print_exc()
|
|
102
|
+
return 1
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _ensure_run_attributes(args):
|
|
106
|
+
"""
|
|
107
|
+
Ensure run command attributes exist when defaulting to run.
|
|
108
|
+
|
|
109
|
+
WHY: When no command is specified, we default to 'run' but the args object
|
|
110
|
+
won't have run-specific attributes from the subparser. This function ensures
|
|
111
|
+
they exist with sensible defaults.
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
args: Parsed arguments object to update
|
|
115
|
+
"""
|
|
116
|
+
# Set defaults for run command attributes
|
|
117
|
+
args.no_tickets = getattr(args, 'no_tickets', False)
|
|
118
|
+
args.no_hooks = getattr(args, 'no_hooks', False)
|
|
119
|
+
args.intercept_commands = getattr(args, 'intercept_commands', False)
|
|
120
|
+
args.input = getattr(args, 'input', None)
|
|
121
|
+
args.non_interactive = getattr(args, 'non_interactive', False)
|
|
122
|
+
args.no_native_agents = getattr(args, 'no_native_agents', False)
|
|
123
|
+
args.claude_args = getattr(args, 'claude_args', [])
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _execute_command(command: str, args) -> int:
|
|
127
|
+
"""
|
|
128
|
+
Execute the specified command.
|
|
129
|
+
|
|
130
|
+
WHY: This function maps command names to their implementations, providing
|
|
131
|
+
a single place to manage command routing.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
command: The command name to execute
|
|
135
|
+
args: Parsed command line arguments
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
Exit code from the command
|
|
139
|
+
"""
|
|
140
|
+
# Map commands to their implementations
|
|
141
|
+
command_map = {
|
|
142
|
+
CLICommands.RUN.value: run_session,
|
|
143
|
+
CLICommands.TICKETS.value: list_tickets,
|
|
144
|
+
CLICommands.INFO.value: show_info,
|
|
145
|
+
CLICommands.AGENTS.value: manage_agents,
|
|
146
|
+
CLICommands.UI.value: run_terminal_ui,
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
# Execute command if found
|
|
150
|
+
if command in command_map:
|
|
151
|
+
result = command_map[command](args)
|
|
152
|
+
# Commands may return None (success) or an exit code
|
|
153
|
+
return result if result is not None else 0
|
|
154
|
+
else:
|
|
155
|
+
# Unknown command - this shouldn't happen with argparse
|
|
156
|
+
# but we handle it for completeness
|
|
157
|
+
print(f"Unknown command: {command}")
|
|
158
|
+
return 1
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
# For backward compatibility - export main
|
|
162
|
+
if __name__ == "__main__":
|
|
163
|
+
sys.exit(main())
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CLI commands for claude-mpm.
|
|
3
|
+
|
|
4
|
+
WHY: This package contains individual command implementations, organized into
|
|
5
|
+
separate modules for better maintainability and code organization.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .run import run_session
|
|
9
|
+
from .tickets import list_tickets
|
|
10
|
+
from .info import show_info
|
|
11
|
+
from .agents import manage_agents
|
|
12
|
+
from .ui import run_terminal_ui
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
'run_session',
|
|
16
|
+
'list_tickets',
|
|
17
|
+
'show_info',
|
|
18
|
+
'manage_agents',
|
|
19
|
+
'run_terminal_ui'
|
|
20
|
+
]
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agents command implementation for claude-mpm.
|
|
3
|
+
|
|
4
|
+
WHY: This module manages Claude Code native agents, including listing, deploying,
|
|
5
|
+
and cleaning agent deployments.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from ...core.logger import get_logger
|
|
11
|
+
from ...constants import AgentCommands
|
|
12
|
+
from ..utils import get_agent_versions_display
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def manage_agents(args):
|
|
16
|
+
"""
|
|
17
|
+
Manage Claude Code native agents.
|
|
18
|
+
|
|
19
|
+
WHY: Claude Code agents need to be deployed and managed. This command provides
|
|
20
|
+
a unified interface for all agent-related operations.
|
|
21
|
+
|
|
22
|
+
DESIGN DECISION: When no subcommand is provided, we show the current agent
|
|
23
|
+
versions as a quick status check. This matches the behavior users see at startup.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
args: Parsed command line arguments with agents_command attribute
|
|
27
|
+
"""
|
|
28
|
+
logger = get_logger("cli")
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
from ...services.agent_deployment import AgentDeploymentService
|
|
32
|
+
deployment_service = AgentDeploymentService()
|
|
33
|
+
|
|
34
|
+
if not args.agents_command:
|
|
35
|
+
# No subcommand - show agent versions
|
|
36
|
+
# WHY: This provides a quick way for users to check deployed agent versions
|
|
37
|
+
# without needing to specify additional subcommands
|
|
38
|
+
agent_versions = get_agent_versions_display()
|
|
39
|
+
if agent_versions:
|
|
40
|
+
print(agent_versions)
|
|
41
|
+
else:
|
|
42
|
+
print("No deployed agents found")
|
|
43
|
+
print("\nTo deploy agents, run: claude-mpm --mpm:agents deploy")
|
|
44
|
+
return
|
|
45
|
+
|
|
46
|
+
if args.agents_command == AgentCommands.LIST.value:
|
|
47
|
+
_list_agents(args, deployment_service)
|
|
48
|
+
|
|
49
|
+
elif args.agents_command == AgentCommands.DEPLOY.value:
|
|
50
|
+
_deploy_agents(args, deployment_service, force=False)
|
|
51
|
+
|
|
52
|
+
elif args.agents_command == AgentCommands.FORCE_DEPLOY.value:
|
|
53
|
+
_deploy_agents(args, deployment_service, force=True)
|
|
54
|
+
|
|
55
|
+
elif args.agents_command == AgentCommands.CLEAN.value:
|
|
56
|
+
_clean_agents(args, deployment_service)
|
|
57
|
+
|
|
58
|
+
except ImportError:
|
|
59
|
+
logger.error("Agent deployment service not available")
|
|
60
|
+
print("Error: Agent deployment service not available")
|
|
61
|
+
except Exception as e:
|
|
62
|
+
logger.error(f"Error managing agents: {e}")
|
|
63
|
+
print(f"Error: {e}")
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _list_agents(args, deployment_service):
|
|
67
|
+
"""
|
|
68
|
+
List available or deployed agents.
|
|
69
|
+
|
|
70
|
+
WHY: Users need to see what agents are available in the system and what's
|
|
71
|
+
currently deployed. This helps them understand the agent ecosystem.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
args: Command arguments with 'system' and 'deployed' flags
|
|
75
|
+
deployment_service: Agent deployment service instance
|
|
76
|
+
"""
|
|
77
|
+
if args.system:
|
|
78
|
+
# List available agent templates
|
|
79
|
+
print("Available Agent Templates:")
|
|
80
|
+
print("-" * 80)
|
|
81
|
+
agents = deployment_service.list_available_agents()
|
|
82
|
+
if not agents:
|
|
83
|
+
print("No agent templates found")
|
|
84
|
+
else:
|
|
85
|
+
for agent in agents:
|
|
86
|
+
print(f"📄 {agent['file']}")
|
|
87
|
+
if 'name' in agent:
|
|
88
|
+
print(f" Name: {agent['name']}")
|
|
89
|
+
if 'description' in agent:
|
|
90
|
+
print(f" Description: {agent['description']}")
|
|
91
|
+
if 'version' in agent:
|
|
92
|
+
print(f" Version: {agent['version']}")
|
|
93
|
+
print()
|
|
94
|
+
|
|
95
|
+
elif args.deployed:
|
|
96
|
+
# List deployed agents
|
|
97
|
+
print("Deployed Agents:")
|
|
98
|
+
print("-" * 80)
|
|
99
|
+
verification = deployment_service.verify_deployment()
|
|
100
|
+
if not verification["agents_found"]:
|
|
101
|
+
print("No deployed agents found")
|
|
102
|
+
else:
|
|
103
|
+
for agent in verification["agents_found"]:
|
|
104
|
+
print(f"📄 {agent['file']}")
|
|
105
|
+
if 'name' in agent:
|
|
106
|
+
print(f" Name: {agent['name']}")
|
|
107
|
+
print(f" Path: {agent['path']}")
|
|
108
|
+
print()
|
|
109
|
+
|
|
110
|
+
if verification["warnings"]:
|
|
111
|
+
print("\nWarnings:")
|
|
112
|
+
for warning in verification["warnings"]:
|
|
113
|
+
print(f" ⚠️ {warning}")
|
|
114
|
+
|
|
115
|
+
else:
|
|
116
|
+
# Default: show usage
|
|
117
|
+
print("Use --system to list system agents or --deployed to list deployed agents")
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _deploy_agents(args, deployment_service, force=False):
|
|
121
|
+
"""
|
|
122
|
+
Deploy system agents.
|
|
123
|
+
|
|
124
|
+
WHY: Agents need to be deployed to the working directory for Claude Code to use them.
|
|
125
|
+
This function handles both regular and forced deployment.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
args: Command arguments with optional 'target' path
|
|
129
|
+
deployment_service: Agent deployment service instance
|
|
130
|
+
force: Whether to force rebuild all agents
|
|
131
|
+
"""
|
|
132
|
+
if force:
|
|
133
|
+
print("Force deploying all system agents...")
|
|
134
|
+
else:
|
|
135
|
+
print("Deploying system agents...")
|
|
136
|
+
|
|
137
|
+
results = deployment_service.deploy_agents(args.target, force_rebuild=force)
|
|
138
|
+
|
|
139
|
+
if results["deployed"]:
|
|
140
|
+
print(f"\n✓ Successfully deployed {len(results['deployed'])} agents to {results['target_dir']}")
|
|
141
|
+
for agent in results["deployed"]:
|
|
142
|
+
print(f" - {agent['name']}")
|
|
143
|
+
|
|
144
|
+
if force and results.get("updated", []):
|
|
145
|
+
print(f"\n✓ Updated {len(results['updated'])} agents")
|
|
146
|
+
for agent in results["updated"]:
|
|
147
|
+
print(f" - {agent['name']}")
|
|
148
|
+
|
|
149
|
+
if force and results.get("skipped", []):
|
|
150
|
+
print(f"\n✓ Skipped {len(results['skipped'])} up-to-date agents")
|
|
151
|
+
|
|
152
|
+
if results["errors"]:
|
|
153
|
+
print("\n❌ Errors during deployment:")
|
|
154
|
+
for error in results["errors"]:
|
|
155
|
+
print(f" - {error}")
|
|
156
|
+
|
|
157
|
+
if force:
|
|
158
|
+
# Set environment for force deploy
|
|
159
|
+
env_vars = deployment_service.set_claude_environment(
|
|
160
|
+
args.target.parent if args.target else None
|
|
161
|
+
)
|
|
162
|
+
print(f"\n✓ Set Claude environment variables:")
|
|
163
|
+
for key, value in env_vars.items():
|
|
164
|
+
print(f" - {key}={value}")
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def _clean_agents(args, deployment_service):
|
|
168
|
+
"""
|
|
169
|
+
Clean deployed system agents.
|
|
170
|
+
|
|
171
|
+
WHY: Users may want to remove deployed agents to start fresh or clean up
|
|
172
|
+
their working directory.
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
args: Command arguments with optional 'target' path
|
|
176
|
+
deployment_service: Agent deployment service instance
|
|
177
|
+
"""
|
|
178
|
+
print("Cleaning deployed system agents...")
|
|
179
|
+
results = deployment_service.clean_deployment(args.target)
|
|
180
|
+
|
|
181
|
+
if results["removed"]:
|
|
182
|
+
print(f"\n✓ Removed {len(results['removed'])} agents")
|
|
183
|
+
for path in results["removed"]:
|
|
184
|
+
print(f" - {Path(path).name}")
|
|
185
|
+
else:
|
|
186
|
+
print("No system agents found to remove")
|
|
187
|
+
|
|
188
|
+
if results["errors"]:
|
|
189
|
+
print("\n❌ Errors during cleanup:")
|
|
190
|
+
for error in results["errors"]:
|
|
191
|
+
print(f" - {error}")
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Info command implementation for claude-mpm.
|
|
3
|
+
|
|
4
|
+
WHY: This module provides system information and configuration details to help
|
|
5
|
+
users understand their claude-mpm setup and troubleshoot issues.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import shutil
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from ...core.logger import get_logger
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def show_info(args):
|
|
15
|
+
"""
|
|
16
|
+
Show framework and configuration information.
|
|
17
|
+
|
|
18
|
+
WHY: Users need to verify their installation, check dependencies, and understand
|
|
19
|
+
what agents are available. This command provides a comprehensive overview of
|
|
20
|
+
the claude-mpm environment.
|
|
21
|
+
|
|
22
|
+
DESIGN DECISION: We check for all major components and dependencies, showing
|
|
23
|
+
both what's working (✓) and what's missing (✗) to help with troubleshooting.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
args: Parsed command line arguments
|
|
27
|
+
"""
|
|
28
|
+
try:
|
|
29
|
+
from ...core.framework_loader import FrameworkLoader
|
|
30
|
+
except ImportError:
|
|
31
|
+
from claude_mpm.core.framework_loader import FrameworkLoader
|
|
32
|
+
|
|
33
|
+
print("Claude MPM - Multi-Agent Project Manager")
|
|
34
|
+
print("=" * 50)
|
|
35
|
+
|
|
36
|
+
# Framework info
|
|
37
|
+
loader = FrameworkLoader(args.framework_path)
|
|
38
|
+
if loader.framework_content["loaded"]:
|
|
39
|
+
print(f"Framework: claude-multiagent-pm")
|
|
40
|
+
print(f"Version: {loader.framework_content['version']}")
|
|
41
|
+
print(f"Path: {loader.framework_path}")
|
|
42
|
+
print(f"Agents: {', '.join(loader.get_agent_list())}")
|
|
43
|
+
else:
|
|
44
|
+
print("Framework: Not found (using minimal instructions)")
|
|
45
|
+
|
|
46
|
+
print()
|
|
47
|
+
|
|
48
|
+
# Configuration
|
|
49
|
+
print("Configuration:")
|
|
50
|
+
print(f" Log directory: {args.log_dir or '~/.claude-mpm/logs'}")
|
|
51
|
+
print(f" Debug mode: {args.debug}")
|
|
52
|
+
|
|
53
|
+
# Show agent hierarchy
|
|
54
|
+
if loader.agent_registry:
|
|
55
|
+
hierarchy = loader.agent_registry.get_agent_hierarchy()
|
|
56
|
+
print("\nAgent Hierarchy:")
|
|
57
|
+
print(f" Project agents: {len(hierarchy['project'])}")
|
|
58
|
+
print(f" User agents: {len(hierarchy['user'])}")
|
|
59
|
+
print(f" System agents: {len(hierarchy['system'])}")
|
|
60
|
+
|
|
61
|
+
# Show core agents
|
|
62
|
+
core_agents = loader.agent_registry.get_core_agents()
|
|
63
|
+
print(f"\nCore Agents: {', '.join(core_agents)}")
|
|
64
|
+
|
|
65
|
+
# Check dependencies
|
|
66
|
+
print("\nDependencies:")
|
|
67
|
+
|
|
68
|
+
# Check Claude CLI
|
|
69
|
+
claude_path = shutil.which("claude")
|
|
70
|
+
if claude_path:
|
|
71
|
+
print(f" ✓ Claude CLI: {claude_path}")
|
|
72
|
+
else:
|
|
73
|
+
print(" ✗ Claude CLI: Not found in PATH")
|
|
74
|
+
|
|
75
|
+
# Check ai-trackdown-pytools
|
|
76
|
+
try:
|
|
77
|
+
import ai_trackdown_pytools
|
|
78
|
+
print(" ✓ ai-trackdown-pytools: Installed")
|
|
79
|
+
except ImportError:
|
|
80
|
+
print(" ✗ ai-trackdown-pytools: Not installed")
|
|
81
|
+
|
|
82
|
+
# Check Claude Code hooks
|
|
83
|
+
claude_settings = Path.home() / ".claude" / "settings.json"
|
|
84
|
+
if claude_settings.exists():
|
|
85
|
+
print(" ✓ Claude Code Hooks: Installed")
|
|
86
|
+
print(" Use /mpm commands in Claude Code")
|
|
87
|
+
else:
|
|
88
|
+
print(" ✗ Claude Code Hooks: Not installed")
|
|
89
|
+
print(" Run: python scripts/install_hooks.py")
|