Spaces:
Running
Running
| import type { DashboardNode, DashboardEdge } from '../../types/dashboard.js'; | |
| import type { FileEntry } from './scanner.js'; | |
| import type { ParseResult } from './parser.js'; | |
| /** | |
| * Output of the graph building process. | |
| */ | |
| export interface GraphOutput { | |
| /** Generated graph nodes (files, functions, classes) */ | |
| nodes: DashboardNode[]; | |
| /** Generated graph edges (imports, containment, calls) */ | |
| edges: DashboardEdge[]; | |
| } | |
| /** | |
| * Builds file-level graph nodes from scanned files and their parse results. | |
| * | |
| * For each file, creates a DashboardNode with: | |
| * - id: the file's relative path | |
| * - type: "file" | |
| * - name: the file's basename | |
| * - summary: generated from parse result (exports, classes, functions, or fallback) | |
| * - tags: language, category, path-based patterns, and complexity | |
| * | |
| * @param files - Scanned file entries with metadata | |
| * @param parseResults - Map of file relative path to its parse result | |
| * @returns Array of DashboardNode for each file | |
| */ | |
| export declare function buildFileNodes(files: FileEntry[], parseResults: Map<string, ParseResult>): DashboardNode[]; | |
| /** | |
| * Builds function-level graph nodes for significant functions. | |
| * | |
| * A function is "significant" if it is exported OR has 10+ lines (endLine - startLine + 1 >= 10). | |
| * | |
| * For each significant function, creates a DashboardNode with: | |
| * - id: "{relativePath}::{functionName}" | |
| * - type: "function" | |
| * - name: the function name | |
| * - summary: "({params}) β {lineCount} lines" | |
| * - tags: language, "exported" if exported, "async" if name suggests async | |
| * | |
| * Also creates a `contains` edge from the file node to the function node. | |
| * | |
| * @param files - Scanned file entries with metadata | |
| * @param parseResults - Map of file relative path to its parse result | |
| * @returns Object with nodes and edges arrays | |
| */ | |
| export declare function buildFunctionNodes(files: FileEntry[], parseResults: Map<string, ParseResult>): { | |
| nodes: DashboardNode[]; | |
| edges: DashboardEdge[]; | |
| }; | |
| /** | |
| * Builds class-level graph nodes for all classes found in parse results. | |
| * | |
| * For each class, creates a DashboardNode with: | |
| * - id: "{relativePath}::{className}" | |
| * - type: "class" | |
| * - name: the class name | |
| * - summary: "Methods: {methods}" or "Empty class" if no methods | |
| * - tags: language, "exported" if exported, size tag (small/medium/large-class) | |
| * | |
| * Also creates a `contains` edge from the file node to the class node. | |
| * | |
| * @param files - Scanned file entries with metadata | |
| * @param parseResults - Map of file relative path to its parse result | |
| * @returns Object with nodes and edges arrays | |
| */ | |
| export declare function buildClassNodes(files: FileEntry[], parseResults: Map<string, ParseResult>): { | |
| nodes: DashboardNode[]; | |
| edges: DashboardEdge[]; | |
| }; | |
| /** | |
| * Builds import edges from resolved relative import paths. | |
| * | |
| * For each file's imports: | |
| * - Only processes imports with relative paths (starting with '.' or '..') | |
| * - Resolves the import path relative to the importing file's directory | |
| * - If the resolved path matches a known file, creates an 'imports' edge | |
| * - Skips external package imports and unresolvable imports | |
| * | |
| * @param files - Scanned file entries with metadata | |
| * @param parseResults - Map of file relative path to its parse result | |
| * @returns Array of DashboardEdge with type 'imports' | |
| */ | |
| export declare function buildImportEdges(files: FileEntry[], parseResults: Map<string, ParseResult>): DashboardEdge[]; | |
| /** | |
| * Builds call edges using a simple heuristic based on named imports. | |
| * | |
| * For each file's imports that resolve to a known file: | |
| * - If the import has named imports (e.g., `import { formatDate } from './utils'`) | |
| * - And the target file has a significant function node with that name | |
| * - Creates a 'calls' edge from the importing file to the function node | |
| * | |
| * This is a best-effort heuristic β it won't catch all calls but provides useful edges. | |
| * | |
| * @param files - Scanned file entries with metadata | |
| * @param parseResults - Map of file relative path to its parse result | |
| * @returns Array of DashboardEdge with type 'calls' | |
| */ | |
| export declare function buildCallEdges(files: FileEntry[], parseResults: Map<string, ParseResult>): DashboardEdge[]; | |
| /** | |
| * Builds graph nodes and edges from scanned files and their parse results. | |
| * | |
| * Generates: | |
| * - File nodes for each source file | |
| * - Function nodes for each extracted function | |
| * - Class nodes for each extracted class | |
| * - Import edges between files | |
| * - Containment edges (file β function/class) | |
| * - Call relationship edges where detected | |
| * | |
| * @param files - Scanned file entries with metadata | |
| * @param parseResults - Map of file relative path to its parse result | |
| * @returns GraphOutput with all generated nodes and edges | |
| */ | |
| export declare function buildGraph(files: FileEntry[], parseResults: Map<string, ParseResult>): GraphOutput; | |