mirror of
https://github.com/SuperClaude-Org/SuperClaude_Framework.git
synced 2025-12-17 17:56:46 +00:00
Fix update command and installer logic (#339)
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`.
This commit is contained in:
commit
6f17d8051c
@ -19,7 +19,7 @@ from ...utils.ui import (
|
|||||||
)
|
)
|
||||||
from ...utils.environment import setup_environment_variables
|
from ...utils.environment import setup_environment_variables
|
||||||
from ...utils.logger import get_logger
|
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
|
from . import OperationBase
|
||||||
|
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ def display_update_plan(components: List[str], available_updates: Dict[str, Dict
|
|||||||
print()
|
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"""
|
"""Perform the actual update"""
|
||||||
logger = get_logger()
|
logger = get_logger()
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
@ -284,10 +284,6 @@ def perform_update(components: List[str], args: argparse.Namespace) -> bool:
|
|||||||
# Create installer
|
# Create installer
|
||||||
installer = Installer(args.install_dir, dry_run=args.dry_run)
|
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
|
# Create component instances
|
||||||
component_instances = registry.create_component_instances(components, args.install_dir)
|
component_instances = registry.create_component_instances(components, args.install_dir)
|
||||||
|
|
||||||
@ -384,6 +380,9 @@ def run(args: argparse.Namespace) -> int:
|
|||||||
operation = UpdateOperation()
|
operation = UpdateOperation()
|
||||||
operation.setup_operation_logging(args)
|
operation.setup_operation_logging(args)
|
||||||
logger = get_logger()
|
logger = get_logger()
|
||||||
|
|
||||||
|
from setup.cli.base import __version__
|
||||||
|
|
||||||
# ✅ Inserted validation code
|
# ✅ Inserted validation code
|
||||||
expected_home = Path.home().resolve()
|
expected_home = Path.home().resolve()
|
||||||
actual_dir = args.install_dir.resolve()
|
actual_dir = args.install_dir.resolve()
|
||||||
@ -457,7 +456,7 @@ def run(args: argparse.Namespace) -> int:
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
# Perform update
|
# Perform update
|
||||||
success = perform_update(components, args)
|
success = perform_update(components, args, registry)
|
||||||
|
|
||||||
if success:
|
if success:
|
||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
|
|||||||
@ -229,7 +229,7 @@ class MCPComponent(Component):
|
|||||||
["claude", "mcp", "list"],
|
["claude", "mcp", "list"],
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
timeout=30,
|
timeout=60,
|
||||||
shell=(sys.platform == "win32")
|
shell=(sys.platform == "win32")
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ class MCPComponent(Component):
|
|||||||
["claude", "mcp", "list"],
|
["claude", "mcp", "list"],
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
timeout=15,
|
timeout=60,
|
||||||
shell=(sys.platform == "win32")
|
shell=(sys.platform == "win32")
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -542,7 +542,7 @@ class MCPComponent(Component):
|
|||||||
["claude", "mcp", "list"],
|
["claude", "mcp", "list"],
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
timeout=30,
|
timeout=60,
|
||||||
shell=(sys.platform == "win32")
|
shell=(sys.platform == "win32")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,9 @@ class Installer:
|
|||||||
self.install_dir = install_dir or DEFAULT_INSTALL_DIR
|
self.install_dir = install_dir or DEFAULT_INSTALL_DIR
|
||||||
self.dry_run = dry_run
|
self.dry_run = dry_run
|
||||||
self.components: Dict[str, Component] = {}
|
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.updated_components: Set[str] = set()
|
||||||
|
|
||||||
self.failed_components: Set[str] = set()
|
self.failed_components: Set[str] = set()
|
||||||
@ -202,8 +204,8 @@ class Installer:
|
|||||||
|
|
||||||
component = self.components[component_name]
|
component = self.components[component_name]
|
||||||
|
|
||||||
# Skip if already installed
|
# Skip if already installed and not in update mode
|
||||||
if component_name in self.installed_components:
|
if component_name in self.installed_components and not config.get("update_mode"):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Check prerequisites
|
# Check prerequisites
|
||||||
@ -309,8 +311,10 @@ class Installer:
|
|||||||
self.logger.info("All components validated successfully!")
|
self.logger.info("All components validated successfully!")
|
||||||
else:
|
else:
|
||||||
self.logger.error("Some components failed validation. Check errors above.")
|
self.logger.error("Some components failed validation. Check errors above.")
|
||||||
|
|
||||||
def update_components(self, component_names: List[str], config: Dict[str, Any]) -> bool:
|
def update_components(self, component_names: List[str], config: Dict[str, Any]) -> bool:
|
||||||
"""Alias for update operation (uses install logic)"""
|
"""Alias for update operation (uses install logic)"""
|
||||||
|
config["update_mode"] = True
|
||||||
return self.install_components(component_names, config)
|
return self.install_components(component_names, config)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user