Documentation
¶
Index ¶
- func FileNode(input Input, language string) graph.Node
- func ModuleName(path string) string
- func ParseTreeSitter(ctx context.Context, p *treesitter.Parser, content []byte) *treesitter.Tree
- func Unquote(text string) string
- func Unsupported(path string) error
- type Builder
- func (b *Builder) AddFact(from string, kind graph.EdgeKind, targetID, target string, ...)
- func (b *Builder) AddNamedSourceFact(source string, sourceKind graph.NodeKind, kind graph.EdgeKind, ...)
- func (b *Builder) AddNode(node graph.Node) string
- func (b *Builder) Declare(parent string, node graph.Node) string
- func (b *Builder) Diagnostic(line int, level, message string)
- func (b *Builder) FileID() string
- func (b *Builder) Finish() graph.ParseResult
- type Input
- type Parser
- type Registry
- func (r *Registry) For(path string) (Parser, bool)
- func (r *Registry) IsSemanticDependency(path string) bool
- func (r *Registry) Languages() []string
- func (r *Registry) SemanticAffectedPaths(root string, paths, changed []string) []string
- func (r *Registry) SemanticLoadMetrics() map[string]SemanticLoadMetrics
- func (r *Registry) WorkspaceSemanticEvidenceKeys(ctx context.Context, input Input) (map[string]string, bool, error)
- func (r *Registry) WorkspaceSemanticKeys(ctx context.Context, input Input) (map[string]string, error)
- type ScopeKeyer
- type SemanticChangeProvider
- type SemanticDependencyProvider
- type SemanticInputProvider
- type SemanticKeyer
- type SemanticLoadMetrics
- type SemanticLoadMetricsReporter
- type WorkspaceSemanticEvidenceKeyer
- type WorkspaceSemanticKeyer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ModuleName ¶
func ParseTreeSitter ¶
func ParseTreeSitter(ctx context.Context, p *treesitter.Parser, content []byte) *treesitter.Tree
ParseTreeSitter parses UTF-8 source with an already-configured tree-sitter parser and abandons the parse once ctx is done. Tree-sitter has no context aware entry point, so cancellation rides on the progress callback it invokes periodically: returning true there stops parsing and yields a nil tree, which callers must treat as a failed parse rather than an empty file.
func Unsupported ¶
Types ¶
type Builder ¶
type Builder struct {
Input Input
Language string
Result graph.ParseResult
// contains filtered or unexported fields
}
func NewBuilder ¶
func (*Builder) AddNamedSourceFact ¶
func (b *Builder) AddNamedSourceFact(source string, sourceKind graph.NodeKind, kind graph.EdgeKind, targetID, target string, targetKind graph.NodeKind, loc graph.Location, properties map[string]string)
AddNamedSourceFact records an edge whose source declaration is owned by another parse result. Storage resolves the exact source name and optional kind; the parser supplies evidence but never invents the foreign node ID.
func (*Builder) Diagnostic ¶
func (*Builder) Finish ¶
func (b *Builder) Finish() graph.ParseResult
type Input ¶
type Input struct {
Root string
Path string
Content []byte
// SourcePaths is the authoritative repository-relative source membership
// for this indexing run. A nil slice means the caller has no membership
// snapshot and repository-wide parsers must use their deterministic fallback.
SourcePaths []string
Repository string
RepoID string
GoModule string
SemanticKey string
// ScopeKey is the scope-local component of this file's semantic key, when
// the caller has already derived it. A parser that would otherwise compute
// the same value again consumes this instead. Empty means the caller has no
// value to offer and the parser derives its own, so a missing key is never
// read as a match.
ScopeKey string
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func (*Registry) IsSemanticDependency ¶
IsSemanticDependency reports whether path is an explicit repository input to any parser's semantic model, even when the parser does not parse that file as a graph source itself.
func (*Registry) SemanticAffectedPaths ¶
func (*Registry) SemanticLoadMetrics ¶ added in v0.2.3
func (r *Registry) SemanticLoadMetrics() map[string]SemanticLoadMetrics
SemanticLoadMetrics collects each parser's loader counters, keyed by language. A parser that keeps no counters is absent from the map; a parser that keeps them but did no work this run reports zeroes, so "this language has no semantic loader" stays distinguishable from "its loader did nothing".
func (*Registry) WorkspaceSemanticEvidenceKeys ¶
func (r *Registry) WorkspaceSemanticEvidenceKeys(ctx context.Context, input Input) (map[string]string, bool, error)
WorkspaceSemanticEvidenceKeys returns cheap external/configuration evidence plus whether every workspace semantic key supports safe reuse.
type ScopeKeyer ¶ added in v0.2.3
ScopeKeyer reports the scope-local component of a file's semantic key on its own. Deriving that component can cost filesystem work, and SemanticKey folds it into a larger string the caller cannot take apart, so a caller that needs the component itself asks for it here and hands it back through Input.ScopeKey rather than making the parser derive it twice.
type SemanticChangeProvider ¶
type SemanticChangeProvider interface {
SemanticAffectedPaths(root string, allPaths, changedPaths []string) []string
}
SemanticChangeProvider expands incremental invalidation when a source or configuration edit can change otherwise untouched parser output. Root is the repository root the paths are relative to, so a provider that keeps a per-repository model can look up the right one rather than guess.
type SemanticDependencyProvider ¶
type SemanticDependencyProvider interface {
SemanticDependencies() []string
}
SemanticDependencyProvider identifies repository files whose changes can alter this parser's output for otherwise unchanged source files.
type SemanticInputProvider ¶
SemanticInputProvider recognizes repository files that contribute to a parser's semantic model without necessarily being parsed as graph sources. It covers dynamic dependency names that cannot be expressed as a fixed list.
type SemanticKeyer ¶
SemanticKeyer lets a parser add repository-level configuration to a file's incremental cache key. Parsers that do not depend on such configuration do not need to implement it.
A parser that also implements WorkspaceSemanticKeyer refines that shared key here with the scope-local facts that change how this one file extracts. Callers pass the already computed workspace key as Input.SemanticKey so the repository-wide part is never recomputed per file.
type SemanticLoadMetrics ¶ added in v0.2.3
type SemanticLoadMetrics struct {
// Loads counts whole-workspace loads, CacheHits the views served from the
// in-process cache without one.
Loads int64 `json:"loads"`
CacheHits int64 `json:"cache_hits"`
// PersistedHits counts workspace entries adopted from the cross-process
// view cache, and PersistedSaves the entries written to it.
PersistedHits int64 `json:"persisted_hits"`
PersistedSaves int64 `json:"persisted_saves"`
// PersistedDecodes counts the package segments decoded from an adopted
// entry, and PersistedSegmentWrites the segments re-encoded by a save.
PersistedDecodes int64 `json:"persisted_decodes"`
PersistedSegmentWrites int64 `json:"persisted_segment_writes"`
// PeakConcurrent and LastDurationMS are observations rather than totals:
// the highest concurrency seen and the duration of the most recent load.
// Since leaves them as observed, so in a per-run report they describe the
// loader's whole lifetime.
PeakConcurrent int64 `json:"peak_concurrent"`
LastDurationMS int64 `json:"last_duration_ms"`
// LoadNS is the time spent in whole-workspace loads and DerivationNS the
// part of it spent deriving views from what was loaded. DerivationNS is a
// subset of LoadNS.
LoadNS int64 `json:"load_ns"`
DerivationNS int64 `json:"derivation_ns"`
}
SemanticLoadMetrics reports a semantic loader's own counters for one process. They exist so a refresh can be attributed without a bespoke build: the whole-workspace load and the per-package view derivation both happen inside a single Parse call, so without these they are indistinguishable from per-file parse time.
The counters are reporting-only. Nothing may branch on them, and a loader that does not keep them reports zeroes rather than failing a run.
func (SemanticLoadMetrics) Since ¶ added in v0.2.3
func (m SemanticLoadMetrics) Since(baseline SemanticLoadMetrics) SemanticLoadMetrics
Since returns the work counted after baseline. A loader lives as long as its parser, and a parser registry is reused across runs by federation and by the MCP freshness coordinator, so the counters are lifetime totals and a per-run report has to subtract. Only the cumulative fields subtract; the two observations above are carried as they stand.
type SemanticLoadMetricsReporter ¶ added in v0.2.3
type SemanticLoadMetricsReporter interface {
SemanticLoadMetrics() SemanticLoadMetrics
}
SemanticLoadMetricsReporter is a parser that keeps the counters above. The indexer reports what it finds here and never recounts.
type WorkspaceSemanticEvidenceKeyer ¶
type WorkspaceSemanticEvidenceKeyer interface {
WorkspaceSemanticEvidenceKey(context.Context, Input) (string, error)
}
WorkspaceSemanticEvidenceKeyer provides cheap evidence for semantic inputs outside the repository snapshot. When every workspace keyer implements it, callers may reuse a previously computed workspace key while Git proves all in-repository inputs unchanged and these evidence keys still match.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package calleffect defines the closed, language-neutral vocabulary for repository-declared call effects.
|
Package calleffect defines the closed, language-neutral vocabulary for repository-declared call effects. |
|
Package defaults owns the production parser registry shared by the CLI and deterministic evaluation corpus.
|
Package defaults owns the production parser registry shared by the CLI and deterministic evaluation corpus. |
|
Package godot extracts semantic graph symbols from Godot source formats other than GDScript.
|
Package godot extracts semantic graph symbols from Godot source formats other than GDScript. |
|
godotid
Package godotid is the single source of truth for Godot resource identity and for the project-level declarations that several Godot producers share.
|
Package godotid is the single source of truth for Godot resource identity and for the project-level declarations that several Godot producers share. |
|
Package markdown extracts documentation structure and explicit code references.
|
Package markdown extracts documentation structure and explicit code references. |
|
Package protobuf adapts protobuf source files to Grafo's shared graph model.
|
Package protobuf adapts protobuf source files to Grafo's shared graph model. |
|
Package protobufbinding projects supported generated-language APIs onto canonical Protobuf declarations.
|
Package protobufbinding projects supported generated-language APIs onto canonical Protobuf declarations. |
|
Package sql routes SQL source files to an explicitly selected dialect.
|
Package sql routes SQL source files to an explicitly selected dialect. |
|
sqlite
Package sqlite parses SQLite SQL and extracts schema declarations and relation access.
|
Package sqlite parses SQLite SQL and extracts schema declarations and relation access. |
|
Package transport defines the language-neutral transport extraction contract.
|
Package transport defines the language-neutral transport extraction contract. |