Documentation
¶
Overview ¶
Package hive provides the service layer for orchestrating hive operations.
Index ¶
- type App
- type ContextService
- func (c *ContextService) CreateSymlink(ctxDir string) (bool, error)
- func (c *ContextService) Init(ctxDir string) ([]string, error)
- func (c *ContextService) Prune(ctxDir string, olderThan time.Duration) (int, error)
- func (c *ContextService) ResolveDir(ctx context.Context, repo string, shared bool) (string, error)
- type CreateOptions
- type DoctorService
- type FileCopier
- type HookRunner
- type MessageService
- func (m *MessageService) Acknowledge(ctx context.Context, consumerID string, messageIDs []string) error
- func (m *MessageService) GenerateTopic(prefix string) string
- func (m *MessageService) GetUnread(ctx context.Context, consumerID string, topic string) ([]messaging.Message, error)
- func (m *MessageService) ListTopics(ctx context.Context) ([]string, error)
- func (m *MessageService) Prune(ctx context.Context, olderThan time.Duration) (int, error)
- func (m *MessageService) Publish(ctx context.Context, msg messaging.Message, topics []string) error
- func (m *MessageService) Subscribe(ctx context.Context, topic string, since time.Time) ([]messaging.Message, error)
- type RecycleData
- type Recycler
- type SessionService
- func (s *SessionService) CreateSession(ctx context.Context, opts CreateOptions) (*session.Session, error)
- func (s *SessionService) DeleteSession(ctx context.Context, id string) error
- func (s *SessionService) DetectRemote(ctx context.Context, dir string) (string, error)
- func (s *SessionService) DetectSession(ctx context.Context) (string, error)
- func (s *SessionService) GetSession(ctx context.Context, id string) (session.Session, error)
- func (s *SessionService) Git() git.Git
- func (s *SessionService) ListSessions(ctx context.Context) ([]session.Session, error)
- func (s *SessionService) Prune(ctx context.Context, all bool) (int, error)
- func (s *SessionService) RecycleSession(ctx context.Context, id string, w io.Writer) error
- func (s *SessionService) RenameSession(ctx context.Context, id, newName string) error
- type SpawnData
- type Spawner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Sessions *SessionService
Messages *MessageService
Context *ContextService
Doctor *DoctorService
Terminal *terminal.Manager
Plugins *plugins.Manager
Config *config.Config
DB *db.DB
KV kv.KV
Renderer *tmpl.Renderer
}
App is the central entry point for all hive operations. Commands and TUI consume App instead of cherry-picking raw dependencies.
func NewApp ¶
func NewApp( sessions *SessionService, msgStore messaging.Store, cfg *config.Config, termMgr *terminal.Manager, pluginMgr *plugins.Manager, database *db.DB, kvStore kv.KV, renderer *tmpl.Renderer, pluginInfos []doctor.PluginInfo, ) *App
NewApp constructs an App from explicit dependencies.
type ContextService ¶
type ContextService struct {
// contains filtered or unexported fields
}
ContextService manages per-repository context directories.
func NewContextService ¶
func NewContextService(cfg *config.Config, gitClient git.Git) *ContextService
NewContextService creates a new ContextService.
func (*ContextService) CreateSymlink ¶
func (c *ContextService) CreateSymlink(ctxDir string) (bool, error)
CreateSymlink creates a symlink from the current directory to the context directory. Returns true if the symlink already existed and pointed to the correct target.
func (*ContextService) Init ¶
func (c *ContextService) Init(ctxDir string) ([]string, error)
Init creates the context directory and standard subdirectories. Returns the list of subdirectories that were newly created.
func (*ContextService) Prune ¶
Prune deletes files in the context directory older than the given duration. Returns the number of files removed.
func (*ContextService) ResolveDir ¶
ResolveDir determines the context directory for the given repo spec. If repo is "owner/repo", it resolves directly. If shared is true, returns the shared dir. Otherwise detects from the current directory's git remote.
type CreateOptions ¶
type CreateOptions struct {
Name string // Session name (used in path)
SessionID string // Session ID (auto-generated if empty)
Prompt string // Prompt to pass to spawned terminal (batch only)
Remote string // Git remote URL to clone (auto-detected if empty)
Source string // Source directory for file copying
UseBatchSpawn bool // Use batch_spawn commands instead of spawn
}
CreateOptions configures session creation.
type DoctorService ¶
type DoctorService struct {
// contains filtered or unexported fields
}
DoctorService runs health checks on the hive setup.
func NewDoctorService ¶
func NewDoctorService(store session.Store, cfg *config.Config, pluginInfos []doctor.PluginInfo) *DoctorService
NewDoctorService creates a new DoctorService.
type FileCopier ¶
type FileCopier struct {
// contains filtered or unexported fields
}
FileCopier copies files from a source directory to a destination.
func NewFileCopier ¶
func NewFileCopier(log zerolog.Logger, stdout io.Writer) *FileCopier
NewFileCopier creates a new FileCopier.
type HookRunner ¶
type HookRunner struct {
// contains filtered or unexported fields
}
HookRunner executes repository-specific setup hooks.
func NewHookRunner ¶
func NewHookRunner(log zerolog.Logger, executor executil.Executor, stdout, stderr io.Writer) *HookRunner
NewHookRunner creates a new HookRunner.
type MessageService ¶
type MessageService struct {
// contains filtered or unexported fields
}
MessageService wraps messaging.Store with domain logic.
func NewMessageService ¶
func NewMessageService(store messaging.Store, cfg *config.Config) *MessageService
NewMessageService creates a new MessageService.
func (*MessageService) Acknowledge ¶
func (m *MessageService) Acknowledge(ctx context.Context, consumerID string, messageIDs []string) error
Acknowledge marks messages as read by a consumer.
func (*MessageService) GenerateTopic ¶
func (m *MessageService) GenerateTopic(prefix string) string
GenerateTopic creates a new topic name using the configured prefix and a random suffix.
func (*MessageService) GetUnread ¶
func (m *MessageService) GetUnread(ctx context.Context, consumerID string, topic string) ([]messaging.Message, error)
GetUnread returns messages not yet acknowledged by consumer.
func (*MessageService) ListTopics ¶
func (m *MessageService) ListTopics(ctx context.Context) ([]string, error)
ListTopics returns all topic names.
type RecycleData ¶
type RecycleData struct {
DefaultBranch string
}
RecycleData contains template data for recycle commands.
type Recycler ¶
type Recycler struct {
// contains filtered or unexported fields
}
Recycler handles resetting a session environment for reuse.
func NewRecycler ¶
NewRecycler creates a new Recycler.
func (*Recycler) Recycle ¶
func (r *Recycler) Recycle(ctx context.Context, path string, commands []string, data RecycleData, w io.Writer) error
Recycle executes recycle commands sequentially in the session directory. Commands are rendered as Go templates with the provided data. Output is written to the provided writer. If w is nil, output is discarded.
type SessionService ¶
type SessionService struct {
// contains filtered or unexported fields
}
SessionService orchestrates hive session operations.
func NewSessionService ¶
func NewSessionService( sessions session.Store, gitClient git.Git, cfg *config.Config, exec executil.Executor, renderer *tmpl.Renderer, log zerolog.Logger, stdout, stderr io.Writer, ) *SessionService
NewSessionService creates a new SessionService.
func (*SessionService) CreateSession ¶
func (s *SessionService) CreateSession(ctx context.Context, opts CreateOptions) (*session.Session, error)
CreateSession creates a new session or recycles an existing one.
func (*SessionService) DeleteSession ¶
func (s *SessionService) DeleteSession(ctx context.Context, id string) error
DeleteSession removes a session and its directory.
func (*SessionService) DetectRemote ¶
DetectRemote gets the git remote URL from the specified directory.
func (*SessionService) DetectSession ¶
func (s *SessionService) DetectSession(ctx context.Context) (string, error)
DetectSession returns the session ID for the current working directory. Returns empty string if not in a hive session.
func (*SessionService) GetSession ¶
GetSession returns a session by ID.
func (*SessionService) Git ¶
func (s *SessionService) Git() git.Git
Git returns the git client for use in background operations.
func (*SessionService) ListSessions ¶
ListSessions returns all sessions.
func (*SessionService) Prune ¶
Prune removes recycled and corrupted sessions and their directories. If all is true, deletes ALL recycled sessions. If all is false, respects max_recycled limit per repository (keeps newest N).
func (*SessionService) RecycleSession ¶
RecycleSession marks a session for recycling and runs recycle commands. The directory is renamed to a recycled name pattern immediately. Output is written to w. If w is nil, output is discarded.
func (*SessionService) RenameSession ¶
func (s *SessionService) RenameSession(ctx context.Context, id, newName string) error
RenameSession changes the name (and slug) of an existing session.
type SpawnData ¶
type SpawnData struct {
Path string // Absolute path to session directory
Name string // Session name (display name)
Prompt string // User-provided prompt (batch only)
Slug string // Session slug (URL-safe version of name)
ContextDir string // Path to context directory
Owner string // Repository owner
Repo string // Repository name
}
SpawnData is the template context for spawn commands.
type Spawner ¶
type Spawner struct {
// contains filtered or unexported fields
}
Spawner handles terminal spawning with template rendering.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package plugins provides a plugin system for extending Hive with additional commands and status providers.
|
Package plugins provides a plugin system for extending Hive with additional commands and status providers. |
|
beads
Package beads provides a Beads issue tracker plugin for Hive.
|
Package beads provides a Beads issue tracker plugin for Hive. |
|
claude
Package claude provides Claude Code integration for Hive.
|
Package claude provides Claude Code integration for Hive. |
|
contextdir
Package contextdir provides commands for opening context directories.
|
Package contextdir provides commands for opening context directories. |
|
github
Package github provides a GitHub plugin for Hive.
|
Package github provides a GitHub plugin for Hive. |
|
lazygit
Package lazygit provides a lazygit plugin for Hive.
|
Package lazygit provides a lazygit plugin for Hive. |
|
neovim
Package neovim provides a Neovim plugin for Hive.
|
Package neovim provides a Neovim plugin for Hive. |
|
tmux
Package tmux provides a tmux plugin for Hive with default session management commands.
|
Package tmux provides a tmux plugin for Hive with default session management commands. |
|
Package scripts embeds and extracts bundled helper scripts (hive-tmux, agent-send).
|
Package scripts embeds and extracts bundled helper scripts (hive-tmux, agent-send). |