Files
gastown/internal/rig/types.go
Steve Yegge 52194a5496 fix(rig): check witness/state.json instead of witness/rig (gm-2ej)
Witnesses don't have git clones like other agents. The detection was
checking for witness/rig which doesn't exist. Now correctly checks for
witness/state.json which is created by AddRig.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 20:23:42 -08:00

68 lines
1.8 KiB
Go

// Package rig provides rig management functionality.
package rig
import (
"github.com/steveyegge/gastown/internal/config"
)
// Rig represents a managed repository in the workspace.
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"`
// 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"`
}
// AgentDirs are the standard agent directories in a rig.
// Note: witness doesn't have a /rig subdirectory (no clone needed).
var AgentDirs = []string{
"polecats",
"crew",
"refinery/rig",
"witness",
"mayor/rig",
}
// RigSummary provides a concise overview of a rig.
type RigSummary struct {
Name string `json:"name"`
PolecatCount int `json:"polecat_count"`
CrewCount int `json:"crew_count"`
HasWitness bool `json:"has_witness"`
HasRefinery bool `json:"has_refinery"`
}
// Summary returns a RigSummary for this rig.
func (r *Rig) Summary() RigSummary {
return RigSummary{
Name: r.Name,
PolecatCount: len(r.Polecats),
CrewCount: len(r.Crew),
HasWitness: r.HasWitness,
HasRefinery: r.HasRefinery,
}
}