Documentation
¶
Overview ¶
Package labs is the registry of the labs on this machine: one entry per cluster name, pointing at the lab directory that holds its agentlab.yaml, certs/ and state/. `configure` and `up` write it; every command that runs against a lab resolves the lab through it (Resolve), so a person no longer has to `cd` into the lab first. The lab's own layout does not move: the registry only points at directories.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Dir = func() (string, error) { dir, err := os.UserConfigDir() if err != nil { return "", err } return filepath.Join(dir, project.Name), nil }
Dir is the registry's directory: agentlab's own under the user's config directory (~/.config/agentlab on Linux, ~/Library/Application Support/agentlab on macOS), the sibling of the update check's cache. A variable so tests can point it at a temporary directory.
Functions ¶
Types ¶
type Lab ¶
Lab is one registered lab: its cluster name (agentlab.yaml's clusterName, the lab's name everywhere) and its absolute directory.
func List ¶
List returns the registered labs sorted by name. Entries whose directory or agentlab.yaml is gone are dropped — neither offered nor listed — and the file is rewritten without them (best effort: a registry that cannot be written still answers).
func Resolve ¶
Resolve decides which lab directory a command runs against, in one order:
- --lab <name> (flag), refused naming the registered labs when unknown;
- an agentlab.yaml in the current directory, whatever the registry says;
- unless create: the one registered lab, or on a terminal (pick non-nil) the person's choice among several, or off one a refusal naming them and --lab.
dir is "" for the current directory — also when nothing is registered, so the caller's missing-agentlab.yaml path (the first run, or its refusal) stays what it is. create is for the commands that make a lab where they run (`configure`, `up`): in a directory without agentlab.yaml they create one there instead of reaching for another lab.
type TakenError ¶
type TakenError struct {
Name string
Dir string // the directory asking for the name
Other string // the directory the name is registered to
}
TakenError refuses a second lab of a registered name: the two would collide on the kind cluster and its ports.
func (*TakenError) Error ¶
func (e *TakenError) Error() string