Documentation
¶
Index ¶
- Constants
- func AttachToSession(ctx context.Context, sessionID string) error
- func CheckClaudeCredentials() (bool, error)
- func CheckSSHCredentials() (bool, error)
- func CleanupAllOrphaned(ctx context.Context, opts CleanupOptions) error
- func CleanupOrphanedImages(ctx context.Context) (int, error)
- func CleanupOrphanedNetworks() (int, error)
- func CleanupOrphanedVolumes(ctx context.Context, opts CleanupOptions) (int, error)
- func CleanupSession(ctx context.Context, sessionID string, opts CleanupOptions) error
- func ClearClaudeCredentials() error
- func ClearSSHCredentials() error
- func CreateNetwork(networkName string) error
- func CreateVolume(volumeName string) error
- func EnsureDevContainerConfig(containerID string, projectName string) error
- func EnsureNetworkExists() error
- func EnsureSessionNetworkExists(sessionID string) error
- func ExecShell(ctx context.Context, sessionID string) (*exec.Cmd, error)
- func GenerateDevContainerConfig(projectName string) (string, error)
- func GetComposePath(workDir string, composePath string) string
- func GetCredentialInitScript(mountClaude bool) string
- func GetCredentialVolumeMounts(mountClaude bool) []string
- func GetProjectNameFromContainer(containerID string) string
- func GetSSHInitScript(mountSSH bool) string
- func GetSSHVolumeMounts(mountSSH bool) []string
- func GetSessionDNSName(session SessionInfo, service ServiceInfo) string
- func GetSessionNetworkName(sessionID string) string
- func GetUserVSCodeExtensions() ([]string, error)
- func ListNetworkContainers(networkName string) ([]string, error)
- func NetworkExists(networkName string) (bool, error)
- func RemoveNetwork(networkName string) error
- func RemoveSession(ctx context.Context, sessionID string) error
- func RemoveSessionForce(ctx context.Context, sessionID string) error
- func RemoveSessionNetwork(sessionID string) error
- func RemoveSessionNetworkSafe(sessionID string) error
- func RemoveVolume(volumeName string) error
- func RunContainer(opts RunOptions) (string, error)
- func SetupClaudeCredentials() error
- func SetupSSHCredentials() error
- func StartComposeServices(workDir, composePath, sessionID, projectName string, isolation string) error
- func StopComposeServices(workDir, composePath, sessionID, projectName string, isolation string) error
- func StopSession(ctx context.Context, sessionID string) error
- func TailLogs(ctx context.Context, containerID string, output chan<- string) error
- func TestSSHGitHub() (bool, string, error)
- func VolumeExists(volumeName string) (bool, error)
- type CleanupOptions
- type ComposeFile
- type ComposeService
- type ComposeServiceConfig
- type DevContainerConfig
- type DevContainerCustom
- type DevContainerVSCode
- type NginxManager
- func (nm *NginxManager) ConnectToNetwork(ctx context.Context, networkName string) error
- func (nm *NginxManager) EnsureConnectedToAllNetworks(ctx context.Context) error
- func (nm *NginxManager) GetConfigPath() string
- func (nm *NginxManager) IsHealthy(ctx context.Context) (bool, error)
- func (nm *NginxManager) Reload(ctx context.Context) error
- func (nm *NginxManager) Remove(ctx context.Context) error
- func (nm *NginxManager) Restart(ctx context.Context) error
- func (nm *NginxManager) Start(ctx context.Context) error
- func (nm *NginxManager) Stop(ctx context.Context) error
- func (nm *NginxManager) UpdateConfig(ctx context.Context, config string) error
- type RunOptions
- type ServiceInfo
- type SessionInfo
Constants ¶
const (
// ClaudeCredentialsVolume is the name of the Docker volume for Claude credentials
ClaudeCredentialsVolume = "worklet-claude-credentials"
)
const (
// SSHCredentialsVolume is the name of the Docker volume for SSH credentials
SSHCredentialsVolume = "worklet-ssh-credentials"
)
const WorkletNetworkName = "worklet-network"
Variables ¶
This section is empty.
Functions ¶
func AttachToSession ¶
AttachToSession attaches to a running session container
func CheckClaudeCredentials ¶
CheckClaudeCredentials checks if Claude credentials are configured
func CheckSSHCredentials ¶
CheckSSHCredentials checks if SSH credentials are configured
func CleanupAllOrphaned ¶
func CleanupAllOrphaned(ctx context.Context, opts CleanupOptions) error
CleanupAllOrphaned removes all orphaned Docker resources
func CleanupOrphanedImages ¶
CleanupOrphanedImages removes temporary worklet images
func CleanupOrphanedNetworks ¶
CleanupOrphanedNetworks removes all worklet networks that have no connected containers
func CleanupOrphanedVolumes ¶
func CleanupOrphanedVolumes(ctx context.Context, opts CleanupOptions) (int, error)
CleanupOrphanedVolumes removes worklet volumes not associated with running containers
func CleanupSession ¶
func CleanupSession(ctx context.Context, sessionID string, opts CleanupOptions) error
CleanupSession removes all Docker resources associated with a session
func ClearClaudeCredentials ¶
func ClearClaudeCredentials() error
ClearClaudeCredentials removes Claude credentials
func ClearSSHCredentials ¶
func ClearSSHCredentials() error
ClearSSHCredentials removes SSH credentials
func CreateNetwork ¶
CreateNetwork creates a Docker network
func CreateVolume ¶
CreateVolume creates a Docker volume if it doesn't exist
func EnsureDevContainerConfig ¶
EnsureDevContainerConfig ensures container has devcontainer.json
func EnsureNetworkExists ¶
func EnsureNetworkExists() error
EnsureNetworkExists creates the worklet Docker network if it doesn't exist Deprecated: Use EnsureSessionNetworkExists for session-specific networks
func EnsureSessionNetworkExists ¶
EnsureSessionNetworkExists creates a session-specific Docker network if it doesn't exist
func GenerateDevContainerConfig ¶
GenerateDevContainerConfig creates devcontainer.json content
func GetComposePath ¶
GetComposePath determines the path to the docker-compose file
func GetCredentialInitScript ¶
GetCredentialInitScript returns initialization commands for setting up credentials
func GetCredentialVolumeMounts ¶
GetCredentialVolumeMounts returns volume mount arguments for credential volumes
func GetProjectNameFromContainer ¶
GetProjectNameFromContainer retrieves the project name from container labels
func GetSSHInitScript ¶
GetSSHInitScript returns initialization commands for setting up SSH
func GetSSHVolumeMounts ¶
GetSSHVolumeMounts returns volume mount arguments for SSH credentials
func GetSessionDNSName ¶
func GetSessionDNSName(session SessionInfo, service ServiceInfo) string
GetSessionDNSName generates the DNS name for a session service
func GetSessionNetworkName ¶
GetSessionNetworkName returns the network name for a session
func GetUserVSCodeExtensions ¶
GetUserVSCodeExtensions returns list of user's installed VSCode extensions
func ListNetworkContainers ¶
ListNetworkContainers lists containers connected to a network
func NetworkExists ¶
NetworkExists checks if a Docker network exists
func RemoveNetwork ¶
RemoveNetwork removes a Docker network
func RemoveSession ¶
RemoveSession removes a worklet session and all associated resources
func RemoveSessionForce ¶
RemoveSessionForce removes a worklet session and ALL associated resources including pnpm volumes
func RemoveSessionNetwork ¶
RemoveSessionNetwork removes a session-specific Docker network
func RemoveSessionNetworkSafe ¶
RemoveSessionNetworkSafe removes a session-specific Docker network only if no containers are connected
func RunContainer ¶
func RunContainer(opts RunOptions) (string, error)
RunContainer runs a container in detached mode and returns the container ID
func SetupClaudeCredentials ¶
func SetupClaudeCredentials() error
SetupClaudeCredentials runs an interactive container to set up Claude credentials
func SetupSSHCredentials ¶
func SetupSSHCredentials() error
SetupSSHCredentials runs an interactive container to set up SSH credentials
func StartComposeServices ¶
func StartComposeServices(workDir, composePath, sessionID, projectName string, isolation string) error
StartComposeServices starts docker-compose services for a worklet session
func StopComposeServices ¶
func StopComposeServices(workDir, composePath, sessionID, projectName string, isolation string) error
StopComposeServices stops docker-compose services for a worklet session
func StopSession ¶
StopSession stops a worklet session container
func TestSSHGitHub ¶
TestSSHGitHub tests if SSH credentials can connect to GitHub
func VolumeExists ¶
VolumeExists checks if a Docker volume exists
Types ¶
type CleanupOptions ¶
type CleanupOptions struct {
Force bool // Force removal of shared resources like pnpm volumes
}
CleanupOptions configures cleanup behavior
type ComposeFile ¶
type ComposeFile struct {
Version string `yaml:"version"`
Services map[string]ComposeServiceConfig `yaml:"services"`
Networks map[string]interface{} `yaml:"networks,omitempty"`
}
ComposeFile represents the structure of a docker-compose.yml file
type ComposeService ¶
type ComposeService struct {
Name string
Image string
Ports []string
Networks []string
Container string // Container name when running
}
ComposeService represents a service from docker-compose.yml
func ParseComposeServices ¶
func ParseComposeServices(composePath string) ([]ComposeService, error)
ParseComposeServices parses a docker-compose.yml file and extracts service information
type ComposeServiceConfig ¶
type ComposeServiceConfig struct {
Image string `yaml:"image"`
Ports []string `yaml:"ports"`
Environment interface{} `yaml:"environment,omitempty"`
Volumes []string `yaml:"volumes,omitempty"`
Networks interface{} `yaml:"networks,omitempty"`
Labels map[string]string `yaml:"labels,omitempty"`
Other map[string]interface{} `yaml:",inline"`
}
ComposeServiceConfig represents a service configuration in docker-compose.yml
type DevContainerConfig ¶
type DevContainerConfig struct {
Name string `json:"name"`
WorkspaceFolder string `json:"workspaceFolder"`
RemoteUser string `json:"remoteUser,omitempty"`
Customizations DevContainerCustom `json:"customizations"`
}
DevContainerConfig represents the devcontainer.json structure
type DevContainerCustom ¶
type DevContainerCustom struct {
VSCode DevContainerVSCode `json:"vscode"`
}
DevContainerCustom represents VSCode customizations
type DevContainerVSCode ¶
type DevContainerVSCode struct {
Extensions []string `json:"extensions"`
Settings map[string]interface{} `json:"settings"`
}
DevContainerVSCode represents VSCode-specific settings
type NginxManager ¶
type NginxManager struct {
// contains filtered or unexported fields
}
NginxManager handles nginx proxy container operations
func NewNginxManager ¶
func NewNginxManager(configPath string) (*NginxManager, error)
NewNginxManager creates a new nginx manager
func (*NginxManager) ConnectToNetwork ¶
func (nm *NginxManager) ConnectToNetwork(ctx context.Context, networkName string) error
ConnectToNetwork connects the nginx container to a specific network
func (*NginxManager) EnsureConnectedToAllNetworks ¶
func (nm *NginxManager) EnsureConnectedToAllNetworks(ctx context.Context) error
EnsureConnectedToAllNetworks ensures nginx is connected to all worklet session networks
func (*NginxManager) GetConfigPath ¶
func (nm *NginxManager) GetConfigPath() string
GetConfigPath returns the nginx config file path
func (*NginxManager) IsHealthy ¶
func (nm *NginxManager) IsHealthy(ctx context.Context) (bool, error)
IsHealthy checks if the nginx container is running and healthy
func (*NginxManager) Reload ¶
func (nm *NginxManager) Reload(ctx context.Context) error
Reload reloads the nginx configuration
func (*NginxManager) Remove ¶
func (nm *NginxManager) Remove(ctx context.Context) error
Remove removes the nginx proxy container
func (*NginxManager) Restart ¶
func (nm *NginxManager) Restart(ctx context.Context) error
Restart restarts the nginx container with current configuration
func (*NginxManager) Start ¶
func (nm *NginxManager) Start(ctx context.Context) error
Start starts the nginx proxy container
func (*NginxManager) Stop ¶
func (nm *NginxManager) Stop(ctx context.Context) error
Stop stops the nginx proxy container
func (*NginxManager) UpdateConfig ¶
func (nm *NginxManager) UpdateConfig(ctx context.Context, config string) error
UpdateConfig writes a new nginx configuration and reloads
type RunOptions ¶
type RunOptions struct {
WorkDir string
Config *config.WorkletConfig
SessionID string
MountMode bool
ComposePath string // Resolved compose path
CmdArgs []string
}
RunOptions contains all options for running a container
type ServiceInfo ¶
ServiceInfo represents service information for daemon registration
func GetComposeServicesForDaemon ¶
func GetComposeServicesForDaemon(composePath, sessionID, projectName string) ([]ServiceInfo, error)
GetComposeServicesForDaemon extracts service information for daemon registration
type SessionInfo ¶
type SessionInfo struct {
SessionID string `json:"session_id"`
ProjectName string `json:"project_name"`
ContainerID string `json:"container_id"`
ContainerName string `json:"container_name"`
WorkDir string `json:"workdir"`
Status string `json:"status"`
Services []ServiceInfo `json:"services"`
Labels map[string]string `json:"labels"`
CreatedAt time.Time `json:"created_at"`
}
SessionInfo represents information about a worklet session container
func GetSessionInfo ¶
func GetSessionInfo(ctx context.Context, sessionID string) (*SessionInfo, error)
GetSessionInfo returns information about a specific session
func ListAllSessions ¶
func ListAllSessions(ctx context.Context) ([]SessionInfo, error)
ListAllSessions returns all worklet sessions (including stopped) discovered via Docker API
func ListSessions ¶
func ListSessions(ctx context.Context) ([]SessionInfo, error)
ListSessions returns all running worklet sessions discovered via Docker API
func ListSessionsByProject ¶
func ListSessionsByProject(ctx context.Context, projectName string) ([]SessionInfo, error)
ListSessionsByProject returns all sessions for a specific project