feat(state): opt-in auto-commit of state mutations (Phase 4)

settings.autoCommit — toggled from System › Auto-commit (self-gated on
the flake being a git repo) — makes every nomarchy-theme-sync apply/set
also git-commit theme-state.json in the downstream flake, so settings
history is `git log`. Off by default.

Design: the flag is live-read by the tool on each write (nothing in Nix
consumes it → instant toggle, no rebuild, no new option); the commit is
pathspec-limited to theme-state.json so unrelated dirty files are never
swept up; it fires when the flag is on before OR after the write, so
the disable-toggle itself lands in history; same-value writes no-op
(diff against HEAD); missing git identity falls back to
Nomarchy <nomarchy@localhost>; `bg next` is deliberately excluded.

Rider fix: `get` now prints booleans JSON-style (true, not Python's
True) — un-sticking the System menu's "Auto timezone (on/off)" label,
whose `= true` comparison could never match. All shell consumers
already normalise true|True, so no other behavior change.

Verified: V0 (py_compile, nix flake check) + V1 (HM generation builds,
generated nomarchy-menu passes bash -n, wiring present in the rendered
script) + a 7-assertion sandbox-repo round-trip covering enable/set/
same-value/disable/post-disable/apply paths and the identity fallback.
Remaining: on-machine check queued in agent/HARDWARE-QUEUE.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-07-04 09:12:29 +01:00
parent 4c2ad38656
commit bc4e8e1410
7 changed files with 121 additions and 16 deletions

View File

@@ -9,6 +9,9 @@ next, in what order*.
- Agents take the topmost actionable item (see LOOP.md). Finished items
are **deleted** here — the journal + git log are the record; durable
design notes get a ✓-entry in docs/ROADMAP.md if worth keeping.
- Item numbers are **stable IDs** — never renumbered or reused. A gap in
the sequence means shipped (or dropped) work; new items take the next
free number regardless of tier.
- Tags: `[blocked:hw]` needs real hardware (see HARDWARE-QUEUE.md) ·
`[human]` needs Bernardo · `[stuck]` two failed attempts, needs help ·
`[big]` must be split before starting.
@@ -19,19 +22,6 @@ next, in what order*.
## NOW
### 1. Opt-in auto-commit of the flake on state mutations
Phase 4 of the in-flake-state principle (phases 13: night-light,
keyboard memory, display resolution — shipped). Every menu write
(`nomarchy-theme-sync set/apply`) already does `git add -N`; add an
opt-in (a `settings.autoCommit` flag, itself menu-toggled) that commits
**owned files only** (theme-state.json) with a generated message after
each mutation. **Why:** closes the loop on "your checkout is your
machine" — settings changes become history. **Done when:** off by
default; toggleable from the System menu; commits fire on apply/set;
never commits unrelated dirty files; graceful when the repo has no user
git identity. **Verify:** V1 + a round-trip on the theme-sync CLI in a
sandbox repo; V2 if wired into a check.
### 2. CI: run the check suite on every push (Forgejo Actions)
First slice of ROADMAP § Automated upstream lock bumps, promoted to NOW
because agents now push to `main` autonomously — an always-on net under