container

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDomainToAllContainers

func AddDomainToAllContainers(domain string) error

AddDomainToAllContainers adds a domain to all running containers' firewall

func AddDomainToContainer

func AddDomainToContainer(containerName, domain string) error

AddDomainToContainer adds a domain to a specific container's firewall

func CheckBellStatus

func CheckBellStatus(containerName string) bool

CheckBellStatus checks if a container needs attention (bell or silence flags)

func DeleteContainer

func DeleteContainer(containerName string) error

DeleteContainer removes a container and its volumes

func FormatExpiration

func FormatExpiration(creds *Credentials) string

FormatExpiration returns human-readable expiration status

func GetAuthStatus

func GetAuthStatus(containerName string) string

GetAuthStatus retrieves the authentication status for a container

func GetBranchName

func GetBranchName(containerName string) string

GetBranchName retrieves the current git branch from a container

func GetGitStatus

func GetGitStatus(containerName string) string

GetGitStatus gets git status indicators for a container Returns a fixed-width string for proper column alignment

func GetLastActivity

func GetLastActivity(containerName string) string

GetLastActivity gets the last activity time for a container

func GetShortName

func GetShortName(containerName, prefix string) string

GetShortName removes the prefix from a container name

func IsClaudeRunning

func IsClaudeRunning(containerName string) bool

IsClaudeRunning checks if Claude process is running in a container Excludes zombie/defunct processes

func IsDockerResponsive added in v0.9.2

func IsDockerResponsive() bool

IsDockerResponsive checks if Docker daemon is responding

func IsTokenExpired

func IsTokenExpired(creds *Credentials) bool

IsTokenExpired checks if token is expired (true) or valid (false)

func RefreshTokens

func RefreshTokens(containerName string) error

RefreshTokens finds the freshest token and syncs it to a specific container

func RestartContainer

func RestartContainer(containerName string) error

RestartContainer performs a full container restart (docker stop + start)

func StopContainer

func StopContainer(containerName string) error

StopContainer stops a running container

func TimeUntilExpiration

func TimeUntilExpiration(creds *Credentials) time.Duration

TimeUntilExpiration returns duration until token expires (negative if expired)

Types

type ContainerDetails

type ContainerDetails struct {
	Name          string
	ShortName     string
	Status        string
	StatusDetails string
	Branch        string
	GitStatus     string
	AuthStatus    string
	LastActivity  string
	Uptime        string
	CPUs          string
	Memory        string
	IPAddress     string
	Ports         []string
	Volumes       []string
	Environment   []string
	RecentLogs    string
}

ContainerDetails holds comprehensive information about a container for the details view

func GetContainerDetails

func GetContainerDetails(containerName, prefix string) (*ContainerDetails, error)

GetContainerDetails fetches comprehensive information about a container

type Credentials

type Credentials struct {
	ClaudeAiOauth struct {
		AccessToken      string   `json:"accessToken"`
		RefreshToken     string   `json:"refreshToken"`
		ExpiresAt        int64    `json:"expiresAt"` // milliseconds
		Scopes           []string `json:"scopes"`
		SubscriptionType string   `json:"subscriptionType"`
	} `json:"claudeAiOauth"`
}

Credentials represents the Claude OAuth credentials structure

func ReadCredentials

func ReadCredentials(path string) (*Credentials, error)

ReadCredentials loads and parses credentials from a file path

type DisplayOptions

type DisplayOptions struct {
	ShowNumbers bool // Show selection numbers (for interactive selection)
	ShowTable   bool // Show full table format with all columns
}

DisplayOptions configures how containers are displayed

type Info

type Info struct {
	Name           string
	ShortName      string
	Status         string
	StatusDetails  string
	Branch         string
	NeedsAttention bool
	IsDormant      bool      // Claude process not running
	AuthStatus     string    // Token expiration status
	LastActivity   string    // Time since last activity
	GitStatus      string    // Git status indicators
	CreatedAt      time.Time // Container creation time
}

Info holds information about a container

func Display

func Display(containers []Info, opts DisplayOptions) []Info

Display shows containers in a consistent format Returns the sorted list for use in selection

func GetAllContainers

func GetAllContainers(prefix string) ([]Info, error)

GetAllContainers returns a list of all containers (including stopped) with the given prefix

func GetRunningContainers

func GetRunningContainers(prefix string) ([]Info, error)

GetRunningContainers returns a list of all running containers with the given prefix

func SortByPriority

func SortByPriority(containers []Info) []Info

SortByPriority sorts containers by logical priority groups, then by creation date within each group Priority order: 1. Needs Attention (running with bell/silence flag) 2. Running (normal) 3. Dormant (running but Claude not active) 4. Stopped Within each group, sorts by creation date (newest first)

type OperationType

type OperationType string

OperationType defines Docker operations that can be performed on containers

const (
	OperationStop          OperationType = "stop"
	OperationRestart       OperationType = "restart"
	OperationDelete        OperationType = "delete"
	OperationRefreshTokens OperationType = "refresh-tokens"
)

Jump to

Keyboard shortcuts

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