Refactor/tui redesign#1
Merged
Merged
Conversation
added 4 commits
May 31, 2026 16:09
- CachePath() centralises the single on-disk cache location. - AvailableSources/AvailableFormats are the canonical lists shared by the config defaults and the TUI editor (bookinfo-first order; json/all dropped from the exposed presets until writers are wired up). - Validate() performs lightweight checks, now run before Save().
- build.go: BuildFetcher/BuildFetcherFromConfig/BuildPipeline/MetadataSources centralise pipeline + source + cache assembly so the TUI no longer builds http.Client/sources/cache itself. Single source-name -> implementation map. - Pipeline.ProcessBooks processes an already-scanned selection (no re-scan, Run left untouched) and streams ProgressUpdate over a channel. - Tests cover selection honouring, progress streaming, cancellation (no deadlock) and config source ordering/fallback.
Clear empties both buckets in one write transaction on the already-open handle (no second bbolt open, so it is safe while the store is held open elsewhere). Stats reports per-bucket entry counts. Covered by a test that clears a populated store and confirms it stays usable.
Navigation (WS1/WS2): - subView interface (Init/Update/View/SetSize); MainAppModel is the single lifecycle authority with one active subView (no more per-view type assertions). Terminal size is pushed down via SetSize at creation. - Sub-views never call tea.Quit: they emit backToMenuMsg/quitMsg; the root (or newStandaloneProgram for CLI sub-commands) decides. Fixes 'q'/'esc' killing the whole app and the Scan view dead-end; menu cursor is preserved. Decoupling & feedback (WS3/WS4): - Views consume the core factory and share one cache.Store handle (no double bbolt open). Search now uses the same sources as scan (BookInfo + config order). Selection is honoured via ProcessBooks with a real streamed progress bar (listenProgress pattern). Config & cache (WS5/WS6): - Config is driven by a declarative []fieldSpec on a working copy, matched by label; committed to the shared pointer and validated on save. - Cache view clears via the shared Store.Clear and shows entry counts. Cancellation & cleanup (WS0/WS7/WS8): - Long scans/processing run under a cancellable context cancelled on exit. - Dead code removed (tickMsg, RunMenu/RunPathInput, unused components/styles); truncate is rune-safe; expandHome/newProgram shared helpers. - Tests for routing, cursor preservation, size propagation, standalone translation, config field matching, truncate/formatBytes, modal clamping.
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.
No description provided.