Add Jetpack catch-all rule for non-core feature requests - #3362
Conversation
| blocks: [], | ||
| guidance: `## Default to Jetpack for non-core needs | ||
|
|
||
| When the user wants a feature that no core block cleanly provides — sliders, slideshows, social icon menus, related-posts grids, third-party embeds beyond what core/embed handles, business hours, mailchimp signups, etc. — prefer a Jetpack block over a raw-HTML \`core/html\` block. |
There was a problem hiding this comment.
social icon exist in core.
There was a problem hiding this comment.
Good catch — core/social-links covers that. Dropped social icons from the example list in 4891b42a.
|
Can we add an eval for this, how do I test this? |
|
Added a promptfoo eval in `4891b42a`: `jetpack-catchall-slideshow` (in `eval/promptfoo.config.yaml`). It tells the agent "create a site, add a slideshow of three placeholder images" — there's no clean core block for slideshow, so the catch-all should fire. Two assertions:
To run just this test: ```sh I ran it on this branch — passes (1/1 in 2m 52s, agent installed Jetpack and used `jetpack/slideshow`). The eval is also listed in `eval/README.md`. If the assertion shape is wrong (too lenient / too strict / not the signal you want measured) happy to iterate on it. |
|
Ran a /simplify pass — pushed Applied:
Flagged out of scope (separate PR if you want it): the marker-extraction boilerplate ( |
|
I didn't test but if you did land this, it looks good to me. |
📊 Performance Test ResultsComparing c123d14 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) |
|
I need an approval :) |
youknowriad
left a comment
There was a problem hiding this comment.
By pass approvals :P It's RSM
| 1. Make sure Jetpack is active: \`wp_cli plugin install jetpack --activate\`. | ||
| 2. Discover the candidate block by listing what Jetpack has registered: | ||
| \`\`\` | ||
| wp_cli eval 'foreach (\\WP_Block_Type_Registry::get_instance()->get_all_registered() as $n => $b) if (strpos($n, "jetpack/") === 0) echo $n . PHP_EOL;' |
There was a problem hiding this comment.
Over time comes blocks might get hidden from the inserter but kept for BC, we probably should exclude the inserter hidden blocks from this.
Related issues
PLUGIN_RECOMMENDATIONSregistry and shipped the first specific rule (Jetpack Forms).How AI was used in this PR
Code change drafted by Claude after we sketched the rule in conversation. Opening as a draft because the design point ("specific rules vs. generic catch-all") isn't fully settled — Riad's preference is specific entries (form → Jetpack Forms, slider → Jetpack Slider, …), and this catch-all is offered as a complement to them, not a replacement. Claude also drafted this PR description.
Proposed Changes
Adds one new entry to
PLUGIN_RECOMMENDATIONSinapps/cli/ai/plugin-recommendations.ts:name: 'Jetpack (catch-all)', nohtmlPatterns— this rule only contributes guidance text to the system prompt; it does not enforce policy.core/html.wp_cli evalagainstWP_Block_Type_Registry) and how to enable a module if the expected block isn't registered (wp_cli jetpack module list/activate).core/html.No structural changes to
PluginRecommendation(no new fields). The current free-formguidanceprose is enough; following @youknowriad's existing design, structure is added when an automated loop needs it (htmlPatternsfor the policy loop), not preemptively.Why now / why this shape
wp_cli eval … WP_Block_Type_Registry) sidesteps the fact that Jetpack's block availability depends on which modules are active. Hard-coding a list would go stale; letting the agent introspect at runtime stays accurate.Testing Instructions
The catch-all is steering, not policy enforcement, so its effect is observable through agent behavior, not unit tests:
npm run cli:buildnode apps/cli/dist/cli/main.mjs site create --path ~/Studio/jetpack-catchall-test --name jetpack-catchall-test --skip-browserstudio ai "add a slideshow of 3 placeholder images to the homepage"studio ai "add a row of social icons (twitter, github, linkedin) to the footer"studio ai "add a related-posts grid below the main content"wp_cli evalto see what's registered, activates a module if the block it wants is gated, and uses the Jetpack block. It should NOT produce acore/htmlblock with raw<div class="slideshow">…</div>markup.cd apps/cli && npx vitest run ai/tests/block-content-policy.test.ts.I haven't run the end-to-end prompts above — leaving that for the reviewer to decide whether to validate manually or merge this on architecture/code-review alone.
Pre-merge Checklist