Documentation
¶
Index ¶
Constants ¶
const ( KindFile = "file" KindPackage = "package" KindModule = "module" KindFunction = "function" KindMethod = "method" KindType = "type" KindImport = "import" KindSymbol = "symbol" KindOperation = "operation" KindSchema = "schema" KindField = "field" KindService = "service" )
Node kinds emitted by extractors and contract parsers.
const ( EdgeContains graph.EdgeType = "contains" EdgeImports graph.EdgeType = "imports" EdgeCalls graph.EdgeType = "calls" EdgeImplements graph.EdgeType = "implements" EdgeConsumes graph.EdgeType = "consumes" )
Edge types emitted by extractors and contract binders.
Variables ¶
var DefaultIgnoreDirNames = []string{"vendor", "node_modules", ".git", ".synapse", ".synapse-out"}
DefaultIgnoreDirNames are skipped unless overridden.
Functions ¶
func EnsureRootExists ¶
EnsureRootExists is a tiny helper for clearer Walk errors.
Types ¶
type Extractor ¶
type Extractor func(path string, src []byte, root *tree_sitter.Node) Result
Extractor turns a parsed tree into graph IR.
type Language ¶
type Language struct {
Name string
Language *tree_sitter.Language
Extract Extractor
}
Language is a registered grammar keyed by file extension.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps file extensions (with leading dot, lower-case) to languages.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry returns a registry with Go, JS/JSX, TypeScript/TSX, Python, and Swift.
type Result ¶
type Result struct {
Path string `json:"path"`
Lang string `json:"lang"`
Nodes []graph.Node `json:"nodes"`
Edges []graph.Edge `json:"edges"`
Skipped bool `json:"skipped,omitempty"`
}
Result is the intermediate Node/Edge IR for one source file.
func ParseFile ¶
ParseFile reads path and extracts IR using reg. Unknown extensions yield Skipped=true.
func ParseSource ¶
ParseSource parses src as path using reg.
type WalkOptions ¶
type WalkOptions struct {
// IgnoreDirNames are directory basenames to skip (default: vendor, node_modules, .git, .synapse).
IgnoreDirNames []string
// Workers is the concurrent parse pool size (default: GOMAXPROCS).
Workers int
// Registry selects parsers; nil uses NewRegistry().
Registry *Registry
}
WalkOptions configures repository walking.
type WalkResult ¶
WalkResult aggregates per-file parse results and errors.
func WalkTree ¶
func WalkTree(root string, opts WalkOptions) (WalkResult, error)
WalkTree walks root, skipping ignored dirs, and parses registered source files concurrently.