Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
feat: Add semantic Collection authoring to MCP (#5880)
Oleg Isonen03aeb535efec
diff --git a/apps/builder/app/services/api-runtime.server.test.ts b/apps/builder/app/services/api-runtime.server.test.tsindex 468e6bfd9e..3cb9586aaa 100644--- a/apps/builder/app/services/api-runtime.server.test.ts+++ b/apps/builder/app/services/api-runtime.server.test.ts@@ -1,6 +1,7 @@import { describe, expect, test } from "vitest";import { createDefaultPages } from "@webstudio-is/project-build";import type { CompactBuild } from "@webstudio-is/project-build";+import { createEmptyWebstudioFragment } from "@webstudio-is/project-build/runtime/component-template";import type { Asset } from "@webstudio-is/sdk";import {createBuilderRuntimeState,@@ -98,4 +99,43 @@ describe("api runtime adapter", () => {},});});++ test("executes semantic Collection insertion through the server runtime", async () => {+ const mutation = await executeApiRuntimeOperation({+ id: "instances.insertCollection",+ build: createBuild(),+ input: {+ projectId: "project-1",+ parentInstanceId: "root-1",+ data: { type: "json", value: [{ title: "First" }] },+ itemFragment: {+ ...createEmptyWebstudioFragment(),+ children: [{ type: "id", value: "item-root" }],+ instances: [+ {+ type: "instance",+ id: "item-root",+ component: "ws:element",+ tag: "article",+ children: [],+ },+ ],+ },+ },+ });++ expect(mutation).toMatchObject({+ payload: expect.arrayContaining([+ expect.objectContaining({ namespace: "instances" }),+ expect.objectContaining({ namespace: "props" }),+ expect.objectContaining({ namespace: "dataSources" }),+ ]),+ result: {+ collectionInstanceId: expect.any(String),+ itemRootInstanceId: expect.any(String),+ itemParameterId: expect.any(String),+ itemKeyParameterId: expect.any(String),+ },+ });+ });});diff --git a/packages/cli/src/docs.generated.ts b/packages/cli/src/docs.generated.tsindex 8d146605c3..4945b1a407 100644--- a/packages/cli/src/docs.generated.ts+++ b/packages/cli/src/docs.generated.ts@@ -2,11 +2,11 @@// Edit markdown files in src/docs instead.export const cliDocs = {"api-use-cases":- '# CLI API Use Cases\n\n## Link/configure one project\n\nCommands:\n\n- webstudio init --link <api-share-link> --json\n\nNotes:\n\n- Writes local project id and global origin/token config.\n\n## Import synced project bundle into another project\n\nCommands:\n\n- webstudio sync\n- webstudio import --to <destination-share-link>\n- MCP tool: import {"to":"<destination-share-link>"}\n\nNotes:\n\n- Imports local `.webstudio/data.json` into the destination project.\n- Destination share link must allow build/import access.\n- Use `--skip-assets` only when asset rows and files should not be imported.\n\n## Identify current token\n\nCommands:\n\n- MCP tool: whoami {}\n\n## Check token permissions\n\nCommands:\n\n- webstudio permissions --json\n\n## Inspect project/build/version\n\nCommands:\n\n- MCP tool: inspect {}\n- MCP tool: snapshot {"include":["pages","instances","styles"]}\n\n## Discover CLI/API capabilities\n\nCommands:\n\n- webstudio schema api\n- webstudio schema mcp\n- webstudio man --json\n- webstudio man llm --json\n- MCP tool: meta.index {}\n- MCP tool: meta.guide {"brief":"Create a pricing page"}\n- MCP tool: meta.get_more_tools {"brief":"update-styles"}\n- webstudio mcp list-resources\n- webstudio mcp read-resource webstudio://project/guide\n- webstudio mcp read-resource webstudio://project/expressions\n\nNotes:\n\n- Use `webstudio schema mcp` for a tiny machine-readable MCP tool overview. Use `webstudio schema mcp --detail summary` for all tool descriptions, and `webstudio schema mcp --detail full` or focused `meta.get_more_tools` calls only when exact input schemas are needed.\n- Use focused MCP tools for discovery first: `meta.index`, `meta.guide`, `meta.get_more_tools`, `components.list`, `components.summary`, `components.search`, `components.get`, `templates.list`, and `templates.get`. Protocol clients can use `resources/list` and `resources/read`; shell agents can use `webstudio mcp list-resources` and `webstudio mcp read-resource <uri>`. Read longer resources such as `webstudio://project/tools` and `webstudio://project/components` only when focused tools are insufficient.\n- Read `webstudio://project/expressions` before authoring unfamiliar computed text, prop bindings, resource expressions, actions, or Collection item bindings.\n- From a shell, call one MCP tool with the shortcut form `webstudio <tool> \'<json>\'`, for example `webstudio components.summary`. The explicit equivalent is `webstudio mcp single-op-call <tool> \'<json>\'`. Use `--input-file` for large payloads.\n\n## Inspect external shadcn registry items\n\nCommands:\n\n- webstudio registry inspect --source https://example.com/r/registry.json --item button --json\n- webstudio registry inspect --source ./registry.json --item dialog --json\n- webstudio registry inspect --source https://example.com/r/button.json --json\n\nNotes:\n\n- Reads a local or remote registry item without installing files or changing the configured Webstudio project.\n- Returns the item name, description, package and registry dependencies, file paths/targets, available docs, and a read-only compatibility report.\n- The report explicitly says whether installation or editable-component conversion is supported, lists declared requirements and manual steps, and says when arbitrary source code was not analyzed.\n- This is an inspection step only. It does not install files or change the configured project.\n\n## Understand what MCP can do\n\nCommands:\n\n- webstudio man mcp\n- MCP tool: meta.index {}\n- MCP tool: meta.guide {"brief":"What can Webstudio MCP do?"}\n\nMCP lets agents work on one configured Webstudio project. Agents can:\n\n- Inspect the linked project, token permissions, and latest editable build.\n- Read selected project data for audits, migrations, and repair.\n- Search labels, text, props, resource URLs, asset metadata, and styles.\n- Audit accessibility, security, SEO, performance settings, unused assets, ineffective Collection styles, and unused or duplicate style data.\n- Create and edit pages, folders, redirects, breakpoints, and page templates.\n- Create pages from reusable templates.\n- Update page metadata, SEO fields, auth settings, and marketplace metadata.\n- Insert components and styled JSX sections.\n- Move, copy, wrap, unwrap, convert, rename, retag, and delete elements.\n- Update text, rich text, props, bindings, and actions.\n- Create and update local styles, design tokens, style sources, and CSS variables.\n- Create static data variables and JSON variables.\n- Create HTTP, GraphQL, and system resources.\n- Use system resources for sitemap, current date, and assets.\n- Bind resources to rendered data or form/action props.\n- Upload, replace, delete, and inspect asset usage.\n- Publish, unpublish, inspect publish jobs, and manage custom domains.\n- Start preview, capture screenshots, compare screenshot diffs, and use OCR when installed.\n\n## Inspect and refresh MCP session cache\n\nCommands:\n\n- MCP tool: status {}\n- MCP tool: status {"verbose":true}\n- MCP tool: refresh {"namespaces":["pages","instances","styles"]}\n- MCP tool: reset-session {}\n\nNotes:\n\n- Use status before a task to understand the cached ProjectSession state.\n- Use status with `{"verbose":true}` only when debugging full namespaces, freshness, compatibility, or diagnostics.\n- Use refresh when project data may have changed outside the current MCP session.\n- Use reset-session when local cached state is corrupt or incompatible.\n\n## Visually verify rendered work with AI vision\n\nCommands:\n\n- MCP tool: preview.start {"host":"127.0.0.1","port":5173}\n- MCP tool: preview.status {}\n- MCP tool: preview.stop {}\n- MCP tool: screenshot {"path":"/","output":".webstudio/screenshots/home-current.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n- MCP tool: screenshot {"path":"/pricing","output":".webstudio/screenshots/pricing-current.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n- MCP tool: screenshot {"baseUrl":"http://127.0.0.1:5177","path":"/pricing","output":".webstudio/screenshots/pricing-current.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n- MCP tool: screenshot.diff {"baselinePath":".webstudio/screenshots/home-before.png","currentPath":".webstudio/screenshots/home-current.png","outputDir":".webstudio/screenshots/diff"}\n- MCP tool: screenshot.diff {"baselinePath":".webstudio/screenshots/home-before.png","currentPath":".webstudio/screenshots/home-current.png","outputDir":".webstudio/screenshots/diff","expectedText":["Pricing","Start free"]}\n- MCP tool: screenshot.diff {"baselinePath":".webstudio/screenshots/home-before.png","currentPath":".webstudio/screenshots/home-current.png","outputDir":".webstudio/screenshots/diff","expectedVisual":{"maxMismatchPercentage":2,"maxChangedRegions":3,"dominantColorChange":{"channel":"luminance","direction":"increase","minMagnitude":10}}}\n- MCP tool: screenshot.diff {"baselinePath":".webstudio/screenshots/pricing-before.png","currentPath":".webstudio/screenshots/pricing-current.png","outputDir":".webstudio/screenshots/diff"}\n- MCP tool: vision.install-ocr {"confirm":true}\n\nNotes:\n\n- Use this after page/content/style mutations and after generated project files are current so a vision-capable AI can see the production-like generated site.\n- For multi-page work, capture every changed page by `path` through the same preview server; no click navigation is required.\n- After MCP mutations, path screenshots regenerate/restart preview as needed before capture; when preview is fresh, repeated path screenshots reuse the running server.\n- Do not call `preview.start` through one-shot `webstudio mcp single-op-call`: it is long-lived. From a shell, use `webstudio mcp run` with preview.start, screenshot, and preview.stop in one shared process, or use a real long-running MCP client.\n- From one-shot shell calls or another process, pass `baseUrl` with `path` to capture an already-running preview/site without generating, building, starting, or restarting preview.\n- Use preview.stop only in the same long-running MCP server or `webstudio mcp run` process that started preview. A separate one-shot `single-op-call` process does not own another process\'s preview controller.\n- Use waitForSelector when the rendered app has a reliable ready marker, waitUntil:"networkidle" for network-heavy pages, and waitForTimeout only for final visual settling.\n- Preview installs generated app dependencies under `.webstudio/preview` and reuses them across regenerations.\n- Do not add generated-preview dependencies to the repository root `package.json` or `pnpm-lock.yaml`.\n- If dependency installation fails, check npm and network configuration, then reinstall or update the Webstudio CLI if the problem persists.\n- When a baseline exists, use screenshot.diff once per baseline/current page or viewport pair to get changed regions, OCR textAnalysis, and diff artifact paths before deciding whether the result matches. Pass expectedText for explicit pass/fail current-screen text assertions with found and missing text. Pass expectedVisual for pass/fail limits on pixel mismatch percentage, changed-region count, or the overall dominant color/brightness direction.\n- If screenshot.diff reports OCR unavailable and the user agrees to install it, call vision.install-ocr {"confirm":true}; otherwise continue with pixel diff and visual inspection.\n- Compare the PNG, OCR text evidence, and diff artifacts against the user\'s intent for layout, typography, colors, spacing, imagery, and responsive framing; then iterate with focused mutations.\n- Root CLI equivalent: `webstudio screenshot --path /pricing --output pricing.png` generates a temporary production preview, captures that route, and stops the server. For repeated captures, keep `webstudio preview` running and pass its absolute URL to `webstudio screenshot`.\n\n## List pages\n\nCommands:\n\n- MCP tool: list-pages {"includeFolders":true}\n\n## Read page by id\n\nCommands:\n\n- MCP tool: get-page {"pageId":"<pageId>"}\n\n## Read page by path\n\nCommands:\n\n- MCP tool: get-page-by-path {"path":"/pricing"}\n\n## Create page\n\nCommands:\n\n- MCP tool: create-page {"name":"Pricing","path":"/pricing"}\n- MCP tool: create-page {"name":"Pricing","path":"/pricing","title":"Pricing","meta":{"description":"Plans for teams"}}\n\nNotes:\n\n- `name`, `path`, page `title`, and metadata text fields accept plain fixed values.\n- For computed page titles or metadata, send JavaScript expression code such as `pageTitle ?? "Pricing"`.\n\n## Update page settings/metadata\n\nCommands:\n\n- MCP tool: update-page {"pageId":"<pageId>","values":{"title":"Pricing","meta":{"description":"Plans","status":"200"}}}\n- MCP tool: update-page {"pageId":"<pageId>","values":{"meta":{"auth":{"login":"<login>","password":"<password>"}}}}\n\nNotes:\n\n- Page `title` and metadata text fields accept plain fixed values.\n- For computed page titles or metadata, send JavaScript expression code such as `pageTitle ?? "Pricing"`.\n\n## Read project settings\n\nCommands:\n\n- MCP tool: get-project-settings {}\n\nNotes:\n\n- Read `meta.agentInstructions` before making project changes. It contains the project\'s own guidance for AI agents.\n- Agent instructions are shared project guidance. Do not store credentials or other secrets there.\n\n## Update project settings\n\nCommands:\n\n- MCP tool: update-project-settings {"meta":{"siteName":"Acme"}}\n- MCP tool: update-project-settings {"meta":{"agentInstructions":"Use existing design tokens and keep product copy concise."}}\n\n## Read marketplace product\n\nCommands:\n\n- MCP tool: get-marketplace-product {}\n\n## Update marketplace product\n\nCommands:\n\n- MCP tool: update-marketplace-product {"category":"pageTemplates","name":"Acme Template","thumbnailAssetId":"asset-id","author":"Acme Studio","email":"[email protected]","website":"https://example.com","issues":"","description":"Reusable template project for Acme landing pages."}\n\n## List redirects\n\nCommands:\n\n- MCP tool: list-redirects {}\n\n## Create redirect\n\nCommands:\n\n- MCP tool: create-redirect {"old":"/old","new":"/new","status":301}\n\n## Update redirect\n\nCommands:\n\n- MCP tool: update-redirect {"old":"/old","values":{"new":"/newer","status":302}}\n- MCP tool: update-redirect {"old":"/old","values":{"status":null}}\n\n## Delete redirect\n\nCommands:\n\n- MCP tool: delete-redirect {"old":"/old"}\n\n## Set redirects\n\nCommands:\n\n- MCP tool: set-redirects {"redirects":[{"old":"/old","new":"/new","status":"301"}]}\n\n## List breakpoints\n\nCommands:\n\n- MCP tool: list-breakpoints {}\n\n## Create breakpoint\n\nCommands:\n\n- MCP tool: create-breakpoint {"label":"Tablet","maxWidth":991}\n\n## Update breakpoint\n\nCommands:\n\n- MCP tool: update-breakpoint {"breakpointId":"tablet","values":{"label":"Tablet","maxWidth":1023}}\n- MCP tool: update-breakpoint {"breakpointId":"tablet","values":{"condition":null,"minWidth":768}}\n- MCP tool: update-breakpoint {"breakpointId":"tablet","values":{"minWidth":null,"maxWidth":null,"condition":"(hover: hover)"}}\n\n## Delete breakpoint\n\nCommands:\n\n- MCP tool: delete-breakpoint {"breakpointId":"tablet"}\n\n## Duplicate page\n\nCommands:\n\n- MCP tool: duplicate-page {"pageId":"<pageId>","name":"Pricing Copy","path":"/pricing-copy"}\n\n## List page templates\n\nCommands:\n\n- MCP tool: list-page-templates {}\n\n## Create page template\n\nCommands:\n\n- MCP tool: create-page-template {"name":"Landing Template","title":"Landing"}\n\n## Update page template\n\nCommands:\n\n- MCP tool: update-page-template {"templateId":"<templateId>","values":{"name":"Article Template","meta":{"description":"Reusable article layout"}}}\n\n## Delete page template\n\nCommands:\n\n- MCP tool: delete-page-template {"templateId":"<templateId>"}\n\n## Duplicate page template\n\nCommands:\n\n- MCP tool: duplicate-page-template {"templateId":"<templateId>"}\n\n## Reorder page template\n\nCommands:\n\n- MCP tool: reorder-page-template {"sourceTemplateId":"<sourceTemplateId>","targetTemplateId":"<targetTemplateId>","position":"before"}\n\n## Create page from template\n\nCommands:\n\n- MCP tool: create-page-from-template {"templateId":"<templateId>","name":"Landing","path":"/landing"}\n\n## Delete page\n\nCommands:\n\n- MCP tool: delete-page {"pageId":"<pageId>"}\n\n## List folders\n\nCommands:\n\n- MCP tool: list-folders {"includePages":true}\n\n## Create folder\n\nCommands:\n\n- MCP tool: create-folder {"name":"Blog","slug":"blog"}\n\n## Update folder\n\nCommands:\n\n- MCP tool: update-folder {"folderId":"<folderId>","values":{"name":"Blog","slug":"blog"}}\n\n## Delete folder\n\nCommands:\n\n- MCP tool: delete-folder {"folderId":"<folderId>"}\n\n## List element instances\n\nCommands:\n\n- MCP tool: list-instances {"pagePath":"/","maxDepth":3}\n\n## Inspect one element instance\n\nCommands:\n\n- MCP tool: inspect-instance {"instanceId":"<instanceId>","include":["props","styles","children"]}\n\n## Insert authored JSX or one component template\n\nCommands:\n\n- MCP tool: insert-fragment {"parentInstanceId":"<instanceId>","fragment":"<ws.element ws:tag=\\"section\\" ws:style={css`padding: 32px;`}><ws.element ws:tag=\\"h2\\">Product OS</ws.element><radix.Switch><radix.SwitchThumb /></radix.Switch></ws.element>"}\n- MCP tool: insert-component {"parentInstanceId":"<instanceId>","component":"@webstudio-is/sdk-components-react-radix:Switch"}\n- MCP tool: insert-component {"parentInstanceId":"<instanceId>","component":"Form"}\n\nNotes:\n\n- Use MCP `insert-fragment` as the default way to author styled component trees. It converts JSX to a structured fragment before mutation.\n- Use only exact component ids returned by `components.search`, `components.get`, or `templates.get`. Never derive or guess component ids.\n- The `ws:` namespace contains specific Webstudio core components; it is not HTML-tag shorthand. Use `<ws.element ws:tag="div">` for a native `div` and `<ws.element ws:tag="form">` for a native form, never `<ws.div>` or `<ws.form>`.\n- For Webstudio\'s complete form structure, discover the Form component and insert its automatic template with `insert-component` using component `"Form"`.\n- MCP receives JSX as a JSON string because MCP arguments are JSON. The CLI converts it locally before the runtime mutation, so the project session receives structured Webstudio data, not JSX source.\n- In `insert-fragment` JSX, use `ws:style={css\\`...\\`}`for Webstudio-native CSS, or use React-style object syntax such as`style={{ padding: 24 }}` when that is simpler. Both forms create editable Webstudio style data.\n- Do not access host globals or dynamic code APIs in JSX fragments, including `process`, `globalThis`, `eval`, `Function`, or `constructor`.\n- Use Webstudio prop names such as `class` and `for`; do not use React aliases `className` or `htmlFor`.\n- Use Webstudio actions for event/action props, for example `onClick={new ActionValue(["event"], expression\\`console.log(event)\\`)}`. Do not pass JavaScript functions such as `onClick={() => ...}`.\n- Plain prop values must be JSON-compatible: `null`, strings, booleans, finite numbers, arrays, and plain objects. Do not pass `undefined`, `Symbol`, `BigInt`, `NaN`, `Infinity`, `Date`, `Map`, `Set`, class instances, or circular objects; omit the prop, use plain data, or use `expression`/`ActionValue` when the value is dynamic.\n- Template-backed components used in JSX must include required child/part components explicitly under the same parent structure as the template, for example `<radix.Switch><radix.SwitchThumb /></radix.Switch>`.\n- Webstudio applies a registered template automatically when using `insert-component`, so composed components such as Switch include required child parts and styles.\n- Use `components.list`, `components.summary`, `components.search`, `components.get`, `templates.list`, and `templates.get` to discover known registry items, component ids, props, templates, insertability, and content model. Read `webstudio://project/components` only when those focused tools are insufficient.\n- Component/template registry items use a shadcn-compatible top-level shape plus Webstudio-specific superset metadata in `meta`. They are for Builder/MCP discovery, not a published shadcn install registry yet.\n- Known components with `contentModel.category: "none"` are not standalone-insertable; insert their root component template instead so required providers/parents are included.\n- Unknown custom component ids are a low-level extension mechanism, not a discovery fallback. Agents must not synthesize them.\n\n## Make a region editable in Content mode\n\nCommands:\n\n- MCP tool: insert-component {"parentInstanceId":"<instanceId>","component":"ws:block"}\n- MCP tool: inspect-instance {"instanceId":"<instanceId>","include":["children"]}\n\nNotes:\n\n- When a page will be handed to a Content-mode editor, wrap every region they should be able to edit in a Content Block (`ws:block`). Content-mode editors can edit text and supported props only in Content Block descendants. Content outside those blocks remains read-only, even when it looks like ordinary editable text.\n- Put reusable insertable options inside the Content Block\'s `ws:block-template` child. A template is source material, not editor content: editors cannot edit or delete it directly. When an editor inserts a template, its copy becomes a direct child of the Content Block and is editable.\n- Before handing off a page, verify with `inspect-instance` that the intended text, images, and links are inside a Content Block, and that templates include all required styling because Content-mode editors cannot use the Style panel.\n\n## Move elements\n\nCommands:\n\n- MCP tool: move-instance {"moves":"moves.json contents"}\n\nNotes:\n\n- Use `position: "end"` to append an instance. Repeating this for A and then B preserves the final order A, B.\n- A numeric `insertIndex` addresses the target parent\'s children before the moved instance is removed. Use it for exact placement; do not calculate the last index to append.\n- Moves in one `moves` array are applied sequentially in array order.\n\n## Clone element subtree\n\nCommands:\n\n- MCP tool: clone-instance {"sourceInstanceId":"<instanceId>","targetParentInstanceId":"<targetParentId>"}\n\n## Delete element subtree\n\nCommands:\n\n- MCP tool: delete-instance {"instanceIds":["<instanceId>"]}\n\n## List text/expression children\n\nCommands:\n\n- MCP tool: list-texts {"pagePath":"/"}\n\n## Update text child\n\nCommands:\n\n- MCP tool: update-text {"instanceId":"<instanceId>","childIndex":0,"text":"Launch faster"}\n\n## Replace bounded literal text\n\nCommands:\n\n- MCP tool: replace-text {"find":"Start free","replace":"Get started","match":"exact","pagePath":"/pricing","limit":20}\n\nNotes:\n\n- This changes only literal text children, never expression children. Scope it to pagePath or pageId and set a limit before a broad replacement.\n\n## Replace bounded static prop text\n\nCommands:\n\n- MCP tool: replace-prop-text {"find":"old.example.com","replace":"www.example.com","match":"substring","names":["href","code"],"limit":20}\n\nNotes:\n\n- This changes only static string props such as href, alt, aria-label, title, and HTML embed code. It never changes expressions, resources, actions, assets, or other dynamic bindings. Use names or instanceIds and a limit to narrow the change.\n\n## Replace bounded resource text\n\nCommands:\n\n- MCP tool: replace-resource-text {"find":"api.old.example.com","replace":"api.example.com","fields":["url"],"limit":20}\n\nNotes:\n\n- This changes resource names and fixed URL literals only. It skips dynamic URL expressions, headers, search parameters, request bodies, and GraphQL query code.\n\n## Update props\n\nCommands:\n\n- MCP tool: update-props {"updates":"props.json contents"}\n- MCP tool: replace-prop-text {"find":"Old label","replace":"New label","names":["aria-label","title"],"limit":20}\n\nNotes:\n\n- Use this for fixed prop values such as `aria-label`, `alt`, `id`, static `href`, and other direct string/number/boolean/json prop values.\n\n## Add JSON-LD structured data\n\nCommands:\n\n- MCP tool: components.get {"component":"JsonLd"}\n- MCP tool: insert-component {"parentInstanceId":"<headSlotInstanceId>","component":"JsonLd"}\n- MCP tool: update-props {"updates":[{"instanceId":"<jsonLdInstanceId>","name":"code","type":"string","value":"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Organization\\",\\"name\\":\\"Acme\\"}"}]}\n- MCP tool: audit {"scopes":["seo"],"pagePath":"/"}\n\nNotes:\n\n- Prefer placing `JsonLd` inside `HeadSlot`.\n- Store `code` as a JSON object or array encoded as a compact string. The Builder formats it for editing.\n- The semantic prop update rejects malformed JSON and structurally invalid fixed JSON-LD with a precise JSON path.\n- The SEO audit also warns about a missing top-level `@context`, unknown or superseded Schema.org terms, properties unsupported by the supplied type, and incompatible primitive value types.\n- Schema.org vocabulary findings are warnings because custom vocabularies and extensions remain valid. Dynamic JSON-LD is marked as skipped for rendered validation.\n- Do not use bindings just to set static text.\n\n## Delete props\n\nCommands:\n\n- MCP tool: delete-props {"deletions":"props.json contents"}\n\n## Bind props to expressions/resources/actions\n\nCommands:\n\n- MCP tool: bind-props {"bindings":"bindings.json contents"}\n\nNotes:\n\n- Use this only when the prop should remain dynamic: expression, resource, action, or an existing scoped runtime context value such as `system`.\n- For a fixed string value, use `update-props` with `type:"string"` and a direct `value` instead.\n\n## Read styles\n\nCommands:\n\n- MCP tool: get-styles {"instanceIds":["<instanceId>"],"includeTokens":true}\n\n## Update local styles\n\nCommands:\n\n- MCP tool: update-styles {"updates":"styles.json contents"}\n\n## Delete local styles\n\nCommands:\n\n- MCP tool: delete-styles {"deletions":"styles.json contents"}\n\n## Replace matching style values\n\nCommands:\n\n- MCP tool: replace-styles {"property":"color","fromValue":{"type":"keyword","value":"red"},"toValue":{"type":"keyword","value":"blue"}}\n\n## List design tokens\n\nCommands:\n\n- MCP tool: list-design-tokens {}\n- MCP tool: list-design-tokens {"withUsage":true}\n- MCP tool: list-design-tokens {"includeStyles":true}\n\nNotes:\n\n- The default response is compact and includes token id, name, declaration count, and optional usage count.\n- Use `includeStyles:true` only when you need the full inline style declarations.\n\n## Create design tokens\n\nCommands:\n\n- MCP tool: create-design-token {"tokens":"tokens.json contents"}\n\n## Update design token styles\n\nCommands:\n\n- MCP tool: update-design-token-styles {"designTokenId":"<tokenId>","updates":"styles.json contents"}\n\n## Delete design token styles\n\nCommands:\n\n- MCP tool: delete-design-token-styles {"designTokenId":"<tokenId>","deletions":"styles.json contents"}\n\n## Attach design token to instances\n\nCommands:\n\n- MCP tool: attach-design-token {"designTokenId":"<tokenId>","instanceIds":"instances.json contents"}\n\n## Detach design token from instances\n\nCommands:\n\n- MCP tool: detach-design-token {"designTokenId":"<tokenId>","instanceIds":"instances.json contents"}\n\n## Extract design token from local styles\n\nCommands:\n\n- MCP tool: extract-design-token {"instanceIds":["<instanceId>"],"name":"Brand Primary","removeLocalProps":["color"]}\n\n## List CSS variables\n\nCommands:\n\n- MCP tool: list-css-variables {"withUsage":true}\n\n## Define CSS variables\n\nCommands:\n\n- MCP tool: define-css-variable {"vars":"vars.json contents"}\n\n## Delete CSS variables\n\nCommands:\n\n- MCP tool: delete-css-variable {"names":"names.json contents","force":true}\n\n## Rewrite CSS variable references\n\nCommands:\n\n- MCP tool: rewrite-css-variable-refs {"map":"variables.json contents"}\n\n## List data variables\n\nCommands:\n\n- MCP tool: list-variables {}\n- MCP tool: list-variables {"scopeInstanceId":"<instanceId>"}\n\nNotes:\n\n- Data variables live in the internal `dataSources` namespace.\n- For raw `snapshot`, request the public `variables` namespace rather than the internal `dataSources` name. Raw patch payloads still use `dataSources` when applying direct changes.\n- Scope variables to the instance where they should become available. Descendants can use them in expressions, and nested variables with the same name mask outer variables.\n\n## Create data variable\n\nCommands:\n\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"title","value":{"type":"string","value":"Hello"}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"count","value":{"type":"number","value":3}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"featured","value":{"type":"boolean","value":true}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"tags","value":{"type":"string[]","value":["news","product"]}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"filters","value":{"type":"json","value":{"tag":"news"}}}\n\nNotes:\n\n- Data variable values support `string`, `number`, `boolean`, `string[]`, and `json`.\n- Parameters are internal scoped runtime values provided by pages, collections, or components. They are not a public authoring surface: do not create, update, or delete parameter records. Use data variables/resources for user-authored data, and reference documented context values such as `system` only where they are already in scope.\n\n## Update data variable\n\nCommands:\n\n- MCP tool: update-variable {"dataSourceId":"<variableId>","values":{"value":{"type":"json","value":{"count":1}}}}\n\n## Delete data variable\n\nCommands:\n\n- MCP tool: delete-variable {"dataSourceId":"<variableId>"}\n\n## List resources\n\nCommands:\n\n- MCP tool: list-resources {}\n- MCP tool: list-resources {"scopeInstanceId":"<instanceId>"}\n\n## Create resource\n\nCommands:\n\n- MCP tool: create-resource {"resource":{"name":"Posts","method":"get","url":"https://api.example.com/posts","headers":[]}}\n- MCP tool: create-resource {"resource":{"name":"Posts","method":"get","url":"\\"https://api.example.com/posts?tag=\\" + filters.tag","headers":[]},"scopeInstanceId":"<instanceId>","dataSourceName":"posts"}\n- MCP tool: create-resource {"resource":{"name":"Filtered Posts","method":"get","url":"https://api.example.com/posts","searchParams":[{"name":"tag","value":"filters.tag"},{"name":"source","value":{"type":"literal","value":"website"}}],"headers":[{"name":"Authorization","value":"\\"Bearer \\" + auth.token"}]},"scopeInstanceId":"<instanceId>","dataSourceName":"posts"}\n- MCP tool: create-resource {"resource":{"name":"Post GraphQL","control":"graphql","method":"post","url":"https://api.example.com/graphql","headers":[{"name":"Content-Type","value":{"type":"literal","value":"application/json"}}],"body":"{ query: \\"query Post($slug: String!) { post(slug: $slug) { title } }\\", variables: { slug: system.params.slug } }"},"scopeInstanceId":"<instanceId>","dataSourceName":"post"}\n- MCP tool: create-resource {"resource":{"name":"Current Date","control":"system","method":"get","url":"/$resources/current-date","headers":[]},"scopeInstanceId":"<instanceId>","dataSourceName":"currentDate"}\n\nNotes:\n\n- Resource `url` accepts plain fixed URLs and paths such as `https://api.example.com/posts` and `/$resources/current-date`.\n- Resource `url` can also be a JavaScript expression when it is computed, such as `"https://api.example.com/posts?tag=" + filters.tag`.\n- Header values, search parameter values, and body accept expressions for dynamic values. For fixed text, use `{"type":"literal","value":"application/json"}`; Webstudio stores the required string expression for you.\n- Search parameter values, header values, and body expressions can read scoped variables and documented runtime context values such as `system` when they are available at the resource scope.\n- Add `scopeInstanceId` and `dataSourceName` when the resource result should be exposed as a scoped read data variable. Scoped resources are generated into the page resource `data` map and may be loaded during page rendering. Use this for read-oriented resources such as GET CMS/API data.\n- For submit/write/action resources, create the resource without `scopeInstanceId`, then bind a component prop such as a Form `action` with `bind-props` and `binding.type: "resource"`. Prop-bound resources are generated into the page resource `action` map instead of the read `data` map. Use this for POST, PUT, DELETE, webhooks, GraphQL submissions, and other explicit action flows.\n- Resource `method` can be `get`, `post`, `put`, or `delete`. Use GET for read data, POST for creates/GraphQL/webhooks/form submissions, PUT for full updates or replacements, and DELETE for deletion actions.\n- Optional `control` values are `graphql` and `system`. Use `graphql` for GraphQL-style requests, usually POST with a query body. Use `system` for built-in resources such as `"/$resources/sitemap.xml"`, `"/$resources/current-date"`, and `"/$resources/assets"` and when the resource should use the built-in `system` parameter. System fields are `system.origin`, `system.pathname`, `system.params`, and `system.search`.\n\n## Update resource\n\nCommands:\n\n- MCP tool: update-resource {"resourceId":"<resourceId>","values":{"url":"https://api.example.com/posts"}}\n- MCP tool: replace-resource-text {"find":"api.old.example.com","replace":"api.example.com","fields":["url"],"limit":20}\n\n## Delete resource\n\nCommands:\n\n- MCP tool: delete-resource {"resourceId":"<resourceId>"}\n\n## List assets\n\nCommands:\n\n- MCP tool: list-assets {"withUsage":true}\n\nNotes:\n\n- Image asset descriptions are the default alt text for asset-backed Image components.\n- To generate missing descriptions, inspect the image in its rendered page or asset source, write a concise description of its purpose, and save it on the asset rather than duplicating it on each Image instance.\n\n## Update asset metadata\n\nCommands:\n\n- MCP tool: update-asset {"assetId":"<assetId>","values":{"description":"Team collaborating around a whiteboard"}}\n\nNotes:\n\n- Use an empty description only when the image is intentionally decorative.\n- Updating an image asset description updates the default alt text wherever that asset is used with an asset-backed alt prop.\n\n## Generate missing image descriptions with an agent\n\nCommands:\n\n- MCP tool: audit {"scopes":["accessibility"],"verbose":true}\n- MCP tool: set-image-descriptions {"updates":[{"assetId":"hero-id","description":"Team collaborating around a whiteboard"},{"assetId":"texture-id","decorative":true}]}\n- MCP tool: audit {"scopes":["accessibility"]}\n\nNotes:\n\n- Start from `missing-image-description` findings. Inspect each image in its rendered page context before writing text.\n- The vision-capable agent generates the wording; the CLI validates and stores it but does not contain its own vision model.\n- Use `decorative:true` only when the image adds no information. This intentionally stores an empty description so later audits do not report it as missing.\n- Re-run the accessibility audit after the update. Asset-backed Image components use the saved asset description as their default alt text.\n\n## Manage fonts\n\nCommands:\n\n- MCP tool: list-fonts {"includeSystem":true}\n- MCP tool: list-assets {"type":"font"}\n- MCP tool: upload-asset {"asset":{"name":"acme-sans.woff2","type":"font","format":"woff2","meta":{"family":"Acme Sans","style":"normal","weight":400}},"assetsDir":".webstudio/assets"}\n- MCP tool: update-styles {"updates":"styles.json contents"}\n\nNotes:\n\n- Use `list-fonts` to discover uploaded families and system stacks. Upload/delete fonts through the existing asset tools, then apply a family with a `font-family` style declaration.\n\n## Upload one asset\n\nCommands:\n\n- MCP tool: upload-asset {"asset":{"name":"image.png","type":"image","format":"png","meta":{"width":1200,"height":630}},"assetsDir":".webstudio/assets"}\n\n## Upload asset batch\n\nCommands:\n\n- MCP tool: upload-assets {"assets":[{"name":"image.png","type":"image","format":"png","meta":{"width":1200,"height":630}}],"assetsDir":".webstudio/assets"}\n\n## Find asset usage\n\nCommands:\n\n- MCP tool: find-asset-usage {"assetId":"<assetId>"}\n\n## Replace asset references\n\nCommands:\n\n- MCP tool: replace-asset {"fromAssetId":"<oldAssetId>","toAssetId":"<newAssetId>"}\n\n## Delete assets\n\nCommands:\n\n- MCP tool: delete-asset {"assetIdsOrPrefixes":["<assetId>"],"force":true}\n\n## Publish project\n\nCommands:\n\n- webstudio publish deploy --target production --json\n\n## List publishes\n\nCommands:\n\n- webstudio publish list --json\n\n## Check publish job\n\nCommands:\n\n- webstudio publish status --job <buildId> --json\n\n## Unpublish\n\nCommands:\n\n- webstudio publish unpublish --target production --confirm --json\n\n## List domains\n\nCommands:\n\n- webstudio domains list --json\n\n## Create domain\n\nCommands:\n\n- webstudio domains create --domain example.com --json\n\n## Update domain\n\nCommands:\n\n- webstudio domains update --domain-id <domainId> --domain www.example.com --json\n\n## Delete domain\n\nCommands:\n\n- webstudio domains delete --domain-id <domainId> --confirm --json\n\n## Verify domain\n\nCommands:\n\n- webstudio domains verify --domain-id <domainId> --json\n\n## Make arbitrary store-level changes\n\nCommands:\n\n- MCP tool: inspect {}\n- MCP tool: snapshot {"include":["<namespace>"]}\n- MCP tool: apply-patch {"baseVersion":"<version>","transactions":"patch.json contents"}\n\nNotes:\n\n- Use only when no semantic command exists.\n\n## Manage marketplace metadata\n\nCommands:\n\n- MCP tool: get-marketplace-product {}\n- MCP tool: update-marketplace-product {"category":"pageTemplates","name":"Acme Template","thumbnailAssetId":"asset-id","author":"Acme Studio","email":"[email protected]","website":"https://example.com","issues":"","description":"Reusable template project for Acme landing pages."}\n\nPatch namespaces:\n\n- marketplaceProduct\n\n## Search and inspect safely\n\nCommands:\n\n- MCP tool: search-project {"query":"pricing"}\n- MCP tool: search-project {"query":"api.example.com","scopes":["resources"]}\n- MCP tool: list-instances {"pagePath":"/","maxDepth":5}\n- MCP tool: inspect-instance {"instanceId":"<instanceId>","include":["props","styles","children"]}\n- MCP tool: list-texts {"pagePath":"/"}\n- MCP tool: list-assets {"withUsage":true}\n- MCP tool: find-asset-usage {"assetId":"<assetId>"}\n- MCP tool: snapshot {"include":["pages","instances","props","resources","assets"]}\n\nNotes:\n\n- Use `search-project` for query-driven lookup across labels, text, prop values, resource URLs, asset metadata, and styles. Use `audit` for project health findings.\n\n## Audit project quality\n\nCommands:\n\n- webstudio audit --json\n- webstudio audit --scopes accessibility --scopes seo --json\n- webstudio audit --page-path /pricing --json\n- webstudio audit --scopes accessibility --verbose --json\n- webstudio audit --rendered --page-path /pricing --json\n- webstudio audit --rendered --route-example post=/blog/hello --json\n- webstudio audit --rendered --image-domain images.example.com --json\n- MCP tool: audit {}\n- MCP tool: audit {"scopes":["accessibility","security"],"severities":["error","warning"]}\n- MCP tool: audit {"scopes":["accessibility"],"verbose":true}\n- MCP tool: audit {"rendered":true,"verbose":true}\n\nNotes:\n\n- With no scopes, `audit` checks accessibility, security, SEO, performance settings, unused assets, ineffective Collection styles, non-GET resources exposed as render-time data, and unused or duplicate style data.\n- The `performance` scope reports disabled atomic CSS generation. A rendered audit also measures broken, eager below-fold, and oversized images, browser-marked render-blocking resources, and legacy font formats.\n- Rendered image and resource metrics run only when the selected scopes include `performance`; responsive layout dimensions remain available whenever `rendered:true` is requested.\n- Compact findings include stable ids, severity, message, and location. Use `--verbose` or `{"verbose":true}` for evidence, explanation, suggested remediation, skipped-check details, and manual-check workflows.\n- `summary` counts all findings before severity filtering and pagination.\n- `contractVersion` identifies the audit response contract. Handle a new value before assuming existing fields retain the same meaning.\n- Expression-, resource-, and parameter-backed values that cannot be checked reliably appear in `skippedChecks`; they are not treated as passing or failing.\n- Page filters apply to page-owned accessibility, security, and SEO checks. Asset and style usage remain project-wide to avoid false unused findings.\n- Continue paginated results with `cursor`. Restart the audit if the project version changes.\n- Verbose skipped-check and manual-check details are included on the first findings page only; their total counts remain available on every page.\n- `manualChecks` describes responsive, hierarchy, and contrast checks that require preview screenshots and vision.\n- Focused audits return only manual checks relevant to their selected scopes.\n- In a long-lived MCP session, `{"rendered":true}` reuses preview and screenshot\n tools to capture every static page at mobile, desktop, and Builder breakpoint\n edges. Compact output reports rendered check/issue/failure counts; verbose\n output includes screenshot paths and measured layout dimensions.\n- Dynamic route templates are skipped unless `--route-example <pageId>=<path>`\n (or MCP `routeExamples`) supplies a concrete path. The path must not contain\n unresolved `:` or `*` parameters.\n- Plans above 120 captures return a short-lived confirmation token. Review the\n unchanged plan, then rerun with `--confirm-large-run` and\n `--confirmation-token`.\n- Detailed rendered evidence is stored in a versioned manifest under\n `.webstudio/audits`; compact output includes its path and screenshot count.\n- Rendered checks also report broken images, eager images below the fold, and\n image sources more than 2x their rendered dimensions in both axes, including\n Webstudio instance ids and measured dimensions when available.\n- Rendered checks include sanitized Resource Timing evidence and report\n browser-marked render-blocking resources plus legacy `.ttf`, `.otf`, and\n `.woff` fonts without applying a universal transfer-size threshold.\n- Fix findings through semantic mutation commands, then rerun `audit` to confirm their deterministic finding ids disappeared.\n\n## Refactor targeted content\n\nCommands:\n\n- MCP tool: list-instances {"pagePath":"/"}\n- MCP tool: list-texts {"pagePath":"/"}\n- MCP tool: update-text {"instanceId":"<instanceId>","childIndex":0,"text":"Launch faster"}\n- MCP tool: replace-text {"find":"Old headline","replace":"New headline","match":"exact","pagePath":"/pricing","limit":20}\n- MCP tool: update-props {"updates":"props.json contents"}\n- MCP tool: update-page {"pageId":"<pageId>","values":{"title":"Pricing","meta":{"description":"Plans"}}}\n- MCP tool: update-resource {"resourceId":"<resourceId>","values":{"url":"https://api.example.com/posts"}}\n- MCP tool: replace-asset {"fromAssetId":"<oldAssetId>","toAssetId":"<newAssetId>"}\n- MCP tool: replace-styles {"property":"color","fromValue":{"type":"keyword","value":"red"},"toValue":{"type":"keyword","value":"blue"}}\n- MCP tool: rewrite-css-variable-refs {"map":"variables.json contents"}\n\nNotes:\n\n- Use focused reads first, then mutate only matching instances, props, metadata, resource URLs, assets, or style references. Use `replace-text` for bounded literal text changes, `replace-prop-text` for bounded static prop text, `replace-resource-text` for fixed resource names/URLs, and `update-text` for one known child or expressions.\n\n## Optimize existing project\n\nCommands:\n\n- MCP tool: list-pages {"includeFolders":true}\n- MCP tool: update-page {"pageId":"<pageId>","values":{"title":"Pricing","meta":{"description":"Plans"}}}\n- MCP tool: update-props {"updates":"props.json contents"}\n- MCP tool: list-breakpoints {}\n- MCP tool: update-breakpoint {"breakpointId":"tablet","values":{"maxWidth":1023}}\n- MCP tool: get-styles {"instanceIds":["<instanceId>"],"includeTokens":true}\n- MCP tool: update-styles {"updates":"styles.json contents"}\n- MCP tool: attach-design-token {"designTokenId":"<tokenId>","instanceIds":"instances.json contents"}\n- MCP tool: update-project-settings {"meta":{"siteName":"Acme"}}\n\nNotes:\n\n- Use this for SEO metadata, accessibility labels, responsive behavior, token consistency, and project settings.\n\n## Connect external data\n\nCommands:\n\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"title","value":{"type":"string","value":"Hello"}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"tags","value":{"type":"string[]","value":["news","product"]}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"filters","value":{"type":"json","value":{"tag":"news"}}}\n- MCP tool: create-resource {"resource":{"name":"Posts","method":"get","url":"https://api.example.com/posts","searchParams":[{"name":"tag","value":"filters.tag"},{"name":"source","value":{"type":"literal","value":"website"}}],"headers":[]},"scopeInstanceId":"<instanceId>","dataSourceName":"posts"}\n- MCP tool: create-resource {"resource":{"name":"Post GraphQL","control":"graphql","method":"post","url":"https://api.example.com/graphql","headers":[{"name":"Content-Type","value":{"type":"literal","value":"application/json"}}],"body":"{ query: \\"query Post($slug: String!) { post(slug: $slug) { title } }\\", variables: { slug: system.params.slug } }"},"scopeInstanceId":"<instanceId>","dataSourceName":"post"}\n- MCP tool: create-resource {"resource":{"name":"Current Date","control":"system","method":"get","url":"/$resources/current-date","headers":[]},"scopeInstanceId":"<instanceId>","dataSourceName":"currentDate"}\n- MCP tool: update-resource {"resourceId":"<resourceId>","values":{"url":"https://api.example.com/posts"}}\n- MCP tool: bind-props {"bindings":"bindings.json contents"}\n- MCP tool: insert-fragment {"parentInstanceId":"<instanceId>","fragment":"<ws.collection>{/_ collection content _/}</ws.collection>"}\n\nNotes:\n\n- Use this for CMS sections, blog listings, Ghost/headless CMS pages, n8n-style integrations, and API URLs built from variables.\n- For read data, expose GET resources as scoped data variables with `scopeInstanceId`/`dataSourceName` and read the loaded result from the resource result wrapper, usually `.data`.\n- For writes, webhooks, GraphQL submissions, and deletes, prefer unscoped resources bound to Form `action` props so they become action resources instead of auto-loaded read resources.\n- Use direct props for fixed values and prop bindings only when a prop must read a data variable, resource, action, or documented runtime context value such as `system`.\n\n## Render an array or object as repeated content\n\nCommands:\n\n- MCP tool: components.get {"component":"ws:collection"}\n- MCP tool: insert-component {"parentInstanceId":"<instanceId>","component":"ws:collection"}\n- MCP tool: inspect-instance {"instanceId":"<collectionId>","include":["props","bindings","children"]}\n- MCP tool: bind-props {"bindings":[{"instanceId":"<collectionId>","name":"data","binding":{"type":"expression","value":"posts.data"}}]}\n\nNotes:\n\n- Use Collection whenever an array or object from a resource or data variable should render a list, grid, cards, table rows, options, tabs, or other repeated UI.\n- Bind the Collection `data` prop to the complete array or object. Do not bind the resource response wrapper or one indexed item. External resource arrays are commonly nested under the scoped resource result\'s `data` field or deeper.\n- Insert Collection with `insert-component` so Webstudio creates its internal current-item and current-key parameters. Preserve those generated parameters; they are scoped runtime context, not public records to create, replace, or delete.\n- Collection renders its child structure once for every entry. Bind descendant text and props to the current item. Array iteration exposes the item; object iteration exposes its key and value.\n- Wrap multiple repeated sibling instances in one Element inside Collection.\n- For repeated Radix items such as accordion items, tabs, or menu options, bind a stable unique id or slug to every required `value` prop.\n- See the [Collection documentation](https://docs.webstudio.is/university/core-components/collection) for the equivalent Builder workflow.\n\n## Support dynamic runtime behavior\n\nCommands:\n\n- MCP tool: update-props {"updates":"props.json contents"}\n- MCP tool: bind-props {"bindings":"bindings.json contents"}\n- MCP tool: create-resource {"resource":{"name":"Seats","method":"get","url":"https://api.example.com/seats","headers":[]}}\n- MCP tool: snapshot {"include":["instances","props","resources"]}\n- MCP tool: apply-patch {"baseVersion":"<version>","transactions":"patch.json contents"}\n\nNotes:\n\n- Use existing scripts/resources for behavior, then move presentational structure into editable Webstudio instances where possible.\n- There is no dedicated semantic command yet for converting script-generated UI into editable Webstudio structure.\n\n## Build authenticated pages\n\nCommands:\n\n- MCP tool: create-page {"name":"Account","path":"/account"}\n- MCP tool: update-page {"pageId":"<pageId>","values":{"meta":{"auth":{"login":"<login>","password":"<password>"}}}}\n- MCP tool: create-resource {"resource":{"name":"Session","method":"get","url":"https://api.example.com/session","headers":[]}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"user","value":{"type":"json","value":{}}}\n- MCP tool: update-props {"updates":"props.json contents"}\n- MCP tool: bind-props {"bindings":"bindings.json contents"}\n\nNotes:\n\n- Basic auth is semantic today. Provider-specific Supabase/Firebase setup still requires manual resources, props, embeds, or patches.\n\n## Generate from design input\n\nCommands:\n\n- MCP tool: create-page {"name":"Landing","path":"/landing"}\n- MCP tool: create-design-token {"tokens":"tokens.json contents"}\n- MCP tool: define-css-variable {"vars":"vars.json contents"}\n- MCP tool: insert-fragment {"parentInstanceId":"<instanceId>","fragment":"<ws.element ws:tag=\\"section\\"><ws.element ws:tag=\\"p\\">Section copy</ws.element></ws.element>"}\n- MCP tool: update-styles {"updates":"styles.json contents"}\n- MCP tool: preview.start {"host":"127.0.0.1","port":5173}\n- MCP tool: screenshot {"path":"/","output":"current.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n- MCP tool: screenshot {"baseUrl":"http://127.0.0.1:5177","path":"/","output":"current.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n\nNotes:\n\n- Use this after external design interpretation. There is no dedicated import command for Figma, screenshots, Inception output, or design.md yet.\n\n## Cross-project maintenance\n\nCommands:\n\n- webstudio init --link <api-share-link> --json\n- webstudio permissions --json\n- webstudio mcp\n\nNotes:\n\n- Public API and CLI intentionally operate on one configured project at a time. Use an external script to loop over projects.\n\n# Known CLI Gaps\n\n## Provider-specific authenticated pages\n\nMissing:\nCLI supports page basic auth and generic resources/props/embeds, but not guided Supabase/Firebase auth setup.\n\nCurrent fallback:\nCreate the page, resources, variables, props, and embeds manually with existing MCP semantic tools.\n\nSuggested commands:\n\n- setup-auth-page\n\n## Dynamic script/runtime integration helpers\n\nMissing:\nCLI can manipulate props/resources/embeds, but has no semantic workflow for converting script-generated UI into editable Webstudio structures.\n\nCurrent fallback:\nUse MCP props, resources, and raw patch where necessary.\n\nSuggested commands:\n\n- integrate-runtime-ui\n\n## Generate from design input\n\nMissing:\nNo command imports Figma, screenshots, Inception output, or design.md and turns it into pages/tokens/layout.\n\nCurrent fallback:\nUse external generation, then apply semantic CLI commands or apply-patch.\n\nSuggested commands:\n\n- generate-from-design\n\n## Built-in cross-project maintenance\n\nMissing:\nPublic API and CLI intentionally operate on one configured project at a time; there is no built-in multi-project discovery or loop runner.\n\nCurrent fallback:\nRun the CLI from an external script that reconfigures one project/session at a time.\n\nSuggested commands:\n\n- none\n',+ '# CLI API Use Cases\n\n## Link/configure one project\n\nCommands:\n\n- webstudio init --link <api-share-link> --json\n\nNotes:\n\n- Writes local project id and global origin/token config.\n\n## Import synced project bundle into another project\n\nCommands:\n\n- webstudio sync\n- webstudio import --to <destination-share-link>\n- MCP tool: import {"to":"<destination-share-link>"}\n\nNotes:\n\n- Imports local `.webstudio/data.json` into the destination project.\n- Destination share link must allow build/import access.\n- Use `--skip-assets` only when asset rows and files should not be imported.\n\n## Identify current token\n\nCommands:\n\n- MCP tool: whoami {}\n\n## Check token permissions\n\nCommands:\n\n- webstudio permissions --json\n\n## Inspect project/build/version\n\nCommands:\n\n- MCP tool: inspect {}\n- MCP tool: snapshot {"include":["pages","instances","styles"]}\n\n## Discover CLI/API capabilities\n\nCommands:\n\n- webstudio schema api\n- webstudio schema mcp\n- webstudio man --json\n- webstudio man llm --json\n- MCP tool: meta.index {}\n- MCP tool: meta.guide {"brief":"Create a pricing page"}\n- MCP tool: meta.get_more_tools {"brief":"update-styles"}\n- webstudio mcp list-resources\n- webstudio mcp read-resource webstudio://project/guide\n- webstudio mcp read-resource webstudio://project/expressions\n\nNotes:\n\n- Use `webstudio schema mcp` for a tiny machine-readable MCP tool overview. Use `webstudio schema mcp --detail summary` for all tool descriptions, and `webstudio schema mcp --detail full` or focused `meta.get_more_tools` calls only when exact input schemas are needed.\n- Use focused MCP tools for discovery first: `meta.index`, `meta.guide`, `meta.get_more_tools`, `components.list`, `components.summary`, `components.search`, `components.get`, `templates.list`, and `templates.get`. Protocol clients can use `resources/list` and `resources/read`; shell agents can use `webstudio mcp list-resources` and `webstudio mcp read-resource <uri>`. Read longer resources such as `webstudio://project/tools` and `webstudio://project/components` only when focused tools are insufficient.\n- Read `webstudio://project/expressions` before authoring unfamiliar computed text, prop bindings, resource expressions, actions, or Collection item bindings.\n- From a shell, call one MCP tool with the shortcut form `webstudio <tool> \'<json>\'`, for example `webstudio components.summary`. The explicit equivalent is `webstudio mcp single-op-call <tool> \'<json>\'`. Use `--input-file` for large payloads.\n\n## Inspect external shadcn registry items\n\nCommands:\n\n- webstudio registry inspect --source https://example.com/r/registry.json --item button --json\n- webstudio registry inspect --source ./registry.json --item dialog --json\n- webstudio registry inspect --source https://example.com/r/button.json --json\n\nNotes:\n\n- Reads a local or remote registry item without installing files or changing the configured Webstudio project.\n- Returns the item name, description, package and registry dependencies, file paths/targets, available docs, and a read-only compatibility report.\n- The report explicitly says whether installation or editable-component conversion is supported, lists declared requirements and manual steps, and says when arbitrary source code was not analyzed.\n- This is an inspection step only. It does not install files or change the configured project.\n\n## Understand what MCP can do\n\nCommands:\n\n- webstudio man mcp\n- MCP tool: meta.index {}\n- MCP tool: meta.guide {"brief":"What can Webstudio MCP do?"}\n\nMCP lets agents work on one configured Webstudio project. Agents can:\n\n- Inspect the linked project, token permissions, and latest editable build.\n- Read selected project data for audits, migrations, and repair.\n- Search labels, text, props, resource URLs, asset metadata, and styles.\n- Audit accessibility, security, SEO, performance settings, unused assets, ineffective Collection styles, and unused or duplicate style data.\n- Create and edit pages, folders, redirects, breakpoints, and page templates.\n- Create pages from reusable templates.\n- Update page metadata, SEO fields, auth settings, and marketplace metadata.\n- Insert components and styled JSX sections.\n- Create data-driven lists, grids, cards, and similar repeated UI from array or object data in one Collection operation.\n- Move, copy, wrap, unwrap, convert, rename, retag, and delete elements.\n- Update text, rich text, props, bindings, and actions.\n- Create and update local styles, design tokens, style sources, and CSS variables.\n- Create static data variables and JSON variables.\n- Create HTTP, GraphQL, and system resources.\n- Use system resources for sitemap, current date, and assets.\n- Bind resources to rendered data or form/action props.\n- Upload, replace, delete, and inspect asset usage.\n- Publish, unpublish, inspect publish jobs, and manage custom domains.\n- Start preview, capture screenshots, compare screenshot diffs, and use OCR when installed.\n\n## Inspect and refresh MCP session cache\n\nCommands:\n\n- MCP tool: status {}\n- MCP tool: status {"verbose":true}\n- MCP tool: refresh {"namespaces":["pages","instances","styles"]}\n- MCP tool: reset-session {}\n\nNotes:\n\n- Use status before a task to understand the cached ProjectSession state.\n- Use status with `{"verbose":true}` only when debugging full namespaces, freshness, compatibility, or diagnostics.\n- Use refresh when project data may have changed outside the current MCP session.\n- Use reset-session when local cached state is corrupt or incompatible.\n\n## Visually verify rendered work with AI vision\n\nCommands:\n\n- MCP tool: preview.start {"host":"127.0.0.1","port":5173}\n- MCP tool: preview.status {}\n- MCP tool: preview.stop {}\n- MCP tool: screenshot {"path":"/","output":".webstudio/screenshots/home-current.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n- MCP tool: screenshot {"path":"/pricing","output":".webstudio/screenshots/pricing-current.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n- MCP tool: screenshot {"baseUrl":"http://127.0.0.1:5177","path":"/pricing","output":".webstudio/screenshots/pricing-current.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n- MCP tool: screenshot.diff {"baselinePath":".webstudio/screenshots/home-before.png","currentPath":".webstudio/screenshots/home-current.png","outputDir":".webstudio/screenshots/diff"}\n- MCP tool: screenshot.diff {"baselinePath":".webstudio/screenshots/home-before.png","currentPath":".webstudio/screenshots/home-current.png","outputDir":".webstudio/screenshots/diff","expectedText":["Pricing","Start free"]}\n- MCP tool: screenshot.diff {"baselinePath":".webstudio/screenshots/home-before.png","currentPath":".webstudio/screenshots/home-current.png","outputDir":".webstudio/screenshots/diff","expectedVisual":{"maxMismatchPercentage":2,"maxChangedRegions":3,"dominantColorChange":{"channel":"luminance","direction":"increase","minMagnitude":10}}}\n- MCP tool: screenshot.diff {"baselinePath":".webstudio/screenshots/pricing-before.png","currentPath":".webstudio/screenshots/pricing-current.png","outputDir":".webstudio/screenshots/diff"}\n- MCP tool: vision.install-ocr {"confirm":true}\n\nNotes:\n\n- Use this after page/content/style mutations and after generated project files are current so a vision-capable AI can see the production-like generated site.\n- For multi-page work, capture every changed page by `path` through the same preview server; no click navigation is required.\n- After MCP mutations, path screenshots regenerate/restart preview as needed before capture; when preview is fresh, repeated path screenshots reuse the running server.\n- Do not call `preview.start` through one-shot `webstudio mcp single-op-call`: it is long-lived. From a shell, use `webstudio mcp run` with preview.start, screenshot, and preview.stop in one shared process, or use a real long-running MCP client.\n- From one-shot shell calls or another process, pass `baseUrl` with `path` to capture an already-running preview/site without generating, building, starting, or restarting preview.\n- Use preview.stop only in the same long-running MCP server or `webstudio mcp run` process that started preview. A separate one-shot `single-op-call` process does not own another process\'s preview controller.\n- Use waitForSelector when the rendered app has a reliable ready marker, waitUntil:"networkidle" for network-heavy pages, and waitForTimeout only for final visual settling.\n- Preview installs generated app dependencies under `.webstudio/preview` and reuses them across regenerations.\n- Do not add generated-preview dependencies to the repository root `package.json` or `pnpm-lock.yaml`.\n- If dependency installation fails, check npm and network configuration, then reinstall or update the Webstudio CLI if the problem persists.\n- When a baseline exists, use screenshot.diff once per baseline/current page or viewport pair to get changed regions, OCR textAnalysis, and diff artifact paths before deciding whether the result matches. Pass expectedText for explicit pass/fail current-screen text assertions with found and missing text. Pass expectedVisual for pass/fail limits on pixel mismatch percentage, changed-region count, or the overall dominant color/brightness direction.\n- If screenshot.diff reports OCR unavailable and the user agrees to install it, call vision.install-ocr {"confirm":true}; otherwise continue with pixel diff and visual inspection.\n- Compare the PNG, OCR text evidence, and diff artifacts against the user\'s intent for layout, typography, colors, spacing, imagery, and responsive framing; then iterate with focused mutations.\n- Root CLI equivalent: `webstudio screenshot --path /pricing --output pricing.png` generates a temporary production preview, captures that route, and stops the server. For repeated captures, keep `webstudio preview` running and pass its absolute URL to `webstudio screenshot`.\n\n## List pages\n\nCommands:\n\n- MCP tool: list-pages {"includeFolders":true}\n\n## Read page by id\n\nCommands:\n\n- MCP tool: get-page {"pageId":"<pageId>"}\n\n## Read page by path\n\nCommands:\n\n- MCP tool: get-page-by-path {"path":"/pricing"}\n\n## Create page\n\nCommands:\n\n- MCP tool: create-page {"name":"Pricing","path":"/pricing"}\n- MCP tool: create-page {"name":"Pricing","path":"/pricing","title":"Pricing","meta":{"description":"Plans for teams"}}\n\nNotes:\n\n- `name`, `path`, page `title`, and metadata text fields accept plain fixed values.\n- For computed page titles or metadata, send JavaScript expression code such as `pageTitle ?? "Pricing"`.\n\n## Update page settings/metadata\n\nCommands:\n\n- MCP tool: update-page {"pageId":"<pageId>","values":{"title":"Pricing","meta":{"description":"Plans","status":"200"}}}\n- MCP tool: update-page {"pageId":"<pageId>","values":{"meta":{"auth":{"login":"<login>","password":"<password>"}}}}\n\nNotes:\n\n- Page `title` and metadata text fields accept plain fixed values.\n- For computed page titles or metadata, send JavaScript expression code such as `pageTitle ?? "Pricing"`.\n\n## Read project settings\n\nCommands:\n\n- MCP tool: get-project-settings {}\n\nNotes:\n\n- Read `meta.agentInstructions` before making project changes. It contains the project\'s own guidance for AI agents.\n- Agent instructions are shared project guidance. Do not store credentials or other secrets there.\n\n## Update project settings\n\nCommands:\n\n- MCP tool: update-project-settings {"meta":{"siteName":"Acme"}}\n- MCP tool: update-project-settings {"meta":{"agentInstructions":"Use existing design tokens and keep product copy concise."}}\n\n## Read marketplace product\n\nCommands:\n\n- MCP tool: get-marketplace-product {}\n\n## Update marketplace product\n\nCommands:\n\n- MCP tool: update-marketplace-product {"category":"pageTemplates","name":"Acme Template","thumbnailAssetId":"asset-id","author":"Acme Studio","email":"[email protected]","website":"https://example.com","issues":"","description":"Reusable template project for Acme landing pages."}\n\n## List redirects\n\nCommands:\n\n- MCP tool: list-redirects {}\n\n## Create redirect\n\nCommands:\n\n- MCP tool: create-redirect {"old":"/old","new":"/new","status":301}\n\n## Update redirect\n\nCommands:\n\n- MCP tool: update-redirect {"old":"/old","values":{"new":"/newer","status":302}}\n- MCP tool: update-redirect {"old":"/old","values":{"status":null}}\n\n## Delete redirect\n\nCommands:\n\n- MCP tool: delete-redirect {"old":"/old"}\n\n## Set redirects\n\nCommands:\n\n- MCP tool: set-redirects {"redirects":[{"old":"/old","new":"/new","status":"301"}]}\n\n## List breakpoints\n\nCommands:\n\n- MCP tool: list-breakpoints {}\n\n## Create breakpoint\n\nCommands:\n\n- MCP tool: create-breakpoint {"label":"Tablet","maxWidth":991}\n\n## Update breakpoint\n\nCommands:\n\n- MCP tool: update-breakpoint {"breakpointId":"tablet","values":{"label":"Tablet","maxWidth":1023}}\n- MCP tool: update-breakpoint {"breakpointId":"tablet","values":{"condition":null,"minWidth":768}}\n- MCP tool: update-breakpoint {"breakpointId":"tablet","values":{"minWidth":null,"maxWidth":null,"condition":"(hover: hover)"}}\n\n## Delete breakpoint\n\nCommands:\n\n- MCP tool: delete-breakpoint {"breakpointId":"tablet"}\n\n## Duplicate page\n\nCommands:\n\n- MCP tool: duplicate-page {"pageId":"<pageId>","name":"Pricing Copy","path":"/pricing-copy"}\n\n## List page templates\n\nCommands:\n\n- MCP tool: list-page-templates {}\n\n## Create page template\n\nCommands:\n\n- MCP tool: create-page-template {"name":"Landing Template","title":"Landing"}\n\n## Update page template\n\nCommands:\n\n- MCP tool: update-page-template {"templateId":"<templateId>","values":{"name":"Article Template","meta":{"description":"Reusable article layout"}}}\n\n## Delete page template\n\nCommands:\n\n- MCP tool: delete-page-template {"templateId":"<templateId>"}\n\n## Duplicate page template\n\nCommands:\n\n- MCP tool: duplicate-page-template {"templateId":"<templateId>"}\n\n## Reorder page template\n\nCommands:\n\n- MCP tool: reorder-page-template {"sourceTemplateId":"<sourceTemplateId>","targetTemplateId":"<targetTemplateId>","position":"before"}\n\n## Create page from template\n\nCommands:\n\n- MCP tool: create-page-from-template {"templateId":"<templateId>","name":"Landing","path":"/landing"}\n\n## Delete page\n\nCommands:\n\n- MCP tool: delete-page {"pageId":"<pageId>"}\n\n## List folders\n\nCommands:\n\n- MCP tool: list-folders {"includePages":true}\n\n## Create folder\n\nCommands:\n\n- MCP tool: create-folder {"name":"Blog","slug":"blog"}\n\n## Update folder\n\nCommands:\n\n- MCP tool: update-folder {"folderId":"<folderId>","values":{"name":"Blog","slug":"blog"}}\n\n## Delete folder\n\nCommands:\n\n- MCP tool: delete-folder {"folderId":"<folderId>"}\n\n## List element instances\n\nCommands:\n\n- MCP tool: list-instances {"pagePath":"/","maxDepth":3}\n\n## Inspect one element instance\n\nCommands:\n\n- MCP tool: inspect-instance {"instanceId":"<instanceId>","include":["props","styles","children"]}\n\n## Insert authored JSX or one component template\n\nCommands:\n\n- MCP tool: insert-fragment {"parentInstanceId":"<instanceId>","fragment":"<ws.element ws:tag=\\"section\\" ws:style={css`padding: 32px;`}><ws.element ws:tag=\\"h2\\">Product OS</ws.element><radix.Switch><radix.SwitchThumb /></radix.Switch></ws.element>"}\n- MCP tool: insert-component {"parentInstanceId":"<instanceId>","component":"@webstudio-is/sdk-components-react-radix:Switch"}\n- MCP tool: insert-component {"parentInstanceId":"<instanceId>","component":"Form"}\n\nNotes:\n\n- Use MCP `insert-fragment` as the default way to author styled component trees. It converts JSX to a structured fragment before mutation.\n- Use only exact component ids returned by `components.search`, `components.get`, or `templates.get`. Never derive or guess component ids.\n- The `ws:` namespace contains specific Webstudio core components; it is not HTML-tag shorthand. Use `<ws.element ws:tag="div">` for a native `div` and `<ws.element ws:tag="form">` for a native form, never `<ws.div>` or `<ws.form>`.\n- For Webstudio\'s complete form structure, discover the Form component and insert its automatic template with `insert-component` using component `"Form"`.\n- MCP receives JSX as a JSON string because MCP arguments are JSON. The CLI converts it locally before the runtime mutation, so the project session receives structured Webstudio data, not JSX source.\n- In `insert-fragment` JSX, use `ws:style={css\\`...\\`}`for Webstudio-native CSS, or use React-style object syntax such as`style={{ padding: 24 }}` when that is simpler. Both forms create editable Webstudio style data.\n- Do not access host globals or dynamic code APIs in JSX fragments, including `process`, `globalThis`, `eval`, `Function`, or `constructor`.\n- Use Webstudio prop names such as `class` and `for`; do not use React aliases `className` or `htmlFor`.\n- Use Webstudio actions for event/action props, for example `onClick={new ActionValue(["event"], expression\\`console.log(event)\\`)}`. Do not pass JavaScript functions such as `onClick={() => ...}`.\n- Plain prop values must be JSON-compatible: `null`, strings, booleans, finite numbers, arrays, and plain objects. Do not pass `undefined`, `Symbol`, `BigInt`, `NaN`, `Infinity`, `Date`, `Map`, `Set`, class instances, or circular objects; omit the prop, use plain data, or use `expression`/`ActionValue` when the value is dynamic.\n- Template-backed components used in JSX must include required child/part components explicitly under the same parent structure as the template, for example `<radix.Switch><radix.SwitchThumb /></radix.Switch>`.\n- Webstudio applies a registered template automatically when using `insert-component`, so composed components such as Switch include required child parts and styles.\n- Use `components.list`, `components.summary`, `components.search`, `components.get`, `templates.list`, and `templates.get` to discover known registry items, component ids, props, templates, insertability, and content model. Read `webstudio://project/components` only when those focused tools are insufficient.\n- Component/template registry items use a shadcn-compatible top-level shape plus Webstudio-specific superset metadata in `meta`. They are for Builder/MCP discovery, not a published shadcn install registry yet.\n- Known components with `contentModel.category: "none"` are not standalone-insertable; insert their root component template instead so required providers/parents are included.\n- Unknown custom component ids are a low-level extension mechanism, not a discovery fallback. Agents must not synthesize them.\n\n## Make a region editable in Content mode\n\nCommands:\n\n- MCP tool: insert-component {"parentInstanceId":"<instanceId>","component":"ws:block"}\n- MCP tool: inspect-instance {"instanceId":"<instanceId>","include":["children"]}\n\nNotes:\n\n- When a page will be handed to a Content-mode editor, wrap every region they should be able to edit in a Content Block (`ws:block`). Content-mode editors can edit text and supported props only in Content Block descendants. Content outside those blocks remains read-only, even when it looks like ordinary editable text.\n- Put reusable insertable options inside the Content Block\'s `ws:block-template` child. A template is source material, not editor content: editors cannot edit or delete it directly. When an editor inserts a template, its copy becomes a direct child of the Content Block and is editable.\n- Before handing off a page, verify with `inspect-instance` that the intended text, images, and links are inside a Content Block, and that templates include all required styling because Content-mode editors cannot use the Style panel.\n\n## Move elements\n\nCommands:\n\n- MCP tool: move-instance {"moves":"moves.json contents"}\n\nNotes:\n\n- Use `position: "end"` to append an instance. Repeating this for A and then B preserves the final order A, B.\n- A numeric `insertIndex` addresses the target parent\'s children before the moved instance is removed. Use it for exact placement; do not calculate the last index to append.\n- Moves in one `moves` array are applied sequentially in array order.\n\n## Clone element subtree\n\nCommands:\n\n- MCP tool: clone-instance {"sourceInstanceId":"<instanceId>","targetParentInstanceId":"<targetParentId>"}\n\n## Delete element subtree\n\nCommands:\n\n- MCP tool: delete-instance {"instanceIds":["<instanceId>"]}\n\n## List text/expression children\n\nCommands:\n\n- MCP tool: list-texts {"pagePath":"/"}\n\n## Update text child\n\nCommands:\n\n- MCP tool: update-text {"instanceId":"<instanceId>","childIndex":0,"text":"Launch faster"}\n\n## Replace bounded literal text\n\nCommands:\n\n- MCP tool: replace-text {"find":"Start free","replace":"Get started","match":"exact","pagePath":"/pricing","limit":20}\n\nNotes:\n\n- This changes only literal text children, never expression children. Scope it to pagePath or pageId and set a limit before a broad replacement.\n\n## Replace bounded static prop text\n\nCommands:\n\n- MCP tool: replace-prop-text {"find":"old.example.com","replace":"www.example.com","match":"substring","names":["href","code"],"limit":20}\n\nNotes:\n\n- This changes only static string props such as href, alt, aria-label, title, and HTML embed code. It never changes expressions, resources, actions, assets, or other dynamic bindings. Use names or instanceIds and a limit to narrow the change.\n\n## Replace bounded resource text\n\nCommands:\n\n- MCP tool: replace-resource-text {"find":"api.old.example.com","replace":"api.example.com","fields":["url"],"limit":20}\n\nNotes:\n\n- This changes resource names and fixed URL literals only. It skips dynamic URL expressions, headers, search parameters, request bodies, and GraphQL query code.\n\n## Update props\n\nCommands:\n\n- MCP tool: update-props {"updates":"props.json contents"}\n- MCP tool: replace-prop-text {"find":"Old label","replace":"New label","names":["aria-label","title"],"limit":20}\n\nNotes:\n\n- Use this for fixed prop values such as `aria-label`, `alt`, `id`, static `href`, and other direct string/number/boolean/json prop values.\n\n## Add JSON-LD structured data\n\nCommands:\n\n- MCP tool: components.get {"component":"JsonLd"}\n- MCP tool: insert-component {"parentInstanceId":"<headSlotInstanceId>","component":"JsonLd"}\n- MCP tool: update-props {"updates":[{"instanceId":"<jsonLdInstanceId>","name":"code","type":"string","value":"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Organization\\",\\"name\\":\\"Acme\\"}"}]}\n- MCP tool: audit {"scopes":["seo"],"pagePath":"/"}\n\nNotes:\n\n- Prefer placing `JsonLd` inside `HeadSlot`.\n- Store `code` as a JSON object or array encoded as a compact string. The Builder formats it for editing.\n- The semantic prop update rejects malformed JSON and structurally invalid fixed JSON-LD with a precise JSON path.\n- The SEO audit also warns about a missing top-level `@context`, unknown or superseded Schema.org terms, properties unsupported by the supplied type, and incompatible primitive value types.\n- Schema.org vocabulary findings are warnings because custom vocabularies and extensions remain valid. Dynamic JSON-LD is marked as skipped for rendered validation.\n- Do not use bindings just to set static text.\n\n## Delete props\n\nCommands:\n\n- MCP tool: delete-props {"deletions":"props.json contents"}\n\n## Bind props to expressions/resources/actions\n\nCommands:\n\n- MCP tool: bind-props {"bindings":"bindings.json contents"}\n\nNotes:\n\n- Use this only when the prop should remain dynamic: expression, resource, action, or an existing scoped runtime context value such as `system`.\n- For a fixed string value, use `update-props` with `type:"string"` and a direct `value` instead.\n\n## Read styles\n\nCommands:\n\n- MCP tool: get-styles {"instanceIds":["<instanceId>"],"includeTokens":true}\n\n## Update local styles\n\nCommands:\n\n- MCP tool: update-styles {"updates":"styles.json contents"}\n\n## Delete local styles\n\nCommands:\n\n- MCP tool: delete-styles {"deletions":"styles.json contents"}\n\n## Replace matching style values\n\nCommands:\n\n- MCP tool: replace-styles {"property":"color","fromValue":{"type":"keyword","value":"red"},"toValue":{"type":"keyword","value":"blue"}}\n\n## List design tokens\n\nCommands:\n\n- MCP tool: list-design-tokens {}\n- MCP tool: list-design-tokens {"withUsage":true}\n- MCP tool: list-design-tokens {"includeStyles":true}\n\nNotes:\n\n- The default response is compact and includes token id, name, declaration count, and optional usage count.\n- Use `includeStyles:true` only when you need the full inline style declarations.\n\n## Create design tokens\n\nCommands:\n\n- MCP tool: create-design-token {"tokens":"tokens.json contents"}\n\n## Update design token styles\n\nCommands:\n\n- MCP tool: update-design-token-styles {"designTokenId":"<tokenId>","updates":"styles.json contents"}\n\n## Delete design token styles\n\nCommands:\n\n- MCP tool: delete-design-token-styles {"designTokenId":"<tokenId>","deletions":"styles.json contents"}\n\n## Attach design token to instances\n\nCommands:\n\n- MCP tool: attach-design-token {"designTokenId":"<tokenId>","instanceIds":"instances.json contents"}\n\n## Detach design token from instances\n\nCommands:\n\n- MCP tool: detach-design-token {"designTokenId":"<tokenId>","instanceIds":"instances.json contents"}\n\n## Extract design token from local styles\n\nCommands:\n\n- MCP tool: extract-design-token {"instanceIds":["<instanceId>"],"name":"Brand Primary","removeLocalProps":["color"]}\n\n## List CSS variables\n\nCommands:\n\n- MCP tool: list-css-variables {"withUsage":true}\n\n## Define CSS variables\n\nCommands:\n\n- MCP tool: define-css-variable {"vars":"vars.json contents"}\n\n## Delete CSS variables\n\nCommands:\n\n- MCP tool: delete-css-variable {"names":"names.json contents","force":true}\n\n## Rewrite CSS variable references\n\nCommands:\n\n- MCP tool: rewrite-css-variable-refs {"map":"variables.json contents"}\n\n## List data variables\n\nCommands:\n\n- MCP tool: list-variables {}\n- MCP tool: list-variables {"scopeInstanceId":"<instanceId>"}\n\nNotes:\n\n- Data variables live in the internal `dataSources` namespace.\n- For raw `snapshot`, request the public `variables` namespace rather than the internal `dataSources` name. Raw patch payloads still use `dataSources` when applying direct changes.\n- Scope variables to the instance where they should become available. Descendants can use them in expressions, and nested variables with the same name mask outer variables.\n\n## Create data variable\n\nCommands:\n\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"title","value":{"type":"string","value":"Hello"}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"count","value":{"type":"number","value":3}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"featured","value":{"type":"boolean","value":true}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"tags","value":{"type":"string[]","value":["news","product"]}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"filters","value":{"type":"json","value":{"tag":"news"}}}\n\nNotes:\n\n- Data variable values support `string`, `number`, `boolean`, `string[]`, and `json`.\n- Parameters are internal scoped runtime values provided by pages, collections, or components. They are not a public authoring surface: do not create, update, or delete parameter records. Use data variables/resources for user-authored data, and reference documented context values such as `system` only where they are already in scope.\n\n## Update data variable\n\nCommands:\n\n- MCP tool: update-variable {"dataSourceId":"<variableId>","values":{"value":{"type":"json","value":{"count":1}}}}\n\n## Delete data variable\n\nCommands:\n\n- MCP tool: delete-variable {"dataSourceId":"<variableId>"}\n\n## List resources\n\nCommands:\n\n- MCP tool: list-resources {}\n- MCP tool: list-resources {"scopeInstanceId":"<instanceId>"}\n\n## Create resource\n\nCommands:\n\n- MCP tool: create-resource {"resource":{"name":"Posts","method":"get","url":"https://api.example.com/posts","headers":[]}}\n- MCP tool: create-resource {"resource":{"name":"Posts","method":"get","url":"\\"https://api.example.com/posts?tag=\\" + filters.tag","headers":[]},"scopeInstanceId":"<instanceId>","dataSourceName":"posts"}\n- MCP tool: create-resource {"resource":{"name":"Filtered Posts","method":"get","url":"https://api.example.com/posts","searchParams":[{"name":"tag","value":"filters.tag"},{"name":"source","value":{"type":"literal","value":"website"}}],"headers":[{"name":"Authorization","value":"\\"Bearer \\" + auth.token"}]},"scopeInstanceId":"<instanceId>","dataSourceName":"posts"}\n- MCP tool: create-resource {"resource":{"name":"Post GraphQL","control":"graphql","method":"post","url":"https://api.example.com/graphql","headers":[{"name":"Content-Type","value":{"type":"literal","value":"application/json"}}],"body":"{ query: \\"query Post($slug: String!) { post(slug: $slug) { title } }\\", variables: { slug: system.params.slug } }"},"scopeInstanceId":"<instanceId>","dataSourceName":"post"}\n- MCP tool: create-resource {"resource":{"name":"Current Date","control":"system","method":"get","url":"/$resources/current-date","headers":[]},"scopeInstanceId":"<instanceId>","dataSourceName":"currentDate"}\n\nNotes:\n\n- Resource `url` accepts plain fixed URLs and paths such as `https://api.example.com/posts` and `/$resources/current-date`.\n- Resource `url` can also be a JavaScript expression when it is computed, such as `"https://api.example.com/posts?tag=" + filters.tag`.\n- Header values, search parameter values, and body accept expressions for dynamic values. For fixed text, use `{"type":"literal","value":"application/json"}`; Webstudio stores the required string expression for you.\n- Search parameter values, header values, and body expressions can read scoped variables and documented runtime context values such as `system` when they are available at the resource scope.\n- Add `scopeInstanceId` and `dataSourceName` when the resource result should be exposed as a scoped read data variable. Scoped resources are generated into the page resource `data` map and may be loaded during page rendering. Use this for read-oriented resources such as GET CMS/API data.\n- For submit/write/action resources, create the resource without `scopeInstanceId`, then bind a component prop such as a Form `action` with `bind-props` and `binding.type: "resource"`. Prop-bound resources are generated into the page resource `action` map instead of the read `data` map. Use this for POST, PUT, DELETE, webhooks, GraphQL submissions, and other explicit action flows.\n- Resource `method` can be `get`, `post`, `put`, or `delete`. Use GET for read data, POST for creates/GraphQL/webhooks/form submissions, PUT for full updates or replacements, and DELETE for deletion actions.\n- Optional `control` values are `graphql` and `system`. Use `graphql` for GraphQL-style requests, usually POST with a query body. Use `system` for built-in resources such as `"/$resources/sitemap.xml"`, `"/$resources/current-date"`, and `"/$resources/assets"` and when the resource should use the built-in `system` parameter. System fields are `system.origin`, `system.pathname`, `system.params`, and `system.search`.\n\n## Update resource\n\nCommands:\n\n- MCP tool: update-resource {"resourceId":"<resourceId>","values":{"url":"https://api.example.com/posts"}}\n- MCP tool: replace-resource-text {"find":"api.old.example.com","replace":"api.example.com","fields":["url"],"limit":20}\n\n## Delete resource\n\nCommands:\n\n- MCP tool: delete-resource {"resourceId":"<resourceId>"}\n\n## List assets\n\nCommands:\n\n- MCP tool: list-assets {"withUsage":true}\n\nNotes:\n\n- Image asset descriptions are the default alt text for asset-backed Image components.\n- To generate missing descriptions, inspect the image in its rendered page or asset source, write a concise description of its purpose, and save it on the asset rather than duplicating it on each Image instance.\n\n## Update asset metadata\n\nCommands:\n\n- MCP tool: update-asset {"assetId":"<assetId>","values":{"description":"Team collaborating around a whiteboard"}}\n\nNotes:\n\n- Use an empty description only when the image is intentionally decorative.\n- Updating an image asset description updates the default alt text wherever that asset is used with an asset-backed alt prop.\n\n## Generate missing image descriptions with an agent\n\nCommands:\n\n- MCP tool: audit {"scopes":["accessibility"],"verbose":true}\n- MCP tool: set-image-descriptions {"updates":[{"assetId":"hero-id","description":"Team collaborating around a whiteboard"},{"assetId":"texture-id","decorative":true}]}\n- MCP tool: audit {"scopes":["accessibility"]}\n\nNotes:\n\n- Start from `missing-image-description` findings. Inspect each image in its rendered page context before writing text.\n- The vision-capable agent generates the wording; the CLI validates and stores it but does not contain its own vision model.\n- Use `decorative:true` only when the image adds no information. This intentionally stores an empty description so later audits do not report it as missing.\n- Re-run the accessibility audit after the update. Asset-backed Image components use the saved asset description as their default alt text.\n\n## Manage fonts\n\nCommands:\n\n- MCP tool: list-fonts {"includeSystem":true}\n- MCP tool: list-assets {"type":"font"}\n- MCP tool: upload-asset {"asset":{"name":"acme-sans.woff2","type":"font","format":"woff2","meta":{"family":"Acme Sans","style":"normal","weight":400}},"assetsDir":".webstudio/assets"}\n- MCP tool: update-styles {"updates":"styles.json contents"}\n\nNotes:\n\n- Use `list-fonts` to discover uploaded families and system stacks. Upload/delete fonts through the existing asset tools, then apply a family with a `font-family` style declaration.\n\n## Upload one asset\n\nCommands:\n\n- MCP tool: upload-asset {"asset":{"name":"image.png","type":"image","format":"png","meta":{"width":1200,"height":630}},"assetsDir":".webstudio/assets"}\n\n## Upload asset batch\n\nCommands:\n\n- MCP tool: upload-assets {"assets":[{"name":"image.png","type":"image","format":"png","meta":{"width":1200,"height":630}}],"assetsDir":".webstudio/assets"}\n\n## Find asset usage\n\nCommands:\n\n- MCP tool: find-asset-usage {"assetId":"<assetId>"}\n\n## Replace asset references\n\nCommands:\n\n- MCP tool: replace-asset {"fromAssetId":"<oldAssetId>","toAssetId":"<newAssetId>"}\n\n## Delete assets\n\nCommands:\n\n- MCP tool: delete-asset {"assetIdsOrPrefixes":["<assetId>"],"force":true}\n\n## Publish project\n\nCommands:\n\n- webstudio publish deploy --target production --json\n\n## List publishes\n\nCommands:\n\n- webstudio publish list --json\n\n## Check publish job\n\nCommands:\n\n- webstudio publish status --job <buildId> --json\n\n## Unpublish\n\nCommands:\n\n- webstudio publish unpublish --target production --confirm --json\n\n## List domains\n\nCommands:\n\n- webstudio domains list --json\n\n## Create domain\n\nCommands:\n\n- webstudio domains create --domain example.com --json\n\n## Update domain\n\nCommands:\n\n- webstudio domains update --domain-id <domainId> --domain www.example.com --json\n\n## Delete domain\n\nCommands:\n\n- webstudio domains delete --domain-id <domainId> --confirm --json\n\n## Verify domain\n\nCommands:\n\n- webstudio domains verify --domain-id <domainId> --json\n\n## Make arbitrary store-level changes\n\nCommands:\n\n- MCP tool: inspect {}\n- MCP tool: snapshot {"include":["<namespace>"]}\n- MCP tool: apply-patch {"baseVersion":"<version>","transactions":"patch.json contents"}\n\nNotes:\n\n- Use only when no semantic command exists.\n\n## Manage marketplace metadata\n\nCommands:\n\n- MCP tool: get-marketplace-product {}\n- MCP tool: update-marketplace-product {"category":"pageTemplates","name":"Acme Template","thumbnailAssetId":"asset-id","author":"Acme Studio","email":"[email protected]","website":"https://example.com","issues":"","description":"Reusable template project for Acme landing pages."}\n\nPatch namespaces:\n\n- marketplaceProduct\n\n## Search and inspect safely\n\nCommands:\n\n- MCP tool: search-project {"query":"pricing"}\n- MCP tool: search-project {"query":"api.example.com","scopes":["resources"]}\n- MCP tool: list-instances {"pagePath":"/","maxDepth":5}\n- MCP tool: inspect-instance {"instanceId":"<instanceId>","include":["props","styles","children"]}\n- MCP tool: list-texts {"pagePath":"/"}\n- MCP tool: list-assets {"withUsage":true}\n- MCP tool: find-asset-usage {"assetId":"<assetId>"}\n- MCP tool: snapshot {"include":["pages","instances","props","resources","assets"]}\n\nNotes:\n\n- Use `search-project` for query-driven lookup across labels, text, prop values, resource URLs, asset metadata, and styles. Use `audit` for project health findings.\n\n## Audit project quality\n\nCommands:\n\n- webstudio audit --json\n- webstudio audit --scopes accessibility --scopes seo --json\n- webstudio audit --page-path /pricing --json\n- webstudio audit --scopes accessibility --verbose --json\n- webstudio audit --rendered --page-path /pricing --json\n- webstudio audit --rendered --route-example post=/blog/hello --json\n- webstudio audit --rendered --image-domain images.example.com --json\n- MCP tool: audit {}\n- MCP tool: audit {"scopes":["accessibility","security"],"severities":["error","warning"]}\n- MCP tool: audit {"scopes":["accessibility"],"verbose":true}\n- MCP tool: audit {"rendered":true,"verbose":true}\n\nNotes:\n\n- With no scopes, `audit` checks accessibility, security, SEO, performance settings, unused assets, ineffective Collection styles, non-GET resources exposed as render-time data, and unused or duplicate style data.\n- The `performance` scope reports disabled atomic CSS generation. A rendered audit also measures broken, eager below-fold, and oversized images, browser-marked render-blocking resources, and legacy font formats.\n- Rendered image and resource metrics run only when the selected scopes include `performance`; responsive layout dimensions remain available whenever `rendered:true` is requested.\n- Compact findings include stable ids, severity, message, and location. Use `--verbose` or `{"verbose":true}` for evidence, explanation, suggested remediation, skipped-check details, and manual-check workflows.\n- `summary` counts all findings before severity filtering and pagination.\n- `contractVersion` identifies the audit response contract. Handle a new value before assuming existing fields retain the same meaning.\n- Expression-, resource-, and parameter-backed values that cannot be checked reliably appear in `skippedChecks`; they are not treated as passing or failing.\n- Page filters apply to page-owned accessibility, security, and SEO checks. Asset and style usage remain project-wide to avoid false unused findings.\n- Continue paginated results with `cursor`. Restart the audit if the project version changes.\n- Verbose skipped-check and manual-check details are included on the first findings page only; their total counts remain available on every page.\n- `manualChecks` describes responsive, hierarchy, and contrast checks that require preview screenshots and vision.\n- Focused audits return only manual checks relevant to their selected scopes.\n- In a long-lived MCP session, `{"rendered":true}` reuses preview and screenshot\n tools to capture every static page at mobile, desktop, and Builder breakpoint\n edges. Compact output reports rendered check/issue/failure counts; verbose\n output includes screenshot paths and measured layout dimensions.\n- Dynamic route templates are skipped unless `--route-example <pageId>=<path>`\n (or MCP `routeExamples`) supplies a concrete path. The path must not contain\n unresolved `:` or `*` parameters.\n- Plans above 120 captures return a short-lived confirmation token. Review the\n unchanged plan, then rerun with `--confirm-large-run` and\n `--confirmation-token`.\n- Detailed rendered evidence is stored in a versioned manifest under\n `.webstudio/audits`; compact output includes its path and screenshot count.\n- Rendered checks also report broken images, eager images below the fold, and\n image sources more than 2x their rendered dimensions in both axes, including\n Webstudio instance ids and measured dimensions when available.\n- Rendered checks include sanitized Resource Timing evidence and report\n browser-marked render-blocking resources plus legacy `.ttf`, `.otf`, and\n `.woff` fonts without applying a universal transfer-size threshold.\n- Fix findings through semantic mutation commands, then rerun `audit` to confirm their deterministic finding ids disappeared.\n\n## Refactor targeted content\n\nCommands:\n\n- MCP tool: list-instances {"pagePath":"/"}\n- MCP tool: list-texts {"pagePath":"/"}\n- MCP tool: update-text {"instanceId":"<instanceId>","childIndex":0,"text":"Launch faster"}\n- MCP tool: replace-text {"find":"Old headline","replace":"New headline","match":"exact","pagePath":"/pricing","limit":20}\n- MCP tool: update-props {"updates":"props.json contents"}\n- MCP tool: update-page {"pageId":"<pageId>","values":{"title":"Pricing","meta":{"description":"Plans"}}}\n- MCP tool: update-resource {"resourceId":"<resourceId>","values":{"url":"https://api.example.com/posts"}}\n- MCP tool: replace-asset {"fromAssetId":"<oldAssetId>","toAssetId":"<newAssetId>"}\n- MCP tool: replace-styles {"property":"color","fromValue":{"type":"keyword","value":"red"},"toValue":{"type":"keyword","value":"blue"}}\n- MCP tool: rewrite-css-variable-refs {"map":"variables.json contents"}\n\nNotes:\n\n- Use focused reads first, then mutate only matching instances, props, metadata, resource URLs, assets, or style references. Use `replace-text` for bounded literal text changes, `replace-prop-text` for bounded static prop text, `replace-resource-text` for fixed resource names/URLs, and `update-text` for one known child or expressions.\n\n## Optimize existing project\n\nCommands:\n\n- MCP tool: list-pages {"includeFolders":true}\n- MCP tool: update-page {"pageId":"<pageId>","values":{"title":"Pricing","meta":{"description":"Plans"}}}\n- MCP tool: update-props {"updates":"props.json contents"}\n- MCP tool: list-breakpoints {}\n- MCP tool: update-breakpoint {"breakpointId":"tablet","values":{"maxWidth":1023}}\n- MCP tool: get-styles {"instanceIds":["<instanceId>"],"includeTokens":true}\n- MCP tool: update-styles {"updates":"styles.json contents"}\n- MCP tool: attach-design-token {"designTokenId":"<tokenId>","instanceIds":"instances.json contents"}\n- MCP tool: update-project-settings {"meta":{"siteName":"Acme"}}\n\nNotes:\n\n- Use this for SEO metadata, accessibility labels, responsive behavior, token consistency, and project settings.\n\n## Connect external data\n\nCommands:\n\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"title","value":{"type":"string","value":"Hello"}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"tags","value":{"type":"string[]","value":["news","product"]}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"filters","value":{"type":"json","value":{"tag":"news"}}}\n- MCP tool: create-resource {"resource":{"name":"Posts","method":"get","url":"https://api.example.com/posts","searchParams":[{"name":"tag","value":"filters.tag"},{"name":"source","value":{"type":"literal","value":"website"}}],"headers":[]},"scopeInstanceId":"<instanceId>","dataSourceName":"posts"}\n- MCP tool: create-resource {"resource":{"name":"Post GraphQL","control":"graphql","method":"post","url":"https://api.example.com/graphql","headers":[{"name":"Content-Type","value":{"type":"literal","value":"application/json"}}],"body":"{ query: \\"query Post($slug: String!) { post(slug: $slug) { title } }\\", variables: { slug: system.params.slug } }"},"scopeInstanceId":"<instanceId>","dataSourceName":"post"}\n- MCP tool: create-resource {"resource":{"name":"Current Date","control":"system","method":"get","url":"/$resources/current-date","headers":[]},"scopeInstanceId":"<instanceId>","dataSourceName":"currentDate"}\n- MCP tool: update-resource {"resourceId":"<resourceId>","values":{"url":"https://api.example.com/posts"}}\n- MCP tool: bind-props {"bindings":"bindings.json contents"}\n- MCP tool: insert-fragment {"parentInstanceId":"<instanceId>","fragment":"<ws.collection>{/_ collection content _/}</ws.collection>"}\n\nNotes:\n\n- Use this for CMS sections, blog listings, Ghost/headless CMS pages, n8n-style integrations, and API URLs built from variables.\n- For read data, expose GET resources as scoped data variables with `scopeInstanceId`/`dataSourceName` and read the loaded result from the resource result wrapper, usually `.data`.\n- For writes, webhooks, GraphQL submissions, and deletes, prefer unscoped resources bound to Form `action` props so they become action resources instead of auto-loaded read resources.\n- Use direct props for fixed values and prop bindings only when a prop must read a data variable, resource, action, or documented runtime context value such as `system`.\n\n## Render an array or object as repeated content\n\nCommands:\n\n- MCP tool: insert-collection {"parentInstanceId":"<instanceId>","data":{"type":"expression","value":"posts.data.items"},"itemFragment":"<ws.element ws:tag=\\"article\\"><ws.element ws:tag=\\"h2\\">{expression`collectionItem.title`}</ws.element></ws.element>"}\n- MCP tool: inspect-instance {"instanceId":"<collectionId>","include":["props","bindings","children"]}\n\nNotes:\n\n- Use Collection whenever an array or object from a resource or data variable should render a list, grid, cards, table rows, options, tabs, or other repeated UI.\n- Pass `insert-collection` the complete array or object. Do not pass the resource response wrapper or one indexed item. External resource arrays are commonly nested under the scoped resource result\'s `data` field or deeper.\n- Pass one repeated-item Webstudio JSX root. The command creates the Collection, its private current-item/current-key parameters, the iterable binding, and descendant item bindings atomically.\n- Collection renders the item root once for every entry. Use `expression` values such as `collectionItem.title` in descendant text and props. Object iteration also exposes `collectionItemKey`.\n- Wrap multiple repeated sibling instances in one Element inside Collection.\n- For repeated Radix items such as accordion items, tabs, or menu options, bind a stable unique id or slug to every required `value` prop.\n- See the [Collection documentation](https://docs.webstudio.is/university/core-components/collection) for the equivalent Builder workflow.\n\n## Support dynamic runtime behavior\n\nCommands:\n\n- MCP tool: update-props {"updates":"props.json contents"}\n- MCP tool: bind-props {"bindings":"bindings.json contents"}\n- MCP tool: create-resource {"resource":{"name":"Seats","method":"get","url":"https://api.example.com/seats","headers":[]}}\n- MCP tool: snapshot {"include":["instances","props","resources"]}\n- MCP tool: apply-patch {"baseVersion":"<version>","transactions":"patch.json contents"}\n\nNotes:\n\n- Use existing scripts/resources for behavior, then move presentational structure into editable Webstudio instances where possible.\n- There is no dedicated semantic command yet for converting script-generated UI into editable Webstudio structure.\n\n## Build authenticated pages\n\nCommands:\n\n- MCP tool: create-page {"name":"Account","path":"/account"}\n- MCP tool: update-page {"pageId":"<pageId>","values":{"meta":{"auth":{"login":"<login>","password":"<password>"}}}}\n- MCP tool: create-resource {"resource":{"name":"Session","method":"get","url":"https://api.example.com/session","headers":[]}}\n- MCP tool: create-variable {"scopeInstanceId":"<instanceId>","name":"user","value":{"type":"json","value":{}}}\n- MCP tool: update-props {"updates":"props.json contents"}\n- MCP tool: bind-props {"bindings":"bindings.json contents"}\n\nNotes:\n\n- Basic auth is semantic today. Provider-specific Supabase/Firebase setup still requires manual resources, props, embeds, or patches.\n\n## Generate from design input\n\nCommands:\n\n- MCP tool: create-page {"name":"Landing","path":"/landing"}\n- MCP tool: create-design-token {"tokens":"tokens.json contents"}\n- MCP tool: define-css-variable {"vars":"vars.json contents"}\n- MCP tool: insert-fragment {"parentInstanceId":"<instanceId>","fragment":"<ws.element ws:tag=\\"section\\"><ws.element ws:tag=\\"p\\">Section copy</ws.element></ws.element>"}\n- MCP tool: update-styles {"updates":"styles.json contents"}\n- MCP tool: preview.start {"host":"127.0.0.1","port":5173}\n- MCP tool: screenshot {"path":"/","output":"current.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n- MCP tool: screenshot {"baseUrl":"http://127.0.0.1:5177","path":"/","output":"current.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n\nNotes:\n\n- Use this after external design interpretation. There is no dedicated import command for Figma, screenshots, Inception output, or design.md yet.\n\n## Cross-project maintenance\n\nCommands:\n\n- webstudio init --link <api-share-link> --json\n- webstudio permissions --json\n- webstudio mcp\n\nNotes:\n\n- Public API and CLI intentionally operate on one configured project at a time. Use an external script to loop over projects.\n\n# Known CLI Gaps\n\n## Provider-specific authenticated pages\n\nMissing:\nCLI supports page basic auth and generic resources/props/embeds, but not guided Supabase/Firebase auth setup.\n\nCurrent fallback:\nCreate the page, resources, variables, props, and embeds manually with existing MCP semantic tools.\n\nSuggested commands:\n\n- setup-auth-page\n\n## Dynamic script/runtime integration helpers\n\nMissing:\nCLI can manipulate props/resources/embeds, but has no semantic workflow for converting script-generated UI into editable Webstudio structures.\n\nCurrent fallback:\nUse MCP props, resources, and raw patch where necessary.\n\nSuggested commands:\n\n- integrate-runtime-ui\n\n## Generate from design input\n\nMissing:\nNo command imports Figma, screenshots, Inception output, or design.md and turns it into pages/tokens/layout.\n\nCurrent fallback:\nUse external generation, then apply semantic CLI commands or apply-patch.\n\nSuggested commands:\n\n- generate-from-design\n\n## Built-in cross-project maintenance\n\nMissing:\nPublic API and CLI intentionally operate on one configured project at a time; there is no built-in multi-project discovery or loop runner.\n\nCurrent fallback:\nRun the CLI from an external script that reconfigures one project/session at a time.\n\nSuggested commands:\n\n- none\n',"manual-api":'# Webstudio API CLI Manual\n\nThe API commands operate on the single project configured by:\n\n- .webstudio/config.json: projectId\n- global Webstudio config: origin and token\n\n- Pass --json to API/discovery commands that support it. Do not add --json to top-level commands unless their help/schema documents it.\n- Never pass a project id. Commands use configured project only.\n- Read ids before writing. Do not invent ids for existing records.\n- stdout is one JSON object. stderr is diagnostics.\n- Prefer MCP semantic tools for detailed project edits. Use MCP apply-patch only when no semantic tool exists.\n\n## Start\n\n{{start}}\n\n## Read First\n\n{{readFirst}}\n\n## Project Session Cache\n\n- CLI commands use one local ProjectSession snapshot for the configured project.\n- Local-capable reads use cached namespaces when compatible and fetch only missing or stale namespaces.\n- Local-capable mutations build patches from the local snapshot, then commit with the cached build version.\n- Successful mutation commits update the local snapshot only after the remote commit succeeds.\n- Server-only commands run remotely and invalidate/refetch namespaces declared by the operation catalog.\n- Use --refresh on local-capable commands to refresh required namespaces before running.\n- Successful JSON responses include compact meta.session with operationId, buildId, version, source, committed, namespaceCounts, diagnosticCount, non-empty diagnostic summaries, and optional compatibilityVersion.\n\n## CLI Capability Inventory\n\nFor a short end-consumer summary of what MCP can do, see\n`manual mcp` / `webstudio man mcp`. The MCP inventory describes the same\nproject, page, element, style, data, asset, publish, domain, and visual\nverification capabilities without internal command names.\n\n### Top-Level Commands\n\n{{topLevelCapabilityIndex}}\n\n### High-Level API Commands By Area\n\n{{apiCapabilityIndex}}\n\n### MCP Tool Operations\n\nThese are MCP tools. From a shell, call them with the shortcut form `webstudio <tool> \'<json>\'` or with the explicit form `webstudio mcp single-op-call <tool> \'<json>\'`:\n\n{{mcpOnlyCommandIndex}}\n\n## Task Recipes\n\n{{taskRecipeIndex}}\n\n## Use Case Index\n\n{{useCaseIndex}}\n\n## Known CLI Gaps\n\n{{knownCliGapIndex}}\n\n## Input File Shapes\n\n{{inputFileShapeIndex}}\n\n## Raw Patch Fallback\n\napply-patch accepts either BuildPatchTransaction[] or { "transactions": BuildPatchTransaction[] }.\n\nEach transaction has:\n\n{\n"id": "patch-transaction-label",\n"payload": [\n{\n"namespace": "projectSettings",\n"patches": [\n{ "op": "replace", "path": ["meta", "siteName"], "value": "New Site" }\n]\n}\n]\n}\n\nThe transaction id is a patch label used for optimistic synchronization. It is\nnot a Builder record id. Do not invent ids for pages, instances, props,\nbreakpoints, resources, variables, folders, assets, or other project records.\n\nPatch paths are JSON-patch-like paths into Builder store data. Map-like namespaces use ids as the first path item.\n\nSupported namespaces:\n\n- pages: redirects, page records, and folders\n- projectSettings: project-wide metadata and compiler settings\n- instances: element instances and children, including text/expression children\n- props: element props, bindings, page references, resource bindings\n- styles: CSS declarations keyed by style declaration key\n- styleSources: local style sources and reusable design tokens\n- styleSourceSelections: instance-to-style-source connections\n- dataSources: data variables, parameters, and resource data sources\n- resources: data resource definitions\n- assets: project asset records handled by the existing asset patch path\n- breakpoints: responsive breakpoints\n- marketplaceProduct: marketplace metadata\n\n## Data Sources\n\n`dataSources` is the internal Builder namespace for variables. Public API, CLI,\nand MCP tools expose it through two user-facing groups:\n\n- data variables: `list-variables`, `create-variable`, `update-variable`, and\n `delete-variable`\n- data resources: `list-resources`, `create-resource`, `update-resource`, and\n `delete-resource`\n\nFor raw `snapshot`, request the public `variables` namespace rather than the\ninternal `dataSources` name. Raw patch payloads still use `dataSources` when\napplying direct changes.\n\nVariables can be scoped to an instance. Expressions under that instance can use\nthe variable by name; nested variables with the same name mask outer variables.\nVariable values support `string`, `number`, `boolean`, `string[]`, and `json`.\nUse `string[]` for lists of strings such as tags or selected categories; use\n`json` for objects, arrays with mixed shapes, or nested API filter state.\nParameters are internal scoped runtime values provided by pages, collections,\nor components. They are not a public authoring surface: do not create, update,\nor delete parameter records. Public tools should preserve existing parameter\nrecords and may reference documented context values such as `system` in\nexpressions where they are already in scope.\n\nResource `url` accepts plain fixed URLs and paths, for example\n`https://api.example.com/posts` or `/$resources/current-date`. Dynamic URLs can\ncombine strings and variables, for example\n`"https://api.example.com/posts?tag=" + filters.tag`. Prefer `searchParams` for\nquery parameters that should be encoded separately:\n`[{ "name": "tag", "value": "filters.tag" }]`. Header values, search parameter\nvalues, and bodies are expressions for dynamic content. For fixed text, use\n`{ "type": "literal", "value": "application/json" }`; Webstudio stores the\nrequired string expression. Headers can still read variables such as\n`"Bearer " + auth.token`, and GraphQL bodies can return objects such as\n`{ query: "...", variables: { slug: system.params.slug } }`.\n\nCreate a GET resource with `scopeInstanceId` when the fetched resource result\nshould be available as a read data variable. Scoped GET resources default to\n`exposeAsDataSource: true`, are generated into the page resource `data` map,\nand may be loaded during page rendering. Use `dataSourceName` to choose the\nvariable name.\n\nFor submit/write/action resources, create the resource without\n`scopeInstanceId`, then bind a component prop such as a Form `action` to the\nresource with `bind-props` and `binding.type: "resource"`. Prop-bound resources\nare generated into the page resource `action` map instead of the read `data`\nmap. Use this shape for POST, PUT, DELETE, webhook, and other resources that\nshould run only from an explicit form/action flow, not merely because the page\nrendered.\n\nPOST, PUT, and DELETE resources default to `exposeAsDataSource: false` even\nwhen a scope is supplied. Set `exposeAsDataSource: true` only when a write-method\nresource intentionally provides render-time data, such as a read-only GraphQL\nPOST query. A scope is required, and the result includes a warning because the\nrequest may execute during page rendering. Set `exposeAsDataSource: false` on\n`update-resource` to detach an existing render-time data source.\n\nResource `method` can be `get`, `post`, `put`, or `delete`. Use GET for read\ndata. Use POST for creates, GraphQL requests, webhooks, and form submissions.\nUse PUT for full updates/replacements. Use DELETE for deletion actions.\nOptional `control` values are `graphql` and `system`: `graphql` marks a\nGraphQL-style resource, usually POST with a query body; `system` marks a\nresource intended to use the built-in `system` parameter or one of the built-in\nlocal resource URLs: `"/$resources/sitemap.xml"`,\n`"/$resources/current-date"`, and `"/$resources/assets"`. The system parameter\nfields are `system.origin`, `system.pathname`, `system.params`, and\n`system.search`.\n\nUse prop bindings for dynamic values that read variables or resources; use\ndirect props for static values.\n\nCommit raw patch:\n\nMCP tool: apply-patch\n\n## Raw Patch Examples\n\nRename the site:\n\n[\n{\n"id": "patch-site-name",\n"payload": [\n{\n"namespace": "projectSettings",\n"patches": [\n{ "op": "add", "path": ["meta", "siteName"], "value": "Acme Studio" }\n]\n}\n]\n}\n]\n\nUpdate page title metadata:\n\n[\n{\n"id": "patch-page-title",\n"payload": [\n{\n"namespace": "pages",\n"patches": [\n{ "op": "replace", "path": ["pages", "page-id", "meta", "title"], "value": "Pricing" }\n]\n}\n]\n}\n]\n\nUpdate a text child on an element:\n\n[\n{\n"id": "patch-text",\n"payload": [\n{\n"namespace": "instances",\n"patches": [\n{ "op": "replace", "path": ["instance-id", "children", 0, "value"], "value": "Launch faster" }\n]\n}\n]\n}\n]\n\nCreate records with semantic operations such as create-variable,\ncreate-resource, create-design-token, create-page, create-folder,\nand create-breakpoint. Raw patch rejects generated record\ncreation, collection replacement, record replacement with a different `id`, and\nrecord id field mutations in id-keyed namespaces because Webstudio must generate\nand preserve record ids.\n\n## Safety Rules\n\n- For MCP apply-patch, read the latest version with MCP snapshot before writing.\n- Reuse ids from MCP snapshot output when updating existing records.\n- Do not create generated records, replace generated record collections, replace records with different ids, or mutate record id fields with raw patch. Use semantic create operations so Webstudio generates ids.\n- If apply-patch reports a version conflict, read the latest build and regenerate the patch.\n- Prefer semantic MCP read tools for discovery, then use MCP snapshot for exact patch paths.\n\n## Command Index\n\n{{commandIndex}}\n',"manual-llm":- '# Webstudio CLI Manual for LLMs\n\nUse this order. Stop only when a command returns ok:false.\n\nIf you are inside the Webstudio monorepo, the first command discovery should use\nthe local CLI exactly as `node packages/cli/local.js ...` from the repo root. Do\nnot use `packages/cli/bin.js` for local source-tree work; it is the packaged\nbuild entry and may use stale built output. Do not use `pnpm exec webstudio`,\n`pnpm --filter webstudio exec webstudio`, or a global `webstudio`: they can\nresolve an older binary.\n\nFor delegated design-system or “use every component” tasks, skip the generic warm-up sequence and start with exactly one MCP command: `webstudio workflow.next \'{"goal":"design-system-page"}\'`. Report that returned checkpoint to the parent/user and stop until continued.\n\n## Always\n\n1. webstudio permissions --json\n2. For bounded shell workflows, call MCP tools directly through the CLI shortcut, for example `webstudio meta.index` or `webstudio insert-fragment \'<json>\' --dry-run`. The explicit form `webstudio mcp single-op-call <tool> \'<json>\'` is equivalent and useful when you need to make the MCP boundary obvious. Use `webstudio mcp run \'[{"tool":"components.find","input":{"brief":"button"}}]\'` for multiple calls in one shared CLI session. Use a normal JSON file path for large batches. Use long-running `webstudio mcp` only when your environment is a real MCP client. Do not manually send raw JSON-RPC to `webstudio mcp` from a shell or PTY.\n3. Read MCP `meta.index`, for example `webstudio meta.index`.\n4. Use focused MCP calls with concrete JSON: `webstudio meta.guide \'{"brief":"Create a design system page using every component"}\'`, `webstudio meta.get_more_tools \'{"tools":["insert-fragment"]}\'`, `webstudio components.list \'{"source":"all"}\'`, `webstudio components.coverage-plan`, `webstudio components.search \'{"brief":"radix select"}\'`, `webstudio components.get \'{"component":"@webstudio-is/sdk-components-react-radix:Select"}\'`, `webstudio templates.list`, and `webstudio templates.get \'{"component":"@webstudio-is/sdk-components-react-radix:Select"}\'`.\n5. Read overview resources `webstudio://project/tools-overview` or `webstudio://project/components-overview` when useful. Read full resources `webstudio://project/tools` or `webstudio://project/components` only when focused tools are insufficient.\n6. Pick focused MCP read tool.\n7. Pick semantic MCP write tool.\n\nUse `webstudio schema mcp` for a tiny MCP tool overview. Use `webstudio schema mcp --detail summary` for all tool descriptions, and `webstudio schema mcp --detail full` only when exact input schemas for all tools are truly needed; otherwise prefer focused `meta.get_more_tools` and `components.*` calls.\n\nRun these commands from the linked project root. Use the MCP startup status line\'s absolute root for local files; write temporary scripts and artifacts under `<project root>/.temp`, not under a parent workspace.\n\nMonorepo quick path for a simple styled section:\n\n```sh\nnode packages/cli/local.js mcp single-op-call meta.index\nnode packages/cli/local.js mcp single-op-call meta.get_more_tools \'{"tools":["insert-fragment"]}\'\nnode packages/cli/local.js mcp single-op-call insert-fragment \'{"parentInstanceId":"parent-id","fragment":"<ws.element ws:tag=\\"section\\" ws:style={css`padding: 32px; display: grid; gap: 12px;`}><ws.element ws:tag="h2">Launch Kit</ws.element><ws.element ws:tag="p">A focused section created with Webstudio JSX.</ws.element><ws.element ws:tag="button">Get started</ws.element></ws.element>"}\' --dry-run\n```\n\nThe same local shortcut form is shorter and preferred for simple shell steps:\n\n```sh\nnode packages/cli/local.js meta.index\nnode packages/cli/local.js meta.get_more_tools \'{"tools":["insert-fragment"]}\'\nnode packages/cli/local.js insert-fragment \'{"parentInstanceId":"parent-id","fragment":"<ws.element ws:tag=\\"section\\" ws:style={css`padding: 32px; display: grid; gap: 12px;`}><ws.element ws:tag="h2">Launch Kit</ws.element><ws.element ws:tag="p">A focused section created with Webstudio JSX.</ws.element><ws.element ws:tag="button">Get started</ws.element></ws.element>"}\' --dry-run\n```\n\nFor this simple path, do not grep source files, dump full MCP resources, or write parser scripts first. Use `list-pages`, `get-page-by-path`, or `list-instances` only to get the target `parentInstanceId`.\n\nWhen authoring JSX for `insert-fragment`, use Webstudio component helpers and Webstudio style syntax. Use `ws:style={css\\`...\\`}`for Webstudio-native CSS, or use React-style object syntax such as`style={{ padding: 24 }}` when that is simpler. Both forms create editable Webstudio style data.\n\nWhen the task says another user will edit a page in Content mode, use a Content Block (`ws:block`) around every editable region. Content-mode users can edit text and supported props only in descendants of that block; content outside it is read-only. Put reusable insertable options in the block\'s `ws:block-template` child. Do not put intended editor content inside that template container: templates are protected source material, while an inserted template copy becomes an editable direct child of the Content Block. Verify this structure before handoff.\n\nDo not access host globals or dynamic code APIs in JSX fragments, including `process`, `globalThis`, `eval`, `Function`, or `constructor`. JSX fragments are declarative project data; use the built-in Webstudio helpers instead.\n\nUse Webstudio prop names in JSX: `class`, `for`, `aria-label`, and other HTML/Webstudio names. Do not use React-only aliases such as `className` or `htmlFor`; the runtime rejects them with the Webstudio prop name to use.\n\nUse Webstudio actions for event/action props. Do not pass JavaScript functions such as `onClick={() => ...}`; the runtime rejects them because functions cannot be persisted as Webstudio project data.\n\n```tsx\n<ws.element\n ws:tag="button"\n onClick={new ActionValue(["event"], expression`console.log(event)`)}\n>\n Open\n</ws.element>\n```\n\nPlain JSX prop values must be JSON-compatible: `null`, strings, booleans, finite numbers, arrays, and plain objects. Do not pass `undefined`, `Symbol`, `BigInt`, `NaN`, `Infinity`, `Date`, `Map`, `Set`, class instances, or circular objects; omit the prop, use plain data, or use `expression`/`ActionValue` when the value is dynamic.\n\nIf a component has a registered template with required parts, JSX must include those parts explicitly under the same parent structure as the template, for example `<radix.Switch><radix.SwitchThumb /></radix.Switch>`. Use `insert-component` when you want Webstudio to apply one component template automatically.\n\n## Animation Components\n\nBefore creating animation examples, inspect the exact components with focused discovery:\n\n```sh\nwebstudio components.get \'{"component":"@webstudio-is/sdk-components-animation:AnimateChildren"}\'\nwebstudio components.get \'{"component":"@webstudio-is/sdk-components-animation:AnimateText"}\'\nwebstudio components.get \'{"component":"@webstudio-is/sdk-components-animation:StaggerAnimation"}\'\nwebstudio components.get \'{"component":"@webstudio-is/sdk-components-animation:VideoAnimation"}\'\n```\n\nUse Animation Group (`AnimateChildren`) as the controller. Put normal instances directly inside it, or put Text Animation, Stagger Animation, or Video Animation directly inside it. Text, Stagger, and Video are helper components with `contentModel.category: "none"` and should not be used as standalone section roots.\n\nDefine timing and CSS changes on the Animation Group `action` prop. Use `type:"view"` for viewport entry/exit progress and `type:"scroll"` for scroll-progress timelines. For in animations, keep the canvas styles as the final state and use `fill:"backwards"` with keyframes that describe the starting state. For out animations, use `fill:"forwards"` with keyframes that describe the ending state.\n\nText Animation settings: `slidingWindow` defaults to `5`, `easing` defaults to `linear`, and `splitBy` defaults to `char`. Use `splitBy:"space"` for word-by-word animation. The parent Animation Group keyframes provide the actual opacity, translate, scale, or other styles.\n\nStagger Animation settings: `slidingWindow` defaults to `1` and `easing` defaults to `linear`. It applies parent Animation Group progress across its direct children. Use `slidingWindow:0` for instant sequential steps, `1` for one child at a time, and values above `1` for overlapping waves.\n\nVideo Animation settings: `timeline` is a boolean. Prefer `insert-component` for Video Animation so the Video child template is inserted, then configure the Video child asset/source. Use short, seek-friendly videos for smooth scroll-linked playback.\n\nUse JSX fragments for authored animation structures when you need styled, editable examples. Put the final visual state in `ws:style` and put the starting or ending animated state in the Animation Group `action` keyframes. Include an explicit `offset` on every keyframe: use `offset: 0` for starting-state keyframes with `fill:"backwards"` and `offset: 1` for ending-state keyframes with `fill:"forwards"`.\n\n```tsx\n<animation.AnimateChildren\n action={{\n type: "view",\n axis: "block",\n animations: [\n {\n name: "Fade up on entry",\n timing: {\n fill: "backwards",\n rangeStart: ["entry", { type: "unit", value: 0, unit: "%" }],\n rangeEnd: ["entry", { type: "unit", value: 100, unit: "%" }],\n },\n keyframes: [\n {\n offset: 0,\n styles: {\n opacity: { type: "unit", value: 0, unit: "number" },\n translate: {\n type: "tuple",\n value: [\n { type: "unit", value: 0, unit: "number" },\n { type: "unit", value: 24, unit: "px" },\n ],\n },\n },\n },\n ],\n },\n ],\n }}\n>\n <ws.element\n ws:tag="section"\n ws:style={css`\n display: grid;\n gap: 16px;\n padding: 48px;\n border-radius: 24px;\n background: #111827;\n color: white;\n `}\n >\n <ws.element ws:tag="h2">Launch metrics</ws.element>\n <ws.element ws:tag="p">\n A polished card that fades up as it enters the viewport.\n </ws.element>\n </ws.element>\n</animation.AnimateChildren>\n```\n\nFor Text Animation, keep `animation.AnimateText` as the direct child of Animation Group and place the text-containing element inside it:\n\n```tsx\n<animation.AnimateChildren\n action={{\n type: "view",\n animations: [\n {\n name: "Parallax In",\n timing: {\n fill: "backwards",\n rangeStart: ["cover", { type: "unit", value: 0, unit: "%" }],\n rangeEnd: ["cover", { type: "unit", value: 70, unit: "%" }],\n },\n keyframes: [\n {\n offset: 0,\n styles: {\n translate: {\n type: "tuple",\n value: [\n { type: "unit", value: 0, unit: "number" },\n { type: "unit", value: 100, unit: "px" },\n ],\n },\n },\n },\n ],\n },\n {\n name: "Opacity In",\n timing: {\n fill: "backwards",\n rangeStart: ["cover", { type: "unit", value: 0, unit: "%" }],\n rangeEnd: ["cover", { type: "unit", value: 70, unit: "%" }],\n },\n keyframes: [\n {\n offset: 0,\n styles: {\n opacity: { type: "unit", value: 0, unit: "number" },\n },\n },\n ],\n },\n {\n name: "Scale In",\n timing: {\n fill: "backwards",\n rangeStart: ["cover", { type: "unit", value: 0, unit: "%" }],\n rangeEnd: ["cover", { type: "unit", value: 70, unit: "%" }],\n },\n keyframes: [\n {\n offset: 0,\n styles: {\n scale: {\n type: "tuple",\n value: [\n { type: "unit", value: 5, unit: "number" },\n { type: "unit", value: 5, unit: "number" },\n ],\n },\n },\n },\n ],\n },\n {\n name: "Parallax Out",\n timing: {\n fill: "forwards",\n rangeStart: ["cover", { type: "unit", value: 50, unit: "%" }],\n rangeEnd: ["cover", { type: "unit", value: 100, unit: "%" }],\n },\n keyframes: [\n {\n offset: 1,\n styles: {\n translate: {\n type: "tuple",\n value: [\n { type: "unit", value: 0, unit: "number" },\n { type: "unit", value: -100, unit: "px" },\n ],\n },\n scale: {\n type: "tuple",\n value: [\n { type: "unit", value: 5, unit: "number" },\n { type: "unit", value: 5, unit: "number" },\n ],\n },\n opacity: { type: "unit", value: 0, unit: "number" },\n },\n },\n ],\n },\n ],\n insetStart: { type: "unit", value: 5, unit: "%" },\n insetEnd: { type: "unit", value: 5, unit: "%" },\n isPinned: true,\n }}\n>\n <animation.AnimateText\n splitBy="space"\n slidingWindow={5}\n easing="easeOutQuart"\n >\n <ws.element ws:tag="h2">Animate words with controlled rhythm</ws.element>\n </animation.AnimateText>\n</animation.AnimateChildren>\n```\n\nFor Stagger Animation, put the repeated cards or rows directly inside `animation.StaggerAnimation`:\n\n```tsx\n<animation.AnimateChildren\n action={{\n type: "view",\n animations: [\n {\n timing: {\n fill: "backwards",\n rangeStart: ["contain", { type: "unit", value: 0, unit: "%" }],\n rangeEnd: ["contain", { type: "unit", value: 30, unit: "%" }],\n },\n keyframes: [\n {\n offset: 0,\n styles: {\n opacity: { type: "unit", value: 0, unit: "number" },\n },\n },\n ],\n },\n ],\n }}\n>\n <animation.StaggerAnimation>\n <ws.element\n ws:tag="article"\n ws:style={css`\n padding: 20px;\n border: 1px solid #d1d5db;\n border-radius: 16px;\n `}\n >\n Plan\n </ws.element>\n <ws.element\n ws:tag="article"\n ws:style={css`\n padding: 20px;\n border: 1px solid #d1d5db;\n border-radius: 16px;\n `}\n >\n Build\n </ws.element>\n <ws.element\n ws:tag="article"\n ws:style={css`\n padding: 20px;\n border: 1px solid #d1d5db;\n border-radius: 16px;\n `}\n >\n Launch\n </ws.element>\n </animation.StaggerAnimation>\n</animation.AnimateChildren>\n```\n\nFor Video Animation, use the registered template via `insert-component` when possible. If you author JSX, include the Video child explicitly:\n\n```tsx\n<animation.AnimateChildren\n action={{\n type: "view",\n animations: [\n {\n name: "Video progress",\n timing: {\n fill: "both",\n rangeStart: ["cover", { type: "unit", value: 0, unit: "%" }],\n rangeEnd: ["cover", { type: "unit", value: 100, unit: "%" }],\n },\n keyframes: [{ offset: 0, styles: {} }],\n },\n ],\n }}\n>\n <animation.VideoAnimation timeline={true}>\n <$.Video\n preload="auto"\n autoPlay={true}\n muted={true}\n playsInline={true}\n crossOrigin="anonymous"\n />\n </animation.VideoAnimation>\n</animation.AnimateChildren>\n```\n\n## Command Surface Boundary\n\n- Use top-level `webstudio ...` shell commands for setup, sync/import/build/preview/screenshot, permissions, publish/domains, schema, registry inspection, man, and starting MCP.\n- Use MCP tools for Builder project data manipulation: pages, instances/components, props, text, styles, tokens, variables, resources, assets, breakpoints, redirects, and raw patches.\n- From a shell, call MCP tools with the shortcut form `webstudio <tool> \'<json>\'`, for example `webstudio insert-fragment \'<json>\' --dry-run`. The explicit equivalent is `webstudio mcp single-op-call <tool> \'<json>\'`. Use `--input-file` for large payloads.\n- Inside the Webstudio monorepo, call the local CLI as its own command: `node packages/cli/local.js ...`. Do not wrap the CLI call in `pwd && ...`, command substitution, `pnpm exec webstudio`, `pnpm --filter webstudio exec webstudio`, or a global `webstudio`.\n- For experiments, pass `--dry-run` to local-capable mutation calls. Read the computed transaction from `meta.session.transaction` and its base build version from `meta.session.version`. Copying a `.webstudio` folder is not an isolated project clone; `.webstudio/config.json` still points to the same remote project, so non-dry-run mutations can commit to that project.\n- For bounded multi-step shell work, run inline JSON with `webstudio mcp run \'[{"tool":"components.find","input":{"brief":"button"}}]\'`; this reuses one CLI session without raw JSON-RPC. For large batches, write `{ "calls": [{ "tool": "..." }] }` to a normal JSON file and run `webstudio mcp run .temp/mcp-calls.json`.\n- Use JSON strings for `brief` fields. Never pass boolean flags such as `{"brief":true}`.\n- Treat `webstudio mcp single-op-call` and `webstudio mcp run` stderr lines as progress checkpoints; stdout remains JSON on both success and failure. On failure, parse stdout for `{ "ok": false, "error": { "code": "...", "message": "..." } }` before deciding what to fix.\n- If a CLI/MCP tool crashes, hangs, gives a confusing error, needs an undocumented workaround, or forces source-code inspection for normal usage, ask the user to report it in Discord `#help` at https://wstd.us/community. Give them a complete copy-paste report with the goal, expected behavior, actual error, exact command/tool call, stdout JSON, stderr/lifecycle logs, environment, workaround, and secrets redacted.\n- Run one-shot `webstudio mcp single-op-call` commands sequentially against a linked `.webstudio` folder. If a command returns `PROJECT_SESSION_BUSY`, another CLI/MCP process is updating the local session; wait a moment and retry sequentially.\n- In delegated or non-streaming agent environments, do not batch many MCP calls silently and do not wrap many shortcut or `webstudio mcp single-op-call` commands in a shell loop. Treat each parent-visible checkpoint as the unit of work. If the parent asks for status within 30 seconds, run exactly one shortcut command such as `webstudio meta.index` or one explicit `webstudio mcp single-op-call` command, report that command/result, then wait for the parent to continue. Do not take a broad task such as creating a full design-system page as one execution unit. Call `workflow.next {"goal":"design-system-page"}`, report the returned phase/checkpoint, wait until the parent continues, call `checkpoint.ack {"reported":true,"continueAfterReport":true,"summary":"<what you reported>"}`, complete exactly that bounded phase, and return: discovery, page creation, one dry-run JSX section, one committed JSX section, one `components.coverage-insert-next` call, or one presentation pass. Phase commands do not include nextPhase in their own output. After the parent continues, acknowledge the previous checkpoint first, then call `workflow.next` with the next phase. For all-component design-system pages, checkpoint after workflow planning, discovery, page creation, call `components.coverage-insert-next` once before checkpointing again, then finish with `workflow.next {"goal":"design-system-page","phase":"presentation-pass"}`. Coverage 72/72 is necessary but not sufficient: the page must be organized into styled, real-world examples, not raw unstyled component dumps.\n- For design-system or “use every component” tasks, start with compact `webstudio components.coverage-plan`, checkpoint, then request component coverage details with `webstudio components.coverage-plan \'{"detail":"roots","offset":20}\'` or `{"detail":"parts"}` only when needed. Do not pass `detail` to `list-pages`; use `list-pages {}` or `get-page-by-path` for page lookup.\n- MCP tool shortcuts are only for MCP tools. If a shortcut is ambiguous with a real top-level command, the real top-level command wins; use `webstudio mcp single-op-call <tool> \'<json>\'` to force the MCP path.\n\n## LLM Implementation Process\n\nUse this process for user requests that change Webstudio content, layout, styles, assets, pages, redirects, resources, or publishing state:\n\n1. Discover capabilities with `webstudio man --json`, `webstudio schema api`, `webstudio schema mcp`, MCP `meta.index`, `meta.guide`, `meta.get_more_tools`, `components.list`, `components.summary`, `components.coverage-plan`, `components.search`, `components.get`, `templates.list`, and `templates.get`. From a shell, prefer shortcut calls such as `webstudio meta.index` and `webstudio components.search \'{"brief":"button"}\'` for these focused tool calls; use `webstudio mcp single-op-call` when you need the explicit MCP form. Read full resources such as `webstudio://project/tools` and `webstudio://project/components` only when needed. Do not write scripts to parse full MCP discovery JSON for normal lookup.\n2. Inspect current project state with semantic reads such as `get-project-settings`, `list-pages`, `get-page-by-path`, `list-instances`, `inspect-instance`, `get-styles`, `list-assets`, `list-breakpoints`, and `snapshot` only when needed. Before changing a project, read `get-project-settings` and follow any non-empty `meta.agentInstructions`. These are shared project instructions, not a place for secrets.\n3. Mutate the Webstudio project with semantic MCP write tools first. Prefer MCP `insert-fragment` for authored/styled sections, use `insert-component` only for one automatic component template, then `update-text`, `update-props`, `update-styles`, `upload-asset`, `create-page`, and page/project settings tools over raw patches.\n4. Use `apply-patch` only when no semantic tool covers the required change, and only after reading the latest snapshot/version.\n5. For visual/design work, regenerate or preview the generated app, capture a screenshot, inspect it with vision, and iterate before final response.\n6. Report what changed and what verification ran.\n\n## Visual Design Workflow\n\nFor requests involving visible HTML/CSS, layout, typography, colors, imagery, responsive behavior, or screenshots:\n\n1. Read editable Webstudio structure first: pages, instances, props, styles, breakpoints, assets, and relevant text.\n2. Do not use generated route/component files as the source of truth for editable content.\n3. Make edits through Webstudio semantic commands/MCP tools so the result stays editable in Builder and survives the next `webstudio build`.\n4. Keep generated project files current, start preview, and capture the changed page with `screenshot`.\n5. Use `screenshot.diff` when a baseline exists and inspect screenshot/diff artifacts with vision before finishing.\n6. If vision or screenshot tooling is unavailable, state that explicitly and explain what fallback verification was used.\n\n## Responsive Verification Workflow\n\nFor responsive page work, use Builder breakpoints as the source of truth:\n\n1. Read breakpoints with `list-breakpoints` before deciding responsive behavior.\n2. Apply responsive styles with existing Builder breakpoint ids; do not invent CSS media queries or breakpoint names when Webstudio breakpoint data exists.\n3. Pick screenshot viewport widths from the project breakpoints: include a desktop width, each defined max-width or min-width edge, and a narrow mobile width.\n4. Capture each viewport with `screenshot`, for example `{"path":"/","output":"home-375.png","viewport":{"width":375,"height":812}}` and `{"path":"/","output":"home-1440.png","viewport":{"width":1440,"height":900}}`.\n5. Inspect every viewport screenshot with vision before finishing, checking layout, overflow, hidden content, text wrapping, and breakpoint-specific style changes.\n6. If any viewport fails, update styles through semantic Webstudio tools and repeat screenshots for the affected breakpoints.\n\n## Generated Files Guardrails\n\n- Do not edit `app/__generated__`, generated route files, generated page files, generated CSS, or build output for normal Webstudio content/design requests.\n- Do not replace generated page components with handcrafted app code unless the user explicitly asks for code-only export customization.\n- Generated files are build artifacts and may be overwritten by `webstudio build`.\n- If a task truly requires generated app customization, keep it outside `app/__generated__` where possible and explain that it is not editable Webstudio content.\n\n## Values vs Bindings\n\nBefore authoring unfamiliar expressions, read `webstudio://project/expressions` with MCP `resources/read` or `webstudio mcp read-resource webstudio://project/expressions`. It documents the supported expression subset, method allowlist, scope, Collection context, and validation limits.\n\n- Use direct value tools for fixed content. For one visible text child, use `update-text` with plain `text`. For a bounded multi-instance literal replacement, use `replace-text` with `find`, `replace`, `pagePath` or `pageId`, and `limit`; it does not change expression children. Use `replace-prop-text` for bounded changes inside static string props, optionally limited to prop names or instance ids; it never changes dynamic bindings. For static props such as `aria-label`, `alt`, `id`, `class`, `href`, or button labels stored as props, use `update-props` with the prop\'s direct type/value.\n- Use `bind-props` only when the prop must stay dynamic: an expression, resource result, action, or existing scoped runtime context such as `system`. Do not use `bind-props` just to set a fixed string.\n- Direct prop string example: `{"updates":[{"instanceId":"button-id","name":"aria-label","type":"string","value":"Open menu"}]}`.\n- Expression binding example: `{"bindings":[{"instanceId":"link-id","name":"href","binding":{"type":"expression","value":"currentPost.url"}}]}`.\n- Page metadata fields such as `title`, `description`, `language`, `redirect`, `status`, and custom meta content accept plain fixed text. For computed values, pass JavaScript expression code such as `pageTitle ?? "Pricing | Acme"`.\n- Page metadata update example: use `update-page` with `{"pageId":"page-id","values":{"title":"Pricing | Acme","meta":{"description":"Plans for teams"}}}`.\n- Resource `url` accepts plain fixed URLs and paths. For computed URLs, pass JavaScript expression code such as `"https://api.example.com/items?tag=" + filters.tag`. Resource header values, search parameter values, and text bodies accept expressions for dynamic values; for fixed text, use `{ "type": "literal", "value": "application/json" }`.\n- Resource update example: use `update-resource` with `{"resourceId":"resource-id","values":{"url":"https://api.example.com/items"}}`.\n- Data variable values support `string`, `number`, `boolean`, `string[]`, and `json`. Use `string[]` only for arrays where every item is a string; use `json` for objects, mixed arrays, filters, and nested data.\n- Parameters are internal scoped runtime values from pages, collections, or components. They are not a public authoring surface: do not create, update, or delete parameter records. Public tools should preserve existing parameter records and may reference documented context values such as `system` in expressions where they are already in scope.\n- Use scoped resources for read data. A GET resource created with `scopeInstanceId`/`dataSourceName` defaults to `exposeAsDataSource:true`, becomes a scoped resource data variable, is generated into the page resource `data` map, and may be loaded while rendering the page. Read the loaded resource result from its wrapper, usually `.data`.\n- Use prop-bound resources for actions. A resource created without `scopeInstanceId` and bound to a component prop such as Form `action` with `bind-props` and `binding.type: "resource"` becomes an action resource in the page resource `action` map. Use this for POST, PUT, DELETE, webhooks, GraphQL submissions, and anything that should run only from an explicit form/action flow.\n- POST, PUT, and DELETE resources default to `exposeAsDataSource:false`, even with a scope. Set `exposeAsDataSource:true` only for an intentional render-time read such as a GraphQL POST query; provide `scopeInstanceId` and inspect the returned warning. Set it to `false` during `update-resource` to detach existing render-time exposure.\n- For dynamic resource query parameters prefer `searchParams`, for example `{"name":"tag","value":"filters.tag"}`. Use `{"type":"literal","value":"website"}` for fixed request text. Header values can be expressions such as `"\\"Bearer \\" + auth.token"`. Body can be an object expression, including GraphQL payloads such as `{ query: "...", variables: { slug: system.params.slug } }`.\n- Resource methods are `get`, `post`, `put`, and `delete`. Optional resource controls are `graphql` and `system`. Use `control:"graphql"` for GraphQL POST resources with query bodies. Use `control:"system"` for built-in local resource URLs such as `"/$resources/current-date"` and for resources reading the built-in `system` parameter. The built-in system fields are `system.origin`, `system.pathname`, `system.params`, and `system.search`; do not use `system.path`.\n- Whenever an array or object from a resource or data variable should render repeated UI, use Collection. Insert `ws:collection` with `insert-component`, bind its `data` prop to the complete iterable rather than the response wrapper or one indexed item, preserve the generated `item`/`itemKey` parameters, and bind descendants to the current iteration context. Wrap multiple repeated siblings in one Element, and give repeated Radix items stable unique `value` bindings.\n- Expressions are single JavaScript expressions, not statements or functions. Functions, arrow functions, classes, `new`, `this`, `await`, imports, arbitrary calls, increment/decrement, and assignment outside actions are unsupported. Prefer optional chaining, nullish coalescing, ternaries, property/index access, operators, and the documented string/array methods.\n\n## Pick Read Command\n\n{{readFirst}}\n\n## Pick Write Command\n\n{{taskRecipeIndex}}\n\n## Raw Patch Only If Needed\n\n1. Use MCP tool: snapshot.\n2. Write BuildPatchTransaction[].\n3. Use MCP tool: apply-patch.\n\n## MCP Argument Examples\n\nMCP tools receive JSON argument objects, not CLI flags. Use these shapes:\n\n{{mcpArgumentExampleIndex}}\n\n## Rules\n\n- Never guess ids for existing records. Read them first.\n- Never use project ids from user input. Commands use the configured project.\n- Use --refresh before a local-capable command when cached data may be stale.\n- Pass --json only to commands whose help/schema documents it. Do not add --json to top-level commands such as sync unless supported.\n- On VERSION_CONFLICT, read MCP snapshot again, regenerate the patch, then retry.\n- Treat stdout JSON as the API contract and stderr as diagnostics.\n- For visual/design work, verify the rendered result with vision before finishing.\n- Do not edit generated files for normal Webstudio content/design requests.\n- Use direct values for static strings and bindings only for dynamic expressions/resources/actions.\n- Use plain fixed text where documented. Only encode a quoted JavaScript string literal when a field is explicitly documented as an expression-only value.\n- Confirm destructive commands with --confirm only when user requested deletion/unpublish/replacement.\n- Use webstudio schema api for machine-readable top-level command metadata and webstudio schema mcp for MCP tool schemas.\n\n## Known Gaps\n\n{{knownCliGapIndex}}\n',+ '# Webstudio CLI Manual for LLMs\n\nUse this order. Stop only when a command returns ok:false.\n\nIf you are inside the Webstudio monorepo, the first command discovery should use\nthe local CLI exactly as `node packages/cli/local.js ...` from the repo root. Do\nnot use `packages/cli/bin.js` for local source-tree work; it is the packaged\nbuild entry and may use stale built output. Do not use `pnpm exec webstudio`,\n`pnpm --filter webstudio exec webstudio`, or a global `webstudio`: they can\nresolve an older binary.\n\nFor delegated design-system or “use every component” tasks, skip the generic warm-up sequence and start with exactly one MCP command: `webstudio workflow.next \'{"goal":"design-system-page"}\'`. Report that returned checkpoint to the parent/user and stop until continued.\n\n## Always\n\n1. webstudio permissions --json\n2. For bounded shell workflows, call MCP tools directly through the CLI shortcut, for example `webstudio meta.index` or `webstudio insert-fragment \'<json>\' --dry-run`. The explicit form `webstudio mcp single-op-call <tool> \'<json>\'` is equivalent and useful when you need to make the MCP boundary obvious. Use `webstudio mcp run \'[{"tool":"components.find","input":{"brief":"button"}}]\'` for multiple calls in one shared CLI session. Use a normal JSON file path for large batches. Use long-running `webstudio mcp` only when your environment is a real MCP client. Do not manually send raw JSON-RPC to `webstudio mcp` from a shell or PTY.\n3. Read MCP `meta.index`, for example `webstudio meta.index`.\n4. Use focused MCP calls with concrete JSON: `webstudio meta.guide \'{"brief":"Create a design system page using every component"}\'`, `webstudio meta.get_more_tools \'{"tools":["insert-fragment"]}\'`, `webstudio components.list \'{"source":"all"}\'`, `webstudio components.coverage-plan`, `webstudio components.search \'{"brief":"radix select"}\'`, `webstudio components.get \'{"component":"@webstudio-is/sdk-components-react-radix:Select"}\'`, `webstudio templates.list`, and `webstudio templates.get \'{"component":"@webstudio-is/sdk-components-react-radix:Select"}\'`.\n5. Read overview resources `webstudio://project/tools-overview` or `webstudio://project/components-overview` when useful. Read full resources `webstudio://project/tools` or `webstudio://project/components` only when focused tools are insufficient.\n6. Pick focused MCP read tool.\n7. Pick semantic MCP write tool.\n\nUse `webstudio schema mcp` for a tiny MCP tool overview. Use `webstudio schema mcp --detail summary` for all tool descriptions, and `webstudio schema mcp --detail full` only when exact input schemas for all tools are truly needed; otherwise prefer focused `meta.get_more_tools` and `components.*` calls.\n\nRun these commands from the linked project root. Use the MCP startup status line\'s absolute root for local files; write temporary scripts and artifacts under `<project root>/.temp`, not under a parent workspace.\n\nMonorepo quick path for a simple styled section:\n\n```sh\nnode packages/cli/local.js mcp single-op-call meta.index\nnode packages/cli/local.js mcp single-op-call meta.get_more_tools \'{"tools":["insert-fragment"]}\'\nnode packages/cli/local.js mcp single-op-call insert-fragment \'{"parentInstanceId":"parent-id","fragment":"<ws.element ws:tag=\\"section\\" ws:style={css`padding: 32px; display: grid; gap: 12px;`}><ws.element ws:tag="h2">Launch Kit</ws.element><ws.element ws:tag="p">A focused section created with Webstudio JSX.</ws.element><ws.element ws:tag="button">Get started</ws.element></ws.element>"}\' --dry-run\n```\n\nThe same local shortcut form is shorter and preferred for simple shell steps:\n\n```sh\nnode packages/cli/local.js meta.index\nnode packages/cli/local.js meta.get_more_tools \'{"tools":["insert-fragment"]}\'\nnode packages/cli/local.js insert-fragment \'{"parentInstanceId":"parent-id","fragment":"<ws.element ws:tag=\\"section\\" ws:style={css`padding: 32px; display: grid; gap: 12px;`}><ws.element ws:tag="h2">Launch Kit</ws.element><ws.element ws:tag="p">A focused section created with Webstudio JSX.</ws.element><ws.element ws:tag="button">Get started</ws.element></ws.element>"}\' --dry-run\n```\n\nFor this simple path, do not grep source files, dump full MCP resources, or write parser scripts first. Use `list-pages`, `get-page-by-path`, or `list-instances` only to get the target `parentInstanceId`.\n\nWhen authoring JSX for `insert-fragment`, use Webstudio component helpers and Webstudio style syntax. Use `ws:style={css\\`...\\`}`for Webstudio-native CSS, or use React-style object syntax such as`style={{ padding: 24 }}` when that is simpler. Both forms create editable Webstudio style data.\n\nWhen the task says another user will edit a page in Content mode, use a Content Block (`ws:block`) around every editable region. Content-mode users can edit text and supported props only in descendants of that block; content outside it is read-only. Put reusable insertable options in the block\'s `ws:block-template` child. Do not put intended editor content inside that template container: templates are protected source material, while an inserted template copy becomes an editable direct child of the Content Block. Verify this structure before handoff.\n\nDo not access host globals or dynamic code APIs in JSX fragments, including `process`, `globalThis`, `eval`, `Function`, or `constructor`. JSX fragments are declarative project data; use the built-in Webstudio helpers instead.\n\nUse Webstudio prop names in JSX: `class`, `for`, `aria-label`, and other HTML/Webstudio names. Do not use React-only aliases such as `className` or `htmlFor`; the runtime rejects them with the Webstudio prop name to use.\n\nUse Webstudio actions for event/action props. Do not pass JavaScript functions such as `onClick={() => ...}`; the runtime rejects them because functions cannot be persisted as Webstudio project data.\n\n```tsx\n<ws.element\n ws:tag="button"\n onClick={new ActionValue(["event"], expression`console.log(event)`)}\n>\n Open\n</ws.element>\n```\n\nPlain JSX prop values must be JSON-compatible: `null`, strings, booleans, finite numbers, arrays, and plain objects. Do not pass `undefined`, `Symbol`, `BigInt`, `NaN`, `Infinity`, `Date`, `Map`, `Set`, class instances, or circular objects; omit the prop, use plain data, or use `expression`/`ActionValue` when the value is dynamic.\n\nIf a component has a registered template with required parts, JSX must include those parts explicitly under the same parent structure as the template, for example `<radix.Switch><radix.SwitchThumb /></radix.Switch>`. Use `insert-component` when you want Webstudio to apply one component template automatically.\n\n## Animation Components\n\nBefore creating animation examples, inspect the exact components with focused discovery:\n\n```sh\nwebstudio components.get \'{"component":"@webstudio-is/sdk-components-animation:AnimateChildren"}\'\nwebstudio components.get \'{"component":"@webstudio-is/sdk-components-animation:AnimateText"}\'\nwebstudio components.get \'{"component":"@webstudio-is/sdk-components-animation:StaggerAnimation"}\'\nwebstudio components.get \'{"component":"@webstudio-is/sdk-components-animation:VideoAnimation"}\'\n```\n\nUse Animation Group (`AnimateChildren`) as the controller. Put normal instances directly inside it, or put Text Animation, Stagger Animation, or Video Animation directly inside it. Text, Stagger, and Video are helper components with `contentModel.category: "none"` and should not be used as standalone section roots.\n\nDefine timing and CSS changes on the Animation Group `action` prop. Use `type:"view"` for viewport entry/exit progress and `type:"scroll"` for scroll-progress timelines. For in animations, keep the canvas styles as the final state and use `fill:"backwards"` with keyframes that describe the starting state. For out animations, use `fill:"forwards"` with keyframes that describe the ending state.\n\nText Animation settings: `slidingWindow` defaults to `5`, `easing` defaults to `linear`, and `splitBy` defaults to `char`. Use `splitBy:"space"` for word-by-word animation. The parent Animation Group keyframes provide the actual opacity, translate, scale, or other styles.\n\nStagger Animation settings: `slidingWindow` defaults to `1` and `easing` defaults to `linear`. It applies parent Animation Group progress across its direct children. Use `slidingWindow:0` for instant sequential steps, `1` for one child at a time, and values above `1` for overlapping waves.\n\nVideo Animation settings: `timeline` is a boolean. Prefer `insert-component` for Video Animation so the Video child template is inserted, then configure the Video child asset/source. Use short, seek-friendly videos for smooth scroll-linked playback.\n\nUse JSX fragments for authored animation structures when you need styled, editable examples. Put the final visual state in `ws:style` and put the starting or ending animated state in the Animation Group `action` keyframes. Include an explicit `offset` on every keyframe: use `offset: 0` for starting-state keyframes with `fill:"backwards"` and `offset: 1` for ending-state keyframes with `fill:"forwards"`.\n\n```tsx\n<animation.AnimateChildren\n action={{\n type: "view",\n axis: "block",\n animations: [\n {\n name: "Fade up on entry",\n timing: {\n fill: "backwards",\n rangeStart: ["entry", { type: "unit", value: 0, unit: "%" }],\n rangeEnd: ["entry", { type: "unit", value: 100, unit: "%" }],\n },\n keyframes: [\n {\n offset: 0,\n styles: {\n opacity: { type: "unit", value: 0, unit: "number" },\n translate: {\n type: "tuple",\n value: [\n { type: "unit", value: 0, unit: "number" },\n { type: "unit", value: 24, unit: "px" },\n ],\n },\n },\n },\n ],\n },\n ],\n }}\n>\n <ws.element\n ws:tag="section"\n ws:style={css`\n display: grid;\n gap: 16px;\n padding: 48px;\n border-radius: 24px;\n background: #111827;\n color: white;\n `}\n >\n <ws.element ws:tag="h2">Launch metrics</ws.element>\n <ws.element ws:tag="p">\n A polished card that fades up as it enters the viewport.\n </ws.element>\n </ws.element>\n</animation.AnimateChildren>\n```\n\nFor Text Animation, keep `animation.AnimateText` as the direct child of Animation Group and place the text-containing element inside it:\n\n```tsx\n<animation.AnimateChildren\n action={{\n type: "view",\n animations: [\n {\n name: "Parallax In",\n timing: {\n fill: "backwards",\n rangeStart: ["cover", { type: "unit", value: 0, unit: "%" }],\n rangeEnd: ["cover", { type: "unit", value: 70, unit: "%" }],\n },\n keyframes: [\n {\n offset: 0,\n styles: {\n translate: {\n type: "tuple",\n value: [\n { type: "unit", value: 0, unit: "number" },\n { type: "unit", value: 100, unit: "px" },\n ],\n },\n },\n },\n ],\n },\n {\n name: "Opacity In",\n timing: {\n fill: "backwards",\n rangeStart: ["cover", { type: "unit", value: 0, unit: "%" }],\n rangeEnd: ["cover", { type: "unit", value: 70, unit: "%" }],\n },\n keyframes: [\n {\n offset: 0,\n styles: {\n opacity: { type: "unit", value: 0, unit: "number" },\n },\n },\n ],\n },\n {\n name: "Scale In",\n timing: {\n fill: "backwards",\n rangeStart: ["cover", { type: "unit", value: 0, unit: "%" }],\n rangeEnd: ["cover", { type: "unit", value: 70, unit: "%" }],\n },\n keyframes: [\n {\n offset: 0,\n styles: {\n scale: {\n type: "tuple",\n value: [\n { type: "unit", value: 5, unit: "number" },\n { type: "unit", value: 5, unit: "number" },\n ],\n },\n },\n },\n ],\n },\n {\n name: "Parallax Out",\n timing: {\n fill: "forwards",\n rangeStart: ["cover", { type: "unit", value: 50, unit: "%" }],\n rangeEnd: ["cover", { type: "unit", value: 100, unit: "%" }],\n },\n keyframes: [\n {\n offset: 1,\n styles: {\n translate: {\n type: "tuple",\n value: [\n { type: "unit", value: 0, unit: "number" },\n { type: "unit", value: -100, unit: "px" },\n ],\n },\n scale: {\n type: "tuple",\n value: [\n { type: "unit", value: 5, unit: "number" },\n { type: "unit", value: 5, unit: "number" },\n ],\n },\n opacity: { type: "unit", value: 0, unit: "number" },\n },\n },\n ],\n },\n ],\n insetStart: { type: "unit", value: 5, unit: "%" },\n insetEnd: { type: "unit", value: 5, unit: "%" },\n isPinned: true,\n }}\n>\n <animation.AnimateText\n splitBy="space"\n slidingWindow={5}\n easing="easeOutQuart"\n >\n <ws.element ws:tag="h2">Animate words with controlled rhythm</ws.element>\n </animation.AnimateText>\n</animation.AnimateChildren>\n```\n\nFor Stagger Animation, put the repeated cards or rows directly inside `animation.StaggerAnimation`:\n\n```tsx\n<animation.AnimateChildren\n action={{\n type: "view",\n animations: [\n {\n timing: {\n fill: "backwards",\n rangeStart: ["contain", { type: "unit", value: 0, unit: "%" }],\n rangeEnd: ["contain", { type: "unit", value: 30, unit: "%" }],\n },\n keyframes: [\n {\n offset: 0,\n styles: {\n opacity: { type: "unit", value: 0, unit: "number" },\n },\n },\n ],\n },\n ],\n }}\n>\n <animation.StaggerAnimation>\n <ws.element\n ws:tag="article"\n ws:style={css`\n padding: 20px;\n border: 1px solid #d1d5db;\n border-radius: 16px;\n `}\n >\n Plan\n </ws.element>\n <ws.element\n ws:tag="article"\n ws:style={css`\n padding: 20px;\n border: 1px solid #d1d5db;\n border-radius: 16px;\n `}\n >\n Build\n </ws.element>\n <ws.element\n ws:tag="article"\n ws:style={css`\n padding: 20px;\n border: 1px solid #d1d5db;\n border-radius: 16px;\n `}\n >\n Launch\n </ws.element>\n </animation.StaggerAnimation>\n</animation.AnimateChildren>\n```\n\nFor Video Animation, use the registered template via `insert-component` when possible. If you author JSX, include the Video child explicitly:\n\n```tsx\n<animation.AnimateChildren\n action={{\n type: "view",\n animations: [\n {\n name: "Video progress",\n timing: {\n fill: "both",\n rangeStart: ["cover", { type: "unit", value: 0, unit: "%" }],\n rangeEnd: ["cover", { type: "unit", value: 100, unit: "%" }],\n },\n keyframes: [{ offset: 0, styles: {} }],\n },\n ],\n }}\n>\n <animation.VideoAnimation timeline={true}>\n <$.Video\n preload="auto"\n autoPlay={true}\n muted={true}\n playsInline={true}\n crossOrigin="anonymous"\n />\n </animation.VideoAnimation>\n</animation.AnimateChildren>\n```\n\n## Command Surface Boundary\n\n- Use top-level `webstudio ...` shell commands for setup, sync/import/build/preview/screenshot, permissions, publish/domains, schema, registry inspection, man, and starting MCP.\n- Use MCP tools for Builder project data manipulation: pages, instances/components, props, text, styles, tokens, variables, resources, assets, breakpoints, redirects, and raw patches.\n- From a shell, call MCP tools with the shortcut form `webstudio <tool> \'<json>\'`, for example `webstudio insert-fragment \'<json>\' --dry-run`. The explicit equivalent is `webstudio mcp single-op-call <tool> \'<json>\'`. Use `--input-file` for large payloads.\n- Inside the Webstudio monorepo, call the local CLI as its own command: `node packages/cli/local.js ...`. Do not wrap the CLI call in `pwd && ...`, command substitution, `pnpm exec webstudio`, `pnpm --filter webstudio exec webstudio`, or a global `webstudio`.\n- For experiments, pass `--dry-run` to local-capable mutation calls. Read the computed transaction from `meta.session.transaction` and its base build version from `meta.session.version`. Copying a `.webstudio` folder is not an isolated project clone; `.webstudio/config.json` still points to the same remote project, so non-dry-run mutations can commit to that project.\n- For bounded multi-step shell work, run inline JSON with `webstudio mcp run \'[{"tool":"components.find","input":{"brief":"button"}}]\'`; this reuses one CLI session without raw JSON-RPC. For large batches, write `{ "calls": [{ "tool": "..." }] }` to a normal JSON file and run `webstudio mcp run .temp/mcp-calls.json`.\n- Use JSON strings for `brief` fields. Never pass boolean flags such as `{"brief":true}`.\n- Treat `webstudio mcp single-op-call` and `webstudio mcp run` stderr lines as progress checkpoints; stdout remains JSON on both success and failure. On failure, parse stdout for `{ "ok": false, "error": { "code": "...", "message": "..." } }` before deciding what to fix.\n- If a CLI/MCP tool crashes, hangs, gives a confusing error, needs an undocumented workaround, or forces source-code inspection for normal usage, ask the user to report it in Discord `#help` at https://wstd.us/community. Give them a complete copy-paste report with the goal, expected behavior, actual error, exact command/tool call, stdout JSON, stderr/lifecycle logs, environment, workaround, and secrets redacted.\n- Run one-shot `webstudio mcp single-op-call` commands sequentially against a linked `.webstudio` folder. If a command returns `PROJECT_SESSION_BUSY`, another CLI/MCP process is updating the local session; wait a moment and retry sequentially.\n- In delegated or non-streaming agent environments, do not batch many MCP calls silently and do not wrap many shortcut or `webstudio mcp single-op-call` commands in a shell loop. Treat each parent-visible checkpoint as the unit of work. If the parent asks for status within 30 seconds, run exactly one shortcut command such as `webstudio meta.index` or one explicit `webstudio mcp single-op-call` command, report that command/result, then wait for the parent to continue. Do not take a broad task such as creating a full design-system page as one execution unit. Call `workflow.next {"goal":"design-system-page"}`, report the returned phase/checkpoint, wait until the parent continues, call `checkpoint.ack {"reported":true,"continueAfterReport":true,"summary":"<what you reported>"}`, complete exactly that bounded phase, and return: discovery, page creation, one dry-run JSX section, one committed JSX section, one `components.coverage-insert-next` call, or one presentation pass. Phase commands do not include nextPhase in their own output. After the parent continues, acknowledge the previous checkpoint first, then call `workflow.next` with the next phase. For all-component design-system pages, checkpoint after workflow planning, discovery, page creation, call `components.coverage-insert-next` once before checkpointing again, then finish with `workflow.next {"goal":"design-system-page","phase":"presentation-pass"}`. Coverage 72/72 is necessary but not sufficient: the page must be organized into styled, real-world examples, not raw unstyled component dumps.\n- For design-system or “use every component” tasks, start with compact `webstudio components.coverage-plan`, checkpoint, then request component coverage details with `webstudio components.coverage-plan \'{"detail":"roots","offset":20}\'` or `{"detail":"parts"}` only when needed. Do not pass `detail` to `list-pages`; use `list-pages {}` or `get-page-by-path` for page lookup.\n- MCP tool shortcuts are only for MCP tools. If a shortcut is ambiguous with a real top-level command, the real top-level command wins; use `webstudio mcp single-op-call <tool> \'<json>\'` to force the MCP path.\n\n## LLM Implementation Process\n\nUse this process for user requests that change Webstudio content, layout, styles, assets, pages, redirects, resources, or publishing state:\n\n1. Discover capabilities with `webstudio man --json`, `webstudio schema api`, `webstudio schema mcp`, MCP `meta.index`, `meta.guide`, `meta.get_more_tools`, `components.list`, `components.summary`, `components.coverage-plan`, `components.search`, `components.get`, `templates.list`, and `templates.get`. From a shell, prefer shortcut calls such as `webstudio meta.index` and `webstudio components.search \'{"brief":"button"}\'` for these focused tool calls; use `webstudio mcp single-op-call` when you need the explicit MCP form. Read full resources such as `webstudio://project/tools` and `webstudio://project/components` only when needed. Do not write scripts to parse full MCP discovery JSON for normal lookup.\n2. Inspect current project state with semantic reads such as `get-project-settings`, `list-pages`, `get-page-by-path`, `list-instances`, `inspect-instance`, `get-styles`, `list-assets`, `list-breakpoints`, and `snapshot` only when needed. Before changing a project, read `get-project-settings` and follow any non-empty `meta.agentInstructions`. These are shared project instructions, not a place for secrets.\n3. Mutate the Webstudio project with semantic MCP write tools first. Prefer MCP `insert-fragment` for authored/styled sections, use `insert-component` only for one automatic component template, then `update-text`, `update-props`, `update-styles`, `upload-asset`, `create-page`, and page/project settings tools over raw patches.\n4. Use `apply-patch` only when no semantic tool covers the required change, and only after reading the latest snapshot/version.\n5. For visual/design work, regenerate or preview the generated app, capture a screenshot, inspect it with vision, and iterate before final response.\n6. Report what changed and what verification ran.\n\n## Visual Design Workflow\n\nFor requests involving visible HTML/CSS, layout, typography, colors, imagery, responsive behavior, or screenshots:\n\n1. Read editable Webstudio structure first: pages, instances, props, styles, breakpoints, assets, and relevant text.\n2. Do not use generated route/component files as the source of truth for editable content.\n3. Make edits through Webstudio semantic commands/MCP tools so the result stays editable in Builder and survives the next `webstudio build`.\n4. Keep generated project files current, start preview, and capture the changed page with `screenshot`.\n5. Use `screenshot.diff` when a baseline exists and inspect screenshot/diff artifacts with vision before finishing.\n6. If vision or screenshot tooling is unavailable, state that explicitly and explain what fallback verification was used.\n\n## Responsive Verification Workflow\n\nFor responsive page work, use Builder breakpoints as the source of truth:\n\n1. Read breakpoints with `list-breakpoints` before deciding responsive behavior.\n2. Apply responsive styles with existing Builder breakpoint ids; do not invent CSS media queries or breakpoint names when Webstudio breakpoint data exists.\n3. Pick screenshot viewport widths from the project breakpoints: include a desktop width, each defined max-width or min-width edge, and a narrow mobile width.\n4. Capture each viewport with `screenshot`, for example `{"path":"/","output":"home-375.png","viewport":{"width":375,"height":812}}` and `{"path":"/","output":"home-1440.png","viewport":{"width":1440,"height":900}}`.\n5. Inspect every viewport screenshot with vision before finishing, checking layout, overflow, hidden content, text wrapping, and breakpoint-specific style changes.\n6. If any viewport fails, update styles through semantic Webstudio tools and repeat screenshots for the affected breakpoints.\n\n## Generated Files Guardrails\n\n- Do not edit `app/__generated__`, generated route files, generated page files, generated CSS, or build output for normal Webstudio content/design requests.\n- Do not replace generated page components with handcrafted app code unless the user explicitly asks for code-only export customization.\n- Generated files are build artifacts and may be overwritten by `webstudio build`.\n- If a task truly requires generated app customization, keep it outside `app/__generated__` where possible and explain that it is not editable Webstudio content.\n\n## Values vs Bindings\n\nBefore authoring unfamiliar expressions, read `webstudio://project/expressions` with MCP `resources/read` or `webstudio mcp read-resource webstudio://project/expressions`. It documents the supported expression subset, method allowlist, scope, Collection context, and validation limits.\n\n- Use direct value tools for fixed content. For one visible text child, use `update-text` with plain `text`. For a bounded multi-instance literal replacement, use `replace-text` with `find`, `replace`, `pagePath` or `pageId`, and `limit`; it does not change expression children. Use `replace-prop-text` for bounded changes inside static string props, optionally limited to prop names or instance ids; it never changes dynamic bindings. For static props such as `aria-label`, `alt`, `id`, `class`, `href`, or button labels stored as props, use `update-props` with the prop\'s direct type/value.\n- Use `bind-props` only when the prop must stay dynamic: an expression, resource result, action, or existing scoped runtime context such as `system`. Do not use `bind-props` just to set a fixed string.\n- Direct prop string example: `{"updates":[{"instanceId":"button-id","name":"aria-label","type":"string","value":"Open menu"}]}`.\n- Expression binding example: `{"bindings":[{"instanceId":"link-id","name":"href","binding":{"type":"expression","value":"currentPost.url"}}]}`.\n- Page metadata fields such as `title`, `description`, `language`, `redirect`, `status`, and custom meta content accept plain fixed text. For computed values, pass JavaScript expression code such as `pageTitle ?? "Pricing | Acme"`.\n- Page metadata update example: use `update-page` with `{"pageId":"page-id","values":{"title":"Pricing | Acme","meta":{"description":"Plans for teams"}}}`.\n- Resource `url` accepts plain fixed URLs and paths. For computed URLs, pass JavaScript expression code such as `"https://api.example.com/items?tag=" + filters.tag`. Resource header values, search parameter values, and text bodies accept expressions for dynamic values; for fixed text, use `{ "type": "literal", "value": "application/json" }`.\n- Resource update example: use `update-resource` with `{"resourceId":"resource-id","values":{"url":"https://api.example.com/items"}}`.\n- Data variable values support `string`, `number`, `boolean`, `string[]`, and `json`. Use `string[]` only for arrays where every item is a string; use `json` for objects, mixed arrays, filters, and nested data.\n- Parameters are internal scoped runtime values from pages, collections, or components. They are not a public authoring surface: do not create, update, or delete parameter records. Public tools should preserve existing parameter records and may reference documented context values such as `system` in expressions where they are already in scope.\n- Use scoped resources for read data. A GET resource created with `scopeInstanceId`/`dataSourceName` defaults to `exposeAsDataSource:true`, becomes a scoped resource data variable, is generated into the page resource `data` map, and may be loaded while rendering the page. Read the loaded resource result from its wrapper, usually `.data`.\n- Use prop-bound resources for actions. A resource created without `scopeInstanceId` and bound to a component prop such as Form `action` with `bind-props` and `binding.type: "resource"` becomes an action resource in the page resource `action` map. Use this for POST, PUT, DELETE, webhooks, GraphQL submissions, and anything that should run only from an explicit form/action flow.\n- POST, PUT, and DELETE resources default to `exposeAsDataSource:false`, even with a scope. Set `exposeAsDataSource:true` only for an intentional render-time read such as a GraphQL POST query; provide `scopeInstanceId` and inspect the returned warning. Set it to `false` during `update-resource` to detach existing render-time exposure.\n- For dynamic resource query parameters prefer `searchParams`, for example `{"name":"tag","value":"filters.tag"}`. Use `{"type":"literal","value":"website"}` for fixed request text. Header values can be expressions such as `"\\"Bearer \\" + auth.token"`. Body can be an object expression, including GraphQL payloads such as `{ query: "...", variables: { slug: system.params.slug } }`.\n- Resource methods are `get`, `post`, `put`, and `delete`. Optional resource controls are `graphql` and `system`. Use `control:"graphql"` for GraphQL POST resources with query bodies. Use `control:"system"` for built-in local resource URLs such as `"/$resources/current-date"` and for resources reading the built-in `system` parameter. The built-in system fields are `system.origin`, `system.pathname`, `system.params`, and `system.search`; do not use `system.path`.\n- Whenever an array or object from a resource or data variable should render repeated UI, call `insert-collection` with the complete iterable and one repeated-item JSX root. The command creates the Collection, private item parameters, iterable binding, and descendant item bindings atomically. Use `collectionItem` and `collectionItemKey` expressions in the item JSX. Wrap multiple repeated siblings in one Element, and give repeated Radix items stable unique `value` bindings.\n- Expressions are single JavaScript expressions, not statements or functions. Functions, arrow functions, classes, `new`, `this`, `await`, imports, arbitrary calls, increment/decrement, and assignment outside actions are unsupported. Prefer optional chaining, nullish coalescing, ternaries, property/index access, operators, and the documented string/array methods.\n\n## Pick Read Command\n\n{{readFirst}}\n\n## Pick Write Command\n\n{{taskRecipeIndex}}\n\n## Raw Patch Only If Needed\n\n1. Use MCP tool: snapshot.\n2. Write BuildPatchTransaction[].\n3. Use MCP tool: apply-patch.\n\n## MCP Argument Examples\n\nMCP tools receive JSON argument objects, not CLI flags. Use these shapes:\n\n{{mcpArgumentExampleIndex}}\n\n## Rules\n\n- Never guess ids for existing records. Read them first.\n- Never use project ids from user input. Commands use the configured project.\n- Use --refresh before a local-capable command when cached data may be stale.\n- Pass --json only to commands whose help/schema documents it. Do not add --json to top-level commands such as sync unless supported.\n- On VERSION_CONFLICT, read MCP snapshot again, regenerate the patch, then retry.\n- Treat stdout JSON as the API contract and stderr as diagnostics.\n- For visual/design work, verify the rendered result with vision before finishing.\n- Do not edit generated files for normal Webstudio content/design requests.\n- Use direct values for static strings and bindings only for dynamic expressions/resources/actions.\n- Use plain fixed text where documented. Only encode a quoted JavaScript string literal when a field is explicitly documented as an expression-only value.\n- Confirm destructive commands with --confirm only when user requested deletion/unpublish/replacement.\n- Use webstudio schema api for machine-readable top-level command metadata and webstudio schema mcp for MCP tool schemas.\n\n## Known Gaps\n\n{{knownCliGapIndex}}\n',"manual-mcp":'# Webstudio MCP Manual\n\n`webstudio mcp` starts a stdio MCP server for real MCP clients. Shell users can call MCP tools with the shortcut form `webstudio <tool> \'<json>\'`, for example `webstudio meta.index` or `webstudio insert-fragment \'<json>\' --dry-run`. `webstudio mcp single-op-call` is the explicit equivalent and prints the structured JSON result. `webstudio mcp run` runs multiple MCP tool calls from inline JSON or a normal JSON file in one shared CLI session. Do not manually type or pipe raw JSON-RPC frames into `webstudio mcp` from an interactive shell or PTY.\n\n## Startup\n\n1. Configure a project with `webstudio init --link <api-share-link> --json`.\n2. Generate the client configuration with `webstudio connect claude`,\n `webstudio connect codex`, `webstudio connect cursor`, or\n `webstudio connect vscode`. Use `--print` to preview file-based config.\n3. Check capabilities with `webstudio permissions --json`.\n4. For shell-driven agents, use shortcut calls such as `webstudio meta.index` and `webstudio insert-fragment \'<json>\' --dry-run` for individual MCP tool calls. Use the explicit equivalent `webstudio mcp single-op-call <tool> \'<json>\'` when you need to force the MCP path, or `webstudio mcp run \'[{"tool":"components.find","input":{"brief":"button"}}]\'` for bounded multi-call workflows. Use `webstudio mcp run .temp/mcp-calls.json` for large batches.\n5. For MCP clients, start the server with `webstudio mcp`.\n6. Start discovery with `meta.index`, then call focused tools with concrete JSON, for example `webstudio mcp single-op-call meta.guide \'{"brief":"Create a design system page using every component"}\'`.\n\nStart MCP from the linked Webstudio project root. The lifecycle status line prints that absolute root; create local scripts, screenshots, and temporary artifacts under that root, for example `<project root>/.temp/script.mjs`. If the shell starts in a parent workspace, `cd` into the project root first or use absolute paths.\n\nWhen developing inside the Webstudio monorepo, start the local CLI exactly as `node packages/cli/local.js mcp` from the repo root. Do not use `pnpm exec webstudio`, `pnpm --filter webstudio exec webstudio`, or a global `webstudio`: they can resolve an older binary.\n\nWhile the server is running, stdout is reserved for MCP JSON-RPC messages. Do not print human text from the server process. The server advertises MCP `logging` capability and emits sparse `notifications/message` logs for ready state and tool lifecycle checkpoints such as `tool preview.start started`, `tool preview.start still running after 10000ms`, and `tool preview.start succeeded in 1234ms`; stderr also mirrors these sparse lifecycle fallback lines prefixed with `[webstudio mcp]`.\n\n## One-Shot Tool Calls\n\nUse the shortcut `webstudio <tool> \'<json>\'` when you are operating from a shell and need one MCP tool result. The explicit form `webstudio mcp single-op-call <tool> \'<json>\'` is equivalent and avoids writing temporary Node.js stdio client scripts.\n\nExamples:\n\n```sh\nwebstudio mcp single-op-call meta.index\nwebstudio mcp single-op-call meta.guide \'{"brief":"Create a design system page using every component"}\'\nwebstudio mcp single-op-call meta.get_more_tools \'{"tools":["insert-fragment"]}\'\nwebstudio mcp single-op-call components.list \'{"source":"all"}\'\nwebstudio mcp single-op-call components.coverage-plan\nwebstudio mcp single-op-call components.search \'{"brief":"radix select"}\'\nwebstudio mcp single-op-call components.get \'{"component":"@webstudio-is/sdk-components-react-radix:Select"}\'\nwebstudio mcp single-op-call templates.list\nwebstudio mcp single-op-call templates.get \'{"component":"@webstudio-is/sdk-components-react-radix:Select"}\'\nwebstudio mcp single-op-call insert-fragment --input-file .temp/insert-fragment.json\n```\n\nShortcut equivalents:\n\n```sh\nwebstudio meta.index\nwebstudio meta.guide \'{"brief":"Create a design system page using every component"}\'\nwebstudio meta.get_more_tools \'{"tools":["insert-fragment"]}\'\nwebstudio components.list \'{"source":"all"}\'\nwebstudio components.coverage-plan\nwebstudio components.search \'{"brief":"radix select"}\'\nwebstudio components.get \'{"component":"@webstudio-is/sdk-components-react-radix:Select"}\'\nwebstudio templates.list\nwebstudio templates.get \'{"component":"@webstudio-is/sdk-components-react-radix:Select"}\'\nwebstudio insert-fragment --input-file .temp/insert-fragment.json\n```\n\nRules:\n\n- Inside the Webstudio monorepo, replace `webstudio` in the examples above with `node packages/cli/local.js`, for example `node packages/cli/local.js meta.index`.\n- For a simple authored/styled section, run `meta.index`, then `meta.get_more_tools \'{"tools":["insert-fragment"]}\'`, then `insert-fragment`. Do not grep source files, dump full MCP resources, or write parser scripts first.\n- In `insert-fragment` JSX, use `ws:style={css\\`...\\`}`for Webstudio-native CSS, or use React-style object syntax such as`style={{ padding: 24 }}` when that is simpler. Both forms create editable Webstudio style data.\n- Prefer JSX for authored/styled content. Common `insert-fragment` inputs:\n\n```jsonl\n{"parentInstanceId":"root-id","fragment":"<ws.element ws:tag=\\"section\\" ws:style={css`padding: 32px; display: grid; gap: 16px;`}><ws.element ws:tag="h2">Northstar Product OS</ws.element><ws.element ws:tag="p">Reusable patterns for teams.</ws.element></ws.element>"}\n{"parentInstanceId":"root-id","fragment":"<ws.element ws:tag=\\"section\\" style={{ padding: 32, borderRadius: 16 }}><ws.element ws:tag="h2">Operations Console</ws.element><ws.element ws:tag="p">React-style object styles become editable Webstudio styles.</ws.element></ws.element>"}\n{"parentInstanceId":"root-id","fragment":"<ws.element ws:tag=\\"section\\" ws:tokens={[token(\\"accent\\", css`color: #0f766e;`)]}><ws.element ws:tag="button" onClick={new ActionValue([\\"event\\"], expression`console.log(event)`)}>Track launch</ws.element></ws.element>"}\n{"parentInstanceId":"root-id","fragment":"<ws.element ws:tag=\\"section\\"><radix.Switch><radix.SwitchThumb /></radix.Switch></ws.element>"}\n```\n\n- Do not access host globals or dynamic code APIs in JSX fragments, including `process`, `globalThis`, `eval`, `Function`, or `constructor`.\n- Use Webstudio prop names such as `class` and `for`; do not use React aliases `className` or `htmlFor`.\n- Use Webstudio actions for event/action props, for example `onClick={new ActionValue(["event"], expression\\`console.log(event)\\`)}`. Do not pass JavaScript functions such as `onClick={() => ...}`.\n- Plain prop values must be JSON-compatible: `null`, strings, booleans, finite numbers, arrays, and plain objects. Do not pass `undefined`, `Symbol`, `BigInt`, `NaN`, `Infinity`, `Date`, `Map`, `Set`, class instances, or circular objects; omit the prop, use plain data, or use `expression`/`ActionValue` when the value is dynamic.\n- Template-backed components used in JSX must include required child/part components explicitly under the same parent structure as the template, for example `<radix.Switch><radix.SwitchThumb /></radix.Switch>`. Use `insert-component` when you want one automatic registered component template.\n- The positional input is JSON and defaults to `{}`.\n- Use `--input-file` for large mutation payloads.\n- Use `--dry-run` with local-capable mutation tools when you need a patch plan without committing. The computed transaction is returned in `meta.session.transaction`, and `meta.session.version` is its base build version. Copying a `.webstudio` folder is not an isolated project clone; `.webstudio/config.json` still points to the same remote project, so non-dry-run mutations can commit to that project.\n- The command prints JSON to stdout for both success and failure. Success uses the same `structuredContent` shape MCP tools return: `{ "ok": true, "data": ..., "meta": ... }`. Failure prints `{ "ok": false, "error": { "code": "...", "message": "..." }, "meta": ... }` and exits nonzero.\n- The command writes sparse progress to stderr, including start, success/failure, elapsed time, and committed status when the tool returns session metadata.\n- Invalid argument types fail loudly with path-specific messages, for example `meta.guide input.brief must be a string when provided`.\n- Run one-shot shortcut or `mcp single-op-call` commands sequentially against the same linked `.webstudio` folder. If you receive `PROJECT_SESSION_BUSY`, another CLI/MCP process is updating the local session; wait a moment and retry sequentially.\n- If you are a delegated agent and your parent cannot see live stderr/stdout, do not run a long sequence of shortcut or `mcp single-op-call` commands silently and do not wrap many calls in a shell loop. Treat each parent-visible checkpoint as the unit of work. If the parent asks for status within 30 seconds, run exactly one `webstudio <tool>` or `webstudio mcp single-op-call` command, report that command/result, then wait before the next MCP command. For all-component design-system pages, checkpoint after discovery, checkpoint after page creation, call `components.coverage-insert-next` once before checkpointing again, then finish with the `presentation-pass` workflow phase. Coverage alone is not completion; organize examples into styled sections/cards.\n\n## Reporting CLI/MCP Issues\n\nIf a CLI/MCP tool gives a confusing error, crashes, hangs, produces invalid output, requires an undocumented workaround, or makes you inspect source code to understand normal usage, ask the user to report it in the Webstudio Discord `#help` channel: https://wstd.us/community.\n\nGive the user a complete copy-paste report. Include only non-secret values: never include auth tokens, private URLs, cookies, API keys, passwords, or proprietary project data. Redact them as `<redacted>`.\n\nCopy-paste template:\n\n````md\nWebstudio CLI/MCP issue report\n\nWhat I was trying to do:\n<short user goal, for example "Create a resource from an external API and render it in a collection">\n\nWhat I expected:\n<what should have happened>\n\nWhat happened instead:\n<exact error, confusing behavior, hang, missing docs, or workaround required>\n\nCommand/tool used:\n\n```sh\n<exact command or MCP tool call, with tokens/secrets redacted>\n```\n\nStructured output / error:\n\n```json\n<stdout JSON or MCP structuredContent, if available, with secrets redacted>\n```\n\nStderr / lifecycle logs:\n\n```txt\n<stderr lines, timings, checkpoint messages, or stack trace, with secrets redacted>\n```\n\nEnvironment:\n\n- CLI command path: <webstudio / node packages/cli/local.js / other>\n- Webstudio CLI version: <from command output if known>\n- OS: <macOS / Windows / Linux / unknown>\n- Node version: <node -v if known>\n- Project/session state: <linked project, local .webstudio session, preview, MCP server, or unknown>\n\nWorkaround tried:\n<what the agent/user tried next, and whether it worked>\n\nWhy this should be improved:\n<one sentence: better error message, docs, schema, tool behavior, etc.>\n````\n\n## Shared-Session Shell Runs\n\nUse `webstudio mcp run \'[{"tool":"components.find","input":{"brief":"button"}}]\'` when you are operating from a shell and need several MCP tool calls to share one CLI session without hand-writing JSON-RPC. For large batches, pass a normal JSON file path such as `.temp/mcp-calls.json`. Do not use shell process substitution like `<(...)`; use inline JSON or a real file.\n\nUse `mcp run` for long-lived tools such as `preview.start`. A one-shot `mcp single-op-call preview.start` cannot keep ownership of a preview server for a later screenshot or stop call. Put `preview.start`, `screenshot`, and `preview.stop` in one shared `mcp run` process, or use a real long-running MCP client.\n\nInput shape:\n\n```json\n{\n "calls": [\n { "tool": "meta.index" },\n { "tool": "components.find", "input": { "brief": "radix select" } }\n ]\n}\n```\n\nRules:\n\n- The command prints JSON to stdout for both success and failure. It stops at the first failed call and prints partial results in `{ "ok": false, "error": ..., "data": { "completedCalls": ..., "results": [...] }, "meta": ... }`, then exits nonzero.\n- If a call returns `checkpoint.required`, `mcp run` stops immediately before later calls and prints partial results with `CHECKPOINT_REQUIRED`. Stop now and report the checkpoint to the parent/user. Only after the parent/user continues, call `checkpoint.ack {"reported":true,"continueAfterReport":true,"summary":"<what you reported>"}` before continuing.\n- For `mcp single-op-call`, checkpoint requirements persist across later one-shot CLI processes until you call `checkpoint.ack {"reported":true,"continueAfterReport":true,"summary":"<what you reported>"}`.\n- Use this instead of manually sending JSON-RPC frames to `webstudio mcp` from a shell.\n\n## Discovery\n\nUse MCP itself after startup, or call the same tools with `webstudio mcp single-op-call`:\n\n- `tools/list`: machine-readable available tools\n- `resources/list`: available overview and full JSON resources\n- `meta.index`: concise capability catalog\n- `meta.guide`: workflow for a user goal; call with a string brief such as `{"brief":"Create a pricing page"}`\n- `meta.get_more_tools`: detailed params, examples, namespaces, and local/server behavior; prefer exact names such as `{"tools":["insert-fragment"]}` when you know them\n- `components.list`: shadcn-compatible registry items for visible components and templates\n- `components.summary`: compact structured component catalog with insertability and template hints\n- `components.coverage-plan`: compact paged plan for design-system coverage tasks that need every component; default returns counts plus the first root page, use `{"detail":"roots"}`, `{"detail":"parts"}`, or `{"detail":"full"}` for more\n- `components.coverage-status`: page-specific covered/missing component report with `missingRoots` and `missingParts`\n- `components.search`: focused component/template search by id, namespace, label, category, or content model\n- `components.find`: compatibility alias for focused component search\n- `components.get`: full metadata for one component id\n- `templates.list`: shadcn-compatible registry items for template-backed insertions only\n- `templates.get`: full registry item and payload metadata for one template\n\nComponent and template registry items use a shadcn-compatible top-level shape plus Webstudio-specific superset metadata in `meta`. Use `meta.runtime` for component ids, props, states, content model, and source identity; `meta.authoring` for composition and accessibility guidance; and `meta.builder` for template insertion details and expected project-data namespaces. These items are for Builder/MCP discovery and are not a published shadcn install registry yet.\n\nPrefer the focused `components.*` tools over dumping `webstudio://project/components`. Do not write local scripts to parse full MCP discovery JSON for common component lookup.\nFor “use every component” or design-system pages, start with compact `components.coverage-plan`, checkpoint, then page through roots/parts instead of dumping the full catalog.\n\n## Consumer Capabilities\n\nMCP lets agents work on one configured Webstudio project at a time. In consumer\nterms, agents can:\n\n- Check which project they are connected to.\n- Check what the share link is allowed to do.\n- Inspect project metadata and the latest editable build.\n- Read selected project data for audits and repair.\n- Apply precise project changes against a known version.\n- List, inspect, create, update, delete, duplicate, copy, and reorder pages.\n- Set the home page.\n- Preserve old page paths for redirects or history.\n- Read and update page titles, descriptions, metadata, auth settings, and SEO fields.\n- List, create, update, duplicate, move, and delete page folders.\n- List, create, update, delete, duplicate, reorder, and reuse page templates.\n- Create pages from reusable templates.\n- Read and update project site settings.\n- Read and update marketplace product metadata.\n- List, create, update, delete, and replace redirects.\n- List, create, update, and delete responsive breakpoints.\n- List and inspect page elements.\n- Insert registered components.\n- Insert styled JSX fragments.\n- Move, reparent, clone, duplicate, wrap, unwrap, convert, rename, retag, and delete elements.\n- Fill grid cells.\n- List and update text children.\n- Update plain text and expression text.\n- Update structured rich text.\n- Add, update, delete, and bind element props.\n- Bind props to expressions, resources, actions, and runtime system values.\n- Read, add, update, delete, and replace local styles.\n- Update selected style-source styles.\n- List, create, update, attach, detach, extract, duplicate, rename, lock, unlock, reorder, clear, and delete design tokens and style sources.\n- List, define, rename, delete, and rewrite CSS variables.\n- List, create, update, and delete static data variables.\n- Create string, number, boolean, string list, and JSON variables.\n- Delete unused data variables.\n- List, create, update, upsert, bind, and delete resources.\n- Create HTTP resources.\n- Create GraphQL resources.\n- Create system resources.\n- Use built-in system resources for sitemap, current date, and assets.\n- List, upload, add, update, find usage for, replace, and delete assets.\n- Publish to staging or production.\n- Publish to selected domains.\n- List publish builds.\n- Check publish job status.\n- Unpublish staging or production deployments.\n- List, create, update, delete, and verify custom domains.\n- Start and stop preview.\n- Capture screenshots of generated pages.\n- Compare screenshots against baselines.\n- Install OCR support for richer visual checks.\n\nUseful resources:\n\n- `webstudio://project/status`: compact current ProjectSession status\n- `webstudio://project/tools-overview`: small operation overview by capability area\n- `webstudio://project/components-overview`: small component overview with ids, labels, namespaces, and categories\n- `webstudio://project/tools`: full operation catalog; read only when focused metadata is insufficient\n- `webstudio://project/components`: full component catalog with props, states, and content model composition constraints; read only when `components.summary`, `components.find`, and `components.get` are insufficient\n- `webstudio://project/guide`: concise discovery guide\n- `webstudio://project/expressions`: expression syntax, scope, supported methods, bindings, Collection iteration context, and verification\n- `webstudio://project/accessibility-review`: evidence-based LLM accessibility-review workflow using project checks, preview, and screenshots\n\n## MCP SDK Client Imports\n\nWhen writing a local Node.js MCP client script, use the official MCP SDK package and these exact ESM imports:\n\nInside the Webstudio monorepo this package is available at the repo root. In another project, install it first with `pnpm add -D @modelcontextprotocol/sdk`.\n\n```js\nimport { Client } from "@modelcontextprotocol/sdk/client/index.js";\nimport { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";\nimport { LoggingMessageNotificationSchema } from "@modelcontextprotocol/sdk/types.js";\n```\n\nMinimal stdio client for the local Webstudio CLI:\n\n```js\nconst client = new Client({ name: "webstudio-agent", version: "1.0.0" });\n\nclient.setNotificationHandler(\n LoggingMessageNotificationSchema,\n (notification) => {\n console.error(`[mcp] ${notification.params.data}`);\n }\n);\n\nconst transport = new StdioClientTransport({\n command: "node",\n args: ["packages/cli/local.js", "mcp"],\n cwd: process.cwd(),\n stderr: "inherit",\n});\n\nawait client.connect(transport);\n\nconst index = await client.callTool({\n name: "meta.index",\n arguments: {},\n});\nconsole.log(JSON.stringify(index.structuredContent, null, 2));\n\nawait client.close();\n```\n\nUse `node packages/cli/local.js mcp` from the Webstudio monorepo root for local development, or `webstudio mcp` from a linked project where the CLI is installed. Keep stdout for JSON-RPC/structured results and surface MCP logging notifications or stderr lifecycle lines as progress.\n\n## Core Rules\n\n- stdout is reserved for MCP JSON-RPC while the server is running.\n- Operate on the configured project only.\n- Read ids before writing.\n- Prefer semantic tools over `apply-patch`.\n- Use `status` and `refresh` when cached namespaces may be stale. Pass `status {"verbose":true}` only when debugging full namespace arrays, freshness, compatibility, or diagnostic details.\n- A mutation is durable only when `meta.session.committed` is true.\n- For visual/design work, verify the rendered result with vision before finishing.\n\n## Vision Verification Loop\n\nVision-capable AI can use MCP to see what it is building:\n\n{{mcpVisionVerificationLoopMarkdown}}\n\nGenerated app setup:\n\n{{mcpGeneratedAppDependencyNotes}}\n\n## MCP Argument Examples\n\nMCP tools receive JSON argument objects:\n\n{{mcpArgumentExampleIndex}}\n\n## Screenshot Verification\n\n{{screenshotVerificationSummary}}\n',"mcp-startup-epilogue":@@ -87,7 +87,7 @@ export const cliDocSections = {"POST, PUT, and DELETE resources default to exposeAsDataSource:false, even with a scope. Set exposeAsDataSource:true only for an intentional render-time read such as a GraphQL POST query; provide scopeInstanceId and inspect the returned warning. Set it to false during update-resource to detach existing render-time exposure.",'For dynamic resource query parameters prefer searchParams, for example {"name":"tag","value":"filters.tag"}. Use {"type":"literal","value":"website"} for fixed request text. Header values can be expressions such as "\\"Bearer \\" + auth.token". Body can be an object expression, including GraphQL payloads such as { query: "...", variables: { slug: system.params.slug } }.','Resource methods are get, post, put, and delete. Optional resource controls are graphql and system. Use control:"graphql" for GraphQL POST resources with query bodies. Use control:"system" for built-in local resource URLs such as "/$resources/current-date" and for resources reading the built-in system parameter. The built-in system fields are system.origin, system.pathname, system.params, and system.search; do not use system.path.',- "Whenever an array or object from a resource or data variable should render repeated UI, use Collection. Insert ws:collection with insert-component, bind its data prop to the complete iterable rather than the response wrapper or one indexed item, preserve the generated item/itemKey parameters, and bind descendants to the current iteration context. Wrap multiple repeated siblings in one Element, and give repeated Radix items stable unique value bindings.",+ "Whenever an array or object from a resource or data variable should render repeated UI, call insert-collection with the complete iterable and one repeated-item JSX root. The command creates the Collection, private item parameters, iterable binding, and descendant item bindings atomically. Use collectionItem and collectionItemKey expressions in the item JSX. Wrap multiple repeated siblings in one Element, and give repeated Radix items stable unique value bindings.","Expressions are single JavaScript expressions, not statements or functions. Functions, arrow functions, classes, new, this, await, imports, arbitrary calls, increment/decrement, and assignment outside actions are unsupported. Prefer optional chaining, nullish coalescing, ternaries, property/index access, operators, and the documented string/array methods.",],rules: [diff --git a/packages/cli/src/docs/api-use-cases.md b/packages/cli/src/docs/api-use-cases.mdindex 559eac4e72..215ec66063 100644--- a/packages/cli/src/docs/api-use-cases.md+++ b/packages/cli/src/docs/api-use-cases.md@@ -98,6 +98,7 @@ MCP lets agents work on one configured Webstudio project. Agents can:- Create pages from reusable templates.- Update page metadata, SEO fields, auth settings, and marketplace metadata.- Insert components and styled JSX sections.+- Create data-driven lists, grids, cards, and similar repeated UI from array or object data in one Collection operation.- Move, copy, wrap, unwrap, convert, rename, retag, and delete elements.- Update text, rich text, props, bindings, and actions.- Create and update local styles, design tokens, style sources, and CSS variables.@@ -993,17 +994,15 @@ Notes:Commands:-- MCP tool: components.get {"component":"ws:collection"}-- MCP tool: insert-component {"parentInstanceId":"<instanceId>","component":"ws:collection"}+- MCP tool: insert-collection {"parentInstanceId":"<instanceId>","data":{"type":"expression","value":"posts.data.items"},"itemFragment":"<ws.element ws:tag=\"article\"><ws.element ws:tag=\"h2\">{expression`collectionItem.title`}</ws.element></ws.element>"}- MCP tool: inspect-instance {"instanceId":"<collectionId>","include":["props","bindings","children"]}-- MCP tool: bind-props {"bindings":[{"instanceId":"<collectionId>","name":"data","binding":{"type":"expression","value":"posts.data"}}]}Notes:- Use Collection whenever an array or object from a resource or data variable should render a list, grid, cards, table rows, options, tabs, or other repeated UI.-- Bind the Collection `data` prop to the complete array or object. Do not bind the resource response wrapper or one indexed item. External resource arrays are commonly nested under the scoped resource result's `data` field or deeper.-- Insert Collection with `insert-component` so Webstudio creates its internal current-item and current-key parameters. Preserve those generated parameters; they are scoped runtime context, not public records to create, replace, or delete.-- Collection renders its child structure once for every entry. Bind descendant text and props to the current item. Array iteration exposes the item; object iteration exposes its key and value.+- Pass `insert-collection` the complete array or object. Do not pass the resource response wrapper or one indexed item. External resource arrays are commonly nested under the scoped resource result's `data` field or deeper.+- Pass one repeated-item Webstudio JSX root. The command creates the Collection, its private current-item/current-key parameters, the iterable binding, and descendant item bindings atomically.+- Collection renders the item root once for every entry. Use `expression` values such as `collectionItem.title` in descendant text and props. Object iteration also exposes `collectionItemKey`.- Wrap multiple repeated sibling instances in one Element inside Collection.- For repeated Radix items such as accordion items, tabs, or menu options, bind a stable unique id or slug to every required `value` prop.- See the [Collection documentation](https://docs.webstudio.is/university/core-components/collection) for the equivalent Builder workflow.diff --git a/packages/cli/src/docs/manual-llm.md b/packages/cli/src/docs/manual-llm.mdindex 3d99bb1f0e..b87e96dff9 100644--- a/packages/cli/src/docs/manual-llm.md+++ b/packages/cli/src/docs/manual-llm.md@@ -429,7 +429,7 @@ Before authoring unfamiliar expressions, read `webstudio://project/expressions`- POST, PUT, and DELETE resources default to `exposeAsDataSource:false`, even with a scope. Set `exposeAsDataSource:true` only for an intentional render-time read such as a GraphQL POST query; provide `scopeInstanceId` and inspect the returned warning. Set it to `false` during `update-resource` to detach existing render-time exposure.- For dynamic resource query parameters prefer `searchParams`, for example `{"name":"tag","value":"filters.tag"}`. Use `{"type":"literal","value":"website"}` for fixed request text. Header values can be expressions such as `"\"Bearer \" + auth.token"`. Body can be an object expression, including GraphQL payloads such as `{ query: "...", variables: { slug: system.params.slug } }`.- Resource methods are `get`, `post`, `put`, and `delete`. Optional resource controls are `graphql` and `system`. Use `control:"graphql"` for GraphQL POST resources with query bodies. Use `control:"system"` for built-in local resource URLs such as `"/$resources/current-date"` and for resources reading the built-in `system` parameter. The built-in system fields are `system.origin`, `system.pathname`, `system.params`, and `system.search`; do not use `system.path`.-- Whenever an array or object from a resource or data variable should render repeated UI, use Collection. Insert `ws:collection` with `insert-component`, bind its `data` prop to the complete iterable rather than the response wrapper or one indexed item, preserve the generated `item`/`itemKey` parameters, and bind descendants to the current iteration context. Wrap multiple repeated siblings in one Element, and give repeated Radix items stable unique `value` bindings.+- Whenever an array or object from a resource or data variable should render repeated UI, call `insert-collection` with the complete iterable and one repeated-item JSX root. The command creates the Collection, private item parameters, iterable binding, and descendant item bindings atomically. Use `collectionItem` and `collectionItemKey` expressions in the item JSX. Wrap multiple repeated siblings in one Element, and give repeated Radix items stable unique `value` bindings.- Expressions are single JavaScript expressions, not statements or functions. Functions, arrow functions, classes, `new`, `this`, `await`, imports, arbitrary calls, increment/decrement, and assignment outside actions are unsupported. Prefer optional chaining, nullish coalescing, ternaries, property/index access, operators, and the documented string/array methods.## Pick Read Commanddiff --git a/packages/http-client/src/index.test.ts b/packages/http-client/src/index.test.tsindex a5c165658c..8e78eb1354 100644--- a/packages/http-client/src/index.test.ts+++ b/packages/http-client/src/index.test.ts@@ -54,6 +54,7 @@ import {getProjectSettings,getStyleDeclarations,inspectInstance,+ insertCollection,insertComponent,insertFragment,importProjectBundle,@@ -105,6 +106,21 @@ import {} from "./index";import * as httpClient from "./index";+type FragmentPayload = Parameters<typeof insertFragment>[0]["fragment"];++const createFragmentPayload = (): FragmentPayload => ({+ children: [],+ instances: [],+ assets: [],+ dataSources: [],+ resources: [],+ props: [],+ breakpoints: [],+ styleSourceSelections: [],+ styleSources: [],+ styles: [],+});+afterEach(() => {vi.unstubAllGlobals();});@@ -571,22 +587,29 @@ test("wraps project api trpc calls in named functions", async () => {parentInstanceId: "parent-id",component: "@webstudio-is/sdk-components-react-radix:Switch",});- await insertFragment({+ await insertCollection({...params,parentInstanceId: "parent-id",- fragment: {- children: [],- instances: [],- assets: [],- dataSources: [],- resources: [],- props: [],- breakpoints: [],- styleSourceSelections: [],- styleSources: [],- styles: [],+ data: { type: "json", value: [{ title: "First" }] },+ itemFragment: {+ ...createFragmentPayload(),+ children: [{ type: "id", value: "item-root" }],+ instances: [+ {+ type: "instance",+ id: "item-root",+ component: "ws:element",+ tag: "article",+ children: [],+ },+ ],},});+ await insertFragment({+ ...params,+ parentInstanceId: "parent-id",+ fragment: createFragmentPayload(),+ });await moveInstance({...params,moves: [{ instanceId: "instance-id", parentInstanceId: "parent-id" }],@@ -863,6 +886,10 @@ test("wraps project api trpc calls in named functions", async () => {"/trpc/api.instances.insertComponent",'"component":"@webstudio-is/sdk-components-react-radix:Switch"'),+ expectBodyRequest(+ "/trpc/api.instances.insertCollection",+ '"itemFragment":{"children":[{"type":"id","value":"item-root"}]'+ ),expectBodyRequest("/trpc/api.instances.insertFragment",'"fragment":{"children":[]'diff --git a/packages/http-client/src/index.ts b/packages/http-client/src/index.tsindex d0d700b1a5..b6fcd0c830 100644--- a/packages/http-client/src/index.ts+++ b/packages/http-client/src/index.ts@@ -1106,6 +1106,8 @@ export const insertComponent = projectMutationInput<}>("insert-component");+export const insertCollection = runtimeProjectMutation("insert-collection");+export const insertFragment = projectMutationInput<AuthProjectParams & {parentInstanceId: string;diff --git a/packages/project-build/src/contracts/__generated__/runtime-operation-contracts.ts b/packages/project-build/src/contracts/__generated__/runtime-operation-contracts.tsindex 4d6b2d03ac..7a2a32dc42 100644--- a/packages/project-build/src/contracts/__generated__/runtime-operation-contracts.ts+++ b/packages/project-build/src/contracts/__generated__/runtime-operation-contracts.ts@@ -25970,6 +25970,5807 @@ export const runtimeOperationContractData = [retryOnConflict: false,requiresAssets: true,},+ {+ id: "instances.insertCollection",+ command: "insert-collection",+ client: "insertCollection",+ kind: "mutation",+ inputSchema: {+ type: "object",+ properties: {+ parentInstanceId: {+ type: "string",+ },+ data: {+ oneOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "json",+ },+ value: {+ anyOf: [+ {+ type: "array",+ items: {},+ },+ {+ type: "object",+ propertyNames: {+ type: "string",+ },+ additionalProperties: {},+ },+ ],+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "expression",+ },+ value: {+ type: "string",+ minLength: 1,+ description:+ 'Expression resolving to the complete array or object, for example "Posts.data.items".',+ },+ },+ required: ["type", "value"],+ },+ ],+ description:+ "Complete iterable for the Collection. Do not pass one indexed item.",+ },+ itemFragment: {+ type: "object",+ properties: {+ children: {+ type: "array",+ items: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "id",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "text",+ },+ value: {+ type: "string",+ },+ placeholder: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "expression",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ },+ instances: {+ type: "array",+ items: {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "instance",+ },+ id: {+ type: "string",+ },+ component: {+ type: "string",+ minLength: 1,+ },+ tag: {+ type: "string",+ minLength: 1,+ description:+ "Optional HTML tag override for component rendering. Omit for component defaults; never pass an empty string.",+ },+ label: {+ type: "string",+ },+ children: {+ type: "array",+ items: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "id",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "text",+ },+ value: {+ type: "string",+ },+ placeholder: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "expression",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ },+ },+ required: ["type", "id", "component", "children"],+ },+ },+ assets: {+ type: "array",+ items: {+ anyOf: [+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ size: {+ type: "number",+ },+ name: {+ type: "string",+ },+ filename: {+ type: "string",+ },+ description: {+ anyOf: [+ {+ type: "string",+ },+ {+ type: "null",+ },+ ],+ },+ createdAt: {+ type: "string",+ },+ format: {+ anyOf: [+ {+ type: "string",+ const: "ttf",+ },+ {+ type: "string",+ const: "woff",+ },+ {+ type: "string",+ const: "woff2",+ },+ ],+ },+ meta: {+ anyOf: [+ {+ type: "object",+ properties: {+ family: {+ type: "string",+ },+ style: {+ type: "string",+ enum: ["normal", "italic", "oblique"],+ },+ weight: {+ type: "number",+ },+ },+ required: ["family", "style", "weight"],+ },+ {+ type: "object",+ properties: {+ family: {+ type: "string",+ },+ variationAxes: {+ type: "object",+ propertyNames: {+ type: "string",+ enum: [+ "wght",+ "wdth",+ "slnt",+ "opsz",+ "ital",+ "GRAD",+ "XTRA",+ "XOPQ",+ "YOPQ",+ "YTLC",+ "YTUC",+ "YTAS",+ "YTDE",+ "YTFI",+ ],+ },+ additionalProperties: {+ type: "object",+ properties: {+ name: {+ type: "string",+ },+ min: {+ type: "number",+ },+ default: {+ type: "number",+ },+ max: {+ type: "number",+ },+ },+ required: ["name", "min", "default", "max"],+ },+ },+ },+ required: ["family", "variationAxes"],+ },+ ],+ },+ type: {+ type: "string",+ const: "font",+ },+ },+ required: [+ "id",+ "size",+ "name",+ "createdAt",+ "format",+ "meta",+ "type",+ ],+ },+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ size: {+ type: "number",+ },+ name: {+ type: "string",+ },+ filename: {+ type: "string",+ },+ description: {+ anyOf: [+ {+ type: "string",+ },+ {+ type: "null",+ },+ ],+ },+ createdAt: {+ type: "string",+ },+ format: {+ type: "string",+ },+ meta: {+ type: "object",+ properties: {+ width: {+ type: "number",+ },+ height: {+ type: "number",+ },+ },+ required: ["width", "height"],+ },+ type: {+ type: "string",+ const: "image",+ },+ },+ required: [+ "id",+ "size",+ "name",+ "createdAt",+ "format",+ "meta",+ "type",+ ],+ },+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ size: {+ type: "number",+ },+ name: {+ type: "string",+ },+ filename: {+ type: "string",+ },+ description: {+ anyOf: [+ {+ type: "string",+ },+ {+ type: "null",+ },+ ],+ },+ createdAt: {+ type: "string",+ },+ format: {+ type: "string",+ },+ meta: {+ type: "object",+ properties: {},+ required: [],+ additionalProperties: true,+ },+ type: {+ type: "string",+ const: "file",+ },+ },+ required: [+ "id",+ "size",+ "name",+ "createdAt",+ "format",+ "meta",+ "type",+ ],+ },+ ],+ },+ },+ dataSources: {+ type: "array",+ items: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "variable",+ },+ id: {+ type: "string",+ },+ scopeInstanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ value: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "number",+ },+ value: {+ type: "number",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "string",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "boolean",+ },+ value: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "string[]",+ },+ value: {+ type: "array",+ items: {+ type: "string",+ },+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "json",+ },+ value: {},+ },+ required: ["type"],+ },+ ],+ },+ },+ required: ["type", "id", "name", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "parameter",+ },+ id: {+ type: "string",+ },+ scopeInstanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ },+ required: ["type", "id", "name"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "resource",+ },+ id: {+ type: "string",+ },+ scopeInstanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ resourceId: {+ type: "string",+ },+ },+ required: ["type", "id", "name", "resourceId"],+ },+ ],+ },+ },+ resources: {+ type: "array",+ items: {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ name: {+ type: "string",+ },+ control: {+ anyOf: [+ {+ type: "string",+ const: "system",+ },+ {+ type: "string",+ const: "graphql",+ },+ ],+ },+ method: {+ anyOf: [+ {+ type: "string",+ const: "get",+ },+ {+ type: "string",+ const: "post",+ },+ {+ type: "string",+ const: "put",+ },+ {+ type: "string",+ const: "delete",+ },+ ],+ },+ url: {+ type: "string",+ },+ searchParams: {+ type: "array",+ items: {+ type: "object",+ properties: {+ name: {+ type: "string",+ },+ value: {+ type: "string",+ },+ },+ required: ["name", "value"],+ },+ },+ headers: {+ type: "array",+ items: {+ type: "object",+ properties: {+ name: {+ type: "string",+ },+ value: {+ type: "string",+ },+ },+ required: ["name", "value"],+ },+ },+ body: {+ type: "string",+ },+ },+ required: ["id", "name", "method", "url", "headers"],+ },+ },+ props: {+ type: "array",+ items: {+ anyOf: [+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ instanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ required: {+ type: "boolean",+ },+ type: {+ type: "string",+ const: "number",+ },+ value: {+ type: "number",+ },+ },+ required: ["id", "instanceId", "name", "type", "value"],+ },+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ instanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ required: {+ type: "boolean",+ },+ type: {+ type: "string",+ const: "string",+ },+ value: {+ type: "string",+ },+ },+ required: ["id", "instanceId", "name", "type", "value"],+ },+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ instanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ required: {+ type: "boolean",+ },+ type: {+ type: "string",+ const: "boolean",+ },+ value: {+ type: "boolean",+ },+ },+ required: ["id", "instanceId", "name", "type", "value"],+ },+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ instanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ required: {+ type: "boolean",+ },+ type: {+ type: "string",+ const: "json",+ },+ value: {},+ },+ required: ["id", "instanceId", "name", "type"],+ },+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ instanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ required: {+ type: "boolean",+ },+ type: {+ type: "string",+ const: "asset",+ },+ value: {+ type: "string",+ },+ },+ required: ["id", "instanceId", "name", "type", "value"],+ },+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ instanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ required: {+ type: "boolean",+ },+ type: {+ type: "string",+ const: "page",+ },+ value: {+ anyOf: [+ {+ type: "string",+ },+ {+ type: "object",+ properties: {+ pageId: {+ type: "string",+ },+ instanceId: {+ type: "string",+ },+ },+ required: ["pageId", "instanceId"],+ },+ ],+ },+ },+ required: ["id", "instanceId", "name", "type", "value"],+ },+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ instanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ required: {+ type: "boolean",+ },+ type: {+ type: "string",+ const: "string[]",+ },+ value: {+ type: "array",+ items: {+ type: "string",+ },+ },+ },+ required: ["id", "instanceId", "name", "type", "value"],+ },+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ instanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ required: {+ type: "boolean",+ },+ type: {+ type: "string",+ const: "parameter",+ },+ value: {+ type: "string",+ },+ },+ required: ["id", "instanceId", "name", "type", "value"],+ },+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ instanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ required: {+ type: "boolean",+ },+ type: {+ type: "string",+ const: "resource",+ },+ value: {+ type: "string",+ },+ },+ required: ["id", "instanceId", "name", "type", "value"],+ },+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ instanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ required: {+ type: "boolean",+ },+ type: {+ type: "string",+ const: "expression",+ },+ value: {+ type: "string",+ },+ },+ required: ["id", "instanceId", "name", "type", "value"],+ },+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ instanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ required: {+ type: "boolean",+ },+ type: {+ type: "string",+ const: "action",+ },+ value: {+ type: "array",+ items: {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "execute",+ },+ args: {+ type: "array",+ items: {+ type: "string",+ },+ },+ code: {+ type: "string",+ },+ },+ required: ["type", "args", "code"],+ },+ },+ },+ required: ["id", "instanceId", "name", "type", "value"],+ },+ {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ instanceId: {+ type: "string",+ },+ name: {+ type: "string",+ },+ required: {+ type: "boolean",+ },+ type: {+ type: "string",+ const: "animationAction",+ },+ value: {+ oneOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "scroll",+ },+ source: {+ anyOf: [+ {+ type: "string",+ const: "closest",+ },+ {+ type: "string",+ const: "nearest",+ },+ {+ type: "string",+ const: "root",+ },+ ],+ },+ axis: {+ anyOf: [+ {+ type: "string",+ const: "block",+ },+ {+ type: "string",+ const: "inline",+ },+ {+ type: "string",+ const: "x",+ },+ {+ type: "string",+ const: "y",+ },+ ],+ },+ animations: {+ type: "array",+ items: {+ type: "object",+ properties: {+ name: {+ type: "string",+ },+ description: {+ type: "string",+ },+ enabled: {+ type: "array",+ items: {+ type: "array",+ prefixItems: [+ {+ type: "string",+ description: "breakpointId",+ },+ {+ type: "boolean",+ },+ ],+ minItems: 2,+ maxItems: 2,+ },+ },+ keyframes: {+ type: "array",+ items: {+ type: "object",+ properties: {+ offset: {+ type: "number",+ },+ styles: {+ type: "object",+ propertyNames: {+ type: "string",+ },+ additionalProperties: {+ $ref: "#/$defs/__schema0",+ },+ },+ },+ required: ["styles"],+ },+ },+ timing: {+ type: "object",+ properties: {+ easing: {+ type: "string",+ },+ fill: {+ anyOf: [+ {+ type: "string",+ const: "none",+ },+ {+ type: "string",+ const: "forwards",+ },+ {+ type: "string",+ const: "backwards",+ },+ {+ type: "string",+ const: "both",+ },+ ],+ },+ duration: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ value: {+ type: "number",+ },+ unit: {+ anyOf: [+ {+ type: "string",+ const: "ms",+ },+ {+ type: "string",+ const: "s",+ },+ ],+ },+ },+ required: [+ "type",+ "value",+ "unit",+ ],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ delay: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ value: {+ type: "number",+ },+ unit: {+ anyOf: [+ {+ type: "string",+ const: "ms",+ },+ {+ type: "string",+ const: "s",+ },+ ],+ },+ },+ required: [+ "type",+ "value",+ "unit",+ ],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ iterations: {+ anyOf: [+ {+ type: "number",+ },+ {+ type: "string",+ const: "infinite",+ },+ ],+ },+ rangeStart: {+ type: "array",+ prefixItems: [+ {+ anyOf: [+ {+ type: "string",+ const: "start",+ },+ {+ type: "string",+ const: "end",+ },+ ],+ },+ {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ value: {+ type: "number",+ },+ unit: {+ anyOf: [+ {+ type: "string",+ const: "%",+ },+ {+ type: "string",+ const: "px",+ },+ {+ type: "string",+ const: "cm",+ },+ {+ type: "string",+ const: "mm",+ },+ {+ type: "string",+ const: "q",+ },+ {+ type: "string",+ const: "in",+ },+ {+ type: "string",+ const: "pt",+ },+ {+ type: "string",+ const: "pc",+ },+ {+ type: "string",+ const: "em",+ },+ {+ type: "string",+ const: "rem",+ },+ {+ type: "string",+ const: "ex",+ },+ {+ type: "string",+ const: "rex",+ },+ {+ type: "string",+ const: "cap",+ },+ {+ type: "string",+ const: "rcap",+ },+ {+ type: "string",+ const: "ch",+ },+ {+ type: "string",+ const: "rch",+ },+ {+ type: "string",+ const: "lh",+ },+ {+ type: "string",+ const: "rlh",+ },+ {+ type: "string",+ const: "vw",+ },+ {+ type: "string",+ const: "svw",+ },+ {+ type: "string",+ const: "lvw",+ },+ {+ type: "string",+ const: "dvw",+ },+ {+ type: "string",+ const: "vh",+ },+ {+ type: "string",+ const: "svh",+ },+ {+ type: "string",+ const: "lvh",+ },+ {+ type: "string",+ const: "dvh",+ },+ {+ type: "string",+ const: "vi",+ },+ {+ type: "string",+ const: "svi",+ },+ {+ type: "string",+ const: "lvi",+ },+ {+ type: "string",+ const: "dvi",+ },+ {+ type: "string",+ const: "vb",+ },+ {+ type: "string",+ const: "svb",+ },+ {+ type: "string",+ const: "lvb",+ },+ {+ type: "string",+ const: "dvb",+ },+ {+ type: "string",+ const: "vmin",+ },+ {+ type: "string",+ const: "svmin",+ },+ {+ type: "string",+ const: "lvmin",+ },+ {+ type: "string",+ const: "dvmin",+ },+ {+ type: "string",+ const: "vmax",+ },+ {+ type: "string",+ const: "svmax",+ },+ {+ type: "string",+ const: "lvmax",+ },+ {+ type: "string",+ const: "dvmax",+ },+ ],+ },+ },+ required: [+ "type",+ "value",+ "unit",+ ],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ ],+ minItems: 2,+ maxItems: 2,+ },+ rangeEnd: {+ type: "array",+ prefixItems: [+ {+ anyOf: [+ {+ type: "string",+ const: "start",+ },+ {+ type: "string",+ const: "end",+ },+ ],+ },+ {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ value: {+ type: "number",+ },+ unit: {+ anyOf: [+ {+ type: "string",+ const: "%",+ },+ {+ type: "string",+ const: "px",+ },+ {+ type: "string",+ const: "cm",+ },+ {+ type: "string",+ const: "mm",+ },+ {+ type: "string",+ const: "q",+ },+ {+ type: "string",+ const: "in",+ },+ {+ type: "string",+ const: "pt",+ },+ {+ type: "string",+ const: "pc",+ },+ {+ type: "string",+ const: "em",+ },+ {+ type: "string",+ const: "rem",+ },+ {+ type: "string",+ const: "ex",+ },+ {+ type: "string",+ const: "rex",+ },+ {+ type: "string",+ const: "cap",+ },+ {+ type: "string",+ const: "rcap",+ },+ {+ type: "string",+ const: "ch",+ },+ {+ type: "string",+ const: "rch",+ },+ {+ type: "string",+ const: "lh",+ },+ {+ type: "string",+ const: "rlh",+ },+ {+ type: "string",+ const: "vw",+ },+ {+ type: "string",+ const: "svw",+ },+ {+ type: "string",+ const: "lvw",+ },+ {+ type: "string",+ const: "dvw",+ },+ {+ type: "string",+ const: "vh",+ },+ {+ type: "string",+ const: "svh",+ },+ {+ type: "string",+ const: "lvh",+ },+ {+ type: "string",+ const: "dvh",+ },+ {+ type: "string",+ const: "vi",+ },+ {+ type: "string",+ const: "svi",+ },+ {+ type: "string",+ const: "lvi",+ },+ {+ type: "string",+ const: "dvi",+ },+ {+ type: "string",+ const: "vb",+ },+ {+ type: "string",+ const: "svb",+ },+ {+ type: "string",+ const: "lvb",+ },+ {+ type: "string",+ const: "dvb",+ },+ {+ type: "string",+ const: "vmin",+ },+ {+ type: "string",+ const: "svmin",+ },+ {+ type: "string",+ const: "lvmin",+ },+ {+ type: "string",+ const: "dvmin",+ },+ {+ type: "string",+ const: "vmax",+ },+ {+ type: "string",+ const: "svmax",+ },+ {+ type: "string",+ const: "lvmax",+ },+ {+ type: "string",+ const: "dvmax",+ },+ ],+ },+ },+ required: [+ "type",+ "value",+ "unit",+ ],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ ],+ minItems: 2,+ maxItems: 2,+ },+ },+ required: [],+ },+ },+ required: ["keyframes", "timing"],+ },+ },+ isPinned: {+ type: "boolean",+ },+ debug: {+ type: "boolean",+ },+ },+ required: ["type", "animations"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "view",+ },+ subject: {+ type: "string",+ },+ axis: {+ anyOf: [+ {+ type: "string",+ const: "block",+ },+ {+ type: "string",+ const: "inline",+ },+ {+ type: "string",+ const: "x",+ },+ {+ type: "string",+ const: "y",+ },+ ],+ },+ animations: {+ type: "array",+ items: {+ type: "object",+ properties: {+ name: {+ type: "string",+ },+ description: {+ type: "string",+ },+ enabled: {+ type: "array",+ items: {+ type: "array",+ prefixItems: [+ {+ type: "string",+ description: "breakpointId",+ },+ {+ type: "boolean",+ },+ ],+ minItems: 2,+ maxItems: 2,+ },+ },+ keyframes: {+ type: "array",+ items: {+ type: "object",+ properties: {+ offset: {+ type: "number",+ },+ styles: {+ type: "object",+ propertyNames: {+ type: "string",+ },+ additionalProperties: {+ $ref: "#/$defs/__schema0",+ },+ },+ },+ required: ["styles"],+ },+ },+ timing: {+ type: "object",+ properties: {+ easing: {+ type: "string",+ },+ fill: {+ anyOf: [+ {+ type: "string",+ const: "none",+ },+ {+ type: "string",+ const: "forwards",+ },+ {+ type: "string",+ const: "backwards",+ },+ {+ type: "string",+ const: "both",+ },+ ],+ },+ duration: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ value: {+ type: "number",+ },+ unit: {+ anyOf: [+ {+ type: "string",+ const: "ms",+ },+ {+ type: "string",+ const: "s",+ },+ ],+ },+ },+ required: [+ "type",+ "value",+ "unit",+ ],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ delay: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ value: {+ type: "number",+ },+ unit: {+ anyOf: [+ {+ type: "string",+ const: "ms",+ },+ {+ type: "string",+ const: "s",+ },+ ],+ },+ },+ required: [+ "type",+ "value",+ "unit",+ ],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ iterations: {+ anyOf: [+ {+ type: "number",+ },+ {+ type: "string",+ const: "infinite",+ },+ ],+ },+ rangeStart: {+ type: "array",+ prefixItems: [+ {+ anyOf: [+ {+ type: "string",+ const: "contain",+ },+ {+ type: "string",+ const: "cover",+ },+ {+ type: "string",+ const: "entry",+ },+ {+ type: "string",+ const: "exit",+ },+ {+ type: "string",+ const: "entry-crossing",+ },+ {+ type: "string",+ const: "exit-crossing",+ },+ ],+ },+ {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ value: {+ type: "number",+ },+ unit: {+ anyOf: [+ {+ type: "string",+ const: "%",+ },+ {+ type: "string",+ const: "px",+ },+ {+ type: "string",+ const: "cm",+ },+ {+ type: "string",+ const: "mm",+ },+ {+ type: "string",+ const: "q",+ },+ {+ type: "string",+ const: "in",+ },+ {+ type: "string",+ const: "pt",+ },+ {+ type: "string",+ const: "pc",+ },+ {+ type: "string",+ const: "em",+ },+ {+ type: "string",+ const: "rem",+ },+ {+ type: "string",+ const: "ex",+ },+ {+ type: "string",+ const: "rex",+ },+ {+ type: "string",+ const: "cap",+ },+ {+ type: "string",+ const: "rcap",+ },+ {+ type: "string",+ const: "ch",+ },+ {+ type: "string",+ const: "rch",+ },+ {+ type: "string",+ const: "lh",+ },+ {+ type: "string",+ const: "rlh",+ },+ {+ type: "string",+ const: "vw",+ },+ {+ type: "string",+ const: "svw",+ },+ {+ type: "string",+ const: "lvw",+ },+ {+ type: "string",+ const: "dvw",+ },+ {+ type: "string",+ const: "vh",+ },+ {+ type: "string",+ const: "svh",+ },+ {+ type: "string",+ const: "lvh",+ },+ {+ type: "string",+ const: "dvh",+ },+ {+ type: "string",+ const: "vi",+ },+ {+ type: "string",+ const: "svi",+ },+ {+ type: "string",+ const: "lvi",+ },+ {+ type: "string",+ const: "dvi",+ },+ {+ type: "string",+ const: "vb",+ },+ {+ type: "string",+ const: "svb",+ },+ {+ type: "string",+ const: "lvb",+ },+ {+ type: "string",+ const: "dvb",+ },+ {+ type: "string",+ const: "vmin",+ },+ {+ type: "string",+ const: "svmin",+ },+ {+ type: "string",+ const: "lvmin",+ },+ {+ type: "string",+ const: "dvmin",+ },+ {+ type: "string",+ const: "vmax",+ },+ {+ type: "string",+ const: "svmax",+ },+ {+ type: "string",+ const: "lvmax",+ },+ {+ type: "string",+ const: "dvmax",+ },+ ],+ },+ },+ required: [+ "type",+ "value",+ "unit",+ ],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ ],+ minItems: 2,+ maxItems: 2,+ },+ rangeEnd: {+ type: "array",+ prefixItems: [+ {+ anyOf: [+ {+ type: "string",+ const: "contain",+ },+ {+ type: "string",+ const: "cover",+ },+ {+ type: "string",+ const: "entry",+ },+ {+ type: "string",+ const: "exit",+ },+ {+ type: "string",+ const: "entry-crossing",+ },+ {+ type: "string",+ const: "exit-crossing",+ },+ ],+ },+ {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ value: {+ type: "number",+ },+ unit: {+ anyOf: [+ {+ type: "string",+ const: "%",+ },+ {+ type: "string",+ const: "px",+ },+ {+ type: "string",+ const: "cm",+ },+ {+ type: "string",+ const: "mm",+ },+ {+ type: "string",+ const: "q",+ },+ {+ type: "string",+ const: "in",+ },+ {+ type: "string",+ const: "pt",+ },+ {+ type: "string",+ const: "pc",+ },+ {+ type: "string",+ const: "em",+ },+ {+ type: "string",+ const: "rem",+ },+ {+ type: "string",+ const: "ex",+ },+ {+ type: "string",+ const: "rex",+ },+ {+ type: "string",+ const: "cap",+ },+ {+ type: "string",+ const: "rcap",+ },+ {+ type: "string",+ const: "ch",+ },+ {+ type: "string",+ const: "rch",+ },+ {+ type: "string",+ const: "lh",+ },+ {+ type: "string",+ const: "rlh",+ },+ {+ type: "string",+ const: "vw",+ },+ {+ type: "string",+ const: "svw",+ },+ {+ type: "string",+ const: "lvw",+ },+ {+ type: "string",+ const: "dvw",+ },+ {+ type: "string",+ const: "vh",+ },+ {+ type: "string",+ const: "svh",+ },+ {+ type: "string",+ const: "lvh",+ },+ {+ type: "string",+ const: "dvh",+ },+ {+ type: "string",+ const: "vi",+ },+ {+ type: "string",+ const: "svi",+ },+ {+ type: "string",+ const: "lvi",+ },+ {+ type: "string",+ const: "dvi",+ },+ {+ type: "string",+ const: "vb",+ },+ {+ type: "string",+ const: "svb",+ },+ {+ type: "string",+ const: "lvb",+ },+ {+ type: "string",+ const: "dvb",+ },+ {+ type: "string",+ const: "vmin",+ },+ {+ type: "string",+ const: "svmin",+ },+ {+ type: "string",+ const: "lvmin",+ },+ {+ type: "string",+ const: "dvmin",+ },+ {+ type: "string",+ const: "vmax",+ },+ {+ type: "string",+ const: "svmax",+ },+ {+ type: "string",+ const: "lvmax",+ },+ {+ type: "string",+ const: "dvmax",+ },+ ],+ },+ },+ required: [+ "type",+ "value",+ "unit",+ ],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ ],+ minItems: 2,+ maxItems: 2,+ },+ },+ required: [],+ },+ },+ required: ["keyframes", "timing"],+ },+ },+ insetStart: {+ anyOf: [+ {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ value: {+ type: "number",+ },+ unit: {+ anyOf: [+ {+ type: "string",+ const: "%",+ },+ {+ type: "string",+ const: "px",+ },+ {+ type: "string",+ const: "cm",+ },+ {+ type: "string",+ const: "mm",+ },+ {+ type: "string",+ const: "q",+ },+ {+ type: "string",+ const: "in",+ },+ {+ type: "string",+ const: "pt",+ },+ {+ type: "string",+ const: "pc",+ },+ {+ type: "string",+ const: "em",+ },+ {+ type: "string",+ const: "rem",+ },+ {+ type: "string",+ const: "ex",+ },+ {+ type: "string",+ const: "rex",+ },+ {+ type: "string",+ const: "cap",+ },+ {+ type: "string",+ const: "rcap",+ },+ {+ type: "string",+ const: "ch",+ },+ {+ type: "string",+ const: "rch",+ },+ {+ type: "string",+ const: "lh",+ },+ {+ type: "string",+ const: "rlh",+ },+ {+ type: "string",+ const: "vw",+ },+ {+ type: "string",+ const: "svw",+ },+ {+ type: "string",+ const: "lvw",+ },+ {+ type: "string",+ const: "dvw",+ },+ {+ type: "string",+ const: "vh",+ },+ {+ type: "string",+ const: "svh",+ },+ {+ type: "string",+ const: "lvh",+ },+ {+ type: "string",+ const: "dvh",+ },+ {+ type: "string",+ const: "vi",+ },+ {+ type: "string",+ const: "svi",+ },+ {+ type: "string",+ const: "lvi",+ },+ {+ type: "string",+ const: "dvi",+ },+ {+ type: "string",+ const: "vb",+ },+ {+ type: "string",+ const: "svb",+ },+ {+ type: "string",+ const: "lvb",+ },+ {+ type: "string",+ const: "dvb",+ },+ {+ type: "string",+ const: "vmin",+ },+ {+ type: "string",+ const: "svmin",+ },+ {+ type: "string",+ const: "lvmin",+ },+ {+ type: "string",+ const: "dvmin",+ },+ {+ type: "string",+ const: "vmax",+ },+ {+ type: "string",+ const: "svmax",+ },+ {+ type: "string",+ const: "lvmax",+ },+ {+ type: "string",+ const: "dvmax",+ },+ ],+ },+ },+ required: ["type", "value", "unit"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ const: "auto",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ insetEnd: {+ anyOf: [+ {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ value: {+ type: "number",+ },+ unit: {+ anyOf: [+ {+ type: "string",+ const: "%",+ },+ {+ type: "string",+ const: "px",+ },+ {+ type: "string",+ const: "cm",+ },+ {+ type: "string",+ const: "mm",+ },+ {+ type: "string",+ const: "q",+ },+ {+ type: "string",+ const: "in",+ },+ {+ type: "string",+ const: "pt",+ },+ {+ type: "string",+ const: "pc",+ },+ {+ type: "string",+ const: "em",+ },+ {+ type: "string",+ const: "rem",+ },+ {+ type: "string",+ const: "ex",+ },+ {+ type: "string",+ const: "rex",+ },+ {+ type: "string",+ const: "cap",+ },+ {+ type: "string",+ const: "rcap",+ },+ {+ type: "string",+ const: "ch",+ },+ {+ type: "string",+ const: "rch",+ },+ {+ type: "string",+ const: "lh",+ },+ {+ type: "string",+ const: "rlh",+ },+ {+ type: "string",+ const: "vw",+ },+ {+ type: "string",+ const: "svw",+ },+ {+ type: "string",+ const: "lvw",+ },+ {+ type: "string",+ const: "dvw",+ },+ {+ type: "string",+ const: "vh",+ },+ {+ type: "string",+ const: "svh",+ },+ {+ type: "string",+ const: "lvh",+ },+ {+ type: "string",+ const: "dvh",+ },+ {+ type: "string",+ const: "vi",+ },+ {+ type: "string",+ const: "svi",+ },+ {+ type: "string",+ const: "lvi",+ },+ {+ type: "string",+ const: "dvi",+ },+ {+ type: "string",+ const: "vb",+ },+ {+ type: "string",+ const: "svb",+ },+ {+ type: "string",+ const: "lvb",+ },+ {+ type: "string",+ const: "dvb",+ },+ {+ type: "string",+ const: "vmin",+ },+ {+ type: "string",+ const: "svmin",+ },+ {+ type: "string",+ const: "lvmin",+ },+ {+ type: "string",+ const: "dvmin",+ },+ {+ type: "string",+ const: "vmax",+ },+ {+ type: "string",+ const: "svmax",+ },+ {+ type: "string",+ const: "lvmax",+ },+ {+ type: "string",+ const: "dvmax",+ },+ ],+ },+ },+ required: ["type", "value", "unit"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ const: "auto",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ isPinned: {+ type: "boolean",+ },+ debug: {+ type: "boolean",+ },+ },+ required: ["type", "animations"],+ },+ ],+ },+ },+ required: ["id", "instanceId", "name", "type", "value"],+ },+ ],+ },+ },+ breakpoints: {+ type: "array",+ items: {+ type: "object",+ properties: {+ id: {+ type: "string",+ },+ label: {+ type: "string",+ },+ minWidth: {+ type: "number",+ },+ maxWidth: {+ type: "number",+ },+ condition: {+ type: "string",+ },+ },+ required: ["id", "label"],+ },+ },+ styleSourceSelections: {+ type: "array",+ items: {+ type: "object",+ properties: {+ instanceId: {+ type: "string",+ },+ values: {+ type: "array",+ items: {+ type: "string",+ },+ },+ },+ required: ["instanceId", "values"],+ },+ },+ styleSources: {+ type: "array",+ items: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "token",+ },+ id: {+ type: "string",+ },+ name: {+ type: "string",+ },+ locked: {+ type: "boolean",+ },+ },+ required: ["type", "id", "name"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "local",+ },+ id: {+ type: "string",+ },+ },+ required: ["type", "id"],+ },+ ],+ },+ },+ styles: {+ type: "array",+ items: {+ type: "object",+ properties: {+ styleSourceId: {+ type: "string",+ },+ breakpointId: {+ type: "string",+ },+ state: {+ type: "string",+ },+ property: {+ type: "string",+ },+ value: {+ $ref: "#/$defs/__schema0",+ },+ listed: {+ description: "Whether the style is from the Advanced panel",+ type: "boolean",+ },+ },+ required: [+ "styleSourceId",+ "breakpointId",+ "property",+ "value",+ ],+ },+ },+ },+ required: [+ "children",+ "instances",+ "assets",+ "dataSources",+ "resources",+ "props",+ "breakpoints",+ "styleSourceSelections",+ "styleSources",+ "styles",+ ],+ description:+ "One structured repeated-item fragment. Descendant expressions may reference collectionItem and collectionItemKey.",+ },+ mode: {+ type: "string",+ enum: ["append", "prepend", "replace"],+ },+ insertIndex: {+ type: "integer",+ minimum: 0,+ maximum: 9007199254740991,+ },+ },+ required: ["parentInstanceId", "data", "itemFragment"],+ $defs: {+ __schema0: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "image",+ },+ value: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "asset",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "url",+ },+ url: {+ type: "string",+ },+ },+ required: ["type", "url"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "layers",+ },+ value: {+ type: "array",+ items: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "image",+ },+ value: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "asset",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "url",+ },+ url: {+ type: "string",+ },+ },+ required: ["type", "url"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "tuple",+ },+ value: {+ type: "array",+ items: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "image",+ },+ value: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "asset",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "url",+ },+ url: {+ type: "string",+ },+ },+ required: ["type", "url"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "function",+ },+ name: {+ type: "string",+ },+ args: {+ $ref: "#/$defs/__schema0",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "name", "args"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: [+ "type",+ "r",+ "g",+ "b",+ "alpha",+ ],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "shadow",+ },+ hidden: {+ type: "boolean",+ },+ position: {+ anyOf: [+ {+ type: "string",+ const: "inset",+ },+ {+ type: "string",+ const: "outset",+ },+ ],+ },+ offsetX: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: [+ "type",+ "r",+ "g",+ "b",+ "alpha",+ ],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ offsetY: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: [+ "type",+ "r",+ "g",+ "b",+ "alpha",+ ],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ blur: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: [+ "type",+ "r",+ "g",+ "b",+ "alpha",+ ],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ spread: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: [+ "type",+ "r",+ "g",+ "b",+ "alpha",+ ],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ color: {+ anyOf: [+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: [+ "type",+ "r",+ "g",+ "b",+ "alpha",+ ],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ },+ required: ["type", "position", "offsetX", "offsetY"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "invalid",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "function",+ },+ name: {+ type: "string",+ },+ args: {+ $ref: "#/$defs/__schema0",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "name", "args"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "fontFamily",+ },+ value: {+ type: "array",+ items: {+ type: "string",+ },+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "tuple",+ },+ value: {+ type: "array",+ items: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "image",+ },+ value: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "asset",+ },+ value: {+ type: "string",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "url",+ },+ url: {+ type: "string",+ },+ },+ required: ["type", "url"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "function",+ },+ name: {+ type: "string",+ },+ args: {+ $ref: "#/$defs/__schema0",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "name", "args"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "function",+ },+ name: {+ type: "string",+ },+ args: {+ $ref: "#/$defs/__schema0",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "name", "args"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "guaranteedInvalid",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "invalid",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unset",+ },+ value: {+ type: "string",+ const: "",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "shadow",+ },+ hidden: {+ type: "boolean",+ },+ position: {+ anyOf: [+ {+ type: "string",+ const: "inset",+ },+ {+ type: "string",+ const: "outset",+ },+ ],+ },+ offsetX: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ offsetY: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ blur: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ spread: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ color: {+ anyOf: [+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ },+ required: ["type", "position", "offsetX", "offsetY"],+ },+ ],+ },+ __schema1: {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "color",+ },+ colorSpace: {+ anyOf: [+ {+ type: "string",+ const: "hex",+ },+ {+ type: "string",+ const: "srgb",+ },+ {+ type: "string",+ const: "p3",+ },+ {+ type: "string",+ const: "srgb-linear",+ },+ {+ type: "string",+ const: "hsl",+ },+ {+ type: "string",+ const: "hwb",+ },+ {+ type: "string",+ const: "lab",+ },+ {+ type: "string",+ const: "lch",+ },+ {+ type: "string",+ const: "oklab",+ },+ {+ type: "string",+ const: "oklch",+ },+ {+ type: "string",+ const: "a98rgb",+ },+ {+ type: "string",+ const: "prophoto",+ },+ {+ type: "string",+ const: "rec2020",+ },+ {+ type: "string",+ const: "xyz-d65",+ },+ {+ type: "string",+ const: "xyz-d50",+ },+ ],+ },+ components: {+ type: "array",+ prefixItems: [+ {+ type: "number",+ },+ {+ type: "number",+ },+ {+ type: "number",+ },+ ],+ minItems: 3,+ maxItems: 3,+ },+ alpha: {+ anyOf: [+ {+ type: "number",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "var",+ },+ value: {+ type: "string",+ },+ fallback: {+ anyOf: [+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unparsed",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "keyword",+ },+ value: {+ type: "string",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "unit",+ },+ unit: {+ type: "string",+ },+ value: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "unit", "value"],+ },+ {+ $ref: "#/$defs/__schema1",+ },+ {+ type: "object",+ properties: {+ type: {+ type: "string",+ const: "rgb",+ },+ r: {+ type: "number",+ },+ g: {+ type: "number",+ },+ b: {+ type: "number",+ },+ alpha: {+ type: "number",+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "r", "g", "b", "alpha"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "value"],+ },+ ],+ },+ hidden: {+ type: "boolean",+ },+ },+ required: ["type", "colorSpace", "components", "alpha"],+ },+ },+ },+ outputSchema: {+ type: "object",+ properties: {+ instanceIds: {+ type: "array",+ items: {+ type: "string",+ },+ },+ rootInstanceIds: {+ type: "array",+ items: {+ type: "string",+ },+ },+ removedInstanceIds: {+ type: "array",+ items: {+ type: "string",+ },+ },+ parentInstanceId: {+ type: "string",+ },+ didMergeBreakpointsDueToLimit: {+ type: "boolean",+ const: true,+ },+ collectionInstanceId: {+ type: "string",+ },+ itemRootInstanceId: {+ type: "string",+ },+ itemParameterId: {+ type: "string",+ },+ itemKeyParameterId: {+ type: "string",+ },+ },+ required: [+ "instanceIds",+ "rootInstanceIds",+ "removedInstanceIds",+ "parentInstanceId",+ "collectionInstanceId",+ "itemRootInstanceId",+ "itemParameterId",+ "itemKeyParameterId",+ ],+ },+ readNamespaces: [+ "pages",+ "instances",+ "props",+ "dataSources",+ "resources",+ "styleSources",+ "styleSourceSelections",+ "styles",+ "breakpoints",+ "assets",+ ],+ writeNamespaces: [+ "instances",+ "props",+ "dataSources",+ "resources",+ "styleSources",+ "styleSourceSelections",+ "styles",+ "breakpoints",+ "assets",+ ],+ invalidatesNamespaces: [+ "instances",+ "props",+ "dataSources",+ "resources",+ "styleSources",+ "styleSourceSelections",+ "styles",+ "breakpoints",+ "assets",+ ],+ retryOnConflict: false,+ requiresAssets: true,+ },{id: "instances.insertFragment",command: "insert-fragment",diff --git a/packages/project-build/src/docs.generated.ts b/packages/project-build/src/docs.generated.tsindex 0a0edd4e29..1d04d9b15f 100644--- a/packages/project-build/src/docs.generated.ts+++ b/packages/project-build/src/docs.generated.ts@@ -4,7 +4,7 @@ export const projectBuildDocs = {"accessibility-review":'<!-- Adapted for Webstudio MCP from Community-Access/accessibility-agents, web-accessibility-wizard/SKILL.md (MIT): https://github.com/Community-Access/accessibility-agents/blob/main/codex-skills/web-accessibility-wizard/SKILL.md -->\n\n# Webstudio Accessibility Review\n\nUse this workflow when creating or reviewing a page, component, form, menu,\ndialog, or responsive layout. It is an LLM-assisted review, not proof of WCAG\nconformance. Do not claim that a page is accessible solely because this review\nhas no findings.\n\n## Evidence First\n\n1. Read `meta.index` and use focused project tools. Do not inspect Webstudio\n source code or generated files for normal project reviews.\n2. Run `audit` with `{"scopes":["accessibility"]}` before changing\n anything. It detects deterministic metadata issues such as labels, landmark\n structure, positive tabindex values, invalid static ARIA states, and unmuted\n autoplay. Fix confirmed static findings first.\n3. For each changed route, use `preview.start` and capture screenshots with\n `screenshot` at desktop, tablet, and mobile widths. Use `waitForSelector`\n or `waitForTimeout` only when the page has an actual delayed ready state.\n4. Use `get-page-by-path`, `list-instances`, `inspect-instance`, and focused\n prop/style reads to verify semantics and authored state that screenshots\n cannot prove.\n5. Make only supported, evidence-based fixes with semantic MCP tools. Recheck\n the affected route and the static accessibility search after every fix.\n\n## Review Areas\n\nReview these areas in priority order. Record the evidence for every finding.\n\n### 1. Names, Semantics, and Structure\n\n- Every image has purposeful alternative text or an explicitly empty alt when\n decorative. Image-submit inputs need a non-empty alt label describing their\n action.\n- For `missing-image-description` findings, inspect the rendered image in its\n page context and call `set-image-descriptions` with either a concise generated\n description or `decorative: true`. Re-run the audit after saving the decision.\n- Buttons, links, icon-only controls, and form controls have accessible names.\n- Prefer native HTML semantics over ARIA roles.\n- Non-native elements using `role="button"` or `role="link"` must be\n keyboard-focusable.\n- Use one sensible page h1, ordered heading levels, meaningful link text, and\n a main landmark.\n- Iframes have titles. Static HTML ids are unique, ARIA reference props point\n to real ids, and static boolean/select/numeric ARIA values are valid.\n- Focusable controls must not be hidden from assistive technology with\n `aria-hidden`.\n\n### 2. Keyboard and Focus\n\n- Interactive controls should be native or have a documented keyboard model.\n- Visible focus must not be removed without a visible replacement.\n- Hover-only information or controls need a keyboard-accessible equivalent.\n- Do not use positive tabindex values.\n- Mark keyboard behavior as **manual verification required** when the available\n evidence cannot prove tab order, Escape handling, or focus restoration.\n\n### 3. Dialogs, Menus, and Other Overlays\n\n- Dialogs need an accessible name and a close action.\n- Opening an overlay should move focus into it, trap focus where appropriate,\n and restore focus to its trigger on close.\n- Menus, popovers, disclosures, and tabs must expose their expanded/selected\n state and remain usable without a pointer.\n- If the current MCP/browser tools cannot exercise the interaction, report it\n as a manual verification item instead of guessing.\n\n### 4. Forms and Errors\n\n- Inputs have labels, required state, helpers, and errors associated with the\n right control.\n- Invalid controls expose `aria-invalid` when applicable.\n- Error, loading, and success feedback is not conveyed only by color or a\n transient visual toast.\n- Submit controls do not become unexplained dead ends when disabled.\n\n### 5. Visual, Responsive, Media, and Motion\n\n- At each target width, text remains readable, controls remain reachable, and\n no content is clipped, overlapped, or dependent on hover alone.\n- Do not rely only on color, position, shape, or iconography to convey meaning.\n- Keep non-text contrast, text contrast, focus indicators, and small text as\n visual review items unless measured evidence is available.\n- Videos with meaningful speech need captions; non-essential motion should\n respect reduced-motion preferences. Do not autoplay sound.\n\n### 6. Dynamic Content and Data\n\n- Loading, empty, error, and success states have understandable visible text.\n- Important dynamic updates and validation feedback need an appropriate\n announcement strategy.\n- Check repeated resource-driven content for unique labels, headings, ids, and\n meaningful empty states.\n\n## Findings and Fixes\n\nClassify every item as one of:\n\n- **Confirmed:** directly shown by `audit`, project data, or a rendered\n screenshot.\n- **Likely:** a credible issue inferred from rendered evidence; explain what\n would confirm it.\n- **Manual verification required:** needs keyboard, screen-reader, contrast, or\n interaction testing that the available tools cannot prove.\n\nFor each item include: severity (`critical`, `high`, `medium`, or `low`), page\npath, affected element or instance id when known, evidence, short user impact,\nand the smallest supported fix. Fix critical and high items first. Do not add\nARIA attributes, alt text, labels, or live regions when their meaning cannot be\nknown from the project; ask the user or report the missing context.\n\nFinish with a concise summary of fixed findings, remaining findings, and manual\nverification items. Use screenshots as evidence of the rendered state, not as\nproof of accessibility compliance.\n',expressions:- '# Webstudio Expressions\n\nUse an expression only when a value must be computed at runtime from scoped\ndata. Use direct text and direct prop values for fixed content.\n\n## Source Format\n\nExpression-capable MCP fields receive JavaScript expression source as a JSON\nstring. Send one expression, without a `return` statement or surrounding\nfunction. For example:\n\n```json\n{ "binding": { "type": "expression", "value": "post.title ?? \\"Untitled\\"" } }\n```\n\nDo not send a fixed prop string as an expression. Use `update-props` with\n`type:"string"`. Page metadata and resource URLs accept plain fixed strings and\nnormalize them for storage. Expression-only resource headers, search parameters,\nand bodies accept `{ "type": "literal", "value": "fixed text" }` when the\nvalue is not dynamic.\n\n## Scope\n\n- Data variables are available on their scope instance and descendants.\n- An inner variable with the same name masks the outer variable.\n- A scoped resource result is a variable. Read its payload from its result\n wrapper, usually `resourceName.data`; APIs may nest the desired value deeper.\n- Collection creates internal `collectionItem` and `collectionItemKey`\n parameters. They are available only to that Collection\'s descendants.\n Preserve those generated parameters and do not reuse encoded parameter ids\n copied from another Collection.\n- Array Collection iteration exposes the current item. Object iteration exposes\n the current key and value.\n- The built-in `system` context is available only where supplied by the runtime.\n Its documented fields are `system.origin`, `system.pathname`, `system.params`,\n and `system.search`. There is no `system.path`.\n- Actions expose only their declared arguments, such as `event`, plus data that\n is in scope.\n\nRead `list-variables`, `list-resources`, `inspect-instance`, and existing\nbindings before writing an expression. Do not guess identifier names. Syntax is\nvalidated when a mutation is submitted, but an identifier that is unavailable\nat the final render scope may require preview verification to detect.\n\n## Supported Syntax\n\nExpressions support literals, arrays, objects, property and index access,\noptional chaining, unary and arithmetic operators, comparisons, logical\noperators, nullish coalescing, ternaries, and template literals.\n\nSupported string methods:\n\n{{allowedStringMethods}}\n\nSupported array methods:\n\n{{allowedArrayMethods}}\n\nOther values support `toString`. Arbitrary global functions and arbitrary\nmethod calls are not supported.\n\n## Unsupported Syntax\n\nDo not use statements, declarations, functions, arrow functions, classes,\n`new`, `this`, `await`, imports, tagged templates, sequence expressions,\nincrement/decrement, or destructuring assignment. Assignment is allowed only\ninside actions. Use an explicit assignment there rather than `++` or `--`.\n\n## Common Examples\n\n- Text: `post.title ?? "Untitled"`\n- Prop: `post.url`\n- Nested API array for Collection: `posts.data.items`\n- Resource URL: `"https://api.example.com/posts?tag=" + filters.tag`\n- Header: `"Bearer " + auth.token`\n- Search parameter: `String(filters.page ?? 1)` is not supported because global\n function calls are forbidden; use `(filters.page ?? 1).toString()` instead.\n- Resource body: `{ query: queryText, variables: { slug: system.params.slug } }`\n- Conditional: `featured ? "Featured" : "Standard"`\n- Safe nested access: `post.author?.name ?? "Unknown author"`\n\n## Collections\n\nWhenever an array or object should render repeated UI, insert `ws:collection`\nwith `insert-component` and bind its `data` prop to the complete iterable. Do\nnot bind the response wrapper or one indexed item. Collection renders its child\nstructure once per entry. Bind descendants with expressions such as\n`collectionItem.name`; for object iteration, `collectionItemKey` contains the\ncurrent key. See `components.get {"component":"ws:collection"}` for the\ncomplete workflow.\n\n## Verification\n\nAfter changing expressions, preview the affected page and verify representative\ndata, empty/null data, and Collection item counts. Use `audit` for relevant\nstructural findings, but do not treat a successful syntax parse as proof that\nruntime data has the expected shape.\n',+ '# Webstudio Expressions\n\nUse an expression only when a value must be computed at runtime from scoped\ndata. Use direct text and direct prop values for fixed content.\n\n## Source Format\n\nExpression-capable MCP fields receive JavaScript expression source as a JSON\nstring. Send one expression, without a `return` statement or surrounding\nfunction. For example:\n\n```json\n{ "binding": { "type": "expression", "value": "post.title ?? \\"Untitled\\"" } }\n```\n\nDo not send a fixed prop string as an expression. Use `update-props` with\n`type:"string"`. Page metadata and resource URLs accept plain fixed strings and\nnormalize them for storage. Expression-only resource headers, search parameters,\nand bodies accept `{ "type": "literal", "value": "fixed text" }` when the\nvalue is not dynamic.\n\n## Scope\n\n- Data variables are available on their scope instance and descendants.\n- An inner variable with the same name masks the outer variable.\n- A scoped resource result is a variable. Read its payload from its result\n wrapper, usually `resourceName.data`; APIs may nest the desired value deeper.\n- Collection creates internal `collectionItem` and `collectionItemKey`\n parameters. They are available only to that Collection\'s descendants.\n Preserve those generated parameters and do not reuse encoded parameter ids\n copied from another Collection.\n- Array Collection iteration exposes the current item. Object iteration exposes\n the current key and value.\n- The built-in `system` context is available only where supplied by the runtime.\n Its documented fields are `system.origin`, `system.pathname`, `system.params`,\n and `system.search`. There is no `system.path`.\n- Actions expose only their declared arguments, such as `event`, plus data that\n is in scope.\n\nRead `list-variables`, `list-resources`, `inspect-instance`, and existing\nbindings before writing an expression. Do not guess identifier names. Syntax is\nvalidated when a mutation is submitted, but an identifier that is unavailable\nat the final render scope may require preview verification to detect.\n\n## Supported Syntax\n\nExpressions support literals, arrays, objects, property and index access,\noptional chaining, unary and arithmetic operators, comparisons, logical\noperators, nullish coalescing, ternaries, and template literals.\n\nSupported string methods:\n\n{{allowedStringMethods}}\n\nSupported array methods:\n\n{{allowedArrayMethods}}\n\nOther values support `toString`. Arbitrary global functions and arbitrary\nmethod calls are not supported.\n\n## Unsupported Syntax\n\nDo not use statements, declarations, functions, arrow functions, classes,\n`new`, `this`, `await`, imports, tagged templates, sequence expressions,\nincrement/decrement, or destructuring assignment. Assignment is allowed only\ninside actions. Use an explicit assignment there rather than `++` or `--`.\n\n## Common Examples\n\n- Text: `post.title ?? "Untitled"`\n- Prop: `post.url`\n- Nested API array for Collection: `posts.data.items`\n- Resource URL: `"https://api.example.com/posts?tag=" + filters.tag`\n- Header: `"Bearer " + auth.token`\n- Search parameter: `String(filters.page ?? 1)` is not supported because global\n function calls are forbidden; use `(filters.page ?? 1).toString()` instead.\n- Resource body: `{ query: queryText, variables: { slug: system.params.slug } }`\n- Conditional: `featured ? "Featured" : "Standard"`\n- Safe nested access: `post.author?.name ?? "Unknown author"`\n\n## Collections\n\nWhenever an array or object should render repeated UI, call `insert-collection`\nwith the complete iterable and one repeated-item JSX root. Do not pass the\nresponse wrapper or one indexed item. The command creates the Collection and\nits private item parameters atomically, then renders the item root once per\nentry. Bind descendants with expressions such as `collectionItem.name`; for\nobject iteration, `collectionItemKey` contains the current key. Wrap multiple\nrepeated siblings in one `ws.element` root.\n\n## Verification\n\nAfter changing expressions, preview the affected page and verify representative\ndata, empty/null data, and Collection item counts. Use `audit` for relevant\nstructural findings, but do not treat a successful syntax parse as proof that\nruntime data has the expected shape.\n',"mcp-startup-guidance":'If you are inside the Webstudio monorepo, use the local CLI exactly as `node packages/cli/local.js ...` as your first command path. Do not use `packages/cli/bin.js` for local source-tree work; it is the packaged build entry and may use stale built output. Before editing a Webstudio project, do one small discovery step, then act. For delegated design-system or “use every component” tasks, the first MCP command is `workflow.next {"goal":"design-system-page"}`; report that returned checkpoint to the parent/user and stop until continued. For a simple authored/styled section, the intended path is literal: call `meta.index`, call `meta.get_more_tools` with `{"tools":["insert-fragment"]}`, read the target parent id with `list-pages`/`get-page-by-path`/`list-instances` only if needed, then call `insert-fragment`. Prefer `insert-fragment` for authored/styled sections; use `insert-component` only when inserting one automatic component template. Do not grep source files, dump full MCP resources, or write parser scripts before trying focused MCP calls. Good first calls are `meta.index` for orientation, `meta.guide` for a goal workflow, `workflow.next` for one bounded delegated phase, `meta.get_more_tools` for exact tool schemas, and `components.coverage-plan`, `components.coverage-insert-next`, `components.find`, or `components.get` for component work. Do not call every discovery tool up front. For delegated or non-streaming agents whose parent cannot see live stderr/stdout, treat each parent-visible checkpoint as the unit of work. If the parent asks for status within 30 seconds, run exactly one shortcut command such as `webstudio meta.index` or one explicit `webstudio mcp single-op-call` command, report its command/result, and wait for the parent before the next MCP command. Do not run long shell loops of shortcut or `webstudio mcp single-op-call` commands; they hide progress from the parent. Do not take a broad task such as creating a full design-system page as one execution unit. Instead call `workflow.next {"goal":"design-system-page"}`, report the returned phase/checkpoint to the parent, wait until the parent continues, call `checkpoint.ack {"reported":true,"continueAfterReport":true,"summary":"<what you reported>"}`, complete exactly that bounded phase, and return: discovery, page creation, one dry-run JSX section, one committed JSX section, one `components.coverage-insert-next` call, or one presentation pass. Phase commands do not include nextPhase in their own output. After the parent continues, acknowledge the previous checkpoint first, then call `workflow.next` with the next phase. For design-system or “use every component” tasks, start with `workflow.next`, acknowledge its checkpoint only after parent/user continuation, then run compact `components.coverage-plan`, checkpoint, create the page, checkpoint, then call `components.coverage-insert-next` once per coverage checkpoint, and finish with the `presentation-pass` workflow phase. Coverage 72/72 is necessary but not sufficient: the page must be organized into styled, real-world design-system examples instead of raw unstyled component dumps. Request component coverage details with `components.coverage-plan {"detail":"roots"}` or `components.coverage-plan {"detail":"parts"}` only when needed. `list-pages` does not accept `detail`; use `list-pages {}` or `get-page-by-path` for page lookup. Read overview resources such as `webstudio://project/guide`, `webstudio://project/tools-overview`, and `webstudio://project/components-overview` only when focused tools are insufficient. Do not dump or parse full resources such as `webstudio://project/tools` or `webstudio://project/components` unless the focused tools are insufficient. Run one-shot shortcut or explicit `webstudio mcp single-op-call` commands sequentially against the same linked `.webstudio` folder. For experiments, pass `--dry-run` to local-capable mutations. Copying a `.webstudio` folder is not an isolated project clone; `.webstudio/config.json` still points to the same remote project, so non-dry-run mutations can commit to that project. If a one-shot call returns checkpoint.required, the CLI persists `CHECKPOINT_REQUIRED` across later one-shot calls until you report the checkpoint, wait until continued, and call `checkpoint.ack {"reported":true,"continueAfterReport":true,"summary":"<what you reported>"}`. If you receive `PROJECT_SESSION_BUSY`, another CLI/MCP process is updating the local session; wait a moment and retry sequentially. Complete one bounded phase and return a checkpoint before continuing. Follow the guide: read ids and Builder breakpoints first, use focused component discovery for component ids, props, and content model composition, prefer semantic tools over `apply-patch`, use direct value tools for fixed text/props, use bindings only for dynamic expressions/resources/actions, page metadata and fixed resource URLs accept plain strings, put page/resource update fields under `values`, do not edit generated files for normal content/design changes, and use `preview.start` plus screenshot/vision for visual work.\n',} as const;diff --git a/packages/project-build/src/docs/expressions.md b/packages/project-build/src/docs/expressions.mdindex ac984a9d76..4f7f8ddc7c 100644--- a/packages/project-build/src/docs/expressions.md+++ b/packages/project-build/src/docs/expressions.md@@ -81,13 +81,13 @@ inside actions. Use an explicit assignment there rather than `++` or `--`.## Collections-Whenever an array or object should render repeated UI, insert `ws:collection`-with `insert-component` and bind its `data` prop to the complete iterable. Do-not bind the response wrapper or one indexed item. Collection renders its child-structure once per entry. Bind descendants with expressions such as-`collectionItem.name`; for object iteration, `collectionItemKey` contains the-current key. See `components.get {"component":"ws:collection"}` for the-complete workflow.+Whenever an array or object should render repeated UI, call `insert-collection`+with the complete iterable and one repeated-item JSX root. Do not pass the+response wrapper or one indexed item. The command creates the Collection and+its private item parameters atomically, then renders the item root once per+entry. Bind descendants with expressions such as `collectionItem.name`; for+object iteration, `collectionItemKey` contains the current key. Wrap multiple+repeated siblings in one `ws.element` root.## Verificationdiff --git a/packages/project-build/src/mcp.test.ts b/packages/project-build/src/mcp.test.tsindex c5d3b957ed..dc4b4f68af 100644--- a/packages/project-build/src/mcp.test.ts+++ b/packages/project-build/src/mcp.test.ts@@ -217,6 +217,16 @@ const publicMcpOperations: readonly PublicMcpOperation[] = [writeNamespaces: ["instances", "props", "styles"],invalidatesNamespaces: ["instances", "props", "styles"],}),+ publicOperation({+ command: "insert-collection",+ id: "instances.insertCollection",+ method: "mutation",+ permit: "build",+ description: "Insert a semantic Collection",+ readNamespaces: ["pages", "instances", "dataSources"],+ writeNamespaces: ["instances", "props", "dataSources"],+ invalidatesNamespaces: ["instances", "props", "dataSources"],+ }),publicOperation({command: "list-texts",id: "texts.list",@@ -1753,6 +1763,85 @@ describe("project session mcp adapter", () => {expect(call?.input).not.toHaveProperty("source");});+ test("converts semantic Collection item jsx before executing one atomic operation", async () => {+ const executeOperation = createExecuteOperation(async () =>+ createEnvelope({+ operationId: "instances.insertCollection",+ result: {+ rootInstanceIds: ["collection"],+ instanceIds: ["collection", "item"],+ collectionInstanceId: "collection",+ itemRootInstanceId: "item",+ itemParameterId: "item-parameter",+ itemKeyParameterId: "item-key-parameter",+ },+ })+ );+ const adapter = createProjectSessionMcpCore({+ operations: publicMcpOperations,+ createProjectSession: createSessionFactory(),+ executeOperation,+ });++ await adapter.callTool({+ name: "insert-collection",+ input: {+ parentInstanceId: "body",+ data: { type: "expression", value: "Posts.data.items" },+ itemFragment:+ '<ws.element ws:tag="article"><ws.element ws:tag="h2">{expression`collectionItem.title`}</ws.element></ws.element>',+ },+ });++ expect(vi.mocked(executeOperation).mock.calls[0]?.[0]).toEqual({+ command: "insert-collection",+ input: {+ parentInstanceId: "body",+ data: { type: "expression", value: "Posts.data.items" },+ itemFragment: expect.objectContaining({+ instances: expect.arrayContaining([+ expect.objectContaining({+ component: "ws:element",+ tag: "article",+ }),+ expect.objectContaining({ component: "ws:element", tag: "h2" }),+ ]),+ }),+ mode: undefined,+ insertIndex: undefined,+ },+ dryRun: false,+ });+ });++ test("rejects invalid semantic Collection data before execution", async () => {+ const executeOperation = createExecuteOperation();+ const adapter = createProjectSessionMcpCore({+ operations: publicMcpOperations,+ createProjectSession: createSessionFactory(),+ executeOperation,+ });++ await expect(+ adapter.callTool({+ name: "insert-collection",+ input: {+ parentInstanceId: "body",+ data: { type: "json", value: "not-an-array" },+ itemFragment: '<ws.element ws:tag="article" />',+ },+ })+ ).rejects.toMatchObject({+ issues: [+ expect.objectContaining({+ code: "invalid_union",+ path: ["data", "value"],+ }),+ ],+ });+ expect(executeOperation).not.toHaveBeenCalled();+ });+test("rejects structured fragment objects at the mcp boundary", async () => {const executeOperation = createExecuteOperation();const adapter = createProjectSessionMcpCore({@@ -3449,12 +3538,12 @@ describe("project session mcp adapter", () => {expect.objectContaining({workflow: expect.arrayContaining([expect.stringContaining("complete nested array/object"),- expect.stringContaining('Insert "ws:collection"'),- expect.stringContaining("current-item context"),+ expect.stringContaining("insert-collection"),+ expect.stringContaining("private parameters atomically"),expect.stringContaining("stable unique id or slug"),]),tools: expect.arrayContaining([- expect.objectContaining({ name: "components.get" }),+ expect.objectContaining({ name: "insert-collection" }),]),}));@@ -4177,9 +4266,9 @@ describe("project session mcp adapter", () => {component: "ws:collection",description: expect.stringContaining("array or object"),collectionUsage: expect.stringMatching(- /complete array or object.*renders its child structure once per entry/+ /insert-collection.*private item\/itemKey parameters.*atomically/),- usage: expect.stringContaining("internal item/itemKey parameter"),+ usage: expect.stringContaining("internal Collection parameter"),props: expect.objectContaining({data: expect.objectContaining({ type: "json", required: true }),item: expect.objectContaining({ type: "string" }),@@ -5415,6 +5504,43 @@ describe("project session mcp adapter", () => {expect(executeOperation).not.toHaveBeenCalled();});+ test.each([+ {+ command: "insert-fragment",+ input: {+ parentInstanceId: "body",+ fragment: '<ws.element ws:tag="div" />',+ },+ },+ {+ command: "insert-collection",+ input: {+ parentInstanceId: "body",+ data: { type: "json", value: [] },+ itemFragment: '<ws.element ws:tag="article" />',+ },+ },+ ])(+ "does not dispatch the $command adapter when the operation is unavailable",+ async ({ command, input }) => {+ const createProjectSession = createSessionFactory();+ const executeOperation = createExecuteOperation();+ const adapter = createProjectSessionMcpCore({+ operations: publicMcpOperations.filter(+ (operation) => operation.command !== command+ ),+ createProjectSession,+ executeOperation,+ });++ await expect(adapter.callTool({ name: command, input })).rejects.toThrow(+ `Unknown MCP tool "${command}".`+ );+ expect(createProjectSession).not.toHaveBeenCalled();+ expect(executeOperation).not.toHaveBeenCalled();+ }+ );+test("reads MCP resources from the long-lived project session", async () => {const session = createSession({initialize: vi.fn(async () =>diff --git a/packages/project-build/src/mcp.ts b/packages/project-build/src/mcp.tsindex 6468d72847..d83d607f66 100644--- a/packages/project-build/src/mcp.ts+++ b/packages/project-build/src/mcp.ts@@ -58,6 +58,8 @@ import {getTemplateRequiredStructure,parseComponentEdge,} from "./runtime/components";+import { getInputSchemaMetadata } from "./contracts/input-schema";+import { insertCollectionInput } from "./runtime/collection";import {isComponentAvailableForDocumentType,isComponentHiddenFromCatalog,@@ -485,6 +487,19 @@ const insertFragmentMcpInputSchema = {required: ["parentInstanceId", "fragment"],} as const satisfies ProjectSessionMcpInputSchema;+const insertCollectionMcpInput = insertCollectionInput+ .omit({ itemFragment: true })+ .extend({+ itemFragment: z+ .string()+ .describe(+ `${webstudioJsxFragmentInputDescription} Pass exactly one root instance. Expressions may reference collectionItem and collectionItemKey, for example {expression\`collectionItem.name\`}.`+ ),+ })+ .describe(+ "Create a Collection, bind its complete iterable, and insert one repeated-item Webstudio JSX fragment atomically. Internal item parameters are generated automatically."+ );+const componentInputSchema = {...emptyInputSchema,properties: {@@ -560,6 +575,35 @@ const getOperationInputSchema = (};};+const insertCollectionMcpInputSchema = getOperationInputSchema({+ inputSchema: getInputSchemaMetadata(insertCollectionMcpInput).inputJsonSchema,+});++const mcpOperationOverrides = new Map<+ string,+ {+ description: string;+ inputSchema: ProjectSessionMcpInputSchema;+ }+>([+ [+ "insert-fragment",+ {+ description:+ "Insert an authored/styled Webstudio fragment with components, text, props, tokens, and styles. Pass fragment as a Webstudio JSX string.",+ inputSchema: insertFragmentMcpInputSchema,+ },+ ],+ [+ "insert-collection",+ {+ description:+ "Create a Collection from array/object data and one repeated-item Webstudio JSX fragment. Internal item parameters and bindings are created atomically.",+ inputSchema: insertCollectionMcpInputSchema,+ },+ ],+]);+const acceptsJsonType = (schema: InputJsonSchema | undefined,type: "object" | "array"@@ -1279,6 +1323,23 @@ export const mcpArgumentExamples: Record<string, readonly unknown[]> = {component: "@webstudio-is/sdk-components-react-radix:Switch",},],+ "insert-collection": [+ {+ parentInstanceId: "parent-id",+ data: { type: "expression", value: "Posts.data.items" },+ itemFragment:+ '<ws.element ws:tag="article"><ws.element ws:tag="h2">{expression`collectionItem.title ?? "Untitled"`}</ws.element></ws.element>',+ },+ {+ parentInstanceId: "parent-id",+ data: {+ type: "json",+ value: [{ name: "Starter" }, { name: "Pro" }],+ },+ itemFragment:+ '<ws.element ws:tag="div">{expression`collectionItem.name`}</ws.element>',+ },+ ],"insert-fragment": [{parentInstanceId: "parent-id",@@ -2239,21 +2300,18 @@ export const listProjectSessionMcpTools = (.filter((operation) => hiddenMcpOperationCommands.has(operation.command) === false)- .map((operation) =>- createProjectSessionMcpTool({+ .map((operation) => {+ const override = mcpOperationOverrides.get(operation.command);+ return createProjectSessionMcpTool({name: operation.command,- description:- operation.command === "insert-fragment"- ? "Insert an authored/styled Webstudio fragment with components, text, props, tokens, and styles. Pass fragment as a Webstudio JSX string."- : operation.description,+ description: override?.description ?? operation.description,inputSchema:- operation.command === "insert-fragment"- ? insertFragmentMcpInputSchema- : getMcpOperationInputSchema(operation, {- includeRenderedAudit:- options.includeScreenshot === true &&- options.includePreview === true,- }),+ override?.inputSchema ??+ getMcpOperationInputSchema(operation, {+ includeRenderedAudit:+ options.includeScreenshot === true &&+ options.includePreview === true,+ }),...(operation.outputSchema === undefined? {}: { outputSchema: getMcpOutputSchema(operation.outputSchema) }),@@ -2270,8 +2328,8 @@ export const listProjectSessionMcpTools = (invalidatesNamespaces: operation.invalidatesNamespaces,retryOnConflict: operation.retryOnConflict,},- })- ),+ });+ }),...sessionTools.map((tool) => ({...tool,mcpExamples: getMcpExamples(tool.name),@@ -2656,6 +2714,25 @@ const getInsertFragmentInput = async (input: unknown) => {};};+const getInsertCollectionInput = async (input: unknown) => {+ const { itemFragment, ...parsedInput } =+ insertCollectionMcpInput.parse(input);+ return {+ ...parsedInput,+ itemFragment: await parseWebstudioJsxFragment(itemFragment),+ };+};++const normalizeMcpOperationInput = async (name: string, input: unknown) => {+ if (name === "insert-fragment") {+ return await getInsertFragmentInput(input);+ }+ if (name === "insert-collection") {+ return await getInsertCollectionInput(input);+ }+ return input;+};+const coveragePlanDetailValues = ["summary", "roots", "parts", "full"] as const;type CoveragePlanDetail = (typeof coveragePlanDetailValues)[number];const coveragePlanDocumentTypes = ["html", "xml", "text"] as const;@@ -3229,7 +3306,7 @@ const getAnimationComponentGuidance = (component: string) =>animationComponentGuidanceByComponent.get(component);const collectionComponentUsage =- 'Use Collection whenever an array or object from a resource or data variable should render a repeated list, grid, set of cards, table rows, options, tabs, or similar UI. Insert "ws:collection" with insert-component so Webstudio creates and preserves its internal item and itemKey parameters. Bind the Collection data prop to the complete array or object, not the resource response wrapper and not one indexed item; external resource arrays are often nested under the scoped resource result\'s data field or deeper. Collection renders its child structure once per entry. Array iteration exposes the current item as `collectionItem`; object iteration exposes the current value as `collectionItem` and key as `collectionItemKey`. Bind descendant content and props with expressions such as `collectionItem.name`; do not reuse encoded parameter ids from another Collection. Wrap multiple repeated sibling instances in one Element. For repeated Radix items, bind a stable unique id or slug to each required value prop. Do not create, replace, or delete the internal item/itemKey parameter records directly.';+ "Use Collection whenever an array or object from a resource or data variable should render a repeated list, grid, set of cards, table rows, options, tabs, or similar UI. Prefer insert-collection: pass the complete array/object plus one repeated-item JSX root, and it creates the Collection, private item/itemKey parameters, iterable binding, and item bindings atomically. External resource arrays are often nested below the scoped result's data field. Array iteration exposes `collectionItem`; object iteration also exposes `collectionItemKey`. Use expressions such as expression`collectionItem.name` in item JSX. Wrap multiple repeated siblings in one Element. For repeated Radix items, bind a stable unique id or slug to required value props. Do not create, replace, or delete internal Collection parameter records directly.";const getComponentCatalog = () => ({source: "@webstudio-is/sdk-components-registry/metas",@@ -4226,9 +4303,9 @@ const getMetaGuide = ("components.get","list-variables","list-resources",- "insert-component",+ "insert-collection","inspect-instance",- "bind-props",+ "audit",],tools)@@ -4267,10 +4344,9 @@ const getMetaGuide = (: []),...(isCollectionGoal? [- 'Call components.get with {"component":"ws:collection"} and use its Collection-specific guidance.',"Find the array or object to repeat. For a scoped resource result, select the complete nested array/object, commonly below the result's data field; do not bind the response wrapper or one indexed item.",- 'Insert "ws:collection" with insert-component so its internal item and itemKey parameters are created. Do not create or replace those parameter records manually.',- "Bind the Collection data prop to the complete iterable. Put the repeated UI under Collection and bind descendant text/props to the generated current-item context; wrap multiple sibling instances in one Element.",+ "Call insert-collection once with the complete iterable and one repeated-item JSX root. Use expression`collectionItem.name` and expression`collectionItemKey` inside the item fragment; the operation creates and binds private parameters atomically.",+ "Wrap multiple repeated sibling instances in one ws.element. Do not create, replace, or delete Collection parameter records manually.","Verify that every array/object entry renders once. For repeated Radix items, bind a stable unique id or slug to required value props.",]: []),@@ -5427,18 +5503,11 @@ export const createProjectSessionMcpCore = <Command extends string = string>({if (name === "preview.stop" && stopPreview !== undefined) {return toMetaResult(await stopPreview());}- if (name === "insert-fragment") {- const envelope = await executeOperation({- command: name as Command,- input: await getInsertFragmentInput(input),- dryRun,- });- return toCallResult(envelope);- }const operation = operationByCommand.get(name as Command);if (operation === undefined) {throw new Error(`Unknown MCP tool "${name}".`);}+ const normalizedInput = await normalizeMcpOperationInput(name, input);const isAuditInput = name === "audit" && isRecord(input);if (isAuditInput &&@@ -5539,7 +5608,7 @@ export const createProjectSessionMcpCore = <Command extends string = string>({key !== "routeExamples"))- : input+ : normalizedInput);const envelope = await executeOperation({command: name as Command,diff --git a/packages/project-build/src/project-session.test.ts b/packages/project-build/src/project-session.test.tsindex 103e28aca4..ed766aefe7 100644--- a/packages/project-build/src/project-session.test.ts+++ b/packages/project-build/src/project-session.test.ts@@ -22,6 +22,9 @@ import { createBuilderStateFromSnapshot } from "./state/adapters";import { createBuilderStateFreshness } from "./state/freshness";import { applyBuilderPatchTransactions } from "./state/patch";import { build } from "./state/fixtures.test-utils";+import { parseWebstudioJsxFragment } from "./runtime/jsx";+import { executeBuilderRuntimeOperation } from "./runtime/registry";+import type { BuilderRuntimeMutation } from "./runtime/mutation";const compatibilityVersion = "test-session";const compatibility: ProjectSessionCompatibility = {@@ -499,6 +502,83 @@ describe("project session", () => {expect(storage.saved).toHaveLength(0);});+ test("plans and commits one semantic Collection transaction that survives refresh", async () => {+ let remote = createSnapshot();+ const storage = createStorage(createPersistedSnapshot());+ const transport = createTransport(remote);+ transport.fetchNamespaces = async (input) => {+ transport.loadedNamespaces.push([...input.namespaces]);+ return remote;+ };+ let serverGeneratedId = 0;+ transport.executeServerOperation = async <Result>(input: {+ operationId: string;+ input: unknown;+ }) => {+ transport.serverOperations.push(input);+ const mutation =+ await executeBuilderRuntimeOperation<BuilderRuntimeMutation>({+ id: input.operationId,+ state: remote.state,+ input: input.input,+ context: {+ projectVersion: remote.version,+ createId: () => `server-generated-id-${serverGeneratedId++}`,+ },+ });+ const transaction: BuilderPatchTransaction = {+ id: `server-transaction-${serverGeneratedId++}`,+ payload: mutation.payload,+ };+ remote = {+ ...remote,+ version: remote.version + 1,+ state: applyBuilderPatchTransactions(remote.state, [transaction]).state,+ };+ return mutation.result as Result;+ };+ const session = createSession({ storage, transport });+ const input = {+ parentInstanceId: "instance-root",+ data: {+ type: "json" as const,+ value: [{ title: "First" }, { title: "Second" }],+ },+ itemFragment: await parseWebstudioJsxFragment(+ '<ws.element ws:tag="article">{expression`collectionItem.title`}</ws.element>'+ ),+ };++ await session.initialize();+ const planned = await session.mutate("instances.insertCollection", input, {+ dryRun: true,+ });+ expect(planned.diagnostics).toEqual([+ expect.objectContaining({ code: "DRY_RUN" }),+ ]);+ expect(planned.source).toBe("dry-run");+ expect(planned.state.committed).toBe(false);+ expect(+ planned.transaction?.payload.map((change) => change.namespace)+ ).toEqual(expect.arrayContaining(["instances", "props", "dataSources"]));+ expect(transport.commits).toHaveLength(0);++ const committed = await session.mutate("instances.insertCollection", input);+ expect(committed.state.committed).toBe(true);+ expect(transport.serverOperations).toHaveLength(1);+ const result = committed.result as { collectionInstanceId: string };+ expect(+ remote.state.instances?.get(result.collectionInstanceId)+ ).toMatchObject({+ component: "ws:collection",+ });++ await session.refresh(["instances", "props", "dataSources"]);+ expect(+ storage.saved.at(-1)?.state.instances?.get(result.collectionInstanceId)+ ).toMatchObject({ component: "ws:collection" });+ });+test("commits remotely before applying mutation locally", async () => {const storage = createStorage(createPersistedSnapshot());const transport = createTransport();diff --git a/packages/project-build/src/runtime/collection.ts b/packages/project-build/src/runtime/collection.tsnew file mode 100644index 0000000000..fd47a9b367--- /dev/null+++ b/packages/project-build/src/runtime/collection.ts@@ -0,0 +1,268 @@+import {+ collectionComponent,+ webstudioFragment,+ type DataSource,+ type Instance,+ type Prop,+ type WebstudioData,+ type WebstudioFragment,+} from "@webstudio-is/sdk";+import { z } from "zod";+import { componentInsertResult } from "./component-insert-contract";+import type { ComponentTemplateRegistry } from "./component-template";+import { bindExpressionToInstanceScope } from "./data";+import { throwBuilderRuntimeError } from "./errors";+import { insertIndexInput, instanceInsertModeInput } from "./instances";++const collectionDataInput = z.discriminatedUnion("type", [+ z.object({+ type: z.literal("json"),+ value: z.union([z.array(z.unknown()), z.record(z.string(), z.unknown())]),+ }),+ z.object({+ type: z.literal("expression"),+ value: z+ .string()+ .min(1)+ .describe(+ 'Expression resolving to the complete array or object, for example "Posts.data.items".'+ ),+ }),+]);++export const insertCollectionInput = z.object({+ parentInstanceId: z.string(),+ data: collectionDataInput.describe(+ "Complete iterable for the Collection. Do not pass one indexed item."+ ),+ itemFragment: webstudioFragment.describe(+ "One structured repeated-item fragment. Descendant expressions may reference collectionItem and collectionItemKey."+ ),+ mode: instanceInsertModeInput.optional(),+ insertIndex: insertIndexInput.optional(),+});++export const insertCollectionResult = componentInsertResult.extend({+ collectionInstanceId: z.string(),+ itemRootInstanceId: z.string(),+ itemParameterId: z.string(),+ itemKeyParameterId: z.string(),+});++export type InsertCollectionResult = z.infer<typeof insertCollectionResult>;++const assertNoIdCollision = (+ label: string,+ generatedRecords: ReadonlyArray<{ id: string }>,+ itemRecords: ReadonlyArray<{ id: string }>+) => {+ const generatedIds = new Set(generatedRecords.map((record) => record.id));+ const collision = itemRecords.find((record) => generatedIds.has(record.id));+ if (collision !== undefined) {+ return throwBuilderRuntimeError(+ "CONFLICT",+ `Collection item fragment ${label} id "${collision.id}" conflicts with the generated Collection template.`+ );+ }+};++const getItemRootInstanceId = (fragment: WebstudioFragment) => {+ const root = fragment.children[0];+ if (+ fragment.children.length !== 1 ||+ root?.type !== "id" ||+ fragment.instances.some((instance) => instance.id === root.value) === false+ ) {+ return throwBuilderRuntimeError(+ "BAD_REQUEST",+ "Collection itemFragment must contain exactly one root instance. Wrap repeated sibling elements in one ws:element or component."+ );+ }+ const instances = new Map(+ fragment.instances.map((instance) => [instance.id, instance])+ );+ if (instances.size !== fragment.instances.length) {+ return throwBuilderRuntimeError(+ "BAD_REQUEST",+ "Collection itemFragment instance ids must be unique."+ );+ }+ const reachableIds = new Set<string>();+ const visitingIds = new Set<string>();+ const visit = (instanceId: string) => {+ if (visitingIds.has(instanceId)) {+ return throwBuilderRuntimeError(+ "BAD_REQUEST",+ "Collection itemFragment instance tree must not contain a cycle."+ );+ }+ if (reachableIds.has(instanceId)) {+ return;+ }+ const instance = instances.get(instanceId);+ if (instance === undefined) {+ return throwBuilderRuntimeError(+ "BAD_REQUEST",+ `Collection itemFragment references missing instance "${instanceId}".`+ );+ }+ visitingIds.add(instanceId);+ for (const child of instance.children) {+ if (child.type === "id") {+ visit(child.value);+ }+ }+ visitingIds.delete(instanceId);+ reachableIds.add(instanceId);+ };+ visit(root.value);+ if (reachableIds.size !== instances.size) {+ return throwBuilderRuntimeError(+ "BAD_REQUEST",+ "Collection itemFragment must not contain instances disconnected from its root."+ );+ }+ return root.value;+};++const getCollectionParameter = ({+ name,+ collectionInstance,+ collectionProps,+ dataSources,+}: {+ name: "item" | "itemKey";+ collectionInstance: Instance;+ collectionProps: Prop[];+ dataSources: DataSource[];+}) => {+ const prop = collectionProps.find(+ (candidate): candidate is Extract<Prop, { type: "parameter" }> =>+ candidate.name === name && candidate.type === "parameter"+ );+ const dataSource = dataSources.find(+ (candidate): candidate is Extract<DataSource, { type: "parameter" }> =>+ candidate.id === prop?.value &&+ candidate.type === "parameter" &&+ candidate.scopeInstanceId === collectionInstance.id+ );+ if (prop === undefined || dataSource === undefined) {+ return throwBuilderRuntimeError(+ "BAD_REQUEST",+ `Collection component template is missing its ${name} parameter.`+ );+ }+ return { prop, dataSource };+};++export const createCollectionFragment = ({+ state,+ input,+ templates,+}: {+ state: Pick<WebstudioData, "instances" | "dataSources">;+ input: z.infer<typeof insertCollectionInput>;+ templates: ComponentTemplateRegistry;+}) => {+ const itemRootInstanceId = getItemRootInstanceId(input.itemFragment);+ for (const dataSource of input.itemFragment.dataSources) {+ if (+ dataSource.name === "collectionItem" ||+ dataSource.name === "collectionItemKey"+ ) {+ return throwBuilderRuntimeError(+ "BAD_REQUEST",+ `Collection itemFragment cannot declare reserved data source "${dataSource.name}".`+ );+ }+ }++ const template = structuredClone(+ templates.get(collectionComponent)?.template+ );+ const collectionChild = template?.children[0];+ if (template === undefined || collectionChild?.type !== "id") {+ return throwBuilderRuntimeError(+ "BAD_REQUEST",+ "Collection component template is unavailable."+ );+ }+ const collectionInstance = template.instances.find(+ (instance) => instance.id === collectionChild.value+ );+ if (collectionInstance === undefined) {+ return throwBuilderRuntimeError(+ "BAD_REQUEST",+ "Collection component template root is unavailable."+ );+ }+ const collectionProps = template.props.filter(+ (prop) => prop.instanceId === collectionInstance.id+ );+ const item = getCollectionParameter({+ name: "item",+ collectionInstance,+ collectionProps,+ dataSources: template.dataSources,+ });+ const itemKey = getCollectionParameter({+ name: "itemKey",+ collectionInstance,+ collectionProps,+ dataSources: template.dataSources,+ });+ const dataProp = collectionProps.find((prop) => prop.name === "data");+ if (dataProp === undefined) {+ return throwBuilderRuntimeError(+ "BAD_REQUEST",+ "Collection component template is missing its data prop."+ );+ }+ const nextDataProp: Prop =+ input.data.type === "json"+ ? { ...dataProp, type: "json", value: input.data.value }+ : {+ ...dataProp,+ type: "expression",+ value: bindExpressionToInstanceScope({+ expression: input.data.value,+ instanceId: input.parentInstanceId,+ instances: state.instances,+ dataSources: state.dataSources,+ }),+ };+ const parameterDataSources = [item.dataSource, itemKey.dataSource];+ assertNoIdCollision(+ "instance",+ [collectionInstance],+ input.itemFragment.instances+ );+ assertNoIdCollision("prop", collectionProps, input.itemFragment.props);+ assertNoIdCollision(+ "data source",+ parameterDataSources,+ input.itemFragment.dataSources+ );++ return {+ fragment: {+ ...input.itemFragment,+ children: [{ type: "id", value: collectionInstance.id }],+ instances: [+ { ...collectionInstance, children: input.itemFragment.children },+ ...input.itemFragment.instances,+ ],+ props: [+ ...collectionProps.filter((prop) => prop.id !== dataProp.id),+ nextDataProp,+ ...input.itemFragment.props,+ ],+ dataSources: [...parameterDataSources, ...input.itemFragment.dataSources],+ } satisfies WebstudioFragment,+ collectionInstanceId: collectionInstance.id,+ itemRootInstanceId,+ itemParameterId: item.prop.value,+ itemKeyParameterId: itemKey.prop.value,+ parameterDataSources,+ };+};diff --git a/packages/project-build/src/runtime/component-insert-contract.ts b/packages/project-build/src/runtime/component-insert-contract.tsnew file mode 100644index 0000000000..c84e8e3772--- /dev/null+++ b/packages/project-build/src/runtime/component-insert-contract.ts@@ -0,0 +1,11 @@+import { z } from "zod";++export const componentInsertResult = z.object({+ instanceIds: z.array(z.string()),+ rootInstanceIds: z.array(z.string()),+ removedInstanceIds: z.array(z.string()),+ parentInstanceId: z.string(),+ didMergeBreakpointsDueToLimit: z.literal(true).optional(),+});++export type ComponentInsertResult = z.infer<typeof componentInsertResult>;diff --git a/packages/project-build/src/runtime/components.test.ts b/packages/project-build/src/runtime/components.test.tsindex 997552820f..13717bc5ac 100644--- a/packages/project-build/src/runtime/components.test.ts+++ b/packages/project-build/src/runtime/components.test.ts@@ -8,11 +8,14 @@ import {type Page,type PageTemplate,type Pages,+ type Prop,+ type StyleDecl,type WsComponentMeta,type WebstudioData,} from "@webstudio-is/sdk";import { componentMetas } from "@webstudio-is/sdk-components-registry/metas";import {+ insertCollection,insertComponent,insertComponentInput,insertFragment,@@ -220,6 +223,306 @@ test("keeps Collection item expressions linked to each inserted parameter", () =}});+test("inserts a semantic Collection with literal data and bound item expressions", async () => {+ const parent = createParent();+ const mutation = insertCollection(+ createState(parent),+ {+ parentInstanceId: parent.id,+ data: {+ type: "json",+ value: [{ name: "Starter" }, { name: "Pro" }],+ },+ itemFragment: await parseWebstudioJsxFragment(+ '<ws.element ws:tag="article" ws:style={css`display: grid;`}><ws.element ws:tag="h2">{expression`collectionItem.name`}</ws.element></ws.element>'+ ),+ },+ { createId: createIdFactory() }+ );+ const instances = getAddedValues<Instance>(mutation, "instances");+ const props = getAddedValues<Prop>(mutation, "props");+ const styles = getAddedValues<StyleDecl>(mutation, "styles");++ expect(mutation.result).toMatchObject({+ parentInstanceId: parent.id,+ collectionInstanceId: expect.any(String),+ itemRootInstanceId: expect.any(String),+ itemParameterId: expect.any(String),+ itemKeyParameterId: expect.any(String),+ });+ expect(instances).toContainEqual(+ expect.objectContaining({+ id: mutation.result.collectionInstanceId,+ component: collectionComponent,+ children: [{ type: "id", value: mutation.result.itemRootInstanceId }],+ })+ );+ expect(+ instances.find(+ (instance) => instance.id === mutation.result.collectionInstanceId+ )+ ).not.toHaveProperty("tag");+ expect(props).toContainEqual(+ expect.objectContaining({+ instanceId: mutation.result.collectionInstanceId,+ name: "data",+ type: "json",+ value: [{ name: "Starter" }, { name: "Pro" }],+ })+ );+ expect(styles).toContainEqual(+ expect.objectContaining({+ property: "display",+ value: { type: "keyword", value: "grid" },+ })+ );+ expect(props).toContainEqual(+ expect.objectContaining({+ instanceId: mutation.result.collectionInstanceId,+ name: "item",+ type: "parameter",+ value: mutation.result.itemParameterId,+ })+ );+ expect(+ instances.flatMap((instance) =>+ instance.children.flatMap((child) =>+ child.type === "expression" ? [child.value] : []+ )+ )+ ).toContain(`${encodeDataVariableId(mutation.result.itemParameterId)}?.name`);+});++test("binds semantic Collection data to outer scope and item props to its parameter", async () => {+ const parent = createParent();+ const state = createState(parent);+ state.dataSources.set("posts", {+ id: "posts",+ type: "variable",+ name: "Posts",+ scopeInstanceId: parent.id,+ value: { type: "json", value: { data: { items: [] } } },+ });+ const mutation = insertCollection(+ state,+ {+ parentInstanceId: parent.id,+ data: { type: "expression", value: "Posts.data.items" },+ itemFragment: await parseWebstudioJsxFragment(+ '<ws.element ws:tag="article" title={expression`collectionItem.title`}>Item</ws.element>'+ ),+ },+ { createId: createIdFactory() }+ );+ const props = getAddedValues<Prop>(mutation, "props");++ expect(props).toContainEqual(+ expect.objectContaining({+ instanceId: mutation.result.collectionInstanceId,+ name: "data",+ type: "expression",+ value: `${encodeDataVariableId("posts")}?.data?.items`,+ })+ );+ expect(props).toContainEqual(+ expect.objectContaining({+ instanceId: mutation.result.itemRootInstanceId,+ name: "title",+ type: "expression",+ value: `${encodeDataVariableId(mutation.result.itemParameterId)}?.title`,+ })+ );+});++test("binds semantic Collection data to an HTTP resource result", async () => {+ const parent = createParent();+ const state = createState(parent);+ state.dataSources.set("posts", {+ id: "posts",+ type: "resource",+ name: "Posts",+ scopeInstanceId: parent.id,+ resourceId: "posts-resource",+ });+ const mutation = insertCollection(+ state,+ {+ parentInstanceId: parent.id,+ data: { type: "expression", value: "Posts.data.items" },+ itemFragment: await parseWebstudioJsxFragment(+ '<ws.element ws:tag="article">{expression`collectionItem.title`}</ws.element>'+ ),+ },+ { createId: createIdFactory() }+ );+ const dataProp = getAddedValues<Prop>(mutation, "props").find(+ (prop) =>+ prop.instanceId === mutation.result.collectionInstanceId &&+ prop.name === "data"+ );++ expect(dataProp).toMatchObject({+ type: "expression",+ value: `${encodeDataVariableId("posts")}?.data?.items`,+ });+});++test("binds object Collection keys to the generated itemKey parameter", async () => {+ const parent = createParent();+ const mutation = insertCollection(+ createState(parent),+ {+ parentInstanceId: parent.id,+ data: {+ type: "json",+ value: { starter: { name: "Starter" }, pro: { name: "Pro" } },+ },+ itemFragment: await parseWebstudioJsxFragment(+ '<ws.element ws:tag="article">{expression`collectionItemKey`}</ws.element>'+ ),+ },+ { createId: createIdFactory() }+ );+ const itemRoot = getAddedValues<Instance>(mutation, "instances").find(+ (instance) => instance.id === mutation.result.itemRootInstanceId+ );++ expect(itemRoot?.children).toContainEqual({+ type: "expression",+ value: encodeDataVariableId(mutation.result.itemKeyParameterId),+ });+});++test("requires one semantic Collection item root", async () => {+ const parent = createParent();+ const itemFragment = await parseWebstudioJsxFragment(+ '<ws.element ws:tag="div" /><ws.element ws:tag="div" />'+ );+ expect(() =>+ insertCollection(+ createState(parent),+ {+ parentInstanceId: parent.id,+ data: { type: "json", value: [] },+ itemFragment,+ },+ { createId: createIdFactory() }+ )+ ).toThrow("exactly one root instance");+});++test.each([+ {+ name: "duplicate ids",+ createExtra: (root: Instance) => ({ ...root }),+ message: "instance ids must be unique",+ },+ {+ name: "a disconnected instance",+ createExtra: (root: Instance) => ({ ...root, id: "disconnected" }),+ message: "must not contain instances disconnected from its root",+ },+])(+ "rejects Collection item fragments with $name",+ ({ createExtra, message }) => {+ const parent = createParent();+ const root: Instance = {+ type: "instance",+ id: "item-root",+ component: elementComponent,+ tag: "article",+ children: [],+ };+ expect(() =>+ insertCollection(+ createState(parent),+ {+ parentInstanceId: parent.id,+ data: { type: "json", value: [] },+ itemFragment: {+ ...createEmptyWebstudioFragment(),+ children: [{ type: "id", value: root.id }],+ instances: [root, createExtra(root)],+ },+ },+ { createId: createIdFactory() }+ )+ ).toThrow(message);+ }+);++test.each([+ {+ name: "a missing child",+ childId: "missing",+ message: 'references missing instance "missing"',+ },+ {+ name: "a cycle",+ childId: "item-root",+ message: "instance tree must not contain a cycle",+ },+])("rejects Collection item fragments with $name", ({ childId, message }) => {+ const parent = createParent();+ expect(() =>+ insertCollection(+ createState(parent),+ {+ parentInstanceId: parent.id,+ data: { type: "json", value: [] },+ itemFragment: {+ ...createEmptyWebstudioFragment(),+ children: [{ type: "id", value: "item-root" }],+ instances: [+ {+ type: "instance",+ id: "item-root",+ component: elementComponent,+ tag: "article",+ children: [{ type: "id", value: childId }],+ },+ ],+ },+ },+ { createId: createIdFactory() }+ )+ ).toThrow(message);+});++test("rejects Collection item ids that collide with its canonical template", () => {+ const parent = createParent();+ const template = getComponentTemplates().get(collectionComponent)?.template;+ const collectionRoot = template?.children[0];+ expect(collectionRoot?.type).toBe("id");+ if (collectionRoot?.type !== "id") {+ throw new Error("Collection template root is unavailable");+ }++ expect(() =>+ insertCollection(+ createState(parent),+ {+ parentInstanceId: parent.id,+ data: { type: "json", value: [] },+ itemFragment: {+ ...createEmptyWebstudioFragment(),+ children: [{ type: "id", value: collectionRoot.value }],+ instances: [+ {+ type: "instance",+ id: collectionRoot.value,+ component: elementComponent,+ tag: "article",+ children: [],+ },+ ],+ },+ },+ { createId: createIdFactory() }+ )+ ).toThrow("conflicts with the generated Collection template");+});+test("inserts fragment into page template", async () => {const parent = createParent();const root: Instance = {diff --git a/packages/project-build/src/runtime/components.ts b/packages/project-build/src/runtime/components.tsindex 1a0fe9ce94..0ebcfd2186 100644--- a/packages/project-build/src/runtime/components.ts+++ b/packages/project-build/src/runtime/components.ts@@ -5,6 +5,7 @@ import {ROOT_INSTANCE_ID,webstudioFragment,type Breakpoints,+ type DataSource,type DataSources,type Instance,type Instances,@@ -32,6 +33,12 @@ import {type ComponentTemplateRegistry,} from "./component-template";import { isComponentAvailableForDocumentType } from "./component-catalog";+import type { ComponentInsertResult } from "./component-insert-contract";+import {+ createCollectionFragment,+ insertCollectionInput,+ type InsertCollectionResult,+} from "./collection";import type { BuilderRuntimeContext } from "./context";import { isFragmentContentModeCopyableProp } from "./content-mode-copy-policy";import { findAvailableVariables } from "./data";@@ -624,7 +631,9 @@ export const getTemplateRequiredStructure = (};};-const createInsertFragmentMutation = ({+const createInsertFragmentMutation = <+ Details extends Record<string, unknown> = Record<string, never>,+>({state,parentInstanceId,fragment,@@ -633,6 +642,8 @@ const createInsertFragmentMutation = ({insertIndex: explicitInsertIndex,conflictResolution,contentMode = false,+ additionalAvailableVariables = [],+ getResultDetails,context,}: {state: ComponentInsertState;@@ -643,6 +654,11 @@ const createInsertFragmentMutation = ({insertIndex?: z.infer<typeof insertIndexInput>;conflictResolution?: ConflictResolution;contentMode?: boolean;+ additionalAvailableVariables?: DataSource[];+ getResultDetails?: (ids: {+ newInstanceIds: Map<string, string>;+ newDataSourceIds: Map<string, string>;+ }) => Details;context: BuilderRuntimeContext;}) => {const mutationState = getRequiredComponentInsertState(state);@@ -687,15 +703,18 @@ const createInsertFragmentMutation = ({);}- const { newInstanceIds, didMergeBreakpointsDueToLimit } =+ const { newInstanceIds, newDataSourceIds, didMergeBreakpointsDueToLimit } =insertWebstudioFragmentCopy({data: nextData,fragment,- availableVariables: findAvailableVariables({- startingInstanceId: originalParent.id,- instances: mutationState.instances,- dataSources: mutationState.dataSources,- }),+ availableVariables: [+ ...findAvailableVariables({+ startingInstanceId: originalParent.id,+ instances: mutationState.instances,+ dataSources: mutationState.dataSources,+ }),+ ...additionalAvailableVariables,+ ],projectId: context.projectId ?? "",conflictResolution,createId: context.createId,@@ -724,6 +743,27 @@ const createInsertFragmentMutation = ({return child;});+ const createResult = (+ parentInstanceId: string,+ removedInstanceIds: string[]+ ): ComponentInsertResult & Details =>+ ({+ instanceIds: Array.from(newInstanceIds.values()).filter(+ (instanceId) =>+ instanceId !== ROOT_INSTANCE_ID &&+ mutationState.instances.has(instanceId) === false+ ),+ rootInstanceIds: insertedChildren.flatMap((child) =>+ child.type === "id" ? [child.value] : []+ ),+ removedInstanceIds,+ parentInstanceId,+ ...(getResultDetails?.({ newInstanceIds, newDataSourceIds }) ??+ ({} as Details)),+ ...(didMergeBreakpointsDueToLimit+ ? { didMergeBreakpointsDueToLimit: true as const }+ : {}),+ }) as ComponentInsertResult & Details;if (normalizedSlotDropTarget !== undefined) {if (mode === "replace") {@@ -747,21 +787,7 @@ const createInsertFragmentMutation = ({});return createRuntimeMutation({payload: insertPayload,- result: {- instanceIds: Array.from(newInstanceIds.values()).filter(- (instanceId) =>- instanceId !== ROOT_INSTANCE_ID &&- mutationState.instances.has(instanceId) === false- ),- rootInstanceIds: insertedChildren.flatMap((child) =>- child.type === "id" ? [child.value] : []- ),- removedInstanceIds: [],- parentInstanceId: parent.id,- ...(didMergeBreakpointsDueToLimit- ? { didMergeBreakpointsDueToLimit }- : {}),- },+ result: createResult(parent.id, []),invalidatesNamespaces: componentInsertNamespaces,});}@@ -791,21 +817,7 @@ const createInsertFragmentMutation = ({...replacementPayload,...insertPayload,]),- result: {- instanceIds: Array.from(newInstanceIds.values()).filter(- (instanceId) =>- instanceId !== ROOT_INSTANCE_ID &&- mutationState.instances.has(instanceId) === false- ),- rootInstanceIds: insertedChildren.flatMap((child) =>- child.type === "id" ? [child.value] : []- ),- removedInstanceIds: replacedInstanceIds,- parentInstanceId: parent.id,- ...(didMergeBreakpointsDueToLimit- ? { didMergeBreakpointsDueToLimit }- : {}),- },+ result: createResult(parent.id, replacedInstanceIds),invalidatesNamespaces: componentInsertNamespaces,});};@@ -888,6 +900,63 @@ export const insertComponent = (});};+export const insertCollection = (+ state: ComponentInsertState,+ input: z.infer<typeof insertCollectionInput>,+ context: BuilderRuntimeContext+) => {+ const mutationState = getRequiredComponentInsertState(state);+ if (mutationState.instances.has(input.parentInstanceId) === false) {+ return throwBuilderRuntimeError("NOT_FOUND", "Instance not found");+ }+ const templates = getComponentTemplates();+ const collection = createCollectionFragment({+ state: mutationState,+ input,+ templates,+ });+ const getMappedId = (ids: Map<string, string>, sourceId: string) => {+ const id = ids.get(sourceId);+ if (id === undefined) {+ return throwBuilderRuntimeError(+ "CONFLICT",+ `Collection insertion did not map generated id "${sourceId}".`+ );+ }+ return id;+ };+ return createInsertFragmentMutation<+ Omit<InsertCollectionResult, keyof ComponentInsertResult>+ >({+ state,+ parentInstanceId: input.parentInstanceId,+ fragment: collection.fragment,+ templates,+ mode: input.mode,+ insertIndex: input.insertIndex,+ additionalAvailableVariables: collection.parameterDataSources,+ getResultDetails: ({ newInstanceIds, newDataSourceIds }) => ({+ collectionInstanceId: getMappedId(+ newInstanceIds,+ collection.collectionInstanceId+ ),+ itemRootInstanceId: getMappedId(+ newInstanceIds,+ collection.itemRootInstanceId+ ),+ itemParameterId: getMappedId(+ newDataSourceIds,+ collection.itemParameterId+ ),+ itemKeyParameterId: getMappedId(+ newDataSourceIds,+ collection.itemKeyParameterId+ ),+ }),+ context,+ });+};+const createInsertTokenFragmentMutation = ({state,fragment,diff --git a/packages/project-build/src/runtime/cutover.ts b/packages/project-build/src/runtime/cutover.tsindex b5566aa00e..515cca29ec 100644--- a/packages/project-build/src/runtime/cutover.ts+++ b/packages/project-build/src/runtime/cutover.ts@@ -129,10 +129,12 @@ export const builderRuntimeCutoverManifests = [family: "component-insert-mutations",operationIds: ["instances.insertComponent",+ "instances.insertCollection","instances.insertFragment",] as const,callers: ["appRouter.api.instances",+ "MCP insert-collection","MCP insert-fragment","Builder components panel",] as const,diff --git a/packages/project-build/src/runtime/registry.test.ts b/packages/project-build/src/runtime/registry.test.tsindex 1322561064..b77acedddf 100644--- a/packages/project-build/src/runtime/registry.test.ts+++ b/packages/project-build/src/runtime/registry.test.ts@@ -1623,6 +1623,7 @@ describe("builder runtime registry", () => {["pageTree.move", {}],["pageTree.reparentOrphans", "invalid"],["instances.insertComponent", { parentInstanceId: "body" }],+ ["instances.insertCollection", { parentInstanceId: "body" }],["instances.insertFragment", { parentInstanceId: "body" }],["instances.move", { moves: {} }],["instances.reparent", {}],diff --git a/packages/project-build/src/runtime/registry.ts b/packages/project-build/src/runtime/registry.tsindex 56c0e59e67..8511dff758 100644--- a/packages/project-build/src/runtime/registry.ts+++ b/packages/project-build/src/runtime/registry.ts@@ -13,6 +13,7 @@ import { builderRuntimeContext, type BuilderRuntimeContext } from "./context";import { z } from "zod";import * as assets from "./assets";import * as components from "./components";+import * as collection from "./collection";import * as data from "./data";import * as fonts from "./fonts";import * as instanceDuplicate from "./instance-duplicate";@@ -180,10 +181,28 @@ const runtimeOperation = <if (outputSchema === undefined) {return result;}+ const parseOutput = (value: Result) => {+ if (contract.kind === "mutation") {+ if (+ typeof value !== "object" ||+ value === null ||+ "result" in value === false+ ) {+ throw new Error(+ `Mutation runtime operation "${id}" must return a mutation envelope with a result.`+ );+ }+ return {+ ...value,+ result: outputSchema.parse(value.result),+ } as Result;+ }+ return outputSchema.parse(value) as Result;+ };if (result instanceof Promise) {- return result.then((value) => outputSchema.parse(value) as Result);+ return result.then(parseOutput);}- return outputSchema.parse(result) as Result;+ return parseOutput(result);},};};@@ -793,6 +812,18 @@ export const builderRuntimeOperations = [({ state, input, context }) =>components.insertComponent(state, input, context)),+ runtimeOperation(+ "instances.insertCollection",+ api("insert-collection", "insertCollection"),+ mutationContract({+ readNamespaces: components.componentInsertReadNamespaces,+ writeNamespaces: components.componentInsertNamespaces,+ }),+ collection.insertCollectionInput,+ ({ state, input, context }) =>+ components.insertCollection(state, input, context),+ collection.insertCollectionResult+ ),runtimeOperation("instances.insertFragment",api("insert-fragment", "insertFragment"),diff --git a/packages/protocol/src/builder-api/operations.ts b/packages/protocol/src/builder-api/operations.tsindex 3ed32dfa20..031149da48 100644--- a/packages/protocol/src/builder-api/operations.ts+++ b/packages/protocol/src/builder-api/operations.ts@@ -167,6 +167,7 @@ export const publicApiOperations = publicApiOperationDocumentation.map(const operationsRequiringNegotiatedServerSupport = new Set(["instances.insertComponent",+ "instances.insertCollection","instances.insertFragment",]);