Architecture
ColimaStack is a SwiftUI macOS app backed by local command-line tools and selected Colima files.
Event-driven control plane
Section titled “Event-driven control plane”ColimaStack uses a push-based event bus (RuntimeEventBus) to deliver state updates from multiple long-lived sources to a central reducer (AppState.reduce). This replaces the former fixed-interval polling loop.
Runtime event sources
Section titled “Runtime event sources”- Docker engine events (
DockerEventSource): A long-liveddocker events --format '{{json .}}'subscription over the selected profile’s Docker context. Bootstraps with a fulldocker ps/images/volume ls/network lssnapshot, then applies deltas on engine events. Reconnects with exponential backoff. - Kubernetes watch (
KubernetesWatchSource): A long-livedkubectl get pods -A -w -o jsonwatch. Bootstraps with a fullkubectl getsnapshot per resource kind (nodes, namespaces, pods, services, deployments), then re-snapshots on watch events. - Colima file watcher (
ColimaFileWatcherSource):DispatchSourcefile-system watchers on~/.colima/<profile>/colima.yaml,daemon/daemon.log, and the lima instance state. On config/state changes, triggers a single on-demandcolima status --jsonprobe. Tails the daemon log live from the last-read offset.
Streaming process runner
Section titled “Streaming process runner”StreamingProcessRunner yields stdout/stderr chunks via AsyncStream as they arrive, without waiting for process exit. This enables:
- Live command output for
colima start/stop/restart/delete/kubernetes/updatein the Activity view - Long-lived
docker stats(streaming, no--no-stream) for the Monitor view - Long-lived
kubectl get -wfor Kubernetes watches
Connection state
Section titled “Connection state”Each source tracks a ConnectionState (disconnected, connecting, connected, reconnecting, failed) that is surfaced in the menu bar and Overview screen. Reconnect uses exponential backoff with jitter, capped at 30 seconds.
Lifecycle
Section titled “Lifecycle”The RuntimeEventEngine owns the event bus lifecycle at the application scope (survives main window close). It observes AppState.selectedProfileID and starts/stops per-profile sources on change.
On-demand control plane
Section titled “On-demand control plane”The app still calls the Colima CLI directly for profile lifecycle and configuration-oriented operations:
colima list --jsonCOLIMA_PROFILE=<profile> colima status --jsonCOLIMA_PROFILE=<profile> colima start [flags]COLIMA_PROFILE=<profile> colima stopCOLIMA_PROFILE=<profile> colima restartCOLIMA_PROFILE=<profile> colima delete --forceCOLIMA_PROFILE=<profile> colima updateCOLIMA_PROFILE=<profile> colima kubernetes start|stop
See Command API for the full command list and flags.
Docker inventory
Section titled “Docker inventory”Docker resources are read through the Docker CLI. When the selected profile exposes a context, commands are prefixed with docker --context <context>.
docker ps -a --format jsondocker images --format jsondocker volume ls --format jsondocker network ls --format jsondocker stats --format json(streaming)docker system df --format jsondocker events --format json(long-lived stream)
Kubernetes inventory
Section titled “Kubernetes inventory”Kubernetes resources are read through kubectl. When the selected profile exposes a Kubernetes context, commands are prefixed with kubectl --context <context>.
kubectl get nodes -o jsonkubectl get namespaces -o jsonkubectl get pods -A -o jsonkubectl get deployments -A -o jsonkubectl get services -A -o jsonkubectl top nodeskubectl top pods -Akubectl get pods -A -w -o json(long-lived watch)
File-backed documents
Section titled “File-backed documents”ColimaStack reads selected files from $COLIMA_HOME or ~/.colima:
- profile config:
$COLIMA_HOME/<profile>/colima.yaml - template:
$COLIMA_HOME/_templates/default.yaml - SSH config:
$COLIMA_HOME/ssh_config - Lima override:
$COLIMA_HOME/_lima/_config/override.yaml - daemon log:
$COLIMA_HOME/<profile>/daemon/daemon.log
File changes are detected via DispatchSource vnode sources rather than periodic re-reads.
Tool presence
Section titled “Tool presence”Tool presence and version (colima, docker, kubectl, limactl) are probed once at startup and on a slow 60-second timer, not on every refresh. Versions are cached for the session.
See Command API for the current backend contract.