Documentation
¶
Overview ¶
Package dog manages Dogs - Deacon's helper workers for infrastructure tasks. Dogs are reusable workers with multi-rig worktrees, managed by the Deacon. Unlike polecats (single-rig, ephemeral), dogs handle cross-rig infrastructure work.
Index ¶
- Variables
- type Dog
- type DogState
- type Manager
- func (m *Manager) Add(name string) (*Dog, error)
- func (m *Manager) AssignWork(name, work string) error
- func (m *Manager) CleanupStaleBranches() (int, error)
- func (m *Manager) ClearWork(name string) error
- func (m *Manager) Get(name string) (*Dog, error)
- func (m *Manager) GetIdleDog() (*Dog, error)
- func (m *Manager) IdleCount() (int, error)
- func (m *Manager) List() ([]*Dog, error)
- func (m *Manager) Refresh(name string) error
- func (m *Manager) RefreshRig(name, rigName string) error
- func (m *Manager) Remove(name string) error
- func (m *Manager) SetState(name string, state State) error
- func (m *Manager) WorkingCount() (int, error)
- type State
Constants ¶
This section is empty.
Variables ¶
var ( ErrDogExists = errors.New("dog already exists") ErrDogNotFound = errors.New("dog not found") ErrNoRigs = errors.New("no rigs configured") )
Common errors
Functions ¶
This section is empty.
Types ¶
type Dog ¶
type Dog struct {
Name string // Dog name (e.g., "alpha")
State State // Current state
Path string // Path to kennel dir (~/gt/deacon/dogs/<name>)
Worktrees map[string]string // Rig name -> worktree path
LastActive time.Time // Last activity timestamp
Work string // Current work assignment (bead ID or molecule)
CreatedAt time.Time // When dog was added to kennel
}
Dog represents a Deacon helper worker.
type DogState ¶
type DogState struct {
Name string `json:"name"`
State State `json:"state"`
LastActive time.Time `json:"last_active"`
Work string `json:"work,omitempty"` // Current work assignment
Worktrees map[string]string `json:"worktrees,omitempty"` // Rig -> path (for verification)
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
DogState is the persistent state stored in .dog.json.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles dog lifecycle in the kennel.
func NewManager ¶
func NewManager(townRoot string, rigsConfig *config.RigsConfig) *Manager
NewManager creates a new dog manager.
func (*Manager) Add ¶
Add creates a new dog in the kennel with worktrees into each rig. Each dog gets a worktree per rig (e.g., dogs/alpha/gastown/, dogs/alpha/beads/). Worktrees are created from each rig's bare repo (.repo.git) or mayor/rig.
func (*Manager) AssignWork ¶
AssignWork assigns work to a dog and sets it to working state.
func (*Manager) CleanupStaleBranches ¶
CleanupStaleBranches removes orphaned dog branches from all rigs. Returns total branches deleted across all rigs.
func (*Manager) GetIdleDog ¶
GetIdleDog returns an idle dog suitable for work assignment. Returns nil if no idle dogs are available.
func (*Manager) Refresh ¶
Refresh recreates all worktrees for a dog with fresh branches. This is useful when worktrees have drifted or become stale.
func (*Manager) RefreshRig ¶
RefreshRig recreates the worktree for a specific rig.
func (*Manager) Remove ¶
Remove deletes a dog from the kennel. Removes all worktrees and the dog directory.
func (*Manager) WorkingCount ¶
WorkingCount returns the number of working dogs.