diff --git a/AGENTS.md b/AGENTS.md index 2eca4e97..f2e62397 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,6 +4,34 @@ Standing rules for any agent or developer working in this repo. Project-wide context lives in the sibling repos' AGENTS.md files (../bookhoard-app/AGENTS.md is the Android client's). +## Rendering ownership (templ vs TypeScript) — ALWAYS apply + +The point of templ + htmx + Alpine is: the server renders the UI, and +JavaScript is kept minimal. The rule that keeps it that way: + +> **JavaScript decides what shows. templ decides what it looks like.** + +- Content derived from **server data** (DB rows, search results, match + lists, conflict cards, any list/card/badge/table) is rendered by + templ. When it changes client-side, fetch a **templ partial** from an + SSR route and swap it in (`htmx.ajax(...)`), never rebuild it from a + JSON payload with `innerHTML` string templates. +- **Pure functions of client-local state** (open/closed panels, tabs, + password strength from a typed value, toasts) may render in + TS/Alpine — no server round trip needed. +- `web/src` is **TypeScript only** — no new `.js` source files. + Vendored third-party and vite build output under `web/static` are + exempt. +- Inline `