pluginsdk/AGENTS.md
Alex Dunmow 27e57b8837 feat!: delete guest chrome (templates/bn, templates/pongo) — host composes the envelope (P3)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 13:32:22 +08:00

37 lines
1.7 KiB
Markdown

# Plugin SDK
Go module `git.dev.alexdunmow.com/block/pluginsdk`.
**Purpose: this is the ONE plugin-facing artifact.** BlockNinja CMS plugins
import this module and nothing else from the internal Go tree. Plugins must
NOT import the first-party `core` module — core exists only for code shared
between first-party entities (cms, orchestrator, ninja CLI).
## The contract is proto, not Go
- `abi/proto/v1/*.proto` is **the contract**. The host↔guest wire is proto-only;
a plugin in ANY language generates its own bindings from these files.
- `abi/v1/` is the **Go** binding of that contract (`abiv1`). The rest of the Go
surface here — `plugin/`, `plugin/wasmguest/**`, and the guest-facing type
packages — is **one language binding** of the SDK. A non-Go plugin implements
the ABI hooks directly and never sees these Go structs.
- **The SDK ships no page chrome.** A template renders only its
`TemplateDocument`; the **host** composes the document envelope
(doctype / `<html>` / `<head>` / `<body>` + bn chrome) around it. A guest
expresses its envelope needs (title, meta, asset hooks) through
`templates.PageDocument` — never by emitting head/body markup itself.
## Critical Rules
- **NEVER use `replace` directives in go.mod** — not here, not in any consumer.
All module resolution goes through the Gitea module proxy. To test local
changes, tag and push a version.
- All consumers are in-house — **no backwards-compatibility shims**. Change the
API and update consumers.
- Regenerate Go bindings after editing any `.proto`: `make proto`.
## Design
Program spec (in the cms repo):
`docs/superpowers/specs/2026-07-07-proto-first-plugin-sdk-design.md`.