Commit 9fe6faf
committed
refactor: Phase 2 Part 2 - Migrate bootstrap debug logic to pkg/
Architecture enforcement: Extracted ALL business logic from
cmd/debug/bootstrap.go to pkg/bootstrap/debug/ following same pattern
as iris.go migration.
Changes:
- Reduce cmd/debug/bootstrap.go from 853 lines → 50 lines (94% reduction)
- Create pkg/bootstrap/debug/ package with 6 files:
* types.go (35 lines) - CheckResult, BootstrapDebugResult, DiagnosticConfig
* diagnostics.go (52 lines) - Main RunDiagnostics() (Assess → Intervene → Evaluate)
* checks_system.go (101 lines) - System info and resources
* checks_bootstrap.go (306 lines) - Bootstrap prerequisites, state, locks, phases, attempts
* checks_infrastructure.go (216 lines) - Services, ports, network
* utils.go (188 lines) - Display, print, summary generation
Architecture Compliance:
- cmd/debug/bootstrap.go now pure orchestration (flag parsing + delegation)
- All business logic in pkg/ with proper structure
- Follows Assess → Intervene → Evaluate pattern
- All exported functions have godoc comments
- Structured logging with otelzap.Ctx(rc.Ctx)
- No file operations, loops, or complex conditionals in cmd/
Verification:
- go build ./pkg/bootstrap/debug/... passes ✓
- go vet ./pkg/bootstrap/debug/... passes ✓
- Zero functionality lost
- 14 functions successfully migrated
Impact:
- cmd/debug/bootstrap.go: 853 → 50 lines (803 lines extracted)
- Improved testability (pkg/ functions unit-testable)
- Better organization (checks grouped by responsibility)
- Maintains all bootstrap diagnostic functionality
Part of systematic cmd/ to pkg/ migration (#2 of 15 files).
Next: cmd/create/wazuh.go (854 lines)1 parent 78acf12 commit 9fe6faf
File tree
7 files changed
+905
-810
lines changed- cmd/debug
- pkg/bootstrap/debug
7 files changed
+905
-810
lines changed
0 commit comments