graph

package
v0.11.7 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AffectedFile

type AffectedFile struct {
	File  string     `json:"file"`
	Kind  ChangeKind `json:"kind"`
	Nodes []*Node    `json:"nodes"`
}

type Arch

type Arch struct {
	Languages   []LangStat   `json:"languages"`
	TotalFiles  int          `json:"total_files"`
	TotalNodes  int          `json:"total_nodes"`
	TotalEdges  int          `json:"total_edges"`
	Layers      []ModuleStat `json:"layers"`
	Modules     []ModuleStat `json:"modules"`
	ModuleDeps  []ModuleDep  `json:"module_deps"`
	EntryPoints []*Node      `json:"entry_points"`
	Hotspots    []Hotspot    `json:"hotspots"`
}

type CallResolver

type CallResolver interface {
	ResolveCall(ctx context.Context, file string, line, column int) (defFile string, defLine int, ok bool)
}

type ChangeKind

type ChangeKind string
const (
	ChangeAdded    ChangeKind = "added"
	ChangeModified ChangeKind = "modified"
	ChangeDeleted  ChangeKind = "deleted"
)

type Changes

type Changes struct {
	Files  []AffectedFile `json:"files"`
	Impact []Impact       `json:"impact,omitempty"`
}

type CoChange

type CoChange struct {
	File  string `json:"file"`
	Count int    `json:"count"`
}

type CoChangesResult

type CoChangesResult struct {
	File    string     `json:"file"`
	Commits int        `json:"commits"`
	Related []CoChange `json:"related"`
}

type DepsResult

type DepsResult struct {
	Module     string   `json:"module"`
	DependsOn  []string `json:"depends_on"`
	DependedBy []string `json:"depended_by"`
	External   []string `json:"external"`
	Transitive []string `json:"transitive,omitempty"`
}

type Edge

type Edge struct {
	From string     `json:"from"`
	To   string     `json:"to"`
	Kind EdgeKind   `json:"kind"`
	Via  Provenance `json:"via,omitempty"`
}

type EdgeKind

type EdgeKind string
const (
	EdgeCalls      EdgeKind = "calls"
	EdgeInherits   EdgeKind = "inherits"
	EdgeImplements EdgeKind = "implements"
)

type Engine

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

func New

func New(root, cachePath string, opts ...Option) *Engine

func (*Engine) Architecture

func (e *Engine) Architecture(ctx context.Context) (Arch, error)

func (*Engine) CoChanges

func (e *Engine) CoChanges(ctx context.Context, file string, limit int) (CoChangesResult, error)

func (*Engine) DeadCode

func (e *Engine) DeadCode(ctx context.Context, limit int) ([]*Node, error)

func (*Engine) Deps

func (e *Engine) Deps(ctx context.Context, target string, depth int) (DepsResult, error)

func (*Engine) DetectChanges

func (e *Engine) DetectChanges(ctx context.Context, since string) (Changes, error)

func (*Engine) EdgeStats

func (e *Engine) EdgeStats() map[Provenance]int

func (*Engine) Hierarchy

func (e *Engine) Hierarchy(ctx context.Context, name, file string) (HierarchyResult, error)

func (*Engine) Index

func (e *Engine) Index(ctx context.Context) (Status, error)

func (*Engine) Search

func (e *Engine) Search(ctx context.Context, opts SearchOpts) ([]*Node, error)

func (*Engine) Similar

func (e *Engine) Similar(ctx context.Context, name, file string, limit int) (SimilarResult, error)

func (*Engine) Snippet

func (e *Engine) Snippet(ctx context.Context, name, file string) (Snippet, error)

func (*Engine) Status

func (e *Engine) Status() Status

func (*Engine) StatusOrLoad

func (e *Engine) StatusOrLoad() Status

func (*Engine) Tests

func (e *Engine) Tests(ctx context.Context, name, file string) (TestsResult, error)

func (*Engine) Trace

func (e *Engine) Trace(ctx context.Context, from, to, file string, callers bool, maxDepth int) (TraceResult, error)

type Graph

type Graph struct {
	Nodes   []*Node   `json:"nodes"`
	Edges   []*Edge   `json:"edges"`
	Imports []*Import `json:"imports,omitempty"`
	// contains filtered or unexported fields
}

type HierarchyResult

type HierarchyResult struct {
	Type         *Node   `json:"type"`
	Extends      []*Node `json:"extends"`
	Subtypes     []*Node `json:"subtypes"`
	Implements   []*Node `json:"implements"`
	Implementers []*Node `json:"implementers"`
	Others       []*Node `json:"others,omitempty"`
}

type Hotspot

type Hotspot struct {
	Node    *Node `json:"node"`
	Callers int   `json:"callers"`
	Callees int   `json:"callees"`
}

type Impact added in v0.9.3

type Impact struct {
	Caller *Node   `json:"caller"`
	Calls  []*Node `json:"calls"`
}

type Import

type Import struct {
	FromFile string `json:"from"`
	Path     string `json:"path"`
	ToModule string `json:"to,omitempty"`
}

type Kind

type Kind string
const (
	KindFunction    Kind = "function"
	KindMethod      Kind = "method"
	KindClass       Kind = "class"
	KindInterface   Kind = "interface"
	KindType        Kind = "type"
	KindConstructor Kind = "constructor"
	KindModule      Kind = "module"
	KindConstant    Kind = "constant"
	KindVariable    Kind = "variable"
)

type LangStat

type LangStat struct {
	Lang  string `json:"lang"`
	Files int    `json:"files"`
	Nodes int    `json:"nodes"`
}

type ModuleDep

type ModuleDep struct {
	Module     string `json:"module"`
	DependsOn  int    `json:"depends_on"`
	DependedBy int    `json:"depended_by"`
}

type ModuleStat

type ModuleStat struct {
	Path  string `json:"path"`
	Files int    `json:"files"`
	Nodes int    `json:"nodes"`
}

type Node

type Node struct {
	ID        string `json:"id"`
	Kind      Kind   `json:"kind"`
	Name      string `json:"name"`
	File      string `json:"file"`
	StartLine int    `json:"start_line"`
	EndLine   int    `json:"end_line"`
	Lang      string `json:"lang"`
}

type Option

type Option func(*Engine)

func WithResolver

func WithResolver(r CallResolver) Option

type Path

type Path struct {
	Nodes []*Node
	Via   []Provenance
}

type Provenance

type Provenance string
const (
	ViaName      Provenance = "name"
	ViaLSP       Provenance = "lsp"
	ViaAmbiguous Provenance = "ambiguous"
)

type SearchOpts

type SearchOpts struct {
	Query string
	Kind  Kind
	File  string
	Limit int
}

type Similar

type Similar struct {
	Node  *Node   `json:"node"`
	Score float64 `json:"score"`
}

type SimilarResult

type SimilarResult struct {
	Target  *Node     `json:"target"`
	Matches []Similar `json:"matches"`
	Others  []*Node   `json:"others,omitempty"`
}

type Snippet

type Snippet struct {
	Node   *Node
	Code   string
	Others []*Node
}

type Status

type Status struct {
	Indexed   bool
	IndexedAt time.Time
	Files     int
	Nodes     int
	Edges     int
}

type TestsResult

type TestsResult struct {
	Symbol   *Node   `json:"symbol"`
	TestedBy []*Node `json:"tested_by"`
	Covers   []*Node `json:"covers"`
	Others   []*Node `json:"others,omitempty"`
}

type TraceResult

type TraceResult struct {
	Roots []*Node
	Paths []Path
}

Jump to

Keyboard shortcuts

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