René's URL Explorer Experiment


Title: feat: let AI agents import HTML as editable layers by ysamcode · Pull Request #605 · ycode/ycode · GitHub

Open Graph Title: feat: let AI agents import HTML as editable layers by ysamcode · Pull Request #605 · ycode/ycode

X Title: feat: let AI agents import HTML as editable layers by ysamcode · Pull Request #605 · ycode/ycode

Description: Summary Add an opt-in import_html MCP tool that turns HTML + Tailwind into native, editable Ycode layers in one call. It reuses the editor's existing HTML import (no second converter) and returns a warning for anything dropped or converted lossily. Layer-by-layer building stays the default: agents only use it when the user asks for HTML import or provides HTML. Changes Add import_html (page or component target, optional parent and position; defaults to the page body) returning created layer ids and grouped warnings Run the shared converter on the server via linkedom; the editor's paste-HTML import keeps using the browser parser through the same code Warn about dropped tags (style, script, …), unknown tags, lossy tags (select options, picture, …), dropped attributes, relative media URLs, inline styles with no Tailwind equivalent, styled inline elements inside text, mobile-first prefixes (md:), unsupported variants, and classes with no design-panel control Keep breakpoint classes out of the desktop design object (max-md:flex-col no longer overwrites the desktop direction) Skip v3 → v4 size rescaling for agent input, which is already v4 (rounded-sm stays rounded-sm); the editor import is unchanged Register the tool in the in-app agent's deferred site group and mention it as opt-in in the instructions Round-trip check Exported all 12 sections of an existing landing page (322 layers) with export_layer_html and re-imported them: same layer count, identical classes on 312 layers, no text lost. Remaining differences come mostly from the exporter (anchor ids, non-URL links, icon classes, background images, interactions, custom names) and are left for a follow-up. Test plan Ask an agent to "import this HTML" with a Tailwind section and confirm it lands inside the page body as editable layers Confirm the response lists warnings for a relative , a