(options: UpgradeOptions = {})
| 131 | } |
| 132 | |
| 133 | export async function upgrade(options: UpgradeOptions = {}): Promise<void> { |
| 134 | const currentVersion = options.currentVersion ?? VERSION |
| 135 | const fetchImpl = options.fetchImpl ?? fetch |
| 136 | const runInstaller = options.runInstaller |
| 137 | |
| 138 | console.log(`Current version: ${currentVersion}`) |
| 139 | |
| 140 | const latestVersion = await getLatestCliVersion(fetchImpl) |
| 141 | console.log(`Latest version: ${latestVersion}`) |
| 142 | |
| 143 | if (compareVersions(latestVersion, currentVersion) <= 0) { |
| 144 | console.log("Roo CLI is already up to date.") |
| 145 | return |
| 146 | } |
| 147 | |
| 148 | console.log(`Upgrading Roo CLI from ${currentVersion} to ${latestVersion}...`) |
| 149 | if (runInstaller) { |
| 150 | await runInstaller() |
| 151 | } else { |
| 152 | await runUpgradeInstaller(latestVersion) |
| 153 | } |
| 154 | console.log("✓ Upgrade completed.") |
| 155 | } |
no test coverage detected