Documentation
¶
Index ¶
- Constants
- Variables
- func EnsureSettings(settings map[string]SettingsFile) map[string]SettingsFile
- func GetContent(settings map[string]SettingsFile, path string, defaultContent []byte) []byte
- func SetContent(settings map[string]SettingsFile, path string, content []byte) map[string]SettingsFile
- type Agent
- type PortProvider
- type Registry
- type SettingsFile
Constants ¶
const ( // ClaudeJSONPath is the relative path to the claude.json file. ClaudeJSONPath = ".claude.json" // ClaudeSettingsPath is the relative path to the Claude settings file. ClaudeSettingsPath = ".claude/settings.json" )
const CursorCLIConfigPath = ".cursor/cli-config.json"
CursorCLIConfigPath is the path to Cursor's CLI configuration file.
const (
// GooseConfigPath is the relative path to the Goose configuration file.
GooseConfigPath = ".config/goose/config.yaml"
)
const (
// OpenCodeConfigPath is the relative path to the OpenCode configuration file.
OpenCodeConfigPath = ".config/opencode/opencode.json"
)
const (
// OpenclawConfigPath is the relative path to the OpenClaw configuration file.
OpenclawConfigPath = ".openclaw/openclaw.json"
)
Variables ¶
var ( // ErrAgentNotFound is returned when an agent is not found in the registry. ErrAgentNotFound = errors.New("agent not found") )
Functions ¶
func EnsureSettings ¶ added in v0.12.0
func EnsureSettings(settings map[string]SettingsFile) map[string]SettingsFile
EnsureSettings returns the settings map, creating one if nil.
func GetContent ¶ added in v0.12.0
func GetContent(settings map[string]SettingsFile, path string, defaultContent []byte) []byte
GetContent returns the content bytes for a settings file path, or defaultContent if the path does not exist.
func SetContent ¶ added in v0.12.0
func SetContent(settings map[string]SettingsFile, path string, content []byte) map[string]SettingsFile
SetContent updates or creates a settings file entry, preserving the Executable flag if the entry already exists. Returns the (possibly initialized) settings map.
Types ¶
type Agent ¶
type Agent interface {
// Name returns the agent name (e.g., "claude", "goose").
Name() string
// SkipOnboarding modifies agent settings to skip onboarding prompts.
// It takes the current agent settings map (path -> SettingsFile), the workspace
// sources path inside the container, and an optional list of API key values
// to pre-approve so the agent does not prompt the user about them.
// Returns the modified settings map, or an error if modification fails.
SkipOnboarding(settings map[string]SettingsFile, workspaceSourcesPath string, approvedKeys []string) (map[string]SettingsFile, error)
// SetModel configures the model ID in the agent settings.
// It takes the current agent settings map (path -> SettingsFile) and the model ID,
// and returns the modified settings with the model configured.
// If the agent does not support model configuration, settings are returned unchanged.
// Returns the modified settings map, or an error if modification fails.
SetModel(settings map[string]SettingsFile, modelID string) (map[string]SettingsFile, error)
// SkillsDir returns the container path (using $HOME variable) under which skill
// directories should be mounted (e.g., "$HOME/.claude/skills" for Claude Code).
// Returns "" if the agent does not support skills mounting.
SkillsDir() string
// SetMCPServers configures MCP servers in the agent settings.
// It takes the current agent settings map (path -> SettingsFile) and the MCP configuration,
// and returns the modified settings with MCP servers configured.
// If the agent does not support MCP configuration, settings are returned unchanged.
// If mcp is nil, settings are returned unchanged.
// Returns the modified settings map, or an error if modification fails.
SetMCPServers(settings map[string]SettingsFile, mcp *workspace.McpConfiguration) (map[string]SettingsFile, error)
}
Agent is an interface for agent-specific configuration and setup operations.
func NewOpenCode ¶ added in v0.6.0
func NewOpenCode() Agent
NewOpenCode creates a new OpenCode agent implementation.
func NewOpenclaw ¶ added in v0.15.0
func NewOpenclaw() Agent
NewOpenclaw creates a new OpenClaw agent implementation.
type PortProvider ¶ added in v0.15.0
type PortProvider interface {
DefaultPorts() []int
}
PortProvider is an optional interface that agents can implement to declare container ports that should be automatically forwarded. Agents without port requirements do not need to implement this interface.
type Registry ¶
type Registry interface {
// Register registers an agent implementation by name.
Register(name string, agent Agent) error
// Get retrieves an agent implementation by name.
// Returns ErrAgentNotFound if the agent is not registered.
Get(name string) (Agent, error)
// List returns all registered agent names.
List() []string
}
Registry manages agent implementations.
type SettingsFile ¶ added in v0.12.0
SettingsFile represents an agent settings file with its content and metadata.