@blockbite/agent-context 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/examples/README.md +23 -0
  2. package/examples/dynamic-template-reference/fields.yaml +61 -0
  3. package/examples/dynamic-template-reference/manifest.json +8 -0
  4. package/examples/dynamic-template-reference/module.ts +12 -0
  5. package/examples/dynamic-template-reference/recipe.json +5 -0
  6. package/examples/dynamic-template-reference/seeds.json +44 -0
  7. package/examples/dynamic-template-reference/style.css +156 -0
  8. package/examples/dynamic-template-reference/template.liquid +59 -0
  9. package/index.json +239 -0
  10. package/mcp-tools.json +222 -0
  11. package/package.json +24 -0
  12. package/references/block-dsl.md +257 -0
  13. package/references/islands.md +111 -0
  14. package/references/tailwind-utilities.md +108 -0
  15. package/skills/analyze-template/SKILL.md +20 -0
  16. package/skills/block-style/SKILL.md +101 -0
  17. package/skills/connect/SKILL.md +25 -0
  18. package/skills/connection-status/SKILL.md +38 -0
  19. package/skills/create-template-draft/SKILL.md +55 -0
  20. package/skills/design-tokens/SKILL.md +54 -0
  21. package/skills/document-blueprint/SKILL.md +166 -0
  22. package/skills/figma-design-to-code/SKILL.md +126 -0
  23. package/skills/figma-site-builder/SKILL.md +209 -0
  24. package/skills/frame-draft-link/SKILL.md +77 -0
  25. package/skills/islands-list/SKILL.md +24 -0
  26. package/skills/project-select/SKILL.md +19 -0
  27. package/skills/projects-list/SKILL.md +17 -0
  28. package/skills/render-preview/SKILL.md +20 -0
  29. package/skills/sandbox-status/SKILL.md +18 -0
  30. package/skills/site-motion-pass/SKILL.md +88 -0
  31. package/skills/site-reviewer/SKILL.md +107 -0
  32. package/skills/sync-plan/SKILL.md +20 -0
  33. package/skills/template-figma/SKILL.md +123 -0
  34. package/skills/template-new/SKILL.md +221 -0
  35. package/skills/template-preview/SKILL.md +115 -0
  36. package/skills/template-refine/SKILL.md +135 -0
  37. package/skills/update-template-draft/SKILL.md +36 -0
@@ -0,0 +1,108 @@
1
+ # BlockBite Tailwind Utilities
2
+
3
+ Use this reference when writing Tailwind classes in BlockBite templates, block
4
+ styles, preview templates, or workspace CSS. BlockBite loads the
5
+ `@blockbite/tailwind` plugin in the generated Tailwind pipeline, so these
6
+ utilities are available without adding another build step.
7
+
8
+ Use unprefixed classes unless the workspace explicitly configures a Tailwind
9
+ class prefix.
10
+
11
+ ## Grid Area Utilities
12
+
13
+ Use `grid-area-[cols/rows]` on a container to create a CSS grid with explicit
14
+ column and row counts.
15
+
16
+ Use `area-[row-start/col-start/row-end/col-end]` on direct children to set the
17
+ child placement. The `area-*` utility stores the value in `--area`; the
18
+ `grid-area-*` container applies it to direct children.
19
+
20
+ ```liquid
21
+ <section class="grid-area-[12/6] gap-4">
22
+ <article class="area-[2/2/4/6] rounded-lg bg-white p-6">
23
+ ...
24
+ </article>
25
+ </section>
26
+ ```
27
+
28
+ `area-[2/2/4/2]` is valid syntax, but remember that CSS grid line values follow
29
+ `row-start / column-start / row-end / column-end`. Choose end lines that create
30
+ the intended span. Slash and dash separators are accepted, for example
31
+ `area-[2-2-4-6]`.
32
+
33
+ ## Direct-Child Variants
34
+
35
+ Use `children:*` for all direct children and `children-<tag>:*` for supported
36
+ direct child elements. These are useful for rich text, generated block output,
37
+ and repeated child elements where adding a class to each child is noisy.
38
+
39
+ Supported element variants:
40
+
41
+ - `children-p:*`
42
+ - `children-a:*`
43
+ - `children-img:*`
44
+ - `children-ol:*`
45
+ - `children-ul:*`
46
+ - `children-li:*`
47
+ - `children-h1:*`
48
+ - `children-h2:*`
49
+ - `children-blockquote:*`
50
+
51
+ ```liquid
52
+ <div class="children-p:mb-4 children-a:underline children-img:rounded-lg">
53
+ {{ props.fields.body | bb_str | raw }}
54
+ </div>
55
+ ```
56
+
57
+ ## Prose And Rich Text
58
+
59
+ For rich text/prose wrappers, combine direct-child variants with normal Tailwind
60
+ utilities. Use Tailwind color utilities such as `text-white`, so the child
61
+ variant form is `children:text-white`, `children-p:text-white`, or
62
+ `children-a:text-white`.
63
+
64
+ ```liquid
65
+ <div class="children:text-white children-p:mb-4 children-p:text-white children-a:text-white children-a:underline children-h2:text-white">
66
+ {{ props.fields.body | bb_str | raw }}
67
+ </div>
68
+ ```
69
+
70
+ Do not use `children:color-white` unless the workspace has explicitly defined a
71
+ custom `color-white` utility. In standard Tailwind syntax, text color is
72
+ `text-white`.
73
+
74
+ ## Containers
75
+
76
+ Use BlockBite container classes for site-width alignment before writing custom
77
+ width CSS:
78
+
79
+ - `container`: standard site-width wrapper using `--bb-container-width`.
80
+ - `container-wide`: wider wrapper using `--bb-container-wide-width`.
81
+ - `container-full`: full-width wrapper using `--bb-container-full-width` and
82
+ full-container padding when configured.
83
+ - `container-inner`: applies calculated inner left and right padding without
84
+ constraining width.
85
+ - `container-inner-left`: aligns only the left side to the standard container
86
+ inset.
87
+ - `container-inner-right`: aligns only the right side to the standard container
88
+ inset.
89
+
90
+ These classes read BlockBite container CSS variables from the workspace theme
91
+ and generated design-token layer.
92
+
93
+ ```liquid
94
+ <section class="container-full bg-neutral-950 py-20">
95
+ <div class="container-inner">
96
+ <div class="max-w-3xl children:text-white children-p:text-white">
97
+ {{ props.fields.body | bb_str | raw }}
98
+ </div>
99
+ </div>
100
+ </section>
101
+ ```
102
+
103
+ ## Other Utilities And Variants
104
+
105
+ - `b_mask-text`: clips the background to text; pair it with background classes.
106
+ - `editor:*`: scopes a utility to `.editor-styles-wrapper &` for editor-only
107
+ adjustments. Use this only when the frontend and editor genuinely need
108
+ different styling.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: analyze-template
3
+ description: Analyze a BlockBite dynamic template package (files, fields.yaml, seeds.json, and matching DB records) before editing. Use when the user wants to understand or audit an existing template.
4
+ ---
5
+
6
+ # Analyze a BlockBite template
7
+
8
+ ## Steps
9
+
10
+ 1. Ensure a project is selected (connection-status / project-select).
11
+ 2. Call `blockbite-template-analyze` with either `{ "slug": "<slug>" }` or
12
+ `{ "view": "templates/<slug>/template.liquid" }`.
13
+ 3. Set `{ "preferSandbox": true }` to inspect pending sandbox changes first.
14
+ 4. Summarize package files, `fields.yaml` validity, `seeds.json` shape, and the
15
+ read-only dynamic-template / dynamic-content records.
16
+
17
+ ## Next
18
+
19
+ - Preview with the render-preview skill.
20
+ - Plan edits with the update-template-draft skill (writes go to the sandbox).
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: block-style
3
+ description: Create or refine BlockBite shared block styles for workspace blocks. Use when the user wants Tailwind-powered styles for blocks such as bb/button, core/button, bb/group, quote, cards, or any blocks/<namespace>/<block>/styles/*.template.liquid variant, including checking workspace block availability and regenerating frontend assets with wp bb autobuild.
4
+ ---
5
+
6
+ # Block Style
7
+
8
+ Create or refine a shared block style in the active BlockBite workspace.
9
+
10
+ Before authoring DSL tags, read `../references/block-dsl.md` when it exists.
11
+ For BlockBite-specific Tailwind utilities such as `area-[...]`, `grid-area-[...]`, and `children:*`, read `../references/tailwind-utilities.md` when it exists.
12
+ When choosing token-backed Tailwind classes, run `wp bb design-tokens db-to-local` if needed and read `<workspace>/dev/css/design-tokens.css`.
13
+
14
+ ## Agent Contract
15
+
16
+ The agent is the interface; WP-CLI is only the executor. Do not rely on interactive CLI prompts. Resolve the block and style name from the chat, infer sensible defaults when safe, then run commands with full flags.
17
+
18
+ ## Build Mode Contract
19
+
20
+ Treat BlockBite's reported build mode as authoritative:
21
+
22
+ - auto-build: after template, style, script, or block-style edits, run `ddev wp bb autobuild`; if Node.js is unavailable, open the signed browser fallback URL.
23
+ - custom-build: do not use the signed browser runner; use the project-specific frontend build pipeline.
24
+ - Default to auto-build for template and site work unless `wp bb learn`, `wp bb init`, or `dev/template-start/latest.json` explicitly reports custom-build.
25
+ - Do not infer custom-build from development manifests in mounted plugins or neighboring projects.
26
+ - Do not start, repair, shim, or mutate external Vite/Webpack setup unless the user explicitly asks for plugin development or custom-build work.
27
+ - If autobuild stalls or fails, report the runner status and stop before changing build setup.
28
+
29
+ ## Workspace Contract
30
+
31
+ Block styles live in:
32
+
33
+ ```text
34
+ <workspace>/blocks/<namespace>/<block>/styles/<style-slug>.template.liquid
35
+ ```
36
+
37
+ The generated CSS lives in:
38
+
39
+ ```text
40
+ <workspace>/autobuild/css/block-styles.css
41
+ ```
42
+
43
+ Never edit `autobuild/css/block-styles.css` by hand. In auto-build mode, run:
44
+
45
+ ```bash
46
+ ddev wp bb autobuild
47
+ ```
48
+
49
+ If Node.js is unavailable, open the printed browser fallback URL and wait for
50
+ the runner to finish before inspecting generated output.
51
+
52
+ ## Workflow
53
+
54
+ 1. Resolve the workspace root and inspect `<workspace>/blocks/<namespace>/<block>`.
55
+ 2. If the block folder is missing, check whether the plugin provides it and use:
56
+
57
+ ```bash
58
+ ddev wp bb offload <namespace>/<block> --workspace
59
+ ```
60
+
61
+ 3. Read `<workspace>/dev/css/design-tokens.css` when token choices matter.
62
+ 4. Read the block's `manifest.json` and existing `styles/*.template.liquid`.
63
+ 5. Reuse an existing style when it already matches the requested role.
64
+ 6. Create or update a style DSL file with Tailwind classes on the block tag.
65
+ 7. Build according to the reported build mode. In auto-build mode, run `ddev wp bb autobuild`.
66
+ 8. If Node.js is unavailable, open the printed signed browser fallback URL and wait for success.
67
+ 9. Inspect `autobuild/css/block-styles.css` for the expected selector and classes.
68
+
69
+ ## Style DSL
70
+
71
+ Use the same DSL as dynamic templates:
72
+
73
+ ```liquid
74
+ <bb-button class="inline-flex items-center rounded-full bg-brand-a-900 px-4 py-2 text-neutral-50">
75
+ <bb-richtext content-tag="span" class="font-body text-lg font-medium leading-[1.4]" />
76
+ <bb-icon class="size-4 shrink-0" />
77
+ </bb-button>
78
+ ```
79
+
80
+ For `bb/button`, prefer styling child atoms in the same style file when needed:
81
+
82
+ - `.wp-block-bb-richtext` through nested `<bb-richtext>`
83
+ - `.wp-block-bb-icon` through nested `<bb-icon>`
84
+
85
+ ## Template Usage
86
+
87
+ When a dynamic template contains a button, first check whether `bb/button` exists in `<workspace>/blocks`.
88
+
89
+ Use shared styles for repeated visual variants instead of repeating long Tailwind button classes inside each template.
90
+
91
+ Use the style by applying the block style attribute supported by the block/component, for example `bb-style` when available, or by using the existing block style selected in WordPress/editor flows.
92
+
93
+ ## Finish
94
+
95
+ Report:
96
+
97
+ - block name
98
+ - style slug and file path
99
+ - whether the block was already present or offloaded
100
+ - build command result
101
+ - selector found in `autobuild/css/block-styles.css`
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: connect
3
+ description: Connect this agent to the BlockBite Platform MCP server and confirm the connection is live. Use when the user mentions connecting BlockBite, signing in to BlockBite, or when MCP tool calls fail with an authentication error.
4
+ ---
5
+
6
+ # Connect to BlockBite
7
+
8
+ BlockBite Platform is the single MCP server. The agent talks only to Platform;
9
+ Platform routes approved calls to the selected WordPress Studio site.
10
+
11
+ ## Steps
12
+
13
+ 1. Ensure the `blockbite` MCP server is configured (remote HTTP to the Platform
14
+ `/mcp` endpoint). The plugin ships this in its MCP config.
15
+ 2. On first use, complete the Platform OAuth flow in the browser when prompted.
16
+ 3. Verify the connection by calling `blockbite-connection-status`.
17
+ 4. If no project is selected yet, call `blockbite-projects-list` then
18
+ `blockbite-project-select`.
19
+
20
+ ## Notes
21
+
22
+ - You never handle WordPress bearers or site URLs directly. Platform owns
23
+ project routing, the Studio bearer, and audit.
24
+ - If a call returns a project-selection-required error, run the project-select
25
+ skill before retrying.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: connection-status
3
+ description: Check the BlockBite MCP connection, the selected project, and whether Studio tools are reachable. Use when the user asks if BlockBite is connected or when diagnosing failing tool calls.
4
+ ---
5
+
6
+ # BlockBite connection status
7
+
8
+ ## Steps
9
+
10
+ 1. Call `blockbite-connection-status` (no arguments).
11
+ 2. Report: authenticated account, `selected_project`, Studio `site_url`, and
12
+ whether a Studio bearer is available.
13
+ 3. If not connected, run the connect skill. If no project is selected, run the
14
+ project-select skill.
15
+
16
+ ## `bearer_available: false` is normal after selecting a project
17
+
18
+ Platform mints the Studio bearer **lazily, on the first Studio tool call** —
19
+ selecting a project intentionally clears it. So `bearer_available: false`
20
+ immediately after `blockbite-project-select` is expected and does **not** mean
21
+ Studio tools are unusable.
22
+
23
+ - Do **not** treat `bearer_available: false` as a blocker, and **never** fall
24
+ back to the site's public WordPress REST API (e.g. `/wp-json/...`).
25
+ - To proceed, just call the Studio tool you need (for example
26
+ `blockbite-islands-list` or `blockbite-workspace-status`). The first such call
27
+ performs the bearer exchange with WordPress; a follow-up
28
+ `blockbite-connection-status` will then show `bearer_available: true`.
29
+ - Only if that first Studio tool call returns a `studio_*` error (e.g.
30
+ `studio_auth_failed`, `studio_bearer_exchange_failed`, `studio_unreachable`)
31
+ is there a real connection problem — see Troubleshooting.
32
+
33
+ ## Troubleshooting
34
+
35
+ - `studio_auth_failed`: Platform could not authenticate to the site. Ask the user
36
+ to reconnect the project from the BlockBite Platform dashboard.
37
+ - `manage_secret_missing`: the site has not completed the management handshake;
38
+ reconnect the WordPress site so Platform can re-mint the signing secret.
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: create-template-draft
3
+ description: Create a new BlockBite template draft in the sandbox, then preview it. Use when the user wants to build a new section, hero, FAQ, or pattern. All writes stay in the sandbox.
4
+ ---
5
+
6
+ # Create a BlockBite template draft
7
+
8
+ Writes always target the sandbox overlay. Production is never modified until the
9
+ user approves the sandbox in WordPress.
10
+
11
+ ## Steps
12
+
13
+ 1. Ensure a project is selected.
14
+ 2. Call `blockbite-template-create-draft` with a `{ "name": "<section name>" }`
15
+ or `{ "slug": "<slug>", "type": "<section|hero|faq|...>" }`.
16
+ 3. Return the preview URL as the deliverable, plus the approval URL so the user
17
+ can promote the sandbox.
18
+ 4. Iterate with `blockbite-workspace-write` / `blockbite-workspace-patch` and
19
+ re-preview with the render-preview skill.
20
+ 5. After the user approves the sandbox package, use `blockbite-build-status`
21
+ and `blockbite-build-run` if bundles are dirty. Do not run Node.js, import
22
+ BlockBite build chunks, or call build request endpoints directly.
23
+
24
+ ## Islands and page sections
25
+
26
+ When the user asks for an "island", header, hero, nav, footer, or any reusable
27
+ section, author it as a **dynamic-template package** under
28
+ `templates/<slug>/`:
29
+
30
+ - `template.liquid` — markup with Tailwind utilities / semantic class names
31
+ - `style.css` — keyframes, pseudo-elements, complex selectors only
32
+ - `fields.yaml` — field schema (and `subcollections` if repeated rows)
33
+ - `seeds.json` — preview/sample data
34
+
35
+ Before writing, read the bundled canonical example at
36
+ `example-use/blockbite/templates/dynamic-template-reference/`. It demonstrates
37
+ the complete package: Liquid data resolution with `bb_seed` / `bb_source`, repeated
38
+ `subcollections`, scoped semantic CSS, local `module.ts` behavior, and
39
+ `manifest.json` wiring.
40
+
41
+ Do **not** hand-write `islands/<slug>/island-pattern.html`, and do **not** wrap a
42
+ section in a raw `<!-- wp:html --><style>…</style>` block. That `islands/`
43
+ compiled-blocks format (`format: blockbite-ui-dsl`, `mode: compiled-blocks`) is
44
+ generated by the editor/compiler — there is no agent tool to author it.
45
+
46
+ ## Guardrails
47
+
48
+ - Run `blockbite-agent-onboarding` first if you are unsure of workspace paths or
49
+ sandbox rules.
50
+ - Check `blockbite-sandbox-status` to see pending changes before adding more.
51
+ - After the package is written, return the `blockbite_preview_mcp` preview URL.
52
+ Do **not** open a browser or use browser automation to verify — the preview
53
+ URL is how the user reviews the result.
54
+ - MCP build orchestration stays in MCP tools: use `blockbite-build-status` /
55
+ `blockbite-build-run`, never local probes.
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: design-tokens
3
+ description: Use when working with BlockBite design tokens, workspace dev/css/design-tokens.css, Tailwind theme token availability, or the `wp bb design-tokens` CLI used by agents and local development.
4
+ ---
5
+
6
+ # BlockBite Design Tokens
7
+
8
+ Use this skill when a task depends on BlockBite design tokens or Tailwind theme tokens.
9
+
10
+ ## Source Of Truth
11
+
12
+ - `dev/css/design-tokens.css` is the writable local source of truth.
13
+ - Saved design tokens live in Studio under the `design-tokens` item handle.
14
+ - The database `content` column stores the same Tailwind v4 `@theme` CSS as `dev/css/design-tokens.css`.
15
+ - The database `data` column stores a derived `DesignTokenIndex` for Studio UI, MCP, and previews.
16
+ - Agents may add any valid Tailwind v4 `@theme` variable, including custom namespaces. Do not force output into the old normalized token schema.
17
+ - Do not read or write `dev/design-tokens.yaml`; it is no longer part of the token workflow.
18
+
19
+ ## CLI
20
+
21
+ Sync the workspace CSS and derived token index:
22
+
23
+ ```bash
24
+ wp bb init
25
+ wp bb update skills
26
+ wp bb design-tokens
27
+ wp bb design-tokens db-to-local
28
+ wp bb design-tokens local-to-db
29
+ wp bb design-tokens build
30
+ wp bb design-tokens check
31
+ ```
32
+
33
+ `wp bb init` refreshes this context and installs missing workspace skills. It does not ask interactive CLI questions. Use `wp bb update skills` to overwrite shipped skill boilerplates in `dev/skills` only.
34
+
35
+ Useful options:
36
+
37
+ ```bash
38
+ wp bb design-tokens db-to-local --out=/absolute/path/dev/css/design-tokens.css
39
+ wp bb design-tokens local-to-db --in=/absolute/path/dev/css/design-tokens.css
40
+ wp bb design-tokens check --in=/absolute/path/dev/css/design-tokens.css
41
+ ```
42
+
43
+ ## Workflow
44
+
45
+ 1. Refresh tokens with `wp bb design-tokens db-to-local` when the workspace file may be stale.
46
+ 2. Read `<workspace>/dev/css/design-tokens.css` and parse top-level Tailwind v4 `@theme` declarations.
47
+ 3. Prefer token classes generated by the parsed namespaces, such as `text-{token}` from `--text-*`, `font-{token}` from `--font-*`, `bg-{token}` / `text-{token}` / `border-{token}` from `--color-*`, `rounded-{token}` from `--radius-*`, and `shadow-{token}` from `--shadow-*`.
48
+ 4. Missing font-size steps, color shades, radius values, and other namespace entries are allowed; do not assume unconfigured tokens exist.
49
+ 5. For block style work, combine this with the `block-style` skill and the shared DSL reference at `../references/block-dsl.md` when available.
50
+
51
+ ## Contract
52
+
53
+ Write Tailwind v4 `@theme` CSS, not normalized token arrays or the previous YAML-style schema.
54
+ Manual CSS edits do not update Studio until `wp bb design-tokens local-to-db` runs.
@@ -0,0 +1,166 @@
1
+ ---
2
+ name: document-blueprint
3
+ description: Create or refine BlockBite workspace document blueprints that assemble full WordPress pages from ordered dynamic-template sections, section seed files, and existing content blueprints without writing directly to the database.
4
+ ---
5
+
6
+ # Document Blueprint
7
+
8
+ Use this skill when the user wants a full page/document assembled from existing BlockBite dynamic templates and content blueprints.
9
+
10
+ Document blueprints are workspace files. Do not write page content directly into the database. The import flow overwrites a selected page with managed `bb/dynamic-template` blocks and imports section seed files into block-instance dynamic content sources.
11
+
12
+ ## File Contract
13
+
14
+ Create document blueprints under:
15
+
16
+ ```txt
17
+ <workspace>/document-blueprints/<slug>/
18
+ blueprint.json
19
+ sections/
20
+ <section-key>.seed.json
21
+ ```
22
+
23
+ `blueprint.json`:
24
+
25
+ ```json
26
+ {
27
+ "title": "Home",
28
+ "description": "Home page document blueprint",
29
+ "sections": [
30
+ {
31
+ "key": "hero",
32
+ "name": "Hero",
33
+ "template": "home-hero",
34
+ "dynamicContent": "home-hero",
35
+ "tag": "section",
36
+ "align": "full",
37
+ "seed": "sections/hero.seed.json"
38
+ }
39
+ ]
40
+ }
41
+ ```
42
+
43
+ Section seed files:
44
+
45
+ ```json
46
+ {
47
+ "fields": {
48
+ "headline": "Production headline",
49
+ "body": "Production copy"
50
+ },
51
+ "subcollections": {}
52
+ }
53
+ ```
54
+
55
+ Field keys in `fields` and `subcollections` must match the target content blueprint handles or field ids.
56
+
57
+ ## Workflow
58
+
59
+ 1. If no document blueprint exists, scaffold one:
60
+
61
+ ```bash
62
+ ddev wp bb document-blueprint scaffold --slug=home
63
+ ```
64
+
65
+ For multiple pages or content-heavy page plans, prefer the PHP/WP-CLI generator
66
+ instead of ad hoc Node/Python scripts:
67
+
68
+ ```bash
69
+ ddev wp bb document-blueprint generate --file=document-blueprints.spec.json
70
+ ddev wp bb document-blueprint generate --file=document-blueprints.spec.json --overwrite
71
+ ```
72
+
73
+ Spec files may contain one blueprint object, a `blueprints` array, or a `pages`
74
+ array. Each section must include `key` and `template`; `dynamicContent` defaults
75
+ to `template`. Put seed content directly on the section as `fields` and
76
+ `subcollections`, or as a `seedData` object:
77
+
78
+ ```json
79
+ {
80
+ "blueprints": [
81
+ {
82
+ "slug": "style-editor",
83
+ "title": "Style Editor",
84
+ "description": "Conversion page for the visual style editor.",
85
+ "sections": [
86
+ {
87
+ "key": "header",
88
+ "name": "Page header",
89
+ "template": "editorial-centered-statement",
90
+ "fields": {
91
+ "eyebrow": "Style Editor",
92
+ "heading": "Style WordPress blocks without leaving the editor.",
93
+ "text": "Use visual controls, responsive targeting, and Tailwind-compatible class input."
94
+ },
95
+ "subcollections": {}
96
+ }
97
+ ]
98
+ }
99
+ ]
100
+ }
101
+ ```
102
+
103
+ 2. Replace scaffold placeholder slugs with existing registered slugs:
104
+
105
+ - `template`: dynamic template slug.
106
+ - `dynamicContent`: content blueprint slug. If omitted, it defaults to the template slug.
107
+
108
+ 3. For each section, read the target template/content schema before editing the seed. Keep section keys stable because re-import matches managed sections by `blueprint + section`.
109
+
110
+ 4. Keep one seed file per section. Use `fields` for section-level values and `subcollections` for repeaters.
111
+
112
+ 5. Validate before importing:
113
+
114
+ ```bash
115
+ ddev wp bb document-blueprint validate
116
+ ddev wp bb document-blueprint validate --slug=home
117
+ ```
118
+
119
+ 6. For visual review before import, create a file-backed preview package:
120
+
121
+ ```txt
122
+ <workspace>/templates/<blueprint-slug>-preview/template.liquid
123
+ ```
124
+
125
+ Use the `bb_document_blueprint` filter so BlockBite renders the blueprint sections in order with their section seed files:
126
+
127
+ ```liquid
128
+ <main class="bb-document-blueprint-preview" data-bb-document-blueprint-preview="home">
129
+ {{ "home" | bb_document_blueprint | raw }}
130
+ </main>
131
+ ```
132
+
133
+ Open it through the normal template preview route:
134
+
135
+ ```txt
136
+ /?blockbite_preview=1&template=true&view=templates/<blueprint-slug>-preview/template.liquid&dataMode=seed
137
+ ```
138
+
139
+ This preview is read-only. It must not create a page, update `post_content`, or import dynamic content source rows.
140
+
141
+ 7. Import from the Studio Document blueprints UI only after the selected page is safe to overwrite.
142
+
143
+ ## Import Semantics
144
+
145
+ The importer writes only managed dynamic template blocks into page `post_content`. Existing unmarked blocks are removed because document blueprint import is explicitly overwrite.
146
+
147
+ Managed blocks are marked with:
148
+
149
+ ```json
150
+ {
151
+ "bbMeta": {
152
+ "documentBlueprint": {
153
+ "blueprint": "home",
154
+ "section": "hero"
155
+ }
156
+ }
157
+ }
158
+ ```
159
+
160
+ On re-import, matching managed document blueprint sections reuse/update their existing block-instance source rows instead of duplicating them.
161
+
162
+ ## Preview Semantics
163
+
164
+ `bb_document_blueprint` reads `document-blueprints/<slug>/blueprint.json`, loads each section seed from that blueprint folder, and renders each referenced `templates/<section.template>/template.liquid` with the blueprint seed as `item` and `live: true`.
165
+
166
+ Use this for in-between page review. Use the importer only when the user wants the blueprint written into a real WordPress page.