fix(theme): let mq-theme-manager.sh run outside $HOME/macos-scripts - #173
Merged
Conversation
It read `${HOME}/macos-scripts` outright, where doctor.sh, scan.sh and — since
#172 — mq-zsh-theme-switcher.sh all read
`${MACOS_SCRIPTS_HOME:-$HOME/macos-scripts}`. This is the sibling #172 named
and deliberately left for its own change.
Measured with HOME pointed away from the checkout, only `preview` fails: it is
the one verb that reads BASE_DIR, through UI_LIB, and it dies sourcing a UI
library that is not there. list, current, apply and reset work anywhere, which
is why this stayed invisible — and on a developer machine $HOME/macos-scripts
exists, so preview works too.
THEME_FILE stays at ${HOME}/.mq-theme. The selected theme is user state, the
same class as ~/.zshrc, and belongs in $HOME wherever the checkout lives.
tests/theme-manager-path-smoke.sh runs the manager from a temporary tree
holding nothing but a symlinked ui/, requires preview to render its panel
rather than merely exit 0, and drives apply -> current -> reset. Proven able
to fail: with the hard-coded path back it stops at step 2.
Every run gets its own HOME, and the last step compares a checksum of the real
~/.mq-theme taken before the test. apply writes and reset deletes that file,
and an earlier probe in this work applied a theme to the machine running it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The sibling #172 named and deliberately left alone. One line of runtime, plus its test.
Defect
terminal/themes/mq-theme-manager.shread${HOME}/macos-scriptsoutright, wheretools/scripts/doctor.sh,tools/scripts/scan.shand — since #172 —mq-zsh-theme-switcher.shall read${MACOS_SCRIPTS_HOME:-$HOME/macos-scripts}.Measured with
HOMEpointed away from the checkout:Only
previewreadsBASE_DIR, throughUI_LIB. That is why this stayed invisible: four of the five verbs work anywhere, and on a developer machine$HOME/macos-scriptsexists so the fifth does too.Fix
THEME_FILEis untouched at${HOME}/.mq-theme. The selected theme is user state, the same class as~/.zshrc, and belongs in$HOMEwherever the checkout lives.Test
tests/theme-manager-path-smoke.sh, 5 steps:previewruns from a temp tree holding nothing but a symlinkedui/, and renders —THEME PREVIEWandTheme: green— rather than merely exiting 0list,current,apply,resetwork there too;applywrites.mq-themeinside the isolated HOME,currentreads it back,resetremoves itMACOS_SCRIPTS_HOMEunset and a HOME holding nomacos-scripts,previewstill fails — the fallback is unchanged, and the step would prove nothing if it passed~/.mq-themehas the same checksum as before the testProven able to fail: with the hard-coded path put back, the run stops at step 2 with
FAIL: preview exited 1 from a non-default checkout.Step 5 is not decoration.
applywrites andresetdeletes~/.mq-theme, and an earlier probe in this work applied a theme to the machine running it. Every run in this test gets its ownHOME.Full suite green, markdownlint clean.
🤖 Generated with Claude Code