preflight

package
v0.47.8 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package preflight provides pre-flight validation for required binaries and system checks.

Index

Constants

View Source
const DefaultLookPathTimeout = 5 * time.Second

DefaultLookPathTimeout is the default timeout for exec.LookPath operations.

Variables

View Source
var ErrEmptyBinaryName = errors.New("empty binary name")

ErrEmptyBinaryName indicates an empty binary name was provided.

Functions

func CheckAll

func CheckAll() (warnings []string, errs []string)

CheckAll performs all pre-flight checks and returns warnings and errors. Errors are for missing required binaries, warnings are for missing optional binaries. Error messages include the underlying error details.

func CheckAllWithTimeout

func CheckAllWithTimeout(timeout time.Duration) (warnings []string, errs []string)

CheckAllWithTimeout performs all pre-flight checks with a custom timeout.

func IsBinaryAvailable

func IsBinaryAvailable(name string) bool

IsBinaryAvailable checks if a specific binary is available in PATH. Returns false for empty binary names.

func IsBinaryAvailableWithTimeout

func IsBinaryAvailableWithTimeout(name string, timeout time.Duration) bool

IsBinaryAvailableWithTimeout checks if a specific binary is available with a custom timeout.

Types

type BinaryCheck

type BinaryCheck struct {
	Name        string
	Required    bool   // false = warning only
	InstallHint string // e.g., "brew install sops" or "https://..."
	Error       error  // The underlying error from LookPath if lookup failed
}

BinaryCheck represents a required binary and its purpose.

func CheckBinaries

func CheckBinaries() []BinaryCheck

CheckBinaries validates all required and optional binaries are available. Returns list of missing binaries with install hints and error details.

func CheckBinariesWithTimeout

func CheckBinariesWithTimeout(timeout time.Duration) []BinaryCheck

CheckBinariesWithTimeout validates all binaries with a custom timeout.

func CheckOptionalBinaries

func CheckOptionalBinaries() []BinaryCheck

CheckOptionalBinaries validates optional binaries and returns missing ones. Returns list of missing optional binaries with error details.

func CheckOptionalBinariesWithTimeout

func CheckOptionalBinariesWithTimeout(timeout time.Duration) []BinaryCheck

CheckOptionalBinariesWithTimeout validates optional binaries with a custom timeout.

func CheckRequiredBinaries

func CheckRequiredBinaries() []BinaryCheck

CheckRequiredBinaries validates only required binaries are available. Returns list of missing required binaries with error details.

func CheckRequiredBinariesWithTimeout

func CheckRequiredBinariesWithTimeout(timeout time.Duration) []BinaryCheck

CheckRequiredBinariesWithTimeout validates required binaries with a custom timeout.

func GetAllBinaries

func GetAllBinaries() []BinaryCheck

GetAllBinaries returns all configured binaries (required and optional).

func GetOptionalBinaries

func GetOptionalBinaries() []BinaryCheck

GetOptionalBinaries returns only optional binaries.

func GetRequiredBinaries

func GetRequiredBinaries() []BinaryCheck

GetRequiredBinaries returns only required binaries.

type SSHKeyPermResult added in v0.30.3

type SSHKeyPermResult struct {
	// Path is the key file that was checked (empty if no key file was found).
	Path string
	// Mode is the actual permission bits of the key file.
	Mode os.FileMode
	// PermissionsChecked reports whether POSIX permission bits were validated.
	// Windows uses ACLs instead, which this check does not inspect.
	PermissionsChecked bool
	// Err is non-nil when the key path cannot be used safely as a key file.
	Err error
}

SSHKeyPermResult is the result of an SSH key permission check.

func CheckSSHKeyPermissions added in v0.30.3

func CheckSSHKeyPermissions() SSHKeyPermResult

CheckSSHKeyPermissions validates the explicit SSH key or the first usable conventional candidate. The key must be a non-empty regular file and, on POSIX systems, have safe permissions (0400 or 0600). An empty Path means no candidate was found; SSH auth may instead use an agent or an HTTPS URL.

Jump to

Keyboard shortcuts

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