Documentation
¶
Index ¶
- type BuildIndexRequest
- type BuildIndexResponse
- type CodeAPIController
- func (c *CodeAPIController) ExecuteCypher(ctx *gin.Context)
- func (c *CodeAPIController) ExecuteCypherWrite(ctx *gin.Context)
- func (c *CodeAPIController) FindClasses(ctx *gin.Context)
- func (c *CodeAPIController) FindMethods(ctx *gin.Context)
- func (c *CodeAPIController) GetCallGraph(ctx *gin.Context)
- func (c *CodeAPIController) GetCallees(ctx *gin.Context)
- func (c *CodeAPIController) GetCallers(ctx *gin.Context)
- func (c *CodeAPIController) GetClass(ctx *gin.Context)
- func (c *CodeAPIController) GetClassFields(ctx *gin.Context)
- func (c *CodeAPIController) GetClassMethods(ctx *gin.Context)
- func (c *CodeAPIController) GetCodeSnippet(ctx *gin.Context)
- func (c *CodeAPIController) GetDataDependents(ctx *gin.Context)
- func (c *CodeAPIController) GetDataSources(ctx *gin.Context)
- func (c *CodeAPIController) GetFieldAccessors(ctx *gin.Context)
- func (c *CodeAPIController) GetImpact(ctx *gin.Context)
- func (c *CodeAPIController) GetInheritanceTree(ctx *gin.Context)
- func (c *CodeAPIController) GetMethod(ctx *gin.Context)
- func (c *CodeAPIController) ListClasses(ctx *gin.Context)
- func (c *CodeAPIController) ListFiles(ctx *gin.Context)
- func (c *CodeAPIController) ListFunctions(ctx *gin.Context)
- func (c *CodeAPIController) ListMethods(ctx *gin.Context)
- func (c *CodeAPIController) ListRepos(ctx *gin.Context)
- type CodeGraphProcessor
- func (cgp *CodeGraphProcessor) Init(ctx context.Context, repo *config.Repository) error
- func (cgp *CodeGraphProcessor) Name() string
- func (cgp *CodeGraphProcessor) PostProcess(ctx context.Context, repo *config.Repository) error
- func (cgp *CodeGraphProcessor) ProcessFile(ctx context.Context, repo *config.Repository, fileCtx *FileContext) error
- type CommitData
- type CommitDiffData
- type EmbeddingProcessor
- func (ep *EmbeddingProcessor) Init(ctx context.Context, repo *config.Repository) error
- func (ep *EmbeddingProcessor) Name() string
- func (ep *EmbeddingProcessor) PostProcess(ctx context.Context, repo *config.Repository) error
- func (ep *EmbeddingProcessor) ProcessFile(ctx context.Context, repo *config.Repository, fileCtx *FileContext) error
- type ExecuteCypherRequest
- type FileChurnData
- type FileContext
- type FileDiffData
- type FileProcessor
- type FileStatData
- type FindClassesRequest
- type FindMethodsRequest
- type FlexibleFunctionID
- type FunctionChurnMetrics
- type GetCallGraphRequest
- type GetClassRequest
- type GetCodeSnippetRequest
- type GetCodeSnippetResponse
- type GetDataDependentsRequest
- type GetEntitySummaryRequest
- type GetFileSummariesRequest
- type GetFileSummariesResponse
- type GetFileSummaryRequest
- type GetImpactRequest
- type GetMethodRequest
- type GetSummaryStatsRequest
- type GetSummaryStatsResponse
- type GitChurnProcessor
- func (gcp *GitChurnProcessor) Init(ctx context.Context, repo *config.Repository) error
- func (gcp *GitChurnProcessor) Name() string
- func (gcp *GitChurnProcessor) PostProcess(ctx context.Context, repo *config.Repository) error
- func (gcp *GitChurnProcessor) ProcessFile(ctx context.Context, repo *config.Repository, fileCtx *FileContext) error
- type GitLogCache
- func (glc *GitLogCache) Build(ctx context.Context) error
- func (glc *GitLogCache) BuildDiffData(ctx context.Context, filePath string) (*FileDiffData, error)
- func (glc *GitLogCache) GetAllFileMetrics() map[string]*FileChurnData
- func (glc *GitLogCache) GetCommits() []CommitData
- func (glc *GitLogCache) GetFileMetrics(relativePath string) *FileChurnData
- type HunkData
- type HunkRange
- type IndexBuilder
- type IndexFileRequest
- type IndexFileResponse
- type IndexedFileResult
- type ListClassesRequest
- type ListFilesRequest
- type ListMethodsRequest
- type ListReposResponse
- type MethodSignatureResult
- type PostProcessor
- type RepoController
- func (rc *RepoController) BuildIndex(c *gin.Context)
- func (rc *RepoController) GetFunctionDependencies(c *gin.Context)
- func (rc *RepoController) GetFunctionDetails(c *gin.Context)
- func (rc *RepoController) GetFunctionsInFile(c *gin.Context)
- func (rc *RepoController) IndexFile(c *gin.Context)
- func (rc *RepoController) ProcessDirectory(c *gin.Context)
- func (rc *RepoController) SearchMethodsBySignature(c *gin.Context)
- func (rc *RepoController) SearchSimilarCode(c *gin.Context)
- type SearchMethodsBySignatureRequest
- type SearchMethodsBySignatureResponse
- type SummaryController
- type SummaryProcessor
- func (p *SummaryProcessor) GenerateClassSummaryOnDemand(ctx context.Context, repo *config.Repository, filePath string, ...) (*summary.CodeSummary, error)
- func (p *SummaryProcessor) GenerateFileSummariesOnDemand(ctx context.Context, repo *config.Repository, filePath string, ...) ([]*summary.CodeSummary, error)
- func (p *SummaryProcessor) GenerateFileSummaryOnDemand(ctx context.Context, repo *config.Repository, filePath string) (*summary.CodeSummary, error)
- func (p *SummaryProcessor) GenerateFunctionSummaryOnDemand(ctx context.Context, repo *config.Repository, filePath string, ...) (*summary.CodeSummary, error)
- func (p *SummaryProcessor) Init(ctx context.Context, repo *config.Repository) error
- func (p *SummaryProcessor) Name() string
- func (p *SummaryProcessor) PostProcess(ctx context.Context, repo *config.Repository) error
- func (p *SummaryProcessor) ProcessFile(ctx context.Context, repo *config.Repository, fileCtx *FileContext) error
- type SummaryProcessorConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildIndexRequest ¶
type BuildIndexResponse ¶
type CodeAPIController ¶
type CodeAPIController struct {
// contains filtered or unexported fields
}
CodeAPIController handles HTTP requests for the CodeAPI
func NewCodeAPIController ¶
func NewCodeAPIController(api codeapi.CodeAPI, cfg *config.Config, logger *zap.Logger) *CodeAPIController
NewCodeAPIController creates a new CodeAPIController
func (*CodeAPIController) ExecuteCypher ¶
func (c *CodeAPIController) ExecuteCypher(ctx *gin.Context)
ExecuteCypher executes a raw read-only Cypher query
func (*CodeAPIController) ExecuteCypherWrite ¶
func (c *CodeAPIController) ExecuteCypherWrite(ctx *gin.Context)
ExecuteCypherWrite executes a raw write Cypher query
func (*CodeAPIController) FindClasses ¶
func (c *CodeAPIController) FindClasses(ctx *gin.Context)
FindClasses finds classes matching criteria
func (*CodeAPIController) FindMethods ¶
func (c *CodeAPIController) FindMethods(ctx *gin.Context)
FindMethods finds methods matching criteria
func (*CodeAPIController) GetCallGraph ¶
func (c *CodeAPIController) GetCallGraph(ctx *gin.Context)
GetCallGraph returns the call graph for a function
func (*CodeAPIController) GetCallees ¶
func (c *CodeAPIController) GetCallees(ctx *gin.Context)
GetCallees returns functions called by the specified function
func (*CodeAPIController) GetCallers ¶
func (c *CodeAPIController) GetCallers(ctx *gin.Context)
GetCallers returns functions that call the specified function
func (*CodeAPIController) GetClass ¶
func (c *CodeAPIController) GetClass(ctx *gin.Context)
GetClass returns a class by ID
func (*CodeAPIController) GetClassFields ¶
func (c *CodeAPIController) GetClassFields(ctx *gin.Context)
GetClassFields returns fields belonging to a class
func (*CodeAPIController) GetClassMethods ¶
func (c *CodeAPIController) GetClassMethods(ctx *gin.Context)
GetClassMethods returns methods belonging to a class
func (*CodeAPIController) GetCodeSnippet ¶
func (c *CodeAPIController) GetCodeSnippet(ctx *gin.Context)
GetCodeSnippet returns a code snippet from a file in a repository
func (*CodeAPIController) GetDataDependents ¶
func (c *CodeAPIController) GetDataDependents(ctx *gin.Context)
GetDataDependents returns nodes that depend on a value
func (*CodeAPIController) GetDataSources ¶
func (c *CodeAPIController) GetDataSources(ctx *gin.Context)
GetDataSources returns nodes that contribute to a value
func (*CodeAPIController) GetFieldAccessors ¶
func (c *CodeAPIController) GetFieldAccessors(ctx *gin.Context)
GetFieldAccessors returns methods that access a field
func (*CodeAPIController) GetImpact ¶
func (c *CodeAPIController) GetImpact(ctx *gin.Context)
GetImpact returns impact analysis for a node
func (*CodeAPIController) GetInheritanceTree ¶
func (c *CodeAPIController) GetInheritanceTree(ctx *gin.Context)
GetInheritanceTree returns the inheritance hierarchy for a class
func (*CodeAPIController) GetMethod ¶
func (c *CodeAPIController) GetMethod(ctx *gin.Context)
GetMethod returns a method by ID
func (*CodeAPIController) ListClasses ¶
func (c *CodeAPIController) ListClasses(ctx *gin.Context)
ListClasses returns classes in a repository
func (*CodeAPIController) ListFiles ¶
func (c *CodeAPIController) ListFiles(ctx *gin.Context)
ListFiles returns files in a repository
func (*CodeAPIController) ListFunctions ¶
func (c *CodeAPIController) ListFunctions(ctx *gin.Context)
ListFunctions returns top-level functions in a repository
func (*CodeAPIController) ListMethods ¶
func (c *CodeAPIController) ListMethods(ctx *gin.Context)
ListMethods returns methods in a repository
func (*CodeAPIController) ListRepos ¶
func (c *CodeAPIController) ListRepos(ctx *gin.Context)
ListRepos returns all available repositories
type CodeGraphProcessor ¶
type CodeGraphProcessor struct {
// contains filtered or unexported fields
}
CodeGraphProcessor implements FileProcessor for code graph building
func NewCodeGraphProcessor ¶
func NewCodeGraphProcessor( config *config.Config, codeGraph *codegraph.CodeGraph, repoService *service.RepoService, logger *zap.Logger, ) *CodeGraphProcessor
NewCodeGraphProcessor creates a new code graph processor
func (*CodeGraphProcessor) Init ¶
func (cgp *CodeGraphProcessor) Init(ctx context.Context, repo *config.Repository) error
Init initializes the processor for a repository. This pre-initializes the language server to ensure it's ready for post-processing.
func (*CodeGraphProcessor) Name ¶
func (cgp *CodeGraphProcessor) Name() string
Name returns the processor name
func (*CodeGraphProcessor) PostProcess ¶
func (cgp *CodeGraphProcessor) PostProcess(ctx context.Context, repo *config.Repository) error
PostProcess performs LSP-based post-processing on the repository
func (*CodeGraphProcessor) ProcessFile ¶
func (cgp *CodeGraphProcessor) ProcessFile(ctx context.Context, repo *config.Repository, fileCtx *FileContext) error
ProcessFile processes a single file for code graph building
type CommitData ¶
type CommitData struct {
SHA string
Author string
Date time.Time
IsMerge bool
FileStats []FileStatData
}
CommitData holds data for a single commit
type CommitDiffData ¶
CommitDiffData holds diff data for a single commit
type EmbeddingProcessor ¶
type EmbeddingProcessor struct {
// contains filtered or unexported fields
}
EmbeddingProcessor implements FileProcessor for code chunk embeddings
func NewEmbeddingProcessor ¶
func NewEmbeddingProcessor(chunkService *vector.CodeChunkService, logger *zap.Logger) *EmbeddingProcessor
NewEmbeddingProcessor creates a new embedding processor
func (*EmbeddingProcessor) Init ¶
func (ep *EmbeddingProcessor) Init(ctx context.Context, repo *config.Repository) error
Init initializes the processor for a repository (no-op for EmbeddingProcessor)
func (*EmbeddingProcessor) Name ¶
func (ep *EmbeddingProcessor) Name() string
Name returns the processor name
func (*EmbeddingProcessor) PostProcess ¶
func (ep *EmbeddingProcessor) PostProcess(ctx context.Context, repo *config.Repository) error
PostProcess performs any cleanup or finalization after all files are processed
func (*EmbeddingProcessor) ProcessFile ¶
func (ep *EmbeddingProcessor) ProcessFile(ctx context.Context, repo *config.Repository, fileCtx *FileContext) error
ProcessFile processes a single file for embedding generation
type ExecuteCypherRequest ¶
type ExecuteCypherRequest struct {
Query string `json:"query" binding:"required"`
Params map[string]any `json:"params"`
}
ExecuteCypherRequest is the request for executing raw Cypher
type FileChurnData ¶
type FileChurnData struct {
LinesAdded int
LinesDeleted int
CommitCount int
Authors map[string]bool
FirstCommit time.Time
LastCommit time.Time
}
FileChurnData holds aggregated churn metrics for a file
type FileContext ¶
type FileContext struct {
// FileID is the unique identifier for this file version from MySQL
FileID int32
// FilePath is the absolute path to the file
FilePath string
// RelativePath is the path relative to the repository root
RelativePath string
// Content is the file content (already read to avoid multiple I/O)
Content []byte
// FileSHA is the SHA256 hash of the file content
FileSHA string
// CommitID is the git commit SHA if the file is committed (nil if ephemeral)
CommitID *string
// Ephemeral indicates if this is an uncommitted/working directory version
Ephemeral bool
}
FileContext contains metadata about a file being processed
type FileDiffData ¶
type FileDiffData struct {
Commits []CommitDiffData
}
FileDiffData holds detailed diff data for function attribution
type FileProcessor ¶
type FileProcessor interface {
// Init initializes the processor for a repository before any files are processed
// This is called once per repository at the start of processing
// Use this for setup operations like creating database tables or initializing stores
Init(ctx context.Context, repo *config.Repository) error
// ProcessFile processes a single file in the repository
// ctx: context for cancellation
// repo: repository configuration
// fileCtx: file context containing FileID, path, content, and metadata
// Returns an error if processing fails
ProcessFile(ctx context.Context, repo *config.Repository, fileCtx *FileContext) error
// PostProcess performs repository-level operations after all files are processed
// This is called once after all files have been processed
PostProcess(ctx context.Context, repo *config.Repository) error
// Name returns the name of this processor (for logging purposes)
Name() string
}
FileProcessor defines the interface for processing individual files and performing repository-level post-processing operations
type FileStatData ¶
type FileStatData struct {
FilePath string
LinesAdded int
LinesDeleted int
// For function-level attribution
HunkRanges []HunkRange
}
FileStatData holds file-level statistics from a commit
type FindClassesRequest ¶
type FindClassesRequest struct {
RepoName string `json:"repo_name" binding:"required"`
Name string `json:"name"`
NameLike string `json:"name_like"`
FilePath string `json:"file_path"`
FileID *int32 `json:"file_id"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
FindClassesRequest is the request for finding classes
type FindMethodsRequest ¶
type FindMethodsRequest struct {
RepoName string `json:"repo_name" binding:"required"`
Name string `json:"name"`
NameLike string `json:"name_like"`
ClassName string `json:"class_name"`
ClassID *ast.NodeID `json:"class_id"`
FilePath string `json:"file_path"`
FileID *int32 `json:"file_id"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
FindMethodsRequest is the request for finding methods
type FlexibleFunctionID ¶
FlexibleFunctionID can be unmarshaled from either a number or a string. If string, it can be:
- A numeric string: "12345" -> ID=12345
- A qualified name: "ClassName.methodName" -> ClassName="ClassName", FunctionName="methodName"
- A simple name: "main" -> FunctionName="main"
func (*FlexibleFunctionID) UnmarshalJSON ¶
func (f *FlexibleFunctionID) UnmarshalJSON(data []byte) error
type FunctionChurnMetrics ¶
type FunctionChurnMetrics struct {
LinesAdded int
LinesDeleted int
CommitCount int
Authors map[string]bool
}
FunctionChurnMetrics holds churn metrics for a function
type GetCallGraphRequest ¶
type GetCallGraphRequest struct {
RepoName string `json:"repo_name" binding:"required"`
FunctionID *FlexibleFunctionID `json:"function_id"`
FunctionName string `json:"function_name"`
ClassName string `json:"class_name"`
FilePath string `json:"file_path"`
Direction string `json:"direction"` // "outgoing", "incoming", "both"
MaxDepth int `json:"max_depth"`
IncludeExternal bool `json:"include_external"`
}
GetCallGraphRequest is the request for getting a call graph. function_id accepts either:
- A numeric ID: 12345 or "12345"
- A qualified name: "ClassName.methodName"
- A simple function name: "main"
type GetClassRequest ¶
type GetClassRequest struct {
RepoName string `json:"repo_name" binding:"required"`
ClassID int64 `json:"class_id" binding:"required"`
IncludeMethods bool `json:"include_methods"`
IncludeFields bool `json:"include_fields"`
}
GetClassRequest is the request for getting a class by ID
type GetCodeSnippetRequest ¶
type GetCodeSnippetRequest struct {
RepoName string `json:"repo_name" binding:"required"`
FilePath string `json:"file_path" binding:"required"`
StartLine int `json:"start_line" binding:"required,min=1"`
EndLine int `json:"end_line" binding:"required,min=1"`
}
GetCodeSnippetRequest is the request for getting a code snippet
type GetCodeSnippetResponse ¶
type GetCodeSnippetResponse struct {
RepoName string `json:"repo_name"`
FilePath string `json:"file_path"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
Code string `json:"code"`
TotalLines int `json:"total_lines"`
}
GetCodeSnippetResponse is the response for getting a code snippet
type GetDataDependentsRequest ¶
type GetDataDependentsRequest struct {
RepoName string `json:"repo_name" binding:"required"`
NodeID int64 `json:"node_id"`
VariableName string `json:"variable_name"`
FilePath string `json:"file_path"`
MaxDepth int `json:"max_depth"`
IncludeIndirect bool `json:"include_indirect"`
}
GetDataDependentsRequest is the request for getting data dependents
type GetEntitySummaryRequest ¶
type GetEntitySummaryRequest struct {
RepoName string `json:"repo_name" binding:"required"`
FilePath string `json:"file_path" binding:"required"`
EntityType string `json:"entity_type" binding:"required"` // "function" or "class"
EntityName string `json:"entity_name" binding:"required"`
}
GetEntitySummaryRequest is the request for getting a specific entity summary
type GetFileSummariesRequest ¶
type GetFileSummariesRequest struct {
RepoName string `json:"repo_name" binding:"required"`
FilePath string `json:"file_path" binding:"required"`
EntityType string `json:"entity_type"` // Optional: "function", "class", or empty for all
}
GetFileSummariesRequest is the request for getting all summaries for a file
type GetFileSummariesResponse ¶
type GetFileSummariesResponse struct {
FilePath string `json:"file_path"`
Summaries []*summary.CodeSummary `json:"summaries"`
Count int `json:"count"`
}
GetFileSummariesResponse is the response for GetFileSummaries
type GetFileSummaryRequest ¶
type GetFileSummaryRequest struct {
RepoName string `json:"repo_name" binding:"required"`
FilePath string `json:"file_path" binding:"required"`
}
GetFileSummaryRequest is the request for getting a file-level summary
type GetImpactRequest ¶
type GetImpactRequest struct {
RepoName string `json:"repo_name" binding:"required"`
NodeID int64 `json:"node_id"`
Name string `json:"name"`
NodeType string `json:"node_type"` // "function", "class", "field", "variable"
FilePath string `json:"file_path"`
MaxDepth int `json:"max_depth"`
IncludeCallGraph bool `json:"include_call_graph"`
IncludeDataFlow bool `json:"include_data_flow"`
}
GetImpactRequest is the request for impact analysis
type GetMethodRequest ¶
type GetMethodRequest struct {
RepoName string `json:"repo_name" binding:"required"`
MethodID int64 `json:"method_id" binding:"required"`
}
GetMethodRequest is the request for getting a method by ID
type GetSummaryStatsRequest ¶
type GetSummaryStatsRequest struct {
RepoName string `json:"repo_name" binding:"required"`
}
GetSummaryStatsRequest is the request for getting summary statistics
type GetSummaryStatsResponse ¶
type GetSummaryStatsResponse struct {
RepoName string `json:"repo_name"`
Stats *db.SummaryStats `json:"stats"`
}
GetSummaryStatsResponse is the response for GetSummaryStats
type GitChurnProcessor ¶
type GitChurnProcessor struct {
// contains filtered or unexported fields
}
GitChurnProcessor computes git churn metrics and stores them on graph nodes
func NewGitChurnProcessor ¶
func NewGitChurnProcessor( codeGraph *codegraph.CodeGraph, cfg *config.GitChurnConfig, logger *zap.Logger, ) *GitChurnProcessor
NewGitChurnProcessor creates a new GitChurnProcessor
func (*GitChurnProcessor) Init ¶
func (gcp *GitChurnProcessor) Init(ctx context.Context, repo *config.Repository) error
Init initializes the processor for a repository
func (*GitChurnProcessor) Name ¶
func (gcp *GitChurnProcessor) Name() string
Name returns the processor name
func (*GitChurnProcessor) PostProcess ¶
func (gcp *GitChurnProcessor) PostProcess(ctx context.Context, repo *config.Repository) error
PostProcess performs git churn analysis on the repository
func (*GitChurnProcessor) ProcessFile ¶
func (gcp *GitChurnProcessor) ProcessFile( ctx context.Context, repo *config.Repository, fileCtx *FileContext, ) error
ProcessFile is a no-op for churn analysis (all work done in PostProcess)
type GitLogCache ¶
type GitLogCache struct {
// contains filtered or unexported fields
}
GitLogCache caches parsed git log data for efficient querying
func NewGitLogCache ¶
func NewGitLogCache(repoPath string, config *config.GitChurnConfig, logger *zap.Logger) *GitLogCache
NewGitLogCache creates a new GitLogCache for the given repository
func (*GitLogCache) Build ¶
func (glc *GitLogCache) Build(ctx context.Context) error
Build parses the git log and populates the cache
func (*GitLogCache) BuildDiffData ¶
func (glc *GitLogCache) BuildDiffData(ctx context.Context, filePath string) (*FileDiffData, error)
BuildDiffData builds detailed diff data for function-level attribution This runs git log with -p for detailed diffs on specific files
func (*GitLogCache) GetAllFileMetrics ¶
func (glc *GitLogCache) GetAllFileMetrics() map[string]*FileChurnData
GetAllFileMetrics returns all file metrics
func (*GitLogCache) GetCommits ¶
func (glc *GitLogCache) GetCommits() []CommitData
GetCommits returns all parsed commits
func (*GitLogCache) GetFileMetrics ¶
func (glc *GitLogCache) GetFileMetrics(relativePath string) *FileChurnData
GetFileMetrics returns churn metrics for a specific file
type HunkData ¶
type HunkData struct {
OldStart int
OldCount int
NewStart int
NewCount int
LinesAdded int
LinesDeleted int
}
HunkData holds data for a single diff hunk
type IndexBuilder ¶
type IndexBuilder struct {
// contains filtered or unexported fields
}
IndexBuilder orchestrates the building of various indexes (code graph, embeddings) for a repository using a parallel file processing approach
func NewIndexBuilder ¶
func NewIndexBuilder(config *config.Config, processors []FileProcessor, fileVersionRepo *db.FileVersionRepository, logger *zap.Logger) *IndexBuilder
NewIndexBuilder creates a new index builder with the specified processors
func (*IndexBuilder) BuildIndex ¶
func (ib *IndexBuilder) BuildIndex(ctx context.Context, repo *config.Repository) error
BuildIndex processes a repository through all registered processors
func (*IndexBuilder) BuildIndexWithGitInfo ¶
func (ib *IndexBuilder) BuildIndexWithGitInfo(ctx context.Context, repo *config.Repository, useHead bool, gitInfo *util.GitInfo) error
BuildIndexWithGitInfo processes a repository with optional git HEAD optimization
type IndexFileRequest ¶
type IndexFileRequest struct {
RepoName string `json:"repo_name" binding:"required"`
RelativePaths []string `json:"relative_paths" binding:"required"`
}
IndexFileRequest represents the request to index a single file
type IndexFileResponse ¶
type IndexFileResponse struct {
RepoName string `json:"repo_name"`
Files []IndexedFileResult `json:"files"`
Message string `json:"message"`
}
IndexFileResponse represents the response after indexing files
type IndexedFileResult ¶
type IndexedFileResult struct {
RelativePath string `json:"relative_path"`
FileID int32 `json:"file_id,omitempty"`
FileSHA string `json:"file_sha,omitempty"`
Processors []string `json:"processors_run,omitempty"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
IndexedFileResult represents the result of indexing a single file
type ListClassesRequest ¶
type ListClassesRequest struct {
RepoName string `json:"repo_name" binding:"required"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
ListClassesRequest is the request for listing classes
type ListFilesRequest ¶
type ListFilesRequest struct {
RepoName string `json:"repo_name" binding:"required"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
ListFilesRequest is the request for listing files
type ListMethodsRequest ¶
type ListMethodsRequest struct {
RepoName string `json:"repo_name" binding:"required"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
ListMethodsRequest is the request for listing methods
type ListReposResponse ¶
type ListReposResponse struct {
Repos []string `json:"repos"`
}
ListReposResponse is the response for listing repositories
type MethodSignatureResult ¶
type MethodSignatureResult struct {
MethodName string `json:"method_name"`
ClassName string `json:"class_name,omitempty"`
Signature string `json:"signature"`
ReturnType string `json:"return_type,omitempty"`
ParameterTypes []string `json:"parameter_types,omitempty"`
ParameterNames []string `json:"parameter_names,omitempty"`
FilePath string `json:"file_path"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
Score float32 `json:"score"`
NormalizedText string `json:"normalized_text,omitempty"` // The normalized text used for embedding
}
MethodSignatureResult represents a single method found by signature search
type PostProcessor ¶
type PostProcessor struct {
// contains filtered or unexported fields
}
func NewPostProcessor ¶
func NewPostProcessor(codeGraph *codegraph.CodeGraph, lspService *lsp.LspService, logger *zap.Logger) *PostProcessor
func (*PostProcessor) PostProcessRepository ¶
func (pp *PostProcessor) PostProcessRepository(ctx context.Context, repo *config.Repository) error
func (*PostProcessor) ProcessFakeClasses ¶
type RepoController ¶
type RepoController struct {
// contains filtered or unexported fields
}
func NewRepoController ¶
func NewRepoController(repoService *service.RepoService, chunkService *vector.CodeChunkService, processors []FileProcessor, mysqlConn *db.MySQLConnection, config *config.Config, logger *zap.Logger) *RepoController
func (*RepoController) BuildIndex ¶
func (rc *RepoController) BuildIndex(c *gin.Context)
func (*RepoController) GetFunctionDependencies ¶
func (rc *RepoController) GetFunctionDependencies(c *gin.Context)
func (*RepoController) GetFunctionDetails ¶
func (rc *RepoController) GetFunctionDetails(c *gin.Context)
func (*RepoController) GetFunctionsInFile ¶
func (rc *RepoController) GetFunctionsInFile(c *gin.Context)
func (*RepoController) IndexFile ¶
func (rc *RepoController) IndexFile(c *gin.Context)
IndexFile indexes multiple files through all registered processors in parallel
func (*RepoController) ProcessDirectory ¶
func (rc *RepoController) ProcessDirectory(c *gin.Context)
func (*RepoController) SearchMethodsBySignature ¶
func (rc *RepoController) SearchMethodsBySignature(c *gin.Context)
SearchMethodsBySignature searches for methods using natural language queries on signatures
func (*RepoController) SearchSimilarCode ¶
func (rc *RepoController) SearchSimilarCode(c *gin.Context)
SearchSimilarCode handles searching for similar code using a code snippet
type SearchMethodsBySignatureRequest ¶
type SearchMethodsBySignatureRequest struct {
RepoName string `json:"repo_name" binding:"required"`
Query string `json:"query" binding:"required"` // Natural language query like "find user by email"
Limit int `json:"limit"` // Max results (default 10)
}
SearchMethodsBySignatureRequest represents the request for semantic signature search
type SearchMethodsBySignatureResponse ¶
type SearchMethodsBySignatureResponse struct {
RepoName string `json:"repo_name"`
Query string `json:"query"`
Results []MethodSignatureResult `json:"results"`
Success bool `json:"success"`
Message string `json:"message,omitempty"`
}
SearchMethodsBySignatureResponse represents the response from signature search
type SummaryController ¶
type SummaryController struct {
// contains filtered or unexported fields
}
SummaryController handles HTTP requests for code summary queries
func NewSummaryController ¶
func NewSummaryController( mysqlDB *sql.DB, cfg *config.Config, summaryProcessor *SummaryProcessor, logger *zap.Logger, ) *SummaryController
NewSummaryController creates a new SummaryController
func (*SummaryController) GetEntitySummary ¶
func (c *SummaryController) GetEntitySummary(ctx *gin.Context)
GetEntitySummary returns a specific function or class summary If the summary doesn't exist and on-demand generation is available, it will be generated
func (*SummaryController) GetFileSummaries ¶
func (c *SummaryController) GetFileSummaries(ctx *gin.Context)
GetFileSummaries returns all summaries for a file, optionally filtered by entity type. If no summaries exist and on-demand generation is available, summaries will be generated.
func (*SummaryController) GetFileSummary ¶
func (c *SummaryController) GetFileSummary(ctx *gin.Context)
GetFileSummary returns the file-level summary for a file If the summary doesn't exist and on-demand generation is available, it will be generated
func (*SummaryController) GetSummaryStats ¶
func (c *SummaryController) GetSummaryStats(ctx *gin.Context)
GetSummaryStats returns statistics about summaries for a repository
type SummaryProcessor ¶
type SummaryProcessor struct {
// contains filtered or unexported fields
}
SummaryProcessor generates hierarchical code summaries
func NewSummaryProcessor ¶
func NewSummaryProcessor( llmService llm.LLMService, promptManager *summary.PromptManager, mysqlDB *sql.DB, codeGraph *codegraph.CodeGraph, config *SummaryProcessorConfig, logger *zap.Logger, ) *SummaryProcessor
NewSummaryProcessor creates a new summary processor
func (*SummaryProcessor) GenerateClassSummaryOnDemand ¶
func (p *SummaryProcessor) GenerateClassSummaryOnDemand( ctx context.Context, repo *config.Repository, filePath string, className string, ) (*summary.CodeSummary, error)
GenerateClassSummaryOnDemand generates a summary for a class by name This is used when the API is called but no summary exists Note: This does not check p.config.Enabled since on-demand generation should always work
func (*SummaryProcessor) GenerateFileSummariesOnDemand ¶
func (p *SummaryProcessor) GenerateFileSummariesOnDemand( ctx context.Context, repo *config.Repository, filePath string, entityType summary.SummaryLevel, ) ([]*summary.CodeSummary, error)
GenerateFileSummariesOnDemand generates summaries for all entities in a file. If entityType is specified (non-zero), only generates summaries for that type. Returns the list of generated summaries. Note: This does not check p.config.Enabled since on-demand generation should always work
func (*SummaryProcessor) GenerateFileSummaryOnDemand ¶
func (p *SummaryProcessor) GenerateFileSummaryOnDemand( ctx context.Context, repo *config.Repository, filePath string, ) (*summary.CodeSummary, error)
GenerateFileSummaryOnDemand generates a summary for a file by path This is used when the API is called but no summary exists Note: This does not check p.config.Enabled since on-demand generation should always work
func (*SummaryProcessor) GenerateFunctionSummaryOnDemand ¶
func (p *SummaryProcessor) GenerateFunctionSummaryOnDemand( ctx context.Context, repo *config.Repository, filePath string, functionName string, ) (*summary.CodeSummary, error)
GenerateFunctionSummaryOnDemand generates a summary for a function by name This is used when the API is called but no summary exists Note: This does not check p.config.Enabled since on-demand generation should always work
func (*SummaryProcessor) Init ¶
func (p *SummaryProcessor) Init(ctx context.Context, repo *config.Repository) error
Init initializes the summary store for the repository
func (*SummaryProcessor) Name ¶
func (p *SummaryProcessor) Name() string
Name returns the processor name
func (*SummaryProcessor) PostProcess ¶
func (p *SummaryProcessor) PostProcess(ctx context.Context, repo *config.Repository) error
PostProcess generates folder and project level summaries These require all files to be processed first
func (*SummaryProcessor) ProcessFile ¶
func (p *SummaryProcessor) ProcessFile(ctx context.Context, repo *config.Repository, fileCtx *FileContext) error
ProcessFile generates summaries for functions, classes, and the file itself This runs after CodeGraphProcessor has already populated the code graph for this file