Decouple domain and storage code from TUI presentation - #35
Merged
Merged
Conversation
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
Adds a storage/UI config split and relocates all presentation concerns (spinners, styled errors, CLI renderers) out of
internal/book,internal/catalog, andinternal/webintocmd/bookandinternal/theme. Completes Phase 0 of thepkg/bookextraction; CLI behavior is unchanged.What's new
theme.UIConfig- embeds*book.Configand carries runtime presentation state (Theme,Templates) plusLoadTheme,LoadTemplates, andStyledError;book.Configis now storage-only andinternal/bookimports stdlib + toml only.cmd/book/spinner.go-loadCatalogandloadWebsitereplacecatalog.LoadCatalogandweb.LoadWebsite;internal/catalogandinternal/webno longer import huh or the spinner.cmd/book/catalog.go-dumpDefaultsandprintConfigSourcesmove out ofinternal/catalogas thebook catalog theme|template|configimplementations, ending the storage layer's theme dependency.book.MarshalCatalog- replacesPrintCatalogwith a pure([]byte, error)marshaler; cmd call sites print via theprintCataloghelper.Behavior changes / guardrails
catalog configoutput andcatalog theme/templatedumps verified byte-identical against the previous binary.catalog.ResolveWritePathis newly exported so the relocateddumpDefaultskeeps symlink-aware writes;CreateTOMLshares the same resolution path.gc,doctor,migrate,indexCache) keep*book.Configsignatures; cmd actions and TUI constructors take*theme.UIConfigand hand the embedded config to storage calls.Testing
TestMarshalCatalogtable test covers json, toml, and empty formats;TestUIConfigStyledErrorcovers interactive and plain rendering.index rebuild,index sync,doctor, andgcagainst the previous binary.make checkruns fmt, vet, lint, and tests; all green.