Documentation
¶
Index ¶
- func ExtractDefinitions(project string, f SourceFile) ([]graph.Node, []graph.Edge)
- func IsTestFile(p string) bool
- func ProjectName(root string) string
- func ResolveCalls(project, root string, files []SourceFile, nodes []graph.Node, ...) []graph.Edge
- func ResolveImports(project string, files []SourceFile) []graph.Edge
- func ResolveSimilar(project, root string, nodes []graph.Node) []graph.Edge
- type Changes
- type Lang
- type Result
- type SourceFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractDefinitions ¶
ExtractDefinitions reads a file from disk and extracts its definitions.
func IsTestFile ¶
IsTestFile reports whether a repo-relative path is a test file, by the naming conventions of the supported stacks (Go `_test.go`, JS/TS `.test.`/`.spec.`, and `__tests__` dirs). Exported so the query layer can exclude test functions from the dead-code hint — they're invoked by the test runner, not by code.
func ProjectName ¶
ProjectName derives a stable project key from the repo root (matches the upstream convention of slugging the absolute path).
func ResolveCalls ¶
func ResolveCalls(project, root string, files []SourceFile, nodes []graph.Node, changed map[string]bool) []graph.Edge
ResolveCalls emits CALLS edges. For TS/JS it delegates to scip-typescript (batch, type-checker-accurate) per tsconfig subproject and attributes each resolved reference to the function/method that encloses it (the caller). It is best-effort: a subproject whose scip run fails contributes no edges rather than failing the whole index. Go call resolution is in-process via go/packages + a CHA call graph (internal/gocalls). changed gates which CALLS scopes are re-resolved: nil re-resolves everything (a full index); otherwise only scopes present in the set run (each tsconfig dir, and "go"). Unchanged scopes' edges are reused by the caller, not recomputed here.
func ResolveImports ¶
func ResolveImports(project string, files []SourceFile) []graph.Edge
ResolveImports reads the files and emits IMPORTS edges. It is the disk-reading wrapper around resolveImports.
func ResolveSimilar ¶
ResolveSimilar emits SIMILAR_TO edges between near-clone functions/methods. It reads each file once, tokenizes every function body, and runs the MinHash + LSH pass (internal/similar). Cross-file by nature, so it always runs on the full node set.
Types ¶
type Changes ¶
type Changes struct {
Changed []string // indexed, but content hash differs now
Added []string // on disk, absent from the index
Deleted []string // in the index, gone from disk
}
Changes is the set of files that differ from the indexed snapshot.
func DetectChanges ¶
DetectChanges compares the source files currently under root against the per-file content hashes recorded at the last index (Store.FileHashes). It is the basis for skipping a re-index when nothing changed, and later for re-resolving only the scopes whose files moved. A never-indexed project reports every file as Added.
type Result ¶
type Result struct {
Project string
Files int
Nodes int
EdgesKept int
EdgesDropped int
Reused bool // nothing changed since the last index; the pipeline was skipped
}
Result summarizes an indexing run.
type SourceFile ¶
SourceFile is a discovered file worth indexing.
func Discover ¶
func Discover(root string) ([]SourceFile, error)
Discover walks root and returns indexable source files. It honors directory hard-ignores plus the repo's .gitignore and .cbmignore — so a repo's vendored deps and build artifacts (e.g. a Go module cache under tmp/) don't flood the graph. Common-case ignore semantics only: directory/name patterns, globs, and root-anchored paths; negation (`!`) and nested .gitignore files are not honored.