Files
gastown/internal/crew/types.go
Steve Yegge 05f692cc2f feat: add crew directory structure and manager
Add crew/ directory support to rig structure for user-managed
persistent workspaces. Crew workers are separate from polecats
(AI-managed) and can have optional custom BEADS_DIR configuration.

- Add internal/crew package with Worker type and Manager
- Update rig types to include Crew slice and CrewCount in summary
- Update rig manager to scan for crew workers
- Add crew/ to AgentDirs for rig initialization

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 20:31:18 -08:00

73 lines
1.9 KiB
Go

// Package crew provides crew worker management.
// Crew workers are user-managed persistent workspaces within a rig,
// as opposed to polecats which are AI-managed workers.
package crew
import "time"
// State represents the current state of a crew worker.
type State string
const (
// StateActive means the crew workspace is active.
StateActive State = "active"
// StateInactive means the crew workspace is inactive.
StateInactive State = "inactive"
)
// Worker represents a crew member's workspace in a rig.
// Unlike polecats, crew workers are managed by the Overseer (human),
// not by AI agents.
type Worker struct {
// Name is the crew worker identifier.
Name string `json:"name"`
// Rig is the rig this worker belongs to.
Rig string `json:"rig"`
// State is the current state.
State State `json:"state"`
// ClonePath is the path to the worker's clone.
ClonePath string `json:"clone_path"`
// Branch is the current git branch (if any).
Branch string `json:"branch,omitempty"`
// BeadsDir is an optional custom beads directory.
// If empty, defaults to the rig's .beads/ directory.
BeadsDir string `json:"beads_dir,omitempty"`
// CreatedAt is when the worker was created.
CreatedAt time.Time `json:"created_at"`
// UpdatedAt is when the worker was last updated.
UpdatedAt time.Time `json:"updated_at"`
}
// Summary provides a concise view of crew worker status.
type Summary struct {
Name string `json:"name"`
State State `json:"state"`
Branch string `json:"branch,omitempty"`
}
// Summary returns a Summary for this worker.
func (w *Worker) Summary() Summary {
return Summary{
Name: w.Name,
State: w.State,
Branch: w.Branch,
}
}
// EffectiveBeadsDir returns the beads directory to use.
// Returns the custom BeadsDir if set, otherwise returns the rig default path.
func (w *Worker) EffectiveBeadsDir(rigPath string) string {
if w.BeadsDir != "" {
return w.BeadsDir
}
return rigPath + "/.beads"
}