enrichment

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package enrichment provides workspace enrichment types and functions. This centralizes enrichment logic previously scattered across nav and hooks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchCxStatsMap

func FetchCxStatsMap(nodes []*workspace.WorkspaceNode) map[string]*CxStats

FetchCxStatsMap fetches context stats by running cx stats --per-line. Returns a map indexed by workspace path.

func FetchNoteCountsMap

func FetchNoteCountsMap() (map[string]*NoteCounts, error)

FetchNoteCountsMap fetches note counts for all known workspaces. Returns counts indexed by workspace name (not path). The caller should map workspace names to paths as needed.

func FetchPlanStatsMap

func FetchPlanStatsMap() (map[string]*PlanStats, error)

FetchPlanStatsMap fetches plan statistics for all workspaces. It uses a lightweight frontmatter parser to avoid importing flow packages.

func FetchToolInfoMap

func FetchToolInfoMap(nodes []*workspace.WorkspaceNode, fetchRelease, fetchBinary bool) (map[string]*ReleaseInfo, map[string]*BinaryStatus)

FetchToolInfoMap fetches release info and binary status using `grove list --json`. Returns maps indexed by workspace path.

func GetRemoteURL

func GetRemoteURL(dir string) string

GetRemoteURL fetches the git remote URL for a directory.

Types

type BinaryStatus

type BinaryStatus struct {
	ToolName       string `json:"tool_name"`
	IsDevActive    bool   `json:"is_dev_active"`
	LinkName       string `json:"link_name"`
	CurrentVersion string `json:"current_version"`
}

BinaryStatus holds the active status of a project's binary.

type CxStats

type CxStats struct {
	Files  int   `json:"total_files"`
	Tokens int   `json:"total_tokens"`
	Size   int64 `json:"total_size"`
}

CxStats holds token counts from grove-context.

type EnrichedWorkspace

type EnrichedWorkspace struct {
	*workspace.WorkspaceNode
	GitStatus    *git.ExtendedGitStatus `json:"git_status,omitempty"`
	NoteCounts   *NoteCounts            `json:"note_counts,omitempty"`
	PlanStats    *PlanStats             `json:"plan_stats,omitempty"`
	ReleaseInfo  *ReleaseInfo           `json:"release_info,omitempty"`
	ActiveBinary *BinaryStatus          `json:"active_binary,omitempty"`
	CxStats      *CxStats               `json:"cx_stats,omitempty"`
	GitRemoteURL string                 `json:"git_remote_url,omitempty"`
}

EnrichedWorkspace wraps a WorkspaceNode with enrichment data.

func EnrichWorkspaces

func EnrichWorkspaces(ctx context.Context, nodes []*workspace.WorkspaceNode, opts *EnrichmentOptions) []*EnrichedWorkspace

EnrichWorkspaces updates workspace nodes with runtime enrichment data. Returns a slice of EnrichedWorkspace with the requested data populated.

type EnrichmentOptions

type EnrichmentOptions struct {
	FetchNoteCounts   bool
	FetchGitStatus    bool
	FetchPlanStats    bool
	FetchReleaseInfo  bool
	FetchBinaryStatus bool
	FetchCxStats      bool
	FetchRemoteURL    bool
	GitStatusPaths    map[string]bool // nil means all projects
}

EnrichmentOptions controls which data to fetch and for which projects

func DefaultEnrichmentOptions

func DefaultEnrichmentOptions() *EnrichmentOptions

DefaultEnrichmentOptions returns options that fetch the fast/common enrichments. More expensive enrichments (release, binary, cx) are off by default.

func FullEnrichmentOptions

func FullEnrichmentOptions() *EnrichmentOptions

FullEnrichmentOptions returns options that fetch all enrichment types.

type NoteCounts

type NoteCounts struct {
	Current    int `json:"current"`
	Issues     int `json:"issues"`
	Inbox      int `json:"inbox"`
	Docs       int `json:"docs"`
	Completed  int `json:"completed"`
	Review     int `json:"review"`
	InProgress int `json:"in_progress"`
	Other      int `json:"other"`
}

NoteCounts holds counts of notes by type.

type PlanStats

type PlanStats struct {
	TotalPlans int    `json:"total_plans"`
	ActivePlan string `json:"active_plan"`
	Running    int    `json:"running"`
	Pending    int    `json:"pending"`
	Completed  int    `json:"completed"`
	Failed     int    `json:"failed"`
	Todo       int    `json:"todo"`
	Hold       int    `json:"hold"`
	Abandoned  int    `json:"abandoned"`
	PlanStatus string `json:"plan_status,omitempty"` // Status of the plan itself (e.g., "hold", "finished")
}

PlanStats holds statistics about grove-flow plans.

type ReleaseInfo

type ReleaseInfo struct {
	LatestTag    string `json:"latest_tag"`
	CommitsAhead int    `json:"commits_ahead"`
}

ReleaseInfo holds release tag and commit information.

Jump to

Keyboard shortcuts

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