runtime

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandApply      = "apply"
	CommandBuild      = "build"
	CommandCompletion = "completion"
	CommandConfigure  = "configure"
	CommandDB         = "db"
	CommandDelete     = "delete"
	CommandGet        = "get"
	CommandHelp       = "help"
	CommandInit       = "init"
	CommandPull       = "pull"
	CommandRun        = "run"
	CommandVersion    = "version"
	CommandWait       = "wait"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthProvider

type AuthProvider interface {
	Token(ctx context.Context) (string, error)
}

AuthProvider resolves a bearer token when one is available. A provider should return ("", nil) when auth is simply not configured or no token is stored; commands that need authenticated endpoints can rely on the server response.

type Config

type Config struct {
	Env             Env
	Auth            AuthProvider
	RegistryURL     *string
	RegistryToken   *string
	OnTokenResolved func(token string) error
}

Config contains the shared runtime dependencies used by command constructors.

func (Config) WithDefaults

func (c Config) WithDefaults() Config

type Deps

type Deps struct {
	Runtime Runtime
	Auth    AuthProvider
	Kinds   *scheme.Registry
}

Deps is passed to every new-style command constructor.

It is intentionally concrete and uniform. Local commands can ignore the fields they do not need. Registry/auth are lazy capabilities: passing this value to a command must not perform network or token work by itself.

type Env

type Env interface {
	Getenv(key string) string
}

Env abstracts environment lookup so tests and embedded CLIs can avoid process-global os.Getenv state.

type NoopAuthProvider

type NoopAuthProvider struct{}

NoopAuthProvider is the default until an embedding application supplies auth.

func (NoopAuthProvider) Token

type OSEnv

type OSEnv struct{}

OSEnv is the default Env implementation.

func (OSEnv) Getenv

func (OSEnv) Getenv(key string) string

type RegistryTarget

type RegistryTarget struct {
	BaseURL string
	Token   string
}

RegistryTarget is the resolved registry address and bearer token for a command invocation.

type Runtime

type Runtime interface {
	RegistryTarget() RegistryTarget
	RegistryClient(ctx context.Context) (*client.Client, error)
}

Runtime is the command-facing runtime contract.

func New

func New(cfg Config) Runtime

Jump to

Keyboard shortcuts

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