instance

package
v0.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package instance tracks the state of running klausctl container instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear(paths *config.Paths) error

Clear removes the instance state file.

func ContainerName

func ContainerName(name string) string

ContainerName returns the container name for a given instance name.

Types

type Instance

type Instance struct {
	// Name is the instance name (default: "default").
	Name string `json:"name"`
	// ContainerID is the container ID returned by the runtime.
	ContainerID string `json:"containerID"`
	// Runtime is the container runtime used ("docker" or "podman").
	Runtime string `json:"runtime"`
	// Personality is the OCI reference of the resolved personality (empty when none).
	Personality string `json:"personality,omitempty"`
	// Image is the container image reference.
	Image string `json:"image"`
	// Port is the host port mapped to the MCP endpoint.
	Port int `json:"port"`
	// Workspace is the host workspace directory.
	Workspace string `json:"workspace"`
	// StartedAt is when the container was started.
	StartedAt time.Time `json:"startedAt"`
}

Instance holds the state of a running klausctl container.

func Load

func Load(paths *config.Paths) (*Instance, error)

Load reads the instance state from the instance file.

func LoadAll added in v0.0.11

func LoadAll(paths *config.Paths) ([]*Instance, error)

LoadAll reads instance state files from all per-instance directories.

func (*Instance) ContainerName

func (i *Instance) ContainerName() string

ContainerName returns the container name used by the runtime.

func (*Instance) Save

func (i *Instance) Save(paths *config.Paths) error

Save writes the instance state to the instance file. The caller is responsible for setting StartedAt before calling Save.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL