TypeDock is designed so coding agents can build custom client themes and small extensions safely against an explicit contract — without risking server compromise or brittle runtime hacks.
Give this guide (along with themes/kinari/theme.json or plugins/social/plugin.js) as context when asking an AI coding agent to scaffold a TypeDock theme or plugin.
Building a Custom Theme with an AI Agent
Hard Rules (Contract)
- No server-side code: Only create
theme.json, Pongo2 HTML templates underlayouts/,partials/, andcomponents/, and static assets underassets/. - Declare every configurable token in
theme.json: Expose brand colors, typography, and layout switches undersettings.<group>.fields.<field>and reference them in CSS viavar(--td-<group>-<field>). - Use slots for composable regions: Declare named slots in
theme.json(slots.<name>) instead of hardcoding sidebar/footer widgets so site editors can reorder components from Admin. - Preserve base path compatibility: Always route theme asset URLs and links through the theme context helpers (so sites work identically at domain root
/and subdirectories like/blog/). - Keep markup accessible and fast: Prefer semantic HTML and clean CSS over heavy client-side JS bundles.
Suggested Starting Point
- Inspect
themes/default/for the complete set of layout templates (base.html,archive.html,single.html,page.html,author.html,search.html,404.html). - Inspect
themes/kinari/for a full example oftheme.jsonsettings, CSS variables, and slot-driven header/footer layouts.
Building a Drop-in JS Plugin with an AI Agent
Hard Rules (Contract)
- Sandbox-compatible ES only: Plugins execute in
gojawith strict timeouts. Do not rely on Node.js built-ins (fs,process,requireof npm packages) or browser DOM globals. - Use
ctx.*host APIs exclusively: Usectx.getOption/ctx.setOptionfor plugin settings,ctx.dbfor guarded queries,ctx.httpfor external API calls, andctx.escapeHtmlwhen returning HTML fragments. - Declare capabilities explicitly: If replacing a shared contract (such as
mailorcaptcha), declare"provides": ["..."]inplugin.json. - Isolate admin UI: Register admin screens via
ctx.registerAdminRoute+ctx.registerAdminMenu; setadmin_cspinplugin.jsonif the iframe needs external script/frame origins. - Fail gracefully: Always validate inputs and return structured error objects rather than throwing uncaught exceptions.
Suggested Reference Plugins
- Editorial components & slots:
plugins/social/andplugins/advanced-blocks/ - Forms & submissions storage:
plugins/form/ - URL redirect resolver:
plugins/redirect/ - Capability provider (
provides: ["captcha"]):plugins/turnstile-captcha/ - Custom mail transport (
provides: ["mail"]): seedocs/plugins/mail-provider.md