grove

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package grove is the public, in-process Go API for the Grove code knowledge graph. Prism, Fuse, and Relay import this package and call it directly — there is no HTTP server, no port, no shared-secret token, no auto-start.

Index data lives in <repoRoot>/.grove/grove.db. SQLite WAL mode handles concurrent readers; only one writer at a time per database file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertificationFinding added in v0.4.5

type CertificationFinding = core.CertificationFinding

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type CertificationPolicy added in v0.4.5

type CertificationPolicy = core.CertificationPolicy

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type CertificationReport added in v0.4.5

type CertificationReport = core.CertificationReport

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type Config

type Config struct {
	// RepoRoot is the absolute path to the repository whose .grove/ directory
	// holds the index. Required.
	RepoRoot string
	// NativeAnalyzers overrides native graph enrichment when non-nil.
	NativeAnalyzers *bool
	// NativeLanguages limits native analyzers to these languages/analyzer names.
	NativeLanguages []string
	// NativeDisabledLanguages disables these languages/analyzer names.
	NativeDisabledLanguages []string
	// NativeTimeout bounds each analyzer invocation. Zero uses Grove's default.
	NativeTimeout time.Duration
}

Config controls how Engine opens a repository's Grove index.

type DiffInput added in v0.4.5

type DiffInput = core.DiffInput

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type Edge

type Edge = core.Edge

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type EdgeType

type EdgeType = core.EdgeType

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type Engine

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

Engine is the embedded Grove API consumed by Prism, Fuse, and Relay. Methods are safe for concurrent use.

func Open

func Open(ctx context.Context, cfg Config) (*Engine, error)

Open initialises the on-disk store, runs migrations, and rebuilds the in-memory graph from whatever symbols are already persisted.

func (*Engine) CertifyDiff added in v0.4.5

func (e *Engine) CertifyDiff(ctx context.Context, input DiffInput) (CertificationReport, error)

CertifyDiff maps a unified diff onto the indexed graph and returns a conservative structural certification report. The report is additive: retrieval, MCP, and Provasign behavior do not change unless callers opt in. Changed files whose indexed content no longer matches the working tree are reported as index_stale and escalate the verdict to manual_review.

func (*Engine) Close

func (e *Engine) Close() error

Close releases the underlying SQLite handle.

func (*Engine) Deps

func (e *Engine) Deps(ctx context.Context, filePath string) ([]Edge, error)

Deps returns the outgoing dependency edges for filePath.

func (*Engine) DiffAgainstFileContent added in v0.6.0

func (e *Engine) DiffAgainstFileContent(before []Symbol, relPath string, content []byte) (GraphDiff, error)

DiffAgainstFileContent diffs a snapshot against itself with one file's symbols replaced by those parsed from content: "what would change structurally if relPath had these bytes?".

func (*Engine) DiffSince added in v0.6.0

func (e *Engine) DiffSince(ctx context.Context, before []Symbol) GraphDiff

DiffSince diffs a previously captured snapshot against the engine's current graph.

func (*Engine) FileSymbols added in v0.6.1

func (e *Engine) FileSymbols(ctx context.Context, relPath string) []Symbol

FileSymbols returns the symbols currently indexed for one repo-relative file path, ordered by span. Use this instead of SnapshotSymbols when only a handful of files matter (e.g. working-set drift checks).

func (*Engine) ICR

func (e *Engine) ICR(ctx context.Context, intent string) IsolatedChangeRegion

ICR computes the Isolated Change Region for a given intent.

func (*Engine) Impact

func (e *Engine) Impact(ctx context.Context, query string, maxDepth int) ([]Symbol, error)

Impact returns the blast radius for a symbol/file query.

func (*Engine) Index

func (e *Engine) Index(ctx context.Context, dir string) (IndexResult, error)

Index walks dir (defaults to RepoRoot), parses changed files via delta SHA, updates the persistent store, and refreshes the in-memory graph.

func (*Engine) PreviewFileSymbols added in v0.6.0

func (e *Engine) PreviewFileSymbols(relPath string, content []byte) ([]Symbol, error)

PreviewFileSymbols parses in-memory content as if it lived at relPath (repo-relative) and returns the symbols Grove would index for it. Combine with Diff to compute the structural delta of content that is not on disk yet — e.g. a git merge driver's result, which git writes to the worktree only after the driver exits.

func (*Engine) Query

func (e *Engine) Query(ctx context.Context, intent string, limit int) ([]Symbol, error)

Query resolves a natural-language intent into ranked symbols by blending TF-IDF semantic search with substring keyword matches.

func (*Engine) References added in v0.12.0

func (e *Engine) References(ctx context.Context, name string) (ReferenceResult, error)

References answers "where is NAME used?" by scanning code occurrences of the name (comments/strings excluded), each attributed to its enclosing symbol. Unlike Impact (which walks the resolved call graph), this is the resolution- free reference layer: near-complete for types/classes/constants that calls edges never capture. ReferenceResult.Ambiguous reports whether several definitions share the name. Catches syntactic references only — reflection / dynamic usage is invisible, so "no references" is best-effort, not proof of dead code.

func (*Engine) Root

func (e *Engine) Root() string

Root returns the repository root the engine is attached to.

func (*Engine) Semantic

func (e *Engine) Semantic(ctx context.Context, query string, limit int) ([]Scored, error)

Semantic returns TF-IDF-ranked symbols with cosine-similarity scores.

func (*Engine) SnapshotSymbols added in v0.6.0

func (e *Engine) SnapshotSymbols(ctx context.Context) []Symbol

SnapshotSymbols returns a deep copy of every symbol in the current graph. Capture one before a merge/reindex and pass it to Diff afterwards to get the structural delta.

func (*Engine) Status

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

Status reports the current persisted index summary.

func (*Engine) Symbols

func (e *Engine) Symbols(ctx context.Context, query string, limit int) ([]Symbol, error)

Symbols returns symbols whose name/qualified-name matches query (substring).

func (*Engine) Tests

func (e *Engine) Tests(ctx context.Context, query string) ([]Symbol, error)

Tests returns the test symbols that cover the given symbol/file query.

func (*Engine) TestsWithEvidence added in v0.11.0

func (e *Engine) TestsWithEvidence(ctx context.Context, query string) ([]Symbol, map[string]int, error)

TestsWithEvidence returns the covering tests plus the per-reason counts of edges the traversal policy excluded — the weak evidence Grove chose not to trust. Lets a consumer report "related tests" alongside what was withheld.

type EvidenceRef added in v0.4.5

type EvidenceRef = core.EvidenceRef

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type GraphDiff added in v0.6.0

type GraphDiff = core.GraphDiff

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

func Diff added in v0.6.0

func Diff(before, after []Symbol) GraphDiff

Diff computes the structural delta between two symbol snapshots, matched by stable identity (file path + qualified name + kind) so line shifts and content-SHA churn don't register as changes. This is the primitive behind the stale-context loop: diff the graph across a merge, intersect the changed/breaking symbols with another agent's working set, and you know exactly whose ground shifted.

type IndexResult

type IndexResult = core.IndexResult

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type IsolatedChangeRegion

type IsolatedChangeRegion = core.IsolatedChangeRegion

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type Reference added in v0.12.0

type Reference = parser.Reference

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type ReferenceResult added in v0.12.0

type ReferenceResult = parser.ReferenceResult

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type Scored

type Scored = struct {
	Symbol *core.SymbolRecord
	Score  float64
}

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type Status

type Status = core.Status

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type Symbol

type Symbol = core.SymbolRecord

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type SymbolChange added in v0.6.0

type SymbolChange = core.SymbolChange

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

type Verdict added in v0.4.5

type Verdict = core.Verdict

Re-exported core types — Prism/Fuse/Relay can use these directly without mirroring shapes.

Jump to

Keyboard shortcuts

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