MarketAlly.AIPlugin.Extensions/MarketAlly.AIPlugin.Analysis/ModularMapAdapter.cs

56 lines
1.3 KiB
C#
Executable File

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<object> CallExistingModularMapAsync(AIPluginRegistry registry, string projectPath, Dictionary<string, object> 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<string>(),
Recommendations = new List<string> { "Modular analysis unavailable - basic structure assumed" }
}
};
}
}
}