UNPKG

memory-engineering-mcp

Version:

🧠 AI Memory System powered by MongoDB Atlas & Voyage AI - Autonomous memory management with zero manual work

108 lines • 2.55 kB
/** * MongoDB Graph Relationships for Code * * Following the plan: "code should get mongodb graph capabilities" * This enables relationship tracking between code entities */ import type { ObjectId } from 'mongodb'; /** * Graph node types in the codebase */ export type GraphNodeType = 'file' | 'function' | 'class' | 'interface' | 'component' | 'module' | 'service' | 'api'; /** * Relationship types between nodes */ export type GraphRelationType = 'imports' | 'calls' | 'extends' | 'implements' | 'uses' | 'depends_on' | 'related_to'; /** * Graph node - represents a code entity */ export interface GraphNode { _id?: ObjectId; nodeId: string; projectId: string; type: GraphNodeType; name: string; filePath?: string; metadata: { signature?: string; language?: string; loc?: number; complexity?: number; exports?: string[]; params?: string[]; returnType?: string; }; contentVector?: number[]; createdAt: Date; updatedAt: Date; } /** * Graph edge - represents a relationship */ export interface GraphEdge { _id?: ObjectId; edgeId: string; projectId: string; fromNodeId: string; toNodeId: string; type: GraphRelationType; weight?: number; metadata: { lineNumber?: number; isCircular?: boolean; isExternal?: boolean; }; createdAt: Date; updatedAt: Date; } /** * Graph query result */ export interface GraphQueryResult { nodes: GraphNode[]; edges: GraphEdge[]; paths?: GraphPath[]; } /** * Graph path - for dependency chains */ export interface GraphPath { nodes: string[]; edges: string[]; length: number; weight: number; } /** * Graph analytics */ export interface GraphAnalytics { totalNodes: number; totalEdges: number; nodesByType: Record<GraphNodeType, number>; edgesByType: Record<GraphRelationType, number>; mostConnected: Array<{ nodeId: string; name: string; inDegree: number; outDegree: number; }>; circularDependencies: Array<{ cycle: string[]; severity: 'low' | 'medium' | 'high'; }>; isolatedNodes: Array<{ nodeId: string; name: string; }>; } /** * Graph options for queries */ export interface GraphQueryOptions { maxDepth?: number; nodeTypes?: GraphNodeType[]; edgeTypes?: GraphRelationType[]; includeTransitive?: boolean; direction?: 'in' | 'out' | 'both'; } //# sourceMappingURL=graph.d.ts.map