Versions in this module Expand all Collapse all v0 v0.1.156 Apr 24, 2026 v0.1.155 Apr 24, 2026 Changes in this version + func ComputeFileHashes(vfs VFS, dir string, extensions map[string]bool) map[string]string + func DedentLines(lines []string) []string + func FormatTimeline(timelines []*FileTimeline) string + func FormatTimelineStats(s TimelineStats) string + func Levenshtein(a, b string) int + func OperationName(req *codev0.CodeRequest) string + type ASTSymbolProvider struct + func NewASTSymbolProvider(dir string) *ASTSymbolProvider + func NewASTSymbolProviderVFS(dir string, vfs VFS) *ASTSymbolProvider + func (p *ASTSymbolProvider) Graph() (*CodeGraph, error) + func (p *ASTSymbolProvider) ListSymbols(_ context.Context, file string) ([]*codev0.Symbol, error) + type AgeBucket string + const AgeAncient + const AgeModerate + const AgeOld + const AgeRecent + type ByteLRU struct + MaxEntrySize int64 + func NewByteLRU(capacity int64) *ByteLRU + func (c *ByteLRU) Clear() + func (c *ByteLRU) Get(key string) []byte + func (c *ByteLRU) Invalidate(key string) + func (c *ByteLRU) Len() int + func (c *ByteLRU) Put(key string, data []byte) + func (c *ByteLRU) Size() int64 + type CachedVFS struct + func NewCachedVFS(base VFS, dir string) (*CachedVFS, error) + func (c *CachedVFS) Close() error + func (c *CachedVFS) Invalidate() error + func (c *CachedVFS) MkdirAll(path string, perm os.FileMode) error + func (c *CachedVFS) ReadDir(path string) ([]os.DirEntry, error) + func (c *CachedVFS) ReadFile(path string) ([]byte, error) + func (c *CachedVFS) Remove(path string) error + func (c *CachedVFS) Rename(oldpath, newpath string) error + func (c *CachedVFS) Stat(path string) (os.FileInfo, error) + func (c *CachedVFS) WalkDir(root string, fn fs.WalkDirFunc) error + func (c *CachedVFS) WriteFile(path string, data []byte, perm os.FileMode) error + type CodeExecutor interface + Execute func(context.Context, *codev0.CodeRequest) (*codev0.CodeResponse, error) + type CodeGraph struct + Edges []Edge + Nodes map[string]*CodeNode + func NewCodeGraph() *CodeGraph + func ParseGoTree(dir string) (*CodeGraph, error) + func ParseGoTreeVFS(vfs VFS, dir string) (*CodeGraph, error) + func (g *CodeGraph) AddEdge(e Edge) + func (g *CodeGraph) AddNode(n *CodeNode) + func (g *CodeGraph) Files() []string + func (g *CodeGraph) FindDefinitions(name string) []*CodeNode + func (g *CodeGraph) FindDefinitionsByKind(name string, kind NodeKind) []*CodeNode + func (g *CodeGraph) FindUsages(name string) []*CodeNode + func (g *CodeGraph) FunctionNodes() []*CodeNode + func (g *CodeGraph) GetCallees(nodeID string) []string + func (g *CodeGraph) GetCallers(nodeID string) []string + func (g *CodeGraph) GetCallersOfAny(nodeIDs []string) []string + func (g *CodeGraph) GetNeighborhood(nodeID string) *Neighborhood + func (g *CodeGraph) GetNodesForFile(file string) []string + func (g *CodeGraph) GetSameFile(nodeID string) []string + func (g *CodeGraph) NameIndexSize() int + func (g *CodeGraph) RebuildIndexes() + func (g *CodeGraph) RemoveNode(nodeID string) + func (g *CodeGraph) RemoveNodesForFile(file string) []string + func (g *CodeGraph) ResolveIDs(ids []string) []*CodeNode + func (g *CodeGraph) SearchSymbols(query string) []*CodeNode + func (g *CodeGraph) Stats() GraphStats + func (g *CodeGraph) SummaryableNodes() []*CodeNode + type CodeMap struct + Files []FileMap + Language string + func BuildCodeMap(language string, symbols []SymbolInput) *CodeMap + func (cm *CodeMap) Format() string + func (cm *CodeMap) Stats() CodeMapStats + type CodeMapStats struct + Files int + Symbols int + type CodeNode struct + Body string + CalledBy []string + Calls []string + Children []string + Doc string + EndLine int + File string + ID string + Imports []string + Kind NodeKind + Line int + Name string + Signature string + func (n *CodeNode) QualifiedName() string + type CodebaseContext struct + CodeMap *CodeMap + DepGraph *DepGraph + Graph *CodeGraph + Language string + Module string + Packages []*codev0.PackageInfo + Stats TimelineStats + Timelines []*FileTimeline + func BuildCodebaseContext(ctx context.Context, server CodeExecutor) (*CodebaseContext, error) + func (cc *CodebaseContext) FilePaths() []string + func (cc *CodebaseContext) Format(budget int) string + type DefaultCodeServer struct + FS VFS + SourceDir string + func NewDefaultCodeServer(sourceDir string, opts ...ServerOption) *DefaultCodeServer + func (s *DefaultCodeServer) Close() error + func (s *DefaultCodeServer) Execute(ctx context.Context, req *codev0.CodeRequest) (*codev0.CodeResponse, error) + func (s *DefaultCodeServer) FileOps() FileOperation + func (s *DefaultCodeServer) GetSourceDir() string + func (s *DefaultCodeServer) GetVFS() VFS + func (s *DefaultCodeServer) Override(op string, handler OperationHandler) + func (s *DefaultCodeServer) SetWriteListener(l WriteListener) + type DepEdge struct + From string + To string + type DepGraph struct + Module string + Packages []PackageNode + func BuildDepGraph(module string, packages []PackageInput) *DepGraph + func (g *DepGraph) ConnectedComponents() [][]string + func (g *DepGraph) Format() string + func (g *DepGraph) InternalEdges() []DepEdge + func (g *DepGraph) Leaves() []string + func (g *DepGraph) Roots() []string + type DiffKind int + const DiffAdd + const DiffContext + const DiffRemove + func (k DiffKind) String() string + type DiffLine struct + Content string + Kind DiffKind + NewLine int + OldLine int + type Edge struct + From string + Kind EdgeKind + To string + type EdgeKind int + const EdgeCalls + const EdgeContains + const EdgeImports + func (e EdgeKind) String() string + type EditResult struct + Content string + OK bool + Strategy string + func SmartEdit(content, find, replace string) EditResult + type FileChange struct + Content []byte + Path string + Type string + type FileDiff struct + Hunks []Hunk + NewPath string + OldPath string + func ParseUnifiedDiff(raw string) []FileDiff + func (fd *FileDiff) Summary() string + type FileMap struct + Path string + Symbols []SymbolEntry + type FileOperation interface + CopyFile func(ctx context.Context, srcPath, destPath string) error + DeleteFile func(ctx context.Context, path string) error + ListFiles func(ctx context.Context, path string, recursive bool, extensions []string) ([]string, error) + MoveFile func(ctx context.Context, oldPath, newPath string) error + ReadFile func(ctx context.Context, path string) ([]byte, error) + ReplaceInFile func(ctx context.Context, path, find, replace string) (changed bool, err error) + Search func(ctx context.Context, opts SearchOpts) (*SearchResult, error) + WriteFile func(ctx context.Context, path string, data []byte) error + func NewFileOps(vfs VFS, root string) FileOperation + type FileTimeline struct + Chunks []TimelineChunk + Path string + func BuildFileTimeline(path string, blameLines []*codev0.GitBlameLine, refDate time.Time) *FileTimeline + func BuildProjectTimeline(ctx context.Context, vfs VFS, rootDir string, extensions []string, ...) ([]*FileTimeline, error) + func (ft *FileTimeline) Lines() int + func (ft *FileTimeline) Newest() time.Time + func (ft *FileTimeline) Oldest() time.Time + type GitBlameLine struct + Author string + Content string + Date string + Hash string + Line int32 + type GitCommitInfo struct + Author string + Date string + FilesChanged int32 + Hash string + Message string + ShortHash string + type GitDiffFileInfo struct + Additions int32 + Deletions int32 + Path string + Status string + type GoCodeServer struct + func NewGoCodeServer(dir string, serverOpts []ServerOption, goOpts ...GoServerOption) *GoCodeServer + func (s *GoCodeServer) GetProjectInfo(ctx context.Context, req *codev0.GetProjectInfoRequest) (*codev0.GetProjectInfoResponse, error) + func (s *GoCodeServer) ListDependencies(ctx context.Context, req *codev0.ListDependenciesRequest) (*codev0.ListDependenciesResponse, error) + func (s *GoCodeServer) ListSymbols(ctx context.Context, req *codev0.ListSymbolsRequest) (*codev0.ListSymbolsResponse, error) + func (s *GoCodeServer) VFS() VFS + type GoServerOption func(*GoCodeServer) + func WithSymbolProvider(sp SymbolProvider) GoServerOption + type GraphStats struct + Files int + Functions int + Methods int + Packages int + TotalEdges int + TotalNodes int + Types int + func (s GraphStats) String() string + type HotspotFile struct + Chunks int + Path string + type Hunk struct + Header string + Lines []DiffLine + NewCount int + NewStart int + OldCount int + OldStart int + type LocalVFS struct + func (LocalVFS) MkdirAll(path string, perm os.FileMode) error + func (LocalVFS) ReadDir(path string) ([]os.DirEntry, error) + func (LocalVFS) ReadFile(path string) ([]byte, error) + func (LocalVFS) Remove(path string) error + func (LocalVFS) Rename(oldpath, newpath string) error + func (LocalVFS) Stat(path string) (os.FileInfo, error) + func (LocalVFS) WalkDir(root string, fn fs.WalkDirFunc) error + func (LocalVFS) WriteFile(path string, data []byte, perm os.FileMode) error + type MemoryVFS struct + func NewMemoryVFS() *MemoryVFS + func NewMemoryVFSFrom(files map[string]string) *MemoryVFS + func (m *MemoryVFS) MkdirAll(path string, _ os.FileMode) error + func (m *MemoryVFS) ReadDir(path string) ([]os.DirEntry, error) + func (m *MemoryVFS) ReadFile(path string) ([]byte, error) + func (m *MemoryVFS) Remove(path string) error + func (m *MemoryVFS) Rename(oldpath, newpath string) error + func (m *MemoryVFS) Stat(path string) (os.FileInfo, error) + func (m *MemoryVFS) WalkDir(root string, fn fs.WalkDirFunc) error + func (m *MemoryVFS) WriteFile(path string, data []byte, _ os.FileMode) error + type NativeGit struct + func OpenNativeGit(dir string) *NativeGit + func (g *NativeGit) DiffStat(ctx context.Context, baseRef, headRef string) ([]*GitDiffFileInfo, error) + func (g *NativeGit) HEAD() (string, error) + func (g *NativeGit) ListBranches() ([]string, error) + func (g *NativeGit) Log(ctx context.Context, maxCount int, ref, path, since string) ([]*GitCommitInfo, error) + func (g *NativeGit) Show(ctx context.Context, ref, path string) (string, bool, error) + type NativeJJ struct + func OpenNativeJJ(dir string) *NativeJJ + func (j *NativeJJ) Blame(ctx context.Context, path string, startLine, endLine int32) ([]*GitBlameLine, error) + func (j *NativeJJ) Diff(ctx context.Context, baseRef, headRef, path string, contextLines int, ...) (string, []*GitDiffFileInfo, error) + func (j *NativeJJ) Log(ctx context.Context, maxCount int, ref, path, since string) ([]*GitCommitInfo, error) + func (j *NativeJJ) Show(ctx context.Context, ref, path string) (string, bool, error) + type Neighborhood struct + Callees []*CodeNode + Callers []*CodeNode + Node *CodeNode + SameFile []*CodeNode + type NodeKind int + const NodeFile + const NodeFunction + const NodeMethod + const NodePackage + const NodeType + func (k NodeKind) String() string + type OperationHandler func(ctx context.Context, req *codev0.CodeRequest) (*codev0.CodeResponse, error) + type OverlayVFS struct + func NewOverlayVFS(base VFS) *OverlayVFS + func (o *OverlayVFS) Base() VFS + func (o *OverlayVFS) BaseSnapshot(path string) ([]byte, bool) + func (o *OverlayVFS) Commit() error + func (o *OverlayVFS) DeletedFiles() []string + func (o *OverlayVFS) Diff() []FileChange + func (o *OverlayVFS) Dirty() bool + func (o *OverlayVFS) MkdirAll(path string, perm os.FileMode) error + func (o *OverlayVFS) ModifiedFiles() []string + func (o *OverlayVFS) ReadDir(path string) ([]os.DirEntry, error) + func (o *OverlayVFS) ReadFile(path string) ([]byte, error) + func (o *OverlayVFS) Remove(path string) error + func (o *OverlayVFS) Rename(oldpath, newpath string) error + func (o *OverlayVFS) Rollback() + func (o *OverlayVFS) Stat(path string) (os.FileInfo, error) + func (o *OverlayVFS) WalkDir(root string, fn fs.WalkDirFunc) error + func (o *OverlayVFS) WriteFile(path string, data []byte, perm os.FileMode) error + type PackageInput struct + Doc string + Files []string + Imports []string + Name string + Path string + type PackageNode struct + Doc string + Files []string + Imports []string + Name string + Path string + type PythonASTSymbolProvider struct + func NewPythonASTSymbolProvider(sourceDir string) *PythonASTSymbolProvider + func (p *PythonASTSymbolProvider) Close() + func (p *PythonASTSymbolProvider) ListSymbols(ctx context.Context, file string) ([]*codev0.Symbol, error) + type PythonCodeServer struct + func NewPythonCodeServer(dir string, serverOpts []ServerOption, pyOpts ...PythonServerOption) *PythonCodeServer + func (s *PythonCodeServer) GetProjectInfo(ctx context.Context, req *codev0.GetProjectInfoRequest) (*codev0.GetProjectInfoResponse, error) + func (s *PythonCodeServer) ListDependencies(ctx context.Context, req *codev0.ListDependenciesRequest) (*codev0.ListDependenciesResponse, error) + func (s *PythonCodeServer) ListSymbols(ctx context.Context, req *codev0.ListSymbolsRequest) (*codev0.ListSymbolsResponse, error) + type PythonServerOption func(*PythonCodeServer) + func WithPythonSymbolProvider(sp SymbolProvider) PythonServerOption + type RelevanceScorer struct + func NewRelevanceScorer(cc *CodebaseContext, vfs VFS, rootDir string, opts ...ScorerOption) *RelevanceScorer + func (r *RelevanceScorer) ScoreFiles(ctx context.Context, query string, files []string) []ScoredFile + func (r *RelevanceScorer) TopK(ctx context.Context, query string, files []string, k int) []ScoredFile + type ScoredFile struct + Callers int + Importers int + Path string + RecentLines int + Score float64 + SearchHits int + SymbolHits int + type ScorerOption func(*RelevanceScorer) + func WithWeights(search, symbol, callGraph, recency, centrality float64) ScorerOption + type SearchMatch struct + File string + Line int + Text string + type SearchOpts struct + CaseInsensitive bool + ContextLines int + Exclude []string + Extensions []string + Literal bool + MaxResults int + Path string + Pattern string + type SearchResult struct + Matches []SearchMatch + Truncated bool + func Search(ctx context.Context, root string, opts SearchOpts) (*SearchResult, error) + func SearchTrigram(_ context.Context, vfs VFS, idx *TrigramIndex, root string, opts SearchOpts) (*SearchResult, error) + func SearchVFS(_ context.Context, vfs VFS, root string, opts SearchOpts) (*SearchResult, error) + type ServerOption func(*DefaultCodeServer) + func WithCachedFS() ServerOption + func WithContentCache(budgetBytes int64) ServerOption + func WithTrigramIndex() ServerOption + func WithVFS(vfs VFS) ServerOption + type SymbolEntry struct + Children []SymbolEntry + Kind string + Line int + Name string + Parent string + Signature string + type SymbolInput struct + Children []SymbolInput + File string + Kind string + Line int + Name string + Parent string + Signature string + type SymbolProvider interface + ListSymbols func(ctx context.Context, file string) ([]*codev0.Symbol, error) + type TSASTSymbolProvider struct + func NewTSASTSymbolProvider(sourceDir string) *TSASTSymbolProvider + func (p *TSASTSymbolProvider) Close() + func (p *TSASTSymbolProvider) ListSymbols(ctx context.Context, file string) ([]*codev0.Symbol, error) + func (p *TSASTSymbolProvider) ListSymbolsByFile(ctx context.Context) (map[string][]*codev0.Symbol, error) + type TimelineChunk struct + Age AgeBucket + Author string + Date time.Time + EndLine int + Hash string + StartLine int + Summary string + type TimelineStats struct + Hotspots []HotspotFile + LinesByAge map[AgeBucket]int + NewestDate time.Time + NewestFile string + OldestDate time.Time + OldestFile string + TotalChunks int + TotalFiles int + TotalLines int + func ComputeTimelineStats(timelines []*FileTimeline) TimelineStats + type TrigramIndex struct + func NewTrigramIndex() *TrigramIndex + func (idx *TrigramIndex) AddFile(path string, content []byte) + func (idx *TrigramIndex) Query(pattern string) []string + func (idx *TrigramIndex) RemoveFile(path string) + func (idx *TrigramIndex) Size() int + type VCSProvider interface + Blame func(ctx context.Context, path string, startLine, endLine int32) ([]*GitBlameLine, error) + Diff func(ctx context.Context, baseRef, headRef, path string, contextLines int, ...) (string, []*GitDiffFileInfo, error) + Log func(ctx context.Context, maxCount int, ref, path, since string) ([]*GitCommitInfo, error) + Show func(ctx context.Context, ref, path string) (string, bool, error) + type VFS interface + MkdirAll func(path string, perm os.FileMode) error + ReadDir func(path string) ([]os.DirEntry, error) + ReadFile func(path string) ([]byte, error) + Remove func(path string) error + Rename func(oldpath, newpath string) error + Stat func(path string) (os.FileInfo, error) + WalkDir func(root string, fn fs.WalkDirFunc) error + WriteFile func(path string, data []byte, perm os.FileMode) error + type VFSProvider interface + GetSourceDir func() string + GetVFS func() VFS + type WriteListener func(ctx context.Context, kind, path, prevPath string, content []byte) error