sicua
Version:
A tool for analyzing project structure and dependencies
83 lines (82 loc) • 3.27 kB
TypeScript
import { DependencyGraph, ComponentRelation } from "../../../types";
import { INode, IEdge } from "../../../types/zombieCluster.types";
/**
* Creates a node element for React Flow visualization
* @param id Node identifier
* @param label Display label
* @param fullPath Full path to the file
* @param directory Directory information
* @param position Position coordinates for React Flow
* @param parent Optional parent group id
* @returns INode compliant with React Flow structure
*/
export declare function createNode(id: string, label: string, fullPath: string, directory: string, position: {
x: number;
y: number;
}, parent?: string, isComponent?: boolean, fileType?: string): INode;
/**
* Creates an edge element for React Flow visualization
* @param id Unique edge identifier
* @param source Source node id
* @param target Target node id
* @param type Optional connection type
* @param label Optional label
* @returns IEdge compliant with React Flow structure
*/
export declare function createEdge(id: string, source: string, target: string, type?: "import" | "export" | "dynamic", label?: string): IEdge;
/**
* Generates a unique edge ID from source and target
* @param source Source node id
* @param target Target node id
* @returns Unique edge identifier
*/
export declare function generateEdgeId(source: string, target: string): string;
/**
* Normalizes an import path to match component names
* @param importPath The raw import path
* @param components The list of components to match against
* @returns The normalized component name or the original import path
*/
export declare function normalizeImportPath(importPath: string, components: ComponentRelation[]): string;
/**
* Finds isolated nodes in a graph (nodes with no incoming or outgoing edges)
* @param graph The dependency graph
* @returns Set of isolated node ids
*/
export declare function findIsolatedNodes(graph: DependencyGraph): Set<string>;
/**
* Gets the file type from a full path
* @param fullPath The full path to the file
* @returns The file extension or undefined
*/
export declare function getFileTypeFromPath(fullPath: string): string | undefined;
/**
* Determines risk level based on cluster size
* @param size The size of the cluster
* @returns The risk level as 'high', 'medium', or 'low'
*/
export declare function determineRiskLevel(size: number): "high" | "medium" | "low";
/**
* Generates a simple grid layout for nodes
* @param nodeCount Number of nodes to position
* @param startX Starting X coordinate
* @param startY Starting Y coordinate
* @param spacing Spacing between nodes
* @returns Array of position coordinates
*/
export declare function generateGridLayout(nodeCount: number, startX?: number, startY?: number, spacing?: number): {
x: number;
y: number;
}[];
/**
* Generates a circular layout for nodes (useful for circular dependencies)
* @param nodeCount Number of nodes to position
* @param centerX Center X coordinate
* @param centerY Center Y coordinate
* @param radius Radius of the circle
* @returns Array of position coordinates
*/
export declare function generateCircularLayout(nodeCount: number, centerX?: number, centerY?: number, radius?: number): {
x: number;
y: number;
}[];