| """Version Tracker - Track versions and changelog""" |
|
|
| import json |
| from pathlib import Path |
| from typing import List, Dict, Optional |
| from dataclasses import dataclass |
| from datetime import datetime |
|
|
|
|
| @dataclass |
| class Change: |
| """Represents a single change entry""" |
|
|
| version: str |
| change_type: str |
| description: str |
| date: str |
|
|
|
|
| class VersionTracker: |
| """Track software versions and changelog""" |
|
|
| CURRENT_VERSION = "1.0.0" |
| VERSION_FILE = "version.json" |
|
|
| CHANGELOG = [ |
| { |
| "version": "1.0.0", |
| "date": "2025-01-01", |
| "changes": [ |
| "Initial release", |
| "Core agent functionality", |
| "Terminal animations", |
| "Knowledge base integration", |
| ], |
| }, |
| { |
| "version": "0.9.0", |
| "date": "2024-12-15", |
| "changes": [ |
| "Beta release", |
| "Myanmar language support", |
| "Basic animations", |
| ], |
| }, |
| ] |
|
|
| def __init__(self, data_dir: Optional[Path] = None): |
| if data_dir: |
| self.data_dir = data_dir |
| else: |
| self.data_dir = Path.home() / ".burme_coder" |
|
|
| self.data_dir.mkdir(parents=True, exist_ok=True) |
| self._ensure_version_file() |
|
|
| def _ensure_version_file(self): |
| """Ensure version tracking file exists""" |
| version_file = self.data_dir / self.VERSION_FILE |
|
|
| if not version_file.exists(): |
| version_file.write_text( |
| json.dumps({"version": self.CURRENT_VERSION, "last_updated": datetime.now().isoformat()}, indent=2) |
| ) |
|
|
| def get_current_version(self) -> str: |
| """Get current version""" |
| return self.CURRENT_VERSION |
|
|
| def get_changelog(self) -> List[Dict]: |
| """Get full changelog""" |
| return self.CHANGELOG |
|
|
| def get_changes_for_version(self, version: str) -> Optional[Dict]: |
| """Get changes for a specific version""" |
| for entry in self.CHANGELOG: |
| if entry["version"] == version: |
| return entry |
| return None |
|
|
| def is_update_available(self, remote_version: str) -> bool: |
| """Check if update is available""" |
| current = self._version_tuple(self.CURRENT_VERSION) |
| remote = self._version_tuple(remote_version) |
| return remote > current |
|
|
| def _version_tuple(self, version: str) -> tuple: |
| """Convert version string to tuple for comparison""" |
| parts = version.replace("-", ".").split(".") |
| return tuple(int(p) if p.isdigit() else 0 for p in parts) |
|
|
| def get_roadmap(self) -> List[Dict]: |
| """Get project roadmap""" |
| return [ |
| { |
| "version": "1.1.0", |
| "planned_features": [ |
| "Enhanced animations", |
| "More language support", |
| "Improved knowledge base", |
| ], |
| }, |
| { |
| "version": "1.2.0", |
| "planned_features": [ |
| "API server", |
| "Web interface", |
| "REST API", |
| ], |
| }, |
| { |
| "version": "2.0.0", |
| "planned_features": [ |
| "Full model training", |
| "Production deployment", |
| ], |
| }, |
| ] |
|
|
| def get_deprecations(self) -> List[Dict]: |
| """Get list of deprecated features""" |
| return [ |
| { |
| "feature": "old_animation_api", |
| "version": "0.9.0", |
| "replacement": "new_animation_api", |
| "removal_version": "1.2.0", |
| } |
| ] |
|
|