grove.nvim grove.nvim
grove.nvim is a Neovim plugin that integrates the Grove CLI ecosystem into the editor. It provides a Lua interface for orchestrating AI workflows, managing context, and navigating workspaces by wrapping the underlying grove binaries.
Core Mechanisms
Hybrid Architecture: The plugin consists of a Lua frontend and a Go binary. The Lua layer handles UI elements (floating windows, virtual text, inputs), while the Go binary acts as a bridge, constructing and executing commands for flow, cx, and tend.
Terminal Wrapping: Interactive CLI tools (like flow plan tui, cx view, nb tui) are executed inside Neovim floating windows or splits. This allows usage of the full TUI capabilities without leaving the editor context.
Tool Status: The plugin polls metadata from flow plan status --json and cx stats to render real-time feedback via a native status bar or Lualine components.
Internal Discovery: The embedded Go binary utilizes grove core libraries directly to perform workspace discovery and alias resolution (resolve-aliases), ensuring consistent path handling with the rest of the ecosystem.
Features
Flow Orchestration
- Chat Execution:
:GroveChatRunexecutesflow runon the current Markdown buffer. It pipes output to a terminal window or handles headless execution with status indicators. - Plan Management:
:GrovePlanopens a picker (viasnacks.nvim) to browse, filter, and manage plans.:GroveAddJobprovides a form-based UI for appending jobs to the active plan. - Visual Indicators: Renders virtual text in Markdown files to distinguish user turns, LLM responses, and running states.
Context Management
- Rule Editing: Provides syntax highlighting and virtual text statistics for
.grove/rulesfiles. It executescx stats --per-lineto display token counts and file matches next to each rule. - Alias Resolution: The rules editor supports
gf(go to file) on@aliasdirectives by resolving them viacx resolve. - Autocompletion: Integrates with
blink.cmpto provide completions for:- Aliases:
@alias:paths resolved from the workspace viacx workspace list. - Git Repos: Remote repository paths for
git:aliases viacx repo list. - Templates: Available job templates via
flow plan templates list.
- Aliases:
File Marking
The :GroveMarkFile command adds the current buffer to a persistent .grove/marks list. The plugin automatically syncs this list into the .grove/rules file using aliases, allowing rapid context manipulation without manual rule editing.
Testing Integration
:GroveRunTest executes the tend test scenario defined under the cursor. It extracts the scenario name from the Go file and runs tend run --debug-session <name> in a floating window.
Text Interaction
:GroveText captures visually selected text and prompts for a user question. It appends both to a target chat file and optionally executes the run immediately (:GroveTextRun), facilitating “ask about code” workflows.
Integrations
grove.nvim serves as the editor layer for the following tools:
flow: Manages the lifecycle of chat sessions and plans. The plugin reads job statuses via JSON output and executes plan modifications.cx: Used for context analysis. The plugin visualizescx statsdata, usescx resolvefor navigation, andcx workspace listfor autocompletion.tend: Executes specific test scenarios identified by the cursor position in Go test files.nav/gmux::GroveSessionizewrapsgmux szto switch tmux sessions from within Neovim.hooks::GroveHooksSessionsdisplays the active session history TUI.nb::GroveNBBrowseopens the notebook TUI for knowledge base navigation.grove: Wraps thereleaseandlogsTUIs for ecosystem management.core: The plugin’s binary importsgrove-corepackages to replicate workspace discovery logic for internal operations.