opencode

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatMessages

func FormatMessages(messages []CommitMessage) []string

func SetFixturesDir

func SetFixturesDir(dir string)

SetFixturesDir overrides the directory from which fixtures are loaded.

Types

type AgentEnsurer

type AgentEnsurer func(agent string, install bool) error

type AppError

type AppError struct {
	Op      string
	Message string
	OC      *OCError
	Err     error
}

func (*AppError) Error

func (e *AppError) Error() string

func (*AppError) Render

func (e *AppError) Render() string

func (*AppError) Unwrap

func (e *AppError) Unwrap() error

type Client

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

func NewClient

func NewClient(baseURL, repoDir, agent string) *Client

func (*Client) CreateSession

func (c *Client) CreateSession(ctx context.Context, agentName string) (string, error)

func (*Client) DeleteSession

func (c *Client) DeleteSession(ctx context.Context, sessionID string) error

func (*Client) GenerateMessages

func (c *Client) GenerateMessages(ctx context.Context, sessionID string, params GenerateParams) ([]CommitMessage, error)

type ClientFactory

type ClientFactory func(baseURL, repoDir, agent string) *Client

type CommitMessage

type CommitMessage struct {
	Subject string `json:"subject"`
	Body    string `json:"body"`
}

type GenerateParams

type GenerateParams struct {
	SubjectMin  int
	SubjectMax  int
	Body        bool
	ContextJSON string
}

type OCError

type OCError struct {
	Kind        OCErrorKind
	RequestType string
	SessionID   string
	Agent       string
	Code        string
	Message     string
	Status      int
	RawJSON     string
}

func (*OCError) ErrorText

func (e *OCError) ErrorText() string

func (*OCError) RenderDetails

func (e *OCError) RenderDetails() string

type OCErrorKind

type OCErrorKind string
const (
	OCErrAPI                OCErrorKind = "api_error"
	OCErrHTTP               OCErrorKind = "http_error"
	OCErrNoStructuredOutput OCErrorKind = "no_structured_output"
	OCErrNoSubjects         OCErrorKind = "no_subjects"
)

type PipelineResult

type PipelineResult struct {
	SessionID string
	Messages  []CommitMessage
	Error     error
}

type PipelineRunner

type PipelineRunner struct {
	EnsureAgent  AgentEnsurer
	StartServer  ServerStarter
	StopServer   ServerStopper
	NewClient    ClientFactory
	RepoDir      string
	Agent        string
	InstallAgent bool
}

func (*PipelineRunner) Run

func (*PipelineRunner) Stop

func (r *PipelineRunner) Stop()

type ServerStarter

type ServerStarter func(ctx context.Context) (baseURL string, err error)

type ServerStopper

type ServerStopper func() error

Jump to

Keyboard shortcuts

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