Support new blank or child themes in Studio Code - #4209
Conversation
…e never edited directly Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📊 Performance Test ResultsComparing 39fe6a5 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
|
Do you think we can write an eval that actually breaks in trunk but passes in this branch? |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…mes' into stu-2017-support-blank-child-themes
Yes! I added an eval to test a blank theme and another to test the child theme behaviors: |
| - **single-page-build-turn-cadence** — Agent builds a simple one-page site. Asserts (a) every individual turn stays under 60s (wall-clock between successive assistant messages) and (b) no `wp_cli` call uses `--post_content-file=` (which silently fails inside PHP-WASM). | ||
| - **jetpack-catchall-slideshow** — Agent reaches for Jetpack on a slideshow request. Asserts the generated page content uses a `jetpack/*` block (i.e. the catch-all rule fired instead of the agent falling back to raw HTML). | ||
| - **differentiate-preview-vs-remote** — Regression for STU-1775. Seeds one connected WordPress.com remote site and one preview site for a local site, then asserts the `site_connected_remote_sites` and `preview_list` tools tag their output with a `type` discriminator (`wpcom-remote` / `preview`) and that the agent's prose keeps the two categories distinct (preview sites are never described as connected WordPress.com remote sites). | ||
| - **blank-theme-for-new-site** — Default new-site flow ("create a new site about the history of Wapuu", no theme named). Asserts the agent scaffolds a fresh blank theme — `scaffold_theme` called without `parentTheme` and succeeding. |
There was a problem hiding this comment.
I wonder if we can move the assertions of this eval to one of the previous ones to keep the evals a bit more fast/contained.
There was a problem hiding this comment.
Great suggestion! I added it to "single-page site build keeps every turn under 60s" 87b15ce
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| expect( prompt ).toContain( 'Personal or Premium cannot install plugins' ); | ||
| } ); | ||
|
|
||
| it( 'guards installed third-party theme edits behind child themes', () => { |
There was a problem hiding this comment.
That feels like a useless unit test.
There was a problem hiding this comment.
Agreed! Removed it. c7dcebb
We still have other similar unit tests that were added in other PRs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…pport-blank-child-themes
Related issues
When asked to customize a site running an installed theme (e.g. Ollie), Studio Code edited the theme's files directly. Any later theme update would silently wipe every customization — the exact failure reported in STU-2017.
How AI was used in this PR
AI assisted with implementation, code review, and simplification passes; all changes were verified with unit tests, typecheck, and lint.
Proposed Changes
scaffold_themeaccepts aparentThemeslug and scaffolds a minimal block child theme (inherits the parent's templates, parts, patterns, theme.json settings, and styles) and activates it. Customizations survive parent theme updates.style.css(Theme Handbook pattern), so parents that enqueue viaget_stylesheet_uri()keep their styling when the child is active.Testing Instructions
Child theme check:
npm run cli:build && node apps/cli/dist/cli/main.mjs codescaffold_themecall withparentTheme: 'ollie', all edits under the new child theme directory, andwp-content/themes/ollie/untouched.npm run eval -- --filter-pattern "child theme"Keep working with themes built from scratch:
npm run cli:build && node apps/cli/dist/cli/main.mjs codenpm run eval -- --filter-pattern "single-page site"Pre-merge Checklist