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 IsMCPConfigPath ¶ added in v0.6.0
IsMCPConfigPath reports whether name is a recognised MCP config filename. name may be a full path; only the basename is matched.
Types ¶
type Call ¶
Call is an unresolved call site: CallerID invoked a symbol named Callee. IsMember marks an attribute/method call (`x.f()`), which the Python import-guided resolver must skip — the alias evidence only covers bare names.
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 ImportAlias ¶ added in v0.6.0
type ImportAlias struct {
Local, Imported, ModuleStem, Loc string
}
ImportAlias is per-file evidence from a top-level `from M import N [as L]`: the local name L (alias or N) resolves to symbol N in module-stem M.
type MDRef ¶ added in v0.6.0
type MDRef struct {
FromID, Target, File, Loc string
}
MDRef is an unresolved markdown reference: the FromID node linked to the raw Target before corpus resolution. Target is a link/wikilink/reference-def destination path, or a bare `symbol` name captured from an inline code span.
type ModInvoke ¶ added in v0.5.0
ModInvoke carries one `module` block's arguments so Resolve can follow a local wrapper chain. Dir is the invoking directory (its dirScope). Args holds literal scalar/list arguments by name; ArgVarRefs maps an argument name to the bare variable it passes through (`arg = var.<name>`).
type ModRef ¶ added in v0.4.0
type ModRef struct {
FromID, Source, File, Loc string
}
ModRef is a Terraform module block's source before resolution: the module node FromID declared `source = Source` in File. Resolve turns a local source into an edge to the target directory node, and a registry/private-registry source into an external concept node.
type NullLabelRef ¶ added in v0.5.0
type NullLabelRef struct {
NodeID, Scope string
Inputs labelInputs
}
NullLabelRef carries a captured cloudposse null-label module so Resolve can fill in segments that come from input variables or an inherited context. NodeID is the module node; Scope is its directory (used to find the caller); Inputs are the locally-captured label fields.
type Result ¶
type Result struct {
Nodes []model.Node
Edges []model.Edge
Defs []Def
Calls []Call
Imps []Imp
ModRefs []ModRef
NullLabels []NullLabelRef
ModInvokes []ModInvoke
ImportAliases []ImportAlias
MDRefs []MDRef
}
Result is one file's extraction before cross-file resolution.
func File ¶
File extracts rel (a path relative to root). Unsupported extensions return an empty result, not an error, so the caller can skip them silently.
func FileFromBytes ¶ added in v0.3.0
FileFromBytes extracts rel from already-read source bytes. It lets callers that have hashed the file (e.g. the incremental cache) avoid a second read. Unsupported extensions return an empty result.
func IntrospectCargo ¶ added in v0.6.0
IntrospectCargo parses a Rust workspace rooted at root/Cargo.toml plus its member manifests and returns crate:<name> nodes and crate_depends_on edges for workspace-internal path dependencies only (registry deps like serde are excluded). It mirrors upstream graphify/cargo_introspect.py: a manifest with a [package].name becomes a node, and a [dependencies] entry whose name matches another workspace crate becomes an edge. A genuine TOML syntax error in any manifest is returned; degenerate-but-parseable manifests yield no nodes/edges rather than an error.
func IntrospectManifests ¶ added in v0.8.1
IntrospectManifests parses every package manifest under root (pyproject.toml, go.mod, pom.xml) into a canonical file_type "package" node per module — keyed by package NAME so a package referenced from several manifests collapses to one hub node — plus "depends_on" edges module->dependency. It mirrors upstream graphify/manifest_ingest.py; unlike upstream it also emits a stub package node for external dependencies, because this port's graph builder drops edges whose target node is absent. A dependency that is itself a module in the corpus gets only the edge (its real node already exists), never a stub that would clobber the real node's source_file. A malformed or nameless manifest is skipped, never fatal, so the default-on pass cannot break a build.