mirror of
https://github.com/SuperClaude-Org/SuperClaude_Framework.git
synced 2025-12-17 17:56:46 +00:00
✨ Implement dynamic version loading system
- Convert all hardcoded versions to dynamic loading from VERSION file - Reduce version update locations from 50+ to just 3 files - Add proper fallback handling for version reading - Update all CLI commands to use dynamic __version__ - Streamline future version management process This change makes version bumping much simpler - only need to update: 1. VERSION file 2. package.json 3. pyproject.toml
This commit is contained in:
parent
4831319a10
commit
9abaa10366
@ -11,7 +11,13 @@ Usage:
|
|||||||
SuperClaude --help
|
SuperClaude --help
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "4.0.7"
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Read version from VERSION file
|
||||||
|
try:
|
||||||
|
__version__ = (Path(__file__).parent.parent / "VERSION").read_text().strip()
|
||||||
|
except Exception:
|
||||||
|
__version__ = "4.0.7" # Fallback
|
||||||
__author__ = "NomenAK, Mithun Gowda B"
|
__author__ = "NomenAK, Mithun Gowda B"
|
||||||
__email__ = "anton.knoery@gmail.com"
|
__email__ = "anton.knoery@gmail.com"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
|
|||||||
@ -98,7 +98,8 @@ Examples:
|
|||||||
parents=[global_parser]
|
parents=[global_parser]
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument("--version", action="version", version="SuperClaude 4.0.7")
|
from SuperClaude import __version__
|
||||||
|
parser.add_argument("--version", action="version", version=f"SuperClaude {__version__}")
|
||||||
|
|
||||||
subparsers = parser.add_subparsers(
|
subparsers = parser.add_subparsers(
|
||||||
dest="operation",
|
dest="operation",
|
||||||
@ -208,8 +209,9 @@ def main() -> int:
|
|||||||
try:
|
try:
|
||||||
from setup.utils.updater import check_for_updates
|
from setup.utils.updater import check_for_updates
|
||||||
# Check for updates in the background
|
# Check for updates in the background
|
||||||
|
from SuperClaude import __version__
|
||||||
updated = check_for_updates(
|
updated = check_for_updates(
|
||||||
current_version="4.0.7",
|
current_version=__version__,
|
||||||
auto_update=getattr(args, 'auto_update', False)
|
auto_update=getattr(args, 'auto_update', False)
|
||||||
)
|
)
|
||||||
# If updated, suggest restart
|
# If updated, suggest restart
|
||||||
@ -226,7 +228,8 @@ def main() -> int:
|
|||||||
# No operation provided? Show help manually unless in quiet mode
|
# No operation provided? Show help manually unless in quiet mode
|
||||||
if not args.operation:
|
if not args.operation:
|
||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
display_header("SuperClaude Framework v4.0.7", "Unified CLI for all operations")
|
from SuperClaude import __version__
|
||||||
|
display_header(f"SuperClaude Framework v{__version__}", "Unified CLI for all operations")
|
||||||
print(f"{Colors.CYAN}Available operations:{Colors.RESET}")
|
print(f"{Colors.CYAN}Available operations:{Colors.RESET}")
|
||||||
for op, desc in get_operation_modules().items():
|
for op, desc in get_operation_modules().items():
|
||||||
print(f" {op:<12} {desc}")
|
print(f" {op:<12} {desc}")
|
||||||
|
|||||||
@ -4,7 +4,13 @@ SuperClaude CLI Base Module
|
|||||||
Base class for all CLI operations providing common functionality
|
Base class for all CLI operations providing common functionality
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "4.0.7"
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Read version from VERSION file
|
||||||
|
try:
|
||||||
|
__version__ = (Path(__file__).parent.parent.parent / "VERSION").read_text().strip()
|
||||||
|
except Exception:
|
||||||
|
__version__ = "4.0.7" # Fallback
|
||||||
|
|
||||||
|
|
||||||
def get_command_info():
|
def get_command_info():
|
||||||
|
|||||||
@ -234,7 +234,7 @@ def display_backup_list(backups: List[Dict[str, Any]]) -> None:
|
|||||||
def create_backup_metadata(install_dir: Path) -> Dict[str, Any]:
|
def create_backup_metadata(install_dir: Path) -> Dict[str, Any]:
|
||||||
"""Create metadata for the backup"""
|
"""Create metadata for the backup"""
|
||||||
metadata = {
|
metadata = {
|
||||||
"backup_version": "4.0.7",
|
"backup_version": __version__,
|
||||||
"created": datetime.now().isoformat(),
|
"created": datetime.now().isoformat(),
|
||||||
"install_dir": str(install_dir),
|
"install_dir": str(install_dir),
|
||||||
"components": {},
|
"components": {},
|
||||||
@ -513,8 +513,9 @@ def run(args: argparse.Namespace) -> int:
|
|||||||
|
|
||||||
# Display header
|
# Display header
|
||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
|
from setup.cli.base import __version__
|
||||||
display_header(
|
display_header(
|
||||||
"SuperClaude Backup v3.0",
|
f"SuperClaude Backup v{__version__}",
|
||||||
"Backup and restore SuperClaude installations"
|
"Backup and restore SuperClaude installations"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -559,8 +559,9 @@ def run(args: argparse.Namespace) -> int:
|
|||||||
|
|
||||||
# Display header
|
# Display header
|
||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
|
from setup.cli.base import __version__
|
||||||
display_header(
|
display_header(
|
||||||
"SuperClaude Installation v3.0",
|
f"SuperClaude Installation v{__version__}",
|
||||||
"Installing SuperClaude framework components"
|
"Installing SuperClaude framework components"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -785,8 +785,9 @@ def run(args: argparse.Namespace) -> int:
|
|||||||
|
|
||||||
# Display header
|
# Display header
|
||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
|
from setup.cli.base import __version__
|
||||||
display_header(
|
display_header(
|
||||||
"SuperClaude Uninstall v3.0",
|
f"SuperClaude Uninstall v{__version__}",
|
||||||
"Removing SuperClaude framework components"
|
"Removing SuperClaude framework components"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -405,7 +405,7 @@ def run(args: argparse.Namespace) -> int:
|
|||||||
# Display header
|
# Display header
|
||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
display_header(
|
display_header(
|
||||||
"SuperClaude Update v4.0.7",
|
f"SuperClaude Update v{__version__}",
|
||||||
"Updating SuperClaude framework components"
|
"Updating SuperClaude framework components"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ from typing import Dict, List, Tuple, Optional, Any
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from ..core.base import Component
|
from ..core.base import Component
|
||||||
|
from setup import __version__
|
||||||
|
|
||||||
|
|
||||||
class AgentsComponent(Component):
|
class AgentsComponent(Component):
|
||||||
@ -19,7 +20,7 @@ class AgentsComponent(Component):
|
|||||||
"""Get component metadata"""
|
"""Get component metadata"""
|
||||||
return {
|
return {
|
||||||
"name": "agents",
|
"name": "agents",
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"description": "14 specialized AI agents with domain expertise and intelligent routing",
|
"description": "14 specialized AI agents with domain expertise and intelligent routing",
|
||||||
"category": "agents"
|
"category": "agents"
|
||||||
}
|
}
|
||||||
@ -29,7 +30,7 @@ class AgentsComponent(Component):
|
|||||||
return {
|
return {
|
||||||
"components": {
|
"components": {
|
||||||
"agents": {
|
"agents": {
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"installed": True,
|
"installed": True,
|
||||||
"agents_count": len(self.component_files),
|
"agents_count": len(self.component_files),
|
||||||
"install_directory": str(self.install_component_subdir)
|
"install_directory": str(self.install_component_subdir)
|
||||||
@ -63,7 +64,7 @@ class AgentsComponent(Component):
|
|||||||
|
|
||||||
# Add component registration
|
# Add component registration
|
||||||
self.settings_manager.add_component_registration("agents", {
|
self.settings_manager.add_component_registration("agents", {
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"category": "agents",
|
"category": "agents",
|
||||||
"agents_count": len(self.component_files),
|
"agents_count": len(self.component_files),
|
||||||
"agents_list": self.component_files
|
"agents_list": self.component_files
|
||||||
|
|||||||
@ -6,6 +6,7 @@ from typing import Dict, List, Tuple, Optional, Any
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from ..core.base import Component
|
from ..core.base import Component
|
||||||
|
from setup import __version__
|
||||||
|
|
||||||
class CommandsComponent(Component):
|
class CommandsComponent(Component):
|
||||||
"""SuperClaude slash commands component"""
|
"""SuperClaude slash commands component"""
|
||||||
@ -18,7 +19,7 @@ class CommandsComponent(Component):
|
|||||||
"""Get component metadata"""
|
"""Get component metadata"""
|
||||||
return {
|
return {
|
||||||
"name": "commands",
|
"name": "commands",
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"description": "SuperClaude slash command definitions",
|
"description": "SuperClaude slash command definitions",
|
||||||
"category": "commands"
|
"category": "commands"
|
||||||
}
|
}
|
||||||
@ -28,14 +29,14 @@ class CommandsComponent(Component):
|
|||||||
return {
|
return {
|
||||||
"components": {
|
"components": {
|
||||||
"commands": {
|
"commands": {
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"installed": True,
|
"installed": True,
|
||||||
"files_count": len(self.component_files)
|
"files_count": len(self.component_files)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"commands": {
|
"commands": {
|
||||||
"enabled": True,
|
"enabled": True,
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"auto_update": False
|
"auto_update": False
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,7 +59,7 @@ class CommandsComponent(Component):
|
|||||||
|
|
||||||
# Add component registration to metadata
|
# Add component registration to metadata
|
||||||
self.settings_manager.add_component_registration("commands", {
|
self.settings_manager.add_component_registration("commands", {
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"category": "commands",
|
"category": "commands",
|
||||||
"files_count": len(self.component_files)
|
"files_count": len(self.component_files)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import shutil
|
|||||||
|
|
||||||
from ..core.base import Component
|
from ..core.base import Component
|
||||||
from ..services.claude_md import CLAUDEMdService
|
from ..services.claude_md import CLAUDEMdService
|
||||||
|
from setup import __version__
|
||||||
|
|
||||||
class CoreComponent(Component):
|
class CoreComponent(Component):
|
||||||
"""Core SuperClaude framework files component"""
|
"""Core SuperClaude framework files component"""
|
||||||
@ -20,7 +21,7 @@ class CoreComponent(Component):
|
|||||||
"""Get component metadata"""
|
"""Get component metadata"""
|
||||||
return {
|
return {
|
||||||
"name": "core",
|
"name": "core",
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"description": "SuperClaude framework documentation and core files",
|
"description": "SuperClaude framework documentation and core files",
|
||||||
"category": "core"
|
"category": "core"
|
||||||
}
|
}
|
||||||
@ -29,7 +30,7 @@ class CoreComponent(Component):
|
|||||||
"""Get metadata modifications for SuperClaude"""
|
"""Get metadata modifications for SuperClaude"""
|
||||||
return {
|
return {
|
||||||
"framework": {
|
"framework": {
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"name": "SuperClaude",
|
"name": "SuperClaude",
|
||||||
"description": "AI-enhanced development framework for Claude Code",
|
"description": "AI-enhanced development framework for Claude Code",
|
||||||
"installation_type": "global",
|
"installation_type": "global",
|
||||||
@ -37,7 +38,7 @@ class CoreComponent(Component):
|
|||||||
},
|
},
|
||||||
"superclaude": {
|
"superclaude": {
|
||||||
"enabled": True,
|
"enabled": True,
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"profile": "default",
|
"profile": "default",
|
||||||
"auto_update": False
|
"auto_update": False
|
||||||
}
|
}
|
||||||
@ -58,7 +59,7 @@ class CoreComponent(Component):
|
|||||||
|
|
||||||
# Add component registration to metadata
|
# Add component registration to metadata
|
||||||
self.settings_manager.add_component_registration("core", {
|
self.settings_manager.add_component_registration("core", {
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"category": "core",
|
"category": "core",
|
||||||
"files_count": len(self.component_files)
|
"files_count": len(self.component_files)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -21,6 +21,7 @@ except ImportError:
|
|||||||
LOCKING_AVAILABLE = None
|
LOCKING_AVAILABLE = None
|
||||||
|
|
||||||
from ..core.base import Component
|
from ..core.base import Component
|
||||||
|
from setup import __version__
|
||||||
from ..utils.ui import display_info, display_warning
|
from ..utils.ui import display_info, display_warning
|
||||||
|
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ class MCPComponent(Component):
|
|||||||
"""Get component metadata"""
|
"""Get component metadata"""
|
||||||
return {
|
return {
|
||||||
"name": "mcp",
|
"name": "mcp",
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"description": "MCP server configuration management via .claude.json",
|
"description": "MCP server configuration management via .claude.json",
|
||||||
"category": "integration"
|
"category": "integration"
|
||||||
}
|
}
|
||||||
@ -348,7 +349,7 @@ class MCPComponent(Component):
|
|||||||
metadata_mods = {
|
metadata_mods = {
|
||||||
"components": {
|
"components": {
|
||||||
"mcp": {
|
"mcp": {
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"installed": True,
|
"installed": True,
|
||||||
"servers_configured": len(self.selected_servers),
|
"servers_configured": len(self.selected_servers),
|
||||||
"configured_servers": self.selected_servers
|
"configured_servers": self.selected_servers
|
||||||
|
|||||||
@ -6,6 +6,7 @@ from typing import Dict, List, Tuple, Optional, Any
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from ..core.base import Component
|
from ..core.base import Component
|
||||||
|
from setup import __version__
|
||||||
from ..services.claude_md import CLAUDEMdService
|
from ..services.claude_md import CLAUDEMdService
|
||||||
|
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ class MCPDocsComponent(Component):
|
|||||||
"""Get component metadata"""
|
"""Get component metadata"""
|
||||||
return {
|
return {
|
||||||
"name": "mcp_docs",
|
"name": "mcp_docs",
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"description": "MCP server documentation and usage guides",
|
"description": "MCP server documentation and usage guides",
|
||||||
"category": "documentation"
|
"category": "documentation"
|
||||||
}
|
}
|
||||||
@ -135,7 +136,7 @@ class MCPDocsComponent(Component):
|
|||||||
metadata_mods = {
|
metadata_mods = {
|
||||||
"components": {
|
"components": {
|
||||||
"mcp_docs": {
|
"mcp_docs": {
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"installed": True,
|
"installed": True,
|
||||||
"files_count": len(self.component_files),
|
"files_count": len(self.component_files),
|
||||||
"servers_documented": self.selected_servers
|
"servers_documented": self.selected_servers
|
||||||
|
|||||||
@ -6,6 +6,7 @@ from typing import Dict, List, Tuple, Optional, Any
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from ..core.base import Component
|
from ..core.base import Component
|
||||||
|
from setup import __version__
|
||||||
from ..services.claude_md import CLAUDEMdService
|
from ..services.claude_md import CLAUDEMdService
|
||||||
|
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ class ModesComponent(Component):
|
|||||||
"""Get component metadata"""
|
"""Get component metadata"""
|
||||||
return {
|
return {
|
||||||
"name": "modes",
|
"name": "modes",
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"description": "SuperClaude behavioral modes (Brainstorming, Introspection, Task Management, Token Efficiency)",
|
"description": "SuperClaude behavioral modes (Brainstorming, Introspection, Task Management, Token Efficiency)",
|
||||||
"category": "modes"
|
"category": "modes"
|
||||||
}
|
}
|
||||||
@ -69,7 +70,7 @@ class ModesComponent(Component):
|
|||||||
metadata_mods = {
|
metadata_mods = {
|
||||||
"components": {
|
"components": {
|
||||||
"modes": {
|
"modes": {
|
||||||
"version": "4.0.7",
|
"version": __version__,
|
||||||
"installed": True,
|
"installed": True,
|
||||||
"files_count": len(self.component_files)
|
"files_count": len(self.component_files)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -295,16 +295,19 @@ class UpdateChecker:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def check_for_updates(current_version: str = "4.0.7", **kwargs) -> bool:
|
def check_for_updates(current_version: str = None, **kwargs) -> bool:
|
||||||
"""
|
"""
|
||||||
Convenience function to check for updates
|
Convenience function to check for updates
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
current_version: Current installed version
|
current_version: Current installed version (defaults to reading from setup)
|
||||||
**kwargs: Additional arguments passed to check_and_notify
|
**kwargs: Additional arguments passed to check_and_notify
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True if update was performed
|
True if update was performed
|
||||||
"""
|
"""
|
||||||
|
if current_version is None:
|
||||||
|
from setup import __version__
|
||||||
|
current_version = __version__
|
||||||
checker = UpdateChecker(current_version)
|
checker = UpdateChecker(current_version)
|
||||||
return checker.check_and_notify(**kwargs)
|
return checker.check_and_notify(**kwargs)
|
||||||
Loading…
x
Reference in New Issue
Block a user