Skip to main content
The core defines interfaces (ports) that adapters implement. This allows swapping implementations without changing business logic.

IGraphStorage

Persists and queries the code graph.
public interface IGraphStorage
{
    Task<IEnumerable<GraphNode>> GetNodesAsync(CancellationToken ct);
    Task<IEnumerable<GraphEdge>> GetEdgesAsync(CancellationToken ct);
    Task<(IEnumerable<GraphNode>, IEnumerable<GraphEdge>)> GetGraphAsync(CancellationToken ct);
    Task<GraphNode?> GetNodeAsync(string nodeId, CancellationToken ct);
    Task UpdateNodeAttributesAsync(string nodeId, Dictionary<string, object> attributes, CancellationToken ct);
    Task RemoveAttributesByPrefixAsync(string attributePrefix, CancellationToken ct);
    Task SaveAnalysisResultAsync(IReadOnlyList<GraphNode> nodes, IReadOnlyList<GraphEdge> edges, CancellationToken ct);
}
Implementations:
  • GraphDatabaseStorage - Graph database (default)
  • InMemoryGraphStorage - Testing

ILayoutCompute

Computes node positions using force-directed algorithms.
public interface ILayoutCompute
{
    Task<LayoutResult> ComputeLayoutAsync(
        IReadOnlyList<string> nodes,
        IReadOnlyList<(string SourceId, string TargetId)> edges,
        LayoutOptions? options = null,
        IProgress<LayoutProgress>? progress = null,
        CancellationToken ct = default);

    Task<LayoutStatus> GetStatusAsync(CancellationToken ct);
    Task CancelAsync(CancellationToken ct);
    Task<bool> IsAvailableAsync(CancellationToken ct);
}
Implementations:
  • GpuLayoutAdapter - GPU-accelerated via Rust server (Metal/Vulkan)
  • CpuLayoutFallback - CPU fallback (planned)

IOverlayPlugin

Extends CodeGraph with custom data and visualizations.
public interface IOverlayPlugin
{
    string Id { get; }
    string Name { get; }
    string Description { get; }
    OverlayDefinition[] Overlays { get; }

    Task ApplyAsync(IGraphStorage storage, CancellationToken ct);
    Task RemoveAsync(IGraphStorage storage, CancellationToken ct);
}
Implementations:
  • TestCoveragePlugin - Coverage data
  • GitActivityPlugin - Git metrics
  • Custom plugins via DLL loading

IStructuralAnalyzer

Analyzes source code and extracts structure.
public interface IStructuralAnalyzer
{
    Task<AnalysisResult> AnalyzeAsync(string path, CancellationToken ct);
}
Implementations:
  • CSharpAnalyzer - C# analysis (default)
  • Future: other languages

Why Ports?

Testability

Mock any external dependency. Test business logic in isolation.

Swappability

Replace any component without touching core. Swap implementations freely.