Documentation
¶
Index ¶
- Constants
- func EnsureShareDir() (string, error)
- func GetConfigVolumeMounts(projectName, agentName string) ([]mount.Mount, error)
- func GetDockerSocketMount() mount.Mount
- func GetGitConfigMount() []mount.Mount
- func GetShareVolumeMount(hostPath string) mount.Mount
- func GitConfigExists() bool
- type BindStrategy
- func (s *BindStrategy) Cleanup(ctx context.Context, cli *docker.Client) error
- func (s *BindStrategy) GetMounts() []mount.Mount
- func (s *BindStrategy) Mode() config.Mode
- func (s *BindStrategy) Name() string
- func (s *BindStrategy) Prepare(ctx context.Context, cli *docker.Client) error
- func (s *BindStrategy) ShouldPreserve() bool
- type Config
- type ConfigVolumeResult
- type GitCredentialSetupResult
- type SetupMountsConfig
- type SetupMountsResult
- type SnapshotStrategy
- func (s *SnapshotStrategy) Cleanup(ctx context.Context, cli *docker.Client) error
- func (s *SnapshotStrategy) GetMounts() []mount.Mount
- func (s *SnapshotStrategy) Mode() config.Mode
- func (s *SnapshotStrategy) Name() string
- func (s *SnapshotStrategy) Prepare(ctx context.Context, cli *docker.Client) error
- func (s *SnapshotStrategy) ShouldPreserve() bool
- func (s *SnapshotStrategy) VolumeName() string
- func (s *SnapshotStrategy) WasCreated() bool
- type Strategy
Constants ¶
const ( SharePurpose = "share" ShareStagingPath = "/home/claude/.clawker-share" )
const HostGitConfigStagingPath = "/tmp/host-gitconfig"
HostGitConfigStagingPath is where the host's gitconfig is mounted for processing by entrypoint
Variables ¶
This section is empty.
Functions ¶
func EnsureShareDir ¶
EnsureShareDir creates the global shared directory if it doesn't already exist. This directory provides a read-only bind mount across all projects and agents.
func GetConfigVolumeMounts ¶
GetConfigVolumeMounts returns mounts for persistent config volumes. These are used for both bind and snapshot modes to preserve Claude config.
func GetDockerSocketMount ¶
GetDockerSocketMount returns the Docker socket mount if enabled
func GetGitConfigMount ¶
GetGitConfigMount returns a mount configuration for the host's ~/.gitconfig file. The file is mounted read-only to a staging location where the entrypoint script can process it (filtering credential.helper lines) before copying to ~/.gitconfig.
Returns nil if ~/.gitconfig doesn't exist on the host.
func GetShareVolumeMount ¶
GetShareVolumeMount returns the mount for the global shared volume (read-only).
func GitConfigExists ¶
func GitConfigExists() bool
GitConfigExists checks if the host has a ~/.gitconfig file
Types ¶
type BindStrategy ¶
type BindStrategy struct {
// contains filtered or unexported fields
}
BindStrategy implements Strategy for direct host mount (live sync)
func NewBindStrategy ¶
func NewBindStrategy(cfg Config) *BindStrategy
NewBindStrategy creates a new bind mount strategy
func (*BindStrategy) GetMounts ¶
func (s *BindStrategy) GetMounts() []mount.Mount
GetMounts returns the Docker mount configuration
func (*BindStrategy) ShouldPreserve ¶
func (s *BindStrategy) ShouldPreserve() bool
ShouldPreserve returns true - bind mounts are the source of truth
type Config ¶
type Config struct {
// HostPath is the path on the host to mount/copy
HostPath string
// RemotePath is the path inside the container
RemotePath string
// ProjectName is used for naming volumes
ProjectName string
// AgentName is used for naming agent-specific volumes
AgentName string
// IgnorePatterns are patterns to exclude when copying (snapshot mode)
IgnorePatterns []string
}
Config holds common configuration for workspace strategies
type ConfigVolumeResult ¶
ConfigVolumeResult tracks which config volumes were newly created vs pre-existing.
func EnsureConfigVolumes ¶
func EnsureConfigVolumes(ctx context.Context, cli *docker.Client, projectName, agentName string) (ConfigVolumeResult, error)
EnsureConfigVolumes creates config and history volumes with proper labels. Should be called before container creation to ensure volumes have clawker labels. This enables proper cleanup via label-based filtering in RemoveContainerWithVolumes.
type GitCredentialSetupResult ¶
GitCredentialSetupResult holds the mounts and environment variables needed for git credential forwarding.
func SetupGitCredentials ¶
func SetupGitCredentials(cfg *config.GitCredentialsConfig, hostProxyRunning bool) GitCredentialSetupResult
SetupGitCredentials configures mounts and environment variables for git credential forwarding. It returns the mounts to add and environment variables to set based on the config and whether the host proxy is running.
SSH and GPG agent forwarding are handled by the socketbridge package (via docker exec), not by host proxy or socket mounts. Only HTTPS credentials and git config are handled here.
type SetupMountsConfig ¶
type SetupMountsConfig struct {
// ModeOverride is the CLI flag value (empty means use config default)
ModeOverride string
// Config is the loaded clawker configuration
Config *config.Project
// AgentName is the agent name for volume naming
AgentName string
// WorkDir is the host working directory for workspace mounts.
// If empty, falls back to os.Getwd() for backward compatibility.
WorkDir string
// ProjectRootDir is the main repository root when using a worktree.
// If set, the .git directory will be mounted at the same absolute path
// in the container to allow git worktree references to resolve.
ProjectRootDir string
}
SetupMountsConfig holds configuration for workspace mount setup
type SetupMountsResult ¶
type SetupMountsResult struct {
// Mounts is the list of mounts to add to the container's HostConfig.
Mounts []mount.Mount
// ConfigVolumeResult tracks which config volumes were newly created.
// Used by container init orchestration to decide whether to copy host config.
ConfigVolumeResult ConfigVolumeResult
// WorkspaceVolumeName is the name of the workspace volume created during setup.
// Non-empty only for snapshot mode. Used for cleanup on init failure.
WorkspaceVolumeName string
}
SetupMountsResult holds the results from setting up workspace mounts.
func SetupMounts ¶
func SetupMounts(ctx context.Context, client *docker.Client, cfg SetupMountsConfig) (*SetupMountsResult, error)
SetupMounts prepares workspace mounts for container creation. It handles workspace mode resolution, strategy creation/preparation, config volumes, and docker socket mounting.
Returns a result containing the mounts and config volume creation state.
type SnapshotStrategy ¶
type SnapshotStrategy struct {
// contains filtered or unexported fields
}
SnapshotStrategy implements Strategy for ephemeral volume copy (isolated)
func NewSnapshotStrategy ¶
func NewSnapshotStrategy(cfg Config) (*SnapshotStrategy, error)
NewSnapshotStrategy creates a new snapshot strategy. Returns an error if the project or agent name is invalid for Docker resource naming.
func (*SnapshotStrategy) GetMounts ¶
func (s *SnapshotStrategy) GetMounts() []mount.Mount
GetMounts returns the Docker mount configuration
func (*SnapshotStrategy) Mode ¶
func (s *SnapshotStrategy) Mode() config.Mode
Mode returns the config mode
func (*SnapshotStrategy) Name ¶
func (s *SnapshotStrategy) Name() string
Name returns the strategy name
func (*SnapshotStrategy) ShouldPreserve ¶
func (s *SnapshotStrategy) ShouldPreserve() bool
ShouldPreserve returns false - snapshot volumes are ephemeral
func (*SnapshotStrategy) VolumeName ¶
func (s *SnapshotStrategy) VolumeName() string
VolumeName returns the name of the snapshot volume
func (*SnapshotStrategy) WasCreated ¶
func (s *SnapshotStrategy) WasCreated() bool
WasCreated returns true if this prepare call created the volume
type Strategy ¶
type Strategy interface {
// Name returns the strategy name for logging/display
Name() string
// Mode returns the config mode this strategy implements
Mode() config.Mode
// Prepare sets up any required resources (volumes, etc.)
Prepare(ctx context.Context, cli *docker.Client) error
// GetMounts returns the Docker mount configuration for the workspace
GetMounts() []mount.Mount
// Cleanup removes any temporary resources
Cleanup(ctx context.Context, cli *docker.Client) error
// ShouldPreserve returns true if resources should be preserved on down
ShouldPreserve() bool
}
Strategy defines the interface for workspace mounting strategies