extract

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package extract turns a source file into graph fragments using tree-sitter. Each extractor emits definition nodes (file, function, type, method) plus the structural edges it can see locally (contains, imports). Calls and imports that cross files are recorded raw and stitched together by Resolve, which has the whole-corpus view needed to point a call at the right definition.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resolve

func Resolve(results []Result, files []string) model.Extraction

Resolve stitches per-file results into one extraction. It adds the call edges and import edges that need a whole-corpus view: calls resolve to definitions by name, and relative imports resolve to the file they point at.

Types

type Call

type Call struct {
	CallerID, Callee, File, Loc string
}

Call is an unresolved call site: CallerID invoked a symbol named Callee.

type Def

type Def struct {
	ID, Name, File string
}

Def records a named definition so cross-file calls can resolve to it by name.

type Imp

type Imp struct {
	FileID, File, Spec, Loc string
}

Imp is an unresolved import: File imported the module named Spec.

type Result

type Result struct {
	Nodes []model.Node
	Edges []model.Edge
	Defs  []Def
	Calls []Call
	Imps  []Imp
}

Result is one file's extraction before cross-file resolution.

func File

func File(root, rel string) (Result, error)

File extracts rel (a path relative to root). Unsupported extensions return an empty result, not an error, so the caller can skip them silently.

Jump to

Keyboard shortcuts

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