Documentation
¶
Index ¶
- type Edge
- type EdgeType
- type FileType
- type Graph
- func (g *Graph) AddCallGraphData(callGraphData []byte) error
- func (g *Graph) BuildFromAnalysis(ctx context.Context, projectAnalysis *types.ProjectAnalysis) error
- func (g *Graph) GetAPIs() []*Node
- func (g *Graph) GetNodeNeighbors(nodeID string) ([]*Node, error)
- func (g *Graph) ToJSON() ([]byte, error)
- func (g *Graph) UpdateFromAnalysis(ctx context.Context, projectAnalysis *types.ProjectAnalysis) error
- type LLMContext
- type LLMEnricher
- func (e *LLMEnricher) EnrichContext(ctx context.Context, yamlConfig *yaml.NexlayerYAML) (*LLMContext, error)
- func (e *LLMEnricher) GeneratePrompt(ctx context.Context, basePrompt string, yamlConfig *yaml.NexlayerYAML) (string, error)
- func (e *LLMEnricher) LoadMetadata() error
- func (e *LLMEnricher) QueryLLM(ctx context.Context, prompt string, config *yaml.NexlayerYAML) (*LLMResult, error)
- func (e *LLMEnricher) QueryLLMAsync(ctx context.Context, prompt string, config *yaml.NexlayerYAML) (<-chan *LLMResult, <-chan error)
- func (e *LLMEnricher) Shutdown(ctx context.Context)
- type LLMResult
- type MetadataType
- type Node
- type NodeType
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Edge ¶
type Edge struct {
Metadata map[MetadataType]interface{} `json:"metadata"`
Annotations map[string]string `json:"annotations"`
Source string `json:"source"`
Target string `json:"target"`
Type EdgeType `json:"type"`
}
Edge represents a relationship between nodes
type EdgeType ¶
type EdgeType string
EdgeType represents the type of relationship between nodes
const ( // Common edge types across languages EdgeCalls EdgeType = "calls" EdgeImports EdgeType = "imports" EdgeImplements EdgeType = "implements" EdgeExtends EdgeType = "extends" EdgeDependsOn EdgeType = "depends_on" EdgeCommunicatesWith EdgeType = "communicates_with" EdgeDefines EdgeType = "defines" EdgeUses EdgeType = "uses" EdgeDecorates EdgeType = "decorates" )
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph represents the project's knowledge graph
func (*Graph) AddCallGraphData ¶
AddCallGraphData integrates call graph data into the knowledge graph
func (*Graph) BuildFromAnalysis ¶
func (g *Graph) BuildFromAnalysis(ctx context.Context, projectAnalysis *types.ProjectAnalysis) error
BuildFromAnalysis constructs the graph from project analysis
func (*Graph) GetNodeNeighbors ¶
GetNodeNeighbors returns all nodes connected to a given node
func (*Graph) UpdateFromAnalysis ¶
func (g *Graph) UpdateFromAnalysis(ctx context.Context, projectAnalysis *types.ProjectAnalysis) error
UpdateFromAnalysis incrementally updates the graph with new analysis data
type LLMContext ¶
type LLMContext struct {
ProjectStructure map[string]interface{} `json:"project_structure"`
Dependencies map[string]string `json:"dependencies"`
Languages map[string]interface{} `json:"languages"`
Frameworks map[string]interface{} `json:"frameworks"`
Resources map[string]interface{} `json:"resources"`
Network map[string]interface{} `json:"network"`
Storage map[string]interface{} `json:"storage"`
APIEndpoints []interface{} `json:"api_endpoints"`
PodFlows []interface{} `json:"pod_flows"`
Patterns []interface{} `json:"patterns"`
}
LLMContext represents the enriched context for LLM interactions
type LLMEnricher ¶
type LLMEnricher struct {
// contains filtered or unexported fields
}
LLMEnricher enriches the knowledge graph with LLM metadata
func NewLLMEnricher ¶
func NewLLMEnricher(graph *Graph, metadataDir string) *LLMEnricher
NewLLMEnricher creates a new LLM metadata enricher with optimized caching
func (*LLMEnricher) EnrichContext ¶
func (e *LLMEnricher) EnrichContext(ctx context.Context, yamlConfig *yaml.NexlayerYAML) (*LLMContext, error)
EnrichContext enriches the context with information from the configuration
func (*LLMEnricher) GeneratePrompt ¶
func (e *LLMEnricher) GeneratePrompt(ctx context.Context, basePrompt string, yamlConfig *yaml.NexlayerYAML) (string, error)
GeneratePrompt generates a prompt for the LLM
func (*LLMEnricher) LoadMetadata ¶
func (e *LLMEnricher) LoadMetadata() error
LoadMetadata loads LLM metadata from the tools directory with caching
func (*LLMEnricher) QueryLLM ¶
func (e *LLMEnricher) QueryLLM(ctx context.Context, prompt string, config *yaml.NexlayerYAML) (*LLMResult, error)
QueryLLM queries the LLM with a prompt and configuration
func (*LLMEnricher) QueryLLMAsync ¶
func (e *LLMEnricher) QueryLLMAsync(ctx context.Context, prompt string, config *yaml.NexlayerYAML) (<-chan *LLMResult, <-chan error)
QueryLLMAsync queries the LLM asynchronously
func (*LLMEnricher) Shutdown ¶
func (e *LLMEnricher) Shutdown(ctx context.Context)
Shutdown gracefully shuts down the LLM enricher
type LLMResult ¶
type LLMResult struct {
Result string `json:"result"`
Timestamp time.Time `json:"timestamp"`
Source string `json:"source"` // "cache" or "api"
}
LLMResult represents the result of an LLM query with metadata
type MetadataType ¶
type MetadataType string
MetadataType represents the type of metadata stored in node properties
const ( // Metadata types for deployment and configuration MetadataLocation MetadataType = "location" // File location info MetadataVisibility MetadataType = "visibility" // Public/private/exported MetadataDeployment MetadataType = "deployment" // Deployment-specific info MetadataResource MetadataType = "resource" // Resource requirements MetadataNetwork MetadataType = "network" // Network configuration MetadataAuth MetadataType = "auth" // Authentication requirements MetadataStorage MetadataType = "storage" // Storage requirements )
type Node ¶
type Node struct {
Metadata map[MetadataType]interface{} `json:"metadata"`
Annotations map[string]string `json:"annotations"`
ID string `json:"id"`
Type NodeType `json:"type"`
Name string `json:"name"`
Path string `json:"path,omitempty"`
Language string `json:"language,omitempty"`
}
Node represents a code entity in the knowledge graph
type NodeType ¶
type NodeType string
NodeType represents the type of a node in the knowledge graph
const ( // Common node types across languages TypeFunction NodeType = "function" TypeClass NodeType = "class" TypeMethod NodeType = "method" TypeModule NodeType = "module" TypePackage NodeType = "package" TypeDependency NodeType = "dependency" TypeAPIEndpoint NodeType = "api_endpoint" TypeFile NodeType = "file" TypeConfigFile NodeType = "config" TypeVariable NodeType = "variable" TypeType NodeType = "type" TypeInterface NodeType = "interface" TypeConstant NodeType = "constant" TypeAnnotation NodeType = "annotation" TypeDecorator NodeType = "decorator" )
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher monitors project files for changes and updates the knowledge graph
func NewWatcher ¶
func NewWatcher(graph *Graph, projectDir string, analyzer func(string) (*types.ProjectAnalysis, error)) (*Watcher, error)
NewWatcher creates a new file system watcher