agent

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const CursorCLIConfigPath = ".cursor/cli-config.json"

CursorCLIConfigPath is the path to Cursor's CLI configuration file.

View Source
const (
	// GooseConfigPath is the relative path to the Goose configuration file.
	GooseConfigPath = ".config/goose/config.yaml"
)
View Source
const (
	// OpenCodeConfigPath is the relative path to the OpenCode configuration file.
	OpenCodeConfigPath = ".config/opencode/opencode.json"
)

Variables

View Source
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 NewClaude

func NewClaude() Agent

NewClaude creates a new Claude agent implementation.

func NewCursor

func NewCursor() Agent

NewCursor creates a new Cursor agent implementation.

func NewGoose

func NewGoose() Agent

NewGoose creates a new Goose agent implementation.

func NewOpenCode added in v0.6.0

func NewOpenCode() Agent

NewOpenCode creates a new OpenCode agent implementation.

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.

func NewRegistry

func NewRegistry() Registry

NewRegistry creates a new agent registry.

type SettingsFile added in v0.12.0

type SettingsFile struct {
	Content    []byte
	Executable bool
}

SettingsFile represents an agent settings file with its content and metadata.

Jump to

Keyboard shortcuts

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