Help us shape the future of Go! Take the 2026 Go Developer Survey

app

package
v0.68.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package app is the hive CLI's composition root: the engine services plus the pieces only the CLI has (plugins, the command set, sources, its config).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSourceRegistry

func BuildSourceRegistry(logger zerolog.Logger, cfg *config.Config, exec cliengine.Executor, kvStore kv.KV) *sources.Registry

BuildSourceRegistry constructs the sources.Registry from cfg, registering a per-backend source for each enabled builtin. Registration failures are logged and the offending entry is skipped rather than failing startup.

Types

type App

type App struct {
	*hive.Engine

	// Logger carries no cmp label. A command or component adds its own.
	Logger zerolog.Logger

	// Config is the CLI config. It shadows Engine.Config, and its embedded
	// engine half is the config the engine was built from.
	Config *config.Config
	// ConfigPath is the config file the CLI loaded, which a daemon it starts
	// must load too.
	ConfigPath  string
	Doctor      *doctor.Service
	Multiplexer Multiplexer
	Plugins     *plugins.Manager
	CommandSet  *plugins.CommandSet
	Build       BuildInfo
	Sources     *sources.Registry
	// Servers is the local session API and each server under servers:.
	Servers *servers.Fleet
	// contains filtered or unexported fields
}

App is the central entry point for all hive operations. It embeds the engine, whose accessors (Sessions, Messages, HC, ...) commands and the TUI call per use, and adds what only the CLI has.

func NewApp

func NewApp(
	logger zerolog.Logger,
	engine *hive.Engine,
	cfg *config.Config,
	multiplexer Multiplexer,
	pluginMgr *plugins.Manager,
	commandSet *plugins.CommandSet,
	pluginInfos []doctor.PluginInfo,
	configPath string,
) *App

NewApp wraps an engine built from &cfg.Config with the CLI pieces. Doctor validates the whole CLI config, so `hive doctor` keeps reporting errors in sections only the CLI reads.

func (*App) DaemonClient added in v0.68.0

func (a *App) DaemonClient(autoStart bool) *daemonclient.Client

DaemonClient reaches the daemon for this data directory. It needs only the logger, the config, and ConfigPath, so commands that skip the engine can call it. With autoStart, a dial that finds no daemon starts this binary as one.

func (*App) DefaultServer added in v0.68.0

func (a *App) DefaultServer() string

DefaultServer is the server that SessionAPI reaches and that a bare session id names: the --target-server server, else session.LocalServer.

func (*App) ServerAPI added in v0.68.0

func (a *App) ServerAPI(name string) (sessionapi.API, error)

ServerAPI is the session API of the named server; session.LocalServer names this machine.

func (*App) SessionAPI added in v0.68.0

func (a *App) SessionAPI() sessionapi.API

SessionAPI is the path for session writes, session reads, and session-view status: the daemon when experimental.daemon is on, else this process's engine. Tmux-only helpers and git reads stay on Sessions().

func (*App) TargetServer added in v0.68.0

func (a *App) TargetServer(name string) error

TargetServer points SessionAPI at the daemon on a server under servers:, so session commands act on that server's sessions instead of local ones.

func (*App) TargetsServer added in v0.68.0

func (a *App) TargetsServer() bool

TargetsServer reports whether SessionAPI reaches a server, where paths and tmux sessions on this machine mean nothing.

type BuildInfo

type BuildInfo struct {
	Version string
	Commit  string
	Date    string
}

BuildInfo holds build-time metadata set by the main package.

type Multiplexer

type Multiplexer interface {
	sessionsvc.Multiplexer
	terminal.PaneSource
	ResolveTarget(ctx context.Context, raw string) (multiplexer.Pane, error)
	SendLiteral(ctx context.Context, target multiplexer.Target, text string) error
	SendKey(ctx context.Context, target multiplexer.Target, key multiplexer.NamedKey) error
	Paste(ctx context.Context, target multiplexer.Target, text []byte, opts multiplexer.PasteOptions) error
}

Multiplexer exposes the shared operations used by application commands.

Jump to

Keyboard shortcuts

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