mirror of
https://github.com/SuperClaude-Org/SuperClaude_Framework.git
synced 2025-12-18 02:06:36 +00:00
* fix(orchestration): add WebFetch auto-trigger for infrastructure configuration Problem: Infrastructure configuration changes (e.g., Traefik port settings) were being made based on assumptions without consulting official documentation, violating the 'Evidence > assumptions' principle in PRINCIPLES.md. Solution: - Added Infrastructure Configuration Validation section to MODE_Orchestration.md - Auto-triggers WebFetch for infrastructure tools (Traefik, nginx, Docker, etc.) - Enforces MODE_DeepResearch activation for investigation - BLOCKS assumption-based configuration changes Testing: Verified WebFetch successfully retrieves Traefik official docs (port 80 default) This prevents production outages from infrastructure misconfiguration by ensuring all technical recommendations are backed by official documentation. * feat: Add PM Agent (Project Manager Agent) for seamless orchestration Introduces PM Agent as the default orchestration layer that coordinates all sub-agents and manages workflows automatically. Key Features: - Default orchestration: All user interactions handled by PM Agent - Auto-delegation: Intelligent sub-agent selection based on task analysis - Docker Gateway integration: Zero-token baseline with dynamic MCP loading - Self-improvement loop: Automatic documentation of patterns and mistakes - Optional override: Users can specify sub-agents explicitly if desired Architecture: - Agent spec: SuperClaude/Agents/pm-agent.md - Command: SuperClaude/Commands/pm.md - Updated docs: README.md (15→16 agents), agents.md (new Orchestration category) User Experience: - Default: PM Agent handles everything (seamless, no manual routing) - Optional: Explicit --agent flag for direct sub-agent access - Both modes available simultaneously (no user downside) Implementation Status: - ✅ Specification complete - ✅ Documentation complete - ⏳ Prototype implementation needed - ⏳ Docker Gateway integration needed - ⏳ Testing and validation needed Refs: kazukinakai/docker-mcp-gateway (IRIS MCP Gateway integration) * feat: Add Agent Orchestration rules for PM Agent default activation Implements PM Agent as the default orchestration layer in RULES.md. Key Changes: - New 'Agent Orchestration' section (CRITICAL priority) - PM Agent receives ALL user requests by default - Manual override with @agent-[name] bypasses PM Agent - Agent Selection Priority clearly defined: 1. Manual override → Direct routing 2. Default → PM Agent → Auto-delegation 3. Delegation based on keywords, file types, complexity, context User Experience: - Default: PM Agent handles everything (seamless) - Override: @agent-[name] for direct specialist access - Transparent: PM Agent reports delegation decisions This establishes PM Agent as the orchestration layer while respecting existing auto-activation patterns and manual overrides. Next Steps: - Local testing in agiletec project - Iteration based on actual behavior - Documentation updates as needed * refactor(pm-agent): redesign as self-improvement meta-layer Problem Resolution: PM Agent's initial design competed with existing auto-activation for task routing, creating confusion about orchestration responsibilities and adding unnecessary complexity. Design Change: Redefined PM Agent as a meta-layer agent that operates AFTER specialist agents complete tasks, focusing on: - Post-implementation documentation and pattern recording - Immediate mistake analysis with prevention checklists - Monthly documentation maintenance and noise reduction - Pattern extraction and knowledge synthesis Two-Layer Orchestration System: 1. Task Execution Layer: Existing auto-activation handles task routing (unchanged) 2. Self-Improvement Layer: PM Agent meta-layer handles documentation (new) Files Modified: - SuperClaude/Agents/pm-agent.md: Complete rewrite with meta-layer design - Category: orchestration → meta - Triggers: All user interactions → Post-implementation, mistakes, monthly - Behavioral Mindset: Continuous learning system - Self-Improvement Workflow: BEFORE/DURING/AFTER/MISTAKE RECOVERY/MAINTENANCE - SuperClaude/Core/RULES.md: Agent Orchestration section updated - Split into Task Execution Layer + Self-Improvement Layer - Added orchestration flow diagram - Clarified PM Agent activates AFTER task completion - README.md: Updated PM Agent description - "orchestrates all interactions" → "ensures continuous learning" - Docs/User-Guide/agents.md: PM Agent section rewritten - Section: Orchestration Agent → Meta-Layer Agent - Expertise: Project orchestration → Self-improvement workflow executor - Examples: Task coordination → Post-implementation documentation - PR_DOCUMENTATION.md: Comprehensive PR documentation added - Summary, motivation, changes, testing, breaking changes - Two-layer orchestration system diagram - Verification checklist Integration Validated: Tested with agiletec project's self-improvement-workflow.md: ✅ PM Agent aligns with existing BEFORE/DURING/AFTER/MISTAKE RECOVERY phases ✅ Complements (not competes with) existing workflow ✅ agiletec workflow defines WHAT, PM Agent defines WHO executes it Breaking Changes: None - Existing auto-activation continues unchanged - Specialist agents unaffected - User workflows remain the same - New capability: Automatic documentation and knowledge maintenance Value Proposition: Transforms SuperClaude into a continuously learning system that accumulates knowledge, prevents recurring mistakes, and maintains fresh documentation without manual intervention. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * docs: add Claude Code conversation history management research Research covering .jsonl file structure, performance impact, and retention policies. Content: - Claude Code .jsonl file format and message types - Performance issues from GitHub (memory leaks, conversation compaction) - Retention policies (consumer vs enterprise) - Rotation recommendations based on actual data - File history snapshot tracking mechanics Source: Moved from agiletec project (research applicable to all Claude Code projects) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: add Development documentation structure Phase 1: Documentation Structure complete - Add Docs/Development/ directory for development documentation - Add ARCHITECTURE.md - System architecture with PM Agent meta-layer - Add ROADMAP.md - 5-phase development plan with checkboxes - Add TASKS.md - Daily task tracking with progress indicators - Add PROJECT_STATUS.md - Current status dashboard and metrics - Add pm-agent-integration.md - Implementation guide for PM Agent mode This establishes comprehensive documentation foundation for: - System architecture understanding - Development planning and tracking - Implementation guidance - Progress visibility Related: #pm-agent-mode #documentation #phase-1 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: PM Agent session lifecycle and PDCA implementation Phase 2: PM Agent Mode Integration (Design Phase) Commands/pm.md updates: - Add "Always-Active Foundation Layer" concept - Add Session Lifecycle (Session Start/During Work/Session End) - Add PDCA Cycle (Plan/Do/Check/Act) automation - Add Serena MCP Memory Integration (list/read/write_memory) - Document auto-activation triggers Agents/pm-agent.md updates: - Add Session Start Protocol (MANDATORY auto-activation) - Add During Work PDCA Cycle with example workflows - Add Session End Protocol with state preservation - Add PDCA Self-Evaluation Pattern - Add Documentation Strategy (temp → patterns/mistakes) - Add Memory Operations Reference Key Features: - Session start auto-activation for context restoration - 30-minute checkpoint saves during work - Self-evaluation with think_about_* operations - Systematic documentation lifecycle - Knowledge evolution to CLAUDE.md Implementation Status: - ✅ Design complete (Commands/pm.md, Agents/pm-agent.md) - ⏳ Implementation pending (Core components) - ⏳ Serena MCP integration pending Salvaged from mistaken development in ~/.claude directory Related: #pm-agent-mode #session-lifecycle #pdca-cycle #phase-2 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: disable Serena MCP auto-browser launch Disable web dashboard and GUI log window auto-launch in Serena MCP server to prevent intrusive browser popups on startup. Users can still manually access the dashboard at http://localhost:24282/dashboard/ if needed. Changes: - Add CLI flags to Serena run command: - --enable-web-dashboard false - --enable-gui-log-window false - Ensures Git-tracked configuration (no reliance on ~/.serena/serena_config.yml) - Aligns with AIRIS MCP Gateway integration approach 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: rename directories to lowercase for PEP8 compliance - Rename superclaude/Agents -> superclaude/agents - Rename superclaude/Commands -> superclaude/commands - Rename superclaude/Core -> superclaude/core - Rename superclaude/Examples -> superclaude/examples - Rename superclaude/MCP -> superclaude/mcp - Rename superclaude/Modes -> superclaude/modes This change follows Python PEP8 naming conventions for package directories. * style: fix PEP8 violations and update package name to lowercase Changes: - Format all Python files with black (43 files reformatted) - Update package name from 'SuperClaude' to 'superclaude' in pyproject.toml - Fix import statements to use lowercase package name - Add missing imports (timedelta, __version__) - Remove old SuperClaude.egg-info directory PEP8 violations reduced from 2672 to 701 (mostly E501 line length due to black's 88 char vs flake8's 79 char limit). * docs: add PM Agent development documentation Add comprehensive PM Agent development documentation: - PM Agent ideal workflow (7-phase autonomous cycle) - Project structure understanding (Git vs installed environment) - Installation flow understanding (CommandsComponent behavior) - Task management system (current-tasks.md) Purpose: Eliminate repeated explanations and enable autonomous PDCA cycles 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * feat(pm-agent): add self-correcting execution and warning investigation culture ## Changes ### superclaude/commands/pm.md - Add "Self-Correcting Execution" section with root cause analysis protocol - Add "Warning/Error Investigation Culture" section enforcing zero-tolerance for dismissal - Define error detection protocol: STOP → Investigate → Hypothesis → Different Solution → Execute - Document anti-patterns (retry without understanding) and correct patterns (research-first) ### docs/Development/hypothesis-pm-autonomous-enhancement-2025-10-14.md - Add PDCA workflow hypothesis document for PM Agent autonomous enhancement ## Rationale PM Agent must never retry failed operations without understanding root causes. All warnings and errors require investigation via context7/WebFetch/documentation to ensure production-quality code and prevent technical debt accumulation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * feat(installer): add airis-mcp-gateway MCP server option ## Changes - Add airis-mcp-gateway to MCP server options in installer - Configuration: GitHub-based installation via uvx - Repository: https://github.com/oraios/airis-mcp-gateway - Purpose: Dynamic MCP Gateway for zero-token baseline and on-demand tool loading ## Implementation Added to setup/components/mcp.py self.mcp_servers dictionary with: - install_method: github - install_command: uvx test installation - run_command: uvx runtime execution - required: False (optional server) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: kazuki <kazuki@kazukinoMacBook-Air.local> Co-authored-by: Claude <noreply@anthropic.com>
341 lines
10 KiB
Python
341 lines
10 KiB
Python
#!/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
|
|
"""
|
|
|
|
import sys
|
|
import argparse
|
|
import subprocess
|
|
import difflib
|
|
from pathlib import Path
|
|
from typing import Dict, Callable
|
|
|
|
# Add the local 'setup' directory to the Python import path
|
|
current_dir = Path(__file__).parent
|
|
project_root = current_dir.parent
|
|
setup_dir = project_root / "setup"
|
|
|
|
# Insert the setup directory at the beginning of sys.path
|
|
if setup_dir.exists():
|
|
sys.path.insert(0, str(setup_dir.parent))
|
|
else:
|
|
print(f"Warning: Setup directory not found at {setup_dir}")
|
|
sys.exit(1)
|
|
|
|
|
|
# Try to import utilities from the setup package
|
|
try:
|
|
from setup.utils.ui import (
|
|
display_header,
|
|
display_info,
|
|
display_success,
|
|
display_error,
|
|
display_warning,
|
|
Colors,
|
|
display_authors,
|
|
)
|
|
from setup.utils.logger import setup_logging, get_logger, LogLevel
|
|
from setup import DEFAULT_INSTALL_DIR
|
|
except ImportError:
|
|
# Provide minimal fallback functions and constants if imports fail
|
|
class Colors:
|
|
RED = YELLOW = GREEN = CYAN = RESET = ""
|
|
|
|
def display_error(msg):
|
|
print(f"[ERROR] {msg}")
|
|
|
|
def display_warning(msg):
|
|
print(f"[WARN] {msg}")
|
|
|
|
def display_success(msg):
|
|
print(f"[OK] {msg}")
|
|
|
|
def display_info(msg):
|
|
print(f"[INFO] {msg}")
|
|
|
|
def display_header(title, subtitle):
|
|
print(f"{title} - {subtitle}")
|
|
|
|
def get_logger():
|
|
return None
|
|
|
|
def setup_logging(*args, **kwargs):
|
|
pass
|
|
|
|
class LogLevel:
|
|
ERROR = 40
|
|
INFO = 20
|
|
DEBUG = 10
|
|
|
|
|
|
def create_global_parser() -> argparse.ArgumentParser:
|
|
"""Create shared parser for global flags used by all commands"""
|
|
global_parser = argparse.ArgumentParser(add_help=False)
|
|
|
|
global_parser.add_argument(
|
|
"--verbose", "-v", action="store_true", help="Enable verbose logging"
|
|
)
|
|
global_parser.add_argument(
|
|
"--quiet", "-q", action="store_true", help="Suppress all output except errors"
|
|
)
|
|
global_parser.add_argument(
|
|
"--install-dir",
|
|
type=Path,
|
|
default=DEFAULT_INSTALL_DIR,
|
|
help=f"Target installation directory (default: {DEFAULT_INSTALL_DIR})",
|
|
)
|
|
global_parser.add_argument(
|
|
"--dry-run",
|
|
action="store_true",
|
|
help="Simulate operation without making changes",
|
|
)
|
|
global_parser.add_argument(
|
|
"--force", action="store_true", help="Force execution, skipping checks"
|
|
)
|
|
global_parser.add_argument(
|
|
"--yes",
|
|
"-y",
|
|
action="store_true",
|
|
help="Automatically answer yes to all prompts",
|
|
)
|
|
global_parser.add_argument(
|
|
"--no-update-check", action="store_true", help="Skip checking for updates"
|
|
)
|
|
global_parser.add_argument(
|
|
"--auto-update",
|
|
action="store_true",
|
|
help="Automatically install updates without prompting",
|
|
)
|
|
|
|
return global_parser
|
|
|
|
|
|
def create_parser():
|
|
"""Create the main CLI parser and attach subcommand parsers"""
|
|
global_parser = create_global_parser()
|
|
|
|
parser = argparse.ArgumentParser(
|
|
prog="SuperClaude",
|
|
description="SuperClaude Framework Management Hub - Unified CLI",
|
|
epilog="""
|
|
Examples:
|
|
SuperClaude install --dry-run
|
|
SuperClaude update --verbose
|
|
SuperClaude backup --create
|
|
""",
|
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
parents=[global_parser],
|
|
)
|
|
|
|
from superclaude import __version__
|
|
|
|
parser.add_argument(
|
|
"--version", action="version", version=f"SuperClaude {__version__}"
|
|
)
|
|
parser.add_argument(
|
|
"--authors", action="store_true", help="Show author information and exit"
|
|
)
|
|
|
|
subparsers = parser.add_subparsers(
|
|
dest="operation",
|
|
title="Operations",
|
|
description="Framework operations to perform",
|
|
)
|
|
|
|
return parser, subparsers, global_parser
|
|
|
|
|
|
def setup_global_environment(args: argparse.Namespace):
|
|
"""Set up logging and shared runtime environment based on args"""
|
|
# Determine log level
|
|
if args.quiet:
|
|
level = LogLevel.ERROR
|
|
elif args.verbose:
|
|
level = LogLevel.DEBUG
|
|
else:
|
|
level = LogLevel.INFO
|
|
|
|
# Define log directory unless it's a dry run
|
|
log_dir = args.install_dir / "logs" if not args.dry_run else None
|
|
setup_logging("superclaude_hub", log_dir=log_dir, console_level=level)
|
|
|
|
# Log startup context
|
|
logger = get_logger()
|
|
if logger:
|
|
logger.debug(
|
|
f"SuperClaude called with operation: {getattr(args, 'operation', 'None')}"
|
|
)
|
|
logger.debug(f"Arguments: {vars(args)}")
|
|
|
|
|
|
def get_operation_modules() -> Dict[str, str]:
|
|
"""Return supported operations and their descriptions"""
|
|
return {
|
|
"install": "Install SuperClaude framework components",
|
|
"update": "Update existing SuperClaude installation",
|
|
"uninstall": "Remove SuperClaude installation",
|
|
"backup": "Backup and restore operations",
|
|
}
|
|
|
|
|
|
def load_operation_module(name: str):
|
|
"""Try to dynamically import an operation module"""
|
|
try:
|
|
return __import__(f"setup.cli.commands.{name}", fromlist=[name])
|
|
except ImportError as e:
|
|
logger = get_logger()
|
|
if logger:
|
|
logger.error(f"Module '{name}' failed to load: {e}")
|
|
return None
|
|
|
|
|
|
def register_operation_parsers(subparsers, global_parser) -> Dict[str, Callable]:
|
|
"""Register subcommand parsers and map operation names to their run functions"""
|
|
operations = {}
|
|
for name, desc in get_operation_modules().items():
|
|
module = load_operation_module(name)
|
|
if module and hasattr(module, "register_parser") and hasattr(module, "run"):
|
|
module.register_parser(subparsers, global_parser)
|
|
operations[name] = module.run
|
|
else:
|
|
# If module doesn't exist, register a stub parser and fallback to legacy
|
|
parser = subparsers.add_parser(
|
|
name, help=f"{desc} (legacy fallback)", parents=[global_parser]
|
|
)
|
|
parser.add_argument(
|
|
"--legacy", action="store_true", help="Use legacy script"
|
|
)
|
|
operations[name] = None
|
|
return operations
|
|
|
|
|
|
def handle_legacy_fallback(op: str, args: argparse.Namespace) -> int:
|
|
"""Run a legacy operation script if module is unavailable"""
|
|
script_path = Path(__file__).parent / f"{op}.py"
|
|
|
|
if not script_path.exists():
|
|
display_error(f"No module or legacy script found for operation '{op}'")
|
|
return 1
|
|
|
|
display_warning(f"Falling back to legacy script for '{op}'...")
|
|
|
|
cmd = [sys.executable, str(script_path)]
|
|
|
|
# Convert args into CLI flags
|
|
for k, v in vars(args).items():
|
|
if k in ["operation", "install_dir"] or v in [None, False]:
|
|
continue
|
|
flag = f"--{k.replace('_', '-')}"
|
|
if v is True:
|
|
cmd.append(flag)
|
|
else:
|
|
cmd.extend([flag, str(v)])
|
|
|
|
try:
|
|
return subprocess.call(cmd)
|
|
except Exception as e:
|
|
display_error(f"Legacy execution failed: {e}")
|
|
return 1
|
|
|
|
|
|
def main() -> int:
|
|
"""Main entry point"""
|
|
try:
|
|
parser, subparsers, global_parser = create_parser()
|
|
operations = register_operation_parsers(subparsers, global_parser)
|
|
args = parser.parse_args()
|
|
|
|
# Handle --authors flag
|
|
if args.authors:
|
|
display_authors()
|
|
return 0
|
|
|
|
# Check for updates unless disabled
|
|
if not args.quiet and not getattr(args, "no_update_check", False):
|
|
try:
|
|
from setup.utils.updater import check_for_updates
|
|
|
|
# Check for updates in the background
|
|
from superclaude import __version__
|
|
|
|
updated = check_for_updates(
|
|
current_version=__version__,
|
|
auto_update=getattr(args, "auto_update", False),
|
|
)
|
|
# If updated, suggest restart
|
|
if updated:
|
|
print(
|
|
"\n🔄 SuperClaude was updated. Please restart to use the new version."
|
|
)
|
|
return 0
|
|
except ImportError:
|
|
# Updater module not available, skip silently
|
|
pass
|
|
except Exception:
|
|
# Any other error, skip silently
|
|
pass
|
|
|
|
# No operation provided? Show help manually unless in quiet mode
|
|
if not args.operation:
|
|
if not args.quiet:
|
|
from superclaude import __version__
|
|
|
|
display_header(
|
|
f"SuperClaude Framework v{__version__}",
|
|
"Unified CLI for all operations",
|
|
)
|
|
print(f"{Colors.CYAN}Available operations:{Colors.RESET}")
|
|
for op, desc in get_operation_modules().items():
|
|
print(f" {op:<12} {desc}")
|
|
return 0
|
|
|
|
# Handle unknown operations and suggest corrections
|
|
if args.operation not in operations:
|
|
close = difflib.get_close_matches(args.operation, operations.keys(), n=1)
|
|
suggestion = f"Did you mean: {close[0]}?" if close else ""
|
|
display_error(f"Unknown operation: '{args.operation}'. {suggestion}")
|
|
return 1
|
|
|
|
# Setup global context (logging, install path, etc.)
|
|
setup_global_environment(args)
|
|
logger = get_logger()
|
|
|
|
# Execute operation
|
|
run_func = operations.get(args.operation)
|
|
if run_func:
|
|
if logger:
|
|
logger.info(f"Executing operation: {args.operation}")
|
|
return run_func(args)
|
|
else:
|
|
# Fallback to legacy script
|
|
if logger:
|
|
logger.warning(
|
|
f"Module for '{args.operation}' missing, using legacy fallback"
|
|
)
|
|
return handle_legacy_fallback(args.operation, args)
|
|
|
|
except KeyboardInterrupt:
|
|
print(f"\n{Colors.YELLOW}Operation cancelled by user{Colors.RESET}")
|
|
return 130
|
|
except Exception as e:
|
|
try:
|
|
logger = get_logger()
|
|
if logger:
|
|
logger.exception(f"Unhandled error: {e}")
|
|
except:
|
|
print(f"{Colors.RED}[ERROR] {e}{Colors.RESET}")
|
|
return 1
|
|
|
|
|
|
# Entrypoint guard
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|