herdr

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package herdr drives the herdr terminal multiplexer through its JSON CLI.

Two rules matter here. Never run bare `herdr` — that launches the TUI, even as a capability probe. And never fail flow because herdr is unavailable: a missing workspace is a warning, since the worktree and the editor are the parts that carry the work.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI struct {
	Runner flowexec.Runner
	// Bin is the herdr executable name.
	Bin string
	Log Logger
}

CLI is the herdr binary wrapper.

func New

func New(r flowexec.Runner, bin string, log Logger) *CLI

New returns a CLI for the configured herdr binary.

func (*CLI) Available

func (c *CLI) Available(ctx context.Context) bool

Available probes herdr without launching its TUI. `herdr workspace list` succeeds only when the local server is reachable, which is exactly the question callers are asking.

func (*CLI) CloseWorkspace

func (c *CLI) CloseWorkspace(ctx context.Context, id string) error

CloseWorkspace closes a workspace. flow never calls this during delete — that is an explicit non-goal — but `flow prune` and future commands may.

func (*CLI) CreateWorkspace

func (c *CLI) CreateWorkspace(ctx context.Context, cwd, label string) (Workspace, error)

CreateWorkspace opens a plain empty shell at cwd. It deliberately starts no agent and splits no panes.

func (*CLI) FocusWorkspace

func (c *CLI) FocusWorkspace(ctx context.Context, id string) error

FocusWorkspace brings an existing workspace to the front.

func (*CLI) ListWorkspaces

func (c *CLI) ListWorkspaces(ctx context.Context) ([]Workspace, error)

ListWorkspaces returns every workspace herdr knows about.

func (*CLI) Version

func (c *CLI) Version(ctx context.Context) (string, error)

Version reports herdr's version string, for `flow doctor`.

type Client

type Client interface {
	Available(ctx context.Context) bool
	CreateWorkspace(ctx context.Context, cwd, label string) (Workspace, error)
	ListWorkspaces(ctx context.Context) ([]Workspace, error)
	FocusWorkspace(ctx context.Context, id string) error
	CloseWorkspace(ctx context.Context, id string) error
}

Client is the herdr surface flow uses.

type Logger

type Logger interface {
	Debug(msg any, keyvals ...any)
}

Logger records parse fallbacks at -v. The signature matches charmbracelet/log, whose message parameter is an any.

type Workspace

type Workspace struct {
	ID         string `json:"id,omitempty"`
	Label      string `json:"label,omitempty"`
	TabID      string `json:"tab_id,omitempty"`
	RootPaneID string `json:"root_pane_id,omitempty"`
	CWD        string `json:"cwd,omitempty"`
}

Workspace is a herdr workspace as flow records it.

func FindByID

func FindByID(list []Workspace, id string) (Workspace, bool)

FindByID returns the workspace with the given ID.

func FindByLabel

func FindByLabel(list []Workspace, label string) (Workspace, bool)

FindByLabel returns the workspace carrying label.

func (Workspace) Identified

func (w Workspace) Identified() bool

Identified reports whether flow learned the workspace's ID. A workspace can be created successfully yet unidentified if herdr's JSON shape has changed.

Jump to

Keyboard shortcuts

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