/** * 代码知识图谱关系定义 * * 定义了代码级别的实体和关系,用于构建深度代码知识图谱 */ /** * 图谱节点类型 */ export type GraphNodeType = 'project' | 'file' | 'function' | 'class' | 'interface' | 'method' | 'variable' | 'package'; /** * 图谱关系类型(谓词) */ export type GraphPredicate = 'HAS_ROOT' | 'CONTAINS' | 'DEFINES' | 'EXPORTS' | 'IMPORTS' | 'IMPORTS_FROM' | 'IMPLEMENTS' | 'EXTENDS' | 'CALLS' | 'USES' | 'DEPENDS_ON'; /** * 代码实体节点标识符 */ export interface CodeNodeId { type: GraphNodeType; name: string; filePath?: string; } /** * 构造节点标识符字符串 */ export declare function makeNodeId(node: CodeNodeId): string; /** * 解析节点标识符字符串 */ export declare function parseNodeId(nodeId: string): CodeNodeId | null; /** * 代码关系(图的边) */ export interface CodeRelationship { subject: string; predicate: GraphPredicate; object: string; properties?: Record; } /** * 代码实体在图中的属性 */ export interface CodeEntityProperties { name: string; filePath?: string; startLine?: number; endLine?: number; signature?: string; returnType?: string; parameters?: string[]; isExported?: boolean; isAsync?: boolean; language?: string; comments?: string; linesOfCode?: number; complexity?: number; }