Hosted‑sync‑first tracker for the Shredmaxxing protocol with a segmented day model (FTN → Lunch → Dinner → Late). v4 focuses on ultra‑fast logging, durable replication, and explainable insights — with an offline‑first cache and no front‑end build chain.
- Spec:
docs/spec_vNext.md(source of truth). - Implementation: the PWA (
index.html,app.js,style.css) remains a v3 UI baseline with v4 core logic wired in (protocol day model, roster IDs/tags, merge+snapshots, review/insights, privacy features, and hosted sync by default with an IndexedDB cache).
- FTN mode: strict / lite / off (FTN segment only)
- Move pre‑lunch and Training (daily toggles)
- HFHC collision (computed + override)
- Seed oils / unknown oils (manual + hints)
- Food diversity presence per segment:
- Proteins / Carbs / Fats / Accoutrements (μ)
- High‑fat meal and High‑fat day (computed + override)
- Supplements (optional module)
- Signals: Energy / Mood / Cravings (1–5)
- Notes (daily + per segment)
- Speed helpers: pinned + recents, undo toast, repeat last segment, copy yesterday (segment/all)
- Formal protocol day anchored to
dayStartwith wrap‑around support (dayEnd <= dayStart). - activeDay(now) resolves after midnight to the prior DateKey.
- Segment boundaries are wall‑clock minutes with deterministic DST clamping.
- Solar arc clamps inside the protocol day for stable rendering.
- Hosted sync (same-origin) is the default durability layer (multi-device convergence).
- IndexedDB is still used as an offline-first cache (UI reads/writes it first);
localStorageremains a legacy fallback. - Attempts persistent storage when supported (see Diagnostics).
- Outbox replication: offline edits queue and sync when back online (never blocks logging).
- Snapshots before import/migration/sync-reset; restore from Diagnostics.
- Merge‑safe import (default) + Replace option.
- Exports: JSON (sanitized, no sync credentials), encrypted JSON (AES‑GCM via WebCrypto), and CSV (per‑day rows).
- Optional hardening: app lock, privacy blur, home redaction. Optional E2EE makes hosted sync ciphertext-only.
- When deployed with a write-capable same-origin server, the app syncs to
/api/sync/v1/*in the background. - The UI always renders from the local cache first, so logging is instant and works offline.
- If the sync API is unavailable (e.g., static hosting /
python -m http.server), the app falls back to local-only mode and continues to work.
- Weekly Review 2.0: coverage matrix, rotation picks, and local‑only correlations.
- Explainable rules engine for protocol insights (on‑device).
./
index.html
style.css
app.js # v3 UI glue + v4 actions
app/ # boot + store + reducer + shared helpers
ui/ # rendering + event bindings
domain/ # time model, heuristics, review, insights
storage/ # IndexedDB adapter, migration, import/export, snapshots
sw.js # app-shell cache + update flow
manifest.webmanifest
icons/
assets/fonts/
docs/spec_vNext.md # canonical spec (vNext)
tests/ # browser + e2e tests
scripts/ # test runners
Open index.html in a browser. (Service worker caching is limited without HTTPS or a local server.)
python3 -m http.server 5173Then open http://localhost:5173/ and install as a PWA if your browser supports it.
node --test app/*.test.mjs ui/*.test.mjs domain/*.test.mjs storage/*.test.mjsnode scripts/run-browser-tests.mjsnode scripts/run-e2e.mjsSee docs/testing-e2e-tooling.md for setup and artifact locations.
- Storage: add a segment, reload, confirm data persists; verify Diagnostics shows storage mode + persist status + sync status.
- Snapshots: create a snapshot, restore it, then delete it; confirm Diagnostics updates snapshot count.
- Import/export: export JSON, import as merge, then import as replace; verify logs/rosters expected. Export encrypted, then import with passphrase.
- CSV export: export CSV and open in a spreadsheet; verify per‑day rows render.
- Copy yesterday: use “Copy yesterday” with a segment list and with “all”; verify overwrite confirm and undo.
- Review: ensure weekly summary, issue chips, correlations, matrix, and rotation picks render.
- Privacy: app lock works, blur on background works, home redaction hides labels.
- Hosted sync: make an offline edit, then go online; verify outbox drains and sync status returns to idle.
- Update flow: with service worker enabled, confirm update toast appears on new SW version.
index.htmlUI shellstyle.cssvisual systemapp.jslogic + storage (v4 adapter + v3 UI glue)app/tiny store + helpers + action logicdomain/time model, heuristics, weekly review, roster logic, insightsstorage/IndexedDB adapter, migration, import/export, snapshotsui/rendering + event bindings (+ non‑DOM helpers)sw.jsoffline cache + update flowmanifest.webmanifestPWA manifest