Phase 2: Upgrade Command Implementation
Phase 2: Upgrade Command Implementation
Goal
Implement xmd upgrade command to upgrade XMD to the latest release.
Tasks
- Add upgrade command to CLI:
- Parse
upgradecommand argument - Handle upgrade process flow
- Show progress and status
- Parse
- Implement upgrade logic:
- Check current version
- Query GitHub API for latest release
- Compare versions
- Download and install if newer
- Create upgrade functions:
check_for_updates()- Compare versionsdownload_release()- Get latest release binaryinstall_upgrade()- Replace current binaryverify_upgrade()- Confirm successful upgrade
Implementation Details
- Use GitHub API: https://api.github.com/repos/akaoio/xmd/releases/latest
- Download appropriate binary for platform
- Backup current binary before replacement
- Atomic replacement to avoid corruption
Success Criteria
xmd upgradesuccessfully updates to latest release- Shows current and new version during upgrade
- Handles errors gracefully (network, permissions, etc)
- Works across different platforms