graph

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildEdges

func BuildEdges(symbols []core.SymbolRecord) []core.Edge

BuildEdges constructs all 8 edge types from the symbol set.

Edge construction order (matches Implementation Plan §3.1):

  1. defines (file → symbol) confidence 1.0
  2. contains (parent → child) confidence 1.0
  3. imports (file → import:path) confidence 0.9
  4. extends (subtype → supertype) confidence 0.85
  5. implements (concrete → interface/trait) confidence 0.85
  6. uses-type (symbol → referenced type) confidence 0.5
  7. calls (caller → callee) confidence 0.85 same-file, 0.6 cross-file
  8. tests (test sym → tested sym) confidence 0.8

"calls" and "uses-type" are scoped to same-file + imported-file symbols per the non-negotiable accuracy rule in the plan.

func DetectConflicts

func DetectConflicts(a, b core.IsolatedChangeRegion) core.ConflictResult

DetectConflicts checks whether two ICRs have overlapping exclusive symbols or files.

Types

type CodeGraph

type CodeGraph struct {
	// contains filtered or unexported fields
}

func New

func New() *CodeGraph

func (*CodeGraph) ComputeICR

func (g *CodeGraph) ComputeICR(intent string) core.IsolatedChangeRegion

ComputeICR computes an Isolated Change Region for the given intent string.

func (*CodeGraph) Deps

func (g *CodeGraph) Deps(filePath string) []core.Edge

Deps returns all edges that touch the given file path. Uses exact-prefix matching: edges from "file:<path>" or whose node ID begins with "<path>::" (symbol IDs in that file).

func (*CodeGraph) Impact

func (g *CodeGraph) Impact(query string, maxDepth int) []core.SymbolRecord

Impact returns all symbols reachable from the seed (identified by query) by traversing inbound edges up to maxDepth. "Inbound" means: things that call, test, or contain the seed symbol — i.e., the blast radius if the seed changes.

func (*CodeGraph) Replace

func (g *CodeGraph) Replace(symbols []core.SymbolRecord, filesIndexed int)

func (*CodeGraph) Search

func (g *CodeGraph) Search(query string, limit int) []core.SymbolRecord

Search returns symbols whose name, qualified name, file path, or signature contains the query string (case-insensitive).

func (*CodeGraph) SemanticSearch

func (g *CodeGraph) SemanticSearch(query string, limit int) []embeddings.Scored

SemanticSearch ranks symbols against a free-text intent using the configured embedding backend (Model2Vec by default; TF-IDF if GROVE_EMBEDDINGS=tfidf). Documents are constructed from (name + qualifiedName + signature + docstring + parent). The engine is built lazily and cached until the next Replace().

func (*CodeGraph) Snapshot

func (g *CodeGraph) Snapshot() ([]core.SymbolRecord, []core.Edge)

func (*CodeGraph) Status

func (g *CodeGraph) Status() core.Status

func (*CodeGraph) TestsFor

func (g *CodeGraph) TestsFor(query string) []core.SymbolRecord

TestsFor returns all test symbols that cover the given query target. Resolution order:

  1. If the query matches an existing symbol name, follow inbound `tests` edges (and inbound `calls` one hop further) to gather covering tests.
  2. Fallback: substring search in test files (for free-text queries).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL