Documentation
¶
Index ¶
- Constants
- func ComputeApproxBetweenness(g *WeightedImportGraph, sampleSize int, seed int64) map[string]float64
- func ComputePageRank(g *WeightedImportGraph, iterations int, damping float64) map[string]float64
- func ComputePercentile(values []float64, p float64) float64
- func IsExported(name string, language string) bool
- func LouvainDetect_Deterministic(g *WeightedImportGraph, seed int64) map[string]int
- type BloomFilter
- type EFIEIndex
- func (e *EFIEIndex) Build(ctx context.Context) error
- func (e *EFIEIndex) Communities() map[int][]string
- func (e *EFIEIndex) CommunityOf(path string) int
- func (e *EFIEIndex) Define(symbol string) []SymbolLocation
- func (e *EFIEIndex) Downstream(path string, depth int) []string
- func (e *EFIEIndex) FileCount() int
- func (e *EFIEIndex) FileSymbols(path string) []SymbolInfo
- func (e *EFIEIndex) FormatContext(targetFiles []string, description string, topN int, maxBytes int) string
- func (e *EFIEIndex) IsBuilt() bool
- func (e *EFIEIndex) PageRankOf(path string) float64
- func (e *EFIEIndex) ProjectSummary(maxBytes int) string
- func (e *EFIEIndex) RelevantFiles(targetFiles []string, description string, topN int) []ScoredFile
- func (e *EFIEIndex) SymbolCount() int
- func (e *EFIEIndex) SymbolsMatching(query string) []string
- func (e *EFIEIndex) Upstream(path string, depth int) []string
- type EFIEIndexer
- func (e *EFIEIndexer) Build(ctx context.Context) error
- func (e *EFIEIndexer) BuiltAt() time.Time
- func (e *EFIEIndexer) Communities() map[int][]string
- func (e *EFIEIndexer) CommunityOf(path string) int
- func (e *EFIEIndexer) Define(symbol string) []SymbolLocation
- func (e *EFIEIndexer) Downstream(path string, depth int) []string
- func (e *EFIEIndexer) FileCount() int
- func (e *EFIEIndexer) FileSymbols(path string) []SymbolInfo
- func (e *EFIEIndexer) FormatContext(targetFiles []string, description string, topN int, maxBytes int) string
- func (e *EFIEIndexer) IsBuilt() bool
- func (e *EFIEIndexer) Neighbors(path string) (imports []string, importedBy []string)
- func (e *EFIEIndexer) PageRankOf(path string) float64
- func (e *EFIEIndexer) ProjectSummary(maxBytes int) string
- func (e *EFIEIndexer) RelevantFiles(targetFiles []string, description string, topN int) []ScoredFile
- func (e *EFIEIndexer) SymbolCount() int
- func (e *EFIEIndexer) SymbolsMatching(query string) []string
- func (e *EFIEIndexer) Upstream(path string, depth int) []string
- type FileInfo
- type FuncSignature
- type GoParser
- type ImportInfo
- type MultiResIndex
- func (idx *MultiResIndex) AddFile(path, language string, symbols []SymbolInfo)
- func (idx *MultiResIndex) AllSymbols() []string
- func (idx *MultiResIndex) BuildTrieIndex()
- func (idx *MultiResIndex) Communities() map[int][]string
- func (idx *MultiResIndex) CommunityAdj() map[int]map[int]bool
- func (idx *MultiResIndex) CommunityOf(path string) int
- func (idx *MultiResIndex) Define(name string) []SymbolLocation
- func (idx *MultiResIndex) FileCount() int
- func (idx *MultiResIndex) FileSymbols(path string) []SymbolInfo
- func (idx *MultiResIndex) SetCentralityPercentiles(p50, p95 float64)
- func (idx *MultiResIndex) SetCommunity(path string, community int)
- func (idx *MultiResIndex) SetCommunityAdj(adj map[int]map[int]bool)
- func (idx *MultiResIndex) SetImportanceRank(rank []string)
- func (idx *MultiResIndex) SortedImportanceRank() []string
- func (idx *MultiResIndex) SymbolCount() int
- func (idx *MultiResIndex) SymbolsMatching(query string) []string
- type Parser
- type PythonParser
- type QueryType
- type RustParser
- type ScoredFile
- type SymbolInfo
- type SymbolInfo2
- type SymbolLocation
- type Trie
- type TrieNode
- type TypeInfo
- type TypeScriptParser
- type WeightedImportGraph
- func (g *WeightedImportGraph) AddNode(path string, imports []string, language string)
- func (g *WeightedImportGraph) AllNodes() []*WeightedNode
- func (g *WeightedImportGraph) AllPaths() []string
- func (g *WeightedImportGraph) Downstream(path string, depth int) []string
- func (g *WeightedImportGraph) EdgeCount() int
- func (g *WeightedImportGraph) HasNode(path string) bool
- func (g *WeightedImportGraph) Neighbors(path string) (imports []string, importedBy []string)
- func (g *WeightedImportGraph) NodeCount() int
- func (g *WeightedImportGraph) RebuildEdges(path string, newImports []string)
- func (g *WeightedImportGraph) SetExternal(path string)
- func (g *WeightedImportGraph) Upstream(path string, depth int) []string
- type WeightedNode
Constants ¶
const ExternalNode = "__external__"
ExternalNode is the sentinel path for unresolved/external imports.
Variables ¶
This section is empty.
Functions ¶
func ComputeApproxBetweenness ¶
func ComputeApproxBetweenness(g *WeightedImportGraph, sampleSize int, seed int64) map[string]float64
ComputeApproxBetweenness computes approximate betweenness centrality using stratified random sampling.
func ComputePageRank ¶
func ComputePageRank(g *WeightedImportGraph, iterations int, damping float64) map[string]float64
ComputePageRank computes the stationary distribution probability for each node.
func ComputePercentile ¶
ComputePercentile returns the p-th percentile of the values.
func IsExported ¶
IsExported reports whether a symbol name is exported in its language.
func LouvainDetect_Deterministic ¶
func LouvainDetect_Deterministic(g *WeightedImportGraph, seed int64) map[string]int
LouvainDetect_Deterministic runs one-pass Louvain community detection with a fixed seed for reproducible output.
Types ¶
type BloomFilter ¶
type BloomFilter struct {
// contains filtered or unexported fields
}
BloomFilter provides O(1) probabilistic membership tests.
func NewBloomFilter ¶
func NewBloomFilter(expectedItems int, fpRate float64) *BloomFilter
NewBloomFilter creates a bloom filter for expectedItems with the given false positive rate. ~1.2 bytes per element at 1% FP rate.
func (*BloomFilter) Add ¶
func (bf *BloomFilter) Add(item string)
Add inserts an item into the bloom filter.
func (*BloomFilter) Contains ¶
func (bf *BloomFilter) Contains(item string) bool
Contains returns true if the item is probably in the set, false if definitely not. O(1) time.
type EFIEIndex ¶
type EFIEIndex struct {
// contains filtered or unexported fields
}
EFIEIndex is the main EFIE index containing the graph and multi-resolution index.
func NewEFIEIndex ¶
NewEFIEIndex creates a new EFIE index for the given working directory.
func (*EFIEIndex) Communities ¶
Communities returns all communities and their members.
func (*EFIEIndex) CommunityOf ¶
CommunityOf returns the community ID for a file.
func (*EFIEIndex) Define ¶
func (e *EFIEIndex) Define(symbol string) []SymbolLocation
Define returns where a symbol is defined.
func (*EFIEIndex) Downstream ¶
Downstream returns files that depend on the given path.
func (*EFIEIndex) FileSymbols ¶
func (e *EFIEIndex) FileSymbols(path string) []SymbolInfo
FileSymbols returns all symbols defined in a file.
func (*EFIEIndex) FormatContext ¶
func (e *EFIEIndex) FormatContext(targetFiles []string, description string, topN int, maxBytes int) string
FormatContext generates an LLM-ready text summary of relevant codebase intelligence.
func (*EFIEIndex) PageRankOf ¶
PageRankOf returns the PageRank score for a file.
func (*EFIEIndex) ProjectSummary ¶
ProjectSummary returns a high-level summary of the project structure.
func (*EFIEIndex) RelevantFiles ¶
func (e *EFIEIndex) RelevantFiles(targetFiles []string, description string, topN int) []ScoredFile
RelevantFiles returns top-N files relevant to the given targets and description.
func (*EFIEIndex) SymbolCount ¶
SymbolCount returns the number of unique symbols.
func (*EFIEIndex) SymbolsMatching ¶
SymbolsMatching returns symbols matching the query.
type EFIEIndexer ¶
type EFIEIndexer struct {
// contains filtered or unexported fields
}
EFIEIndexer wraps EFIEIndex to satisfy the codeintel.Indexer interface. This allows existing workflow code to use EFIE without modification.
func NewEFIEIndexer ¶
func NewEFIEIndexer(workDir string) *EFIEIndexer
NewEFIEIndexer creates a new EFIE-backed indexer.
func (*EFIEIndexer) Build ¶
func (e *EFIEIndexer) Build(ctx context.Context) error
Build constructs the EFIE index.
func (*EFIEIndexer) BuiltAt ¶
func (e *EFIEIndexer) BuiltAt() time.Time
BuiltAt returns when the indexer was last built.
func (*EFIEIndexer) Communities ¶
func (e *EFIEIndexer) Communities() map[int][]string
Communities returns all communities and their members.
func (*EFIEIndexer) CommunityOf ¶
func (e *EFIEIndexer) CommunityOf(path string) int
CommunityOf returns the community ID for a file.
func (*EFIEIndexer) Define ¶
func (e *EFIEIndexer) Define(symbol string) []SymbolLocation
Define returns where a symbol is defined.
func (*EFIEIndexer) Downstream ¶
func (e *EFIEIndexer) Downstream(path string, depth int) []string
Downstream returns files that depend on the given path.
func (*EFIEIndexer) FileCount ¶
func (e *EFIEIndexer) FileCount() int
FileCount returns the number of parsed source files.
func (*EFIEIndexer) FileSymbols ¶
func (e *EFIEIndexer) FileSymbols(path string) []SymbolInfo
FileSymbols returns all symbols defined in a file.
func (*EFIEIndexer) FormatContext ¶
func (e *EFIEIndexer) FormatContext(targetFiles []string, description string, topN int, maxBytes int) string
FormatContext generates an LLM-ready text summary.
func (*EFIEIndexer) IsBuilt ¶
func (e *EFIEIndexer) IsBuilt() bool
IsBuilt reports whether the indexer has been built.
func (*EFIEIndexer) Neighbors ¶
func (e *EFIEIndexer) Neighbors(path string) (imports []string, importedBy []string)
Neighbors returns direct imports and importers of a file.
func (*EFIEIndexer) PageRankOf ¶
func (e *EFIEIndexer) PageRankOf(path string) float64
PageRankOf returns the PageRank score for a file.
func (*EFIEIndexer) ProjectSummary ¶
func (e *EFIEIndexer) ProjectSummary(maxBytes int) string
ProjectSummary returns a high-level summary of the project structure.
func (*EFIEIndexer) RelevantFiles ¶
func (e *EFIEIndexer) RelevantFiles(targetFiles []string, description string, topN int) []ScoredFile
RelevantFiles returns top-N files relevant to the given targets.
func (*EFIEIndexer) SymbolCount ¶
func (e *EFIEIndexer) SymbolCount() int
SymbolCount returns the number of unique symbols.
func (*EFIEIndexer) SymbolsMatching ¶
func (e *EFIEIndexer) SymbolsMatching(query string) []string
SymbolsMatching returns symbols matching the query.
type FileInfo ¶
type FileInfo struct {
Path string
Language string
Imports []ImportInfo
Exports []SymbolInfo2
Funcs []FuncSignature
Types []TypeInfo
}
FileInfo is the parsed representation of a single source file.
type FuncSignature ¶
type FuncSignature struct {
Name string
Receiver string
Params string
Returns string
Exported bool
}
FuncSignature represents a function signature.
type ImportInfo ¶
type ImportInfo struct {
Path string
}
ImportInfo represents a single import declaration.
type MultiResIndex ¶
type MultiResIndex struct {
// contains filtered or unexported fields
}
MultiResIndex provides three-level indexing: File -> Package -> Community.
func NewMultiResIndex ¶
func NewMultiResIndex() *MultiResIndex
NewMultiResIndex creates a new empty multi-resolution index.
func (*MultiResIndex) AddFile ¶
func (idx *MultiResIndex) AddFile(path, language string, symbols []SymbolInfo)
AddFile adds a file to the index.
func (*MultiResIndex) AllSymbols ¶
func (idx *MultiResIndex) AllSymbols() []string
AllSymbols returns all unique symbol names.
func (*MultiResIndex) BuildTrieIndex ¶
func (idx *MultiResIndex) BuildTrieIndex()
BuildTrieIndex builds the symbol trie from all indexed symbols.
func (*MultiResIndex) Communities ¶
func (idx *MultiResIndex) Communities() map[int][]string
Communities returns all communities and their members.
func (*MultiResIndex) CommunityAdj ¶
func (idx *MultiResIndex) CommunityAdj() map[int]map[int]bool
CommunityAdj returns the community adjacency map.
func (*MultiResIndex) CommunityOf ¶
func (idx *MultiResIndex) CommunityOf(path string) int
CommunityOf returns the community ID for a file.
func (*MultiResIndex) Define ¶
func (idx *MultiResIndex) Define(name string) []SymbolLocation
Define returns all locations where a symbol is defined.
func (*MultiResIndex) FileCount ¶
func (idx *MultiResIndex) FileCount() int
FileCount returns the number of indexed files.
func (*MultiResIndex) FileSymbols ¶
func (idx *MultiResIndex) FileSymbols(path string) []SymbolInfo
FileSymbols returns all symbols defined in a file.
func (*MultiResIndex) SetCentralityPercentiles ¶
func (idx *MultiResIndex) SetCentralityPercentiles(p50, p95 float64)
SetCentralityPercentiles caches the 50th and 95th percentile centrality values.
func (*MultiResIndex) SetCommunity ¶
func (idx *MultiResIndex) SetCommunity(path string, community int)
SetCommunity sets the community ID for a file.
func (*MultiResIndex) SetCommunityAdj ¶
func (idx *MultiResIndex) SetCommunityAdj(adj map[int]map[int]bool)
SetCommunityAdj sets the adjacency map for communities.
func (*MultiResIndex) SetImportanceRank ¶
func (idx *MultiResIndex) SetImportanceRank(rank []string)
SetImportanceRank sets the importance-ranked file list.
func (*MultiResIndex) SortedImportanceRank ¶
func (idx *MultiResIndex) SortedImportanceRank() []string
SortedImportanceRank returns files sorted by PageRank descending.
func (*MultiResIndex) SymbolCount ¶
func (idx *MultiResIndex) SymbolCount() int
SymbolCount returns the number of unique symbols.
func (*MultiResIndex) SymbolsMatching ¶
func (idx *MultiResIndex) SymbolsMatching(query string) []string
SymbolsMatching returns symbols whose names contain the query (case-insensitive).
type Parser ¶
type Parser interface {
Language() string
CanParse(path string) bool
Parse(path string, content []byte) (*FileInfo, error)
}
Parser extracts structured information from a source file.
func AllParsers ¶
func AllParsers() []Parser
AllParsers returns the default set of language parsers.
func ParserForFile ¶
ParserForFile returns the first parser that can handle the given file.
type PythonParser ¶
type PythonParser struct{}
func (*PythonParser) CanParse ¶
func (p *PythonParser) CanParse(path string) bool
func (*PythonParser) Language ¶
func (p *PythonParser) Language() string
type RustParser ¶
type RustParser struct{}
func (*RustParser) CanParse ¶
func (p *RustParser) CanParse(path string) bool
func (*RustParser) Language ¶
func (p *RustParser) Language() string
type ScoredFile ¶
ScoredFile represents a file ranked by relevance to a task.
func Query ¶
func Query(efie *EFIEIndex, targetFiles []string, taskDescription string, queryType QueryType, topN int) []ScoredFile
Query executes an EFIE query with adaptive expansion.
func Score ¶
func Score(file string, targets []string, description string, graph *WeightedImportGraph, index *MultiResIndex, targetCommunities map[int]bool) ScoredFile
Score computes the EFIE relevance score for a file. It combines 6 weighted components: centrality, direct relevance, import proximity, symbol match, community boost, and Bloom cross-check.
type SymbolInfo ¶
SymbolInfo represents a named symbol in a file.
type SymbolInfo2 ¶
SymbolInfo2 represents a named symbol.
type SymbolLocation ¶
SymbolLocation identifies where a symbol is defined.
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
Trie provides O(K) prefix-based symbol search.
func (*Trie) PrefixSearch ¶
PrefixSearch returns all symbols sharing the given prefix. O(K + M) time.
type TrieNode ¶
type TrieNode struct {
// contains filtered or unexported fields
}
TrieNode represents a node in the trie for symbol matching.
type TypeScriptParser ¶
type TypeScriptParser struct{}
func (*TypeScriptParser) CanParse ¶
func (p *TypeScriptParser) CanParse(path string) bool
func (*TypeScriptParser) Language ¶
func (p *TypeScriptParser) Language() string
type WeightedImportGraph ¶
type WeightedImportGraph struct {
// contains filtered or unexported fields
}
WeightedImportGraph is a directed dependency graph with precomputed metrics.
func NewWeightedImportGraph ¶
func NewWeightedImportGraph() *WeightedImportGraph
NewWeightedImportGraph creates an empty weighted import graph.
func (*WeightedImportGraph) AddNode ¶
func (g *WeightedImportGraph) AddNode(path string, imports []string, language string)
AddNode adds a file to the graph with its imports.
func (*WeightedImportGraph) AllNodes ¶
func (g *WeightedImportGraph) AllNodes() []*WeightedNode
AllNodes returns all nodes in the graph.
func (*WeightedImportGraph) AllPaths ¶
func (g *WeightedImportGraph) AllPaths() []string
AllPaths returns all file paths in the graph.
func (*WeightedImportGraph) Downstream ¶
func (g *WeightedImportGraph) Downstream(path string, depth int) []string
Downstream returns all files that depend on `path`, up to `depth` levels.
func (*WeightedImportGraph) EdgeCount ¶
func (g *WeightedImportGraph) EdgeCount() int
EdgeCount returns the total number of directed edges.
func (*WeightedImportGraph) HasNode ¶
func (g *WeightedImportGraph) HasNode(path string) bool
HasNode reports whether the graph contains a node for the given path.
func (*WeightedImportGraph) Neighbors ¶
func (g *WeightedImportGraph) Neighbors(path string) (imports []string, importedBy []string)
Neighbors returns direct imports and direct importers of a file.
func (*WeightedImportGraph) NodeCount ¶
func (g *WeightedImportGraph) NodeCount() int
NodeCount returns the number of nodes in the graph.
func (*WeightedImportGraph) RebuildEdges ¶
func (g *WeightedImportGraph) RebuildEdges(path string, newImports []string)
RebuildEdges rebuilds edges for a single node and its neighbors.
func (*WeightedImportGraph) SetExternal ¶
func (g *WeightedImportGraph) SetExternal(path string)
SetExternal marks the external node so it can be excluded from community detection.
type WeightedNode ¶
type WeightedNode struct {
Path string
Imports []string // files this file imports (direct edges)
ImportedBy []string // files that import this file (reverse edges)
Language string
// Precomputed importance metrics
PageRank float64
Betweenness float64
Community int
DegreeCentrality float64
// Semantic fingerprint
SymbolBloom *BloomFilter
ImportSet map[string]bool
}
WeightedNode extends a basic graph node with precomputed importance metrics.