Documentation
¶
Overview ¶
Package rig provides rig management functionality. This file implements the property layer lookup API for unified config access.
Package rig provides rig management functionality.
Index ¶
- Constants
- Variables
- type AddRigOptions
- type BeadsConfig
- type ConfigResult
- type ConfigSource
- type Manager
- type Rig
- func (r *Rig) BeadsPath() string
- func (r *Rig) DefaultBranch() string
- func (r *Rig) GetBoolConfig(key string) bool
- func (r *Rig) GetConfig(key string) interface{}
- func (r *Rig) GetConfigWithSource(key string) ConfigResult
- func (r *Rig) GetIntConfig(key string) int
- func (r *Rig) GetStringConfig(key string) string
- func (r *Rig) Summary() RigSummary
- type RigConfig
- type RigSummary
Constants ¶
const CurrentRigConfigVersion = 1
CurrentRigConfigVersion is the current schema version.
Variables ¶
var ( ErrRigNotFound = errors.New("rig not found") ErrRigExists = errors.New("rig already exists") )
Common errors
var AgentDirs = []string{
"polecats",
"crew",
"refinery/rig",
"witness",
"mayor/rig",
}
AgentDirs are the standard agent directories in a rig. Note: witness doesn't have a /rig subdirectory (no clone needed).
var StackingKeys = map[string]bool{ "priority_adjustment": true, }
StackingKeys defines which keys use stacking semantics (values add up). All other keys use override semantics (first non-nil wins).
var SystemDefaults = map[string]interface{}{ "status": "operational", "auto_restart": true, "max_polecats": 10, "priority_adjustment": 0, "dnd": false, }
SystemDefaults contains compiled-in default values. These are the fallback when no other layer provides a value.
Functions ¶
This section is empty.
Types ¶
type AddRigOptions ¶
type AddRigOptions struct {
Name string // Rig name (directory name)
GitURL string // Repository URL
BeadsPrefix string // Beads issue prefix (defaults to derived from name)
LocalRepo string // Optional local repo for reference clones
DefaultBranch string // Default branch (defaults to auto-detected from remote)
}
AddRigOptions configures rig creation.
type BeadsConfig ¶
type BeadsConfig struct {
Prefix string `json:"prefix"` // issue prefix (e.g., "gt")
SyncRemote string `json:"sync_remote,omitempty"` // git remote for bd sync
}
BeadsConfig represents beads configuration for the rig.
type ConfigResult ¶
type ConfigResult struct {
Value interface{}
Source ConfigSource
}
ConfigResult holds a config lookup result with its source.
type ConfigSource ¶
type ConfigSource string
ConfigSource identifies which layer a config value came from.
const ( SourceWisp ConfigSource = "wisp" // Local wisp layer (.beads-wisp/config/) SourceBead ConfigSource = "bead" // Rig identity bead labels SourceTown ConfigSource = "town" // Town defaults (~/gt/settings/config.json) SourceSystem ConfigSource = "system" // Compiled-in system defaults SourceBlocked ConfigSource = "blocked" // Explicitly blocked at wisp layer SourceNone ConfigSource = "none" // No value found )
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles rig discovery, loading, and creation.
func NewManager ¶
NewManager creates a new rig manager.
func (*Manager) AddRig ¶
func (m *Manager) AddRig(opts AddRigOptions) (*Rig, error)
AddRig creates a new rig as a container with clones for each agent. The rig structure is:
<name>/ # Container (NOT a git clone) ├── config.json # Rig configuration ├── .beads/ # Rig-level issue tracking ├── refinery/rig/ # Canonical main clone ├── mayor/rig/ # Mayor's working clone ├── witness/ # Witness agent (no clone) ├── polecats/ # Worker directories (empty) └── crew/<crew>/ # Default human workspace
func (*Manager) DiscoverRigs ¶
DiscoverRigs returns all rigs registered in the workspace. Rigs that fail to load are logged to stderr and skipped; partial results are returned.
func (*Manager) ListRigNames ¶
ListRigNames returns the names of all registered rigs.
type Rig ¶
type Rig struct {
// Name is the rig identifier (directory name).
Name string `json:"name"`
// Path is the absolute path to the rig directory.
Path string `json:"path"`
// GitURL is the remote repository URL.
GitURL string `json:"git_url"`
// LocalRepo is an optional local repository used for reference clones.
LocalRepo string `json:"local_repo,omitempty"`
// Config is the rig-level configuration.
Config *config.BeadsConfig `json:"config,omitempty"`
// Polecats is the list of polecat names in this rig.
Polecats []string `json:"polecats,omitempty"`
// Crew is the list of crew worker names in this rig.
// Crew workers are user-managed persistent workspaces.
Crew []string `json:"crew,omitempty"`
// HasWitness indicates if the rig has a witness agent.
HasWitness bool `json:"has_witness"`
// HasRefinery indicates if the rig has a refinery agent.
HasRefinery bool `json:"has_refinery"`
// HasMayor indicates if the rig has a mayor clone.
HasMayor bool `json:"has_mayor"`
}
Rig represents a managed repository in the workspace.
func (*Rig) BeadsPath ¶
BeadsPath returns the path to use for beads operations. Returns the mayor/rig clone path if available (has proper sync-branch config), otherwise falls back to the rig root path. This ensures beads commands read from a location with git-synced beads data.
func (*Rig) DefaultBranch ¶
DefaultBranch returns the configured default branch for this rig. Falls back to "main" if not configured or if config cannot be loaded.
func (*Rig) GetBoolConfig ¶
GetBoolConfig looks up a boolean config value. Returns false if not set, not a bool, or blocked.
func (*Rig) GetConfig ¶
GetConfig looks up a config value through all layers. Override semantics: first non-nil value wins. Layers are checked in order: wisp -> bead -> town -> system
func (*Rig) GetConfigWithSource ¶
func (r *Rig) GetConfigWithSource(key string) ConfigResult
GetConfigWithSource looks up a config value and returns which layer it came from.
func (*Rig) GetIntConfig ¶
GetIntConfig looks up an integer config value with stacking semantics. For stacking keys, values from wisp and bead layers ADD to the base. For non-stacking keys, uses override semantics.
func (*Rig) GetStringConfig ¶
GetStringConfig looks up a string config value. Returns empty string if not set or blocked.
type RigConfig ¶
type RigConfig struct {
Type string `json:"type"` // "rig"
Version int `json:"version"` // schema version
Name string `json:"name"` // rig name
GitURL string `json:"git_url"` // repository URL
LocalRepo string `json:"local_repo,omitempty"` // optional local reference repo
DefaultBranch string `json:"default_branch,omitempty"` // main, master, etc.
CreatedAt time.Time `json:"created_at"` // when rig was created
Beads *BeadsConfig `json:"beads,omitempty"`
}
RigConfig represents the rig-level configuration (config.json at rig root).
func LoadRigConfig ¶
LoadRigConfig reads the rig configuration from config.json.