Skip to content

[codex] Add HTML-to-blocks theme generation workflow#3846

Draft
draganescu wants to merge 4 commits into
trunkfrom
add-html-to-block-theme-skills
Draft

[codex] Add HTML-to-blocks theme generation workflow#3846
draganescu wants to merge 4 commits into
trunkfrom
add-html-to-block-theme-skills

Conversation

@draganescu

Copy link
Copy Markdown

Related issues

How AI was used in this PR

AI was used to build and iterate on the proof-of-concept Studio AI workflow, including the html-to-blocks engine integration, block-theme conversion skills, and follow-up routing fixes that make Studio load the new workflow from natural-language prompts and slash commands. The resulting code and generated site behavior were reviewed locally with focused tests and typechecking.

Proposed Changes

  • Introduces a proof-of-concept Studio AI workflow for transforming HTML/CSS designs into editable WordPress blocks, then packaging the completed workspace as a block theme.
  • Adds skill guidance and engine-backed tooling so agents can analyze mockups, serialize block trees, compare visual output, repair fidelity issues, scaffold block themes, and validate the result before installation.
  • Exposes the new workflow through Studio AI routing and slash commands so generated or existing design prompts enter the html-to-blocks path instead of falling back to the generic theme scaffold flow.
  • Hardens block-theme scaffolding against loose agent input so the workflow is more tolerant of imperfect model-generated arguments.

Testing Instructions

  • Use Node 24.15.0 from .nvmrc.
  • Run npx eslint --fix apps/cli/ai/system-prompt.ts tools/common/ai/slash-commands.ts.
  • Run npm test -- apps/cli/ai/tests/system-prompt.test.ts apps/studio/src/components/studio-code-session/composer/slash-autocomplete.test.ts.
  • Run npm run typecheck.
  • Optional manual validation: start a Studio AI run from a generated-design prompt and confirm it loads html-to-blocks, builds a workspace, then loads blocks-to-theme before installing the final site.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

draganescu and others added 4 commits June 15, 2026 19:07
…s to Studio AI

Ports a 3-skill, 18-tool HTML-design -> block-theme pipeline into the Studio
agent: self-contained SKILL.md runbooks (html-to-blocks, blocks-to-theme,
visual-fidelity) plus native defineTool wrappers that drive a vendored Node
engine as a child process (the engine's @wordpress/blocks + playwright deps
stay out of the Vite bundle). Engine excluded from tsc/eslint; deps symlinked.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
During the first end-to-end studio code run the agent could not author the
scaffold_block_theme args (parts/templates/pages, tokenMap.custom, media paths)
against the tool's loose JSON schema, hitting cryptic TypeErrors. Add upfront
arg validation with actionable messages and the expected shapes, default
tokenMap.custom, resolve media from mockup/ with skip-and-record on missing
files, and turn page-resolution failures into errors that list valid page keys.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment on lines +54 to +56
return String(value || '')
.replace(/<script[\s\S]*?<\/script>/gi, '')
.replace(/<style[\s\S]*?<\/style>/gi, '')
Comment on lines +54 to +55
return String(value || '')
.replace(/<script[\s\S]*?<\/script>/gi, '')

export function cleanText(value) {
return String(value || '')
.replace(/<script[\s\S]*?<\/script>/gi, '')
for (const [label, text] of themeTexts) {
// www.w3.org appears as the xmlns of inline data-URI SVGs — a namespace
// identifier, never fetched
const remotes = (text.match(/https?:\/\/[^"')\s]+/g) || []).filter((u) => !u.includes('schemas.wp.org') && !u.includes('gnu.org') && !u.includes('www.w3.org'));
for (const [label, text] of themeTexts) {
// www.w3.org appears as the xmlns of inline data-URI SVGs — a namespace
// identifier, never fetched
const remotes = (text.match(/https?:\/\/[^"')\s]+/g) || []).filter((u) => !u.includes('schemas.wp.org') && !u.includes('gnu.org') && !u.includes('www.w3.org'));
for (const [label, text] of themeTexts) {
// www.w3.org appears as the xmlns of inline data-URI SVGs — a namespace
// identifier, never fetched
const remotes = (text.match(/https?:\/\/[^"')\s]+/g) || []).filter((u) => !u.includes('schemas.wp.org') && !u.includes('gnu.org') && !u.includes('www.w3.org'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants