refactor(#107): theme-state.json → state.json, theme-sync → state-sync
Some checks failed
Check / eval (push) Has been cancelled

The machine flake's git-tracked settings file is system state, not
"theme" only — rename it to state.json. CLI becomes nomarchy-state-sync
with a nomarchy-theme-sync symlink for scripts and muscle memory.

Eval (mkFlake, doctor, lifecycle) still accepts theme-state.json; the
next write migrates to state.json and removes the legacy file.
Documented in MIGRATION.md; drop the CLI alias after release notes.
This commit is contained in:
2026-07-15 11:26:59 +01:00
parent 013403deb4
commit d8e1a13d50
62 changed files with 463 additions and 369 deletions

View File

@@ -67,21 +67,33 @@ for mp in / /boot /nix; do
done
# ── the flake + state file ───────────────────────────────────────────
if [ -f "$flake/theme-state.json" ]; then
if jq empty "$flake/theme-state.json" 2>/dev/null; then
ok "theme-state.json parses"
# #107: prefer state.json; theme-state.json still counts until migrated.
state_file=
if [ -f "$flake/state.json" ]; then
state_file="$flake/state.json"
elif [ -f "$flake/theme-state.json" ]; then
state_file="$flake/theme-state.json"
fi
if [ -n "$state_file" ]; then
state_base=$(basename "$state_file")
if jq empty "$state_file" 2>/dev/null; then
ok "$state_base parses"
else
bad "theme-state.json is not valid JSON (rebuilds will fail)" \
"nomarchy-theme-sync validate (names the spot; fix it, or re-apply a theme)"
bad "$state_base is not valid JSON (rebuilds will fail)" \
"nomarchy-state-sync validate (names the spot; fix it, or re-apply a theme)"
fi
if git -C "$flake" ls-files --error-unmatch theme-state.json >/dev/null 2>&1; then
ok "theme-state.json is git-tracked"
if git -C "$flake" ls-files --error-unmatch "$state_base" >/dev/null 2>&1; then
ok "$state_base is git-tracked"
else
bad "theme-state.json is NOT git-tracked (flake evaluation can't see it)" \
"git -C $flake add theme-state.json"
bad "$state_base is NOT git-tracked (flake evaluation can't see it)" \
"git -C $flake add $state_base"
fi
if [ "$state_base" = "theme-state.json" ]; then
warn "state file still named theme-state.json — run any menu write or" \
"nomarchy-state-sync set … to migrate to state.json"
fi
else
skip "theme-state.json (no flake checkout at $flake)"
skip "state.json (no flake checkout at $flake)"
fi
if [ -d "$flake/.git" ]; then