using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MarketAlly.AIPlugin.Analysis { public static class ModularMapAdapter { public static async Task CallExistingModularMapAsync(AIPluginRegistry registry, string projectPath, Dictionary parameters) { try { // Use the existing ModularMapPlugin through the registry var result = await registry.CallFunctionAsync("ModularMap", parameters); if (result.Success) { return result.Data; } else { // Return a simplified structure if the existing plugin fails return CreateFallbackModularData(projectPath); } } catch (Exception ex) { Console.WriteLine($"Warning: ModularMap plugin failed: {ex.Message}"); return CreateFallbackModularData(projectPath); } } private static object CreateFallbackModularData(string projectPath) { return new { ProjectPath = projectPath, GeneratedAt = DateTime.UtcNow, Statistics = new { TotalModules = 1, TotalDependencies = 0 }, CouplingMetrics = new { OverallCouplingScore = 0.5, HighlyCoupledModules = new List(), Recommendations = new List { "Modular analysis unavailable - basic structure assumed" } } }; } } }