Repository navigation
Refactor for maintainability: split TUI and centralize health hints - #19
Merged
Merged
Conversation
- Remove dead code: metrics/types.go, unused config Theme and Prometheus fields - Unify threshold logic via health.ApplyDefaults and config.Thresholds alias - Route observe ask through health hints and load config thresholds - Split dashboard.go into dashboard, render, views, and styles files - Refactor local.Collect into focused helper functions; reuse processSummary - Avoid copying full metric history when computing dashboard hints - Discover Prometheus metrics once at startup instead of every tick - Add tests for assistant, health defaults, prometheus presets, remote, docker Co-authored-by: Paul Contreras <pol-cova@users.noreply.github.com>
pol-cova
marked this pull request as ready for review
July 19, 2026 23:15
Combine the split TUI structure and centralized health hints with main's theme support, prometheus preset querying, and sample history for ask.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Applies the maintainability recommendations from codebase review: smaller focused files, centralized threshold logic, dead code removal, and expanded test coverage.
Changes
Dead code removal
internal/metrics/types.go(Panel,TimeSerieswere never referenced)themeandprometheus_presets(presets remain inprometheus.Presets)processes,dockerinstead of non-functionaloverview)Centralized health & thresholds
config.Thresholdsas the single threshold type via alias inhealthhealth.ApplyDefaults()andhealth.HealthyMessageconstantobserve askto usehealth.HintsWithThresholdsand respectobserve.yamlthresholdsprometheus.PresetByNamefor 5xx query text in assistantTUI split (616-line monolith → 4 files)
dashboard.go(239 lines) — Bubble Tea lifecycle, collection, inputrender.go(173 lines) — bars, sparks, charts, process tablesviews.go(174 lines) — overview, chart, integration, help, detail viewsstyles.go(12 lines) — lipgloss stylesCollector refactor
local.Collect()into focused helpers (collectCPUAndMemory,collectNetworkRates, etc.)processSummaryintopProcessesPerformance / clarity
history.ReadSamples()for hints instead of copying 1800 snapshots every tickcollectEveryNTicks, renamecollectorinterface tometricsCollectorTests
assistant_test.go— health hint integration, config thresholds, prometheus presethealth/defaults_test.go— threshold defaultsprometheus/preset_test.go— preset lookupmetrics/remote/remote_test.go— snapshot decode and SSH error handlingdocker_test.gofor unit parsingCoverage: 36.6% → 39.6% overall;
assistant0% → 91%,remote0% → 60%Verification
Skipped (follow-up)
topProcesses/net.Connectionsoptimization on busy hosts — performance projectpanelsconfig values