docs: correct PageDocument contract description; drop stale chrome/sync sections

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Alex Dunmow 2026-07-07 13:36:25 +08:00
parent 27e57b8837
commit 52f6c62fd3
2 changed files with 9 additions and 14 deletions

View File

@ -17,9 +17,12 @@ between first-party entities (cms, orchestrator, ninja CLI).
the ABI hooks directly and never sees these Go structs. the ABI hooks directly and never sees these Go structs.
- **The SDK ships no page chrome.** A template renders only its - **The SDK ships no page chrome.** A template renders only its
`TemplateDocument`; the **host** composes the document envelope `TemplateDocument`; the **host** composes the document envelope
(doctype / `<html>` / `<head>` / `<body>` + bn chrome) around it. A guest (doctype / `<html>` / `<head>` / `<body>` + bn chrome) around it. Through
expresses its envelope needs (title, meta, asset hooks) through `templates.PageDocument` a guest supplies the body plus envelope attributes
`templates.PageDocument` — never by emitting head/body markup itself. (body class, `lang`, extra `<html>` attributes, and head/body-end extra
HTML) — never head/body markup itself. Title, meta, and site chrome are
host-authored: the host builds them from the doc map it also hands the guest
as `doc_json`.
## Critical Rules ## Critical Rules

View File

@ -16,23 +16,15 @@ never the first-party `core` module.
context rehydration), its capability stubs (`plugin/wasmguest/caps/`), and the context rehydration), its capability stubs (`plugin/wasmguest/caps/`), and the
`database/sql` driver over the host DB (`plugin/wasmguest/bnwasm/`). `database/sql` driver over the host DB (`plugin/wasmguest/bnwasm/`).
- **Guest-facing type packages** plugins consume: `blocks/` (incl. `blocks/builtin`, - **Guest-facing type packages** plugins consume: `blocks/` (incl. `blocks/builtin`,
`blocks/shared`, `blocks/tags`), `templates/` (registry + `templates/pongo`), `blocks/shared`, `blocks/tags`), `templates/` (the template registry + types,
`templates/bn/` (the templ chrome — see sync rule below), `auth/`, `settings/`, including `PageDocument` — the body-plus-envelope contribution a full-page
template makes; the host owns the chrome), `auth/`, `settings/`,
`content/`, `gating/`, `crypto/`, `rbac/`, `video/`, `ai/`, `subscriptions/`, `content/`, `gating/`, `crypto/`, `rbac/`, `video/`, `ai/`, `subscriptions/`,
`menus/`, `datasources/`. `menus/`, `datasources/`.
The Go surface here is **one language binding**. The proto tree is the contract: The Go surface here is **one language binding**. The proto tree is the contract:
a non-Go plugin implements the ABI hooks directly and never sees the Go structs. a non-Go plugin implements the ABI hooks directly and never sees the Go structs.
## `templates/bn` synced-copy rule
`templates/bn/*` is **authored in the cms repo** (`cms/backend/templates/bn`) and
**synced into here** via cms `make sync-templates`. Do not hand-edit the copy in
this repo — edit it in cms and re-sync. Drift is enforced by check-safety **check 31**
(`check-safety/check_templatesync.go`), which compares this repo's `templates/bn`
against the cms authoritative copy. (This chrome is transitional: it is deleted from
the SDK once host-side head/body injection lands — Phase 3.)
## Rules ## Rules
- **NEVER use `replace` directives** in `go.mod`. Module resolution goes through the - **NEVER use `replace` directives** in `go.mod`. Module resolution goes through the