Documentation
¶
Overview ¶
Package containeropencodebx implements the "opencode-sbx" subcommand, which generates a Docker Sandbox kit for opencode (spec.yaml + embedded global skills/agents/commands/plugins), validates it, packs it into a zip, and optionally creates the sandbox instance. Unlike the crush sbx kit, all tools are pre-baked into the base image; the kit is configuration-only and the opencode config is delivered via the OPENCODE_CONFIG_CONTENT env var.
Index ¶
- Constants
- func Action(ctx context.Context, cmd *cli.Command) error
- func Command() *cli.Command
- func Execute(input Input) IOE.IOEither[error, KitResult]
- func GenerateSpec(input Input) IOE.IOEither[error, genState]
- func ValidateInput(input Input) E.Either[error, Input]
- type Input
- type KitResult
- type ProviderConfig
Constants ¶
const ( // DefaultOutputPath is the default path for the packed kit zip file. DefaultOutputPath = "opencode-sbx-kit.zip" // DefaultAgentImage is the default base image for the opencode sbx agent. // It extends docker/sandbox-templates:opencode with pre-baked Go tooling. DefaultAgentImage = "ghcr.io/dictybase/crusher:opencode-sbx-base" // DefaultGolangciLintVersion is the default golangci-lint version. // It is the only version flag retained because it is the sole value that // surfaces in the generated spec.yaml agentContext text. The gotestsum, // moxide, sem, and rtk version flags were removed because the packed kit // does not vary with them — the sandbox image ships fixed versions. DefaultGolangciLintVersion = "2.11.4" // DefaultProvider is the default AI provider. DefaultProvider = providerOpenRouter )
Variables ¶
This section is empty.
Functions ¶
func Action ¶
Action is the opencode-sbx subcommand entry point. Pipeline: normalize input → validate input → execute kit pipeline → fold into Pair. Printing is outside the pipeline.
func Execute ¶
Execute runs the full pipeline: generate → validate → pack → optionally store secret + create.
func GenerateSpec ¶
GenerateSpec renders the spec template from input. The ProviderConfig was already resolved during ValidateInput and is carried on input.ResolvedProvider, so the template data can be assembled inline.
Types ¶
type Input ¶
type Input struct {
OutputPath string
KitName string
APIKey string
Provider string // "openrouter" | "anthropic" | "openai" | "google"
ResolvedProvider ProviderConfig // set by validateProvider
ShouldCreate bool
AgentImage string
GolangciLintVersion string
Ctx context.Context
}
Input holds the raw CLI arguments before normalization or validation. The ResolvedProvider field is populated by validateProvider so downstream pipeline steps (spec generation) never need to re-lookup the provider.
func InputFromCommand ¶
InputFromCommand reads CLI flags and constructs the opencode-sbx Input.
func NormalizeInput ¶
NormalizeInput fills default values for blank fields.
type ProviderConfig ¶
type ProviderConfig struct {
ServiceDomain string // exact hostname for network.serviceDomains
ProviderDomain string // same or broader, for network.allowedDomains
AuthHeader string // HTTP header name injected by the sbx proxy
AuthValueFormat string // format string; %s is replaced with the credential
APIKeyEnvVar string // env var name on the host and inside the sandbox
}
ProviderConfig holds all template-rendering values for one AI provider.