mirror of
https://github.com/SuperClaude-Org/SuperClaude_Framework.git
synced 2025-12-17 09:46:06 +00:00
Remove profile system and make custom two-stage selection default
- Remove profiles/ directory with all profile JSON files - Update install.py to remove profile CLI options and simplify flow - Make interactive two-stage selection (MCP → Components) the default - Remove ConfigManager.load_profile() method - Update documentation to reflect simplified installation process - Add CLAUDEMdManager for intelligent CLAUDE.md import management - Components now install to root directory with organized @imports - Preserve user customizations while managing framework imports This simplifies the installation experience while providing users direct control over what gets installed through the intuitive two-stage selection process. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9ace0619e2
commit
2e0f2cff6c
@ -180,60 +180,31 @@ SuperClaude install --quick
|
||||
|
||||
**Nervous about what it will do?** See first with:
|
||||
```bash
|
||||
SuperClaude install --quick --dry-run
|
||||
SuperClaude install --dry-run
|
||||
```
|
||||
|
||||
## Installation Options 🎯
|
||||
|
||||
We have three installation profiles to choose from:
|
||||
|
||||
### 🎯 Minimal Installation
|
||||
```bash
|
||||
SuperClaude install --minimal
|
||||
```
|
||||
- **What**: Just the core framework files
|
||||
- **Time**: ~1 minute
|
||||
- **Space**: ~20MB
|
||||
- **Good for**: Testing, basic enhancement, minimal setups
|
||||
- **Includes**: Core behavior documentation that guides Claude
|
||||
|
||||
### 🚀 Quick Installation (Recommended)
|
||||
```bash
|
||||
SuperClaude install --quick
|
||||
```
|
||||
- **What**: Core framework + 16 slash commands
|
||||
- **Time**: ~2 minutes
|
||||
- **Space**: ~50MB
|
||||
- **Good for**: Most users, general development
|
||||
- **Includes**: Everything in minimal + specialized commands like `/analyze`, `/build`, `/improve`
|
||||
|
||||
### 🪶 SuperClaude-Lite Installation (V4 Beta)
|
||||
```bash
|
||||
SuperClaude install --lite
|
||||
```
|
||||
- **What**: Streamlined version with core features only
|
||||
- **Time**: ~1 minute
|
||||
- **Space**: ~25MB
|
||||
- **Good for**: Resource-constrained environments, basic enhancement
|
||||
- **Includes**: Essential framework features without advanced orchestration
|
||||
|
||||
### 🔧 Developer Installation
|
||||
```bash
|
||||
SuperClaude install --profile developer
|
||||
```
|
||||
- **What**: Everything including MCP server integration + Hooks system
|
||||
- **Time**: ~5 minutes
|
||||
- **Space**: ~100MB
|
||||
- **Good for**: Power users, contributors, advanced workflows
|
||||
- **Includes**: Everything + Context7, Sequential, Magic, Playwright, Morphllm, Serena servers + Python hooks
|
||||
|
||||
### 🎛️ Interactive Installation
|
||||
### 🎛️ Interactive Two-Stage Installation (Default)
|
||||
```bash
|
||||
SuperClaude install
|
||||
```
|
||||
- Lets you pick and choose components
|
||||
- Shows detailed descriptions of what each component does
|
||||
- Good if you want control over what gets installed
|
||||
- **Stage 1**: Select MCP servers (Context7, Sequential, Magic, Playwright, etc.)
|
||||
- **Stage 2**: Choose framework components (Core, Commands, Agents, Modes)
|
||||
- **Time**: ~3-5 minutes depending on selections
|
||||
- **Space**: ~50-100MB depending on selections
|
||||
- **Good for**: All users - gives you full control over what gets installed
|
||||
- **Interactive**: Shows detailed descriptions and lets you pick exactly what you want
|
||||
|
||||
### 🎯 Component-Specific Installation
|
||||
```bash
|
||||
SuperClaude install --components core commands modes
|
||||
```
|
||||
- **What**: Install only specific components you need
|
||||
- **Time**: Variable based on selection
|
||||
- **Space**: Variable based on selection
|
||||
- **Good for**: Users who know exactly what they want
|
||||
- **Available components**: core, commands, agents, modes, mcp, mcp_docs
|
||||
|
||||
## Step-by-Step Installation 📋
|
||||
|
||||
@ -303,17 +274,17 @@ The installer is pretty smart and will guide you through the process:
|
||||
# See all available options
|
||||
SuperClaude install --help
|
||||
|
||||
# Quick installation (recommended)
|
||||
SuperClaude install --quick
|
||||
# Interactive installation (recommended)
|
||||
SuperClaude install
|
||||
|
||||
# Want to see what would happen first?
|
||||
SuperClaude install --quick --dry-run
|
||||
SuperClaude install --dry-run
|
||||
|
||||
# Install everything
|
||||
SuperClaude install --profile developer
|
||||
SuperClaude install --components core commands agents modes mcp mcp_docs
|
||||
|
||||
# Quiet installation (minimal output)
|
||||
SuperClaude install --quick --quiet
|
||||
SuperClaude install --quiet
|
||||
|
||||
# Force installation (skip confirmations)
|
||||
python3 SuperClaude.py install --quick --force
|
||||
@ -328,8 +299,8 @@ Here's what happens when you install:
|
||||
3. **Core Files** - Copies framework documentation files
|
||||
4. **Commands** - Installs slash command definitions (if selected)
|
||||
5. **MCP Servers** - Downloads and configures MCP servers (if selected)
|
||||
6. **Hooks System** - Installs Python hooks for framework coordination (developer profile)
|
||||
7. **Configuration** - Sets up `settings.json` with your preferences
|
||||
6. **Configuration** - Sets up framework settings and CLAUDE.md imports
|
||||
7. **Settings** - Sets up `settings.json` with your preferences
|
||||
8. **Validation** - Tests that everything works
|
||||
|
||||
The installer shows progress and will tell you if anything goes wrong.
|
||||
@ -378,7 +349,7 @@ SuperClaude V4 Beta installs to `~/.claude/` by default. Here's what you'll find
|
||||
```
|
||||
~/.claude/
|
||||
├── [above files] # Core framework files
|
||||
└── hooks/ # Python hooks system (developer profile)
|
||||
└── backups/ # Installation backups
|
||||
├── framework_coordinator/
|
||||
├── session_lifecycle/
|
||||
├── performance_monitor/
|
||||
@ -619,13 +590,10 @@ If you're planning to contribute or modify SuperClaude:
|
||||
|
||||
```bash
|
||||
# Developer installation with all components
|
||||
SuperClaude install --profile developer
|
||||
SuperClaude install --components core commands agents modes mcp mcp_docs
|
||||
|
||||
# Install in development mode (symlinks instead of copies)
|
||||
SuperClaude install --profile developer --dev-mode
|
||||
|
||||
# Install with git hooks for development
|
||||
SuperClaude install --profile developer --dev-hooks
|
||||
# Install in development mode
|
||||
SuperClaude install --dev-mode
|
||||
```
|
||||
|
||||
## What's Next? 🚀
|
||||
|
||||
200
ROADMAP.md
200
ROADMAP.md
@ -1,196 +1,4 @@
|
||||
# SuperClaude Roadmap 🗺️
|
||||
|
||||
A realistic look at where we are and where we're headed. No marketing fluff, just honest development plans.
|
||||
|
||||
## Where We Were (v3.0 - July 2024) 📍
|
||||
|
||||
SuperClaude v3 was our stable foundation release:
|
||||
|
||||
### ✅ What Worked Well in v3
|
||||
- **Installation Suite** - Completely rewritten and much more reliable
|
||||
- **Core Framework** - 9 documentation files that guide Claude's behavior
|
||||
- **15 Slash Commands** - Streamlined from 20+ to essential ones
|
||||
- **MCP Integration** - Context7, Sequential, Magic, Playwright (partially working)
|
||||
- **Unified CLI** - `SuperClaude.py` handles install/update/backup
|
||||
|
||||
### What v3 Taught Us
|
||||
- Framework approach was solid but needed more intelligence
|
||||
- MCP integration worked but could be much smoother
|
||||
- Command system was good but needed specialized capabilities
|
||||
- Session persistence was missing and badly needed
|
||||
|
||||
## Where We Are Now (v4.0 Beta - February 2025) 🎯
|
||||
|
||||
SuperClaude v4 represents a massive leap forward with intelligent agents and behavioral modes! 🚀
|
||||
|
||||
### ✅ What We've Accomplished
|
||||
- **Agent System** - 13 specialized domain experts replacing the persona system
|
||||
- **Behavioral Modes** - 4 intelligent modes (Brainstorming, Introspection, Task Management, Token Efficiency)
|
||||
- **Hooks System Redesigned** - Completely rebuilt with Python-based integration
|
||||
- **Session Lifecycle** - Cross-session persistence with /sc:load and /sc:save
|
||||
- **SuperClaude-Lite** - Lightweight implementation with YAML configuration
|
||||
- **Expanded Commands** - 21 commands (added brainstorm, reflect, save, select-tool)
|
||||
- **Enhanced MCP** - 6 servers including new Serena and Morphllm
|
||||
- **Quality Gates** - 8-step validation cycle
|
||||
- **Templates System** - Comprehensive templates for framework extension
|
||||
|
||||
### 🚀 What's Working Great
|
||||
- Session persistence across work sessions
|
||||
- Intelligent routing with specialized agents
|
||||
- Token efficiency (30-50% reduction)
|
||||
- Multi-layer task orchestration
|
||||
- Semantic code analysis with Serena
|
||||
|
||||
### ⚠️ Beta Considerations
|
||||
- Some edge cases in session restoration
|
||||
- MCP server coordination still being optimized
|
||||
- Documentation updates in progress
|
||||
- Performance tuning ongoing
|
||||
|
||||
## Short Term (v4.x) 🔧
|
||||
|
||||
Our immediate focus is stabilizing and polishing the V4 Beta:
|
||||
|
||||
### Beta Stabilization 🐛
|
||||
- Fix edge cases in session restoration
|
||||
- Optimize MCP server coordination
|
||||
- Improve error messages and debugging
|
||||
- Better handling of edge cases in agent routing
|
||||
|
||||
### Performance Optimization ⚡
|
||||
- Fine-tune MCP server coordination
|
||||
- Optimize session lifecycle operations
|
||||
- Improve token efficiency algorithms
|
||||
- Better resource management during wave orchestration
|
||||
|
||||
### Documentation & Polish 📝
|
||||
- Complete documentation updates for V4 features
|
||||
- User guides for new agent system
|
||||
- Examples of behavioral modes in action
|
||||
- Migration guide from V3 to V4
|
||||
|
||||
### Community Integration 👂
|
||||
- Gather feedback on new agent system
|
||||
- Refine behavioral modes based on usage
|
||||
- Prioritize stability fixes over new features
|
||||
- Build confidence in V4 architecture
|
||||
|
||||
## Medium Term (v4.5+) 🚀
|
||||
|
||||
Building on the solid V4 foundation:
|
||||
|
||||
### Advanced Intelligence 🧠
|
||||
- **Enhanced Agent Coordination** - Agents working together more seamlessly
|
||||
- **Predictive Mode Activation** - AI learns when to activate behavioral modes
|
||||
- **Cross-Session Learning** - Agents remember and adapt to user patterns
|
||||
- **Context-Aware Specialization** - Agents become more specialized to user domains
|
||||
|
||||
### Expanded Ecosystem 📦
|
||||
- **Community Agent Templates** - Framework for custom agent creation
|
||||
- **Third-Party MCP Integration** - Support for community MCP servers
|
||||
- **Plugin Architecture** - Easy extensibility for specialized workflows
|
||||
- **Agent Marketplace** - Discover and share specialized agents
|
||||
|
||||
### Enterprise Features 🏢
|
||||
- **Team Collaboration** - Shared sessions and agent configurations
|
||||
- **Organization Templates** - Company-specific agent and mode configurations
|
||||
- **Advanced Analytics** - Deep insights into development patterns
|
||||
- **Security & Compliance** - Enterprise-grade security features
|
||||
|
||||
### Quality & Performance 🎯
|
||||
- **Comprehensive Testing** - Full test suite for all V4 features
|
||||
- **Performance Monitoring** - Real-time performance analytics
|
||||
- **Advanced Error Recovery** - Self-healing session management
|
||||
- **Resource Optimization** - Minimal overhead for maximum capability
|
||||
|
||||
*Timeline: Mid to late 2025, building on V4 stability.*
|
||||
|
||||
## Long Term Vision (v5.0+) 🔮
|
||||
|
||||
Big ideas for the future, building on V4's intelligent foundation:
|
||||
|
||||
### Universal AI Enhancement Platform 🌐
|
||||
- **Multi-CLI Compatibility** - Port SuperClaude agents to other AI coding assistants
|
||||
- **Universal Agent Framework** - Agent system works across different AI platforms
|
||||
- **Cross-Platform Intelligence** - Behavioral modes portable between different tools
|
||||
- **Ecosystem Approach** - Not tied to single AI vendor or platform
|
||||
|
||||
### AI-Native Development Environment 🤖
|
||||
- **Ambient Intelligence** - AI assistance that feels natural and unobtrusive
|
||||
- **Predictive Workflows** - System anticipates needs based on context and history
|
||||
- **Self-Improving Agents** - Agents that learn and adapt to specific codebases
|
||||
- **Collaborative AI Teams** - Multiple AI agents working together on complex projects
|
||||
|
||||
### Next-Generation Features 🚀
|
||||
- **Visual Development Interface** - GUI that complements the CLI experience
|
||||
- **Advanced Context Synthesis** - AI understanding that spans entire codebases
|
||||
- **Autonomous Code Evolution** - AI-driven refactoring and architecture improvements
|
||||
- **Integration Ecosystem** - Deep integration with IDEs, version control, and deployment
|
||||
|
||||
### Enterprise & Research Applications 🏢
|
||||
- **AI Development Standards** - Industry-standard patterns for AI-assisted development
|
||||
- **Research Platform** - Framework for studying AI-human collaboration
|
||||
- **Open Source Foundation** - Community-driven evolution of AI development tools
|
||||
- **Educational Integration** - Teaching next-generation developers with AI assistance
|
||||
|
||||
*Timeline: 2026 and beyond - depends on how AI development evolves and V4 success.*
|
||||
|
||||
## How You Can Help 🤝
|
||||
|
||||
We're a small team and could really use community input:
|
||||
|
||||
### Right Now 🚨
|
||||
- **Report bugs** - Seriously, tell us what's broken
|
||||
- **Share feedback** - What works? What doesn't? What's missing?
|
||||
- **Try different setups** - Help us find compatibility issues
|
||||
- **Spread the word** - If you like it, tell other developers
|
||||
|
||||
### Ongoing 📋
|
||||
- **Feature requests** - What would make your workflow better?
|
||||
- **Documentation** - Help us explain things clearly
|
||||
- **Examples** - Share cool workflows you've discovered
|
||||
- **Code contributions** - PRs welcome for bug fixes
|
||||
|
||||
### Community Channels 💬
|
||||
- **GitHub Issues** - Bug reports and feature requests
|
||||
- **GitHub Discussions** - General feedback and ideas
|
||||
- **Pull Requests** - Code contributions and improvements
|
||||
|
||||
We read everything and try to respond thoughtfully.
|
||||
|
||||
## Staying Connected 📢
|
||||
|
||||
### How We Communicate 📡
|
||||
- **GitHub Releases** - Major updates and changelogs
|
||||
- **README updates** - Current status and key changes
|
||||
- **This roadmap** - Updated quarterly (hopefully)
|
||||
|
||||
### What to Expect 🔔
|
||||
- **Honest updates** - We'll tell you what's really happening
|
||||
- **No overpromising** - Realistic timelines and scope
|
||||
- **Community first** - Your feedback shapes our priorities
|
||||
- **Transparent development** - Open about challenges and decisions
|
||||
|
||||
### Roadmap Updates 🔄
|
||||
We'll update this roadmap roughly every few months based on:
|
||||
- How v3 is actually performing in the wild
|
||||
- What the community is asking for
|
||||
- Technical challenges we discover
|
||||
- Changes in the AI development landscape
|
||||
- Our own capacity and priorities
|
||||
|
||||
---
|
||||
|
||||
## Final Thoughts 💭
|
||||
|
||||
SuperClaude started as a way to make Claude Code more useful for developers. With V4 Beta, we feel we've achieved something special - intelligent agents that truly understand development contexts and behavioral modes that adapt to how you work.
|
||||
|
||||
The agent system and session persistence represent a fundamental shift in how AI can assist development. We're excited about what V4 enables, but we know there's still work to do to make it rock-solid.
|
||||
|
||||
The most important thing is building something that actually helps people get their work done better. If you're using SuperClaude V4 and the intelligent agents are making your development workflow smoother, that's awesome. If you're hitting beta issues or the new features aren't clicking, please tell us why.
|
||||
|
||||
We're in this for the long haul, and V4 represents our vision of what AI-assisted development can become. Your feedback is crucial for making that vision a reality.
|
||||
|
||||
Thanks for being part of this journey and helping us test the future of AI development tools! 🙏
|
||||
|
||||
---
|
||||
Better installation process
|
||||
/plugin official anthropic claude code feature implementation
|
||||
output style official anthropic claude code feature customization
|
||||
Wiki and better documentation
|
||||
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
SuperClaude Framework Management Hub
|
||||
Unified entry point for all SuperClaude operations
|
||||
|
||||
Usage:
|
||||
SuperClaude install [options]
|
||||
SuperClaude update [options]
|
||||
SuperClaude uninstall [options]
|
||||
SuperClaude backup [options]
|
||||
SuperClaude --help
|
||||
"""
|
||||
@ -1,20 +0,0 @@
|
||||
{
|
||||
"name": "Developer Installation",
|
||||
"description": "Full installation with all components including MCP servers",
|
||||
"components": [
|
||||
"core",
|
||||
"commands",
|
||||
"agents",
|
||||
"modes",
|
||||
"mcp",
|
||||
"mcp_docs"
|
||||
],
|
||||
"features": {
|
||||
"auto_update": false,
|
||||
"backup_enabled": true,
|
||||
"validation_level": "comprehensive"
|
||||
},
|
||||
"target_users": ["developers", "power_users"],
|
||||
"estimated_time_minutes": 5,
|
||||
"disk_space_mb": 100
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
{
|
||||
"name": "Minimal Installation",
|
||||
"description": "Core framework files only",
|
||||
"components": [
|
||||
"core"
|
||||
],
|
||||
"features": {
|
||||
"auto_update": false,
|
||||
"backup_enabled": true,
|
||||
"validation_level": "basic"
|
||||
},
|
||||
"target_users": ["testing", "basic"],
|
||||
"estimated_time_minutes": 1,
|
||||
"disk_space_mb": 20
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
{
|
||||
"name": "Quick Installation",
|
||||
"description": "Recommended installation with core framework and essential components",
|
||||
"components": [
|
||||
"core",
|
||||
"commands",
|
||||
"agents",
|
||||
"modes"
|
||||
],
|
||||
"features": {
|
||||
"auto_update": false,
|
||||
"backup_enabled": true,
|
||||
"validation_level": "standard"
|
||||
},
|
||||
"target_users": ["general", "developers"],
|
||||
"estimated_time_minutes": 2,
|
||||
"disk_space_mb": 50
|
||||
}
|
||||
@ -12,7 +12,6 @@ from pathlib import Path
|
||||
SETUP_DIR = Path(__file__).parent
|
||||
PROJECT_ROOT = SETUP_DIR.parent
|
||||
CONFIG_DIR = PROJECT_ROOT / "config"
|
||||
PROFILES_DIR = PROJECT_ROOT / "profiles"
|
||||
|
||||
# Installation target
|
||||
DEFAULT_INSTALL_DIR = Path.home() / ".claude"
|
||||
@ -7,6 +7,7 @@ from pathlib import Path
|
||||
import shutil
|
||||
|
||||
from ..base.component import Component
|
||||
from ..managers.claude_md_manager import CLAUDEMdManager
|
||||
|
||||
class CoreComponent(Component):
|
||||
"""Core SuperClaude framework files component"""
|
||||
@ -77,6 +78,15 @@ class CoreComponent(Component):
|
||||
dir_path = self.install_dir / dirname
|
||||
if not self.file_manager.ensure_directory(dir_path):
|
||||
self.logger.warning(f"Could not create directory: {dir_path}")
|
||||
|
||||
# Update CLAUDE.md with core framework imports
|
||||
try:
|
||||
manager = CLAUDEMdManager(self.install_dir)
|
||||
manager.add_imports(self.component_files, category="Core Framework")
|
||||
self.logger.info("Updated CLAUDE.md with core framework imports")
|
||||
except Exception as e:
|
||||
self.logger.warning(f"Failed to update CLAUDE.md with core framework imports: {e}")
|
||||
# Don't fail the whole installation for this
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ from typing import Dict, List, Tuple, Optional, Any
|
||||
from pathlib import Path
|
||||
|
||||
from ..base.component import Component
|
||||
from ..managers.claude_md_manager import CLAUDEMdManager
|
||||
|
||||
|
||||
class MCPDocsComponent(Component):
|
||||
@ -13,7 +14,7 @@ class MCPDocsComponent(Component):
|
||||
|
||||
def __init__(self, install_dir: Optional[Path] = None):
|
||||
"""Initialize MCP docs component"""
|
||||
super().__init__(install_dir, Path("mcp"))
|
||||
super().__init__(install_dir, Path(""))
|
||||
|
||||
# Map server names to documentation files
|
||||
self.server_docs_map = {
|
||||
@ -57,7 +58,7 @@ class MCPDocsComponent(Component):
|
||||
if server_name in self.server_docs_map:
|
||||
doc_file = self.server_docs_map[server_name]
|
||||
source = source_dir / doc_file
|
||||
target = self.install_component_subdir / doc_file
|
||||
target = self.install_dir / doc_file
|
||||
if source.exists():
|
||||
files.append((source, target))
|
||||
self.logger.debug(f"Will install documentation for {server_name}: {doc_file}")
|
||||
@ -143,6 +144,15 @@ class MCPDocsComponent(Component):
|
||||
self.settings_manager.update_metadata(metadata_mods)
|
||||
self.logger.info("Updated metadata with MCP docs component registration")
|
||||
|
||||
# Update CLAUDE.md with MCP documentation imports
|
||||
try:
|
||||
manager = CLAUDEMdManager(self.install_dir)
|
||||
manager.add_imports(self.component_files, category="MCP Documentation")
|
||||
self.logger.info("Updated CLAUDE.md with MCP documentation imports")
|
||||
except Exception as e:
|
||||
self.logger.warning(f"Failed to update CLAUDE.md with MCP documentation imports: {e}")
|
||||
# Don't fail the whole installation for this
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
self.logger.error(f"Failed to update metadata: {e}")
|
||||
|
||||
@ -6,6 +6,7 @@ from typing import Dict, List, Tuple, Optional, Any
|
||||
from pathlib import Path
|
||||
|
||||
from ..base.component import Component
|
||||
from ..managers.claude_md_manager import CLAUDEMdManager
|
||||
|
||||
|
||||
class ModesComponent(Component):
|
||||
@ -13,7 +14,7 @@ class ModesComponent(Component):
|
||||
|
||||
def __init__(self, install_dir: Optional[Path] = None):
|
||||
"""Initialize modes component"""
|
||||
super().__init__(install_dir, Path("modes"))
|
||||
super().__init__(install_dir, Path(""))
|
||||
|
||||
def get_metadata(self) -> Dict[str, str]:
|
||||
"""Get component metadata"""
|
||||
@ -77,6 +78,15 @@ class ModesComponent(Component):
|
||||
self.settings_manager.update_metadata(metadata_mods)
|
||||
self.logger.info("Updated metadata with modes component registration")
|
||||
|
||||
# Update CLAUDE.md with mode imports
|
||||
try:
|
||||
manager = CLAUDEMdManager(self.install_dir)
|
||||
manager.add_imports(self.component_files, category="Behavioral Modes")
|
||||
self.logger.info("Updated CLAUDE.md with mode imports")
|
||||
except Exception as e:
|
||||
self.logger.warning(f"Failed to update CLAUDE.md with mode imports: {e}")
|
||||
# Don't fail the whole installation for this
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
self.logger.error(f"Failed to update metadata: {e}")
|
||||
|
||||
316
setup/managers/claude_md_manager.py
Normal file
316
setup/managers/claude_md_manager.py
Normal file
@ -0,0 +1,316 @@
|
||||
"""
|
||||
CLAUDE.md Manager for preserving user customizations while managing framework imports
|
||||
"""
|
||||
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import List, Set, Dict, Optional
|
||||
from ..utils.logger import get_logger
|
||||
|
||||
|
||||
class CLAUDEMdManager:
|
||||
"""Manages CLAUDE.md file updates while preserving user customizations"""
|
||||
|
||||
def __init__(self, install_dir: Path):
|
||||
"""
|
||||
Initialize CLAUDEMdManager
|
||||
|
||||
Args:
|
||||
install_dir: Installation directory (typically ~/.claude)
|
||||
"""
|
||||
self.install_dir = install_dir
|
||||
self.claude_md_path = install_dir / "CLAUDE.md"
|
||||
self.logger = get_logger()
|
||||
|
||||
def read_existing_imports(self) -> Set[str]:
|
||||
"""
|
||||
Parse CLAUDE.md for existing @import statements
|
||||
|
||||
Returns:
|
||||
Set of already imported filenames (without @)
|
||||
"""
|
||||
existing_imports = set()
|
||||
|
||||
if not self.claude_md_path.exists():
|
||||
return existing_imports
|
||||
|
||||
try:
|
||||
with open(self.claude_md_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# Find all @import statements using regex
|
||||
import_pattern = r'^@([^\s\n]+\.md)\s*$'
|
||||
matches = re.findall(import_pattern, content, re.MULTILINE)
|
||||
existing_imports.update(matches)
|
||||
|
||||
self.logger.debug(f"Found existing imports: {existing_imports}")
|
||||
|
||||
except Exception as e:
|
||||
self.logger.warning(f"Could not read existing CLAUDE.md imports: {e}")
|
||||
|
||||
return existing_imports
|
||||
|
||||
def read_existing_content(self) -> str:
|
||||
"""
|
||||
Read existing CLAUDE.md content
|
||||
|
||||
Returns:
|
||||
Existing content or empty string if file doesn't exist
|
||||
"""
|
||||
if not self.claude_md_path.exists():
|
||||
return ""
|
||||
|
||||
try:
|
||||
with open(self.claude_md_path, 'r', encoding='utf-8') as f:
|
||||
return f.read()
|
||||
except Exception as e:
|
||||
self.logger.warning(f"Could not read existing CLAUDE.md: {e}")
|
||||
return ""
|
||||
|
||||
def extract_user_content(self, content: str) -> str:
|
||||
"""
|
||||
Extract user content (everything before framework imports section)
|
||||
|
||||
Args:
|
||||
content: Full CLAUDE.md content
|
||||
|
||||
Returns:
|
||||
User content without framework imports
|
||||
"""
|
||||
# Look for framework imports section marker
|
||||
framework_marker = "# ═══════════════════════════════════════════════════\n# SuperClaude Framework Components"
|
||||
|
||||
if framework_marker in content:
|
||||
user_content = content.split(framework_marker)[0].rstrip()
|
||||
else:
|
||||
# If no framework section exists, preserve all content
|
||||
user_content = content.rstrip()
|
||||
|
||||
return user_content
|
||||
|
||||
def organize_imports_by_category(self, files_by_category: Dict[str, List[str]]) -> str:
|
||||
"""
|
||||
Organize imports into categorized sections
|
||||
|
||||
Args:
|
||||
files_by_category: Dict mapping category names to lists of files
|
||||
|
||||
Returns:
|
||||
Formatted import sections
|
||||
"""
|
||||
if not files_by_category:
|
||||
return ""
|
||||
|
||||
sections = []
|
||||
|
||||
# Framework imports section header
|
||||
sections.append("# ═══════════════════════════════════════════════════")
|
||||
sections.append("# SuperClaude Framework Components")
|
||||
sections.append("# ═══════════════════════════════════════════════════")
|
||||
sections.append("")
|
||||
|
||||
# Add each category
|
||||
for category, files in files_by_category.items():
|
||||
if files:
|
||||
sections.append(f"# {category}")
|
||||
for file in sorted(files):
|
||||
sections.append(f"@{file}")
|
||||
sections.append("")
|
||||
|
||||
return "\n".join(sections)
|
||||
|
||||
def add_imports(self, files: List[str], category: str = "Framework") -> bool:
|
||||
"""
|
||||
Add new imports with duplicate checking and user content preservation
|
||||
|
||||
Args:
|
||||
files: List of filenames to import
|
||||
category: Category name for organizing imports
|
||||
|
||||
Returns:
|
||||
True if successful, False otherwise
|
||||
"""
|
||||
try:
|
||||
# Ensure CLAUDE.md exists
|
||||
self.ensure_claude_md_exists()
|
||||
|
||||
# Read existing content and imports
|
||||
existing_content = self.read_existing_content()
|
||||
existing_imports = self.read_existing_imports()
|
||||
|
||||
# Filter out files already imported
|
||||
new_files = [f for f in files if f not in existing_imports]
|
||||
|
||||
if not new_files:
|
||||
self.logger.info("All files already imported, no changes needed")
|
||||
return True
|
||||
|
||||
self.logger.info(f"Adding {len(new_files)} new imports to category '{category}': {new_files}")
|
||||
|
||||
# Extract user content (preserve everything before framework section)
|
||||
user_content = self.extract_user_content(existing_content)
|
||||
|
||||
# Parse existing framework imports by category
|
||||
existing_framework_imports = self._parse_existing_framework_imports(existing_content)
|
||||
|
||||
# Add new files to the specified category
|
||||
if category not in existing_framework_imports:
|
||||
existing_framework_imports[category] = []
|
||||
existing_framework_imports[category].extend(new_files)
|
||||
|
||||
# Build new content
|
||||
new_content_parts = []
|
||||
|
||||
# Add user content
|
||||
if user_content.strip():
|
||||
new_content_parts.append(user_content)
|
||||
new_content_parts.append("") # Add blank line before framework section
|
||||
|
||||
# Add organized framework imports
|
||||
framework_section = self.organize_imports_by_category(existing_framework_imports)
|
||||
if framework_section:
|
||||
new_content_parts.append(framework_section)
|
||||
|
||||
# Write updated content
|
||||
new_content = "\n".join(new_content_parts)
|
||||
|
||||
with open(self.claude_md_path, 'w', encoding='utf-8') as f:
|
||||
f.write(new_content)
|
||||
|
||||
self.logger.success(f"Updated CLAUDE.md with {len(new_files)} new imports")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
self.logger.error(f"Failed to update CLAUDE.md: {e}")
|
||||
return False
|
||||
|
||||
def _parse_existing_framework_imports(self, content: str) -> Dict[str, List[str]]:
|
||||
"""
|
||||
Parse existing framework imports organized by category
|
||||
|
||||
Args:
|
||||
content: Full CLAUDE.md content
|
||||
|
||||
Returns:
|
||||
Dict mapping category names to lists of imported files
|
||||
"""
|
||||
imports_by_category = {}
|
||||
|
||||
# Look for framework imports section
|
||||
framework_marker = "# ═══════════════════════════════════════════════════\n# SuperClaude Framework Components"
|
||||
|
||||
if framework_marker not in content:
|
||||
return imports_by_category
|
||||
|
||||
# Extract framework section
|
||||
framework_section = content.split(framework_marker)[1] if framework_marker in content else ""
|
||||
|
||||
# Parse categories and imports
|
||||
lines = framework_section.split('\n')
|
||||
current_category = None
|
||||
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
|
||||
# Skip section header lines and empty lines
|
||||
if line.startswith('# ═══') or not line:
|
||||
continue
|
||||
|
||||
# Category header (starts with # but not the section divider)
|
||||
if line.startswith('# ') and not line.startswith('# ═══'):
|
||||
current_category = line[2:].strip() # Remove "# "
|
||||
if current_category not in imports_by_category:
|
||||
imports_by_category[current_category] = []
|
||||
|
||||
# Import line (starts with @)
|
||||
elif line.startswith('@') and current_category:
|
||||
import_file = line[1:].strip() # Remove "@"
|
||||
if import_file not in imports_by_category[current_category]:
|
||||
imports_by_category[current_category].append(import_file)
|
||||
|
||||
return imports_by_category
|
||||
|
||||
def ensure_claude_md_exists(self) -> None:
|
||||
"""
|
||||
Create CLAUDE.md with default content if it doesn't exist
|
||||
"""
|
||||
if self.claude_md_path.exists():
|
||||
return
|
||||
|
||||
try:
|
||||
# Create directory if it doesn't exist
|
||||
self.claude_md_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Default CLAUDE.md content
|
||||
default_content = """# SuperClaude Entry Point
|
||||
|
||||
This file serves as the entry point for the SuperClaude framework.
|
||||
You can add your own custom instructions and configurations here.
|
||||
|
||||
The SuperClaude framework components will be automatically imported below.
|
||||
"""
|
||||
|
||||
with open(self.claude_md_path, 'w', encoding='utf-8') as f:
|
||||
f.write(default_content)
|
||||
|
||||
self.logger.info("Created CLAUDE.md with default content")
|
||||
|
||||
except Exception as e:
|
||||
self.logger.error(f"Failed to create CLAUDE.md: {e}")
|
||||
raise
|
||||
|
||||
def remove_imports(self, files: List[str]) -> bool:
|
||||
"""
|
||||
Remove specific imports from CLAUDE.md
|
||||
|
||||
Args:
|
||||
files: List of filenames to remove from imports
|
||||
|
||||
Returns:
|
||||
True if successful, False otherwise
|
||||
"""
|
||||
try:
|
||||
if not self.claude_md_path.exists():
|
||||
return True # Nothing to remove
|
||||
|
||||
existing_content = self.read_existing_content()
|
||||
user_content = self.extract_user_content(existing_content)
|
||||
existing_framework_imports = self._parse_existing_framework_imports(existing_content)
|
||||
|
||||
# Remove files from all categories
|
||||
removed_any = False
|
||||
for category, category_files in existing_framework_imports.items():
|
||||
for file in files:
|
||||
if file in category_files:
|
||||
category_files.remove(file)
|
||||
removed_any = True
|
||||
|
||||
# Remove empty categories
|
||||
existing_framework_imports = {k: v for k, v in existing_framework_imports.items() if v}
|
||||
|
||||
if not removed_any:
|
||||
return True # Nothing was removed
|
||||
|
||||
# Rebuild content
|
||||
new_content_parts = []
|
||||
|
||||
if user_content.strip():
|
||||
new_content_parts.append(user_content)
|
||||
new_content_parts.append("")
|
||||
|
||||
framework_section = self.organize_imports_by_category(existing_framework_imports)
|
||||
if framework_section:
|
||||
new_content_parts.append(framework_section)
|
||||
|
||||
# Write updated content
|
||||
new_content = "\n".join(new_content_parts)
|
||||
|
||||
with open(self.claude_md_path, 'w', encoding='utf-8') as f:
|
||||
f.write(new_content)
|
||||
|
||||
self.logger.info(f"Removed {len(files)} imports from CLAUDE.md")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
self.logger.error(f"Failed to remove imports from CLAUDE.md: {e}")
|
||||
return False
|
||||
@ -278,47 +278,6 @@ class ConfigManager:
|
||||
return component_info.get("dependencies", [])
|
||||
return []
|
||||
|
||||
def load_profile(self, profile_path: Path) -> Dict[str, Any]:
|
||||
"""
|
||||
Load installation profile
|
||||
|
||||
Args:
|
||||
profile_path: Path to profile JSON file
|
||||
|
||||
Returns:
|
||||
Profile configuration dict
|
||||
|
||||
Raises:
|
||||
FileNotFoundError: If profile not found
|
||||
ValidationError: If profile is invalid
|
||||
"""
|
||||
if not profile_path.exists():
|
||||
raise FileNotFoundError(f"Profile not found: {profile_path}")
|
||||
|
||||
try:
|
||||
with open(profile_path, 'r') as f:
|
||||
profile = json.load(f)
|
||||
|
||||
# Basic validation
|
||||
if "components" not in profile:
|
||||
raise ValidationError("Profile must contain 'components' field")
|
||||
|
||||
if not isinstance(profile["components"], list):
|
||||
raise ValidationError("Profile 'components' must be a list")
|
||||
|
||||
# Validate that all components exist
|
||||
features = self.load_features()
|
||||
available_components = set(features.get("components", {}).keys())
|
||||
|
||||
for component in profile["components"]:
|
||||
if component not in available_components:
|
||||
raise ValidationError(f"Unknown component in profile: {component}")
|
||||
|
||||
return profile
|
||||
|
||||
except json.JSONDecodeError as e:
|
||||
raise ValidationError(f"Invalid JSON in {profile_path}: {e}")
|
||||
|
||||
def get_system_requirements(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Get system requirements
|
||||
|
||||
@ -40,8 +40,7 @@ def register_parser(subparsers, global_parser=None) -> argparse.ArgumentParser:
|
||||
epilog="""
|
||||
Examples:
|
||||
SuperClaude install # Interactive installation
|
||||
SuperClaude install --quick --dry-run # Quick installation (dry-run)
|
||||
SuperClaude install --profile developer # Developer profile
|
||||
SuperClaude install --dry-run # Dry-run mode
|
||||
SuperClaude install --components core mcp # Specific components
|
||||
SuperClaude install --verbose --force # Verbose with force mode
|
||||
""",
|
||||
@ -50,23 +49,6 @@ Examples:
|
||||
)
|
||||
|
||||
# Installation mode options
|
||||
parser.add_argument(
|
||||
"--quick",
|
||||
action="store_true",
|
||||
help="Quick installation with pre-selected components"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--minimal",
|
||||
action="store_true",
|
||||
help="Minimal installation (core only)"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--profile",
|
||||
type=str,
|
||||
help="Installation profile (quick, minimal, developer, etc.)"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--components",
|
||||
@ -141,31 +123,7 @@ def get_components_to_install(args: argparse.Namespace, registry: ComponentRegis
|
||||
return ["core", "commands", "agents", "modes", "mcp", "mcp_docs"]
|
||||
return args.components
|
||||
|
||||
# Profile-based selection
|
||||
if args.profile:
|
||||
try:
|
||||
profile_path = PROJECT_ROOT / "profiles" / f"{args.profile}.json"
|
||||
profile = config_manager.load_profile(profile_path)
|
||||
return profile["components"]
|
||||
except Exception as e:
|
||||
logger.error(f"Could not load profile '{args.profile}': {e}")
|
||||
return None
|
||||
|
||||
# Quick installation
|
||||
if args.quick:
|
||||
try:
|
||||
profile_path = PROJECT_ROOT / "profiles" / "quick.json"
|
||||
profile = config_manager.load_profile(profile_path)
|
||||
return profile["components"]
|
||||
except Exception as e:
|
||||
logger.warning(f"Could not load quick profile: {e}")
|
||||
return ["core"] # Fallback to core only
|
||||
|
||||
# Minimal installation
|
||||
if args.minimal:
|
||||
return ["core"]
|
||||
|
||||
# Interactive selection
|
||||
# Interactive two-stage selection
|
||||
return interactive_component_selection(registry, config_manager)
|
||||
|
||||
|
||||
@ -299,43 +257,21 @@ def interactive_component_selection(registry: ComponentRegistry, config_manager:
|
||||
logger = get_logger()
|
||||
|
||||
try:
|
||||
# Add preset options first
|
||||
preset_options = [
|
||||
"Quick Installation (recommended components)",
|
||||
"Minimal Installation (core only)",
|
||||
"Custom Two-Stage Selection"
|
||||
]
|
||||
print(f"\n{Colors.CYAN}SuperClaude Interactive Installation{Colors.RESET}")
|
||||
print(f"{Colors.BLUE}Select components to install using the two-stage process:{Colors.RESET}")
|
||||
|
||||
print(f"\n{Colors.CYAN}SuperClaude Installation Options:{Colors.RESET}")
|
||||
menu = Menu("Select installation type:", preset_options)
|
||||
choice = menu.display()
|
||||
# Stage 1: MCP Server Selection
|
||||
selected_mcp_servers = select_mcp_servers(registry)
|
||||
|
||||
if choice == -1: # Cancelled
|
||||
return None
|
||||
elif choice == 0: # Quick
|
||||
try:
|
||||
profile_path = PROJECT_ROOT / "profiles" / "quick.json"
|
||||
profile = config_manager.load_profile(profile_path)
|
||||
return profile["components"]
|
||||
except Exception:
|
||||
return ["core"]
|
||||
elif choice == 1: # Minimal
|
||||
return ["core"]
|
||||
elif choice == 2: # Custom Two-Stage
|
||||
# Stage 1: MCP Server Selection
|
||||
selected_mcp_servers = select_mcp_servers(registry)
|
||||
|
||||
# Stage 2: Framework Component Selection
|
||||
selected_components = select_framework_components(registry, config_manager, selected_mcp_servers)
|
||||
|
||||
# Store selected MCP servers for components to use
|
||||
if not hasattr(config_manager, '_installation_context'):
|
||||
config_manager._installation_context = {}
|
||||
config_manager._installation_context["selected_mcp_servers"] = selected_mcp_servers
|
||||
|
||||
return selected_components
|
||||
# Stage 2: Framework Component Selection
|
||||
selected_components = select_framework_components(registry, config_manager, selected_mcp_servers)
|
||||
|
||||
return None
|
||||
# Store selected MCP servers for components to use
|
||||
if not hasattr(config_manager, '_installation_context'):
|
||||
config_manager._installation_context = {}
|
||||
config_manager._installation_context["selected_mcp_servers"] = selected_mcp_servers
|
||||
|
||||
return selected_components
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error in component selection: {e}")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user