Help us shape the future of Go! Take the 2026 Go Developer Survey

graph

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendSymbols

func AppendSymbols(wikiDir string, g ModuleGraph) error

func AppendTypes

func AppendTypes(wikiDir string, g ModuleGraph) error

func DeleteModuleGraph

func DeleteModuleGraph(indexDir, wikiDir, modulePath string) error

DeleteModuleGraph removes the stored JSON and wiki markdown for a module. No-op if files do not exist.

func FileHash

func FileHash(path string) (string, error)

func LangForExt

func LangForExt(ext string) string

LangForExt returns the language name for a file extension, or "" if unknown.

func ModuleCacheKey

func ModuleCacheKey(modulePath string, fileHashes map[string]string) string

ModuleCacheKey returns a deterministic cache key for a module. It is derived from the module path and the sorted concatenation of file content hashes, so any file change produces a different key.

func ModuleHashes

func ModuleHashes(repoRoot string, files []string) (map[string]string, error)

func ResetAggregates

func ResetAggregates(wikiDir string) error

func SaveEdges

func SaveEdges(indexDir string, graphs []ModuleGraph) error

func SaveMeta

func SaveMeta(indexDir string, m *Meta) error

func SaveModuleGraph

func SaveModuleGraph(indexDir string, g ModuleGraph) error

func Slug

func Slug(path string) string

func WriteIndex

func WriteIndex(wikiDir string, graphs []ModuleGraph) error

func WriteModule

func WriteModule(wikiDir string, g ModuleGraph) error

Types

type Edges

type Edges struct {
	Imports map[string][]string `json:"imports"`
}

type LLMCache

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

LLMCache is an in-memory LLM response cache backed by a JSON file.

func LoadLLMCache

func LoadLLMCache(path string) (*LLMCache, error)

LoadLLMCache loads the cache from path. Returns an empty cache if the file does not exist.

func (*LLMCache) Get

func (c *LLMCache) Get(key string) (summary, subsystem string, ok bool)

Get returns the cached summary and subsystem for a module key.

func (*LLMCache) Save

func (c *LLMCache) Save() error

Save persists the cache atomically.

func (*LLMCache) Set

func (c *LLMCache) Set(key, summary, subsystem string)

Set stores a summary and subsystem for a module key.

type Meta

type Meta struct {
	BaseCommit string                `json:"base_commit"`
	Modules    map[string]ModuleMeta `json:"modules"`
}

func LoadMeta

func LoadMeta(indexDir string) (*Meta, error)

type Module

type Module struct {
	Path  string
	Files []string
}

func Discover

func Discover(repoRoot string, maxFileSizeKB int, extraExts, ignorePatterns []string) ([]Module, error)

type ModuleGraph

type ModuleGraph struct {
	Module      string
	Summary     string
	ExportFns   []string
	ExportTypes []string
	Imports     []string
	Subsystem   string
}

func LoadAllModuleGraphs

func LoadAllModuleGraphs(indexDir string) ([]ModuleGraph, error)

func Parse

func Parse(output string) ModuleGraph

Parse extracts Summary and Subsystem from LLM output. Structural fields (Imports, ExportFns, ExportTypes) must be set by the caller from tree-sitter results.

type ModuleMeta

type ModuleMeta struct {
	Commit     string            `json:"commit"`
	FileHashes map[string]string `json:"file_hashes"`
}

type StructuralData

type StructuralData struct {
	Imports     []string
	ExportFns   []string
	ExportTypes []string
}

StructuralData holds the tree-sitter-extracted structural information for a source file.

func Extract

func Extract(source []byte, langName string) (*StructuralData, error)

Extract runs tree-sitter queries against source to extract imports and exported symbols. Returns empty StructuralData (not an error) for unknown languages.

Jump to

Keyboard shortcuts

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