@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,135 @@
1
+ ---
2
+ name: template-refine
3
+ description: Refine an existing BlockBite Studio dynamic template package. Use when the user wants to clean up or improve a template created from Figma or AI, simplify Tailwind classes, fix Liquid/runtime issues, preserve fields and seed data, improve Alpine behavior, or align an existing template with BlockBite package conventions.
4
+ ---
5
+
6
+ # Template Refine
7
+
8
+ Improve an existing BlockBite Studio template without breaking its dynamic content contract.
9
+
10
+ Before changing 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 simplifying 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 template slug from the chat, ask only when it is missing, 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
+ ## First Pass
30
+
31
+ Read the package under `<workspace>/templates/<slug>/`:
32
+
33
+ - `template.liquid`
34
+ - `recipe.json`
35
+ - `seeds.json`
36
+ - `fields.yaml`
37
+ - `manifest.json`
38
+ - `style.css`
39
+ - `module.ts`
40
+
41
+ Also read one nearby successful template when possible.
42
+
43
+ ## Frontend Runtime Errors
44
+
45
+ For browser errors, especially Alpine expression errors, open the current
46
+ frontend page with `#blockbite-debug-panel`, inspect the Client JS chapter, and
47
+ read this in the browser console:
48
+
49
+ ```js
50
+ window.BlockBiteDebug?.errors;
51
+ ```
52
+
53
+ Use those entries to identify the template slug, `template.liquid`, `module.ts`,
54
+ failing expression, selector, and rendered element before editing.
55
+
56
+ ## Preserve Contract
57
+
58
+ Keep existing field handles stable unless the user explicitly asks to rename them. Dynamic-content field ids live in the database, not in YAML.
59
+
60
+ Use:
61
+
62
+ - `props.fields.<handle>` for top-level fields
63
+ - `props.subcollections.<handle>` for repeaters
64
+ - `bb_str | raw` for editable text
65
+ - existing component includes when the package already relies on them
66
+
67
+ Supported `fields.yaml` field types are: `string`, `text`, `textarea`, `richtext`, `media`, `image`, `file`, `link`, `svg`, `number`, `integer`, `float`, `boolean`, `bool`, `toggle`, `select`, `radio`, `date`, `datetime`, `color`, `email`, `telephone`, `url`, `password`, and `post_relation`.
68
+
69
+ For editable images, prefer `type: media`; `type: image` and `type: file` normalize to `media`. Do not convert media fields into `image_url: type: string` unless preserving an existing external URL-only contract. If changing a string URL field into media, treat it as a data-shape change and sync dynamic-content intentionally.
70
+
71
+ For icon or shape picker fields, use `type: svg` with `kind: icon` or `kind: shape`; `kind` defaults to `icon`. Do not change these to string IDs or invent `type: icon` unless preserving a legacy contract.
72
+
73
+ ## Fill Layers
74
+
75
+ When refining hero backgrounds, overlays, or other visual layers, prefer the
76
+ child DSL API:
77
+
78
+ ```liquid
79
+ <bb-fills>
80
+ <bb-fill type="image" field="{{ props.fields.hero_artwork }}" class="opacity-70" />
81
+ <bb-fill type="gradient" class="bg-gradient-to-b from-black/20 to-black/70" />
82
+ </bb-fills>
83
+ ```
84
+
85
+ Keep the owning section or group responsible for sizing and clipping, for
86
+ example `relative isolate min-h-* overflow-hidden`. Do not move fills into
87
+ `bb-group` props. If a template uses an absolutely positioned `core-image` or
88
+ `bb-image` only as a background layer, migrate it to `bb-fill type="image"` and
89
+ preserve the media field handle. Keep normal image blocks for images that are
90
+ part of the layout.
91
+
92
+ ## Refinement Goals
93
+
94
+ Prioritize:
95
+
96
+ - valid Liquid and HTML
97
+ - lean Tailwind classes that match the existing design language
98
+ - responsive layout that does not overlap text or controls
99
+ - reusable fields and repeaters instead of hardcoded repeated content
100
+ - shared block styles for repeated visual variants instead of long duplicated Tailwind classes
101
+ - Alpine behavior that uses already-loaded CDN plugins
102
+ - `recipe.json`, `seeds.json`, and `fields.yaml` consistency
103
+
104
+ Do not rewrite unrelated components or database rows.
105
+
106
+ ## Shared Styles Boundary
107
+
108
+ Do not move template-specific styling or global `html`, `body`, `button`,
109
+ `input`, typography, background, or reset rules into
110
+ `<workspace>/app/styles-shared/*.css`.
111
+
112
+ `app/styles-shared/shared.css` is bundled into `app.bundle.css` and loaded in
113
+ block editor previews as well as the frontend. Use it only for intentionally
114
+ shared, scoped component or template-family classes. Keep island CSS in
115
+ `templates/<slug>/style.css`; keep frontend-only globals in
116
+ `app/styles-app/app.css` or the theme stylesheet.
117
+
118
+ ## CLI Flow
119
+
120
+ After file changes, run:
121
+
122
+ ```bash
123
+ ddev wp bb dynamic-template update --slug=<slug>
124
+ ddev wp bb dynamic-content sync --slug=<slug> --fields=<slug>/fields.yaml
125
+ ```
126
+
127
+ Only import seeds when the user wants seed data replaced:
128
+
129
+ ```bash
130
+ ddev wp bb source import-seeds --slug=<slug> --file=wp-content/blockbite/templates/<slug>/seeds.json
131
+ ```
132
+
133
+ ## Finish
134
+
135
+ Validate JSON, inspect the template manually, run focused CLI checks, and report exactly what changed and what was preserved.
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: update-template-draft
3
+ description: Plan and apply sandbox edits to an existing BlockBite template. Use when the user wants to change layout, styles, fields, or sample content of a template. All writes stay in the sandbox.
4
+ ---
5
+
6
+ # Update a BlockBite template (sandbox)
7
+
8
+ ## Steps
9
+
10
+ 1. Ensure a project is selected.
11
+ 2. Call `blockbite-template-update-draft` with
12
+ `{ "slug": "<slug>", "change": "<plain-language change>", "scope": "layout|styles|fields|sample-content" }`.
13
+ This returns suggested tools, a preview URL, and guidance. It does not write.
14
+ 3. Apply the suggested edits with `blockbite-workspace-patch` (search/replace) or
15
+ `blockbite-workspace-write` (full file). These write to the sandbox overlay.
16
+ 4. Preview with the render-preview skill and confirm with the user.
17
+ 5. After the user approves the sandbox package, use `blockbite-build-status`
18
+ and `blockbite-build-run` if bundles are dirty. Do not run Node.js, import
19
+ BlockBite build chunks, or call build request endpoints directly.
20
+
21
+ ## Guardrails
22
+
23
+ - Read the file with `blockbite-workspace-read` before patching.
24
+ - Never assume file contents; verify with analyze-template first.
25
+ - Keep section/island work as `templates/<slug>/` dynamic-template packages
26
+ (`template.liquid` + `style.css` + `fields.yaml` + `seeds.json`). Never convert
27
+ a section into a raw `<!-- wp:html --><style>…</style>` block or hand-write
28
+ `islands/<slug>/island-pattern.html` (compiler output, not agent-authored).
29
+ - Use `example-use/blockbite/templates/dynamic-template-reference/` as the
30
+ canonical package reference when changing fields, seeds, scoped CSS, or local
31
+ `module.ts` behavior.
32
+ - After editing, return the `blockbite_preview_mcp` preview URL. Do **not** open
33
+ a browser or use browser automation to verify — the preview URL is the
34
+ deliverable.
35
+ - MCP build orchestration stays in MCP tools: use `blockbite-build-status` /
36
+ `blockbite-build-run`, never local probes.