grove

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package grove is Fuse's adapter to the in-process Grove engine. The previous HTTP client + auto-spawn of `grove serve` is gone: Fuse now links against `grove/pkg/grove` and opens the on-disk index directly. Public types (Client, Edge, ImpactNode, SymbolRecord, EnsureRunning) are preserved so the rest of Fuse compiles unchanged.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureRunning

func EnsureRunning(ctx context.Context, baseURL, binary, root string, timeout time.Duration) error

EnsureRunning is a no-op in the embedded model — Grove is in-process. Kept for API compatibility; baseURL/binary/timeout are ignored. root is required so we know which repository's .grove/ to attach to.

Types

type Client

type Client struct {
	BaseURL string
	Token   string
	// contains filtered or unexported fields
}

Client wraps an embedded Grove engine. BaseURL/Token are accepted for API compatibility but unused.

func New

func New(baseURL string) *Client

New returns a Client. baseURL is retained for compatibility and ignored.

func (*Client) Close

func (c *Client) Close()

Close releases the engine.

func (*Client) Deps

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

Deps returns dependency edges for filePath.

func (*Client) DriftForMergedFile added in v0.6.0

func (c *Client) DriftForMergedFile(ctx context.Context, snap GraphSnapshot, relPath string, merged []byte) (Drift, error)

DriftForMergedFile computes the structural delta a merge produces for one file, from the merged bytes alone. This is the merge-driver path: git only writes the driver's output to the worktree after the driver exits, so the post-merge state is never on disk while we run — Grove parses the merged content in memory instead.

func (*Client) DriftSince added in v0.6.0

func (c *Client) DriftSince(ctx context.Context, snap GraphSnapshot) (Drift, error)

DriftSince reindexes (delta — unchanged files are skipped) and returns the structural delta against a snapshot taken before the merge. Use after the working tree actually contains the merged result (e.g. post-merge hooks).

func (*Client) EnsureIndexed added in v0.5.0

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

EnsureIndexed makes the embedded index usable for blast-radius queries. On a fresh clone the engine opens with zero symbols and every Impact/Deps call silently returns nothing, so an empty index triggers a full build (bounded by ctx). A populated index gets a best-effort delta refresh so the graph reflects the current working tree; refresh errors are swallowed because stale impact data is better than failing the merge.

func (*Client) Health

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

Health returns nil if the engine is open (or can be opened lazily).

func (*Client) Impact

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

Impact returns nodes affected by changes to query (file or symbol).

func (*Client) Index

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

Index triggers (re-)indexing of dir.

func (*Client) Snapshot added in v0.6.0

func (c *Client) Snapshot(ctx context.Context) (GraphSnapshot, error)

Snapshot captures the current graph for later drift computation. Call it before writing merged content; the index reflects the pre-merge working tree because EnsureIndexed runs when the client is constructed.

func (*Client) Symbols

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

Symbols searches symbols by query string.

func (*Client) WithTokenFromDir

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

WithTokenFromDir records the project root so Fuse can open the engine at <dir>/.grove/grove.db on first use. No token is read (none exists).

type Drift added in v0.6.0

type Drift struct {
	Added    []DriftSymbol `json:"added,omitempty"`
	Removed  []DriftSymbol `json:"removed,omitempty"`
	Changed  []DriftSymbol `json:"changed,omitempty"`
	Renamed  []DriftSymbol `json:"renamed,omitempty"`
	Breaking []DriftSymbol `json:"breaking,omitempty"`
}

Drift is the structural delta of the code graph across a merge, matched by stable symbol identity (file path + qualified name + kind) — line shifts and content-hash churn do not register. This is the evidence the stale-context loop delivers: which symbols changed under everyone's feet, and which of those changes break the exported surface.

func (Drift) Empty added in v0.6.0

func (d Drift) Empty() bool

Empty reports whether the merge produced no structural change.

func (Drift) Summary added in v0.6.0

func (d Drift) Summary() string

Summary is a one-line human rendering for merge-driver stderr output.

type DriftSymbol added in v0.6.0

type DriftSymbol struct {
	FilePath      string `json:"filePath"`
	QualifiedName string `json:"qualifiedName"`
	Kind          string `json:"kind"`
	Change        string `json:"change"` // added | removed | signature | body | renamed
	Exported      bool   `json:"exported"`
	OldSignature  string `json:"oldSignature,omitempty"`
	NewSignature  string `json:"newSignature,omitempty"`
	// RenamedFrom carries the previous qualified name (and file, when it
	// moved) for change == "renamed".
	RenamedFrom string `json:"renamedFrom,omitempty"`
}

DriftSymbol is one symbol-level entry in a graph drift report.

type Edge

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

Edge mirrors the engine edge shape Fuse consumes.

type GraphSnapshot added in v0.6.0

type GraphSnapshot []groveeng.Symbol

GraphSnapshot is an opaque capture of the Grove code graph, taken before a merge so the structural delta can be computed afterwards.

type ImpactNode

type ImpactNode struct {
	ID       string `json:"id"`
	FilePath string `json:"filePath"`
	Name     string `json:"name"`
}

ImpactNode is one entry in the blast-radius response.

type SymbolRecord

type SymbolRecord struct {
	ID       string `json:"id"`
	FilePath string `json:"filePath"`
	Name     string `json:"name"`
	Kind     string `json:"kind"`
}

SymbolRecord is the wire-format subset Fuse uses.

Jump to

Keyboard shortcuts

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