Description
Extract a pure data-types package (internal/model) to serve as the contract between all packages. This prevents wizard from becoming a god package and eliminates import cycle risk.
Rationale
Without this, ignition imports wizard for the config struct, install imports wizard, and tui imports wizard. Having a leaf package with zero dependencies that everyone imports cleanly breaks this coupling.
Implementation
// internal/model/model.go
package model
// InstallConfig is the accumulated wizard state passed to ignition generation.
type InstallConfig struct {
Hostname string
Disk DiskSelection
Network NetworkConfig
Users []UserConfig
Sysexts []Sysext
ConfigMode ConfigMode
ExternalURL string // only when ConfigMode == ExternalURL
}
type ConfigMode int
const (
ConfigModeGuided ConfigMode = iota
ConfigModeExternal
)
type DiskSelection struct {
ByIDPath string // /dev/disk/by-id/...
Model string
Serial string
SizeBytes uint64
Transport string // sata, nvme, usb
Removable bool
}
type NetworkMode int
const (
NetworkModeDHCP NetworkMode = iota
NetworkModeStatic
)
type NetworkConfig struct {
Mode NetworkMode
Interface string
Address string // CIDR notation
Gateway string
DNS []string
Hostname string
}
type UserConfig struct {
Username string
SSHKeys []string
PasswordHash string // optional, bcrypt/SHA-512
}
type Sysext struct {
Name string
URL string
Version string
Channel string
}
Dependency Graph
model ← (leaf, zero imports — everyone can depend on it)
runner ← probe, install
validate ← tui, ignition
probe ← wizard/tui
bakery ← wizard/tui
ignition ← install, wizard
install ← wizard
wizard ← tui, cmd/knuckle
Acceptance Criteria
Description
Extract a pure data-types package (
internal/model) to serve as the contract between all packages. This preventswizardfrom becoming a god package and eliminates import cycle risk.Rationale
Without this,
ignitionimportswizardfor the config struct,installimportswizard, andtuiimportswizard. Having a leaf package with zero dependencies that everyone imports cleanly breaks this coupling.Implementation
Dependency Graph
Acceptance Criteria
internal/model/model.goexists with all types abovemodel.InstallConfiginstead of defining their own structsgo build ./...passes