Skip to content

Core Infra API

Infrastructure interfaces and implementations.

type Executor interface {
Run(cmd string, args ...string) error
RunWithOutput(cmd string, args ...string) (string, error)
RunInDir(dir, cmd string, args ...string) error
RunAsync(cmd string, args ...string) (chan error, error)
}

Abstracts command execution.

  • ShellExecutor: Real shell execution
  • MockExecutor: For testing
type FileSystem interface {
ReadFile(path string) ([]byte, error)
WriteFile(path string, data []byte) error
Exists(path string) bool
MkdirAll(path string) error
RemoveAll(path string) error
// ... more methods
}

Abstracts file operations.

  • OSFileSystem: Real OS operations
  • MockFileSystem: In-memory for tests
type Resolver struct{}
func NewResolver() *Resolver
func (r *Resolver) IsInstalled(formula string) bool
func (r *Resolver) Install(formula string) error

Manages Homebrew dependencies.

Infra provides pluggable implementations, allowing domain logic to be tested with mocks.