mirror of
https://github.com/SuperClaude-Org/SuperClaude_Framework.git
synced 2025-12-17 09:46:06 +00:00
Fix update command and installer logic
This change fixes several issues with the `update` command and the installer: - Corrects the `update` command logic in `setup/cli/commands/update.py`. - Fixes the `update` logic in `setup/core/installer.py` to correctly handle re-installation of components. - Corrects the installation of MCP servers in `setup/components/mcp.py`. Co-authored-by: Mithun Gowda B <mithungowda.b7411@gmail.com> Co-authored-by: jules <jules@users.noreply.github.com>
This commit is contained in:
parent
04af377f24
commit
ebf72715ae
@ -19,7 +19,7 @@ from ...utils.ui import (
|
||||
)
|
||||
from ...utils.environment import setup_environment_variables
|
||||
from ...utils.logger import get_logger
|
||||
from ... import DEFAULT_INSTALL_DIR, PROJECT_ROOT
|
||||
from ... import DEFAULT_INSTALL_DIR, PROJECT_ROOT, DATA_DIR
|
||||
from . import OperationBase
|
||||
|
||||
|
||||
@ -275,7 +275,7 @@ def display_update_plan(components: List[str], available_updates: Dict[str, Dict
|
||||
print()
|
||||
|
||||
|
||||
def perform_update(components: List[str], args: argparse.Namespace) -> bool:
|
||||
def perform_update(components: List[str], args: argparse.Namespace, registry: ComponentRegistry) -> bool:
|
||||
"""Perform the actual update"""
|
||||
logger = get_logger()
|
||||
start_time = time.time()
|
||||
@ -284,10 +284,6 @@ def perform_update(components: List[str], args: argparse.Namespace) -> bool:
|
||||
# Create installer
|
||||
installer = Installer(args.install_dir, dry_run=args.dry_run)
|
||||
|
||||
# Create component registry
|
||||
registry = ComponentRegistry(PROJECT_ROOT / "setup" / "components")
|
||||
registry.discover_components()
|
||||
|
||||
# Create component instances
|
||||
component_instances = registry.create_component_instances(components, args.install_dir)
|
||||
|
||||
@ -384,6 +380,9 @@ def run(args: argparse.Namespace) -> int:
|
||||
operation = UpdateOperation()
|
||||
operation.setup_operation_logging(args)
|
||||
logger = get_logger()
|
||||
|
||||
from setup.cli.base import __version__
|
||||
|
||||
# ✅ Inserted validation code
|
||||
expected_home = Path.home().resolve()
|
||||
actual_dir = args.install_dir.resolve()
|
||||
@ -457,7 +456,7 @@ def run(args: argparse.Namespace) -> int:
|
||||
return 0
|
||||
|
||||
# Perform update
|
||||
success = perform_update(components, args)
|
||||
success = perform_update(components, args, registry)
|
||||
|
||||
if success:
|
||||
if not args.quiet:
|
||||
|
||||
@ -229,7 +229,7 @@ class MCPComponent(Component):
|
||||
["claude", "mcp", "list"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=30,
|
||||
timeout=60,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
|
||||
@ -382,7 +382,7 @@ class MCPComponent(Component):
|
||||
["claude", "mcp", "list"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=15,
|
||||
timeout=60,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
|
||||
@ -542,7 +542,7 @@ class MCPComponent(Component):
|
||||
["claude", "mcp", "list"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=30,
|
||||
timeout=60,
|
||||
shell=(sys.platform == "win32")
|
||||
)
|
||||
|
||||
|
||||
@ -28,7 +28,9 @@ class Installer:
|
||||
self.install_dir = install_dir or DEFAULT_INSTALL_DIR
|
||||
self.dry_run = dry_run
|
||||
self.components: Dict[str, Component] = {}
|
||||
self.installed_components: Set[str] = set()
|
||||
from ..services.settings import SettingsService
|
||||
settings_manager = SettingsService(self.install_dir)
|
||||
self.installed_components: Set[str] = set(settings_manager.get_installed_components().keys())
|
||||
self.updated_components: Set[str] = set()
|
||||
|
||||
self.failed_components: Set[str] = set()
|
||||
@ -202,8 +204,8 @@ class Installer:
|
||||
|
||||
component = self.components[component_name]
|
||||
|
||||
# Skip if already installed
|
||||
if component_name in self.installed_components:
|
||||
# Skip if already installed and not in update mode
|
||||
if component_name in self.installed_components and not config.get("update_mode"):
|
||||
return True
|
||||
|
||||
# Check prerequisites
|
||||
@ -309,8 +311,10 @@ class Installer:
|
||||
self.logger.info("All components validated successfully!")
|
||||
else:
|
||||
self.logger.error("Some components failed validation. Check errors above.")
|
||||
|
||||
def update_components(self, component_names: List[str], config: Dict[str, Any]) -> bool:
|
||||
"""Alias for update operation (uses install logic)"""
|
||||
config["update_mode"] = True
|
||||
return self.install_components(component_names, config)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user