Documentation
¶
Overview ¶
Package cli owns Starport command contracts and process-independent execution.
Index ¶
- Constants
- Variables
- func ExitCode(err error) int
- func New(deps Dependencies) (*urfavecli.Command, error)
- func Run(ctx context.Context, args []string, deps Dependencies) error
- func WriteVersion(w io.Writer, info BuildInfo, asJSON bool) error
- type BuildInfo
- type ConfigLoader
- type Dependencies
- type DevelopmentSession
- type DevelopmentStarter
- type Diagnoser
- type InitOptions
- type InitResult
- type Initializer
- type PathResolver
- type ServerRunner
Constants ¶
const ( // ExitCodeRuntime reports an application or dependency failure. ExitCodeRuntime = 1 // ExitCodeUsage reports invalid command syntax or arguments. ExitCodeUsage = 2 )
Variables ¶
var ( // ErrStdinRequired reports a missing command input stream. ErrStdinRequired = errors.New("command input is required") // ErrStdoutRequired reports a missing command output stream. ErrStdoutRequired = errors.New("command output is required") // ErrStderrRequired reports a missing command error stream. ErrStderrRequired = errors.New("command error output is required") // ErrServerRunnerRequired reports a missing server runtime boundary. ErrServerRunnerRequired = errors.New("server runner is required") // ErrInitializerRequired reports a missing setup runtime boundary. ErrInitializerRequired = errors.New("initializer is required") // ErrConfigLoaderRequired reports a missing configuration reader. ErrConfigLoaderRequired = errors.New("configuration loader is required") // ErrPathResolverRequired reports a missing platform-path reader. ErrPathResolverRequired = errors.New("configuration path resolver is required") // ErrDiagnoserRequired reports a missing diagnostic runtime boundary. ErrDiagnoserRequired = errors.New("diagnoser is required") )
var ( // ErrDevelopmentStarterRequired reports a missing development boundary. ErrDevelopmentStarterRequired = errors.New("development starter is required") // ErrDevelopmentSessionInvalid reports an incomplete development session. ErrDevelopmentSessionInvalid = errors.New("development session is invalid") )
var ErrDiagnosisFailed = errors.New("diagnosis failed")
ErrDiagnosisFailed reports one or more failed diagnostic checks.
Functions ¶
func New ¶
func New(deps Dependencies) (*urfavecli.Command, error)
New creates the Starport root command.
Types ¶
type BuildInfo ¶
type BuildInfo struct {
Version string `json:"version"`
BuildTime string `json:"build_time"`
GitCommit string `json:"git_commit"`
GitBranch string `json:"git_branch"`
GoVersion string `json:"go_version"`
OS string `json:"os"`
Arch string `json:"arch"`
}
BuildInfo contains immutable binary build information.
type ConfigLoader ¶
ConfigLoader reads and validates effective configuration.
type Dependencies ¶
type Dependencies struct {
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
Build BuildInfo
RunServer ServerRunner
StartDevelopment DevelopmentStarter
Initialize Initializer
LoadConfig ConfigLoader
ResolvePaths PathResolver
Diagnose Diagnoser
}
Dependencies contains all runtime boundaries used by commands.
type DevelopmentSession ¶ added in v1.0.3
type DevelopmentSession struct {
URL string
APIKey string
Run func(context.Context) error
Close func(context.Context) error
}
DevelopmentSession contains one ephemeral gateway and its one-time key.
type DevelopmentStarter ¶ added in v1.0.3
type DevelopmentStarter func(context.Context) (DevelopmentSession, error)
DevelopmentStarter creates one isolated local gateway session.
type InitOptions ¶
InitOptions contains explicit local initialization choices.
type InitResult ¶
type InitResult struct {
IdentityName string `json:"identity_name"`
ConfigFile string `json:"config_file,omitempty"`
DataDir string `json:"data_dir,omitempty"`
APIKey string `json:"api_key"`
Rollback func(context.Context) error `json:"-"`
}
InitResult contains initialized paths and the one-time gateway credential.
type Initializer ¶
type Initializer func(context.Context, InitOptions) (InitResult, error)
Initializer creates local state and returns the new gateway credential once.
type PathResolver ¶
PathResolver resolves platform configuration and data paths.
type ServerRunner ¶
ServerRunner starts the gateway and blocks until it stops.