Skip to content

Refactor/tui redesign#1

Merged
lxwiq merged 4 commits into
mainfrom
refactor/tui-redesign
May 31, 2026
Merged

Refactor/tui redesign#1
lxwiq merged 4 commits into
mainfrom
refactor/tui-redesign

Conversation

@lxwiq

@lxwiq lxwiq commented May 31, 2026

Copy link
Copy Markdown
Owner

No description provided.

lolo 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.
Copilot AI review requested due to automatic review settings May 31, 2026 14:11
@lxwiq lxwiq merged commit b98fbe5 into main May 31, 2026
3 of 5 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants