Documentation
¶
Index ¶
- func FunctionDefinitionToKey(def FunctionDefinition) string
- type CallEdge
- type CallGraph
- type ChunkType
- type CodeChunk
- func (c *CodeChunk) GetSearchableText(includeContext bool) string
- func (c *CodeChunk) WithContext(moduleName, className string) *CodeChunk
- func (c *CodeChunk) WithDocstring(docstring string) *CodeChunk
- func (c *CodeChunk) WithEmbedding(embedding []float32) *CodeChunk
- func (c *CodeChunk) WithFileID(fileID int32) *CodeChunk
- func (c *CodeChunk) WithMetadata(key string, value interface{}) *CodeChunk
- func (c *CodeChunk) WithName(name string) *CodeChunk
- func (c *CodeChunk) WithParent(parentID string) *CodeChunk
- func (c *CodeChunk) WithSignature(signature string) *CodeChunk
- type FileInfo
- type FunctionDefinition
- type FunctionDependency
- type FunctionDetails
- type GetFunctionDependenciesRequest
- type GetFunctionDependenciesResponse
- type GetFunctionDetailsRequest
- type GetFunctionDetailsResponse
- type GetFunctionsInFileRequest
- type GetFunctionsInFileResponse
- type Parameter
- type ProcessDirectoryRequest
- type ProcessDirectoryResponse
- type ProcessRepoResponse
- type QueryInfo
- type SearchSimilarCodeRequest
- type SearchSimilarCodeResponse
- type SimilarCodeResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FunctionDefinitionToKey ¶
func FunctionDefinitionToKey(def FunctionDefinition) string
Types ¶
type CallEdge ¶
type CallEdge struct {
From *FunctionDefinition `json:"from"`
To *FunctionDefinition `json:"to"`
}
type CallGraph ¶
type CallGraph struct {
Roots []FunctionDefinition `json:"roots"`
Functions []FunctionDefinition `json:"functions"`
Edges []CallEdge `json:"edges"`
// contains filtered or unexported fields
}
func NewCallGraph ¶
func NewCallGraph() *CallGraph
func (*CallGraph) AddFunctionDependency ¶
func (cg *CallGraph) AddFunctionDependency(caller *FunctionDefinition, dep *FunctionDependency)
type ChunkType ¶
type ChunkType string
ChunkType represents the hierarchical level of a code chunk
const ( ChunkTypeFile ChunkType = "file" ChunkTypeClass ChunkType = "class" ChunkTypeFunction ChunkType = "function" ChunkTypeBlock ChunkType = "block" ChunkTypeConditional ChunkType = "conditional" // if, else, switch, case ChunkTypeLoop ChunkType = "loop" // for, while, do-while ChunkTypeMethodSignature ChunkType = "method_signature" // For semantic signature search )
type CodeChunk ¶
type CodeChunk struct {
// Unique identifier for this chunk
ID string `json:"id"`
// FileID from MySQL file_versions table (shared with CodeGraph)
FileID int32 `json:"file_id"`
// Hierarchical metadata
ChunkType ChunkType `json:"chunk_type"`
Level int `json:"level"` // 1=file, 2=class, 3=function, 4=block
ParentID string `json:"parent_id,omitempty"`
// Code content
Content string `json:"content"`
Language string `json:"language"`
FilePath string `json:"file_path"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
Range base.Range `json:"range"`
// Semantic metadata
Name string `json:"name,omitempty"` // Function/class/file name
Signature string `json:"signature,omitempty"` // Function signature
Docstring string `json:"docstring,omitempty"` // Documentation
// Context for better understanding
ModuleName string `json:"module_name,omitempty"` // Package/module name
ClassName string `json:"class_name,omitempty"` // Parent class if method
// Vector embedding (generated by embedding model)
Embedding []float32 `json:"embedding,omitempty"`
// Additional metadata
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
CodeChunk represents a hierarchical piece of code with vector embedding
func NewCodeChunk ¶
func NewCodeChunk(id string, chunkType ChunkType, level int, content, language, filePath string, rng base.Range) *CodeChunk
NewCodeChunk creates a new code chunk with basic information
func (*CodeChunk) GetSearchableText ¶
GetSearchableText returns the text representation for embedding generation Truncates content to avoid exceeding embedding model context limits includeContext: if true, includes module/class context; if false, only includes the code content
func (*CodeChunk) WithContext ¶
WithContext sets the module and class context
func (*CodeChunk) WithDocstring ¶
WithDocstring sets the documentation string
func (*CodeChunk) WithEmbedding ¶
WithEmbedding sets the vector embedding
func (*CodeChunk) WithFileID ¶
WithFileID sets the FileID from MySQL
func (*CodeChunk) WithMetadata ¶
WithMetadata adds custom metadata
func (*CodeChunk) WithParent ¶
WithParent sets the parent chunk ID
func (*CodeChunk) WithSignature ¶
WithSignature sets the function signature
type FunctionDefinition ¶
type FunctionDefinition struct {
Name string `json:"name"`
Location base.Location `json:"location"`
IsExternal bool `json:"is_external"`
Module string `json:"module,omitempty"`
Params string `json:"params"`
Returns string `json:"returns"`
}
func MapToFunctionFromDocumentSymbol ¶
func MapToFunctionFromDocumentSymbol(uri string, sym *base.DocumentSymbol) FunctionDefinition
func MapToFunctionFromSymbolInformation ¶
func MapToFunctionFromSymbolInformation(uri string, sym *base.SymbolInformation) FunctionDefinition
func (*FunctionDefinition) ToKey ¶
func (fn *FunctionDefinition) ToKey() string
type FunctionDependency ¶
type FunctionDependency struct {
Name string `json:"name"`
CallLocations []base.Location `json:"call_locations"`
Definition FunctionDefinition `json:"definition"`
}
func MapToFunctionDependency ¶
func MapToFunctionDependency(call base.CallHierarchyOutgoingCall, lspClient base.LSPClient) FunctionDependency
type FunctionDetails ¶
type GetFunctionDependenciesResponse ¶
type GetFunctionDependenciesResponse struct {
RepoName string `json:"repo_name"`
FilePath string `json:"file_path"`
FunctionName string `json:"function_name"`
Dependencies []FunctionDependency `json:"dependencies"`
}
type GetFunctionDetailsResponse ¶
type GetFunctionDetailsResponse struct {
RepoName string `json:"repo_name"`
FilePath string `json:"file_path"`
FunctionName string `json:"function_name"`
Details FunctionDetails `json:"details"`
}
type GetFunctionsInFileResponse ¶
type GetFunctionsInFileResponse struct {
RepoName string `json:"repo_name"`
FilePath string `json:"file_path"`
Functions []FunctionDefinition `json:"functions"`
}
type ProcessDirectoryRequest ¶
type ProcessRepoResponse ¶
type ProcessRepoResponse struct {
RepoName string `json:"repo_name"`
Files []FileInfo `json:"files"`
Functions []FunctionDefinition `json:"functions"`
}
type SearchSimilarCodeRequest ¶
type SearchSimilarCodeRequest struct {
RepoName string `json:"repo_name" binding:"required"`
CollectionName string `json:"collection_name"`
CodeSnippet string `json:"code_snippet" binding:"required"`
Language string `json:"language" binding:"required"`
Limit int `json:"limit"`
IncludeCode bool `json:"include_code"`
}