41 lines
2.2 KiB
C#
41 lines
2.2 KiB
C#
namespace ShrinkSDK.Inspect;
|
|
|
|
public sealed record SourceLocation(string File, int Line);
|
|
public sealed record SymbolInfo(string Id, string Name, string Module, string Kind, SourceLocation Location);
|
|
public sealed record Relation(string From, string To, string Kind, string Evidence, SourceLocation Location);
|
|
public sealed record RuntimeState(string Scope, string Name, System.Text.Json.JsonElement Value, SourceLocation Location);
|
|
public sealed record Finding(string Code, string Severity, string Message, SourceLocation Location);
|
|
public sealed record Capability(string Module, string Summary, string Aliases, string Limits, string Extension,
|
|
string Evidence, SourceLocation Location, int Score = 0, string MatchReason = "");
|
|
public sealed record ModuleInfo(string Name, string Root, string Version, string[] Dependencies,
|
|
string[] Assemblies, string[] Validation, bool SemanticDescriptionComplete);
|
|
public sealed class CompilationInput
|
|
{
|
|
public string Name { get; set; } = "";
|
|
public string[] Sources { get; set; } = [];
|
|
public string[] References { get; set; } = [];
|
|
public string[] Defines { get; set; } = [];
|
|
public string Output { get; set; } = "";
|
|
}
|
|
public sealed class CompilationManifest
|
|
{
|
|
public string Root { get; set; } = "";
|
|
public string BuildId { get; set; } = "";
|
|
public CompilationInput[] Assemblies { get; set; } = [];
|
|
public Dictionary<string, long> SourceTicks { get; set; } = new();
|
|
}
|
|
public sealed class Index
|
|
{
|
|
public string Root { get; set; } = "";
|
|
public string BuildId { get; set; } = "";
|
|
public List<string> Coverage { get; } = [];
|
|
public List<ModuleInfo> Modules { get; } = [];
|
|
public List<Capability> Capabilities { get; } = [];
|
|
public Dictionary<string, SymbolInfo> Symbols { get; } = new(StringComparer.Ordinal);
|
|
public List<Relation> Relations { get; } = [];
|
|
public List<RuntimeState> RuntimeStates { get; } = [];
|
|
public List<Finding> Findings { get; } = [];
|
|
public string ModuleFor(string file) => Modules.Where(m => file.StartsWith(m.Root + Path.DirectorySeparatorChar,
|
|
StringComparison.OrdinalIgnoreCase)).OrderByDescending(m => m.Root.Length).FirstOrDefault()?.Name ?? "consumer";
|
|
}
|