File size: 3,743 Bytes
a7d7463 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | """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",
}
]
|