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:
NomenAK
2025-08-23 14:10:11 +02:00
parent 4831319a10
commit 9abaa10366
15 changed files with 57 additions and 30 deletions

View File

@@ -4,7 +4,13 @@ SuperClaude CLI Base Module
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():

View File

@@ -234,7 +234,7 @@ def display_backup_list(backups: List[Dict[str, Any]]) -> None:
def create_backup_metadata(install_dir: Path) -> Dict[str, Any]:
"""Create metadata for the backup"""
metadata = {
"backup_version": "4.0.7",
"backup_version": __version__,
"created": datetime.now().isoformat(),
"install_dir": str(install_dir),
"components": {},
@@ -513,8 +513,9 @@ def run(args: argparse.Namespace) -> int:
# Display header
if not args.quiet:
from setup.cli.base import __version__
display_header(
"SuperClaude Backup v3.0",
f"SuperClaude Backup v{__version__}",
"Backup and restore SuperClaude installations"
)

View File

@@ -559,8 +559,9 @@ def run(args: argparse.Namespace) -> int:
# Display header
if not args.quiet:
from setup.cli.base import __version__
display_header(
"SuperClaude Installation v3.0",
f"SuperClaude Installation v{__version__}",
"Installing SuperClaude framework components"
)

View File

@@ -785,8 +785,9 @@ def run(args: argparse.Namespace) -> int:
# Display header
if not args.quiet:
from setup.cli.base import __version__
display_header(
"SuperClaude Uninstall v3.0",
f"SuperClaude Uninstall v{__version__}",
"Removing SuperClaude framework components"
)

View File

@@ -405,7 +405,7 @@ def run(args: argparse.Namespace) -> int:
# Display header
if not args.quiet:
display_header(
"SuperClaude Update v4.0.7",
f"SuperClaude Update v{__version__}",
"Updating SuperClaude framework components"
)