opencode

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RuleCapabilities

func RuleCapabilities() *clients.RuleCapabilities

RuleCapabilities returns the rule capabilities for OpenCode. OpenCode reads project rules from `AGENTS.md` and any additional files listed in the `instructions` array of opencode.json. (OpenCode also reads `CLAUDE.md` for backwards-compat, but that file is claimed by the Claude Code rule caps to avoid duplicate detection.) sx installs rules into a `<config>/rules/` directory and registers each rule path under `instructions`.

Types

type Client

type Client struct {
	clients.BaseClient
}

Client implements clients.Client for OpenCode (https://opencode.ai).

func NewClient

func NewClient() *Client

NewClient creates a new OpenCode client.

func (*Client) EnsureAssetSupport

func (c *Client) EnsureAssetSupport(_ context.Context, _ *clients.InstallScope) error

EnsureAssetSupport is a no-op for OpenCode (skills are auto-discovered).

func (*Client) GetAssetPath

func (c *Client) GetAssetPath(_ context.Context, name string, assetType asset.Type, scope *clients.InstallScope) (string, error)

GetAssetPath returns the filesystem path of an installed asset.

func (*Client) GetBootstrapOptions

func (c *Client) GetBootstrapOptions(_ context.Context) []bootstrap.Option

GetBootstrapOptions returns optional bootstrap items. OpenCode has no documented session-start hook today, so we only expose the MCP server registration.

func (*Client) GetBootstrapPath

func (c *Client) GetBootstrapPath() string

GetBootstrapPath returns the global opencode.json path for display.

func (*Client) GetVersion

func (c *Client) GetVersion() string

GetVersion returns the opencode CLI version, or empty if unavailable.

func (*Client) InstallAssets

func (c *Client) InstallAssets(ctx context.Context, req clients.InstallRequest) (clients.InstallResponse, error)

InstallAssets installs assets into OpenCode using per-type handlers.

func (*Client) InstallBootstrap

func (c *Client) InstallBootstrap(_ context.Context, opts []bootstrap.Option) error

InstallBootstrap installs MCP servers declared in the supplied options.

func (*Client) IsInstalled

func (c *Client) IsInstalled() bool

IsInstalled checks for ~/.config/opencode/ or the opencode CLI. The config-dir check is preferred because `opencode` is a generic binary name; the config dir is a stronger signal of an actual install.

func (*Client) ListAssets

func (c *Client) ListAssets(ctx context.Context, scope *clients.InstallScope) ([]clients.InstalledSkill, error)

ListAssets returns installed skills for the given scope.

func (*Client) ReadSkill

func (c *Client) ReadSkill(ctx context.Context, name string, scope *clients.InstallScope) (*clients.SkillContent, error)

ReadSkill reads the prompt content of an installed skill.

func (*Client) RuleCapabilities

func (c *Client) RuleCapabilities() *clients.RuleCapabilities

RuleCapabilities exposes OpenCode's rule storage convention so sx can detect, parse, and generate rule files alongside the rest of its per-client rule pipeline.

func (*Client) ScanInstalledAssets

func (c *Client) ScanInstalledAssets(_ context.Context, _ *clients.InstallScope) ([]clients.InstalledAsset, error)

ScanInstalledAssets is not yet implemented for OpenCode.

func (*Client) ShouldInstall

func (c *Client) ShouldInstall(_ context.Context) (bool, error)

ShouldInstall always returns true (OpenCode has no hook-mode dedup needed yet).

func (*Client) UninstallAssets

func (c *Client) UninstallAssets(ctx context.Context, req clients.UninstallRequest) (clients.UninstallResponse, error)

UninstallAssets removes assets from OpenCode.

func (*Client) UninstallBootstrap

func (c *Client) UninstallBootstrap(_ context.Context, opts []bootstrap.Option) error

UninstallBootstrap removes any MCP servers installed by InstallBootstrap.

func (*Client) VerifyAssets

func (c *Client) VerifyAssets(_ context.Context, assets []*lockfile.Asset, scope *clients.InstallScope) []clients.VerifyResult

VerifyAssets checks each asset's on-disk presence.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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