🔧 Fix critical setup process issues and improve reliability

Major fixes for installation system robustness and version consistency:

**Critical Version Synchronization:**
- Update VERSION file from 4.0.0b1 to 4.0.0 for stable release
- Fix setup/__init__.py to read version from VERSION file dynamically
- Synchronize SuperClaude/__main__.py version reference to 4.0.0
- Establish single source of truth for version management

**NPM Package Naming Resolution:**
- Rename npm package from 'superclaude' to '@superclaude-org/superclaude'
- Resolve naming collision with unrelated GitHub workflow package
- Update package description for clarity and accurate branding
- Enable proper npm organization scoping

**Setup Process Reliability:**
- Fix backup system double extension bug in installer.py
- Improve component discovery error handling with structured logging
- Replace deprecated pkg_resources with modern importlib.resources
- Add comprehensive error handling to installation workflows
- Convert print statements to proper logging throughout codebase

**Error Handling & Logging:**
- Add logger integration to ComponentRegistry and Installer classes
- Enhance exception handling for component instantiation failures
- Improve backup creation error handling with rollback capability
- Standardize error reporting across installation system

**Import System Modernization:**
- Replace deprecated pkg_resources with importlib.resources (Python 3.9+)
- Add robust fallback chain for Python 3.8+ compatibility
- Improve module discovery reliability across different environments

These changes significantly improve installation success rates and eliminate
major pain points preventing successful SuperClaude deployment.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
NomenAK
2025-08-17 00:30:02 +02:00
parent 80d76a91c9
commit e0917f33ab
6 changed files with 67 additions and 41 deletions

View File

@@ -7,6 +7,7 @@ import inspect
from typing import Dict, List, Set, Optional, Type
from pathlib import Path
from .base import Component
from ..utils.logger import get_logger
class ComponentRegistry:
@@ -24,6 +25,7 @@ class ComponentRegistry:
self.component_instances: Dict[str, Component] = {}
self.dependency_graph: Dict[str, Set[str]] = {}
self._discovered = False
self.logger = get_logger()
def discover_components(self, force_reload: bool = False) -> None:
"""
@@ -96,10 +98,10 @@ class ComponentRegistry:
self.component_instances[component_name] = instance
except Exception as e:
print(f"Warning: Could not instantiate component {name}: {e}")
self.logger.warning(f"Could not instantiate component {name}: {e}")
except Exception as e:
print(f"Warning: Could not load component module {module_name}: {e}")
self.logger.warning(f"Could not load component module {module_name}: {e}")
def _build_dependency_graph(self) -> None:
"""Build dependency graph for all discovered components"""
@@ -108,7 +110,7 @@ class ComponentRegistry:
dependencies = instance.get_dependencies()
self.dependency_graph[name] = set(dependencies)
except Exception as e:
print(f"Warning: Could not get dependencies for {name}: {e}")
self.logger.warning(f"Could not get dependencies for {name}: {e}")
self.dependency_graph[name] = set()
def get_component_class(self, component_name: str) -> Optional[Type[Component]]:
@@ -144,7 +146,7 @@ class ComponentRegistry:
try:
return component_class(install_dir)
except Exception as e:
print(f"Error creating component instance {component_name}: {e}")
self.logger.error(f"Error creating component instance {component_name}: {e}")
return None
return self.component_instances.get(component_name)
@@ -360,7 +362,7 @@ class ComponentRegistry:
if instance:
instances[name] = instance
else:
print(f"Warning: Could not create instance for component {name}")
self.logger.warning(f"Could not create instance for component {name}")
return instances