grove

package
v0.14.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: 7 Imported by: 0

Documentation

Overview

Package grove is Prism's adapter to the in-process Grove engine.

Historically this package was an HTTP client that spoke to a long-running `grove serve` daemon. The embedded-Grove architecture removes the daemon: Prism links against `grove/pkg/grove` directly and opens the on-disk index in the same process. The public surface of Client (NewClient, EnsureRunning, Index, Query…) is preserved so the rest of Prism (ranking, MCP, CLI) is unchanged.

Package grove holds typed mirrors of Grove's result shapes used by the Prism client. They are plain structs sharing Grove's JSON wire tags so the rest of Prism (ranking, MCP, CLI) never touches engine types directly, and records can round-trip back into the engine (see toEngineSymbol).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallSite

type CallSite struct {
	Callee string `json:"callee"`
	Line   int    `json:"line"`
}

CallSite mirrors grove/internal/core.CallSite.

type Client

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

Client wraps an embedded Grove engine. baseURL/groveBin are ignored in the embedded model and retained only so existing call sites keep compiling.

func NewClient

func NewClient(_, _ string) *Client

NewClient returns a Client. baseURL and groveBin are accepted for API compatibility but unused — Grove is now embedded in-process.

func (*Client) BaseURL

func (c *Client) BaseURL() string

BaseURL returns an embedded-mode marker so legacy log lines remain readable.

func (*Client) Deps

func (c *Client) Deps(ctx context.Context, file string) ([]Edge, error)

Deps returns dependency edges for file.

func (*Client) DiffFile added in v0.7.0

func (c *Client) DiffFile(ctx context.Context, before []SymbolRecord, relPath string) (*FileGraphDiff, error)

DiffFile diffs the symbols delivered earlier (before) against the file's current indexed symbols using Grove's GraphDiff, so renames are paired and breaking changes classified instead of appearing as remove+add churn.

func (*Client) EnsureRunning

func (c *Client) EnsureRunning(ctx context.Context) error

EnsureRunning opens the embedded Grove engine if it has not been opened yet. Replaces the old HTTP probe + auto-spawn of `grove serve`.

func (*Client) FileSymbols added in v0.7.0

func (c *Client) FileSymbols(ctx context.Context, relPath string) ([]SymbolRecord, error)

FileSymbols returns the symbols currently indexed for one repo-relative file path. Used by file reads and working-set drift checks.

func (*Client) Health

func (c *Client) Health(ctx context.Context) error

Health returns nil once the engine is open.

func (*Client) Impact

func (c *Client) Impact(ctx context.Context, query string, maxDepth int) ([]SymbolRecord, error)

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

func (*Client) Index

func (c *Client) Index(ctx context.Context, dir string) (*IndexResult, error)

Index indexes dir (defaults to the project root) and returns a result summary in the wire-format shape Prism's callers expect.

func (*Client) QueryByIntent

func (c *Client) QueryByIntent(ctx context.Context, intent string, limit int) ([]SymbolRecord, error)

QueryByIntent resolves an intent string into ranked symbols.

func (*Client) References added in v0.13.0

func (c *Client) References(ctx context.Context, name string) (groveeng.ReferenceResult, error)

References returns code occurrences of a symbol name — the reference layer ("where is X used"), near-complete for types/classes the call graph misses.

func (*Client) SearchSymbols

func (c *Client) SearchSymbols(ctx context.Context, query string, limit int) ([]SymbolRecord, error)

SearchSymbols returns symbols matching query (substring).

func (*Client) Semantic

func (c *Client) Semantic(ctx context.Context, query string, limit int) ([]SemanticResult, error)

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

func (*Client) Shutdown

func (c *Client) Shutdown()

Shutdown closes the engine.

func (*Client) Status

func (c *Client) Status(ctx context.Context) (*StatusResult, error)

Status returns the persisted index summary.

func (*Client) Tests

func (c *Client) Tests(ctx context.Context, query string) ([]SymbolRecord, error)

Tests returns the tests covering query.

func (*Client) WithTokenFromDir

func (c *Client) WithTokenFromDir(root string) *Client

WithTokenFromDir records the repository root so EnsureRunning can open the engine at <root>/.grove/grove.db. The name is kept for compatibility; no shared-secret token is read or sent (none exists in the embedded model).

type Edge

type Edge struct {
	From       string  `json:"from"`
	To         string  `json:"to"`
	Type       string  `json:"type"`
	Confidence float64 `json:"confidence"`
}

Edge mirrors grove/internal/core.Edge.

type FileGraphDiff added in v0.7.0

type FileGraphDiff struct {
	Added    []SymbolRecord `json:"added"`
	Removed  []SymbolRecord `json:"removed"`
	Changed  []SymbolChange `json:"changed"`
	Renamed  []SymbolChange `json:"renamed,omitempty"`
	Breaking []SymbolChange `json:"breakingChanges"`
}

FileGraphDiff mirrors grove's core.GraphDiff scoped to one file: the structural delta between a delivered symbol snapshot and the current index, with renames paired and breaking changes classified.

type ImpactNode

type ImpactNode = SymbolRecord

ImpactNode is one entry returned by Grove's /impact endpoint.

type IndexResult

type IndexResult struct {
	Root         string `json:"root"`
	FilesSeen    int    `json:"filesSeen"`
	FilesUpdated int    `json:"filesUpdated"`
	FilesSkipped int    `json:"filesSkipped"`
	FilesPruned  int    `json:"filesPruned"`
	SymbolCount  int    `json:"symbolCount"`
	EdgeCount    int    `json:"edgeCount"`
}

IndexResult mirrors Grove's /index response.

type SemanticResult

type SemanticResult struct {
	Score  float64      `json:"score"`
	Symbol SymbolRecord `json:"symbol"`
}

SemanticResult mirrors Grove's /semantic response entry.

type SpanInfo

type SpanInfo struct {
	Start int `json:"start"`
	End   int `json:"end"`
}

SpanInfo is the start/end line range.

type StatusResult

type StatusResult struct {
	FilesIndexed int `json:"filesIndexed"`
	SymbolCount  int `json:"symbolCount"`
	EdgeCount    int `json:"edgeCount"`
}

StatusResult mirrors Grove's /status response.

type SymbolChange added in v0.7.0

type SymbolChange struct {
	Before           *SymbolRecord `json:"before,omitempty"`
	After            *SymbolRecord `json:"after,omitempty"`
	SignatureChanged bool          `json:"signatureChanged"`
	BodyChanged      bool          `json:"bodyChanged"`
}

SymbolChange mirrors grove's core.SymbolChange: one symbol's before/after pair in a structural diff.

type SymbolRecord

type SymbolRecord struct {
	ID             string     `json:"id"`
	FilePath       string     `json:"filePath"`
	BlobSha        string     `json:"blobSha"`
	Language       string     `json:"language"`
	Kind           string     `json:"kind"`
	Name           string     `json:"name"`
	QualifiedName  string     `json:"qualifiedName"`
	Signature      string     `json:"signature"`
	Docstring      string     `json:"docstring,omitempty"`
	Span           SpanInfo   `json:"span"`
	ParentSymbol   string     `json:"parentSymbol,omitempty"`
	Imports        []string   `json:"imports,omitempty"`
	Exports        bool       `json:"exports"`
	RawText        string     `json:"rawText,omitempty"`
	Modifiers      []string   `json:"modifiers,omitempty"`
	TypeParameters []string   `json:"typeParameters,omitempty"`
	Annotations    []string   `json:"annotations,omitempty"`
	CallSites      []CallSite `json:"callSites,omitempty"`
}

SymbolRecord mirrors grove/internal/core.SymbolRecord.

Jump to

Keyboard shortcuts

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