opencode

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package opencode provides OpenCode specific configuration and path handling.

Index

Constants

View Source
const (
	// TypeLocal indicates a local process server (maps to canonical "stdio").
	TypeLocal = "local"

	// TypeRemote indicates a remote HTTP/SSE server (maps to canonical "sse").
	TypeRemote = "remote"
)

Type constants for OpenCode MCP server types.

View Source
const (
	VarArguments = "$ARGUMENTS"
	VarSelection = "$SELECTION"
)

Variables supported by OpenCode.

Variables

View Source
var (
	ErrAgentNotFound      = errors.New("agent not found")
	ErrInvalidAgent       = errors.New("invalid agent: name required")
	ErrAgentDirUnresolved = errors.New("cannot determine agent directory")
)

Sentinel errors for agent operations.

View Source
var (
	// ErrCommandNotFound indicates the requested command does not exist.
	ErrCommandNotFound = errors.New("command not found")

	// ErrInvalidCommand indicates the command is missing required fields.
	ErrInvalidCommand = errors.New("invalid command: name required")
)

Sentinel errors for command operations.

View Source
var (
	ErrMCPServerNotFound = errors.New("MCP server not found")
	ErrInvalidMCPServer  = errors.New("invalid MCP server: name required")
)

Sentinel errors for MCP operations.

View Source
var (
	ErrSkillNotFound = errors.New("skill not found")
	ErrInvalidSkill  = errors.New("invalid skill: name required")
)

Sentinel errors for skill operations.

View Source
var ErrUnsupportedVariable = errors.New("unsupported variable")

ErrUnsupportedVariable indicates content contains variables not supported by OpenCode.

Functions

func ListVariables

func ListVariables(content string) []string

ListVariables returns all variables found in the content. Returns an empty slice if no variables are found. The returned slice contains unique variables in the order they first appear.

func TranslateToCanonical

func TranslateToCanonical(content string) string

TranslateToCanonical converts OpenCode variable syntax to canonical format. Since OpenCode uses the canonical format, this is a pass-through.

func TranslateVariables

func TranslateVariables(content string) string

TranslateVariables converts canonical variable syntax to OpenCode format. Since OpenCode uses the canonical format ($ARGUMENTS, $SELECTION), this is essentially a pass-through that preserves the content unchanged.

func ValidateVariables

func ValidateVariables(content string) error

ValidateVariables checks if content contains only supported variables. Returns nil if valid, or an error listing unsupported variables.

Types

type Agent

type Agent struct {
	// Name is the agent's identifier.
	Name string `yaml:"name" json:"name"`

	// Description explains the agent's purpose and capabilities.
	Description string `yaml:"description,omitempty" json:"description,omitempty"`

	// Mode specifies the agent's operational mode (e.g., "chat", "edit", "review").
	// This is an OpenCode-specific field for agent behavior customization.
	Mode string `yaml:"mode,omitempty" json:"mode,omitempty"`

	// Temperature controls the randomness of the agent's responses.
	// Lower values (0.0-0.3) are more deterministic, higher values (0.7-1.0) are more creative.
	// This is an OpenCode-specific field for fine-tuning agent behavior.
	Temperature float64 `yaml:"temperature,omitempty" json:"temperature,omitempty"`

	// Instructions contains the agent's markdown body content.
	// This field is not part of the YAML frontmatter.
	Instructions string `yaml:"-" json:"-"`
}

Agent represents an OpenCode agent definition. Agents are markdown files that define specialized AI assistants. OpenCode extends the base agent spec with mode and temperature controls.

func (*Agent) GetDescription

func (a *Agent) GetDescription() string

GetDescription returns the agent's description.

func (*Agent) GetInstructions

func (a *Agent) GetInstructions() string

GetInstructions returns the agent's instructions.

func (*Agent) GetName

func (a *Agent) GetName() string

GetName returns the agent's name.

type AgentManager

type AgentManager struct {
	// contains filtered or unexported fields
}

AgentManager handles CRUD operations for OpenCode agents. Agents are markdown files stored in the agent directory.

func NewAgentManager

func NewAgentManager(paths *OpenCodePaths) *AgentManager

NewAgentManager creates a new AgentManager with the given path resolver.

func (*AgentManager) AgentDir

func (m *AgentManager) AgentDir() string

AgentDir returns the agent directory path. This is a convenience method that delegates to the underlying OpenCodePaths.

func (*AgentManager) AgentPath

func (m *AgentManager) AgentPath(name string) string

AgentPath returns the path to a specific agent file. This is a convenience method that delegates to the underlying OpenCodePaths.

func (*AgentManager) Exists

func (m *AgentManager) Exists(name string) bool

Exists checks if an agent with the given name exists.

func (*AgentManager) Get

func (m *AgentManager) Get(name string) (*Agent, error)

Get retrieves an agent by name. Returns ErrAgentNotFound if the agent file doesn't exist.

func (*AgentManager) Install

func (m *AgentManager) Install(a *Agent) error

Install writes an agent to the agent directory. Creates the agent directory if it doesn't exist. Overwrites any existing agent with the same name.

func (*AgentManager) List

func (m *AgentManager) List() ([]*Agent, error)

List returns all agents in the agent directory. Returns an empty slice if the directory doesn't exist.

func (*AgentManager) Names

func (m *AgentManager) Names() ([]string, error)

Names returns a list of all agent names in the agent directory. Returns an empty slice if the directory doesn't exist.

func (*AgentManager) Uninstall

func (m *AgentManager) Uninstall(name string) error

Uninstall removes an agent file. Returns nil if the agent doesn't exist (idempotent).

type Command

type Command struct {
	// Name is the command's identifier (used as /name in the interface).
	Name string `yaml:"name" json:"name"`

	// Description explains what the command does.
	Description string `yaml:"description,omitempty" json:"description,omitempty"`

	// Agent specifies which agent should handle this command.
	// When set, the command will be executed by the named agent instead of the default.
	Agent string `yaml:"agent,omitempty" json:"agent,omitempty"`

	// Model specifies which model should be used for this command.
	// Overrides the default model selection for command execution.
	Model string `yaml:"model,omitempty" json:"model,omitempty"`

	// Subtask indicates whether the command runs as a subtask.
	// When true, the command executes in a separate context from the main conversation.
	Subtask bool `yaml:"subtask,omitempty" json:"subtask,omitempty"`

	// Template defines the output template for the command.
	// Supports variable substitution for structured command output.
	Template string `yaml:"template,omitempty" json:"template,omitempty"`

	// Instructions contains the command's markdown body content.
	// This field is not part of the YAML frontmatter.
	Instructions string `yaml:"-" json:"-"`
}

Command represents an OpenCode slash command definition. Commands are markdown files that define custom slash commands.

func (*Command) GetName

func (c *Command) GetName() string

GetName returns the command's name.

func (*Command) SetInstructions

func (c *Command) SetInstructions(instructions string)

SetInstructions sets the command's instructions.

func (*Command) SetName

func (c *Command) SetName(name string)

SetName sets the command's name.

type CommandManager

type CommandManager struct {
	// contains filtered or unexported fields
}

CommandManager provides CRUD operations for OpenCode slash commands. Commands are stored as markdown files in the commands directory.

func NewCommandManager

func NewCommandManager(paths *OpenCodePaths) *CommandManager

NewCommandManager creates a new CommandManager with the given paths configuration.

func (*CommandManager) Get

func (m *CommandManager) Get(name string) (*Command, error)

Get retrieves a command by name. Returns ErrCommandNotFound if the command file doesn't exist.

func (*CommandManager) Install

func (m *CommandManager) Install(c *Command) error

Install writes a command to disk. Creates the commands directory if it doesn't exist. Overwrites any existing command with the same name.

func (*CommandManager) List

func (m *CommandManager) List() ([]*Command, error)

List returns all commands in the commands directory. Returns an empty slice if the directory doesn't exist or contains no .md files.

func (*CommandManager) Uninstall

func (m *CommandManager) Uninstall(name string) error

Uninstall removes a command from disk. This operation is idempotent; removing a non-existent command returns nil.

type CompatibilityMap

type CompatibilityMap map[string]string

CompatibilityMap maps platform names to version requirements. It supports unmarshaling from both a map (OpenCode format) and a list (Spec format).

func (*CompatibilityMap) UnmarshalYAML

func (c *CompatibilityMap) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

type MCPConfig

type MCPConfig struct {
	// MCP maps server names to their configurations.
	MCP map[string]*MCPServer `json:"mcp"`
	// contains filtered or unexported fields
}

MCPConfig represents the root structure of OpenCode's MCP configuration. In OpenCode, MCP servers are stored under the "mcp" key (not "mcpServers"). It preserves unknown fields for forward compatibility with future versions.

func (*MCPConfig) MarshalJSON

func (c *MCPConfig) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler to include unknown fields in output.

func (*MCPConfig) UnmarshalJSON

func (c *MCPConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler to capture unknown fields.

type MCPManager

type MCPManager struct {
	// contains filtered or unexported fields
}

MCPManager provides CRUD operations for MCP server configurations.

func NewMCPManager

func NewMCPManager(paths *OpenCodePaths) *MCPManager

NewMCPManager creates a new MCPManager instance.

func (*MCPManager) Add

func (m *MCPManager) Add(server *MCPServer) error

Add adds or updates an MCP server in the configuration. Returns ErrInvalidMCPServer if the server name is empty.

func (*MCPManager) Disable

func (m *MCPManager) Disable(name string) error

Disable sets Enabled=false for the specified server. Returns ErrMCPServerNotFound if the server does not exist.

func (*MCPManager) Enable

func (m *MCPManager) Enable(name string) error

Enable sets Enabled=true for the specified server. Returns ErrMCPServerNotFound if the server does not exist.

func (*MCPManager) Get

func (m *MCPManager) Get(name string) (*MCPServer, error)

Get returns a single MCP server by name. Returns ErrMCPServerNotFound if the server does not exist.

func (*MCPManager) List

func (m *MCPManager) List() ([]*MCPServer, error)

List returns all MCP servers from the configuration file. Returns an empty slice if the config file does not exist. The returned servers are sorted by name for deterministic ordering.

func (*MCPManager) Remove

func (m *MCPManager) Remove(name string) error

Remove removes an MCP server from the configuration by name. This operation is idempotent - removing a non-existent server does not error.

type MCPServer

type MCPServer struct {
	// Name is the server's identifier, derived from the map key.
	// Not serialized to JSON since OpenCode uses the map key as the name.
	Name string `json:"-"`

	// Command is the executable and its arguments as a single array.
	// Unlike Claude Code which separates command and args, OpenCode combines them.
	Command []string `json:"command,omitempty"`

	// Type specifies the server type: "local" for stdio or "remote" for HTTP/SSE.
	Type string `json:"type,omitempty"`

	// URL is the server endpoint for remote (HTTP/SSE) transport.
	URL string `json:"url,omitempty"`

	// Environment contains environment variables passed to the server process.
	// Note: OpenCode uses "environment" rather than Claude's "env".
	Environment map[string]string `json:"environment,omitempty"`

	// Headers contains HTTP headers for remote transport connections.
	Headers map[string]string `json:"headers,omitempty"`

	// Enabled indicates whether the server is active.
	// OpenCode uses positive logic (enabled=true means active).
	// Pointer type to distinguish unset from explicitly false.
	Enabled *bool `json:"enabled,omitempty"`
}

MCPServer represents an MCP (Model Context Protocol) server configuration for OpenCode. OpenCode uses a different structure than Claude Code, with command as a string array and type-based transport selection.

type MCPTranslator

type MCPTranslator struct{}

MCPTranslator converts between canonical and OpenCode MCP formats.

OpenCode uses different field names and structures:

  • "mcp" key instead of "mcpServers"
  • "command" is []string (combined cmd + args) instead of separate fields
  • "type" ("local"/"remote") instead of "transport" ("stdio"/"sse")
  • "environment" instead of "env"
  • "enabled" (positive logic) instead of "disabled" (negative logic)
  • No "platforms" field (LOSSY: this field is not preserved)

func NewMCPTranslator

func NewMCPTranslator() *MCPTranslator

NewMCPTranslator creates a new OpenCode MCP translator.

func (*MCPTranslator) FromCanonical

func (t *MCPTranslator) FromCanonical(cfg *mcp.Config) ([]byte, error)

FromCanonical converts canonical MCP configuration to OpenCode format.

Output format:

{"mcp": {"name": {...}, ...}}

Field mappings:

  • Command (string) + Args ([]string) -> Command ([]string)
  • Transport "stdio" -> Type "local"
  • Transport "sse" -> Type "remote"
  • Env -> Environment

NOTE: The Platforms field from canonical format is NOT preserved. OpenCode does not support platform restrictions, so this data is lost when converting to OpenCode format.

func (*MCPTranslator) Platform

func (t *MCPTranslator) Platform() string

Platform returns the platform identifier for this translator.

func (*MCPTranslator) ToCanonical

func (t *MCPTranslator) ToCanonical(platformData []byte) (*mcp.Config, error)

ToCanonical converts OpenCode MCP configuration to canonical format.

Input format:

{"mcp": {"name": {...}, ...}}

or just the servers map:

{"name": {...}, ...}

Field mappings:

  • Command ([]string) -> Command (string) + Args ([]string)
  • Type "local" -> Transport "stdio"
  • Type "remote" -> Transport "sse"
  • Environment -> Env

type OpenCodePaths

type OpenCodePaths struct {
	// contains filtered or unexported fields
}

OpenCodePaths provides OpenCode-specific path resolution. It wraps the generic paths package with OpenCode-specific defaults.

func NewOpenCodePaths

func NewOpenCodePaths(scope Scope, projectRoot string) *OpenCodePaths

NewOpenCodePaths creates a new OpenCodePaths instance. For ScopeProject, projectRoot must be non-empty. For ScopeUser, projectRoot is ignored.

func (*OpenCodePaths) AgentDir

func (p *OpenCodePaths) AgentDir() string

AgentDir returns the agents directory. Returns <base>/agents/

func (*OpenCodePaths) AgentPath

func (p *OpenCodePaths) AgentPath(name string) string

AgentPath returns the path to a specific agent file. Returns <agent>/<name>.md Returns empty string if name is empty.

func (*OpenCodePaths) BaseDir

func (p *OpenCodePaths) BaseDir() string

BaseDir returns the base configuration directory. For ScopeUser: ~/.config/opencode/ For ScopeProject: <projectRoot>/ (directly, not a subdirectory) Returns empty string if projectRoot is empty for ScopeProject.

func (*OpenCodePaths) CommandDir

func (p *OpenCodePaths) CommandDir() string

CommandDir returns the commands directory. Returns <base>/commands/

func (*OpenCodePaths) CommandPath

func (p *OpenCodePaths) CommandPath(name string) string

CommandPath returns the path to a specific command file. Returns <commands>/<name>.md Returns empty string if name is empty.

func (*OpenCodePaths) InstructionsPath

func (p *OpenCodePaths) InstructionsPath() string

InstructionsPath returns the path to the AGENTS.md instructions file. For ScopeUser: ~/.config/opencode/AGENTS.md For ScopeProject: <projectRoot>/AGENTS.md

func (*OpenCodePaths) MCPConfigPath

func (p *OpenCodePaths) MCPConfigPath() string

MCPConfigPath returns the path to the MCP servers configuration file. Returns <base>/opencode.json (MCP config is embedded in main config file)

func (*OpenCodePaths) SkillDir

func (p *OpenCodePaths) SkillDir() string

SkillDir returns the skills directory. Returns <base>/skills/

func (*OpenCodePaths) SkillPath

func (p *OpenCodePaths) SkillPath(name string) string

SkillPath returns the path to a specific skill's SKILL.md file. Returns <skill>/<name>/SKILL.md Returns empty string if name is empty.

type OpenCodePlatform

type OpenCodePlatform struct {
	// contains filtered or unexported fields
}

OpenCodePlatform provides the unified platform adapter for OpenCode. It aggregates all OpenCode-specific managers and provides a consistent interface for the aix CLI.

func NewOpenCodePlatform

func NewOpenCodePlatform(opts ...Option) *OpenCodePlatform

NewOpenCodePlatform creates a new OpenCodePlatform with the given options. Default configuration uses ScopeUser with no project root.

func (*OpenCodePlatform) AddMCP

func (p *OpenCodePlatform) AddMCP(s *MCPServer) error

AddMCP adds an MCP server configuration.

func (*OpenCodePlatform) AgentDir

func (p *OpenCodePlatform) AgentDir() string

AgentDir returns the agents directory for the current scope.

func (*OpenCodePlatform) BackupPaths

func (p *OpenCodePlatform) BackupPaths() []string

BackupPaths returns all config files/directories that should be backed up. For OpenCode, this includes:

  • ~/.config/opencode/opencode.json (MCP config)
  • ~/.config/opencode/ directory (skills, commands, agents)

func (*OpenCodePlatform) CommandDir

func (p *OpenCodePlatform) CommandDir() string

CommandDir returns the commands directory for the current scope.

func (*OpenCodePlatform) DisableMCP

func (p *OpenCodePlatform) DisableMCP(name string) error

DisableMCP disables an MCP server by name.

func (*OpenCodePlatform) DisplayName

func (p *OpenCodePlatform) DisplayName() string

DisplayName returns a human-readable platform name.

func (*OpenCodePlatform) EnableMCP

func (p *OpenCodePlatform) EnableMCP(name string) error

EnableMCP enables an MCP server by name.

func (*OpenCodePlatform) GetAgent

func (p *OpenCodePlatform) GetAgent(name string) (*Agent, error)

GetAgent retrieves an agent by name.

func (*OpenCodePlatform) GetCommand

func (p *OpenCodePlatform) GetCommand(name string) (*Command, error)

GetCommand retrieves a command by name.

func (*OpenCodePlatform) GetMCP

func (p *OpenCodePlatform) GetMCP(name string) (*MCPServer, error)

GetMCP retrieves an MCP server by name.

func (*OpenCodePlatform) GetSkill

func (p *OpenCodePlatform) GetSkill(name string) (*Skill, error)

GetSkill retrieves a skill by name.

func (*OpenCodePlatform) GlobalConfigDir

func (p *OpenCodePlatform) GlobalConfigDir() string

GlobalConfigDir returns the global configuration directory (~/.config/opencode/).

func (*OpenCodePlatform) InstallAgent

func (p *OpenCodePlatform) InstallAgent(a *Agent) error

InstallAgent installs an agent.

func (*OpenCodePlatform) InstallCommand

func (p *OpenCodePlatform) InstallCommand(c *Command) error

InstallCommand installs a slash command.

func (*OpenCodePlatform) InstallSkill

func (p *OpenCodePlatform) InstallSkill(s *Skill) error

InstallSkill installs a skill to the skill directory.

func (*OpenCodePlatform) InstructionsPath

func (p *OpenCodePlatform) InstructionsPath(projectRoot string) string

InstructionsPath returns the path to the instructions file. For user scope, this is ~/.config/opencode/AGENTS.md. For project scope, this is <projectRoot>/AGENTS.md.

func (*OpenCodePlatform) IsAvailable

func (p *OpenCodePlatform) IsAvailable() bool

IsAvailable checks if OpenCode is available on this system. Returns true if the ~/.config/opencode/ directory exists.

func (*OpenCodePlatform) ListAgents

func (p *OpenCodePlatform) ListAgents() ([]*Agent, error)

ListAgents returns all installed agents.

func (*OpenCodePlatform) ListCommands

func (p *OpenCodePlatform) ListCommands() ([]*Command, error)

ListCommands returns all installed commands.

func (*OpenCodePlatform) ListMCP

func (p *OpenCodePlatform) ListMCP() ([]*MCPServer, error)

ListMCP returns all configured MCP servers.

func (*OpenCodePlatform) ListSkills

func (p *OpenCodePlatform) ListSkills() ([]*Skill, error)

ListSkills returns all installed skills.

func (*OpenCodePlatform) MCPConfigPath

func (p *OpenCodePlatform) MCPConfigPath() string

MCPConfigPath returns the path to the MCP servers configuration file.

func (*OpenCodePlatform) Name

func (p *OpenCodePlatform) Name() string

Name returns the platform identifier.

func (*OpenCodePlatform) ProjectConfigDir

func (p *OpenCodePlatform) ProjectConfigDir(projectRoot string) string

ProjectConfigDir returns the project-scoped configuration directory.

func (*OpenCodePlatform) RemoveMCP

func (p *OpenCodePlatform) RemoveMCP(name string) error

RemoveMCP removes an MCP server by name.

func (*OpenCodePlatform) SkillDir

func (p *OpenCodePlatform) SkillDir() string

SkillDir returns the skills directory for the current scope.

func (*OpenCodePlatform) TranslateToCanonical

func (p *OpenCodePlatform) TranslateToCanonical(content string) string

TranslateToCanonical converts OpenCode variable syntax to canonical format. Since OpenCode uses the canonical format, this is a pass-through.

func (*OpenCodePlatform) TranslateVariables

func (p *OpenCodePlatform) TranslateVariables(content string) string

TranslateVariables converts canonical variable syntax to OpenCode format. Since OpenCode uses the canonical format, this is a pass-through.

func (*OpenCodePlatform) UninstallAgent

func (p *OpenCodePlatform) UninstallAgent(name string) error

UninstallAgent removes an agent by name.

func (*OpenCodePlatform) UninstallCommand

func (p *OpenCodePlatform) UninstallCommand(name string) error

UninstallCommand removes a command by name.

func (*OpenCodePlatform) UninstallSkill

func (p *OpenCodePlatform) UninstallSkill(name string) error

UninstallSkill removes a skill by name.

func (*OpenCodePlatform) ValidateVariables

func (p *OpenCodePlatform) ValidateVariables(content string) error

ValidateVariables checks if content contains only supported variables.

func (*OpenCodePlatform) Version

func (p *OpenCodePlatform) Version() (string, error)

Version returns the OpenCode version. Currently returns an empty string as version detection is not yet implemented.

type Option

type Option func(*OpenCodePlatform)

Option configures an OpenCodePlatform instance.

func WithProjectRoot

func WithProjectRoot(root string) Option

WithProjectRoot sets the project root directory for project-scoped paths.

func WithScope

func WithScope(scope Scope) Option

WithScope sets the scope (user or project) for path resolution.

type Scope

type Scope int

Scope defines whether paths resolve to user-level or project-level configuration.

const (
	// ScopeUser resolves paths relative to ~/.config/opencode/
	ScopeUser Scope = iota
	// ScopeProject resolves paths relative to <projectRoot>/ directly
	ScopeProject
)

type Skill

type Skill struct {
	// Name is the skill's unique identifier.
	Name string `yaml:"name" json:"name"`

	// Description explains what the skill does.
	Description string `yaml:"description" json:"description"`

	// Version is the semantic version of the skill.
	Version string `yaml:"version,omitempty" json:"version,omitempty"`

	// Author is the skill creator's name or identifier.
	Author string `yaml:"author,omitempty" json:"author,omitempty"`

	// Tools lists the tool permissions required by this skill.
	Tools []string `yaml:"tools,omitempty" json:"tools,omitempty"`

	// AllowedTools restricts which tools the skill can use.
	// This is an OpenCode-specific field for fine-grained tool control.
	AllowedTools []string `yaml:"allowed_tools,omitempty" json:"allowedTools,omitempty"`

	// Triggers are phrases that activate this skill.
	Triggers []string `yaml:"triggers,omitempty" json:"triggers,omitempty"`

	// Compatibility maps platform names to compatibility notes or version requirements.
	// This is an OpenCode-specific field for cross-platform skill management.
	Compatibility CompatibilityMap `yaml:"compatibility,omitempty" json:"compatibility,omitempty"`

	// Metadata contains arbitrary key-value pairs for extensibility.
	// This is an OpenCode-specific field for custom skill metadata.
	Metadata map[string]any `yaml:"metadata,omitempty" json:"metadata,omitempty"`

	// Instructions contains the skill's markdown body content.
	// This field is not part of the YAML frontmatter.
	Instructions string `yaml:"-" json:"-"`
}

Skill represents an OpenCode skill definition. Skills are markdown files with YAML frontmatter that define reusable capabilities. OpenCode extends the base skill spec with additional fields for tool restrictions and platform compatibility.

type SkillManager

type SkillManager struct {
	// contains filtered or unexported fields
}

SkillManager handles CRUD operations for OpenCode skills.

func NewSkillManager

func NewSkillManager(paths *OpenCodePaths) *SkillManager

NewSkillManager creates a new SkillManager with the given paths configuration.

func (*SkillManager) Get

func (m *SkillManager) Get(name string) (*Skill, error)

Get retrieves a skill by name. Returns ErrSkillNotFound if the skill doesn't exist.

func (*SkillManager) Install

func (m *SkillManager) Install(s *Skill) error

Install creates or overwrites a skill. Creates the skill directory if it doesn't exist.

func (*SkillManager) List

func (m *SkillManager) List() ([]*Skill, error)

List returns all skills in the skill directory. Returns an empty slice if the directory doesn't exist or is empty.

func (*SkillManager) Uninstall

func (m *SkillManager) Uninstall(name string) error

Uninstall removes a skill by name. This operation is idempotent - returns nil if skill doesn't exist.

Jump to

Keyboard shortcuts

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