This commit is contained in:
105
src/types/graph.ts
Normal file
105
src/types/graph.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
export interface GraphNode {
|
||||
id: string;
|
||||
label: string;
|
||||
kind: NodeKind;
|
||||
filePath: string;
|
||||
lineNumber: number;
|
||||
metadata: Record<string, unknown>;
|
||||
dependencies: string[];
|
||||
}
|
||||
|
||||
export type NodeKind = 'interface' | 'type_alias' | 'class' | 'enum' | 'function' | 'import' | 'external';
|
||||
|
||||
export interface GraphEdge {
|
||||
source: string;
|
||||
target: string;
|
||||
label?: string;
|
||||
style?: EdgeStyle;
|
||||
weight?: number;
|
||||
}
|
||||
|
||||
export type EdgeStyle = 'solid' | 'dashed' | 'dotted';
|
||||
|
||||
export interface DependencyGraph {
|
||||
nodes: Map<string, GraphNode>;
|
||||
edges: GraphEdge[];
|
||||
clusters: GraphCluster[];
|
||||
metadata: GraphMetadata;
|
||||
}
|
||||
|
||||
export interface GraphCluster {
|
||||
id: string;
|
||||
label: string;
|
||||
nodeIds: string[];
|
||||
style?: string;
|
||||
}
|
||||
|
||||
export interface GraphMetadata {
|
||||
createdAt: string;
|
||||
sourceDirectory: string;
|
||||
nodeCount: number;
|
||||
edgeCount: number;
|
||||
analysisOptions: AnalysisOptions;
|
||||
}
|
||||
|
||||
export interface AnalysisOptions {
|
||||
maxDepth?: number;
|
||||
includeExternal?: boolean;
|
||||
excludedPatterns?: string[];
|
||||
focusTypes?: string[];
|
||||
}
|
||||
|
||||
export interface CircularDependency {
|
||||
cycle: string[];
|
||||
nodes: string[];
|
||||
edges: GraphEdge[];
|
||||
length: number;
|
||||
}
|
||||
|
||||
export interface WideningIssue {
|
||||
nodeId: string;
|
||||
typeName: string;
|
||||
filePath: string;
|
||||
lineNumber: number;
|
||||
description: string;
|
||||
originalType?: string;
|
||||
widenedType?: string;
|
||||
suggestion?: string;
|
||||
}
|
||||
|
||||
export interface NarrowingIssue {
|
||||
nodeId: string;
|
||||
typeName: string;
|
||||
filePath: string;
|
||||
lineNumber: number;
|
||||
description: string;
|
||||
originalType?: string;
|
||||
narrowedType?: string;
|
||||
suggestion?: string;
|
||||
}
|
||||
|
||||
export interface AnalysisResult {
|
||||
graph: DependencyGraph;
|
||||
circularDependencies: CircularDependency[];
|
||||
wideningIssues: WideningIssue[];
|
||||
narrowingIssues: NarrowingIssue[];
|
||||
summary: AnalysisSummary;
|
||||
}
|
||||
|
||||
export interface AnalysisSummary {
|
||||
totalNodes: number;
|
||||
totalEdges: number;
|
||||
totalCircular: number;
|
||||
totalWidening: number;
|
||||
totalNarrowing: number;
|
||||
filesAnalyzed: number;
|
||||
analysisTimeMs: number;
|
||||
}
|
||||
|
||||
export interface ExportOptions {
|
||||
format: 'dot' | 'graphml' | 'json';
|
||||
outputPath: string;
|
||||
includeMetadata?: boolean;
|
||||
layout?: string;
|
||||
rankDir?: 'TB' | 'LR' | 'BT' | 'RL';
|
||||
}
|
||||
Reference in New Issue
Block a user