claude-mpm 4.11.0__py3-none-any.whl → 4.11.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.
Potentially problematic release.
This version of claude-mpm might be problematic. Click here for more details.
- claude_mpm/VERSION +1 -1
- claude_mpm/cli/commands/mpm_init.py +235 -162
- claude_mpm/cli/commands/mpm_init_handler.py +14 -25
- claude_mpm/cli/parsers/mpm_init_parser.py +32 -31
- claude_mpm/commands/mpm-init.md +129 -78
- claude_mpm/utils/git_analyzer.py +407 -0
- {claude_mpm-4.11.0.dist-info → claude_mpm-4.11.2.dist-info}/METADATA +1 -1
- {claude_mpm-4.11.0.dist-info → claude_mpm-4.11.2.dist-info}/RECORD +12 -13
- claude_mpm/cli/commands/session_pause_manager.py +0 -389
- claude_mpm/cli/commands/session_resume_manager.py +0 -523
- {claude_mpm-4.11.0.dist-info → claude_mpm-4.11.2.dist-info}/WHEEL +0 -0
- {claude_mpm-4.11.0.dist-info → claude_mpm-4.11.2.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.11.0.dist-info → claude_mpm-4.11.2.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.11.0.dist-info → claude_mpm-4.11.2.dist-info}/top_level.txt +0 -0
claude_mpm/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.11.
|
|
1
|
+
4.11.2
|
|
@@ -11,7 +11,6 @@ documentation with code structure analysis.
|
|
|
11
11
|
import contextlib
|
|
12
12
|
import subprocess
|
|
13
13
|
import sys
|
|
14
|
-
from datetime import datetime
|
|
15
14
|
from pathlib import Path
|
|
16
15
|
from typing import Any, Dict, List, Optional
|
|
17
16
|
|
|
@@ -21,9 +20,6 @@ from rich.panel import Panel
|
|
|
21
20
|
from rich.progress import Progress, SpinnerColumn, TextColumn
|
|
22
21
|
from rich.prompt import Prompt
|
|
23
22
|
|
|
24
|
-
# Import pause/resume managers
|
|
25
|
-
from claude_mpm.cli.commands.session_pause_manager import SessionPauseManager
|
|
26
|
-
from claude_mpm.cli.commands.session_resume_manager import SessionResumeManager
|
|
27
23
|
from claude_mpm.core.logging_utils import get_logger
|
|
28
24
|
|
|
29
25
|
# Import new services
|
|
@@ -52,10 +48,6 @@ class MPMInitCommand:
|
|
|
52
48
|
self.analyzer = EnhancedProjectAnalyzer(self.project_path)
|
|
53
49
|
self.display = DisplayHelper(console)
|
|
54
50
|
|
|
55
|
-
# Session management
|
|
56
|
-
self.pause_manager = SessionPauseManager(self.project_path)
|
|
57
|
-
self.resume_manager = SessionResumeManager(self.project_path)
|
|
58
|
-
|
|
59
51
|
def initialize_project(
|
|
60
52
|
self,
|
|
61
53
|
project_type: Optional[str] = None,
|
|
@@ -1472,124 +1464,216 @@ preserving valuable project-specific information while refreshing standard secti
|
|
|
1472
1464
|
logger.error(f"Initialization failed: {e}")
|
|
1473
1465
|
return {"status": "error", "message": str(e)}
|
|
1474
1466
|
|
|
1475
|
-
def
|
|
1467
|
+
def handle_context(
|
|
1476
1468
|
self,
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1469
|
+
session_id: Optional[str] = None,
|
|
1470
|
+
list_sessions: bool = False,
|
|
1471
|
+
days: int = 7,
|
|
1480
1472
|
) -> Dict[str, Any]:
|
|
1481
|
-
"""
|
|
1473
|
+
"""
|
|
1474
|
+
Provide intelligent context for resuming work based on git history.
|
|
1475
|
+
|
|
1476
|
+
Analyzes recent commits to identify:
|
|
1477
|
+
- Active work streams (what was being worked on)
|
|
1478
|
+
- Intent and motivation (why this work)
|
|
1479
|
+
- Risks and blockers
|
|
1480
|
+
- Recommended next actions
|
|
1481
|
+
|
|
1482
|
+
This delegates to Research agent for deep analysis.
|
|
1482
1483
|
|
|
1483
1484
|
Args:
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1485
|
+
session_id: Unused parameter (for compatibility)
|
|
1486
|
+
list_sessions: Unused parameter (for compatibility)
|
|
1487
|
+
days: Number of days of git history to analyze (default: 7)
|
|
1487
1488
|
|
|
1488
1489
|
Returns:
|
|
1489
|
-
Dict containing
|
|
1490
|
+
Dict containing context result
|
|
1490
1491
|
"""
|
|
1491
|
-
|
|
1492
|
-
# If no context provided, prompt for it
|
|
1493
|
-
if not summary:
|
|
1494
|
-
summary = Prompt.ask(
|
|
1495
|
-
"\n[bold]What were you working on?[/bold]",
|
|
1496
|
-
default="Working on project improvements",
|
|
1497
|
-
)
|
|
1492
|
+
from claude_mpm.utils.git_analyzer import analyze_recent_activity
|
|
1498
1493
|
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
if not next_steps:
|
|
1511
|
-
console.print(
|
|
1512
|
-
"\n[bold]List next steps (enter blank line to finish):[/bold]"
|
|
1513
|
-
)
|
|
1514
|
-
next_steps = []
|
|
1515
|
-
while True:
|
|
1516
|
-
item = Prompt.ask(" Next step", default="")
|
|
1517
|
-
if not item:
|
|
1518
|
-
break
|
|
1519
|
-
next_steps.append(item)
|
|
1520
|
-
|
|
1521
|
-
# Pause the session
|
|
1522
|
-
return self.pause_manager.pause_session(
|
|
1523
|
-
conversation_summary=summary,
|
|
1524
|
-
accomplishments=accomplishments,
|
|
1525
|
-
next_steps=next_steps,
|
|
1494
|
+
# 1. Analyze git history with adaptive window
|
|
1495
|
+
console.print(f"\n🔍 Analyzing last {days} days of git history...\n")
|
|
1496
|
+
git_analysis = analyze_recent_activity(
|
|
1497
|
+
repo_path=str(self.project_path), days=days, max_commits=50, min_commits=25
|
|
1498
|
+
)
|
|
1499
|
+
|
|
1500
|
+
# Show adaptive behavior to user
|
|
1501
|
+
if git_analysis.get("adaptive_mode"):
|
|
1502
|
+
console.print(
|
|
1503
|
+
f"[cyan]ℹ️ Note: Analyzed {git_analysis.get('actual_time_span', 'extended period')} "
|
|
1504
|
+
f"to get meaningful context[/cyan]"
|
|
1526
1505
|
)
|
|
1506
|
+
if git_analysis.get("reason"):
|
|
1507
|
+
console.print(f"[dim] Reason: {git_analysis['reason']}[/dim]\n")
|
|
1508
|
+
else:
|
|
1509
|
+
console.print()
|
|
1527
1510
|
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1511
|
+
if git_analysis.get("error"):
|
|
1512
|
+
console.print(
|
|
1513
|
+
f"[yellow]⚠️ Could not analyze git history: {git_analysis['error']}[/yellow]"
|
|
1514
|
+
)
|
|
1515
|
+
console.print(
|
|
1516
|
+
"[dim]Ensure this is a git repository with commit history.[/dim]\n"
|
|
1517
|
+
)
|
|
1518
|
+
return {
|
|
1519
|
+
"status": "error",
|
|
1520
|
+
"message": git_analysis["error"],
|
|
1521
|
+
}
|
|
1532
1522
|
|
|
1533
|
-
|
|
1534
|
-
|
|
1523
|
+
if not git_analysis.get("has_activity"):
|
|
1524
|
+
console.print(
|
|
1525
|
+
f"[yellow]⚠️ No git activity found in the last {days} days.[/yellow]"
|
|
1526
|
+
)
|
|
1527
|
+
console.print("[dim]Try increasing the --days parameter.[/dim]\n")
|
|
1528
|
+
return {
|
|
1529
|
+
"status": "error",
|
|
1530
|
+
"message": f"No git activity in last {days} days",
|
|
1531
|
+
}
|
|
1535
1532
|
|
|
1536
|
-
|
|
1537
|
-
|
|
1533
|
+
# 2. Build Research delegation prompt
|
|
1534
|
+
research_prompt = self._build_research_context_prompt(git_analysis, days)
|
|
1538
1535
|
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
""
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1536
|
+
# 3. Display prompt for PM to delegate
|
|
1537
|
+
console.print("\n" + "=" * 80)
|
|
1538
|
+
console.print("📋 DELEGATE TO RESEARCH AGENT:")
|
|
1539
|
+
console.print("=" * 80 + "\n")
|
|
1540
|
+
console.print(research_prompt)
|
|
1541
|
+
console.print("\n" + "=" * 80 + "\n")
|
|
1545
1542
|
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1543
|
+
return {
|
|
1544
|
+
"status": "context_ready",
|
|
1545
|
+
"git_analysis": git_analysis,
|
|
1546
|
+
"research_prompt": research_prompt,
|
|
1547
|
+
"recommendation": "PM should delegate this prompt to Research agent",
|
|
1548
|
+
}
|
|
1552
1549
|
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
paused_at = session.get("paused_at", "unknown")
|
|
1558
|
-
try:
|
|
1559
|
-
dt = datetime.fromisoformat(paused_at.replace("Z", "+00:00"))
|
|
1560
|
-
paused_display = dt.strftime("%Y-%m-%d %H:%M")
|
|
1561
|
-
except Exception:
|
|
1562
|
-
paused_display = paused_at
|
|
1550
|
+
def _build_research_context_prompt(
|
|
1551
|
+
self, git_analysis: Dict[str, Any], days: int
|
|
1552
|
+
) -> str:
|
|
1553
|
+
"""Build structured Research agent delegation prompt from git analysis."""
|
|
1563
1554
|
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1555
|
+
# Extract key data
|
|
1556
|
+
commits = git_analysis.get("commits", [])
|
|
1557
|
+
branches = git_analysis.get("branches", [])
|
|
1558
|
+
contributors = git_analysis.get("contributors", {})
|
|
1559
|
+
file_changes = git_analysis.get("file_changes", {})
|
|
1567
1560
|
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
)
|
|
1571
|
-
console.print(f" {summary}\n")
|
|
1561
|
+
# Build prompt following Prompt Engineer's template
|
|
1562
|
+
prompt = f"""# Project Context Analysis Mission
|
|
1572
1563
|
|
|
1573
|
-
|
|
1574
|
-
"Select session to resume",
|
|
1575
|
-
choices=[str(i) for i in range(1, len(available_sessions) + 1)],
|
|
1576
|
-
default="1",
|
|
1577
|
-
)
|
|
1578
|
-
session_id = available_sessions[int(choice) - 1]["session_id"]
|
|
1564
|
+
You are Research agent analyzing git history to provide PM with intelligent project context for resuming work.
|
|
1579
1565
|
|
|
1580
|
-
|
|
1581
|
-
|
|
1566
|
+
## Analysis Scope
|
|
1567
|
+
- **Time Range**: Last {days} days"""
|
|
1582
1568
|
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1569
|
+
# Add adaptive mode note if applicable
|
|
1570
|
+
if git_analysis.get("adaptive_mode"):
|
|
1571
|
+
actual_days = git_analysis.get("actual_time_span", "extended period")
|
|
1572
|
+
prompt += f""" (adaptive: {actual_days} days analyzed)
|
|
1573
|
+
- **Note**: {git_analysis.get('reason', 'Analysis window adjusted to ensure meaningful context')}"""
|
|
1586
1574
|
|
|
1587
|
-
|
|
1575
|
+
prompt += f"""
|
|
1576
|
+
- **Commits Analyzed**: {len(commits)} commits
|
|
1577
|
+
- **Branches**: {', '.join(branches[:5]) if branches else 'main'}
|
|
1578
|
+
- **Contributors**: {', '.join(contributors.keys()) if contributors else 'Unknown'}
|
|
1588
1579
|
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1580
|
+
## Your Mission
|
|
1581
|
+
|
|
1582
|
+
Analyze git history to answer these questions for PM:
|
|
1583
|
+
|
|
1584
|
+
1. **What was being worked on?** (Active work streams)
|
|
1585
|
+
2. **Why was this work happening?** (Intent and motivation)
|
|
1586
|
+
3. **What's the natural next step?** (Continuation recommendations)
|
|
1587
|
+
4. **What needs attention?** (Risks, stalls, conflicts)
|
|
1588
|
+
|
|
1589
|
+
## Git Data Provided
|
|
1590
|
+
|
|
1591
|
+
### Recent Commits ({min(len(commits), 10)} most recent):
|
|
1592
|
+
"""
|
|
1593
|
+
|
|
1594
|
+
# Add recent commits
|
|
1595
|
+
for commit in commits[:10]:
|
|
1596
|
+
author = commit.get("author", "Unknown")
|
|
1597
|
+
timestamp = commit.get("timestamp", "Unknown date")
|
|
1598
|
+
message = commit.get("message", "No message")
|
|
1599
|
+
files = commit.get("files", [])
|
|
1600
|
+
|
|
1601
|
+
prompt += f"\n- **{timestamp}** by {author}"
|
|
1602
|
+
prompt += f"\n {message}"
|
|
1603
|
+
prompt += f"\n Files changed: {len(files)}\n"
|
|
1604
|
+
|
|
1605
|
+
# Add file change summary
|
|
1606
|
+
if file_changes:
|
|
1607
|
+
# Sort by modifications count
|
|
1608
|
+
sorted_files = sorted(
|
|
1609
|
+
file_changes.items(),
|
|
1610
|
+
key=lambda x: x[1].get("modifications", 0),
|
|
1611
|
+
reverse=True,
|
|
1612
|
+
)
|
|
1613
|
+
prompt += "\n### Most Changed Files:\n"
|
|
1614
|
+
for file_path, file_data in sorted_files[:10]:
|
|
1615
|
+
modifications = file_data.get("modifications", 0)
|
|
1616
|
+
file_contributors = file_data.get("contributors", [])
|
|
1617
|
+
prompt += f"- {file_path}: {modifications} changes ({len(file_contributors)} contributor{'s' if len(file_contributors) != 1 else ''})\n"
|
|
1618
|
+
|
|
1619
|
+
# Add contributor summary
|
|
1620
|
+
if contributors:
|
|
1621
|
+
prompt += "\n### Contributors:\n"
|
|
1622
|
+
sorted_contributors = sorted(
|
|
1623
|
+
contributors.items(),
|
|
1624
|
+
key=lambda x: x[1].get("commits", 0),
|
|
1625
|
+
reverse=True,
|
|
1626
|
+
)
|
|
1627
|
+
for name, info in sorted_contributors[:5]:
|
|
1628
|
+
commit_count = info.get("commits", 0)
|
|
1629
|
+
prompt += f"- {name}: {commit_count} commit{'s' if commit_count != 1 else ''}\n"
|
|
1630
|
+
|
|
1631
|
+
# Add analysis instructions
|
|
1632
|
+
prompt += """
|
|
1633
|
+
|
|
1634
|
+
## Analysis Instructions
|
|
1635
|
+
|
|
1636
|
+
### Phase 1: Work Stream Identification
|
|
1637
|
+
Group related commits into thematic work streams. For each stream:
|
|
1638
|
+
- **Name**: Infer from commit messages (e.g., "Authentication refactor")
|
|
1639
|
+
- **Status**: ongoing/completed/stalled
|
|
1640
|
+
- **Commits**: Count of commits in this stream
|
|
1641
|
+
- **Intent**: WHY this work (from commit bodies/messages)
|
|
1642
|
+
- **Key Files**: Most changed files in this stream
|
|
1643
|
+
|
|
1644
|
+
### Phase 2: Risk Detection
|
|
1645
|
+
Identify:
|
|
1646
|
+
- **Stalled Work**: Work streams with no activity >3 days
|
|
1647
|
+
- **Anti-Patterns**: WIP commits, temp commits, debug commits
|
|
1648
|
+
- **Documentation Lag**: Code changes without doc updates
|
|
1649
|
+
- **Conflicts**: Merge conflicts or divergent branches
|
|
1650
|
+
|
|
1651
|
+
### Phase 3: Recommendations
|
|
1652
|
+
Based on analysis:
|
|
1653
|
+
1. **Primary Focus**: Most active/recent work to continue
|
|
1654
|
+
2. **Quick Wins**: Small tasks that could be finished
|
|
1655
|
+
3. **Blockers**: Issues preventing progress
|
|
1656
|
+
4. **Next Steps**: Logical continuation points
|
|
1657
|
+
|
|
1658
|
+
## Output Format
|
|
1659
|
+
|
|
1660
|
+
Provide a clear markdown summary with:
|
|
1661
|
+
|
|
1662
|
+
1. **Active Work Streams** (What was being worked on)
|
|
1663
|
+
2. **Intent Summary** (Why this work matters)
|
|
1664
|
+
3. **Risks Detected** (What needs attention)
|
|
1665
|
+
4. **Recommended Next Actions** (What to work on)
|
|
1666
|
+
|
|
1667
|
+
Keep it concise (<1000 words) but actionable.
|
|
1668
|
+
|
|
1669
|
+
## Success Criteria
|
|
1670
|
+
- Work streams accurately reflect development themes
|
|
1671
|
+
- Intent captures the "why" not just "what"
|
|
1672
|
+
- Recommendations are specific and actionable
|
|
1673
|
+
- Risks are prioritized by impact
|
|
1674
|
+
"""
|
|
1675
|
+
|
|
1676
|
+
return prompt
|
|
1593
1677
|
|
|
1594
1678
|
def _display_results(self, result: Dict, verbose: bool):
|
|
1595
1679
|
"""Display initialization results."""
|
|
@@ -1748,9 +1832,9 @@ def mpm_init(
|
|
|
1748
1832
|
- Optimize for AI agent understanding
|
|
1749
1833
|
- Perform AST analysis for enhanced developer documentation
|
|
1750
1834
|
|
|
1751
|
-
|
|
1752
|
-
-
|
|
1753
|
-
-
|
|
1835
|
+
Context Management:
|
|
1836
|
+
- resume: Analyze git history to provide context for resuming work
|
|
1837
|
+
- --catchup: Show recent commit history for PM context
|
|
1754
1838
|
|
|
1755
1839
|
Update Mode:
|
|
1756
1840
|
When CLAUDE.md exists, the command offers to update rather than recreate,
|
|
@@ -1758,8 +1842,7 @@ def mpm_init(
|
|
|
1758
1842
|
|
|
1759
1843
|
Examples:
|
|
1760
1844
|
claude-mpm mpm-init # Initialize/update current directory
|
|
1761
|
-
claude-mpm mpm-init
|
|
1762
|
-
claude-mpm mpm-init resume # Resume latest session
|
|
1845
|
+
claude-mpm mpm-init --catchup # Show recent git history for context
|
|
1763
1846
|
claude-mpm mpm-init --review # Review project state without changes
|
|
1764
1847
|
claude-mpm mpm-init --update # Force update mode
|
|
1765
1848
|
claude-mpm mpm-init --organize # Organize misplaced files
|
|
@@ -1807,24 +1890,18 @@ def mpm_init(
|
|
|
1807
1890
|
sys.exit(1)
|
|
1808
1891
|
|
|
1809
1892
|
|
|
1810
|
-
@mpm_init.command(name="
|
|
1893
|
+
@mpm_init.command(name="context")
|
|
1811
1894
|
@click.option(
|
|
1812
|
-
"--
|
|
1813
|
-
"-
|
|
1895
|
+
"--session-id",
|
|
1896
|
+
"-i",
|
|
1814
1897
|
type=str,
|
|
1815
|
-
help="
|
|
1816
|
-
)
|
|
1817
|
-
@click.option(
|
|
1818
|
-
"--accomplishment",
|
|
1819
|
-
"-a",
|
|
1820
|
-
multiple=True,
|
|
1821
|
-
help="Accomplishment from this session (can be used multiple times)",
|
|
1898
|
+
help="Unused (for compatibility) - will be removed in future version",
|
|
1822
1899
|
)
|
|
1823
1900
|
@click.option(
|
|
1824
|
-
"--
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
help="
|
|
1901
|
+
"--days",
|
|
1902
|
+
type=int,
|
|
1903
|
+
default=7,
|
|
1904
|
+
help="Number of days of git history to analyze (default: 7)",
|
|
1828
1905
|
)
|
|
1829
1906
|
@click.argument(
|
|
1830
1907
|
"project_path",
|
|
@@ -1832,52 +1909,51 @@ def mpm_init(
|
|
|
1832
1909
|
required=False,
|
|
1833
1910
|
default=".",
|
|
1834
1911
|
)
|
|
1835
|
-
def
|
|
1912
|
+
def context_command(session_id, days, project_path):
|
|
1836
1913
|
"""
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
This command captures:
|
|
1840
|
-
- Conversation summary and progress
|
|
1841
|
-
- Git repository state (commits, branch, status)
|
|
1842
|
-
- Todo list status
|
|
1843
|
-
- Working directory changes
|
|
1914
|
+
Provide intelligent context for resuming work based on git history.
|
|
1844
1915
|
|
|
1845
|
-
|
|
1916
|
+
Analyzes recent git history and generates a Research agent delegation
|
|
1917
|
+
prompt for intelligent project context reconstruction.
|
|
1846
1918
|
|
|
1847
1919
|
Examples:
|
|
1848
|
-
claude-mpm mpm-init
|
|
1849
|
-
claude-mpm mpm-init
|
|
1850
|
-
claude-mpm mpm-init
|
|
1851
|
-
|
|
1920
|
+
claude-mpm mpm-init context # Analyze last 7 days
|
|
1921
|
+
claude-mpm mpm-init context --days 14 # Analyze last 14 days
|
|
1922
|
+
claude-mpm mpm-init context --days 30 # Analyze last 30 days
|
|
1923
|
+
|
|
1924
|
+
Note: 'resume' is deprecated, use 'context' instead.
|
|
1852
1925
|
"""
|
|
1853
1926
|
try:
|
|
1854
1927
|
command = MPMInitCommand(Path(project_path))
|
|
1855
1928
|
|
|
1856
|
-
result = command.
|
|
1857
|
-
summary=summary,
|
|
1858
|
-
accomplishments=list(accomplishment) if accomplishment else None,
|
|
1859
|
-
next_steps=list(next_step) if next_step else None,
|
|
1860
|
-
)
|
|
1929
|
+
result = command.handle_context(session_id=session_id, days=days)
|
|
1861
1930
|
|
|
1862
|
-
if result["status"] == "success":
|
|
1931
|
+
if result["status"] == "success" or result["status"] == "context_ready":
|
|
1863
1932
|
sys.exit(0)
|
|
1864
1933
|
else:
|
|
1865
1934
|
sys.exit(1)
|
|
1866
1935
|
|
|
1867
1936
|
except KeyboardInterrupt:
|
|
1868
|
-
console.print("\n[yellow]
|
|
1937
|
+
console.print("\n[yellow]Context analysis cancelled by user[/yellow]")
|
|
1869
1938
|
sys.exit(130)
|
|
1870
1939
|
except Exception as e:
|
|
1871
|
-
console.print(f"[red]
|
|
1940
|
+
console.print(f"[red]Context analysis failed: {e}[/red]")
|
|
1872
1941
|
sys.exit(1)
|
|
1873
1942
|
|
|
1874
1943
|
|
|
1875
|
-
|
|
1944
|
+
# Add deprecated 'resume' alias for backward compatibility
|
|
1945
|
+
@mpm_init.command(name="resume", hidden=True)
|
|
1876
1946
|
@click.option(
|
|
1877
1947
|
"--session-id",
|
|
1878
1948
|
"-i",
|
|
1879
1949
|
type=str,
|
|
1880
|
-
help="
|
|
1950
|
+
help="Unused (for compatibility) - will be removed in future version",
|
|
1951
|
+
)
|
|
1952
|
+
@click.option(
|
|
1953
|
+
"--days",
|
|
1954
|
+
type=int,
|
|
1955
|
+
default=7,
|
|
1956
|
+
help="Number of days of git history to analyze (default: 7)",
|
|
1881
1957
|
)
|
|
1882
1958
|
@click.argument(
|
|
1883
1959
|
"project_path",
|
|
@@ -1885,35 +1961,32 @@ def pause_session(summary, accomplishment, next_step, project_path):
|
|
|
1885
1961
|
required=False,
|
|
1886
1962
|
default=".",
|
|
1887
1963
|
)
|
|
1888
|
-
def resume_session(session_id, project_path):
|
|
1964
|
+
def resume_session(session_id, days, project_path):
|
|
1889
1965
|
"""
|
|
1890
|
-
|
|
1966
|
+
[DEPRECATED] Use 'context' instead.
|
|
1891
1967
|
|
|
1892
|
-
This command
|
|
1893
|
-
|
|
1894
|
-
- Checks for changes since the pause (commits, file changes, branch changes)
|
|
1895
|
-
- Displays warnings for any conflicts
|
|
1896
|
-
- Generates a complete context summary for seamless resumption
|
|
1897
|
-
|
|
1898
|
-
Examples:
|
|
1899
|
-
claude-mpm mpm-init resume
|
|
1900
|
-
claude-mpm mpm-init resume --session-id session-20251019-120000
|
|
1968
|
+
This command is deprecated and will be removed in a future version.
|
|
1969
|
+
Please use 'claude-mpm mpm-init context' instead.
|
|
1901
1970
|
"""
|
|
1971
|
+
console.print(
|
|
1972
|
+
"[yellow]⚠️ Warning: 'resume' is deprecated. Use 'context' instead.[/yellow]"
|
|
1973
|
+
)
|
|
1974
|
+
console.print("[dim]Run: claude-mpm mpm-init context[/dim]\n")
|
|
1975
|
+
|
|
1902
1976
|
try:
|
|
1903
1977
|
command = MPMInitCommand(Path(project_path))
|
|
1978
|
+
result = command.handle_context(session_id=session_id, days=days)
|
|
1904
1979
|
|
|
1905
|
-
result
|
|
1906
|
-
|
|
1907
|
-
if result["status"] == "success":
|
|
1980
|
+
if result["status"] == "success" or result["status"] == "context_ready":
|
|
1908
1981
|
sys.exit(0)
|
|
1909
1982
|
else:
|
|
1910
1983
|
sys.exit(1)
|
|
1911
1984
|
|
|
1912
1985
|
except KeyboardInterrupt:
|
|
1913
|
-
console.print("\n[yellow]
|
|
1986
|
+
console.print("\n[yellow]Context analysis cancelled by user[/yellow]")
|
|
1914
1987
|
sys.exit(130)
|
|
1915
1988
|
except Exception as e:
|
|
1916
|
-
console.print(f"[red]
|
|
1989
|
+
console.print(f"[red]Context analysis failed: {e}[/red]")
|
|
1917
1990
|
sys.exit(1)
|
|
1918
1991
|
|
|
1919
1992
|
|
|
@@ -25,31 +25,17 @@ def manage_mpm_init(args):
|
|
|
25
25
|
# Import the command implementation
|
|
26
26
|
from .mpm_init import MPMInitCommand
|
|
27
27
|
|
|
28
|
-
# Handle
|
|
28
|
+
# Handle context subcommands
|
|
29
29
|
subcommand = getattr(args, "subcommand", None)
|
|
30
30
|
|
|
31
|
-
if subcommand
|
|
32
|
-
#
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
command = MPMInitCommand(project_path)
|
|
31
|
+
if subcommand in ("context", "resume"):
|
|
32
|
+
# Show deprecation warning for 'resume'
|
|
33
|
+
if subcommand == "resume":
|
|
34
|
+
console.print(
|
|
35
|
+
"[yellow]⚠️ Warning: 'resume' is deprecated. Use 'context' instead.[/yellow]"
|
|
36
|
+
)
|
|
37
|
+
console.print("[dim]Run: claude-mpm mpm-init context[/dim]\n")
|
|
39
38
|
|
|
40
|
-
# Handle pause with optional arguments
|
|
41
|
-
result = command.handle_pause(
|
|
42
|
-
summary=getattr(args, "summary", None),
|
|
43
|
-
accomplishments=getattr(args, "accomplishment", None),
|
|
44
|
-
next_steps=getattr(args, "next_step", None),
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
# Return appropriate exit code
|
|
48
|
-
if result.get("status") == "success":
|
|
49
|
-
return 0
|
|
50
|
-
return 1
|
|
51
|
-
|
|
52
|
-
if subcommand == "resume":
|
|
53
39
|
# Get project path
|
|
54
40
|
project_path = (
|
|
55
41
|
Path(args.project_path) if hasattr(args, "project_path") else Path.cwd()
|
|
@@ -58,11 +44,14 @@ def manage_mpm_init(args):
|
|
|
58
44
|
# Create command instance
|
|
59
45
|
command = MPMInitCommand(project_path)
|
|
60
46
|
|
|
61
|
-
# Handle
|
|
62
|
-
result = command.
|
|
47
|
+
# Handle context with optional session ID and days
|
|
48
|
+
result = command.handle_context(
|
|
49
|
+
session_id=getattr(args, "session_id", None),
|
|
50
|
+
days=getattr(args, "days", 7),
|
|
51
|
+
)
|
|
63
52
|
|
|
64
53
|
# Return appropriate exit code
|
|
65
|
-
if result.get("status")
|
|
54
|
+
if result.get("status") in ("success", "context_ready"):
|
|
66
55
|
return 0
|
|
67
56
|
return 1
|
|
68
57
|
|