importFromNeomage function

Future<Map<String, dynamic>?> importFromNeomage()

Import settings from an existing Neomage (Node.js) installation.

Implementation

Future<Map<String, dynamic>?> importFromNeomage() async {
  final home = Platform.environment['HOME'] ?? '';
  final configPath = '$home/.neomage/settings.json';
  final file = File(configPath);

  if (!await file.exists()) return null;

  try {
    final content = await file.readAsString();
    final data = jsonDecode(content) as Map<String, dynamic>;
    // Convert Node.js Neomage settings to Neomage format
    return _convertNodeSettings(data);
  } catch (_) {
    return null;
  }
}