Documentation
¶
Index ¶
- func AgentImageDockerfilePath() (string, error)
- func AgentImageHash() (string, error)
- func BuiltinImageNames() []string
- func BuiltinTemplateNames() []string
- func ComposeBaseArgs(name string) ([]string, string, error)
- func ComposePath(name string) (string, error)
- func ContainerDir(name string) (string, error)
- func ContainersRoot() (string, error)
- func CreateWorkspace(name string, opts CreateOptions) (string, error)
- func DockerPS(ctx context.Context, runner Runner, stderr io.Writer) ([]byte, error)
- func EnvPath(name string) (string, error)
- func Exec(ctx context.Context, runner Runner, name string, cmdArgs []string, ...) error
- func ImageDir(name string) (string, error)
- func ImagesRoot() (string, error)
- func IsBuiltinTemplate(name string) bool
- func PrintList(entries []ListEntry, w io.Writer) error
- func ProjectName(name string) string
- func ReadEnvFile(path string) (map[string]string, error)
- func Rebuild(ctx context.Context, runner Runner, name string, stdout, stderr io.Writer) error
- func Remove(ctx context.Context, runner Runner, name string, stdout, stderr io.Writer) error
- func RenderTemplateContent(data []byte, values PlaceholderValues) ([]byte, error)
- func ResolveTemplateValues(desc *TemplateDescriptor, provided map[string]string, noInput bool, ...) (map[string]string, error)
- func Restart(ctx context.Context, runner Runner, name string, stdout, stderr io.Writer) error
- func SafeName(name string) string
- func Shell(ctx context.Context, runner Runner, name string, stdin io.Reader, ...) error
- func ShellWithOptions(ctx context.Context, runner Runner, name string, opts ShellOptions, ...) error
- func Start(ctx context.Context, runner Runner, name string, stdout, stderr io.Writer) error
- func Stop(ctx context.Context, runner Runner, name string, stdout, stderr io.Writer) error
- func ValidateName(name string) error
- type ComposeInfo
- type CopyFile
- type CreateOptions
- type ExecRecipe
- type Hints
- type ImageSyncResult
- type ListEntry
- type OSRunner
- type PlaceholderValues
- type RunOptions
- type Runner
- type ServiceInfo
- type ShellOptions
- type Template
- type TemplateCondition
- type TemplateDescriptor
- type TemplateFile
- type TemplatePrompt
- type WebConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentImageDockerfilePath ¶
AgentImageDockerfilePath returns the stable managed legacy Arch Dockerfile path for the built-in agent runtime image.
func AgentImageHash ¶
AgentImageHash returns a deterministic short hex fingerprint of the embedded agent image build context. The hash changes whenever any embedded file under images/agent is added, removed, renamed, or modified. It is suffixed onto the agent image tag so changes to embedded content force a fresh image instead of silently reusing a cached tag.
func BuiltinImageNames ¶
func BuiltinImageNames() []string
BuiltinImageNames returns supported managed image asset names.
func BuiltinTemplateNames ¶
func BuiltinTemplateNames() []string
BuiltinTemplateNames returns the built-in contain template names.
func ComposePath ¶
ComposePath returns the canonical compose.yaml path for a named contain workspace.
func ContainerDir ¶
ContainerDir returns the configuration directory for a named contain workspace.
func ContainersRoot ¶
ContainersRoot returns the global directory containing named contain workspaces.
func CreateWorkspace ¶
func CreateWorkspace(name string, opts CreateOptions) (string, error)
CreateWorkspace renders the selected template into the named global contain workspace directory. Existing targets are never overwritten.
func EnvPath ¶ added in v0.0.296
EnvPath returns the .env path for a named contain workspace. The file is written with 0600 permissions and holds the workspace's web UI settings (WEB_PORT, WEB_TOKEN, WEB_BASE_PATH) among other secrets.
func ImagesRoot ¶
ImagesRoot returns the directory containing managed contain image assets.
func IsBuiltinTemplate ¶
IsBuiltinTemplate reports whether name is a built-in contain template.
func ProjectName ¶
ProjectName returns the deterministic Docker Compose project name for a contain workspace.
func ReadEnvFile ¶ added in v0.0.296
ReadEnvFile parses a KEY=VALUE .env file into a map. Blank lines and lines beginning with '#' are ignored, surrounding whitespace is trimmed, and one layer of surrounding single or double quotes is stripped from values. Lines without an '=' are skipped.
func Rebuild ¶
Rebuild rebuilds workspace images without cache, pulls newer base images where Compose can, and recreates containers while preserving volumes/networks.
func Remove ¶
Remove permanently deletes a contain workspace: Compose resources are brought down with volumes removed, then the workspace definition directory is deleted.
func RenderTemplateContent ¶
func RenderTemplateContent(data []byte, values PlaceholderValues) ([]byte, error)
RenderTemplateContent applies simple placeholder substitution to data.
func ResolveTemplateValues ¶
func SafeName ¶
SafeName returns the deterministic name fragment used for Docker Compose project names and Docker resource names. It is tolerant so callers can use it in error paths, but valid workspace names should be checked with ValidateName.
func ShellWithOptions ¶ added in v0.0.193
func ValidateName ¶
ValidateName validates a contain workspace name. Names are intentionally limited to simple path-safe characters because they are used as directory names below the global containers root.
Types ¶
type ComposeInfo ¶
type ComposeInfo struct {
Path string
Services map[string]ServiceInfo
Hints Hints
Invalid bool
InvalidReason string
}
func ReadComposeInfo ¶
func ReadComposeInfo(path string) (ComposeInfo, error)
ReadComposeInfo lightly parses the Compose file for term-llm hints, service names, and labels. It intentionally does not fully validate Compose.
func (ComposeInfo) DefaultService ¶
func (i ComposeInfo) DefaultService() string
func (ComposeInfo) DefaultUser ¶ added in v0.0.193
func (i ComposeInfo) DefaultUser(service string) string
func (ComposeInfo) Shell ¶
func (i ComposeInfo) Shell() string
type CreateOptions ¶
type ExecRecipe ¶ added in v0.0.195
type ImageSyncResult ¶
type ListEntry ¶
func Definitions ¶
Definitions scans global contain workspace definitions without consulting Docker.
type PlaceholderValues ¶
func NewPlaceholderValues ¶
func NewPlaceholderValues(name, cwd, configDir, containersDir, composePath string) PlaceholderValues
NewPlaceholderValues builds the supported replacement values for contain templates.
type RunOptions ¶
type ServiceInfo ¶
type ShellOptions ¶ added in v0.0.193
type ShellOptions struct {
User string
}
type Template ¶
type Template struct {
Name string
Source string
Builtin bool
Descriptor *TemplateDescriptor
Files []TemplateFile
}
func LoadTemplate ¶
LoadTemplate resolves a built-in, single-file, or directory template.
type TemplateCondition ¶
type TemplateDescriptor ¶
type TemplateDescriptor struct {
Version int `yaml:"version"`
Name string `yaml:"name"`
Description string `yaml:"description"`
Prompts []TemplatePrompt `yaml:"prompts"`
}
type TemplatePrompt ¶
type WebConfig ¶ added in v0.0.296
type WebConfig struct {
// Port is the host port the workspace's web UI is published on.
Port string
// Token is the bearer token guarding the web UI. Empty when not yet
// provisioned (e.g. a freshly templated workspace).
Token string
// BasePath is the URL prefix the web UI is mounted under (always rooted
// with a leading slash, no trailing slash).
BasePath string
}
WebConfig captures the web UI connection settings for a contain workspace, resolved from its .env file. It is the discovery surface tooling (such as the hub) needs to reach a workspace's serve without parsing the 0600 .env ad hoc.
func ReadWebConfig ¶ added in v0.0.296
ReadWebConfig reads the workspace .env and returns the resolved web UI settings. Port and BasePath fall back to their template defaults when unset or still holding an unrendered placeholder; Token has no default and is returned empty when not yet provisioned. The error reports a missing or unreadable workspace .env.