Documentation
¶
Index ¶
- func BuildPortRanges(workCfg *config.WorktreeConfig) map[string][2]int
- func NormalizeBranchName(branch string) string
- type Registry
- func (r *Registry) Add(wt *Worktree) error
- func (r *Registry) AllocatePorts(services []string) (map[string]int, error)
- func (r *Registry) FindAvailablePort(service string) (int, error)
- func (r *Registry) Get(normalized string) (*Worktree, bool)
- func (r *Registry) List() []*Worktree
- func (r *Registry) Remove(normalized string) error
- func (r *Registry) Save() error
- type Worktree
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPortRanges ¶
func BuildPortRanges(workCfg *config.WorktreeConfig) map[string][2]int
BuildPortRanges constructs port ranges from WorktreeConfig All port ranges must be defined in the configuration file
func NormalizeBranchName ¶
NormalizeBranchName converts a branch name to a filesystem-safe directory name
Types ¶
type Registry ¶
type Registry struct {
Worktrees map[string]*Worktree `json:"worktrees"`
PortRanges map[string][2]int `json:"port_ranges"`
// contains filtered or unexported fields
}
Registry manages all worktree instances and port allocations
func Load ¶
func Load(worktreeDir string, workCfg *config.WorktreeConfig) (*Registry, error)
Load loads the registry from disk, or creates a new one if it doesn't exist workCfg is optional - if provided, port ranges are loaded from configuration
func (*Registry) AllocatePorts ¶
AllocatePorts allocates ports for all specified services
func (*Registry) FindAvailablePort ¶
FindAvailablePort finds an available port for a service
type Worktree ¶
type Worktree struct {
Branch string `json:"branch"`
Normalized string `json:"normalized"`
Created time.Time `json:"created"`
Projects []string `json:"projects"`
Ports map[string]int `json:"ports"`
ComputedVars map[string]string `json:"computed_vars,omitempty"` // All env vars fully resolved for this instance (ports, derived URLs, aliases)
ComposeProject string `json:"compose_project,omitempty"` // Deprecated: use ComposeProjects
ComposeProjects map[string]string `json:"compose_projects,omitempty"` // Per-service compose project names
YoloMode bool `json:"yolo_mode,omitempty"` // YOLO mode: Claude works autonomously when solution is clear
}
Worktree represents a single worktree instance
func (*Worktree) GetComposeProject ¶
GetComposeProject returns the compose project name for a specific service Falls back to the legacy ComposeProject field if per-service names are not set