/** * Configuration options for link graph generation. * * @category Core */ export interface LinkGraphOptions { /** Include external links in the graph */ includeExternal?: boolean; /** Include image links in the graph */ includeImages?: boolean; /** Include anchor links in the graph */ includeAnchors?: boolean; /** Maximum depth for dependency traversal */ maxDepth?: number; /** Base directory for relative path calculations */ baseDir?: string; } /** * Represents a node in the link graph. * * @category Core */ export interface GraphNode { /** Unique identifier for the node */ id: string; /** Display label for the node */ label: string; /** Absolute file path */ path: string; /** Relative path from base directory */ relativePath: string; /** Node type */ type: "markdown" | "external" | "image" | "directory"; /** Node statistics */ stats: { /** Number of incoming links */ inbound: number; /** Number of outgoing links */ outbound: number; /** Total link count */ total: number; }; /** Additional node properties */ properties: { /** File size in bytes (for files) */ size?: number; /** Whether this is a hub node (high connectivity) */ isHub?: boolean; /** Whether this is an orphaned node (no connections) */ isOrphan?: boolean; }; } /** * Represents an edge in the link graph. * * @category Core */ export interface GraphEdge { /** Source node ID */ source: string; /** Target node ID */ target: string; /** Link type */ type: "internal" | "external" | "image" | "anchor" | "claude-import"; /** Original link text */ text?: string; /** Line number where link appears */ line?: number; /** Link weight (frequency or importance) */ weight: number; } /** * Complete link graph representation. * * @category Core */ export interface LinkGraph { /** All nodes in the graph */ nodes: GraphNode[]; /** All edges in the graph */ edges: GraphEdge[]; /** Graph metadata */ metadata: { /** Total number of files processed */ filesProcessed: number; /** Total number of links found */ totalLinks: number; /** Base directory used for calculations */ baseDir: string; /** Generation timestamp */ generatedAt: string; /** Options used for generation */ options: Required; }; /** Graph analysis results */ analysis: { /** Hub nodes (high connectivity) */ hubs: string[]; /** Orphaned nodes (no connections) */ orphans: string[]; /** Circular references detected */ circularReferences: string[][]; /** Strongly connected components */ stronglyConnected: string[][]; }; } /** * Output format for graph export. * * @category Core */ export type GraphOutputFormat = "json" | "mermaid" | "dot" | "html"; /** * Generates interactive link graphs from markdown file relationships. * * The LinkGraphGenerator analyzes markdown files to extract internal links and builds directed * graphs of file relationships. Supports multiple output formats including JSON data, Mermaid * diagrams, and interactive HTML visualizations. * * @category Core * * @example * Basic graph generation * ```typescript * const generator = new LinkGraphGenerator({ * includeExternal: false, * maxDepth: 5 * }); * * const graph = await generator.generateGraph(['docs/**\/*.md']); * console.log('Generated graph with ' + graph.nodes.length + ' nodes and ' + graph.edges.length + ' edges'); * ``` * * @example * Export to different formats * ```typescript * const generator = new LinkGraphGenerator(); * const graph = await generator.generateGraph(['*.md']); * * // Export as JSON * const json = generator.exportGraph(graph, 'json'); * * // Export as Mermaid diagram * const mermaid = generator.exportGraph(graph, 'mermaid'); * * // Export as interactive HTML * const html = generator.exportGraph(graph, 'html'); * ``` */ export declare class LinkGraphGenerator { private options; private parser; constructor(options?: LinkGraphOptions); /** * Generates a complete link graph from markdown files. * * @param patterns - File patterns to process (supports globs) * * @returns Promise resolving to the generated link graph */ generateGraph(patterns: string[]): Promise; /** * Exports a link graph to the specified format. * * @param graph - The link graph to export * @param format - Output format * * @returns Formatted graph representation */ exportGraph(graph: LinkGraph, format: GraphOutputFormat): string; private parseFiles; private buildGraph; private createNode; private shouldIncludeLink; private resolveTargetPath; private getNodeType; private generateNodeId; private generateNodeLabel; private calculateNodeStats; private analyzeGraph; private detectCircularReferences; private findStronglyConnectedComponents; private exportToJson; private exportToMermaid; private getMermaidNodeShape; private getMermaidArrow; private exportToDot; private getDotNodeStyle; private getDotEdgeStyle; private exportToHtml; } //# sourceMappingURL=link-graph-generator.d.ts.map