preflight

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnthropicTokenCheck

type AnthropicTokenCheck struct{}

AnthropicTokenCheck checks if Anthropic API key is available

func (*AnthropicTokenCheck) Name

func (c *AnthropicTokenCheck) Name() string

func (*AnthropicTokenCheck) Run

type Check

type Check interface {
	// Name returns the check name
	Name() string
	// Run executes the check and returns a CheckResult
	Run(ctx context.Context) CheckResult
}

Check represents a single preflight check

type CheckLevel

type CheckLevel int

CheckLevel represents the severity level of a preflight check

const (
	// LevelError indicates a critical failure that prevents execution
	LevelError CheckLevel = iota
	// LevelWarn indicates a warning that should be addressed but doesn't block execution
	LevelWarn
	// LevelInfo indicates informational output
	LevelInfo
)

type CheckResult

type CheckResult struct {
	Name    string     // Check name
	Level   CheckLevel // Severity level
	Message string     // Human-readable message
	Error   error      // Underlying error (if any)
}

CheckResult represents the result of a single preflight check

type Checker

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

Checker runs a collection of preflight checks

func NewChecker

func NewChecker(cfg Config) *Checker

NewChecker creates a new preflight checker with the given configuration

func (*Checker) Run

func (c *Checker) Run(ctx context.Context) error

Run executes all registered checks and returns an error if any critical checks fail

type Config

type Config struct {
	// Skip skips all preflight checks
	Skip bool
	// Quiet suppresses info-level messages
	Quiet bool
	// RequireDocker checks if docker is available (default: true)
	RequireDocker bool
	// RequireGit checks if git is available (default: true)
	RequireGit bool
	// RequireGitHubToken checks if GitHub token is available (default: false)
	RequireGitHubToken bool
	// RequireAnthropicToken checks if Anthropic token is available (default: false)
	RequireAnthropicToken bool
	// WorkspacePath is the workspace path for permission checks
	WorkspacePath string
	// OutputPath is the output path for permission checks
	OutputPath string
}

Config configures the preflight checker

type DiskSpaceCheck

type DiskSpaceCheck struct {
	Path     string
	MinBytes int64 // Minimum required bytes (for future use; currently writes a 10MB test file)
}

DiskSpaceCheck checks if there's sufficient disk space Note: MinBytes is for future use; the check uses a fixed 10MB test file for practical verification

func (*DiskSpaceCheck) Name

func (c *DiskSpaceCheck) Name() string

func (*DiskSpaceCheck) Run

type DockerCheck

type DockerCheck struct{}

DockerCheck checks if docker is installed and the daemon is reachable

func (*DockerCheck) Name

func (c *DockerCheck) Name() string

func (*DockerCheck) Run

func (c *DockerCheck) Run(ctx context.Context) CheckResult

type GitCheck

type GitCheck struct{}

GitCheck checks if git is installed

func (*GitCheck) Name

func (c *GitCheck) Name() string

func (*GitCheck) Run

func (c *GitCheck) Run(ctx context.Context) CheckResult

type GitHubTokenCheck

type GitHubTokenCheck struct{}

GitHubTokenCheck checks if GitHub token is available

func (*GitHubTokenCheck) Name

func (c *GitHubTokenCheck) Name() string

func (*GitHubTokenCheck) Run

type NetworkCheck

type NetworkCheck struct {
	URL string // URL to check (default: https://google.com)
}

NetworkCheck performs a basic network connectivity check This is best-effort and may not catch all network issues

func (*NetworkCheck) Name

func (c *NetworkCheck) Name() string

func (*NetworkCheck) Run

type OutputCheck

type OutputCheck struct {
	Path string
}

OutputCheck checks if output path is writable

func (*OutputCheck) Name

func (c *OutputCheck) Name() string

func (*OutputCheck) Run

func (c *OutputCheck) Run(ctx context.Context) CheckResult

type WorkspaceCheck

type WorkspaceCheck struct {
	Path string
}

WorkspaceCheck checks if workspace path is accessible

func (*WorkspaceCheck) Name

func (c *WorkspaceCheck) Name() string

func (*WorkspaceCheck) Run

Jump to

Keyboard shortcuts

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