getLatestCLIVersion static method

Future<String?> getLatestCLIVersion()

Get the latest CLI version from GitHub releases

Implementation

static Future<String?> getLatestCLIVersion() async {
  try {
    final response = await http.get(Uri.parse(_githubApiUrl));

    if (response.statusCode == 200) {
      final data = json.decode(response.body);
      final tagName = data['tag_name']?.toString();
      if (tagName != null) {
        return tagName.replaceFirst('v', '');
      }
    }
  } catch (e) {
    // Silently fail - network issues shouldn't break the CLI
  }

  return null;
}