cli

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cli discovers the opencode binary and validates its version.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("opencode binary not found")

ErrNotFound is returned when the opencode binary cannot be located.

View Source
var ErrUnsupportedVersion = errors.New("opencode binary is older than minimum supported version")

ErrUnsupportedVersion is returned when the discovered binary is older than MinimumVersion.

Functions

This section is empty.

Types

type Discoverer

type Discoverer struct {
	// Path pins a specific binary path. If set and non-empty, no $PATH
	// lookup is performed.
	Path string
	// SkipVersionCheck disables the MinimumVersion assertion.
	SkipVersionCheck bool
	// MinimumVersion is the lowest acceptable opencode version. Empty
	// disables the check.
	MinimumVersion string
	// Logger receives diagnostics. Must not be nil (caller is expected
	// to supply io.Discard-backed logger when silent).
	Logger *slog.Logger
}

Discoverer resolves the path to the opencode CLI binary.

func (*Discoverer) Discover

func (d *Discoverer) Discover(ctx context.Context) (path, version string, err error)

Discover resolves the opencode binary path and, unless SkipVersionCheck is set, validates its reported version against MinimumVersion.

Jump to

Keyboard shortcuts

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