Jeremie Fraeys
|
fb2bbbaae5
|
refactor: Phase 7 - TUI cleanup - reorganize model package
Phase 7 of the monorepo maintainability plan:
New files created:
- model/jobs.go - Job type, JobStatus constants, list.Item interface
- model/messages.go - tea.Msg types (JobsLoadedMsg, StatusMsg, TickMsg, etc.)
- model/styles.go - NewJobListDelegate(), JobListTitleStyle(), SpinnerStyle()
- model/keys.go - KeyMap struct, DefaultKeys() function
Modified files:
- model/state.go - reduced from 226 to ~130 lines
- Removed: Job, JobStatus, KeyMap, Keys, inline styles
- Kept: State struct, domain re-exports, ViewMode, DatasetInfo, InitialState()
- controller/commands.go - use model. prefix for message types
- controller/controller.go - use model. prefix for message types
- controller/settings.go - use model.SettingsContentMsg
Deleted files:
- controller/keys.go (moved to model/keys.go since State references KeyMap)
Result:
- No file >150 lines in model/ package
- Single concern per file: state, jobs, messages, styles, keys
- All 41 test packages pass
|
2026-02-17 20:22:04 -05:00 |
|
Jeremie Fraeys
|
c46be7f815
|
refactor: Phase 4 deferred - Extract GPU utilities and execution helpers
Extracted from execution.go to focused packages:
1. internal/worker/gpu.go (60 lines)
- gpuVisibleDevicesString() - GPU device string formatting
- filterExistingDevicePaths() - Device path filtering
- gpuVisibleEnvVarName() - GPU env var selection
- Reuses GPUType constants from gpu_detector.go
2. internal/worker/execution/setup.go (108 lines)
- SetupJobDirectories() - Job directory creation
- CopyDir() - Directory tree copying
- copyFile() - Single file copy helper
3. internal/worker/execution/snapshot.go (52 lines)
- StageSnapshot() - Snapshot staging for jobs
- StageSnapshotFromPath() - Snapshot staging from path
Updated execution.go:
- Removed 64 lines of GPU utilities (now in gpu.go)
- Reduced from 1,082 to ~1,018 lines
- Still contains main execution flow (runJob, executeJob, etc.)
Build status: Compiles successfully
|
2026-02-17 14:03:11 -05:00 |
|