Documentation
¶
Index ¶
- type AgentOptions
- type CacheDir
- type Client
- func (c *Client) Close() error
- func (c *Client) ConnectNetwork(ctx context.Context, networkName, containerName string, aliases []string) error
- func (c *Client) ContainerLogs(ctx context.Context, containerID string) (string, error)
- func (c *Client) CreateNetwork(ctx context.Context, name string) (string, error)
- func (c *Client) EnsureSharedNetwork(ctx context.Context, name string) (string, error)
- func (c *Client) ImageExists(ctx context.Context, imageName string) (bool, error)
- func (c *Client) IsContainerRunning(ctx context.Context, name string) (bool, error)
- func (c *Client) ListForgeContainers(ctx context.Context) ([]ContainerInfo, error)
- func (c *Client) PullImage(ctx context.Context, imageName string) error
- func (c *Client) RemoveContainer(ctx context.Context, name string) error
- func (c *Client) RemoveNetwork(ctx context.Context, name string) error
- func (c *Client) StartAgent(ctx context.Context, opts AgentOptions) (string, error)
- func (c *Client) StartGateway(ctx context.Context, opts GatewayOptions) (string, error)
- func (c *Client) StartGitHubMCP(ctx context.Context, opts GitHubMCPOptions) (string, error)
- func (c *Client) StartSharedService(ctx context.Context, opts SharedServiceOptions) (string, error)
- func (c *Client) StopContainer(ctx context.Context, name string) error
- func (c *Client) WaitForReady(ctx context.Context, containerID string, timeout time.Duration) error
- type ContainerInfo
- type ContainerManager
- type DockerAPI
- type GatewayOptions
- type GitHubMCPOptions
- type NetworkAttachment
- type SharedServiceOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentOptions ¶
type AgentOptions struct {
Name string // container name: forge-agent-<project-id>-<session-id>
Image string // agent image
NetworkName string // Docker network to attach to
ProjectDir string // host path to project (mounted at /work)
SessionDir string // host path to session storage
ClaudeDir string // host path to ~/.claude/
ConfigDir string // host path to ~/.config/claude-forge/
HomeDir string // host home dir for CLAUDE.md paths
Env map[string]string // environment variables
Privileged bool
Interactive bool // allocate TTY and stdin (for docker attach)
Cmd []string // claude args: --dangerously-skip-permissions, --worktree, etc.
UID int // host user UID (for file ownership mapping)
GID int // host user GID (for file ownership mapping)
PluginsDir string // host path to forge plugins dir (mounted rw at ~/.claude/plugins)
CacheDirs []CacheDir // host dependency cache directories to mount (rw)
ExtraMounts []CacheDir // additional user-specified bind mounts (rw)
ResumeWorktreeName string // worktree name when resuming a worktree session
ExtraNetworks []NetworkAttachment // additional networks to connect before starting
}
AgentOptions holds configuration for starting an agent container.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides Docker operations for claude-forge.
func (*Client) ConnectNetwork ¶
func (c *Client) ConnectNetwork(ctx context.Context, networkName, containerName string, aliases []string) error
ConnectNetwork connects a container to a Docker network with optional aliases.
func (*Client) ContainerLogs ¶
ContainerLogs returns the stdout/stderr logs from a container.
func (*Client) CreateNetwork ¶
CreateNetwork creates a Docker network with the given name.
func (*Client) EnsureSharedNetwork ¶
EnsureSharedNetwork creates a shared Docker network if it doesn't already exist. Returns the network ID.
func (*Client) ImageExists ¶
ImageExists checks if a Docker image exists locally.
func (*Client) IsContainerRunning ¶
IsContainerRunning checks if a container with the given name exists and is running. Returns false (no error) if the container doesn't exist.
func (*Client) ListForgeContainers ¶
func (c *Client) ListForgeContainers(ctx context.Context) ([]ContainerInfo, error)
ListForgeContainers lists containers with names matching "forge-agent-*" or "forge-gateway-*".
func (*Client) RemoveContainer ¶
RemoveContainer removes a container by name.
func (*Client) RemoveNetwork ¶
RemoveNetwork removes a Docker network by name.
func (*Client) StartAgent ¶
StartAgent creates and starts an agent container.
func (*Client) StartGateway ¶
StartGateway creates and starts a gateway container.
func (*Client) StartGitHubMCP ¶
StartGitHubMCP creates and starts a GitHub MCP sidecar container.
func (*Client) StartSharedService ¶
StartSharedService creates and starts a shared singleton service container.
func (*Client) StopContainer ¶
StopContainer stops a container by name.
func (*Client) WaitForReady ¶
WaitForReady polls the container state until it is running or exits. After the container first appears running, it re-checks after a short stabilization delay to catch processes that crash immediately on startup. Returns an error if the container exits before the timeout.
type ContainerInfo ¶
ContainerInfo holds information about a running container.
type ContainerManager ¶
type ContainerManager interface {
CreateNetwork(ctx context.Context, name string) (string, error)
RemoveNetwork(ctx context.Context, name string) error
ConnectNetwork(ctx context.Context, networkName, containerName string, aliases []string) error
StartAgent(ctx context.Context, opts AgentOptions) (string, error)
StartGateway(ctx context.Context, opts GatewayOptions) (string, error)
StartGitHubMCP(ctx context.Context, opts GitHubMCPOptions) (string, error)
IsContainerRunning(ctx context.Context, name string) (bool, error)
WaitForReady(ctx context.Context, containerID string, timeout time.Duration) error
StopContainer(ctx context.Context, name string) error
RemoveContainer(ctx context.Context, name string) error
ListForgeContainers(ctx context.Context) ([]ContainerInfo, error)
PullImage(ctx context.Context, image string) error
ImageExists(ctx context.Context, image string) (bool, error)
ContainerLogs(ctx context.Context, containerID string) (string, error)
Close() error
}
ContainerManager abstracts container operations for the orchestrator.
type DockerAPI ¶
type DockerAPI interface {
ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.CreateResponse, error)
ContainerStart(ctx context.Context, containerID string, options container.StartOptions) error
ContainerStop(ctx context.Context, containerID string, options container.StopOptions) error
ContainerRemove(ctx context.Context, containerID string, options container.RemoveOptions) error
ContainerList(ctx context.Context, options container.ListOptions) ([]container.Summary, error)
ContainerInspect(ctx context.Context, containerID string) (container.InspectResponse, error)
ContainerLogs(ctx context.Context, containerID string, options container.LogsOptions) (io.ReadCloser, error)
NetworkCreate(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error)
NetworkRemove(ctx context.Context, networkID string) error
NetworkConnect(ctx context.Context, networkID, containerID string, config *network.EndpointSettings) error
NetworkList(ctx context.Context, options network.ListOptions) ([]network.Inspect, error)
ImagePull(ctx context.Context, refStr string, options image.PullOptions) (io.ReadCloser, error)
ImageList(ctx context.Context, options image.ListOptions) ([]image.Summary, error)
Close() error
}
DockerAPI abstracts the Docker client methods used by the forge client.
type GatewayOptions ¶
type GatewayOptions struct {
Name string // container name: forge-gateway-<project-id>-<session-id>
Image string
NetworkName string
SSHDir string // host ~/.ssh/ (ro)
GHConfigDir string // host ~/.config/gh/ (ro)
Owner string // allowed repo owner
Repo string // allowed repo name
Env map[string]string
}
GatewayOptions holds configuration for starting a gateway container.
type GitHubMCPOptions ¶
type GitHubMCPOptions struct {
Name string // container name: forge-github-mcp-<project-id>-<session-id>
Image string // github-mcp image
NetworkName string // Docker network to attach to
Owner string // allowed repo owner
Repo string // allowed repo name
Env map[string]string // environment variables (GITHUB_TOKEN)
}
GitHubMCPOptions holds configuration for starting a GitHub MCP sidecar container.
type NetworkAttachment ¶
type NetworkAttachment struct {
NetworkName string // Docker network name
Aliases []string // optional DNS aliases within the network
}
NetworkAttachment describes a network to connect to a container before starting it.
type SharedServiceOptions ¶
type SharedServiceOptions struct {
}
SharedServiceOptions holds configuration for starting a shared singleton service container.