Documentation
¶
Index ¶
Constants ¶
View Source
const ( // PropArchRole is the architectural role of a node (e.g., "controller", "service", // "repository", "middleware", "factory", "observer", "gateway"). PropArchRole = "architectural_role" // PropDesignPattern is a comma-separated list of design patterns detected // (e.g., "repository,singleton", "factory", "observer"). PropDesignPattern = "design_pattern" // PropLayerTag classifies nodes into architectural layers // (e.g., "presentation", "business", "data_access", "infrastructure"). PropLayerTag = "layer" // PropGraphSource indicates which branch a node or edge came from // when using BranchStore. Set to the branch name on reads, never persisted. PropGraphSource = "graph_source" )
Well-known property keys used for architectural classification.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Edge ¶
type Edge struct {
ID string `json:"id"`
Type EdgeType `json:"type"`
SourceID string `json:"source_id"`
TargetID string `json:"target_id"`
Properties map[string]string `json:"properties,omitempty"`
}
Edge represents a relationship between two nodes in the knowledge graph.
type EdgeType ¶
type EdgeType string
EdgeType represents a relationship between two nodes.
const ( EdgeContains EdgeType = "Contains" EdgeImports EdgeType = "Imports" EdgeDependsOn EdgeType = "DependsOn" EdgeCalls EdgeType = "Calls" EdgeImplements EdgeType = "Implements" EdgeExposes EdgeType = "Exposes" EdgeConsumes EdgeType = "Consumes" EdgeDocuments EdgeType = "Documents" EdgeTests EdgeType = "Tests" EdgeMigrates EdgeType = "Migrates" EdgeConfigures EdgeType = "Configures" EdgeHasTopic EdgeType = "HasTopic" EdgeAppearsIn EdgeType = "AppearsIn" )
type GraphStats ¶
type GraphStats struct {
NodeCount int64 `json:"node_count"`
EdgeCount int64 `json:"edge_count"`
NodesByType map[NodeType]int64 `json:"nodes_by_type"`
EdgesByType map[EdgeType]int64 `json:"edges_by_type"`
}
GraphStats holds aggregate statistics about the knowledge graph.
type Node ¶
type Node struct {
ID string `json:"id"`
Type NodeType `json:"type"`
Name string `json:"name"`
QualifiedName string `json:"qualified_name"`
FilePath string `json:"file_path"`
Line int `json:"line"`
EndLine int `json:"end_line"`
Package string `json:"package"`
Language string `json:"language"`
Exported bool `json:"exported"`
Signature string `json:"signature,omitempty"`
DocComment string `json:"doc_comment,omitempty"`
Properties map[string]string `json:"properties,omitempty"`
Metrics map[string]float64 `json:"metrics,omitempty"`
}
Node represents a source code or documentation entity in the knowledge graph.
type NodeFilter ¶
type NodeFilter struct {
Type NodeType
FilePath string
Package string
Language string
NamePattern string // glob pattern matched against Name
Exported *bool
// Properties filters nodes by property key-value pairs.
// All specified entries must match (AND logic).
Properties map[string]string
}
NodeFilter specifies criteria for querying nodes.
type NodeType ¶
type NodeType string
NodeType represents the kind of entity in the knowledge graph.
const ( NodeRepository NodeType = "Repository" NodeService NodeType = "Service" NodeModule NodeType = "Module" NodePackage NodeType = "Package" NodeFile NodeType = "File" NodeFunction NodeType = "Function" NodeMethod NodeType = "Method" NodeClass NodeType = "Class" NodeStruct NodeType = "Struct" NodeInterface NodeType = "Interface" NodeEnum NodeType = "Enum" NodeType_ NodeType = "Type" NodeConstant NodeType = "Constant" NodeVariable NodeType = "Variable" NodeAPIEndpoint NodeType = "APIEndpoint" NodeDBModel NodeType = "DBModel" NodeDomainModel NodeType = "DomainModel" NodeViewModel NodeType = "ViewModel" NodeDTO NodeType = "DTO" NodeMigration NodeType = "Migration" NodeDependency NodeType = "Dependency" NodeDocument NodeType = "Document" NodeAIGuideline NodeType = "AIGuideline" NodeTestFunction NodeType = "TestFunction" NodeTestFile NodeType = "TestFile" NodeDirectory NodeType = "Directory" NodeTopic NodeType = "Topic" NodePerson NodeType = "Person" )
type Store ¶
type Store interface {
// AddNode inserts a new node into the graph.
AddNode(ctx context.Context, node *Node) error
// UpdateNode replaces an existing node (matched by ID).
UpdateNode(ctx context.Context, node *Node) error
// DeleteNode removes a node by ID along with its connected edges.
DeleteNode(ctx context.Context, id string) error
// GetNode retrieves a single node by ID.
GetNode(ctx context.Context, id string) (*Node, error)
// QueryNodes returns all nodes matching the given filter.
QueryNodes(ctx context.Context, filter NodeFilter) ([]*Node, error)
// AddEdge inserts a new edge into the graph.
AddEdge(ctx context.Context, edge *Edge) error
// DeleteEdge removes an edge by ID.
DeleteEdge(ctx context.Context, id string) error
// GetEdges returns edges connected to nodeID with the given type.
// If edgeType is empty, all edge types are returned.
GetEdges(ctx context.Context, nodeID string, edgeType EdgeType) ([]*Edge, error)
// GetNeighbors returns nodes connected to nodeID via edges of the given type
// in the specified direction. If edgeType is empty, all edge types are traversed.
GetNeighbors(ctx context.Context, nodeID string, edgeType EdgeType, direction Direction) ([]*Node, error)
// DeleteByFile removes all nodes (and their edges) associated with the given file path.
// This supports incremental updates: delete everything from a file before re-indexing it.
DeleteByFile(ctx context.Context, filePath string) error
// Stats returns aggregate statistics about the graph.
Stats(ctx context.Context) (*GraphStats, error)
// Close releases resources held by the store.
Close() error
}
Store is the interface for knowledge graph persistence.
Click to show internal directories.
Click to hide internal directories.