Homestead is a Go CLI with a Bubble Tea TUI for Linux maintenance: run bundled bash scripts (cleanup, utilities), view native monitors (battery, memory), and manage installers/config (packages, Zsh wizard, file config). Entry point wires dependencies manually and starts the full-screen TUI.
| Layer | Technology | Notes |
|---|---|---|
| Language | Go | go 1.21 (see go.mod, CI release workflow) |
| TUI | bubbletea, lipgloss, bubbles | Primary UI stack |
| Config | gopkg.in/yaml.v3 |
File-based config |
| Scripts | Bash under scripts/ |
Invoked via BashExecutor; REAL_USER / REAL_HOME env pattern |
huh and Charm log are mentioned in older docs but are not current require entries in go.mod—verify before importing.
| Path | Role |
|---|---|
cmd/homestead/main.go |
DI wiring: repos, executor, installer, config, tui.NewModel, tea.NewProgram |
internal/tui/ |
Bubble Tea: pacote raiz (Model, wizards, views) + tui/cmds, tui/items, tui/msg, tui/theme, tui/sysurl — ver docs/architecture/TUI_LAYOUT.md |
internal/app/services/ |
Application services (ScriptService, installers, config, repo, wizard) |
internal/domain/ |
Entities (Script, packages, shell config), types (e.g. Category), interfaces |
internal/infrastructure/ |
repository/ (in-memory catalogs), executor/ (bash), installer/, config/, templates/, plugins/ |
internal/scripts/ |
Legacy script helpers (parallel to domain-driven path; prefer domain + infra for new work) |
scripts/ |
Bash assets: cleanup/, monitoring/, install/, utilities/, lib/ |
configs/ |
Templates / static config |
integration_test.go |
Top-level integration test; mirrors main wiring |
Makefile |
build, run, test, test-short, test-integration, test-coverage |
- TUI selects a script →
ScriptServiceloadsentities.ScriptfromScriptRepository. BashExecutorvalidates paths / permissions; executes bash (or builds interactiveexec.Cmdfor sudo/TTY).- Native monitors use
NativeMonitoronentities.Scriptwith TUI-side handling (no bash path):battery,memory,disk,load,network,thermal,systemd-user(seeinternal/domain/entities/script.goandinternal/monitoring/).
Categories include cleanup, monitoring, install, utilities (internal/domain/types/category.go).
- Go std layout; layered domain → services → infrastructure → tui.
- Errors:
fmt.Errorfwith%w; domain sentinel-style errors ininternal/domain/typeswhere used. - File naming:
snake_caseGo files (e.g.script_service.go); tests*_test.goalongside or in same package.
- All packages:
go test ./...ormake test - Skip slow/integration:
go test -short ./...ormake test-short - Integration:
make test-integration(go test -v -run Integration ./...) - Coverage:
make test-coverage
make run/go run ./cmd/homesteadmake build→./homesteadmake install→$GOPATH/bin/homestead
.github/workflows/release.yml: on GitHub release published, buildslinux/amd64andlinux/arm64and uploads artifacts.
- Recent commits use prefixes such as
feat(scope):,Refactor,Update(mixed English/Portuguese).
- Assume
go runcwd: bash paths in the catalog are relative to repo root; running the binary from elsewhere may break script resolution unless code resolves embed/root explicitly. - List
huh/logas installed without checkinggo.mod. - Expand scope into
linuxtoys/or.agents/unless the task explicitly includes them.