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
fix: Improve Form setup and email settings guidance (#6536)
Oleg Isonen33f7b350bce0
diff --git a/apps/builder/app/builder/features/settings-panel/controls/form-action-picker.browser.test.tsx b/apps/builder/app/builder/features/settings-panel/controls/form-action-picker.browser.test.tsxindex 71ba97183c..6729ee137e 100644--- a/apps/builder/app/builder/features/settings-panel/controls/form-action-picker.browser.test.tsx+++ b/apps/builder/app/builder/features/settings-panel/controls/form-action-picker.browser.test.tsx@@ -133,36 +133,18 @@ afterEach(() => {document.body.innerHTML = "";});-test("Action picker adds, disables, reorders, and removes HTTP, GraphQL, and Email resources", async () => {+test("Action picker adds, reorders, and removes HTTP, GraphQL, and Email resources", async () => {const ui = setup(names);for (const name of names) {await ui.add(name);}- expect(ui.saved).toEqual(- names.map((dataSourceId) => ({ dataSourceId, enabled: true }))- );+ expect(ui.saved).toEqual(names.map((dataSourceId) => ({ dataSourceId })));expect(Array.from(ui.container.querySelectorAll('[data-list-item="true"]')).map((row) => row.getAttribute("aria-label"))).toEqual(names.map((name) => `Action ${name}`));- await act(async () =>- ui.container- .querySelector<HTMLButtonElement>(- '[aria-label="Disable action GraphQL"]'- )!- .click()- );- expect(ui.saved).toEqual([- { dataSourceId: "HTTP", enabled: true },- { dataSourceId: "GraphQL", enabled: false },- { dataSourceId: "Email", enabled: true },- ]);- expect(- ui.container.querySelector('[aria-label="Action GraphQL"]')- ).toHaveStyle({ opacity: "0.2" });-const source = ui.container.querySelector<HTMLElement>('[aria-label="Action Email"] [data-drag-handle]')!;@@ -210,9 +192,9 @@ test("Action picker adds, disables, reorders, and removes HTTP, GraphQL, and Ema);});expect(ui.saved).toEqual([- { dataSourceId: "Email", enabled: true },- { dataSourceId: "HTTP", enabled: true },- { dataSourceId: "GraphQL", enabled: false },+ { dataSourceId: "Email" },+ { dataSourceId: "HTTP" },+ { dataSourceId: "GraphQL" },]);// useDrag suppresses the click immediately following a drag for 300 ms.await new Promise((resolve) => setTimeout(resolve, 350));@@ -222,8 +204,8 @@ test("Action picker adds, disables, reorders, and removes HTTP, GraphQL, and Ema.click());expect(ui.saved).toEqual([- { dataSourceId: "Email", enabled: true },- { dataSourceId: "GraphQL", enabled: false },+ { dataSourceId: "Email" },+ { dataSourceId: "GraphQL" },]);});diff --git a/apps/builder/app/builder/features/settings-panel/controls/form-action.test.tsx b/apps/builder/app/builder/features/settings-panel/controls/form-action.test.tsxindex 5038bc960f..e92e1bd605 100644--- a/apps/builder/app/builder/features/settings-panel/controls/form-action.test.tsx+++ b/apps/builder/app/builder/features/settings-panel/controls/form-action.test.tsx@@ -2,7 +2,13 @@ import { createRoot, type Root } from "react-dom/client";import { act } from "react-dom/test-utils";import { userEvent } from "@vitest/browser/context";import { afterEach, expect, test, vi } from "vitest";-import { TooltipProvider } from "@webstudio-is/design-system";+import {+ SectionTitle,+ SectionTitleButton,+ SectionTitleLabel,+ TooltipProvider,+} from "@webstudio-is/design-system";+import { PlusIcon } from "@webstudio-is/icons";import type { Prop } from "@webstudio-is/sdk";import {$dataSources,@@ -42,6 +48,124 @@ afterEach(() => {document.body.innerHTML = "";});+test("Action + explains how to add a resource when none are available", async () => {+ $instances.set(+ new Map([+ [+ "form",+ {+ type: "instance",+ id: "form",+ component: "Form",+ children: [],+ },+ ],+ ])+ );+ $dataSources.set(new Map());+ $resources.set(new Map());+ const container = document.createElement("div");+ document.body.appendChild(container);+ root = createRoot(container);+ const onChange = vi.fn();+ await act(async () =>+ root?.render(+ <TooltipProvider>+ <FormActionControl+ instanceId="form"+ propName="action"+ prop={undefined}+ computedValue={undefined}+ meta={{ type: "json", control: "form-action", required: false }}+ onChange={onChange}+ />+ </TooltipProvider>+ )+ );++ const addButton = container.querySelector<HTMLButtonElement>(+ '[aria-label="Add action"]'+ )!;+ expect(addButton.disabled).toBe(false);+ expect(addButton.dataset.buttonColor).toBe("ghost");+ await act(async () => userEvent.click(addButton));+ expect(document.querySelector('[role="tooltip"]')?.textContent).toContain(+ "Create a resource in the Variables section first."+ );+ expect(document.querySelector('[role="menu"]')).toBeNull();+ expect(onChange).not.toHaveBeenCalled();+});++test("Action + matches the Variables + button in every interaction state", async () => {+ $instances.set(+ new Map([+ [+ "form",+ { type: "instance", id: "form", component: "Form", children: [] },+ ],+ ])+ );+ $dataSources.set(new Map());+ $resources.set(new Map());+ const container = document.createElement("div");+ document.body.appendChild(container);+ root = createRoot(container);+ await act(async () =>+ root?.render(+ <TooltipProvider>+ <SectionTitle+ suffix={+ <SectionTitleButton+ aria-label="Add variable"+ prefix={<PlusIcon />}+ />+ }+ >+ <SectionTitleLabel>Variables</SectionTitleLabel>+ </SectionTitle>+ <FormActionControl+ instanceId="form"+ propName="action"+ prop={undefined}+ computedValue={undefined}+ meta={{ type: "json", control: "form-action", required: false }}+ onChange={vi.fn()}+ />+ </TooltipProvider>+ )+ );++ const variableButton = Array.from(+ container.querySelectorAll<HTMLButtonElement>('[aria-label="Add variable"]')+ ).at(-1)!;+ const actionButton = container.querySelector<HTMLButtonElement>(+ '[aria-label="Add action"]'+ )!;+ expect(actionButton.tabIndex).toBe(0);+ for (const state of ["auto", "hover", "focus", "pressed"]) {+ variableButton.dataset.state = state;+ actionButton.dataset.state = state;+ const reference = getComputedStyle(variableButton);+ const actual = getComputedStyle(actionButton);+ for (const property of [+ "backgroundColor",+ "color",+ "outlineColor",+ "outlineStyle",+ "outlineWidth",+ "outlineOffset",+ "borderRadius",+ "height",+ "paddingInlineStart",+ "paddingInlineEnd",+ ] as const) {+ expect(actual[property], `${state}: ${property}`).toBe(+ reference[property]+ );+ }+ }+});+test("Action control handles an empty Resource list and can select an in-scope destination", async () => {$resources.set(new Map([["resource", requestResource("resource")]]));$instances.set(@@ -74,7 +198,7 @@ test("Action control handles an empty Resource list and can select an in-scope dtype: "resource",id: "resourceDataSource",scopeInstanceId: "form",- name: "Send request",+ name: "Go",resourceId: "resource",},],@@ -105,7 +229,7 @@ test("Action control handles an empty Resource list and can select an in-scope d)!;await act(async () => userEvent.click(actionLabel()));expect(document.body.textContent).toContain(- "Sends each form submission to all selected destinations at the same time."+ "Sends each form submission to all destinations at the same time.");const variableBullets = Array.from(document.body.querySelectorAll('[role="tooltip"] ul li')@@ -139,6 +263,11 @@ test("Action control handles an empty Resource list and can select an in-scope d"Create a Resource in Data variables to add an action.");+ const addButton = container.querySelector<HTMLButtonElement>(+ '[aria-label="Add action"]'+ )!;+ expect(addButton.dataset.buttonColor).toBe("ghost");+await act(async () =>render({id: "action",@@ -151,18 +280,17 @@ test("Action control handles an empty Resource list and can select an in-scope dexpect(container.textContent).not.toContain("Select at least one Resource destination");- await act(async () =>- userEvent.click(- container.querySelector<HTMLButtonElement>('[aria-label="Add action"]')!- )- );+ await act(async () => userEvent.click(addButton));+ expect(+ getComputedStyle(document.querySelector('[role="menu"]')!).minWidth+ ).toBe("180px");const requestOption = Array.from(document.querySelectorAll<HTMLElement>('[role="menuitem"]')- ).find((option) => option.textContent?.includes("Send request"));+ ).find((option) => option.textContent?.includes("Go"));await act(async () => requestOption?.click());expect(onChange).toHaveBeenLastCalledWith({type: "json",- value: [{ dataSourceId: "resourceDataSource", enabled: true }],+ value: [{ dataSourceId: "resourceDataSource" }],});await act(async () =>@@ -171,7 +299,7 @@ test("Action control handles an empty Resource list and can select an in-scope dinstanceId: "form",name: "action",type: "json",- value: [{ dataSourceId: "resourceDataSource", enabled: true }],+ value: [{ dataSourceId: "resourceDataSource" }],}));await act(async () =>@@ -193,7 +321,7 @@ test("Action control handles an empty Resource list and can select an in-scope dexpect(container.textContent).toContain("Renamed request");await act(async () => userEvent.click(actionLabel()));expect(document.body.textContent).toContain(- "Sends each form submission to all selected destinations at the same time."+ "Sends each form submission to all destinations at the same time.");expect(document.body.textContent).toContain("Reset");expect(document.body.textContent).not.toContain("Reset value");@@ -201,7 +329,7 @@ test("Action control handles an empty Resource list and can select an in-scope dawait act(async () => userEvent.keyboard("{Escape}"));expect(onChange).toHaveBeenLastCalledWith({type: "json",- value: [{ dataSourceId: "resourceDataSource", enabled: true }],+ value: [{ dataSourceId: "resourceDataSource" }],});await act(async () =>@@ -212,7 +340,6 @@ test("Action control handles an empty Resource list and can select an in-scope dtype: "json",value: Array.from({ length: 10 }, (_, index) => ({dataSourceId: `resource-${index}`,- enabled: true,})),}));@@ -298,7 +425,7 @@ test("a Form can select a Resource defined outside its scope", async () => {await act(async () => requestOption?.click());expect(onChange).toHaveBeenLastCalledWith({type: "json",- value: [{ dataSourceId: "externalResourceId", enabled: true }],+ value: [{ dataSourceId: "externalResourceId" }],});});@@ -345,7 +472,7 @@ test("stored Form selection renders and a deleted Resource can be removed", asyninstanceId: "form",name: "action",type: "json",- value: [{ dataSourceId: "resource-id", enabled: true }],+ value: [{ dataSourceId: "resource-id" }],};const container = document.createElement("div");document.body.appendChild(container);@@ -454,9 +581,9 @@ test("Actions only offers eligible in-scope Resources and disables an added one"instanceId: "form",name: "action",type: "json",- value: [{ dataSourceId: "http", enabled: true }],+ value: [{ dataSourceId: "http" }],}}- computedValue={[{ dataSourceId: "http", enabled: true }]}+ computedValue={[{ dataSourceId: "http" }]}meta={{ type: "json", control: "form-action", required: false }}onChange={onChange}/>@@ -499,14 +626,11 @@ test("Actions only offers eligible in-scope Resources and disables an added one");expect(onChange).toHaveBeenLastCalledWith({type: "json",- value: [- { dataSourceId: "http", enabled: true },- { dataSourceId: "email", enabled: true },- ],+ value: [{ dataSourceId: "http" }, { dataSourceId: "email" }],});});-test("a disabled Action stays visible and can be enabled or removed", async () => {+test("a legacy Action stays visible and can be removed", async () => {$instances.set(new Map([[@@ -550,26 +674,15 @@ test("a disabled Action stays visible and can be enabled or removed", async () =instanceId: "form",name: "action",type: "json",- value: [{ dataSourceId: "send", enabled: true }],+ value: [{ dataSourceId: "send", enabled: false }],}}- computedValue={[{ dataSourceId: "send", enabled: true }]}+ computedValue={[{ dataSourceId: "send" }]}meta={{ type: "json", control: "form-action", required: false }}onChange={onChange}/></TooltipProvider>));- await act(async () =>- container- .querySelector<HTMLButtonElement>(- '[aria-label="Disable action Send request"]'- )- ?.click()- );- expect(onChange).toHaveBeenLastCalledWith({- type: "json",- value: [{ dataSourceId: "send", enabled: false }],- });await act(async () =>root?.render(<TooltipProvider>@@ -581,9 +694,9 @@ test("a disabled Action stays visible and can be enabled or removed", async () =instanceId: "form",name: "action",type: "json",- value: [{ dataSourceId: "send", enabled: false }],+ value: [{ dataSourceId: "send" }],}}- computedValue={[{ dataSourceId: "send", enabled: false }]}+ computedValue={[{ dataSourceId: "send" }]}meta={{ type: "json", control: "form-action", required: false }}onChange={onChange}/>@@ -595,7 +708,7 @@ test("a disabled Action stays visible and can be enabled or removed", async () =expect(row?.textContent).toContain("Send request");expect(row?.querySelector("label")).toBeNull();expect(row?.getClientRects().length).toBeGreaterThan(0);- expect(getComputedStyle(row!).opacity).toBe("0.2");+ expect(getComputedStyle(row!).opacity).toBe("1");expect(row?.hasAttribute("disabled")).toBe(false);expect(row?.parentElement?.getBoundingClientRect().left).toBeLessThan(container.getBoundingClientRect().left@@ -607,15 +720,6 @@ test("a disabled Action stays visible and can be enabled or removed", async () =await act(async () => userEvent.tab());expect(document.activeElement).toBe(row);await act(async () => userEvent.keyboard("{ArrowRight}"));- expect(document.activeElement?.getAttribute("aria-label")).toBe(- "Enable action Send request"- );- await act(async () => userEvent.keyboard("{Enter}"));- expect(onChange).toHaveBeenLastCalledWith({- type: "json",- value: [{ dataSourceId: "send", enabled: true }],- });- await act(async () => userEvent.keyboard("{ArrowRight}"));expect(document.activeElement?.getAttribute("aria-label")).toBe("Remove action Send request");@@ -642,20 +746,17 @@ test("a disabled Action stays visible and can be enabled or removed", async () =test.each([{ actions: [], mode: "Navigation mode", warning: undefined },{- actions: [{ dataSourceId: "first", enabled: false }],+ actions: [{ dataSourceId: "first" }],mode: undefined,- warning: "Enable at least one action",+ warning: undefined,},{- actions: [- { dataSourceId: "first", enabled: false },- { dataSourceId: "second", enabled: true },- ],+ actions: [{ dataSourceId: "first" }, { dataSourceId: "second" }],mode: undefined,warning: undefined,},])(- "an empty Action list selects Navigation mode; a non-empty disabled list does not",+ "an empty Action list selects Navigation mode; a non-empty legacy list does not",async ({ actions, mode, warning }) => {$instances.set(new Map([diff --git a/apps/builder/app/builder/features/settings-panel/controls/form-action.tsx b/apps/builder/app/builder/features/settings-panel/controls/form-action.tsxindex 0f4238f47c..2a3ad2147c 100644--- a/apps/builder/app/builder/features/settings-panel/controls/form-action.tsx+++ b/apps/builder/app/builder/features/settings-panel/controls/form-action.tsx@@ -1,4 +1,5 @@import { useStore } from "@nanostores/react";+import { useState } from "react";import {Box,InteractiveListArrowFocus,@@ -9,20 +10,15 @@ import {DropdownMenuTrigger,Flex,Grid,+ SectionTitleButton,SmallIconButton,- SmallToggleButton,Text,Tooltip,InfoTooltip,useSortable,theme,} from "@webstudio-is/design-system";-import {- EyeClosedIcon,- EyeOpenIcon,- MinusIcon,- PlusIcon,-} from "@webstudio-is/icons";+import { MinusIcon, PlusIcon } from "@webstudio-is/icons";import {isFormSubmission,maxFormActions,@@ -39,22 +35,19 @@ import {import { type ControlProps } from "../shared";import { FieldLabel } from "../property-label";import { showVariable } from "../variable-navigation";+import { UrlControl } from "./url";const ActionItem = ({id,index,variable,- isEnabled,active,- onToggle,onRemove,}: {id: string;index: number;variable?: DataSource;- isEnabled: boolean;active: boolean;- onToggle: () => void;onRemove: () => void;}) => {const isResource = variable?.type === "resource";@@ -66,7 +59,6 @@ const ActionItem = ({aria-label={`Action ${name}`}draggableactive={active}- css={{ opacity: isEnabled ? undefined : 0.2 }}onClick={(event) => {const target = event.target;if (@@ -84,29 +76,16 @@ const ActionItem = ({</Text>}buttons={- <>- <Tooltip content={isEnabled ? "Disable action" : "Enable action"}>- <SmallToggleButton- tabIndex={-1}- variant="normal"- pressed={!isEnabled}- aria-label={`${isEnabled ? "Disable" : "Enable"} action ${name}`}- icon={isEnabled ? <EyeOpenIcon /> : <EyeClosedIcon />}- onClick={(event) => event.stopPropagation()}- onPressedChange={onToggle}- />- </Tooltip>- <SmallIconButton- tabIndex={-1}- variant="destructive"- aria-label={`Remove action ${name}`}- icon={<MinusIcon />}- onClick={(event) => {- event.stopPropagation();- onRemove();- }}- />- </>+ <SmallIconButton+ tabIndex={-1}+ variant="destructive"+ aria-label={`Remove action ${name}`}+ icon={<MinusIcon />}+ onClick={(event) => {+ event.stopPropagation();+ onRemove();+ }}+ />}/>);@@ -116,7 +95,12 @@ export const FormActionControl = ({instanceId,prop,onChange,-}: ControlProps<"form-action">) => {+ successRedirect,+}: ControlProps<"form-action"> & {+ successRedirect?: ControlProps<"url">;+}) => {+ const [showEmptyResourceTooltip, setShowEmptyResourceTooltip] =+ useState(false);const instances = useStore($instances);const dataSources = useStore($dataSources);const resourcesById = useStore($resources);@@ -137,7 +121,10 @@ export const FormActionControl = ({return resource !== undefined && resource.control !== "system";});const update = (next: FormSubmission) =>- onChange({ type: "json", value: next });+ onChange({+ type: "json",+ value: next.map(({ dataSourceId }) => ({ dataSourceId })),+ });const { dragItemId, placementIndicator, sortableRefCallback } = useSortable({items: action.map(({ dataSourceId }) => ({ id: dataSourceId })),onSort: (newIndex, oldIndex) => {@@ -160,8 +147,7 @@ export const FormActionControl = ({description={<Flex direction="column" gap="1"><Text>- Sends each form submission to all selected destinations at the- same time.+ Sends each form submission to all destinations at the same time.</Text><Box as="ul" css={{ margin: 0, paddingLeft: theme.spacing[4] }}><li>@@ -199,46 +185,57 @@ export const FormActionControl = ({>Action</FieldLabel>- <DropdownMenu>- <Tooltip content="Add a resource to submit this Form.">- <span style={{ display: "flex" }}>- <DropdownMenuTrigger asChild>- <SmallIconButton- aria-label="Add action"- disabled={- action.length >= maxFormActions || resources.length === 0- }- icon={<PlusIcon />}- />- </DropdownMenuTrigger>- </span>+ {resources.length === 0 ? (+ <Tooltip+ content="Create a resource in the Variables section first."+ open={showEmptyResourceTooltip}+ onOpenChange={setShowEmptyResourceTooltip}+ >+ <SectionTitleButton+ aria-label="Add action"+ tabIndex={0}+ prefix={<PlusIcon />}+ onClick={() => setShowEmptyResourceTooltip(true)}+ /></Tooltip>- <DropdownMenuContent>- {resources.map((variable) => (- <DropdownMenuItem- key={variable.id}- disabled={action.some(- ({ dataSourceId }) => dataSourceId === variable.id- )}- onSelect={() => {- if (- action.length < maxFormActions &&- !action.some(- ({ dataSourceId }) => dataSourceId === variable.id- )- ) {- update([- ...action,- { dataSourceId: variable.id, enabled: true },- ]);- }- }}- >- {variable.name}- </DropdownMenuItem>- ))}- </DropdownMenuContent>- </DropdownMenu>+ ) : (+ <DropdownMenu>+ <Tooltip content="Add a resource to submit this Form.">+ <span style={{ display: "flex" }}>+ <DropdownMenuTrigger asChild>+ <SectionTitleButton+ aria-label="Add action"+ tabIndex={0}+ disabled={action.length >= maxFormActions}+ prefix={<PlusIcon />}+ />+ </DropdownMenuTrigger>+ </span>+ </Tooltip>+ <DropdownMenuContent css={{ minWidth: 180 }}>+ {resources.map((variable) => (+ <DropdownMenuItem+ key={variable.id}+ disabled={action.some(+ ({ dataSourceId }) => dataSourceId === variable.id+ )}+ onSelect={() => {+ if (+ action.length < maxFormActions &&+ !action.some(+ ({ dataSourceId }) => dataSourceId === variable.id+ )+ ) {+ update([...action, { dataSourceId: variable.id }]);+ }+ }}+ >+ {variable.name}+ </DropdownMenuItem>+ ))}+ </DropdownMenuContent>+ </DropdownMenu>+ )}</Flex><Box css={{ py: theme.spacing[2] }}><Flex direction="column" gap="2">@@ -250,23 +247,13 @@ export const FormActionControl = ({marginInline: `calc(-1 * ${theme.panel.paddingInline})`,}}>- {action.map(({ dataSourceId: id, enabled }, index) => (+ {action.map(({ dataSourceId: id }, index) => (<ActionItemkey={id}id={id}index={index}variable={dataSources.get(id)}- isEnabled={enabled}active={dragItemId === id}- onToggle={() =>- update(- action.map((item) =>- item.dataSourceId === id- ? { ...item, enabled: !item.enabled }- : item- )- )- }onRemove={() =>update(action.filter((item) => item.dataSourceId !== id))}@@ -277,6 +264,9 @@ export const FormActionControl = ({</InteractiveListArrowFocus>)}{error && <Text>{error}</Text>}+ {action.length > 0 && successRedirect && (+ <UrlControl {...successRedirect} />+ )}{!invalidSavedValue && action.length === 0 && (<Flex align="center" justify="center" gap="1"><Text>Navigation mode</Text>diff --git a/apps/builder/app/builder/features/settings-panel/props-section/props-section.test.ts b/apps/builder/app/builder/features/settings-panel/props-section/props-section.test.tsindex 5babc590bb..73aebd3f8d 100644--- a/apps/builder/app/builder/features/settings-panel/props-section/props-section.test.ts+++ b/apps/builder/app/builder/features/settings-panel/props-section/props-section.test.ts@@ -8,8 +8,42 @@ const {shouldSyncMediaAssetProps,findExpressionPropByStandardName,shouldWriteBoundValue,+ getStandaloneInitialProps,} = __testing__;+test("keeps a standalone Form redirect when Content mode hides Action", () => {+ const redirect = {+ propName: "successRedirect",+ meta: { type: "string", control: "url", required: false },+ } as const;+ const action = {+ propName: "action",+ meta: { type: "json", control: "form-action", required: false },+ } as const;++ expect(+ getStandaloneInitialProps({+ component: "Form",+ addedProps: [],+ initialProps: [redirect],+ })+ ).toEqual([redirect]);+ expect(+ getStandaloneInitialProps({+ component: "Form",+ addedProps: [],+ initialProps: [action, redirect],+ })+ ).toEqual([action]);+ expect(+ getStandaloneInitialProps({+ component: "Form",+ addedProps: [action],+ initialProps: [redirect],+ })+ ).toEqual([]);+});+test("Form and generic components render their property sections", () => {for (const component of ["Form", "Box"]) {expect(diff --git a/apps/builder/app/builder/features/settings-panel/props-section/props-section.tsx b/apps/builder/app/builder/features/settings-panel/props-section/props-section.tsxindex 70b124991a..84e747d984 100644--- a/apps/builder/app/builder/features/settings-panel/props-section/props-section.tsx+++ b/apps/builder/app/builder/features/settings-panel/props-section/props-section.tsx@@ -51,6 +51,7 @@ import {getInstanceKey,} from "~/shared/nano-states";import { renderControl } from "../controls/combined";+import { FormActionControl } from "../controls/form-action";import { usePropsLogic, type PropAndMeta } from "./use-props-logic";import { AnimationSection } from "./animation/animation-section";import { $matchingBreakpoints } from "../../style-panel/shared/model";@@ -185,6 +186,26 @@ const shouldWriteBoundValue = (): update is Exclude<PropValue, { type: "expression" }> =>isContentMode && update.type !== "expression";+const getStandaloneInitialProps = ({+ component,+ addedProps,+ initialProps,+}: {+ component: Instance["component"];+ addedProps: PropAndMeta[];+ initialProps: PropAndMeta[];+}) => {+ const hasVisibleFormActionControl =+ component === "Form" &&+ [...addedProps, ...initialProps].some(+ (item) => item.meta.control === "form-action"+ );+ return initialProps.filter(+ (item) =>+ item.propName !== "successRedirect" || !hasVisibleFormActionControl+ );+};+const renderProperty = ({propsLogic: logic,@@ -214,6 +235,38 @@ const renderProperty = (getInstanceKey(item.instanceSelector)) ?? propValues);+ if (component === "Form" && meta.control === "form-action") {+ const redirect = logic.initialProps.find(+ (item) => item.propName === "successRedirect"+ );+ return (+ <FormActionControl+ key={propName}+ instanceId={targetInstanceId}+ meta={meta}+ prop={prop}+ propName={propName}+ computedValue={targetPropValues.get(propName) ?? meta.defaultValue}+ onChange={(value) => logic.handleChange({ prop, propName }, value)}+ successRedirect={+ redirect?.meta.control === "url"+ ? {+ instanceId: targetInstanceId,+ meta: redirect.meta,+ prop: redirect.prop,+ propName: redirect.propName,+ computedValue:+ targetPropValues.get(redirect.propName) ??+ redirect.meta.defaultValue,+ onChange: (value) =>+ logic.handleChangeByPropName(redirect.propName, value),+ }+ : undefined+ }+ />+ );+ }+return renderControl({key: propName,instanceId: targetInstanceId,@@ -444,7 +497,11 @@ export const PropsSection = (props: PropsSectionProps) => {/>)}{addedProps.map((item) => renderProperty(props, item))}- {initialProps.map((item) => renderProperty(props, item))}+ {getStandaloneInitialProps({+ component: props.component,+ addedProps,+ initialProps,+ }).map((item) => renderProperty(props, item))}</Flex></CollapsibleSectionWithAddButton>)}@@ -458,6 +515,7 @@ export const __testing__ = {shouldSyncMediaAssetProps,findExpressionPropByStandardName,shouldWriteBoundValue,+ getStandaloneInitialProps,};const $propValues = computed(diff --git a/apps/builder/app/builder/features/settings-panel/resource-panel.test.ts b/apps/builder/app/builder/features/settings-panel/resource-panel.test.tsindex 7b62a7942e..461cc38570 100644--- a/apps/builder/app/builder/features/settings-panel/resource-panel.test.ts+++ b/apps/builder/app/builder/features/settings-panel/resource-panel.test.ts@@ -1458,7 +1458,7 @@ test("body controls follow the effective method for standalone GET and Form ActiinstanceId: "form",name: "action",type: "json",- value: [{ dataSourceId: variable.id, enabled: true }],+ value: [{ dataSourceId: variable.id }],},],])diff --git a/apps/builder/app/builder/features/settings-panel/selected-instance-props-meta.test.ts b/apps/builder/app/builder/features/settings-panel/selected-instance-props-meta.test.tsindex f541166e3c..900558130d 100644--- a/apps/builder/app/builder/features/settings-panel/selected-instance-props-meta.test.ts+++ b/apps/builder/app/builder/features/settings-panel/selected-instance-props-meta.test.ts@@ -1,5 +1,7 @@import { afterEach, expect, test } from "vitest";import { coreMetas, type WsComponentMeta } from "@webstudio-is/sdk";+import { Input as inputMeta } from "@webstudio-is/sdk-components-react/metas";+import { attributesByTag } from "@webstudio-is/html-data";import { showAttribute } from "@webstudio-is/react-sdk";import { $selectedInstancePropsMetas } from "./shared";import {@@ -71,7 +73,10 @@ test("keeps rendered form attributes for components without the opt-out", () =>"Form",{label: "Form",- props: {},+ props: {+ custom: { type: "string", control: "text", required: false },+ className: { type: "string", control: "text", required: false },+ },} satisfies WsComponentMeta,],])@@ -84,4 +89,49 @@ test("keeps rendered form attributes for components without the opt-out", () =>expect(propsMetas.has("enctype")).toBe(true);expect(propsMetas.has("id")).toBe(true);expect(propsMetas.has("aria-label")).toBe(true);+ expect(propsMetas.has("class")).toBe(false);+ const propNames = [...propsMetas.keys()];+ expect(propNames[0]).toBe(showAttribute);+ expect(propNames.indexOf("custom")).toBeLessThan(propNames.indexOf("method"));+ expect(propNames.indexOf("method")).toBeLessThan(propNames.indexOf("id"));+ expect(propNames.indexOf("id")).toBeLessThan(propNames.indexOf("aria-label"));+});++test.each(["ws:element", "Input"])(+ "inherits the unset %s input type from HTML metadata",+ (component) => {+ const input = {+ type: "instance" as const,+ id: "input",+ component,+ tag: "input",+ children: [],+ };+ $instances.set(new Map([[input.id, input]]));+ $props.set(new Map());+ $registeredComponentMetas.set(+ new Map([...Object.entries(coreMetas), ["Input", inputMeta]])+ );+ selectInstance([input.id]);++ const typeMeta = $selectedInstancePropsMetas.get().get("type");++ expect(typeMeta).toMatchObject({+ control: "select",+ defaultValue: "text",+ options: expect.arrayContaining(["text", "email"]),+ });+ expect($props.get().size).toBe(0);+ }+);++test("keeps the implicit type default on the input attribute only", () => {+ expect(+ attributesByTag.input?.find(({ name }) => name === "type")+ ).toMatchObject({+ defaultValue: "text",+ });+ expect(+ attributesByTag.button?.find(({ name }) => name === "type")+ ).not.toHaveProperty("defaultValue");});diff --git a/apps/builder/app/builder/features/settings-panel/shared.tsx b/apps/builder/app/builder/features/settings-panel/shared.tsxindex bd05e7ff31..d1df49885d 100644--- a/apps/builder/app/builder/features/settings-panel/shared.tsx+++ b/apps/builder/app/builder/features/settings-panel/shared.tsx@@ -23,7 +23,7 @@ import {systemParameter,} from "@webstudio-is/sdk";import { getContentModePropNamesByTag } from "@webstudio-is/project-build/runtime";-import type { PropMeta, Prop, Asset } from "@webstudio-is/sdk";+import type { PropMeta, Prop, Asset, WsComponentMeta } from "@webstudio-is/sdk";import {Label as BaseLabel,useIsTruncated,@@ -295,7 +295,7 @@ export const humanizeAttribute = (string: string) => {return humanizeString(standardAttributesToReactProps[string] ?? string);};-type Attribute = (typeof ariaAttributes)[number];+type Attribute = (typeof ariaAttributes)[number] & { defaultValue?: string };const attributeToMeta = (attribute: Attribute): PropMeta => {const required = attribute.required ?? false;@@ -308,6 +308,7 @@ const attributeToMeta = (attribute: Attribute): PropMeta => {required,options,description,+ defaultValue: attribute.defaultValue,};}if (attribute.type === "url") {@@ -355,6 +356,47 @@ const getInitialPropNames = (return initialPropNames;};+const getInstancePropsMetas = (+ meta: WsComponentMeta | undefined,+ tag: string | undefined,+ contentModePropNames: Set<string> | undefined+): Map<string, PropMeta> => {+ const propsMetas = new Map<Prop["name"], PropMeta>();+ const addAttributes = (attributes: readonly Attribute[] | undefined) => {+ if (attributes === undefined) {+ return;+ }+ for (const attribute of [...attributes].reverse()) {+ const propMeta = attributeToMeta(attribute);+ propsMetas.set(+ attribute.name,+ contentModePropNames?.has(attribute.name)+ ? { ...propMeta, contentMode: true }+ : propMeta+ );+ }+ };++ // Build from lowest to highest precedence, then reverse for display order.+ if (tag && meta?.htmlAttributes !== "hide") {+ if (elementsByTag[tag].categories.includes("html-element")) {+ addAttributes(ariaAttributes);+ addAttributes(attributesByTag["*"]);+ }+ addAttributes(attributesByTag[tag]);+ }+ for (const [name, propMeta] of Object.entries(meta?.props ?? {}).reverse()) {+ // Component props take precedence over their equivalent HTML attributes.+ const htmlName = reactPropsToStandardAttributes[name];+ if (htmlName) {+ propsMetas.delete(htmlName);+ }+ propsMetas.set(name, propMeta);+ }+ propsMetas.set(showAttribute, showAttributeMeta);+ return new Map(Array.from(propsMetas.entries()).reverse());+};+export const $selectedInstancePropsMetas = computed([$selectedInstance,@@ -362,66 +404,16 @@ export const $selectedInstancePropsMetas = computed($instanceTags,$contentModePropNamesByTag,],- (- instance,- metas,- instanceTags,- contentModePropNamesByTag- ): Map<string, PropMeta> => {+ (instance, metas, instanceTags, contentModePropNamesByTag) => {if (instance === undefined) {- return new Map();+ return new Map<string, PropMeta>();}- const meta = metas.get(instance.component);const tag = instanceTags.get(instance.id);- const propsMetas = new Map<Prop["name"], PropMeta>();- const contentModePropNames =- tag === undefined ? undefined : contentModePropNamesByTag.get(tag);- const toAttributeMeta = (attribute: Attribute): PropMeta => {- const propMeta = attributeToMeta(attribute);- if (contentModePropNames?.has(attribute.name)) {- return { ...propMeta, contentMode: true };- }- return propMeta;- };- // add html attributes only when instance has tag- if (tag && meta?.htmlAttributes !== "hide") {- if (elementsByTag[tag].categories.includes("html-element")) {- for (const attribute of [...ariaAttributes].reverse()) {- propsMetas.set(attribute.name, toAttributeMeta(attribute));- }- // include global attributes only for html elements- if (attributesByTag["*"]) {- for (const attribute of [...attributesByTag["*"]].reverse()) {- propsMetas.set(attribute.name, toAttributeMeta(attribute));- }- }- }- if (attributesByTag[tag]) {- for (const attribute of [...attributesByTag[tag]].reverse()) {- propsMetas.set(attribute.name, toAttributeMeta(attribute));- }- }- }- for (const [name, propMeta] of Object.entries(- meta?.props ?? {}- ).reverse()) {- // when component property has the same name as html attribute in react- // override to deduplicate similar properties- // for example component can have own "className" and html has "class"- const htmlName = reactPropsToStandardAttributes[name];- if (htmlName) {- propsMetas.delete(htmlName);- }- propsMetas.set(name, propMeta);- }- propsMetas.set(showAttribute, showAttributeMeta);- // ui should render in the following order- // 1. system properties- // 2. component properties- // 3. specific tag attributes- // 4. global html attributes- // 5. aria attributes- return new Map(Array.from(propsMetas.entries()).reverse());+ return getInstancePropsMetas(+ metas.get(instance.component),+ tag,+ tag === undefined ? undefined : contentModePropNamesByTag.get(tag)+ );});diff --git a/apps/builder/app/builder/features/settings-panel/variables-section.test.tsx b/apps/builder/app/builder/features/settings-panel/variables-section.test.tsxindex c622289f45..24e0e8e535 100644--- a/apps/builder/app/builder/features/settings-panel/variables-section.test.tsx+++ b/apps/builder/app/builder/features/settings-panel/variables-section.test.tsx@@ -587,7 +587,7 @@ test("clicking an Action opens its Resource editor and highlights its VariablesinstanceId: "child",name: "action",type: "json",- value: [{ dataSourceId: resourceVariable.id, enabled: true }],+ value: [{ dataSourceId: resourceVariable.id }],}}onChange={() => {}}propName="action"@@ -625,17 +625,6 @@ test("clicking an Action opens its Resource editor and highlights its Variablesexpect($variableToFocus.get()).toBeUndefined();expect($variableToOpen.get()).toBeUndefined();expect(document.querySelector('[role="dialog"]')).toBeNull();- await act(- async () =>- await userEvent.click(- container.querySelector<HTMLButtonElement>(- '[aria-label="Disable action Request"]'- )!- )- );- expect($variableToFocus.get()).toBeUndefined();- expect($variableToOpen.get()).toBeUndefined();- expect(document.querySelector('[role="dialog"]')).toBeNull();await act(async () =>await userEvent.click(@@ -722,7 +711,7 @@ test("an Action Resource unavailable in Variables does not open a stale dialog",instanceId: "child",name: "action",type: "json",- value: [{ dataSourceId: parentResource.id, enabled: true }],+ value: [{ dataSourceId: parentResource.id }],}}computedValue={[]}meta={{diff --git a/apps/builder/app/canvas/features/webstudio-component/preview-form-lifecycle.test.tsx b/apps/builder/app/canvas/features/webstudio-component/preview-form-lifecycle.test.tsxindex 494f335374..e1e6e3f616 100644--- a/apps/builder/app/canvas/features/webstudio-component/preview-form-lifecycle.test.tsx+++ b/apps/builder/app/canvas/features/webstudio-component/preview-form-lifecycle.test.tsx@@ -55,7 +55,7 @@ test.each([true, false])(}return (<__testing__.PreviewResourceForm- action={[{ dataSourceId: "request", enabled: true }]}+ action={[{ dataSourceId: "request" }]}state={state}onStateChange={setState}onManagedSubmit={submit}@@ -99,7 +99,7 @@ test.each([true, false])(const isPreviewMode = useStore($isPreviewMode);return isPreviewMode ? (<__testing__.PreviewResourceForm- action={[{ dataSourceId: "request", enabled: true }]}+ action={[{ dataSourceId: "request" }]}onManagedSubmit={submit}><button type="submit">Send</button>@@ -137,7 +137,7 @@ test("Preview publishes live unsent DOM values as input/change events occur", asroot?.render(<__testing__.PreviewResourceFormdata-ws-managed-form-id="live-form"- action={[{ dataSourceId: "request", enabled: true }]}+ action={[{ dataSourceId: "request" }]}onManagedSubmit={submit}><input name="text" />diff --git a/apps/builder/app/canvas/features/webstudio-component/webstudio-component.test.tsx b/apps/builder/app/canvas/features/webstudio-component/webstudio-component.test.tsxindex 44030e258b..f36d5c6cb3 100644--- a/apps/builder/app/canvas/features/webstudio-component/webstudio-component.test.tsx+++ b/apps/builder/app/canvas/features/webstudio-component/webstudio-component.test.tsx@@ -247,7 +247,7 @@ test.each(["query", "hash", "params"] as const)(await act(async () =>root.render(<PreviewResourceForm- action={[{ dataSourceId: "resource", enabled: true }]}+ action={[{ dataSourceId: "resource" }]}successRedirect="/done"onManagedSubmit={(_values, requestSignal) => {signal = requestSignal;diff --git a/apps/builder/app/services/preview-form-route.server.test.ts b/apps/builder/app/services/preview-form-route.server.test.tsindex d4c50d8275..c4600f3c96 100644--- a/apps/builder/app/services/preview-form-route.server.test.ts+++ b/apps/builder/app/services/preview-form-route.server.test.ts@@ -97,7 +97,7 @@ const draftBuild = {instanceId: "form",name: "action",type: "json",- value: [{ dataSourceId: "destination", enabled: true }],+ value: [{ dataSourceId: "destination" }],},],dataSources: [@@ -322,6 +322,23 @@ test("server MCP simulation and Builder Preview use the same saved Form setup an});});+test("Builder Preview executes a legacy Action with an enabled key", async () => {+ vi.mocked(loadDevBuildByProjectId).mockResolvedValue({+ ...draftBuild,+ props: [+ {+ ...draftBuild.props[0],+ value: [{ dataSourceId: "destination", enabled: false }],+ },+ ],+ } as never);+ const response = await action({ request: request() } as never);+ expect((await response.json()).success).toBe(true);+ expect(+ vi.mocked(createNodeProtectedResourceFetch).mock.results[0].value+ ).toHaveBeenCalledWith(expect.any(Request));+});+test.each([[[], []],[["news"], ["news"]],@@ -556,7 +573,7 @@ test.each([false, true])(createRoot(document.getElementById("root")).render(createElement(Form, {"data-ws-managed-form-id": "form",- action: [{ dataSourceId: "destination", enabled: true }],+ action: [{ dataSourceId: "destination" }],onManagedSubmit: (values, signal) => submitPreviewForm({values,managedFormId: "form",@@ -676,7 +693,7 @@ test.each([false, true])(props: [{...draftBuild.props[0],- value: [{ dataSourceId: "new-email", enabled: true }],+ value: [{ dataSourceId: "new-email" }],},],dataSources: [@@ -973,7 +990,7 @@ test("Preview binds each page's submitted values and browser context to its owninstanceId: formId,name: "action",type: "json",- value: [{ dataSourceId: `${formId}-destination`, enabled: true }],+ value: [{ dataSourceId: `${formId}-destination` }],})),dataSources: pages.flatMap(({ formId }) => [{@@ -1261,8 +1278,8 @@ test("two Email actions identify each credential failure in local Preview", asyn{...draftBuild.props[0],value: [- { dataSourceId: "destination", enabled: true },- { dataSourceId: "visitorDestination", enabled: true },+ { dataSourceId: "destination" },+ { dataSourceId: "visitorDestination" },],},],diff --git a/apps/builder/app/shared/instance-utils/fragment.test.tsx b/apps/builder/app/shared/instance-utils/fragment.test.tsxindex 5ff7b118ec..7092a69012 100644--- a/apps/builder/app/shared/instance-utils/fragment.test.tsx+++ b/apps/builder/app/shared/instance-utils/fragment.test.tsx@@ -546,8 +546,8 @@ describe("insert webstudio fragment copy", () => {name: "action",type: "json",value: [- { dataSourceId: "scoped-source", enabled: true },- { dataSourceId: "external-source", enabled: true },+ { dataSourceId: "scoped-source" },+ { dataSourceId: "external-source" },],},],@@ -572,8 +572,8 @@ describe("insert webstudio fragment copy", () => {).toMatchObject({type: "json",value: [- { dataSourceId: copiedScopedId, enabled: true },- { dataSourceId: "external-source", enabled: true },+ { dataSourceId: copiedScopedId },+ { dataSourceId: "external-source" },],});});diff --git a/apps/builder/app/shared/instance-utils/insert.test.tsx b/apps/builder/app/shared/instance-utils/insert.test.tsxindex a6af68fd86..fdcac4c384 100644--- a/apps/builder/app/shared/instance-utils/insert.test.tsx+++ b/apps/builder/app/shared/instance-utils/insert.test.tsx@@ -946,12 +946,10 @@ describe("insert webstudio component at", () => {if (!isFormSubmission(action.value)) {throw new Error("Expected valid Form actions");}- expect(action.value).toEqual(- expect.arrayContaining([- expect.objectContaining({ enabled: true }),- expect.objectContaining({ enabled: true }),- ])- );+ expect(action.value).toEqual([+ { dataSourceId: expect.any(String) },+ { dataSourceId: expect.any(String) },+ ]);expect(action.value).toHaveLength(2);expect(action.value.map(diff --git a/apps/builder/app/shared/project-settings/section-emails.test.tsx b/apps/builder/app/shared/project-settings/section-emails.test.tsxindex 8094cc89ba..d21b71b059 100644--- a/apps/builder/app/shared/project-settings/section-emails.test.tsx+++ b/apps/builder/app/shared/project-settings/section-emails.test.tsx@@ -121,3 +121,30 @@ test("keyboard users can open the recipients helper", async () => {await act(async () => userEvent.keyboard("{Enter}"));expect(page.getByRole("tooltip").getByText(recipientsHelp)).toBeVisible();});++test("Reply to helper explains the visitor confirmation display name", async () => {+ const replyToHelp =+ "This is the default Reply to address for email resources. Its display name is used in generated default visitor confirmation subjects and messages when the resource has no Reply to value. Custom subjects and messages stay unchanged. If no display name is set, “Site Owner” is used.";+ act(() =>+ root.render(+ <TooltipProvider delayDuration={0}>+ <SectionEmails />+ </TooltipProvider>+ )+ );++ expect(document.body.textContent).not.toContain(replyToHelp);+ const replyToHelpButton = document.querySelector(+ 'button[aria-label="Reply to"]'+ );+ expect(replyToHelpButton).not.toBeNull();+ for (let attempts = 0; attempts < 10; attempts += 1) {+ if (document.activeElement === replyToHelpButton) {+ break;+ }+ await act(async () => userEvent.tab());+ }+ expect(document.activeElement).toBe(replyToHelpButton);+ await act(async () => userEvent.keyboard("{Enter}"));+ expect(page.getByRole("tooltip").getByText(replyToHelp)).toBeVisible();+});diff --git a/apps/builder/app/shared/project-settings/section-emails.tsx b/apps/builder/app/shared/project-settings/section-emails.tsxindex 484ce2afed..f526defc87 100644--- a/apps/builder/app/shared/project-settings/section-emails.tsx+++ b/apps/builder/app/shared/project-settings/section-emails.tsx@@ -95,7 +95,13 @@ export const SectionEmails = () => {</InputErrorsTooltip></Grid><Grid gap={1} css={sectionSpacing}>- <Label htmlFor="project-emailSender">Reply to</Label>+ <Flex gap={1} align="center">+ <Label htmlFor="project-emailSender">Reply to</Label>+ <InfoTooltip+ label="Reply to"+ content="This is the default Reply to address for email resources. Its display name is used in generated default visitor confirmation subjects and messages when the resource has no Reply to value. Custom subjects and messages stay unchanged. If no display name is set, “Site Owner” is used."+ />+ </Flex><InputErrorsTooltip errors={replyToError ? [replyToError] : undefined}><TextAreaid="project-emailSender"diff --git a/apps/builder/e2e/fixtures/mcp-default-contact-email-author.ts b/apps/builder/e2e/fixtures/mcp-default-contact-email-author.tsindex 61a540dc2c..8afdcadfe8 100644--- a/apps/builder/e2e/fixtures/mcp-default-contact-email-author.ts+++ b/apps/builder/e2e/fixtures/mcp-default-contact-email-author.ts@@ -268,7 +268,6 @@ const author = async () => {}const actions = [owner, visitor].map(({ dataSourceId }) => ({dataSourceId,- enabled: true,}));const inspection = await call("inspect-instance", {instanceId: form.id,diff --git a/apps/builder/e2e/fixtures/mcp-email-binding-author.ts b/apps/builder/e2e/fixtures/mcp-email-binding-author.tsindex bea0a85fa4..3577d871b4 100644--- a/apps/builder/e2e/fixtures/mcp-email-binding-author.ts+++ b/apps/builder/e2e/fixtures/mcp-email-binding-author.ts@@ -283,7 +283,7 @@ try {instanceId: form.id,name: "action",type: "json",- value: [{ dataSourceId: visitorEmail.dataSourceId, enabled: true }],+ value: [{ dataSourceId: visitorEmail.dataSourceId }],},],});@@ -330,7 +330,7 @@ try {instanceId: form.id,name: "action",type: "json",- value: [{ dataSourceId: projectEmail.dataSourceId, enabled: true }],+ value: [{ dataSourceId: projectEmail.dataSourceId }],},],});diff --git a/apps/builder/e2e/fixtures/mcp-email-http-combination-author.ts b/apps/builder/e2e/fixtures/mcp-email-http-combination-author.tsindex 615277ca19..8884a2a1a1 100644--- a/apps/builder/e2e/fixtures/mcp-email-http-combination-author.ts+++ b/apps/builder/e2e/fixtures/mcp-email-http-combination-author.ts@@ -294,8 +294,8 @@ const author = async () => {exposeAsDataSource: true,});const actions = [- { dataSourceId: email.dataSourceId, enabled: true },- { dataSourceId: http.dataSourceId, enabled: true },+ { dataSourceId: email.dataSourceId },+ { dataSourceId: http.dataSourceId },];await call("update-props", {updates: [diff --git a/apps/builder/e2e/fixtures/mcp-form-action-combination-author.ts b/apps/builder/e2e/fixtures/mcp-form-action-combination-author.tsindex 74df5123fb..e987694544 100644--- a/apps/builder/e2e/fixtures/mcp-form-action-combination-author.ts+++ b/apps/builder/e2e/fixtures/mcp-form-action-combination-author.ts@@ -297,7 +297,6 @@ const author = async () => {}const actions = created.slice(0, 10).map(({ dataSourceId }) => ({dataSourceId,- enabled: true,}));await call("update-props", {updates: [@@ -312,10 +311,7 @@ const author = async () => {instanceId: form.id,name: "action",type: "json",- value: [- ...actions,- { dataSourceId: created[10].dataSourceId, enabled: true },- ],+ value: [...actions, { dataSourceId: created[10].dataSourceId }],},],},@@ -349,12 +345,12 @@ const author = async () => {"graphql",`{ query: "mutation Record($name: String!) { record(name: $name) }", variables: { name: ${formData}.name } }`);- const disabled = await createAction("Disabled HTTP action", "/reject");+ const middle = await createAction("Middle HTTP action", "/submit");const http = await createAction("Last HTTP action", "/submit");const actions = [- { dataSourceId: graphql.dataSourceId, enabled: true },- { dataSourceId: disabled.dataSourceId, enabled: false },- { dataSourceId: http.dataSourceId, enabled: true },+ { dataSourceId: graphql.dataSourceId },+ { dataSourceId: middle.dataSourceId },+ { dataSourceId: http.dataSourceId },];await call("update-props", {updates: [@@ -375,7 +371,7 @@ const author = async () => {`${JSON.stringify({formId: form.id,graphqlResourceId: graphql.resourceId,- disabledResourceId: disabled.resourceId,+ middleResourceId: middle.resourceId,httpResourceId: http.resourceId,})}\n`);diff --git a/apps/builder/e2e/fixtures/mcp-form-callbacks-author.ts b/apps/builder/e2e/fixtures/mcp-form-callbacks-author.tsindex 15c551522e..d6027893b1 100644--- a/apps/builder/e2e/fixtures/mcp-form-callbacks-author.ts+++ b/apps/builder/e2e/fixtures/mcp-form-callbacks-author.ts@@ -367,7 +367,7 @@ const author = async () => {? { type: "resource", value: resource.resourceId }: {type: "json",- value: [{ dataSourceId: resource.dataSourceId, enabled: true }],+ value: [{ dataSourceId: resource.dataSourceId }],}),},{diff --git a/apps/builder/e2e/fixtures/mcp-form-context-author.ts b/apps/builder/e2e/fixtures/mcp-form-context-author.tsindex 199174acd0..27d5d0bd06 100644--- a/apps/builder/e2e/fixtures/mcp-form-context-author.ts+++ b/apps/builder/e2e/fixtures/mcp-form-context-author.ts@@ -307,7 +307,7 @@ const author = async () => {instanceId: formId,name: "action",type: "json",- value: [{ dataSourceId: resource.dataSourceId, enabled: true }],+ value: [{ dataSourceId: resource.dataSourceId }],},],});diff --git a/apps/builder/e2e/fixtures/mcp-form-data-string-author.ts b/apps/builder/e2e/fixtures/mcp-form-data-string-author.tsindex 381a2b1afd..67d7f926b2 100644--- a/apps/builder/e2e/fixtures/mcp-form-data-string-author.ts+++ b/apps/builder/e2e/fixtures/mcp-form-data-string-author.ts@@ -296,11 +296,11 @@ const author = async () => {instanceId: form.id,name: "action",type: "json",- value: [{ dataSourceId: owner.dataSourceId, enabled: true }],+ value: [{ dataSourceId: owner.dataSourceId }],},],});- const actions = [{ dataSourceId: owner.dataSourceId, enabled: true }];+ const actions = [{ dataSourceId: owner.dataSourceId }];const updatedInspection = await call("inspect-instance", {instanceId: form.id,include: ["props"],diff --git a/apps/builder/e2e/fixtures/mcp-graphql-resource-inspector-author.ts b/apps/builder/e2e/fixtures/mcp-graphql-resource-inspector-author.tsindex eea629649c..bf8db958b3 100644--- a/apps/builder/e2e/fixtures/mcp-graphql-resource-inspector-author.ts+++ b/apps/builder/e2e/fixtures/mcp-graphql-resource-inspector-author.ts@@ -265,7 +265,7 @@ const author = async () => {dataSourceName: "GraphQL inspection action",exposeAsDataSource: true,});- const actions = [{ dataSourceId: graphql.dataSourceId, enabled: true }];+ const actions = [{ dataSourceId: graphql.dataSourceId }];await call("update-props", {updates: [{ instanceId: form.id, name: "action", type: "json", value: actions },diff --git a/apps/builder/e2e/fixtures/mcp-managed-form-author.ts b/apps/builder/e2e/fixtures/mcp-managed-form-author.tsindex f59bc8a25f..07c843278a 100644--- a/apps/builder/e2e/fixtures/mcp-managed-form-author.ts+++ b/apps/builder/e2e/fixtures/mcp-managed-form-author.ts@@ -484,7 +484,6 @@ const author = async () => {value: [{dataSourceId: secondProjectEmail.dataSourceId,- enabled: true,},],},@@ -584,32 +583,30 @@ const author = async () => {const actions = emptyActionMode? []: formatMode- ? [{ dataSourceId: http.dataSourceId, enabled: true }]+ ? [{ dataSourceId: http.dataSourceId }]: [...(emailMode? emails.filter(({ name }) =>["Email to owner", "Email to visitor"].includes(name))- .map(({ dataSourceId }) => ({ dataSourceId, enabled: true }))+ .map(({ dataSourceId }) => ({ dataSourceId })): emailIsolationMode? projectRecipientsResource === undefined? []: [{dataSourceId: projectRecipientsResource.dataSourceId,- enabled: true,},]: redirectMode? authorOptions.fail === true- ? [{ dataSourceId: http.dataSourceId, enabled: true }]+ ? [{ dataSourceId: http.dataSourceId }]: successfulHttp === undefined? []: [{dataSourceId: successfulHttp.dataSourceId,- enabled: true,},]: [@@ -618,10 +615,9 @@ const author = async () => {: [{dataSourceId: successfulHttp.dataSourceId,- enabled: true,},]),- { dataSourceId: http.dataSourceId, enabled: true },+ { dataSourceId: http.dataSourceId },]),];const updates = [diff --git a/apps/builder/e2e/fixtures/mcp-managed-form-query-author.ts b/apps/builder/e2e/fixtures/mcp-managed-form-query-author.tsindex bb344c0a4f..301f2dda67 100644--- a/apps/builder/e2e/fixtures/mcp-managed-form-query-author.ts+++ b/apps/builder/e2e/fixtures/mcp-managed-form-query-author.ts@@ -292,7 +292,7 @@ const author = async () => {instanceId: formId,name: "action",type: "json",- value: [{ dataSourceId: resource.dataSourceId, enabled: true }],+ value: [{ dataSourceId: resource.dataSourceId }],},],});diff --git a/apps/builder/e2e/tests/mcp-form-action-combination.[shard-2].[shard-5].[shard-6].e2e.ts b/apps/builder/e2e/tests/mcp-form-action-combination.[shard-2].[shard-5].[shard-6].e2e.tsindex bdd9daaa03..ea6d267054 100644--- a/apps/builder/e2e/tests/mcp-form-action-combination.[shard-2].[shard-5].[shard-6].e2e.ts+++ b/apps/builder/e2e/tests/mcp-form-action-combination.[shard-2].[shard-5].[shard-6].e2e.ts@@ -12,7 +12,7 @@ import { test } from "../test";const execFileAsync = promisify(execFile);-test("MCP-authored Form dispatches enabled HTTP and GraphQL Actions in configured result order", async ({+test("MCP-authored Form dispatches all Actions in configured result order", async ({context,}) => {const fixture = await createContentModeProject({@@ -53,11 +53,11 @@ test("MCP-authored Form dispatches enabled HTTP and GraphQL Actions in configure},});- const { formId, graphqlResourceId, disabledResourceId, httpResourceId } =+ const { formId, graphqlResourceId, middleResourceId, httpResourceId } =JSON.parse(stdout) as {formId: string;graphqlResourceId: string;- disabledResourceId: string;+ middleResourceId: string;httpResourceId: string;};const receiver = await startFormDeliveryReceiver();@@ -102,17 +102,22 @@ test("MCP-authored Form dispatches enabled HTTP and GraphQL Actions in configureresourceName: "First GraphQL action",status: 200,}),+ expect.objectContaining({+ resourceId: middleResourceId,+ resourceName: "Middle HTTP action",+ status: 200,+ }),expect.objectContaining({resourceId: httpResourceId,resourceName: "Last HTTP action",status: 200,}),]);- expect(JSON.stringify(submission)).not.toContain(disabledResourceId);- expect(receiver.deliveries).toHaveLength(2);+ expect(receiver.deliveries).toHaveLength(3);expect(receiver.deliveries.map(({ pathname }) => pathname)).toEqual(["/submit","/submit",+ "/submit",]);const graphqlDelivery = receiver.deliveries.find(({ body }) =>body.includes("mutation Record")diff --git a/apps/builder/e2e/tests/mcp-form-action-concurrency.[shard-2].[shard-5].[shard-6].e2e.ts b/apps/builder/e2e/tests/mcp-form-action-concurrency.[shard-2].[shard-5].[shard-6].e2e.tsindex 25f692a611..dfe745d8ed 100644--- a/apps/builder/e2e/tests/mcp-form-action-concurrency.[shard-2].[shard-5].[shard-6].e2e.ts+++ b/apps/builder/e2e/tests/mcp-form-action-concurrency.[shard-2].[shard-5].[shard-6].e2e.ts@@ -31,10 +31,15 @@ const startBarrierReceiver = async () => {return;}deliveries.push(Buffer.concat(chunks).toString("utf8"));- if (deliveries.length > 2) {+ if (deliveries.length > 3) {response.writeHead(409).end();return;}+ if (barrierReached) {+ response.writeHead(200, { "content-type": "application/json" });+ response.end(JSON.stringify({ delivered: true }));+ return;+ }pending.push(response);if (pending.length === 1) {// A serial dispatcher can never get the second response before the first.@@ -76,7 +81,7 @@ const startBarrierReceiver = async () => {};};-test("MCP-authored Form starts both selected Actions before either receiver responds", async ({+test("MCP-authored Form starts connected Actions concurrently and runs all three", async ({context,}) => {const fixture = await createContentModeProject({@@ -110,12 +115,12 @@ test("MCP-authored Form starts both selected Actions before either receiver resp},});- const { formId, graphqlResourceId, httpResourceId, disabledResourceId } =+ const { formId, graphqlResourceId, httpResourceId, middleResourceId } =JSON.parse(stdout) as {formId: string;graphqlResourceId: string;httpResourceId: string;- disabledResourceId: string;+ middleResourceId: string;};const receiver = await startBarrierReceiver();try {@@ -159,10 +164,13 @@ test("MCP-authored Form starts both selected Actions before either receiver respresourceId: graphqlResourceId,status: 200,}),+ expect.objectContaining({+ resourceId: middleResourceId,+ status: 200,+ }),expect.objectContaining({ resourceId: httpResourceId, status: 200 }),]);- expect(JSON.stringify(submission)).not.toContain(disabledResourceId);- expect(receiver.deliveries).toHaveLength(2);+ expect(receiver.deliveries).toHaveLength(3);expect(receiver.deliveries.some((body) => body.includes("mutation Record"))).toBe(true);diff --git a/apps/builder/e2e/tests/preview-managed-form.[shard-2].[shard-5].[shard-6].e2e.ts b/apps/builder/e2e/tests/preview-managed-form.[shard-2].[shard-5].[shard-6].e2e.tsindex bf9b2d78ab..ab75c8e071 100644--- a/apps/builder/e2e/tests/preview-managed-form.[shard-2].[shard-5].[shard-6].e2e.ts+++ b/apps/builder/e2e/tests/preview-managed-form.[shard-2].[shard-5].[shard-6].e2e.ts@@ -63,7 +63,7 @@ test("Preview Form posts to the authenticated Builder and sets error state withoinstanceId: formId,name: "action",type: "json",- value: [{ dataSourceId: variableId, enabled: true }],+ value: [{ dataSourceId: variableId }],},{id: `${formId}:successRedirect`,@@ -231,7 +231,7 @@ test("Preview Form success redirects navigate matched pages and keep feedback foinstanceId: formId,name: "action",type: "json",- value: [{ dataSourceId: variableId, enabled: true }],+ value: [{ dataSourceId: variableId }],},{id: `${targetId}:id`,@@ -360,7 +360,7 @@ test("Preview Form success redirects navigate matched pages and keep feedback fo.toContain("done");});-test("Preview Form preserves browser FormData and renders configured failure results", async ({+test("Preview Form preserves browser FormData and runs legacy disabled actions in order", async ({page,context,}) => {@@ -648,12 +648,12 @@ test("Preview Form preserves browser FormData and renders configured failure resresult.results.map(({ resourceName }: { resourceName: string }) => resourceName)- ).toEqual(["First", "Last"]);+ ).toEqual(["First", "Disabled", "Last"]);expect(result.errors.map(({ resourceName }: { resourceName: string }) => resourceName)- ).toEqual(["First", "Last"]);+ ).toEqual(["First", "Disabled", "Last"]);expect(submissions).toHaveLength(1);const captured = await Promise.all(page@@ -675,7 +675,7 @@ test("Preview Form preserves browser FormData and renders configured failure resawait expect(form.getByRole("alert")).toBeVisible();await expect(form.getByText("Submission failed")).toBeVisible();await expect(form.getByRole("alert")).toContainText(result.errors[0].message);- await expect(form.getByText("First,Last")).toBeVisible();+ await expect(form.getByText("First,Disabled,Last")).toBeVisible();await expect(form.getByText("Sent successfully")).toHaveCount(0);await expect.poll(() =>diff --git a/docs/university/core-components/form.md b/docs/university/core-components/form.mdindex 5808f22f22..25f03ba623 100644--- a/docs/university/core-components/form.md+++ b/docs/university/core-components/form.md@@ -9,7 +9,7 @@ Use **Form** to send visitor input to HTTP or email [resources](../foundations/c## Configure actions1. Use the two email resources included in a new Form, or create HTTP, email, or GraphQL resources in **Variables**, on the Form or an ancestor.-2. Select the Form. In **Properties & Attributes > Action**, use the plus menu to choose up to ten visible resources. Each resource can be selected once; use the row controls to disable or remove an action. Edit a resource in **Variables**.+2. Select the Form. In **Properties & Attributes > Action**, use the plus menu to choose up to ten visible resources. Each resource can be selected once; use the row control to remove an action. Edit a resource in **Variables**.3. Give each input a **Name**. Its name identifies the submitted value in `formData`.4. Submit the Form in Builder Preview to test the current draft, or publish and test the deployed site.diff --git a/packages/cli/evaluations/high-impact/form-runtime.test.ts b/packages/cli/evaluations/high-impact/form-runtime.test.tsindex 2236cdfa1a..7d66d39ebe 100644--- a/packages/cli/evaluations/high-impact/form-runtime.test.ts+++ b/packages/cli/evaluations/high-impact/form-runtime.test.ts@@ -130,7 +130,7 @@ test("runtime validator requires the observed success, failure, recovery sequencinstanceId: "runtime-form",name: "action",type: "json",- value: [{ dataSourceId: "runtime-source", enabled: true }],+ value: [{ dataSourceId: "runtime-source" }],});project.dataSources.push({id: "runtime-source",@@ -171,6 +171,45 @@ test("runtime validator requires the observed success, failure, recovery sequencexpect(result.checks.runtimeObservedStates).toBe("passed");expect(result.checks.runtimeSessionPreview).toBe("passed");+ const withLegacyKey = structuredClone(project);+ withLegacyKey.props.find((prop) => prop.id === "action")!.value = [+ { dataSourceId: "runtime-source", enabled: false },+ ];+ expect(+ evaluateHighImpactOutcome({+ fixture: managedFormRuntimeFixture,+ project: withLegacyKey,+ toolCalls: [{ name: "meta.guide" }, ...submissions],+ formRuntimeDeliveries: [+ { path: "/submit", status: 200 },+ { path: "/reject", status: 503 },+ { path: "/reject", status: 503 },+ { path: "/submit", status: 200 },+ ],+ }).checks.runtimeFormAction+ ).toBe("passed");++ for (const value of [+ [{ dataSourceId: "unexpected" }],+ [{ dataSourceId: "runtime-source" }, { dataSourceId: "unexpected" }],+ ]) {+ const malformed = structuredClone(project);+ malformed.props.find((prop) => prop.id === "action")!.value = value;+ expect(+ evaluateHighImpactOutcome({+ fixture: managedFormRuntimeFixture,+ project: malformed,+ toolCalls: [{ name: "meta.guide" }, ...submissions],+ formRuntimeDeliveries: [+ { path: "/submit", status: 200 },+ { path: "/reject", status: 503 },+ { path: "/reject", status: 503 },+ { path: "/submit", status: 200 },+ ],+ }).checks.runtimeFormAction+ ).toBe("failed");+ }+project.resources[0].url = '"https://somewhere-else.example/submit"';expect(evaluateHighImpactOutcome({diff --git a/packages/cli/evaluations/high-impact/validate.test.ts b/packages/cli/evaluations/high-impact/validate.test.tsindex 757ac714f2..4e76cf3245 100644--- a/packages/cli/evaluations/high-impact/validate.test.ts+++ b/packages/cli/evaluations/high-impact/validate.test.ts@@ -199,8 +199,8 @@ const addManagedContactPage = (): EvaluationProject => {name: "action",type: "json",value: [- { dataSourceId: projectDataSourceId, enabled: true },- { dataSourceId: visitorDataSourceId, enabled: true },+ { dataSourceId: projectDataSourceId },+ { dataSourceId: visitorDataSourceId },],},{@@ -761,6 +761,31 @@ describe("high-impact fixture validation", () => {});describe("managed Form evaluation", () => {+ test("checks intended Form action IDs and order despite legacy keys", () => {+ const project = addManagedContactPage();+ const action = project.props.find(+ ({ instanceId, name }) =>+ instanceId === "contact-form" && name === "action"+ )!;+ const selected = action.value as Array<{ dataSourceId: string }>;+ action.value = selected.map((entry) => ({ ...entry, enabled: false }));+ expect(+ evaluateHighImpactOutcome({+ fixture: managedFormAuthoringFixture,+ project,+ toolCalls: managedFormCalls(),+ }).checks.formActionsPreserved+ ).toBe("passed");+ action.value = [selected[1], selected[0]];+ expect(+ evaluateHighImpactOutcome({+ fixture: managedFormAuthoringFixture,+ project,+ toolCalls: managedFormCalls(),+ }).checks.formActionsPreserved+ ).toBe("failed");+ });+test("accepts contact heading text inside an inline child", () => {const project = addManagedContactPage();const heading = project.instances.find(@@ -1140,7 +1165,7 @@ describe("Form modes evaluation", () => {instanceId: "mode-contact",name: "action",type: "json",- value: [{ dataSourceId: "email-owner", enabled: true }],+ value: [{ dataSourceId: "email-owner" }],},{id: "mode-search-actions",@@ -2258,7 +2283,7 @@ describe("Form modes authoring evaluation", () => {instanceId: "contact",name: "action",type: "json",- value: [{ dataSourceId: "email", enabled: true }],+ value: [{ dataSourceId: "email" }],},{id: "search-action",@@ -2295,7 +2320,7 @@ describe("Form modes authoring evaluation", () => {test("rejects the legacy identity and navigation with connected actions", () => {const invalid = project();invalid.instances[0].component = "WebhookForm";- invalid.props[1].value = [{ dataSourceId: "email", enabled: true }];+ invalid.props[1].value = [{ dataSourceId: "email" }];const result = evaluateHighImpactOutcome({fixture: formModesAuthoringFixture,project: invalid,diff --git a/packages/cli/evaluations/high-impact/validate.ts b/packages/cli/evaluations/high-impact/validate.tsindex d81e8ea02e..6a8d6e31c2 100644--- a/packages/cli/evaluations/high-impact/validate.ts+++ b/packages/cli/evaluations/high-impact/validate.ts@@ -813,7 +813,8 @@ const validateManagedFormAuthoring = (const orderedActions = selectedActions.map((selected) =>typeof selected === "object" &&selected !== null &&- "dataSourceId" in selected+ "dataSourceId" in selected &&+ typeof selected.dataSourceId === "string"? selected: undefined);@@ -864,10 +865,7 @@ const validateManagedFormAuthoring = (selectedActions.length === 2 &&scopedResources.every((resource, index) =>- orderedActions[index]?.dataSourceId === resource.dataSourceId &&- orderedActions[index] !== undefined &&- "enabled" in orderedActions[index] &&- orderedActions[index].enabled === true+ orderedActions[index]?.dataSourceId === resource.dataSourceId);const managedFormStructureComplete =formInstances.length === 1 &&@@ -2212,8 +2210,6 @@ const validateManagedFormRuntime = ((action) =>typeof action === "object" &&action !== null &&- "enabled" in action &&- action.enabled === true &&"dataSourceId" in action &&typeof action.dataSourceId === "string")@@ -2235,7 +2231,10 @@ const validateManagedFormRuntime = (failures,"runtimeFormAction",form !== undefined &&+ Array.isArray(actions) &&+ selected.length === actions.length &&selected.length === 1 &&+ selected[0]?.dataSourceId === "runtime-source" &&selectedResource?.method === "post" &&safeResourceUrl &&input.project.resources.every(diff --git a/packages/cli/src/docs.generated.ts b/packages/cli/src/docs.generated.tsindex 4731c715d5..dd0ed0fc10 100644--- a/packages/cli/src/docs.generated.ts+++ b/packages/cli/src/docs.generated.ts@@ -2,7 +2,7 @@// 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 compact machine-readable MCP tool overview. Add `--verbose` or use 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- `components.summary` returns counts by default; request `{"detail":"components","limit":20}` for paginated entries. Registry list tools return compact metadata, while `components.get` and `templates.get` return focused full details.\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 values and ids across every Builder namespace without sending full project data to the model.\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- Manage nested asset folders and upload, inspect, move, duplicate, download, replace, delete, and inspect usage for assets.\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 {}\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- Enter this workflow only when the user explicitly requests visual verification or opts in after being asked. Do not start preview, screenshots, diffs, OCR, or rendered audits automatically after a mutation.\n- `preview.status` reports whether generated output is `stale`. When no preview is running, `url`, `pid`, and `mode` are omitted. When present, `renderedProjectVersion` is the last project version materialized into the preview.\n- MCP preview and path-based screenshot tools select an available loopback port and return the preview URL. Do not pass `host` or `port`.\n- A managed `screenshot` or another `preview.start` refreshes stale generated output before capture.\n\n- After opt-in, use this so a vision-capable AI can see the generated site from the current MCP session. Use `path`; never pass a Webstudio Builder/share URL or capture Builder chrome.\n- For multi-page work, capture every changed page by `path` through the same preview server; no click navigation is required.\n- Iterative mode is the default: after MCP mutations, path screenshots ensure generated project files are current, wait for the exact session version, and perform an ordinary page reload without Vite HMR. The preview server and browser stay alive. Use `{"mode":"production"}` only for release-like verification; rendered audit does this automatically.\n- Calling `preview.start` after a committed mutation restarts a stale iterative server so external browsers and HTTP clients receive the newly generated project.\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- The screenshot timeout bounds browser capture after the preview is ready. A timeout returns `SCREENSHOT_TIMEOUT`, resets the reusable browser session, and releases the shared preview lifecycle for cleanup.\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- When launcher metadata is available, Preview reuses a supported npm or pnpm launcher. Without launcher metadata, it uses npm when available and otherwise falls back to pnpm.\n- Unless `npm_config_cache` is already configured, npm uses the writable `.webstudio/preview/.npm-cache` directory.\n- For npm cache permission errors, unset `npm_config_cache` to use the preview-local cache, then retry. No cache deletion is required.\n- If dependency installation fails, check the reported package-manager path 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 {}\n- MCP tool: list-folders {}\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` and `path` are plain values. Page `title` and metadata text fields contain expression source; quote fixed text as a JavaScript string literal inside the JSON string.\n- For computed page titles or metadata, send JavaScript expression code such as `pageTitle ?? "Pricing"`. An unquoted word is a variable reference.\n- CLI flags such as `--title` treat values as fixed text. Add `--expressions` to `webstudio create-page` when passing expression source through these flags; quote any fixed text in the same call as a JavaScript string expression.\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":{"method":"basic","login":"<login>","password":"<password>"}}}}\n\nNotes:\n\n- For fixed page `title` and metadata text, quote the text as a JavaScript string literal inside the JSON string.\n- For computed page titles or metadata, send JavaScript expression code such as `pageTitle ?? "Pricing"`. An unquoted word is a variable reference.\n- Page `status` accepts a fixed HTTP status code as a number from 200 through 599 or a JavaScript expression string for a dynamic status.\n- For `webstudio update-page`, add `--expressions` when page title or metadata flags contain expression source. Without it, those flags are fixed text.\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## Submit marketplace product\n\nCommands:\n\n- MCP tool: upload-asset {"asset":{"name":"marketplace-thumbnail.png","type":"image","format":"png","meta":{"width":1200,"height":630}},"assetsDir":".webstudio/assets"}\n- MCP tool: update-marketplace-product {"category":"pageTemplates","name":"Acme Template","thumbnailAssetId":"<uploadedAssetId>","author":"Acme Studio","email":"[email protected]","website":"https://example.com","issues":"","description":"Reusable template project for Acme landing pages."}\n- MCP tool: publish {"target":"production"}\n- MCP tool: submit-marketplace-product {"acknowledgePublicSubmission":true}\n\nNotes:\n\n- Wait for the production publish to complete before submitting the product for review.\n- Submission requires complete, valid marketplace metadata.\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- MCP tool: duplicate-page {"pageId":"<pageId>","name":"Paris","path":"/paris","substitutions":{"text":{"London":"Paris"},"variables":{"city":{"type":"string","value":"Paris"}}}}\n- webstudio duplicate-page --page <pageId> --name Paris --path /paris --substitutions \'{"text":{"London":"Paris"},"variables":{"city":{"type":"string","value":"Paris"}}}\' --json\n\nNotes:\n\n- Text substitutions replace exact fixed text only in the duplicated page\'s text children, string props, title, and metadata.\n- Variable substitutions are keyed by copied source-variable name and use typed variable values. The operation rejects missing or ambiguous names without committing a partial duplicate.\n- Existing expressions and cloned variable/resource references keep their remapped ids.\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\nCLI `create-page-template` and `update-page-template` use fixed text flags by default. Add `--expressions` when passing expression source through title or metadata flags.\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 {}\n- MCP tool: list-pages {}\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":"<section ws:style={css`padding: 32px;`}><h2>Product OS</h2><Switch><SwitchThumb /></Switch></section>"}\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- Use lowercase HTML JSX such as `<div>` and `<form>`. The internal `ws:` namespace is not HTML-tag shorthand.\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 `<Switch><SwitchThumb /></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 exactly one direct `ws:block-template` child. A missing or second template container makes the Content Block invalid. 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 implementation, inventory every editor-owned field and its intended control and write destination, whether or not the block uses MDX. Check that templates contain the required styling, but do not treat containment or a successful text edit as proof that the whole block is editable. Test every field through Content mode, inspect its saved project data or source file, reload, and restore the original value. Report passed, failed, or not tested for each field; missing or read-only required controls are unfinished requirements.\n- Use controls that match the content: a calendar for dates and an image picker for image replacement. Keep fixed punctuation and units out of directly bound value elements. Preserve stored types and wording: when reading time is already a complete string such as `4 min read`, bind that string directly rather than assuming it is a number.\n- For MDX-backed blocks, containment alone is not enough: the MDX body is editable through its source mapping, but the designed shell needs writable document-frontmatter bindings. Follow the binding recipe below rather than binding editable article fields to query results.\n\n## Store Content Block content in MDX\n\nCommands:\n\n- MCP tool: list-assets {"type":"file"}\n- MCP tool: upload-asset {"asset":{"name":"article.mdx","type":"file","format":"mdx","meta":{}},"assetsDir":".webstudio/assets"}\n- MCP tool: connect-content-block-source {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example","source":{"type":"asset","assetId":"<mdxAssetId>"}}\n- MCP tool: switch-content-block-source {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example","source":{"type":"asset","assetId":"<otherMdxAssetId>"}}\n- MCP tool: inspect-content-block-source {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example"}\n- MCP tool: edit-content-block-source {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example","source":"# Article title\\n\\nArticle body."}\n- MCP tool: update-content-block-frontmatter {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example","properties":{"title":"Article title","draft":false}}\n- MCP tool: reload-content-block-source {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example"}\n- MCP tool: migrate-content-block-template-references {"assetIds":["<mdxAssetId>"],"migration":{"type":"rename","from":"Old template name","to":"New template name"}}\n- MCP tool: disconnect-content-block-source {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example"}\n\nNotes:\n\n- Create the local `.mdx` file under `.webstudio/assets` before calling `upload-asset`. Use the returned Asset ID when connecting it.\n- Use the Content Block source operations for connecting, switching, inspecting, editing, reloading, and disconnecting. Do not create or delete the `src` prop with generic prop tools; the source operations preserve the Body outlet and Content Block lifecycle.\n- `renderScope` accepts any non-empty stable key for one rendered occurrence. Use a page-based key for a direct Content Block and a distinct key for each repeated Collection occurrence. It does not load a page, route parameters, or resource results. Supply the concrete scoped values needed to resolve an expression through `variables`.\n- For a result-one Assets resource, preview the concrete query, then connect its persisted expression with the previewed item supplied as `variables`, for example `source:{"type":"expression","value":"post.data.id"}` and `variables:{"post":{"data":{"id":"<mdxAssetId>"}}}`.\n- Connecting replaces existing Body content. If the result returns `requiresConfirmation:true`, report that replacement to the user and repeat the same call with `confirmReplacement:true` only after approval.\n- Prefer Markdown for standard document content; it automatically uses a unique matching semantic template when one exists. Use lowercase JSX such as `<section>` or `<svg>` for HTML or SVG with authored properties that Markdown cannot express.\n- Verify that the Content Block has exactly one direct Templates container before connecting or editing MDX. Zero or multiple containers block materialization and publication.\n- Read the Content Block\'s Templates children before writing a custom reference. Use capitalized JSX such as `<PromotionCard />` for its stable **Name**, which is independent from the display label. A matching template wins over a built-in MDX adapter. Other registered components are unavailable until added to this Content Block\'s Templates. JSX attributes accept quoted static values and bare booleans; expressions such as `{false}` are unsupported. Legacy `ws.element` and `ws:name` forms are compatibility input only. Component namespaces such as `$.*`, `radix.*`, and `animation.*` are unsupported.\n- When explicit JSX children match the designed template structure, their text and supported props overlay the cloned descendants and retain template styles. A mismatched child structure replaces the root defaults, while each authored child still resolves through a matching template when possible. An explicit empty pair clears defaults, and a self-closing reference keeps them. Editing inherited default content writes it back as explicit JSX children. Template resolution is live, so adding a matching semantic or named template later updates existing MDX. Preserve unresolved names and report their diagnostics instead of deleting them.\n- When a template is renamed or deleted, use `migrate-content-block-template-references` to update a selected set of affected MDX files. The first call returns a plan. Report its changed-file, update, omission, and diagnostic counts, then repeat the exact request with its `confirmationToken` only after approval. Renames and removals update named JSX and legacy `ws:name` references, including names such as `Image` and `CodeText` when they identify templates. Rename targets must be valid PascalCase JSX identifiers. Removing a paired reference unwraps and preserves its authored children; removing a self-closing reference removes the node because it has no authored children. Invalid files remain unchanged and are reported in diagnostics.\n- `edit-content-block-source` replaces the complete MDX source. Preserve frontmatter and unrelated source when making a bounded edit.\n- `update-content-block-frontmatter` replaces the complete frontmatter mapping. Inspect the current source first and include every property that must remain.\n- Store frontmatter images as exact `$ref` objects. Bind an editable Image source to the resolved `.src` with explicit `binding.mode:"readwrite"`; use `mode:"read"` for its alt binding to `.description`. Omitting the source mode leaves the image visible but not replaceable in Content mode.\n- Use `update-content-block-frontmatter` for MCP frontmatter edits. MDX-rendered elements are not persistent instance targets for generic `bind-props` or `update-text` calls. Preserve existing `mode:"readwrite"` bindings when encountered; they are valid only for exact direct paths into the connected document\'s frontmatter. Direct bindings through a loaded Markdown or MDX `$ref` ending in `#frontmatter` save to the referenced file, with its write permissions enforced. Shared-record edits affect every document using that record. Computed expressions and JSON/body references remain read-only. Image replacement is supported: a direct Image source binding with `mode:"readwrite"` lets the picker replace the frontmatter `$ref`, while shared Asset metadata is edited in Asset settings.\n- Inspect every returned diagnostic. Invalid MDX is saved rather than silently repaired; preserve the source, report the source range, and fix only the requested or invalid part.\n- If an edit in a long-lived MCP session reports a conflict after another client saved the Asset, call `reload-content-block-source`, inspect the latest source, reapply the requested change, and retry. One-shot CLI calls refresh before each operation and normally cannot reproduce a stale session. Never overwrite the newer revision blindly.\n\n## Make an MDX article header editable\n\nUse the resource only to select the connected source, for example `post.data.id`.\nBind article values inside the Content Block to its document parameter instead\nof `post.data.properties.*`. Inspect the block\'s variables first; `document` is\nthe default name, not a name to assume.\n\nThese commands target persistent designed instances inside the connected block.\n\nCommands:\n\n- MCP tool: update-text {"instanceId":"<headingInstanceId>","childIndex":0,"text":"document.frontmatter.title","mode":"expression","expressionBindingMode":"readwrite"}\n- MCP tool: update-text {"instanceId":"<readingTimeValueInstanceId>","childIndex":0,"text":"document.frontmatter.readingTime","mode":"expression","expressionBindingMode":"readwrite"}\n- MCP tool: bind-props {"bindings":[{"instanceId":"<dateInstanceId>","name":"datetime","binding":{"type":"expression","value":"document.frontmatter.publishedAt","mode":"readwrite"}}]}\n\nNotes:\n\n- Create writable bindings explicitly; the default is read-only. Merely moving a heading or Link inside the Content Block does not make its query-bound text editable.\n- The MDX body uses its source mapping. Static designed content outside that body remains protected unless its text or supported props bind to writable frontmatter fields. Do not apply these generic instance tools to MDX-generated instances.\n- Use direct static paths. Property access is already safe. Fallbacks and formatted expressions, such as `document.frontmatter.title ?? "Untitled"`, remain read-only.\n- Keep every intended editable value in its own text element with a single direct read-write binding. For reading time, use three inline siblings: static `— `, the bound reading-time value, and static ` min read`. Preserve whitespace and the stored field type. Do not combine them into a template literal or concatenate strings, and do not put literal siblings inside the value element itself. Keep fixed wording protected in the designed shell.\n- Prefer component formatting controls, such as Date Time formatting with a directly bound date prop, over transforming the expression. Do not silently sacrifice editability for formatting or a fallback; explain unsupported cases and ask before making an intended editable field read-only.\n- A direct writable binding such as `document.frontmatter.author.name` can edit a shared author loaded through `../authors/acme.md#frontmatter`. The edit saves to the author file and affects every article using it; preserve the article\'s `$ref` marker.\n- Before handoff, inventory every article-owned field, including header text, author details, dates, reading time, categories, hero and inline image sources, alternative text, captions, links, and custom-component content. For each field, inspect its binding and source, edit it through the Content-mode UI, verify the saved MDX or referenced file, reload, and restore the test value. Record passed, failed, or not tested for each field. A correct preview, a successful MCP write, and one representative text edit do not prove the whole article is editable. Do not claim completion while required fields fail or remain untested.\n- Bind the Image source directly to `document.frontmatter.featureImage.src` with `binding.mode:"readwrite"` using `bind-props`. Content mode\'s **Choose source** replaces the article\'s frontmatter image `$ref`; the resolved URL stays read-only. Verify selection, the saved reference, and reload instead of treating a missing write mode as a platform limitation. For alternative text bound to `.description`, use **Choose source → asset actions → Settings → Description** to edit shared Asset metadata. This affects every use of the Asset and is separate from replacing an article\'s image.\n\n## Make an article image replaceable in Content mode\n\nUse this for a persistent designed Image inside a connected Content Block,\nwith `featureImage: { $ref: "./images/hero.png" }` in its MDX frontmatter.\nRead the instance ID and document variable name before adapting the example.\n\nCommands:\n\n- MCP tool: bind-props {"bindings":[{"instanceId":"<imageInstanceId>","name":"src","binding":{"type":"expression","value":"document.frontmatter.featureImage.src","mode":"readwrite"}},{"instanceId":"<imageInstanceId>","name":"alt","binding":{"type":"expression","value":"document.frontmatter.featureImage.description","mode":"read"}}]}\n\nNotes:\n\n- The source mode must be explicit: the default `read` mode displays the image but prevents Content-mode replacement. Do not bind to query-result properties or add a fallback expression.\n- **Choose source** replaces the article\'s `featureImage.$ref`; the disabled resolved-URL input is expected. Do not store a resolved URL string or replace the shared Asset itself.\n- Shared alternative text is a separate action: **Choose source → asset actions → Settings → Description**. Its read-only binding does not require the image source binding to be read-only.\n- If the picker is missing or disabled, inspect the source mode, document scope, loaded reference, and permissions before claiming a product limitation.\n- Verify through Content mode with an approved temporary replacement. Check the saved `$ref`, unchanged unrelated MDX and original shared Asset, reload persistence, and restoration. If that test is not authorized, report it as not tested, not passed.\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: bind-props {"bindings":[{"instanceId":"<jsonLdInstanceId>","name":"code","binding":{"type":"expression","value":"({ \'@context\': \'https://schema.org\', \'@type\': \'Article\', headline: post.title })"}}]}\n- MCP tool: audit {"scopes":["seo"],"pagePath":"/"}\n\nNotes:\n\n- Prefer placing `JsonLd` inside `HeadSlot`.\n- For fixed structured data, store `code` as a JSON object or array encoded as a compact string. The Builder formats it for editing.\n- For structured data containing runtime values, use `bind-props` with an expression that evaluates directly to an object or array. Do not call `JSON.stringify` or assemble JSON with string concatenation. Webstudio stores the expression as source text, evaluates it at runtime, and the `JsonLd` component validates and serializes the resulting value.\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 {"verbose":true}\n\nNotes:\n\n- The default response is compact and includes token id, name, declaration count, and optional usage count.\n- Use `verbose: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":{"--color-primary":"#2d3748","--color-accent":"#e53e3e","--space-card":"1.5rem"},"overwrite":true}\n\nNotes:\n\n- Define or overwrite multiple CSS variables atomically by including every name and value in one `vars` object.\n- Pass colors as CSS strings. Structured `hex` color components use normalized values from `0` to `1`, not `0` to `255`.\n\n## Delete CSS variables\n\nCommands:\n\n- MCP tool: delete-css-variable {"names":["--color-primary","--color-accent","--space-card"],"force":true}\n\nNotes:\n\n- Delete multiple CSS variables atomically by including every name in one `names` array. Destructive MCP calls still require the returned confirmation token before they commit.\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":"json","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`, and `json`. Use `json` for all arrays and objects.\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`. A query key with one value is a string; repeated values are an ordered array. For `?tag=red&tag=blue`, `system.search.tag` is `["red", "blue"]`.\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## Configure Form (Beta) through MCP\n\nUse the exact component id returned by `components.search` for **Form (Beta)**.\nAfter inserting its registered template, use the Form instance id for the\nForm-scoped Resource and Action settings.\n\nThe new Form\'s canonical component id is `Form`. The deprecated legacy\nWebhook Form remains available in Builder for existing projects until the next\nrelease, but is omitted from MCP component discovery. `RemixForm` is deprecated\ncompatibility and should not be used for new projects. Always use registry\ndiscovery instead of assuming the display label is its component id.\n\nThe new Form has two modes derived from its Action array:\n\n- One or more connected Resources: the rendered action is\n `?__webstudio__=resources` and submission runs the enabled Resource actions.\n- No connected Resources (`action: []`): the rendered action is\n `?__webstudio__=navigate` and submission updates URL query parameters through\n client-side navigation. Use this for search and filters with page Resources\n bound to `system.search`. Removing the last Action switches to Navigation mode;\n disabling an Action does not remove it.\n- For ordinary browser submission, insert an `Element` with `tag: "form"`.\n It has no managed action marker and retains native browser behavior.\n\nDo not write the `__webstudio__` marker as a project Action value: that prop holds\nResource selections, and the runtime derives the HTML action URL from it.\nVerify both modes through MCP in a real project: add Resource actions, remove\nall actions for a search/filter form, then reconnect them. Check the rendered\naction, query navigation without a full reload, and Resource execution. Also\nverify a plain form Element remains native. A saved project snapshot alone does\nnot prove these runtime behaviors.\n\nCommands:\n\n- MCP tool: insert-component {"parentInstanceId":"<parentInstanceId>","component":"<componentId from components.search>"}\n- MCP tool: create-resource {"resource":{"name":"Send submission","method":"post","url":"https://api.example.com/submit","headers":[],"body":"formData"},"scopeInstanceId":"<formInstanceId>","dataSourceName":"Send submission","exposeAsDataSource":true}\n- MCP tool: update-props {"updates":[{"instanceId":"<formInstanceId>","name":"action","type":"json","value":[{"dataSourceId":"<returned dataSourceId>","enabled":true}]}]}\n- MCP tool: update-resource {"resourceId":"<emailResourceId>","values":{"email":{"recipientMode":"visitor","visitorEmailField":"email","includeAttachments":true}}}\n- MCP tool: update-project-settings {"meta":{"emailSender":"Acme <[email protected]>"}}\n\nNotes:\n\n- Use `update-props` with a JSON Action array to add, order, enable, disable, or remove destinations. The Action entries use `{ "dataSourceId": "...", "enabled": true }` and support up to ten Resources, matching the Builder control.\n- Create each destination Resource in the Form\'s scope so it can use `formData` and `browserInfo`. Set `exposeAsDataSource:true` to receive the data-source id used by the Action array. When a Resource uses Form-only parameters, it is kept out of page-load requests and runs with the Form submission.\n- `update-resource` accepts the same Email settings as the Builder: project, custom, or visitor recipients; sender; subject; body; and submitted-file attachments. Use expressions in string fields for dynamic values.\n- `update-project-settings` edits the project-wide Email recipients and Reply to. `update-props` also sets Form fields and Success redirect, while `bind-props` supplies dynamic expressions. `insert-component` uses the registered Form template, including its default contact fields and Email Actions. Set subject and body on each Email Resource.\n- MCP mutations update saved project configuration. To test real delivery, submit the Form in Preview or on a published test site and inspect the configured destinations.\n\n## Query Markdown assets\n\nCommands:\n\n- MCP tool: get-asset-field-catalog {}\n- MCP tool: validate-asset-query {"query":{"where":{"all":[{"field":["extension"],"operator":"eq","value":"md"},{"field":["properties","draft"],"operator":"ne","value":true}]},"limit":20}}\n- MCP tool: create-assets-resource {"name":"All assets","scopeInstanceId":"<instanceId>","dataSourceName":"assets"}\n- MCP tool: create-assets-resource {"name":"Published posts","scopeInstanceId":"<instanceId>","dataSourceName":"posts","query":{"result":"many","where":{"all":[{"field":["extension"],"operator":"eq","value":{"type":"literal","value":"md"}},{"field":["properties","draft"],"operator":"ne","value":{"type":"literal","value":true}}]},"sort":[{"field":["properties","publishedAt"],"direction":"desc"}],"limit":{"type":"literal","value":20},"output":{"mode":"fields","includeMetadata":false,"fields":[["properties","title"],["properties","slug"],["properties","publishedAt"],["properties","excerpt"]]},"content":{"mode":"none"}}}\n- MCP tool: create-assets-resource {"name":"Post by slug or ID","scopeInstanceId":"<instanceId>","dataSourceName":"post","query":{"result":"one","where":{"all":[{"field":["extension"],"operator":"eq","value":{"type":"literal","value":"md"}},{"field":["properties","slug"],"operator":"eq","value":"system.params.slug"}]},"output":{"mode":"fields","includeMetadata":false,"fields":[["properties","title"],["properties","publishedAt"]]},"content":{"mode":"markdown-body-ref"}}}\n- MCP tool: list-assets-resources {}\n- MCP tool: get-assets-resource {"resourceId":"<resourceId>"}\n- MCP tool: update-assets-resource {"resourceId":"<resourceId>","values":{"query":null}}\n- MCP tool: preview-asset-query {"query":{"result":"one","where":{"all":[{"field":["extension"],"operator":"eq","value":"md"},{"field":["properties","slug"],"operator":"eq","value":"hello-world"}]},"output":{"mode":"fields","includeMetadata":false,"fields":[["properties","title"]]},"content":{"mode":"markdown-body-ref"}}}\n\nNotes:\n\n- Choose `.mdx` connected to a Content Block when editors must edit article bodies visually in Content mode. Publishing downloads and compiles every reachable MDX article, so more articles can slow publishing. Choose `.md` with Markdown Embed when editing the source in Assets is enough; Content mode editors can still edit the Markdown file there, but not its body on the canvas. `.md` needs no per-article MDX compilation, though the publish runner still synchronizes Asset files for both formats and static generation may read Markdown bodies.\n- Read the field catalog before authoring unfamiliar queries. It includes dynamic schema-less frontmatter paths such as `properties.author.name`, observed types, optionality, and mixed-type state without downloading the source files.\n- Minimize the deployed content database by using `output.mode:"fields"` and selecting only fields the rendered page needs. Keep `includeMetadata:false` unless the rendered value needs file metadata such as name, path, MIME type, or creation date, and avoid `output.mode:"all"` as a convenience default. Query diagnostics are returned separately and do not require metadata output. Filters and sorting may still require their referenced fields in the database.\n- Every reachable Assets data source contributes to the shared published database. Keep one final resource per rendered query. Update an existing scoped resource rather than creating a placeholder, preview copy, or repair replacement, and remove obsolete duplicates.\n- Keep bounded overview filters, limits, and offsets literal and add a deterministic ID tie-breaker to the sort. With `content.mode:"none"`, compilation can materialize the small overview result instead of retaining its output fields across every candidate document. Use runtime expressions only for genuinely dynamic values such as the detail slug.\n- Combine filters with `where.all` (AND) and `where.any` (OR), including nested groups. Filter values, limit, and offset on a saved resource may be Webstudio expressions evaluated at render time. Preview queries use concrete JSON values.\n- Query Markdown or MDX files directly and use `content.mode:"markdown-body-ref"` when rendering their bodies. The published database retains metadata and a document reference, then fetches only the selected files from Asset storage at runtime; it does not embed their bodies. Filter and paginate before content is loaded.\n- `full` and bounded `range` continue to request embedded file bytes. Use them only when the caller requires the complete source or a byte range.\n- In Markdown or MDX, reference sibling Assets with conventional relative URLs such as `../images/hero.png`. Deferred `markdown-body-ref` content resolves matching files against the document\'s folder and emits the correct Builder or published Asset URL. Keep external URLs absolute.\n- Markdown Embed renders sanitized authored HTML for figures, captions, audio, video, and iframes. Scripts, inline event handlers, `srcdoc`, and unsafe URL protocols are removed. It does not render Webstudio MDX elements; connect the `.mdx` file to a Content Block for that workflow.\n- Preview each query with concrete values before saving it. Inspect `__diagnostics__.query` for the temporary query-only footprint and `__diagnostics__.database` for the merged database built from all reachable Assets queries. Only `database.usedBytes` counts toward `database.maxBytes`; query sizes must not be summed and are not separate allowances. Compare `usedBytes`, `unboundedBytes`, and `truncated` within both scopes. A completed Markdown blog should include every source document without truncation, contain no embedded Markdown bodies, and retain only its intended materialized overview query. When merged usage approaches the limit, remove duplicate reachable resources first, then unused output fields, then narrow candidate files.\n- Use `result:"many"` for listings. It returns the ID-keyed map at `<dataSourceName>.data`, with `totalCount` and `hasMore` at `<dataSourceName>.meta`, and remains the default for existing queries. Bind a listing Collection to `posts.data`.\n- Use `result:"one"` for a unique detail route. It returns the selected item or `null` directly at `post.data`, always includes its `id`, and omits pagination. Bind components and page settings directly with expressions such as `post.data.properties.title`, `post.data.content.text`, and `post.data ? 200 : 404`. `result:"first"` and `result:"last"` also return a direct item or `null` but require explicit sorting.\n- Assets always executes a structured query. Omit `query` to use the default many-result query, which selects URL and optional image dimensions. Set `values.query:null` to restore it.\n- `create-assets-resource` and `update-assets-resource` are the semantic authoring path. Do not construct the internal query URL, headers, or body expression manually.\n- The shared metadata index is maintained automatically and is emitted only when a configured Assets resource is reachable.\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- MCP tool: list-assets {"verbose":true}\n\nNotes:\n\n- Compact results include each asset\'s folder id. Use `verbose:true` to include complete records for a page of assets, or `get-asset` to read one complete record including description, folder, creation time, and image/font metadata.\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## Get asset\n\nCommands:\n\n- MCP tool: get-asset {"assetId":"<assetId>"}\n\n## List asset folders\n\nCommands:\n\n- MCP tool: list-asset-folders {}\n\n## Create asset folder\n\nCommands:\n\n- MCP tool: create-asset-folder {"name":"Marketing"}\n- MCP tool: create-asset-folder {"name":"Photos","parentId":"<parentFolderId>"}\n\n## Update asset folder\n\nCommands:\n\n- MCP tool: update-asset-folder {"folderId":"<folderId>","values":{"name":"Brand"}}\n- MCP tool: update-asset-folder {"folderId":"<folderId>","values":{"parentId":"<parentFolderId>"}}\n- MCP tool: update-asset-folder {"folderId":"<folderId>","values":{"parentId":null}}\n\nNotes:\n\n- Updating `parentId` is the folder equivalent of cut and paste. Use `null` to move a folder to Root.\n\n## Duplicate asset folder\n\nCommands:\n\n- MCP tool: duplicate-asset-folder {"folderId":"<folderId>"}\n- MCP tool: duplicate-asset-folder {"folderId":"<folderId>","parentId":"<targetFolderId>"}\n\nNotes:\n\n- Duplication recursively copies descendant folders and assets. This is the folder equivalent of copy and paste.\n\n## Delete asset folder\n\nCommands:\n\n- MCP tool: delete-asset-folder {"folderId":"<folderId>"}\n\nNotes:\n\n- Deleting a folder recursively deletes its descendant folders and assets.\n\n## Update asset metadata\n\nCommands:\n\n- MCP tool: update-asset {"assetId":"<assetId>","values":{"description":"Team collaborating around a whiteboard"}}\n- MCP tool: update-asset {"assetId":"<fontAssetId>","values":{"meta":{"family":"Rajdhani","style":"normal","weight":600}}}\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- Font metadata updates merge with the detected metadata and are validated before committing; use this to correct a family, style, or weight after upload.\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- MCP tool: upload-asset {"asset":{"name":"image.png","type":"image","format":"png","folderId":"<folderId>","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\nNotes:\n\n- Multi-file uploads return `uploaded`, `failed`, and `ambiguous` lists with the\n original input index. Retry only `failed` files. A forced upload in\n `ambiguous` may already be committed; inspect the Assets list before deciding\n whether to upload it again. Successful uploads remain committed.\n\n## Duplicate asset\n\nCommands:\n\n- MCP tool: duplicate-asset {"assetId":"<assetId>"}\n- MCP tool: duplicate-asset {"assetId":"<assetId>","folderId":"<targetFolderId>"}\n- MCP tool: duplicate-asset {"assetId":"<assetId>","folderId":null}\n\nNotes:\n\n- Duplication is the asset equivalent of copy and paste. Updating `folderId` is the equivalent of cut and paste; use `null` for Root.\n\n## Download asset\n\nCommands:\n\n- MCP tool: download-asset {"assetId":"<assetId>"}\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- MCP tool: submit-marketplace-product {"acknowledgePublicSubmission":true}\n\nPatch namespaces:\n\n- marketplaceProduct\n\n## Search and inspect safely\n\nCommands:\n\n- webstudio search-project \'{"query":"pricing"}\'\n- MCP tool: search-project {"query":"pricing"}\n- MCP tool: search-project {"query":"api.example.com","namespaces":["resources"]}\n- MCP tool: search-project {"query":"Brand","namespaces":["styles","styleSources","styleSourceSelections"]}\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- `search-project` is a standalone local-session command over every Builder namespace. It returns matching values with stable match ids, namespace paths, owning entities, references, and affected pages.\n- Use it when a value or id is known. Use list/get tools when the project structure or target is not known.\n- The command synchronizes its required Builder namespaces, then searches locally and returns only matches. Namespace filters limit values matched; related namespaces may still supply route and reference context, and synchronization is unchanged. This reduces data passed to the model, not the initial project-data synchronization.\n- Asset records and file metadata are searchable. Asset binary or document contents are not Builder namespace data and are not searched.\n- Values in recognized credential fields are excluded and counted in `excludedSensitiveValueCount`.\n- 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 {"scopes":["craft"],"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- Craft is opt-in and read-only. Run `audit` with `scopes:["craft"]` to detect whether the project is not using Craft, partially compatible, or compatible with the versioned Craft 1.2 profile. `profileStatuses` includes the University-doc provenance and the smallest safe next action. The audit never installs Craft or changes a non-Craft project.\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## Verify dynamic bindings\n\nCommands:\n\n- webstudio verify-bindings --json\n- MCP tool: verify-bindings {"pagePath":"/pricing"}\n- MCP tool: verify-bindings {"instanceId":"<instanceId>","limit":50}\n\nNotes:\n\n- Statically checks persisted text expressions, expression/action/resource/parameter props, resource expressions, and page metadata.\n- Findings distinguish invalid syntax, unknown or out-of-scope variables, stale internal data-source ids, and missing resource or parameter references.\n- Page and instance filters can be combined when the instance belongs to the selected page. Continue findings with `cursor`.\n- This operation does not resolve rendered values or execute external resources. Preview representative loading, empty, error, and populated states after static findings are fixed.\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 {}\n- MCP tool: list-folders {}\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":"json","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":"<article><h2>{expression`collectionItem.title`}</h2></article>"}\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: integrate-runtime-ui {"parentInstanceId":"<instanceId>","resources":[{"resource":{"name":"Seats","method":"get","url":"https://api.example.com/seats","headers":[]},"dataSourceName":"Seats","exposeAsDataSource":true}],"structure":{"type":"collection","data":{"type":"expression","value":"Seats.data"},"itemFragment":{"children":[{"type":"id","value":"seat"}],"instances":[{"type":"instance","id":"seat","component":"Text","children":[{"type":"expression","value":"collectionItem.label"}]}],"props":[],"dataSources":[],"resources":[],"styleSources":[],"styleSourceSelections":[],"styles":[],"breakpoints":[],"assets":[]}},"retainedBehavior":[{"instanceId":"<scriptInstanceId>","responsibility":"Seat selection behavior"}]}\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 `integrate-runtime-ui` to create variables/resources, insert one editable fragment or Collection, and add safe data bindings in one transaction.\n- List existing script-owned responsibilities under `retainedBehavior`. The operation preserves those instances and never evaluates or accepts replacement script bodies.\n- `unsupportedConversions` records behavior that cannot be represented safely. Dry-run returns the complete transaction and the same retained/unsupported report without changing the project.\n- New actions and HtmlEmbed scripts are intentionally rejected. Create normal editable components and data bindings; keep opaque runtime behavior in existing script instances.\n\n## Build authenticated pages\n\nCommands:\n\n- MCP tool: meta.guide {"brief":"Build a Supabase-authenticated account page","taskScope":"structural-project-change","workflow":"authenticated-page"}\n- MCP tool: create-page {"name":"Account","path":"/account"}\n- MCP tool: update-page {"pageId":"<pageId>","values":{"meta":{"auth":{"method":"basic","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- Inspect and reuse the project\'s existing auth convention before authoring. Do\n not add a second provider or session model implicitly.\n- Model signed-out, loading, signed-in, and failed-auth states explicitly.\n- Never store credentials, service-role keys, refresh tokens, private session\n values, or authenticated response bodies in project data, command output,\n screenshots, agent instructions, or error reports. Privileged provider calls\n and authorization enforcement belong server-side.\n- Basic auth is semantic today. Provider-specific Supabase/Firebase setup still\n uses the existing resource, variable, prop, binding, and embed tools; there is\n no provider-specific installer.\n\n## Generate from design input\n\nCommands:\n\n- MCP tool: meta.guide {"brief":"Recreate this Figma design as a responsive page","taskScope":"visual-change","workflow":"design-input"}\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: list-breakpoints {}\n- MCP tool: insert-fragment {"parentInstanceId":"<instanceId>","fragment":"<section><p>Section copy</p></section>"}\n- MCP tool: update-styles {"updates":[{"instanceId":"<instanceId>","breakpoint":"<breakpointId-from-list-breakpoints>","property":"padding-left","value":{"type":"unit","unit":"px","value":24}}]}\n- MCP tool: preview.start {}\n- MCP tool: screenshot {"path":"/landing","output":"landing-desktop.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n- MCP tool: screenshot {"path":"/landing","output":"landing-mobile.png","viewport":{"width":390,"height":844},"waitUntil":"load","waitForTimeout":250}\n- MCP tool: screenshot {"baseUrl":"http://127.0.0.1:5177","path":"/landing","output":"landing-desktop.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n\nNotes:\n\n- Use this after the agent can inspect the supplied design. There is no direct\n Figma, screenshot, Inception, or `design.md` import command.\n- Inspect and reuse existing variables, tokens, styles, components, assets, and\n page patterns before authoring. Build semantic editable structure rather than\n flattening the design into an image or absolute-positioned approximation.\n- Ask whether the user wants visual verification unless they explicitly requested\n it. If they decline, stop after focused reads and a static audit. If they opt\n in, verify one familiar viewport inside every distinct Builder breakpoint\n range, then run rendered audit and inspect the screenshots before completion.\n\n## Cross-project maintenance\n\nCommands:\n\n- webstudio mcp run .temp/projects.json\n- webstudio mcp run .temp/projects.json --dry-run\n- webstudio mcp run .temp/projects.json --approve-mutations --concurrency 2\n\nNotes:\n\n- Put shared `calls` and a `projects` array of independently linked project roots in the existing `mcp run` manifest. Project roots are relative to the manifest file.\n- Each project uses its own config, authentication, ProjectSession storage, checkpoint, and failure boundary. Confirmed successful calls are checkpointed. Reads can resume automatically; a mutation interrupted after dispatch is reported as ambiguous and is not replayed automatically, preventing silent duplicate writes.\n- Focus the manifest on bounded reads or audits first. Use per-call `dryRun`, global `--dry-run`, or explicitly approve committed mutations with `--approve-mutations` after reviewing the manifest.\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:\nCall `meta.guide` with `workflow:"authenticated-page"`, then create the\npage, resources, variables, props, bindings, and embeds with existing semantic\ntools.\n\nSuggested commands:\n\n- setup-auth-page\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:\nCall `meta.guide` with `workflow:"design-input"`, let the agent inspect the supplied\ndesign, then use semantic page, token, asset, fragment, style, preview,\nscreenshot, and audit tools. Use `apply-patch` only when no semantic operation\nfits.\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 compact machine-readable MCP tool overview. Add `--verbose` or use 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- `components.summary` returns counts by default; request `{"detail":"components","limit":20}` for paginated entries. Registry list tools return compact metadata, while `components.get` and `templates.get` return focused full details.\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 values and ids across every Builder namespace without sending full project data to the model.\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- Manage nested asset folders and upload, inspect, move, duplicate, download, replace, delete, and inspect usage for assets.\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 {}\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- Enter this workflow only when the user explicitly requests visual verification or opts in after being asked. Do not start preview, screenshots, diffs, OCR, or rendered audits automatically after a mutation.\n- `preview.status` reports whether generated output is `stale`. When no preview is running, `url`, `pid`, and `mode` are omitted. When present, `renderedProjectVersion` is the last project version materialized into the preview.\n- MCP preview and path-based screenshot tools select an available loopback port and return the preview URL. Do not pass `host` or `port`.\n- A managed `screenshot` or another `preview.start` refreshes stale generated output before capture.\n\n- After opt-in, use this so a vision-capable AI can see the generated site from the current MCP session. Use `path`; never pass a Webstudio Builder/share URL or capture Builder chrome.\n- For multi-page work, capture every changed page by `path` through the same preview server; no click navigation is required.\n- Iterative mode is the default: after MCP mutations, path screenshots ensure generated project files are current, wait for the exact session version, and perform an ordinary page reload without Vite HMR. The preview server and browser stay alive. Use `{"mode":"production"}` only for release-like verification; rendered audit does this automatically.\n- Calling `preview.start` after a committed mutation restarts a stale iterative server so external browsers and HTTP clients receive the newly generated project.\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- The screenshot timeout bounds browser capture after the preview is ready. A timeout returns `SCREENSHOT_TIMEOUT`, resets the reusable browser session, and releases the shared preview lifecycle for cleanup.\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- When launcher metadata is available, Preview reuses a supported npm or pnpm launcher. Without launcher metadata, it uses npm when available and otherwise falls back to pnpm.\n- Unless `npm_config_cache` is already configured, npm uses the writable `.webstudio/preview/.npm-cache` directory.\n- For npm cache permission errors, unset `npm_config_cache` to use the preview-local cache, then retry. No cache deletion is required.\n- If dependency installation fails, check the reported package-manager path 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 {}\n- MCP tool: list-folders {}\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` and `path` are plain values. Page `title` and metadata text fields contain expression source; quote fixed text as a JavaScript string literal inside the JSON string.\n- For computed page titles or metadata, send JavaScript expression code such as `pageTitle ?? "Pricing"`. An unquoted word is a variable reference.\n- CLI flags such as `--title` treat values as fixed text. Add `--expressions` to `webstudio create-page` when passing expression source through these flags; quote any fixed text in the same call as a JavaScript string expression.\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":{"method":"basic","login":"<login>","password":"<password>"}}}}\n\nNotes:\n\n- For fixed page `title` and metadata text, quote the text as a JavaScript string literal inside the JSON string.\n- For computed page titles or metadata, send JavaScript expression code such as `pageTitle ?? "Pricing"`. An unquoted word is a variable reference.\n- Page `status` accepts a fixed HTTP status code as a number from 200 through 599 or a JavaScript expression string for a dynamic status.\n- For `webstudio update-page`, add `--expressions` when page title or metadata flags contain expression source. Without it, those flags are fixed text.\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## Submit marketplace product\n\nCommands:\n\n- MCP tool: upload-asset {"asset":{"name":"marketplace-thumbnail.png","type":"image","format":"png","meta":{"width":1200,"height":630}},"assetsDir":".webstudio/assets"}\n- MCP tool: update-marketplace-product {"category":"pageTemplates","name":"Acme Template","thumbnailAssetId":"<uploadedAssetId>","author":"Acme Studio","email":"[email protected]","website":"https://example.com","issues":"","description":"Reusable template project for Acme landing pages."}\n- MCP tool: publish {"target":"production"}\n- MCP tool: submit-marketplace-product {"acknowledgePublicSubmission":true}\n\nNotes:\n\n- Wait for the production publish to complete before submitting the product for review.\n- Submission requires complete, valid marketplace metadata.\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- MCP tool: duplicate-page {"pageId":"<pageId>","name":"Paris","path":"/paris","substitutions":{"text":{"London":"Paris"},"variables":{"city":{"type":"string","value":"Paris"}}}}\n- webstudio duplicate-page --page <pageId> --name Paris --path /paris --substitutions \'{"text":{"London":"Paris"},"variables":{"city":{"type":"string","value":"Paris"}}}\' --json\n\nNotes:\n\n- Text substitutions replace exact fixed text only in the duplicated page\'s text children, string props, title, and metadata.\n- Variable substitutions are keyed by copied source-variable name and use typed variable values. The operation rejects missing or ambiguous names without committing a partial duplicate.\n- Existing expressions and cloned variable/resource references keep their remapped ids.\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\nCLI `create-page-template` and `update-page-template` use fixed text flags by default. Add `--expressions` when passing expression source through title or metadata flags.\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 {}\n- MCP tool: list-pages {}\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":"<section ws:style={css`padding: 32px;`}><h2>Product OS</h2><Switch><SwitchThumb /></Switch></section>"}\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- Use lowercase HTML JSX such as `<div>` and `<form>`. The internal `ws:` namespace is not HTML-tag shorthand.\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 `<Switch><SwitchThumb /></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 exactly one direct `ws:block-template` child. A missing or second template container makes the Content Block invalid. 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 implementation, inventory every editor-owned field and its intended control and write destination, whether or not the block uses MDX. Check that templates contain the required styling, but do not treat containment or a successful text edit as proof that the whole block is editable. Test every field through Content mode, inspect its saved project data or source file, reload, and restore the original value. Report passed, failed, or not tested for each field; missing or read-only required controls are unfinished requirements.\n- Use controls that match the content: a calendar for dates and an image picker for image replacement. Keep fixed punctuation and units out of directly bound value elements. Preserve stored types and wording: when reading time is already a complete string such as `4 min read`, bind that string directly rather than assuming it is a number.\n- For MDX-backed blocks, containment alone is not enough: the MDX body is editable through its source mapping, but the designed shell needs writable document-frontmatter bindings. Follow the binding recipe below rather than binding editable article fields to query results.\n\n## Store Content Block content in MDX\n\nCommands:\n\n- MCP tool: list-assets {"type":"file"}\n- MCP tool: upload-asset {"asset":{"name":"article.mdx","type":"file","format":"mdx","meta":{}},"assetsDir":".webstudio/assets"}\n- MCP tool: connect-content-block-source {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example","source":{"type":"asset","assetId":"<mdxAssetId>"}}\n- MCP tool: switch-content-block-source {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example","source":{"type":"asset","assetId":"<otherMdxAssetId>"}}\n- MCP tool: inspect-content-block-source {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example"}\n- MCP tool: edit-content-block-source {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example","source":"# Article title\\n\\nArticle body."}\n- MCP tool: update-content-block-frontmatter {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example","properties":{"title":"Article title","draft":false}}\n- MCP tool: reload-content-block-source {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example"}\n- MCP tool: migrate-content-block-template-references {"assetIds":["<mdxAssetId>"],"migration":{"type":"rename","from":"Old template name","to":"New template name"}}\n- MCP tool: disconnect-content-block-source {"blockInstanceId":"<contentBlockInstanceId>","renderScope":"page:/articles/example"}\n\nNotes:\n\n- Create the local `.mdx` file under `.webstudio/assets` before calling `upload-asset`. Use the returned Asset ID when connecting it.\n- Use the Content Block source operations for connecting, switching, inspecting, editing, reloading, and disconnecting. Do not create or delete the `src` prop with generic prop tools; the source operations preserve the Body outlet and Content Block lifecycle.\n- `renderScope` accepts any non-empty stable key for one rendered occurrence. Use a page-based key for a direct Content Block and a distinct key for each repeated Collection occurrence. It does not load a page, route parameters, or resource results. Supply the concrete scoped values needed to resolve an expression through `variables`.\n- For a result-one Assets resource, preview the concrete query, then connect its persisted expression with the previewed item supplied as `variables`, for example `source:{"type":"expression","value":"post.data.id"}` and `variables:{"post":{"data":{"id":"<mdxAssetId>"}}}`.\n- Connecting replaces existing Body content. If the result returns `requiresConfirmation:true`, report that replacement to the user and repeat the same call with `confirmReplacement:true` only after approval.\n- Prefer Markdown for standard document content; it automatically uses a unique matching semantic template when one exists. Use lowercase JSX such as `<section>` or `<svg>` for HTML or SVG with authored properties that Markdown cannot express.\n- Verify that the Content Block has exactly one direct Templates container before connecting or editing MDX. Zero or multiple containers block materialization and publication.\n- Read the Content Block\'s Templates children before writing a custom reference. Use capitalized JSX such as `<PromotionCard />` for its stable **Name**, which is independent from the display label. A matching template wins over a built-in MDX adapter. Other registered components are unavailable until added to this Content Block\'s Templates. JSX attributes accept quoted static values and bare booleans; expressions such as `{false}` are unsupported. Legacy `ws.element` and `ws:name` forms are compatibility input only. Component namespaces such as `$.*`, `radix.*`, and `animation.*` are unsupported.\n- When explicit JSX children match the designed template structure, their text and supported props overlay the cloned descendants and retain template styles. A mismatched child structure replaces the root defaults, while each authored child still resolves through a matching template when possible. An explicit empty pair clears defaults, and a self-closing reference keeps them. Editing inherited default content writes it back as explicit JSX children. Template resolution is live, so adding a matching semantic or named template later updates existing MDX. Preserve unresolved names and report their diagnostics instead of deleting them.\n- When a template is renamed or deleted, use `migrate-content-block-template-references` to update a selected set of affected MDX files. The first call returns a plan. Report its changed-file, update, omission, and diagnostic counts, then repeat the exact request with its `confirmationToken` only after approval. Renames and removals update named JSX and legacy `ws:name` references, including names such as `Image` and `CodeText` when they identify templates. Rename targets must be valid PascalCase JSX identifiers. Removing a paired reference unwraps and preserves its authored children; removing a self-closing reference removes the node because it has no authored children. Invalid files remain unchanged and are reported in diagnostics.\n- `edit-content-block-source` replaces the complete MDX source. Preserve frontmatter and unrelated source when making a bounded edit.\n- `update-content-block-frontmatter` replaces the complete frontmatter mapping. Inspect the current source first and include every property that must remain.\n- Store frontmatter images as exact `$ref` objects. Bind an editable Image source to the resolved `.src` with explicit `binding.mode:"readwrite"`; use `mode:"read"` for its alt binding to `.description`. Omitting the source mode leaves the image visible but not replaceable in Content mode.\n- Use `update-content-block-frontmatter` for MCP frontmatter edits. MDX-rendered elements are not persistent instance targets for generic `bind-props` or `update-text` calls. Preserve existing `mode:"readwrite"` bindings when encountered; they are valid only for exact direct paths into the connected document\'s frontmatter. Direct bindings through a loaded Markdown or MDX `$ref` ending in `#frontmatter` save to the referenced file, with its write permissions enforced. Shared-record edits affect every document using that record. Computed expressions and JSON/body references remain read-only. Image replacement is supported: a direct Image source binding with `mode:"readwrite"` lets the picker replace the frontmatter `$ref`, while shared Asset metadata is edited in Asset settings.\n- Inspect every returned diagnostic. Invalid MDX is saved rather than silently repaired; preserve the source, report the source range, and fix only the requested or invalid part.\n- If an edit in a long-lived MCP session reports a conflict after another client saved the Asset, call `reload-content-block-source`, inspect the latest source, reapply the requested change, and retry. One-shot CLI calls refresh before each operation and normally cannot reproduce a stale session. Never overwrite the newer revision blindly.\n\n## Make an MDX article header editable\n\nUse the resource only to select the connected source, for example `post.data.id`.\nBind article values inside the Content Block to its document parameter instead\nof `post.data.properties.*`. Inspect the block\'s variables first; `document` is\nthe default name, not a name to assume.\n\nThese commands target persistent designed instances inside the connected block.\n\nCommands:\n\n- MCP tool: update-text {"instanceId":"<headingInstanceId>","childIndex":0,"text":"document.frontmatter.title","mode":"expression","expressionBindingMode":"readwrite"}\n- MCP tool: update-text {"instanceId":"<readingTimeValueInstanceId>","childIndex":0,"text":"document.frontmatter.readingTime","mode":"expression","expressionBindingMode":"readwrite"}\n- MCP tool: bind-props {"bindings":[{"instanceId":"<dateInstanceId>","name":"datetime","binding":{"type":"expression","value":"document.frontmatter.publishedAt","mode":"readwrite"}}]}\n\nNotes:\n\n- Create writable bindings explicitly; the default is read-only. Merely moving a heading or Link inside the Content Block does not make its query-bound text editable.\n- The MDX body uses its source mapping. Static designed content outside that body remains protected unless its text or supported props bind to writable frontmatter fields. Do not apply these generic instance tools to MDX-generated instances.\n- Use direct static paths. Property access is already safe. Fallbacks and formatted expressions, such as `document.frontmatter.title ?? "Untitled"`, remain read-only.\n- Keep every intended editable value in its own text element with a single direct read-write binding. For reading time, use three inline siblings: static `— `, the bound reading-time value, and static ` min read`. Preserve whitespace and the stored field type. Do not combine them into a template literal or concatenate strings, and do not put literal siblings inside the value element itself. Keep fixed wording protected in the designed shell.\n- Prefer component formatting controls, such as Date Time formatting with a directly bound date prop, over transforming the expression. Do not silently sacrifice editability for formatting or a fallback; explain unsupported cases and ask before making an intended editable field read-only.\n- A direct writable binding such as `document.frontmatter.author.name` can edit a shared author loaded through `../authors/acme.md#frontmatter`. The edit saves to the author file and affects every article using it; preserve the article\'s `$ref` marker.\n- Before handoff, inventory every article-owned field, including header text, author details, dates, reading time, categories, hero and inline image sources, alternative text, captions, links, and custom-component content. For each field, inspect its binding and source, edit it through the Content-mode UI, verify the saved MDX or referenced file, reload, and restore the test value. Record passed, failed, or not tested for each field. A correct preview, a successful MCP write, and one representative text edit do not prove the whole article is editable. Do not claim completion while required fields fail or remain untested.\n- Bind the Image source directly to `document.frontmatter.featureImage.src` with `binding.mode:"readwrite"` using `bind-props`. Content mode\'s **Choose source** replaces the article\'s frontmatter image `$ref`; the resolved URL stays read-only. Verify selection, the saved reference, and reload instead of treating a missing write mode as a platform limitation. For alternative text bound to `.description`, use **Choose source → asset actions → Settings → Description** to edit shared Asset metadata. This affects every use of the Asset and is separate from replacing an article\'s image.\n\n## Make an article image replaceable in Content mode\n\nUse this for a persistent designed Image inside a connected Content Block,\nwith `featureImage: { $ref: "./images/hero.png" }` in its MDX frontmatter.\nRead the instance ID and document variable name before adapting the example.\n\nCommands:\n\n- MCP tool: bind-props {"bindings":[{"instanceId":"<imageInstanceId>","name":"src","binding":{"type":"expression","value":"document.frontmatter.featureImage.src","mode":"readwrite"}},{"instanceId":"<imageInstanceId>","name":"alt","binding":{"type":"expression","value":"document.frontmatter.featureImage.description","mode":"read"}}]}\n\nNotes:\n\n- The source mode must be explicit: the default `read` mode displays the image but prevents Content-mode replacement. Do not bind to query-result properties or add a fallback expression.\n- **Choose source** replaces the article\'s `featureImage.$ref`; the disabled resolved-URL input is expected. Do not store a resolved URL string or replace the shared Asset itself.\n- Shared alternative text is a separate action: **Choose source → asset actions → Settings → Description**. Its read-only binding does not require the image source binding to be read-only.\n- If the picker is missing or disabled, inspect the source mode, document scope, loaded reference, and permissions before claiming a product limitation.\n- Verify through Content mode with an approved temporary replacement. Check the saved `$ref`, unchanged unrelated MDX and original shared Asset, reload persistence, and restoration. If that test is not authorized, report it as not tested, not passed.\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: bind-props {"bindings":[{"instanceId":"<jsonLdInstanceId>","name":"code","binding":{"type":"expression","value":"({ \'@context\': \'https://schema.org\', \'@type\': \'Article\', headline: post.title })"}}]}\n- MCP tool: audit {"scopes":["seo"],"pagePath":"/"}\n\nNotes:\n\n- Prefer placing `JsonLd` inside `HeadSlot`.\n- For fixed structured data, store `code` as a JSON object or array encoded as a compact string. The Builder formats it for editing.\n- For structured data containing runtime values, use `bind-props` with an expression that evaluates directly to an object or array. Do not call `JSON.stringify` or assemble JSON with string concatenation. Webstudio stores the expression as source text, evaluates it at runtime, and the `JsonLd` component validates and serializes the resulting value.\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 {"verbose":true}\n\nNotes:\n\n- The default response is compact and includes token id, name, declaration count, and optional usage count.\n- Use `verbose: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":{"--color-primary":"#2d3748","--color-accent":"#e53e3e","--space-card":"1.5rem"},"overwrite":true}\n\nNotes:\n\n- Define or overwrite multiple CSS variables atomically by including every name and value in one `vars` object.\n- Pass colors as CSS strings. Structured `hex` color components use normalized values from `0` to `1`, not `0` to `255`.\n\n## Delete CSS variables\n\nCommands:\n\n- MCP tool: delete-css-variable {"names":["--color-primary","--color-accent","--space-card"],"force":true}\n\nNotes:\n\n- Delete multiple CSS variables atomically by including every name in one `names` array. Destructive MCP calls still require the returned confirmation token before they commit.\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":"json","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`, and `json`. Use `json` for all arrays and objects.\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`. A query key with one value is a string; repeated values are an ordered array. For `?tag=red&tag=blue`, `system.search.tag` is `["red", "blue"]`.\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## Configure Form (Beta) through MCP\n\nUse the exact component id returned by `components.search` for **Form (Beta)**.\nAfter inserting its registered template, use the Form instance id for the\nForm-scoped Resource and Action settings.\n\nThe new Form\'s canonical component id is `Form`. The deprecated legacy\nWebhook Form remains available in Builder for existing projects until the next\nrelease, but is omitted from MCP component discovery. `RemixForm` is deprecated\ncompatibility and should not be used for new projects. Always use registry\ndiscovery instead of assuming the display label is its component id.\n\nThe new Form has two modes derived from its Action array:\n\n- One or more connected Resources: the rendered action is\n `?__webstudio__=resources` and submission runs the Resource actions.\n- No connected Resources (`action: []`): the rendered action is\n `?__webstudio__=navigate` and submission updates URL query parameters through\n client-side navigation. Use this for search and filters with page Resources\n bound to `system.search`. Removing the last Action switches to Navigation mode.\n- For ordinary browser submission, insert an `Element` with `tag: "form"`.\n It has no managed action marker and retains native browser behavior.\n\nDo not write the `__webstudio__` marker as a project Action value: that prop holds\nResource selections, and the runtime derives the HTML action URL from it.\nVerify both modes through MCP in a real project: add Resource actions, remove\nall actions for a search/filter form, then reconnect them. Check the rendered\naction, query navigation without a full reload, and Resource execution. Also\nverify a plain form Element remains native. A saved project snapshot alone does\nnot prove these runtime behaviors.\n\nCommands:\n\n- MCP tool: insert-component {"parentInstanceId":"<parentInstanceId>","component":"<componentId from components.search>"}\n- MCP tool: create-resource {"resource":{"name":"Send submission","method":"post","url":"https://api.example.com/submit","headers":[],"body":"formData"},"scopeInstanceId":"<formInstanceId>","dataSourceName":"Send submission","exposeAsDataSource":true}\n- MCP tool: update-props {"updates":[{"instanceId":"<formInstanceId>","name":"action","type":"json","value":[{"dataSourceId":"<returned dataSourceId>"}]}]}\n- MCP tool: update-resource {"resourceId":"<emailResourceId>","values":{"email":{"recipientMode":"visitor","visitorEmailField":"email","includeAttachments":true}}}\n- MCP tool: update-project-settings {"meta":{"emailSender":"Acme <[email protected]>"}}\n\nNotes:\n\n- Use `update-props` with a JSON Action array to add, order, or remove destinations. The Action entries use `{ "dataSourceId": "..." }` and support up to ten Resources, matching the Builder control. Each connected Action runs in its configured order. An extra `enabled` key in older saved settings is ignored.\n- Create each destination Resource in the Form\'s scope so it can use `formData` and `browserInfo`. Set `exposeAsDataSource:true` to receive the data-source id used by the Action array. When a Resource uses Form-only parameters, it is kept out of page-load requests and runs with the Form submission.\n- `update-resource` accepts the same Email settings as the Builder: project, custom, or visitor recipients; sender; subject; body; and submitted-file attachments. Use expressions in string fields for dynamic values.\n- `update-project-settings` edits the project-wide Email recipients and Reply to. `update-props` also sets Form fields and Success redirect, while `bind-props` supplies dynamic expressions. `insert-component` uses the registered Form template, including its default contact fields and Email Actions. Set subject and body on each Email Resource.\n- MCP mutations update saved project configuration. To test real delivery, submit the Form in Preview or on a published test site and inspect the configured destinations.\n\n## Query Markdown assets\n\nCommands:\n\n- MCP tool: get-asset-field-catalog {}\n- MCP tool: validate-asset-query {"query":{"where":{"all":[{"field":["extension"],"operator":"eq","value":"md"},{"field":["properties","draft"],"operator":"ne","value":true}]},"limit":20}}\n- MCP tool: create-assets-resource {"name":"All assets","scopeInstanceId":"<instanceId>","dataSourceName":"assets"}\n- MCP tool: create-assets-resource {"name":"Published posts","scopeInstanceId":"<instanceId>","dataSourceName":"posts","query":{"result":"many","where":{"all":[{"field":["extension"],"operator":"eq","value":{"type":"literal","value":"md"}},{"field":["properties","draft"],"operator":"ne","value":{"type":"literal","value":true}}]},"sort":[{"field":["properties","publishedAt"],"direction":"desc"}],"limit":{"type":"literal","value":20},"output":{"mode":"fields","includeMetadata":false,"fields":[["properties","title"],["properties","slug"],["properties","publishedAt"],["properties","excerpt"]]},"content":{"mode":"none"}}}\n- MCP tool: create-assets-resource {"name":"Post by slug or ID","scopeInstanceId":"<instanceId>","dataSourceName":"post","query":{"result":"one","where":{"all":[{"field":["extension"],"operator":"eq","value":{"type":"literal","value":"md"}},{"field":["properties","slug"],"operator":"eq","value":"system.params.slug"}]},"output":{"mode":"fields","includeMetadata":false,"fields":[["properties","title"],["properties","publishedAt"]]},"content":{"mode":"markdown-body-ref"}}}\n- MCP tool: list-assets-resources {}\n- MCP tool: get-assets-resource {"resourceId":"<resourceId>"}\n- MCP tool: update-assets-resource {"resourceId":"<resourceId>","values":{"query":null}}\n- MCP tool: preview-asset-query {"query":{"result":"one","where":{"all":[{"field":["extension"],"operator":"eq","value":"md"},{"field":["properties","slug"],"operator":"eq","value":"hello-world"}]},"output":{"mode":"fields","includeMetadata":false,"fields":[["properties","title"]]},"content":{"mode":"markdown-body-ref"}}}\n\nNotes:\n\n- Choose `.mdx` connected to a Content Block when editors must edit article bodies visually in Content mode. Publishing downloads and compiles every reachable MDX article, so more articles can slow publishing. Choose `.md` with Markdown Embed when editing the source in Assets is enough; Content mode editors can still edit the Markdown file there, but not its body on the canvas. `.md` needs no per-article MDX compilation, though the publish runner still synchronizes Asset files for both formats and static generation may read Markdown bodies.\n- Read the field catalog before authoring unfamiliar queries. It includes dynamic schema-less frontmatter paths such as `properties.author.name`, observed types, optionality, and mixed-type state without downloading the source files.\n- Minimize the deployed content database by using `output.mode:"fields"` and selecting only fields the rendered page needs. Keep `includeMetadata:false` unless the rendered value needs file metadata such as name, path, MIME type, or creation date, and avoid `output.mode:"all"` as a convenience default. Query diagnostics are returned separately and do not require metadata output. Filters and sorting may still require their referenced fields in the database.\n- Every reachable Assets data source contributes to the shared published database. Keep one final resource per rendered query. Update an existing scoped resource rather than creating a placeholder, preview copy, or repair replacement, and remove obsolete duplicates.\n- Keep bounded overview filters, limits, and offsets literal and add a deterministic ID tie-breaker to the sort. With `content.mode:"none"`, compilation can materialize the small overview result instead of retaining its output fields across every candidate document. Use runtime expressions only for genuinely dynamic values such as the detail slug.\n- Combine filters with `where.all` (AND) and `where.any` (OR), including nested groups. Filter values, limit, and offset on a saved resource may be Webstudio expressions evaluated at render time. Preview queries use concrete JSON values.\n- Query Markdown or MDX files directly and use `content.mode:"markdown-body-ref"` when rendering their bodies. The published database retains metadata and a document reference, then fetches only the selected files from Asset storage at runtime; it does not embed their bodies. Filter and paginate before content is loaded.\n- `full` and bounded `range` continue to request embedded file bytes. Use them only when the caller requires the complete source or a byte range.\n- In Markdown or MDX, reference sibling Assets with conventional relative URLs such as `../images/hero.png`. Deferred `markdown-body-ref` content resolves matching files against the document\'s folder and emits the correct Builder or published Asset URL. Keep external URLs absolute.\n- Markdown Embed renders sanitized authored HTML for figures, captions, audio, video, and iframes. Scripts, inline event handlers, `srcdoc`, and unsafe URL protocols are removed. It does not render Webstudio MDX elements; connect the `.mdx` file to a Content Block for that workflow.\n- Preview each query with concrete values before saving it. Inspect `__diagnostics__.query` for the temporary query-only footprint and `__diagnostics__.database` for the merged database built from all reachable Assets queries. Only `database.usedBytes` counts toward `database.maxBytes`; query sizes must not be summed and are not separate allowances. Compare `usedBytes`, `unboundedBytes`, and `truncated` within both scopes. A completed Markdown blog should include every source document without truncation, contain no embedded Markdown bodies, and retain only its intended materialized overview query. When merged usage approaches the limit, remove duplicate reachable resources first, then unused output fields, then narrow candidate files.\n- Use `result:"many"` for listings. It returns the ID-keyed map at `<dataSourceName>.data`, with `totalCount` and `hasMore` at `<dataSourceName>.meta`, and remains the default for existing queries. Bind a listing Collection to `posts.data`.\n- Use `result:"one"` for a unique detail route. It returns the selected item or `null` directly at `post.data`, always includes its `id`, and omits pagination. Bind components and page settings directly with expressions such as `post.data.properties.title`, `post.data.content.text`, and `post.data ? 200 : 404`. `result:"first"` and `result:"last"` also return a direct item or `null` but require explicit sorting.\n- Assets always executes a structured query. Omit `query` to use the default many-result query, which selects URL and optional image dimensions. Set `values.query:null` to restore it.\n- `create-assets-resource` and `update-assets-resource` are the semantic authoring path. Do not construct the internal query URL, headers, or body expression manually.\n- The shared metadata index is maintained automatically and is emitted only when a configured Assets resource is reachable.\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- MCP tool: list-assets {"verbose":true}\n\nNotes:\n\n- Compact results include each asset\'s folder id. Use `verbose:true` to include complete records for a page of assets, or `get-asset` to read one complete record including description, folder, creation time, and image/font metadata.\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## Get asset\n\nCommands:\n\n- MCP tool: get-asset {"assetId":"<assetId>"}\n\n## List asset folders\n\nCommands:\n\n- MCP tool: list-asset-folders {}\n\n## Create asset folder\n\nCommands:\n\n- MCP tool: create-asset-folder {"name":"Marketing"}\n- MCP tool: create-asset-folder {"name":"Photos","parentId":"<parentFolderId>"}\n\n## Update asset folder\n\nCommands:\n\n- MCP tool: update-asset-folder {"folderId":"<folderId>","values":{"name":"Brand"}}\n- MCP tool: update-asset-folder {"folderId":"<folderId>","values":{"parentId":"<parentFolderId>"}}\n- MCP tool: update-asset-folder {"folderId":"<folderId>","values":{"parentId":null}}\n\nNotes:\n\n- Updating `parentId` is the folder equivalent of cut and paste. Use `null` to move a folder to Root.\n\n## Duplicate asset folder\n\nCommands:\n\n- MCP tool: duplicate-asset-folder {"folderId":"<folderId>"}\n- MCP tool: duplicate-asset-folder {"folderId":"<folderId>","parentId":"<targetFolderId>"}\n\nNotes:\n\n- Duplication recursively copies descendant folders and assets. This is the folder equivalent of copy and paste.\n\n## Delete asset folder\n\nCommands:\n\n- MCP tool: delete-asset-folder {"folderId":"<folderId>"}\n\nNotes:\n\n- Deleting a folder recursively deletes its descendant folders and assets.\n\n## Update asset metadata\n\nCommands:\n\n- MCP tool: update-asset {"assetId":"<assetId>","values":{"description":"Team collaborating around a whiteboard"}}\n- MCP tool: update-asset {"assetId":"<fontAssetId>","values":{"meta":{"family":"Rajdhani","style":"normal","weight":600}}}\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- Font metadata updates merge with the detected metadata and are validated before committing; use this to correct a family, style, or weight after upload.\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- MCP tool: upload-asset {"asset":{"name":"image.png","type":"image","format":"png","folderId":"<folderId>","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\nNotes:\n\n- Multi-file uploads return `uploaded`, `failed`, and `ambiguous` lists with the\n original input index. Retry only `failed` files. A forced upload in\n `ambiguous` may already be committed; inspect the Assets list before deciding\n whether to upload it again. Successful uploads remain committed.\n\n## Duplicate asset\n\nCommands:\n\n- MCP tool: duplicate-asset {"assetId":"<assetId>"}\n- MCP tool: duplicate-asset {"assetId":"<assetId>","folderId":"<targetFolderId>"}\n- MCP tool: duplicate-asset {"assetId":"<assetId>","folderId":null}\n\nNotes:\n\n- Duplication is the asset equivalent of copy and paste. Updating `folderId` is the equivalent of cut and paste; use `null` for Root.\n\n## Download asset\n\nCommands:\n\n- MCP tool: download-asset {"assetId":"<assetId>"}\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- MCP tool: submit-marketplace-product {"acknowledgePublicSubmission":true}\n\nPatch namespaces:\n\n- marketplaceProduct\n\n## Search and inspect safely\n\nCommands:\n\n- webstudio search-project \'{"query":"pricing"}\'\n- MCP tool: search-project {"query":"pricing"}\n- MCP tool: search-project {"query":"api.example.com","namespaces":["resources"]}\n- MCP tool: search-project {"query":"Brand","namespaces":["styles","styleSources","styleSourceSelections"]}\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- `search-project` is a standalone local-session command over every Builder namespace. It returns matching values with stable match ids, namespace paths, owning entities, references, and affected pages.\n- Use it when a value or id is known. Use list/get tools when the project structure or target is not known.\n- The command synchronizes its required Builder namespaces, then searches locally and returns only matches. Namespace filters limit values matched; related namespaces may still supply route and reference context, and synchronization is unchanged. This reduces data passed to the model, not the initial project-data synchronization.\n- Asset records and file metadata are searchable. Asset binary or document contents are not Builder namespace data and are not searched.\n- Values in recognized credential fields are excluded and counted in `excludedSensitiveValueCount`.\n- 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 {"scopes":["craft"],"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- Craft is opt-in and read-only. Run `audit` with `scopes:["craft"]` to detect whether the project is not using Craft, partially compatible, or compatible with the versioned Craft 1.2 profile. `profileStatuses` includes the University-doc provenance and the smallest safe next action. The audit never installs Craft or changes a non-Craft project.\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## Verify dynamic bindings\n\nCommands:\n\n- webstudio verify-bindings --json\n- MCP tool: verify-bindings {"pagePath":"/pricing"}\n- MCP tool: verify-bindings {"instanceId":"<instanceId>","limit":50}\n\nNotes:\n\n- Statically checks persisted text expressions, expression/action/resource/parameter props, resource expressions, and page metadata.\n- Findings distinguish invalid syntax, unknown or out-of-scope variables, stale internal data-source ids, and missing resource or parameter references.\n- Page and instance filters can be combined when the instance belongs to the selected page. Continue findings with `cursor`.\n- This operation does not resolve rendered values or execute external resources. Preview representative loading, empty, error, and populated states after static findings are fixed.\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 {}\n- MCP tool: list-folders {}\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":"json","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":"<article><h2>{expression`collectionItem.title`}</h2></article>"}\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: integrate-runtime-ui {"parentInstanceId":"<instanceId>","resources":[{"resource":{"name":"Seats","method":"get","url":"https://api.example.com/seats","headers":[]},"dataSourceName":"Seats","exposeAsDataSource":true}],"structure":{"type":"collection","data":{"type":"expression","value":"Seats.data"},"itemFragment":{"children":[{"type":"id","value":"seat"}],"instances":[{"type":"instance","id":"seat","component":"Text","children":[{"type":"expression","value":"collectionItem.label"}]}],"props":[],"dataSources":[],"resources":[],"styleSources":[],"styleSourceSelections":[],"styles":[],"breakpoints":[],"assets":[]}},"retainedBehavior":[{"instanceId":"<scriptInstanceId>","responsibility":"Seat selection behavior"}]}\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 `integrate-runtime-ui` to create variables/resources, insert one editable fragment or Collection, and add safe data bindings in one transaction.\n- List existing script-owned responsibilities under `retainedBehavior`. The operation preserves those instances and never evaluates or accepts replacement script bodies.\n- `unsupportedConversions` records behavior that cannot be represented safely. Dry-run returns the complete transaction and the same retained/unsupported report without changing the project.\n- New actions and HtmlEmbed scripts are intentionally rejected. Create normal editable components and data bindings; keep opaque runtime behavior in existing script instances.\n\n## Build authenticated pages\n\nCommands:\n\n- MCP tool: meta.guide {"brief":"Build a Supabase-authenticated account page","taskScope":"structural-project-change","workflow":"authenticated-page"}\n- MCP tool: create-page {"name":"Account","path":"/account"}\n- MCP tool: update-page {"pageId":"<pageId>","values":{"meta":{"auth":{"method":"basic","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- Inspect and reuse the project\'s existing auth convention before authoring. Do\n not add a second provider or session model implicitly.\n- Model signed-out, loading, signed-in, and failed-auth states explicitly.\n- Never store credentials, service-role keys, refresh tokens, private session\n values, or authenticated response bodies in project data, command output,\n screenshots, agent instructions, or error reports. Privileged provider calls\n and authorization enforcement belong server-side.\n- Basic auth is semantic today. Provider-specific Supabase/Firebase setup still\n uses the existing resource, variable, prop, binding, and embed tools; there is\n no provider-specific installer.\n\n## Generate from design input\n\nCommands:\n\n- MCP tool: meta.guide {"brief":"Recreate this Figma design as a responsive page","taskScope":"visual-change","workflow":"design-input"}\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: list-breakpoints {}\n- MCP tool: insert-fragment {"parentInstanceId":"<instanceId>","fragment":"<section><p>Section copy</p></section>"}\n- MCP tool: update-styles {"updates":[{"instanceId":"<instanceId>","breakpoint":"<breakpointId-from-list-breakpoints>","property":"padding-left","value":{"type":"unit","unit":"px","value":24}}]}\n- MCP tool: preview.start {}\n- MCP tool: screenshot {"path":"/landing","output":"landing-desktop.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n- MCP tool: screenshot {"path":"/landing","output":"landing-mobile.png","viewport":{"width":390,"height":844},"waitUntil":"load","waitForTimeout":250}\n- MCP tool: screenshot {"baseUrl":"http://127.0.0.1:5177","path":"/landing","output":"landing-desktop.png","viewport":{"width":1440,"height":900},"waitUntil":"load","waitForTimeout":250}\n\nNotes:\n\n- Use this after the agent can inspect the supplied design. There is no direct\n Figma, screenshot, Inception, or `design.md` import command.\n- Inspect and reuse existing variables, tokens, styles, components, assets, and\n page patterns before authoring. Build semantic editable structure rather than\n flattening the design into an image or absolute-positioned approximation.\n- Ask whether the user wants visual verification unless they explicitly requested\n it. If they decline, stop after focused reads and a static audit. If they opt\n in, verify one familiar viewport inside every distinct Builder breakpoint\n range, then run rendered audit and inspect the screenshots before completion.\n\n## Cross-project maintenance\n\nCommands:\n\n- webstudio mcp run .temp/projects.json\n- webstudio mcp run .temp/projects.json --dry-run\n- webstudio mcp run .temp/projects.json --approve-mutations --concurrency 2\n\nNotes:\n\n- Put shared `calls` and a `projects` array of independently linked project roots in the existing `mcp run` manifest. Project roots are relative to the manifest file.\n- Each project uses its own config, authentication, ProjectSession storage, checkpoint, and failure boundary. Confirmed successful calls are checkpointed. Reads can resume automatically; a mutation interrupted after dispatch is reported as ambiguous and is not replayed automatically, preventing silent duplicate writes.\n- Focus the manifest on bounded reads or audits first. Use per-call `dryRun`, global `--dry-run`, or explicitly approve committed mutations with `--approve-mutations` after reviewing the manifest.\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:\nCall `meta.guide` with `workflow:"authenticated-page"`, then create the\npage, resources, variables, props, bindings, and embeds with existing semantic\ntools.\n\nSuggested commands:\n\n- setup-auth-page\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:\nCall `meta.guide` with `workflow:"design-input"`, let the agent inspect the supplied\ndesign, then use semantic page, token, asset, fragment, style, preview,\nscreenshot, and audit tools. Use `apply-patch` only when no semantic operation\nfits.\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## Search project data\n\nRun `webstudio search-project \'{"query":"known value"}\'` to search all Builder\nnamespaces in the local project session. Narrow it with\n`{"query":"Brand","namespaces":["styleSources","styles"]}` when only specific\nnamespaces are relevant. Results contain the current value, stable match id,\nnamespace path, owning entity, resolved references, and affected pages.\n\nValues in recognized credential fields are excluded and reported in\n`excludedSensitiveValueCount`.\n\nThe command synchronizes its required Builder namespaces, then searches locally\nand returns only matches. Namespace filters limit values matched; related\nnamespaces may still supply route and reference context, and synchronization is\nunchanged. This reduces data sent to the model, not project synchronization. It\nsearches asset metadata, not asset binaries or document contents.\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`, and `json`. Use `json`\nfor all arrays and objects, including tags, selected categories, and nested API\nfilter 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`,\n`system.search`. A query key with one value is a string; a repeated key is an\narray of values in their original order. For `?tag=red&tag=blue`,\n`system.search.tag` is `["red", "blue"]`; missing keys are absent.\n\nFor a saved Webhook Form on `/products/:slug`, a Resource URL can use\n`"https://api.example.com/products/" + system.params.slug + "/comments"`.\nOn `/products/chair?source=newsletter&tag=red&tag=blue`, use\n`system.search.source` for `"newsletter"` and `system.search.tag` for\n`["red", "blue"]` in a header or object body expression. A missing key stays\nabsent; use `system.search.source ?? "direct"` when a fallback is needed.\nThese values come from the page being submitted, including after navigation.\nFor a saved Webhook Form action, object body bindings are combined with the\nsubmitted fields; a submitted field wins when both use the same key.\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":diff --git a/packages/cli/src/docs/api-use-cases.md b/packages/cli/src/docs/api-use-cases.mdindex 099f893049..8d56c68111 100644--- a/packages/cli/src/docs/api-use-cases.md+++ b/packages/cli/src/docs/api-use-cases.md@@ -848,12 +848,11 @@ discovery instead of assuming the display label is its component id.The new Form has two modes derived from its Action array:- One or more connected Resources: the rendered action is- `?__webstudio__=resources` and submission runs the enabled Resource actions.+ `?__webstudio__=resources` and submission runs the Resource actions.- No connected Resources (`action: []`): the rendered action is`?__webstudio__=navigate` and submission updates URL query parameters throughclient-side navigation. Use this for search and filters with page Resources- bound to `system.search`. Removing the last Action switches to Navigation mode;- disabling an Action does not remove it.+ bound to `system.search`. Removing the last Action switches to Navigation mode.- For ordinary browser submission, insert an `Element` with `tag: "form"`.It has no managed action marker and retains native browser behavior.@@ -869,13 +868,13 @@ Commands:- MCP tool: insert-component {"parentInstanceId":"<parentInstanceId>","component":"<componentId from components.search>"}- MCP tool: create-resource {"resource":{"name":"Send submission","method":"post","url":"https://api.example.com/submit","headers":[],"body":"formData"},"scopeInstanceId":"<formInstanceId>","dataSourceName":"Send submission","exposeAsDataSource":true}-- MCP tool: update-props {"updates":[{"instanceId":"<formInstanceId>","name":"action","type":"json","value":[{"dataSourceId":"<returned dataSourceId>","enabled":true}]}]}+- MCP tool: update-props {"updates":[{"instanceId":"<formInstanceId>","name":"action","type":"json","value":[{"dataSourceId":"<returned dataSourceId>"}]}]}- MCP tool: update-resource {"resourceId":"<emailResourceId>","values":{"email":{"recipientMode":"visitor","visitorEmailField":"email","includeAttachments":true}}}- MCP tool: update-project-settings {"meta":{"emailSender":"Acme <[email protected]>"}}Notes:-- Use `update-props` with a JSON Action array to add, order, enable, disable, or remove destinations. The Action entries use `{ "dataSourceId": "...", "enabled": true }` and support up to ten Resources, matching the Builder control.+- Use `update-props` with a JSON Action array to add, order, or remove destinations. The Action entries use `{ "dataSourceId": "..." }` and support up to ten Resources, matching the Builder control. Each connected Action runs in its configured order. An extra `enabled` key in older saved settings is ignored.- Create each destination Resource in the Form's scope so it can use `formData` and `browserInfo`. Set `exposeAsDataSource:true` to receive the data-source id used by the Action array. When a Resource uses Form-only parameters, it is kept out of page-load requests and runs with the Form submission.- `update-resource` accepts the same Email settings as the Builder: project, custom, or visitor recipients; sender; subject; body; and submitted-file attachments. Use expressions in string fields for dynamic values.- `update-project-settings` edits the project-wide Email recipients and Reply to. `update-props` also sets Form fields and Success redirect, while `bind-props` supplies dynamic expressions. `insert-component` uses the registered Form template, including its default contact fields and Email Actions. Set subject and body on each Email Resource.diff --git a/packages/cli/src/prebuild.test.ts b/packages/cli/src/prebuild.test.tsindex 0a72f7a17c..39981a2f69 100644--- a/packages/cli/src/prebuild.test.ts+++ b/packages/cli/src/prebuild.test.ts@@ -3176,7 +3176,7 @@ sitemap.map((page) => page.path);`instanceId: "root",name: "action",type: "json",- value: [{ dataSourceId: "destination", enabled: true }],+ value: [{ dataSourceId: "destination" }],},],],@@ -3688,19 +3688,16 @@ sitemap.map((page) => page.path);`"too-many",Array(11).fill("destination")- .map((dataSourceId) => ({ dataSourceId, enabled: true })),+ .map((dataSourceId) => ({ dataSourceId })),],["duplicate",- [- { dataSourceId: "destination", enabled: true },- { dataSourceId: "destination", enabled: true },- ],+ [{ dataSourceId: "destination" }, { dataSourceId: "destination" }],],- ["missing", [{ dataSourceId: "missing", enabled: true }]],+ ["missing", [{ dataSourceId: "missing" }]],["malformed", { destinations: "destination" }],["native", { mode: "native", destinations: ["destination"] }],- ["valid", [{ dataSourceId: "destination", enabled: true }]],+ ["valid", [{ dataSourceId: "destination" }]],] as const;const siteData = createSiteData({instances: [@@ -3810,7 +3807,7 @@ sitemap.map((page) => page.path);`for (const [id, error] of [["unknown", "Form submission settings not found"],- ["empty", "Enable at least one action"],+ ["empty", "Select at least one Resource action"],["too-many", "Select no more than 10 Resource actions"],["duplicate", "Select each Resource only once"],["missing", "Resource destination not found"],@@ -4015,7 +4012,7 @@ sitemap.map((page) => page.path);`expect(result.status).toBe(400);expect(result.contentType).toContain("application/json");expect(result.body).toEqual(- getManagedFormFailure("Enable at least one action")+ getManagedFormFailure("Select at least one Resource action"));}},@@ -4100,7 +4097,7 @@ sitemap.map((page) => page.path);`instanceId: "root",name: "action",type: "json",- value: [{ dataSourceId: "destination", enabled: true }],+ value: [{ dataSourceId: "destination" }],},],],@@ -4365,9 +4362,9 @@ sitemap.map((page) => page.path);`name: "action",type: "json",value: [- { dataSourceId: "http-source", enabled: true },- { dataSourceId: "project-source", enabled: true },- { dataSourceId: "custom-source", enabled: true },+ { dataSourceId: "http-source" },+ { dataSourceId: "project-source" },+ { dataSourceId: "custom-source" },],},],@@ -4513,7 +4510,7 @@ sitemap.map((page) => page.path);`instanceId: "root",name: "action",type: "json",- value: [{ dataSourceId: "http-source", enabled: true }],+ value: [{ dataSourceId: "http-source" }],},],],@@ -4622,7 +4619,7 @@ sitemap.map((page) => page.path);`instanceId: "root",name: "action",type: "json",- value: [{ dataSourceId: "destination", enabled: true }],+ value: [{ dataSourceId: "destination" }],},],],@@ -4713,7 +4710,7 @@ sitemap.map((page) => page.path);`instanceId: "root",name: "action",type: "json",- value: [{ dataSourceId: "emailDestination", enabled: true }],+ value: [{ dataSourceId: "emailDestination" }],},],],@@ -5002,7 +4999,7 @@ sitemap.map((page) => page.path);`instanceId: "root",name: "action",type: "json",- value: [{ dataSourceId: "visitor-source", enabled: true }],+ value: [{ dataSourceId: "visitor-source" }],},],[@@ -5136,7 +5133,7 @@ export const createManagedFormResourceFetch = () => globalThis.__testManagedForminstanceId: "root",name: "action",type: "json",- value: [{ dataSourceId: "destination", enabled: true }],+ value: [{ dataSourceId: "destination" }],},],],@@ -5244,8 +5241,8 @@ export const createManagedFormResourceFetch = () => {name: "action",type: "json",value: [- { dataSourceId: "sibling-source", enabled: true },- { dataSourceId: "failed-source", enabled: true },+ { dataSourceId: "sibling-source" },+ { dataSourceId: "failed-source" },],},],@@ -5525,8 +5522,8 @@ export const createManagedFormResourceFetch = () => {name: "action",type: "json",value: [- { dataSourceId: "valid-source", enabled: true },- { dataSourceId: "denied-source", enabled: true },+ { dataSourceId: "valid-source" },+ { dataSourceId: "denied-source" },],},],@@ -5648,8 +5645,8 @@ export const createManagedFormResourceFetch = () => {name: "action",type: "json",value: [- { dataSourceId: "independent-source", enabled: true },- { dataSourceId: "dependent-source", enabled: true },+ { dataSourceId: "independent-source" },+ { dataSourceId: "dependent-source" },],},],@@ -5824,8 +5821,8 @@ export const createManagedFormResourceFetch = () => {name: "action",type: "json",value: [- { dataSourceId: "form-destination", enabled: true },- { dataSourceId: "browser-destination", enabled: true },+ { dataSourceId: "form-destination" },+ { dataSourceId: "browser-destination" },],},],@@ -6065,7 +6062,7 @@ export const createManagedFormResourceFetch = () => {instanceId: "root",name: "action",type: "json",- value: [{ dataSourceId: "destination", enabled: true }],+ value: [{ dataSourceId: "destination" }],},],],@@ -6207,7 +6204,7 @@ export const createManagedFormResourceFetch = () => {instanceId: "root",name: "action",type: "json",- value: [{ dataSourceId: "destination", enabled: true }],+ value: [{ dataSourceId: "destination" }],},],],@@ -6334,7 +6331,7 @@ export const createManagedFormResourceFetch = () => {instanceId: "root",name: "action",type: "json",- value: [{ dataSourceId: "destination", enabled: true }],+ value: [{ dataSourceId: "destination" }],},],],diff --git a/packages/cli/src/prebuild.ts b/packages/cli/src/prebuild.tsindex e1537a988c..de8d4b36a2 100644--- a/packages/cli/src/prebuild.ts+++ b/packages/cli/src/prebuild.ts@@ -65,7 +65,7 @@ import {type ComponentBuildContribution,isPublishedDeployment,isFormSubmission,- getEnabledFormActions,+ getFormActions,} from "@webstudio-is/sdk";import {migratePages,@@ -1806,7 +1806,7 @@ export const createManagedFormResourceFetch = ({ request, context, projectDomainconst action =actionProp?.type === "json" ? actionProp.value : undefined;const resourceIds = isFormSubmission(action)- ? getEnabledFormActions(action).map((id) => {+ ? getFormActions(action).map((id) => {const dataSource = dataSources.get(id);return dataSource?.type === "resource" &&resources.has(dataSource.resourceId)@@ -1820,7 +1820,7 @@ export const createManagedFormResourceFetch = ({ request, context, projectDomain([formId, { action }]) => ({formId,destinationDataSourceIds: isFormSubmission(action)- ? getEnabledFormActions(action)+ ? getFormActions(action): [],}));diff --git a/packages/design-system/src/components/section-title.tsx b/packages/design-system/src/components/section-title.tsxindex 55f12272d7..22b66b6ff6 100644--- a/packages/design-system/src/components/section-title.tsx+++ b/packages/design-system/src/components/section-title.tsx@@ -254,7 +254,10 @@ export const SectionTitleButton = forwardRef(tabIndex={-1}color="ghost"{...props}- css={{ color: cssVar(buttonContentColor), ...css }}+ css={{+ color: cssVar(buttonContentColor, cssVar("--foreground-primary")),+ ...css,+ }}ref={ref}/>)diff --git a/packages/html-data/bin/attributes.ts b/packages/html-data/bin/attributes.tsindex b511ba952a..8191a49479 100644--- a/packages/html-data/bin/attributes.ts+++ b/packages/html-data/bin/attributes.ts@@ -30,6 +30,7 @@ type Attribute = {required?: boolean;type: "string" | "boolean" | "number" | "select" | "url";options?: string[];+ defaultValue?: string;};const overrides: Record<string, Record<string, false | Partial<Attribute>>> = {@@ -87,7 +88,7 @@ const overrides: Record<string, Record<string, false | Partial<Attribute>>> = {name: { required: true },value: { required: true },checked: { required: true },- type: { required: true },+ type: { required: true, defaultValue: "text" },placeholder: { required: true },required: { required: true },autofocus: { required: true },@@ -341,7 +342,8 @@ let attributesContent = `type Attribute = {description: string,required?: boolean,type: 'string' | 'boolean' | 'number' | 'select' | 'url',- options?: string[]+ options?: string[],+ defaultValue?: string}`;diff --git a/packages/html-data/src/__generated__/attributes.ts b/packages/html-data/src/__generated__/attributes.tsindex 05e416d4c7..95ba1f8a72 100644--- a/packages/html-data/src/__generated__/attributes.ts+++ b/packages/html-data/src/__generated__/attributes.ts@@ -4,6 +4,7 @@ type Attribute = {required?: boolean;type: "string" | "boolean" | "number" | "select" | "url";options?: string[];+ defaultValue?: string;};const attribute_accumulate_1kar0jt: Attribute = {@@ -3966,6 +3967,7 @@ export const attributesByTag: Record<string, undefined | Attribute[]> = {"button",],required: true,+ defaultValue: "text",},attribute_value_15qkpz,attribute_width_d9q964,diff --git a/packages/project-build/src/mcp-form.integration.test.ts b/packages/project-build/src/mcp-form.integration.test.tsindex bf4a59e12a..58dd15e5af 100644--- a/packages/project-build/src/mcp-form.integration.test.ts+++ b/packages/project-build/src/mcp-form.integration.test.ts@@ -331,8 +331,8 @@ test("discovers, commits, and reads back the new Form through MCP", async () =>expect(projectResource).toMatchObject({ scopeInstanceId: form?.id });expect(visitorResource).toMatchObject({ scopeInstanceId: form?.id });expect(action?.value).toEqual([- { dataSourceId: projectResource?.dataSourceId, enabled: true },- { dataSourceId: visitorResource?.dataSourceId, enabled: true },+ { dataSourceId: projectResource?.dataSourceId },+ { dataSourceId: visitorResource?.dataSourceId },]);const formVariables = variables.data.variables as Array<{id: string;@@ -512,8 +512,8 @@ test("discovers, commits, and reads back the new Form through MCP", async () =>name: "action",type: "json",value: [- { dataSourceId: visitorResource?.dataSourceId, enabled: false },- { dataSourceId: projectResource?.dataSourceId, enabled: true },+ { dataSourceId: visitorResource?.dataSourceId },+ { dataSourceId: projectResource?.dataSourceId },],},],@@ -532,8 +532,8 @@ test("discovers, commits, and reads back the new Form through MCP", async () =>name: "action",type: "json",value: [- { dataSourceId: visitorResource?.dataSourceId, enabled: false },- { dataSourceId: projectResource?.dataSourceId, enabled: true },+ { dataSourceId: visitorResource?.dataSourceId },+ { dataSourceId: projectResource?.dataSourceId },],}),])@@ -638,7 +638,7 @@ test("discovers, commits, and reads back the new Form through MCP", async () =>email: { recipientMode: "project" },});- const extraActions: Array<{ dataSourceId: string; enabled: boolean }> = [];+ const extraActions: Array<{ dataSourceId: string }> = [];for (let index = 0; index < 7; index++) {const created = await call("create-resource", {resource: {@@ -652,13 +652,12 @@ test("discovers, commits, and reads back the new Form through MCP", async () =>});extraActions.push({dataSourceId: created.data.dataSourceId as string,- enabled: true,});}const tenActions = [- { dataSourceId: projectResource?.dataSourceId, enabled: true },- { dataSourceId: visitorResource?.dataSourceId, enabled: false },- { dataSourceId: httpDataSourceId, enabled: true },+ { dataSourceId: projectResource?.dataSourceId },+ { dataSourceId: visitorResource?.dataSourceId },+ { dataSourceId: httpDataSourceId },...extraActions,];expect(tenActions).toHaveLength(10);@@ -690,10 +689,7 @@ test("discovers, commits, and reads back the new Form through MCP", async () =>instanceId: form?.id,name: "action",type: "json",- value: [- ...tenActions,- { dataSourceId: "one-too-many", enabled: true },- ],+ value: [...tenActions, { dataSourceId: "one-too-many" }],},],},@@ -704,8 +700,8 @@ test("discovers, commits, and reads back the new Form through MCP", async () =>);expect(commits).toBe(commitsBeforeRejection);const remainingActions = [- { dataSourceId: httpDataSourceId, enabled: true },- { dataSourceId: projectResource?.dataSourceId, enabled: true },+ { dataSourceId: httpDataSourceId },+ { dataSourceId: projectResource?.dataSourceId },];await call("update-props", {updates: [diff --git a/packages/project-build/src/runtime/data.test.tsx b/packages/project-build/src/runtime/data.test.tsxindex d647feffb5..100207d632 100644--- a/packages/project-build/src/runtime/data.test.tsx+++ b/packages/project-build/src/runtime/data.test.tsx@@ -117,15 +117,15 @@ test("deleting a Resource removes it from a new Form's destinations", () => {name: "action",type: "json",value: [- { dataSourceId: "resourceVariable", enabled: false },- { dataSourceId: "otherResourceVariable", enabled: true },+ { dataSourceId: "resourceVariable" },+ { dataSourceId: "otherResourceVariable" },],});deleteVariableMutable(data, "resourceVariable");expect(data.props.get("action")).toMatchObject({- value: [{ dataSourceId: "otherResourceVariable", enabled: true }],+ value: [{ dataSourceId: "otherResourceVariable" }],});});@@ -209,7 +209,7 @@ test("Form-scoped Resource bindings and destination survive edit, save, and reloinstanceId: "formId",name: "action",type: "json",- value: [{ dataSourceId: "destination", enabled: true }],+ value: [{ dataSourceId: "destination" }],});const bodyExpression = `({ email: ${encodeDataVariableId("formData")}.email })`;@@ -258,7 +258,7 @@ test("Form-scoped Resource bindings and destination survive edit, save, and reloscopeInstanceId: "formId",});expect(reloadedProps.get("action")).toMatchObject({- value: [{ dataSourceId: "destination", enabled: true }],+ value: [{ dataSourceId: "destination" }],});});@@ -5038,7 +5038,7 @@ describe("resource patch helpers", () => {instanceId: "form",name: "action",type: "json",- value: [{ dataSourceId: "data-source", enabled: false }],+ value: [{ dataSourceId: "data-source" }],};const dataSource: DataSource = {id: "data-source",@@ -5081,7 +5081,7 @@ describe("resource patch helpers", () => {instanceId: "button",name: "action",type: "json",- value: [{ dataSourceId: "data-source", enabled: true }],+ value: [{ dataSourceId: "data-source" }],};const dataSource: DataSource = {id: "data-source",@@ -5100,9 +5100,7 @@ describe("resource patch helpers", () => {expect(result.payload.flatMap(({ patches }) => patches)).not.toContainEqual(expect.objectContaining({ path: ["button-action", "value"] }));- expect(action.value).toEqual([- { dataSourceId: "data-source", enabled: true },- ]);+ expect(action.value).toEqual([{ dataSourceId: "data-source" }]);});test("rejects deleting resources whose data source is referenced by expressions", () => {diff --git a/packages/project-build/src/runtime/data.ts b/packages/project-build/src/runtime/data.tsindex 302ade9192..7a5ff8c3db 100644--- a/packages/project-build/src/runtime/data.ts+++ b/packages/project-build/src/runtime/data.ts@@ -1142,9 +1142,7 @@ export const rebindTreeVariablesMutable = ({});};-const removeFormActionsForResources = <- T extends { dataSourceId: string; enabled: boolean },->(+const removeFormActionsForResources = <T extends { dataSourceId: string }>(actions: T[],removedIds: ReadonlySet<string>): T[] => actions.filter((action) => !removedIds.has(action.dataSourceId));diff --git a/packages/project-build/src/runtime/fragment.test.tsx b/packages/project-build/src/runtime/fragment.test.tsxindex b76041b38e..400fffb75c 100644--- a/packages/project-build/src/runtime/fragment.test.tsx+++ b/packages/project-build/src/runtime/fragment.test.tsx@@ -146,7 +146,7 @@ test("copying a Form remaps its local Resource actions", () => {instanceId: "formId",name: "action",type: "json",- value: [{ dataSourceId: "localResourceVariable", enabled: false }],+ value: [{ dataSourceId: "localResourceVariable" }],});const fragment = webstudioFragment.parse(@@ -170,9 +170,7 @@ test("copying a Form remaps its local Resource actions", () => {copiedSubmission.value as { dataSourceId: string }[])[0].dataSourceId;expect(destinationId).not.toBe("localResourceVariable");- expect(copiedSubmission.value).toEqual([- { dataSourceId: destinationId, enabled: false },- ]);+ expect(copiedSubmission.value).toEqual([{ dataSourceId: destinationId }]);expect(data.dataSources.get(destinationId)).toMatchObject({scopeInstanceId: copiedForm?.id,resourceId: expect.not.stringMatching(/^localResource$/),diff --git a/packages/project-build/src/runtime/managed-form-draft.ts b/packages/project-build/src/runtime/managed-form-draft.tsindex cb9a2300e8..fd5ab0fe3b 100644--- a/packages/project-build/src/runtime/managed-form-draft.ts+++ b/packages/project-build/src/runtime/managed-form-draft.ts@@ -2,7 +2,7 @@ import {decodeDataVariableId,findTreeInstanceIds,getAllPages,- getEnabledFormActions,+ getFormActions,getPagePath,isFormSubmission,type DataSources,@@ -75,9 +75,7 @@ export const prepareManagedFormDraft = ({.filter((prop) => prop.instanceId === formId && prop.name === "action").at(-1);const action = actionProp?.type === "json" ? actionProp.value : undefined;- const destinations = isFormSubmission(action)- ? getEnabledFormActions(action)- : [];+ const destinations = isFormSubmission(action) ? getFormActions(action) : [];const resourceIds = destinations.map((id) => {const source = dataSources.get(id);return source?.type === "resource" && resources.has(source.resourceId)diff --git a/packages/project-build/src/runtime/registry.test.ts b/packages/project-build/src/runtime/registry.test.tsindex a76fda3ef8..ef464b1bbf 100644--- a/packages/project-build/src/runtime/registry.test.ts+++ b/packages/project-build/src/runtime/registry.test.ts@@ -123,7 +123,6 @@ test("rejects a fragment containing a Form with more than 10 actions", () => {type: "json",value: Array.from({ length: 11 }, (_, index) => ({dataSourceId: `resource-${index}`,- enabled: true,})),},],diff --git a/packages/react-sdk/src/component-generator.test.tsx b/packages/react-sdk/src/component-generator.test.tsxindex c5498cfc58..63e0537088 100644--- a/packages/react-sdk/src/component-generator.test.tsx+++ b/packages/react-sdk/src/component-generator.test.tsx@@ -148,7 +148,7 @@ test("managed Forms own their server identity after custom props and action deduinstanceId: "form",name: "action",type: "json",- value: [{ dataSourceId: "request", enabled: true }],+ value: [{ dataSourceId: "request" }],});const managed = generate(true);expect(managed.match(/data-ws-managed-form-id/g)).toHaveLength(1);@@ -169,7 +169,7 @@ test("managed Forms own their server identity after custom props and action deduinstanceId: "form",name: "action",type: "json",- value: [{ dataSourceId: "final", enabled: true }],+ value: [{ dataSourceId: "final" }],});expect(generate(true)).toContain('data-ws-managed-form-id="form"');});@@ -200,7 +200,7 @@ test("managed Form policy applies to a root Form and leaves other elements' propinstanceId: "form",name: "action",type: "json",- value: [{ dataSourceId: "request", enabled: true }],+ value: [{ dataSourceId: "request" }],});const generate = (rootInstanceId: string) =>generateManagedFormComponent({diff --git a/packages/sdk-components-react-remix/src/form-feedback.browser.test.tsx b/packages/sdk-components-react-remix/src/form-feedback.browser.test.tsxindex 4412a2d81a..078741a30f 100644--- a/packages/sdk-components-react-remix/src/form-feedback.browser.test.tsx+++ b/packages/sdk-components-react-remix/src/form-feedback.browser.test.tsx@@ -53,10 +53,7 @@ test("managed Remix Form scrolls partial failure and reveals visible success", areturn (<Formdata-ws-managed-form-id="saved-managed-form"- action={[- { dataSourceId: "first", enabled: true },- { dataSourceId: "second", enabled: true },- ]}+ action={[{ dataSourceId: "first" }, { dataSourceId: "second" }]}state={state}onStateChange={setState}>diff --git a/packages/sdk-components-react-remix/src/resource-form-refresh.browser.test.tsx b/packages/sdk-components-react-remix/src/resource-form-refresh.browser.test.tsxindex d52c22a2b7..9037b88cd8 100644--- a/packages/sdk-components-react-remix/src/resource-form-refresh.browser.test.tsx+++ b/packages/sdk-components-react-remix/src/resource-form-refresh.browser.test.tsx@@ -54,7 +54,7 @@ test("managed submission refreshes mutable page data once without replaying POST<output>{value}</output><Formdata-ws-managed-form-id="form"- action={[{ dataSourceId: "resource", enabled: true }]}+ action={[{ dataSourceId: "resource" }]}onResultChange={(result) => results.push(result)}><button type="submit">Send</button>@@ -111,7 +111,7 @@ test("failed submissions skip refresh and a later successful submission refreshe<output>{value}</output><Formdata-ws-managed-form-id="form"- action={[{ dataSourceId: "resource", enabled: true }]}+ action={[{ dataSourceId: "resource" }]}><button type="submit">Send</button></Form>@@ -152,7 +152,7 @@ test("a redirect skips refresh", async () => {element: (<Formdata-ws-managed-form-id="form"- action={[{ dataSourceId: "resource", enabled: true }]}+ action={[{ dataSourceId: "resource" }]}successRedirect="#done"><button type="submit">Send</button>@@ -195,7 +195,7 @@ test("navigation ignores an in-flight submission from the old page", async () =>element: (<Formdata-ws-managed-form-id="form"- action={[{ dataSourceId: "resource", enabled: true }]}+ action={[{ dataSourceId: "resource" }]}onResultChange={(result) => results.push(result)}><button type="submit">Send</button>@@ -255,7 +255,7 @@ test("refresh failure retains the completed success result and does not replay P<output>{value}</output><Formdata-ws-managed-form-id="form"- action={[{ dataSourceId: "resource", enabled: true }]}+ action={[{ dataSourceId: "resource" }]}onResultChange={(result) => results.push(result)}><button type="submit">Send</button>diff --git a/packages/sdk-components-react-router/src/form-feedback.browser.test.tsx b/packages/sdk-components-react-router/src/form-feedback.browser.test.tsxindex d6b344e2bb..21df241c5e 100644--- a/packages/sdk-components-react-router/src/form-feedback.browser.test.tsx+++ b/packages/sdk-components-react-router/src/form-feedback.browser.test.tsx@@ -75,10 +75,7 @@ test("managed Form reveals partial failure and leaves visible success feedback ireturn (<Formdata-ws-managed-form-id="saved-managed-form"- action={[- { dataSourceId: "first", enabled: true },- { dataSourceId: "second", enabled: true },- ]}+ action={[{ dataSourceId: "first" }, { dataSourceId: "second" }]}state={state}onStateChange={setState}>@@ -150,7 +147,7 @@ test("managed Form reveals authored Error Message on repeated failures", async (return (<Formdata-ws-managed-form-id="saved-managed-form"- action={[{ dataSourceId: "first", enabled: true }]}+ action={[{ dataSourceId: "first" }]}state={state}onStateChange={setState}onResultChange={(result) => setErrors(result.errors)}@@ -204,7 +201,7 @@ test("managed Form reveals a persistent configuration error", async () => {const [errors, setErrors] = useState<Array<{ message: string }>>([]);return (<Form- action={[{ dataSourceId: "disabled-resource", enabled: false }]}+ action={[{ dataSourceId: "resource" }, { dataSourceId: "resource" }]}state={state}onStateChange={setState}onResultChange={(result) => setErrors(result.errors)}@@ -235,7 +232,9 @@ test("managed Form reveals a persistent configuration error", async () => {await act(async () => view.container.querySelector("button")?.click());await vi.waitFor(() => expect(scroll).toHaveBeenCalledTimes(attempt));const currentAlert = view.container.querySelector('[role="alert"]');- expect(currentAlert?.textContent).toContain("Enable at least one action");+ expect(currentAlert?.textContent).toContain(+ "Select each Resource only once"+ );if (alert !== null) {expect(currentAlert).toBe(alert);}@@ -260,7 +259,7 @@ test("managed Form follows a valid success redirect without scrolling feedback",return (<Formdata-ws-managed-form-id="saved-managed-form"- action={[{ dataSourceId: "first", enabled: true }]}+ action={[{ dataSourceId: "first" }]}state={state}onStateChange={setState}successRedirect="#after-form"diff --git a/packages/sdk-components-react-router/src/resource-form-refresh.browser.test.tsx b/packages/sdk-components-react-router/src/resource-form-refresh.browser.test.tsxindex a2b2054ad6..1a0271c944 100644--- a/packages/sdk-components-react-router/src/resource-form-refresh.browser.test.tsx+++ b/packages/sdk-components-react-router/src/resource-form-refresh.browser.test.tsx@@ -59,7 +59,7 @@ test("managed submission refreshes mutable page data once without replaying POST<output>{value}</output><Formdata-ws-managed-form-id="form"- action={[{ dataSourceId: "resource", enabled: true }]}+ action={[{ dataSourceId: "resource" }]}onResultChange={(result) => results.push(result)}><button type="submit">Send</button>@@ -122,7 +122,7 @@ test("success feedback scroll waits until delayed route revalidation settles", a<output>{value}</output><Formdata-ws-managed-form-id="form"- action={[{ dataSourceId: "resource", enabled: true }]}+ action={[{ dataSourceId: "resource" }]}state={state}onStateChange={setState}>@@ -179,7 +179,7 @@ test("success feedback stays visible when restoration follows route idle", async<div style={{ height: window.innerHeight * 2 }} /><Formdata-ws-managed-form-id="form"- action={[{ dataSourceId: "resource", enabled: true }]}+ action={[{ dataSourceId: "resource" }]}state={state}onStateChange={setState}>@@ -264,7 +264,7 @@ test("failed submissions skip refresh and a later successful submission refreshe<output>{value}</output><Formdata-ws-managed-form-id="form"- action={[{ dataSourceId: "resource", enabled: true }]}+ action={[{ dataSourceId: "resource" }]}><button type="submit">Send</button></Form>@@ -305,7 +305,7 @@ test("a redirect skips refresh", async () => {element: (<Formdata-ws-managed-form-id="form"- action={[{ dataSourceId: "resource", enabled: true }]}+ action={[{ dataSourceId: "resource" }]}successRedirect="#done"><button type="submit">Send</button>@@ -348,7 +348,7 @@ test("navigation ignores an in-flight submission from the old page", async () =>element: (<Formdata-ws-managed-form-id="form"- action={[{ dataSourceId: "resource", enabled: true }]}+ action={[{ dataSourceId: "resource" }]}onResultChange={(result) => results.push(result)}><button type="submit">Send</button>@@ -418,7 +418,7 @@ test("refresh failure retains the completed success result and does not replay P<output>{value}</output><Formdata-ws-managed-form-id="form"- action={[{ dataSourceId: "resource", enabled: true }]}+ action={[{ dataSourceId: "resource" }]}state={state}onStateChange={setState}onResultChange={(result) => results.push(result)}diff --git a/packages/sdk-components-react-router/src/resource-form.browser.test.tsx b/packages/sdk-components-react-router/src/resource-form.browser.test.tsxindex 4b9dbe2afa..9a243c1b6a 100644--- a/packages/sdk-components-react-router/src/resource-form.browser.test.tsx+++ b/packages/sdk-components-react-router/src/resource-form.browser.test.tsx@@ -128,7 +128,7 @@ test("managed Form posts its server identity and shows the action error", asyncreturn (<Formdata-ws-managed-form-id="form-instance"- action={[{ dataSourceId: "resource-id", enabled: true }]}+ action={[{ dataSourceId: "resource-id" }]}state={state}onStateChange={(state) => {stateChanges.push(state);@@ -246,7 +246,7 @@ test("managed Form reports success after the action succeeds", async () => {element: (<Formdata-ws-managed-form-id="form-instance"- action={[{ dataSourceId: "resource-id", enabled: true }]}+ action={[{ dataSourceId: "resource-id" }]}onStateChange={(state) => stateChanges.push(state)}onResultChange={(result) => resultChanges.push(result)}>diff --git a/packages/sdk-components-react/src/form-submission.test.ts b/packages/sdk-components-react/src/form-submission.test.tsindex 85e9d01caa..c3952005e2 100644--- a/packages/sdk-components-react/src/form-submission.test.ts+++ b/packages/sdk-components-react/src/form-submission.test.ts@@ -5,20 +5,14 @@ test("requires and limits Resource actions", () => {expect(validateFormSubmission([])).toMatch(/at least one/);const actions = Array.from({ length: 10 }, (_, index) => ({dataSourceId: String(index),- enabled: true,}));expect(validateFormSubmission(actions)).toBeUndefined();- expect(- validateFormSubmission([- ...actions,- { dataSourceId: "extra", enabled: true },- ])- ).toBe("Select no more than 10 Resource actions");+ expect(validateFormSubmission([...actions, { dataSourceId: "extra" }])).toBe(+ "Select no more than 10 Resource actions"+ );});-test("requires an Action array with explicit enabled state", () => {+test("requires an Action array with data source IDs", () => {expect(isFormSubmission({ destinations: ["resource"] })).toBe(false);- expect(isFormSubmission([{ dataSourceId: "resource", enabled: true }])).toBe(- true- );+ expect(isFormSubmission([{ dataSourceId: "resource" }])).toBe(true);});diff --git a/packages/sdk-components-react/src/resource-form-http.test.tsx b/packages/sdk-components-react/src/resource-form-http.test.tsxindex ed4cc1f288..c7c63afa91 100644--- a/packages/sdk-components-react/src/resource-form-http.test.tsx+++ b/packages/sdk-components-react/src/resource-form-http.test.tsx@@ -21,7 +21,7 @@ test("a router-free Form submits to a real JSON endpoint", async () => {createRoot(document.getElementById("root")).render(createElement(Form, {"data-ws-managed-form-id": "form-one",- action: [{ dataSourceId: "destination", enabled: true }],+ action: [{ dataSourceId: "destination" }],onStateChange: (state) => window.formStates.push(state),onResultChange: (result) => window.formResults.push(result),},diff --git a/packages/sdk-components-react/src/resource-form.browser.test.tsx b/packages/sdk-components-react/src/resource-form.browser.test.tsxindex 4d47fa4ad6..70b749ab69 100644--- a/packages/sdk-components-react/src/resource-form.browser.test.tsx+++ b/packages/sdk-components-react/src/resource-form.browser.test.tsx@@ -29,7 +29,7 @@ test("a StrictMode Form submits after the effect cleanup probe", async () => {root.render(<StrictMode><Form- action={[{ dataSourceId: "resource-one", enabled: true }]}+ action={[{ dataSourceId: "resource-one" }]}onManagedSubmit={onManagedSubmit}onResultChange={onResultChange}>@@ -59,7 +59,7 @@ test("a StrictMode Form aborts an active request on real unmount", async () => {root.render(<StrictMode><Form- action={[{ dataSourceId: "resource-one", enabled: true }]}+ action={[{ dataSourceId: "resource-one" }]}onManagedSubmit={(_values, requestSignal) => {signal = requestSignal;return new Promise(() => {});@@ -180,7 +180,7 @@ test("a throwing submit callback cannot trigger native delivery", async () => {await act(async () => {root.render(<Form- action={[{ dataSourceId: "resource-one", enabled: true }]}+ action={[{ dataSourceId: "resource-one" }]}onSubmit={() => {throw new Error("Submit callback failed");}}@@ -244,7 +244,7 @@ test("legacy native-mode settings do not activate saved Resource actions", asynctest("a Resource Form cannot natively submit without hydration", async () => {const html = renderToStaticMarkup(- <Form method="post" action={[{ dataSourceId: "resource", enabled: true }]}>+ <Form method="post" action={[{ dataSourceId: "resource" }]}><input name="email" defaultValue="[email protected]" /><button type="submit">Send</button></Form>@@ -311,7 +311,7 @@ test("a hydrated Form handles submit buttons associated by form id", async () =><><Formid="managed-form"- action={[{ dataSourceId: "resource-one", enabled: true }]}+ action={[{ dataSourceId: "resource-one" }]}onManagedSubmit={onManagedSubmit}><input name="email" defaultValue="[email protected]" />@@ -344,7 +344,7 @@ test("Form passes one structured submission to its dispatcher", async () => {await act(async () => {root.render(<Form- action={[{ dataSourceId: "resource-one", enabled: true }]}+ action={[{ dataSourceId: "resource-one" }]}onManagedSubmit={onManagedSubmit}><input name="name" defaultValue="Ada" />@@ -374,7 +374,7 @@ test("Form resolves Preview success redirects against the Preview page", async (await act(async () => {root.render(<Form- action={[{ dataSourceId: "resource-one", enabled: true }]}+ action={[{ dataSourceId: "resource-one" }]}successRedirect="thanks"getRedirectBaseUrl={() => "https://webstudio.local/contact"}onManagedSubmit={async () => ({@@ -417,7 +417,7 @@ test("unmatched Preview redirect keeps successful Form feedback on the current pawait act(async () => {root.render(<Form- action={[{ dataSourceId: "resource-one", enabled: true }]}+ action={[{ dataSourceId: "resource-one" }]}successRedirect="/missing"getRedirectBaseUrl={() => "https://webstudio.local/contact"}onManagedSubmit={async () => ({@@ -461,7 +461,7 @@ test("file-input settings enforce required uploads and keep optional or multipleact(async () =>root.render(<Form- action={[{ dataSourceId: "resource-one", enabled: true }]}+ action={[{ dataSourceId: "resource-one" }]}onManagedSubmit={onManagedSubmit}><input@@ -526,7 +526,7 @@ test("managed Form submits by HTTP outside a router provider and reports pendingroot.render(<Formdata-ws-managed-form-id="form-one"- action={[{ dataSourceId: "destination", enabled: true }]}+ action={[{ dataSourceId: "destination" }]}onStateChange={(state) => states.push(state)}onResultChange={(result) => results.push(result)}>@@ -633,7 +633,7 @@ test("Preview runs the supplied submission and reports its result without the puawait act(async () =>root.render(<Form- action={[{ dataSourceId: "email", enabled: true }]}+ action={[{ dataSourceId: "email" }]}onManagedSubmit={onManagedSubmit}onResultChange={onResultChange}>@@ -680,7 +680,7 @@ test("Preview reports rejected submissions as failures and clears pending state"await act(async () =>root.render(<Form- action={[{ dataSourceId: "email", enabled: true }]}+ action={[{ dataSourceId: "email" }]}onManagedSubmit={onManagedSubmit}onResultChange={onResultChange}onStateChange={(state) => states.push(state)}@@ -773,7 +773,7 @@ test("managed Form reports HTTP and network failures without native navigation",root.render(<Formdata-ws-managed-form-id="form-one"- action={[{ dataSourceId: "destination", enabled: true }]}+ action={[{ dataSourceId: "destination" }]}onResultChange={(result) => results.push(result)}><button type="submit">Send</button>@@ -862,7 +862,7 @@ test.each([const [errors, setErrors] = useState<Array<{ message: string }>>([]);return (<Form- action={[{ dataSourceId: "request", enabled: true }]}+ action={[{ dataSourceId: "request" }]}onManagedSubmit={async () => ({success: false,status: 422,diff --git a/packages/sdk-components-react/src/resource-form.test.tsx b/packages/sdk-components-react/src/resource-form.test.tsxindex 2676dbdbcc..7315f3a41f 100644--- a/packages/sdk-components-react/src/resource-form.test.tsx+++ b/packages/sdk-components-react/src/resource-form.test.tsx@@ -5,7 +5,7 @@ import { Form } from "./resource-form";test("Form exposes a valid action URL that identifies its mode", () => {const html = renderToStaticMarkup(<Form- action={[{ dataSourceId: "request", enabled: true }]}+ action={[{ dataSourceId: "request" }]}method="post"encType="multipart/form-data">@@ -37,12 +37,12 @@ test("server rendering blocks an over-limit managed Form", () => {const html = renderToStaticMarkup(<Formaction={[- { dataSourceId: "one", enabled: true },- { dataSourceId: "two", enabled: true },- { dataSourceId: "three", enabled: true },- { dataSourceId: "four", enabled: true },- { dataSourceId: "five", enabled: true },- { dataSourceId: "six", enabled: true },+ { dataSourceId: "one" },+ { dataSourceId: "two" },+ { dataSourceId: "three" },+ { dataSourceId: "four" },+ { dataSourceId: "five" },+ { dataSourceId: "six" },]}><button type="submit">Send</button>diff --git a/packages/sdk-components-registry/src/core-templates.test.tsx b/packages/sdk-components-registry/src/core-templates.test.tsxindex e232aa941f..5eb9861f44 100644--- a/packages/sdk-components-registry/src/core-templates.test.tsx+++ b/packages/sdk-components-registry/src/core-templates.test.tsx@@ -302,7 +302,7 @@ test("new Form templates select project and visitor Email Resources", () => {);expect(action).toMatchObject({type: "json",- value: emailSources.map(({ id }) => ({ dataSourceId: id, enabled: true })),+ value: emailSources.map(({ id }) => ({ dataSourceId: id })),});expect(emailSources.map(({ scopeInstanceId }) => scopeInstanceId)).toEqual([form.id,diff --git a/packages/sdk/src/form-submission.test.ts b/packages/sdk/src/form-submission.test.tsindex 67285602bb..f7455e0406 100644--- a/packages/sdk/src/form-submission.test.ts+++ b/packages/sdk/src/form-submission.test.ts@@ -1,36 +1,36 @@import { expect, test } from "vitest";import {- getEnabledFormActions,+ getFormActions,isFormSubmission,validateFormSubmission,} from "./form-submission";-test("enabled Actions preserve configured order", () => {+test("Actions preserve configured order and ignore legacy enabled keys", () => {const actions = [- { dataSourceId: "third", enabled: true },+ { dataSourceId: "third" },{ dataSourceId: "second", enabled: false },- { dataSourceId: "first", enabled: true },+ { dataSourceId: "first" },];expect(isFormSubmission(actions)).toBe(true);expect(validateFormSubmission(actions)).toBeUndefined();- expect(getEnabledFormActions(actions)).toEqual(["third", "first"]);+ expect(getFormActions(actions)).toEqual(["third", "second", "first"]);});-test("all-disabled, duplicate and over-limit Actions are rejected", () => {- expect(- validateFormSubmission([{ dataSourceId: "first", enabled: false }])- ).toBe("Enable at least one action");+test("empty, duplicate and over-limit Actions are rejected", () => {+ expect(validateFormSubmission([{ dataSourceId: "first" }])).toBeUndefined();+ expect(validateFormSubmission([])).toBe(+ "Select at least one Resource action"+ );expect(validateFormSubmission([- { dataSourceId: "first", enabled: true },- { dataSourceId: "first", enabled: false },+ { dataSourceId: "first" },+ { dataSourceId: "first" },])).toBe("Select each Resource only once");expect(validateFormSubmission(Array.from({ length: 11 }, (_, i) => ({dataSourceId: String(i),- enabled: true,})))).toBe("Select no more than 10 Resource actions");@@ -39,7 +39,6 @@ test("all-disabled, duplicate and over-limit Actions are rejected", () => {test("accepts 10 Resource actions", () => {const actions = Array.from({ length: 10 }, (_, i) => ({dataSourceId: String(i),- enabled: true,}));expect(validateFormSubmission(actions)).toBeUndefined();});@@ -47,9 +46,8 @@ test("accepts 10 Resource actions", () => {test.each([{ destinations: ["first"] },"https://example.com/submit",- [{ dataSourceId: "first" }],- [{ dataSourceId: 1, enabled: true }],- [{ dataSourceId: "first", enabled: "true" }],+ [{ dataSourceId: 1 }],+ [{}],[null],])("rejects malformed Action configuration: %j", (value) => {expect(isFormSubmission(value)).toBe(false);diff --git a/packages/sdk/src/form/action.ts b/packages/sdk/src/form/action.tsindex 45c7f1b6bb..5f54033563 100644--- a/packages/sdk/src/form/action.ts+++ b/packages/sdk/src/form/action.ts@@ -1,13 +1,10 @@export const maxFormActions = 10;-export const noEnabledFormActionMessage = "Enable at least one action";export const resourceFormActionUrl = "?__webstudio__=resources";export const navigationFormActionUrl = "?__webstudio__=navigate";export type FormAction = {/** Resource data source ID, stable across renames. */dataSourceId: string;- /** Disabled Actions retain their configured position but do not execute. */- enabled: boolean;};/** Actions execute in parallel and report results in their configured order. */@@ -19,13 +16,12 @@ export const isFormSubmission = (value: unknown): value is FormSubmission =>(action) =>typeof action === "object" &&action !== null &&- typeof action.dataSourceId === "string" &&- typeof action.enabled === "boolean"+ typeof action.dataSourceId === "string");export const validateFormSubmission = (actions: FormSubmission) => {- if (getEnabledFormActions(actions).length === 0) {- return noEnabledFormActionMessage;+ if (actions.length === 0) {+ return "Select at least one Resource action";}if (actions.length > maxFormActions) {return `Select no more than ${maxFormActions} Resource actions`;@@ -38,7 +34,5 @@ export const validateFormSubmission = (actions: FormSubmission) => {}};-export const getEnabledFormActions = (actions: FormSubmission) =>- actions- .filter((action) => action.enabled)- .map((action) => action.dataSourceId);+export const getFormActions = (actions: FormSubmission) =>+ actions.map((action) => action.dataSourceId);diff --git a/packages/sdk/src/form/server-handler.ts b/packages/sdk/src/form/server-handler.tsindex dcdfc58224..10782c00ee 100644--- a/packages/sdk/src/form/server-handler.ts+++ b/packages/sdk/src/form/server-handler.ts@@ -1,6 +1,6 @@import { managedFormIdFieldName } from "./fields";import {- getEnabledFormActions,+ getFormActions,isFormSubmission,validateFormSubmission,} from "./action";@@ -81,7 +81,7 @@ export const handleManagedFormSubmission = async ({}if (configured.resourceIds.length !==- getEnabledFormActions(configured.action).length ||+ getFormActions(configured.action).length ||configured.resourceIds.some((id) => id === null)) {throw new Error("Resource destination not found");diff --git a/packages/sdk/src/managed-form-handler.test.ts b/packages/sdk/src/managed-form-handler.test.tsindex a4d9f56205..124ab88632 100644--- a/packages/sdk/src/managed-form-handler.test.ts+++ b/packages/sdk/src/managed-form-handler.test.ts@@ -53,7 +53,7 @@ test("the shared handler executes a Form graph from the supplied runtime configusearch: {},},configuration: () => ({- action: [{ dataSourceId: "source", enabled: true }],+ action: [{ dataSourceId: "source" }],resourceIds: ["http"],}),getGraph,@@ -169,7 +169,7 @@ test("a dynamic recipient list from a Resource output is rejected before any sensearch: {},},configuration: () => ({- action: [{ dataSourceId: "email-source", enabled: true }],+ action: [{ dataSourceId: "email-source" }],resourceIds: ["email"],}),getGraph: () => graph,@@ -266,8 +266,8 @@ test.each([},configuration: () => ({action: [- { dataSourceId: "http-source", enabled: true },- { dataSourceId: "email-source", enabled: true },+ { dataSourceId: "http-source" },+ { dataSourceId: "email-source" },],resourceIds: ["http", "email"],}),@@ -355,8 +355,8 @@ test("a resolved six-mailbox bound recipient list fails before any send", async},configuration: () => ({action: [- { dataSourceId: "http-source", enabled: true },- { dataSourceId: "email-source", enabled: true },+ { dataSourceId: "http-source" },+ { dataSourceId: "email-source" },],resourceIds: ["http", "email"],}),@@ -448,7 +448,6 @@ test("three webhooks complete when the Email Service rate-limits one destinationconfiguration: () => ({action: graph.rootIds.map((dataSourceId) => ({dataSourceId,- enabled: true,})),resourceIds: graph.rootIds,}),@@ -516,10 +515,7 @@ test("a visitor Email Resource sends in parallel and a failed delivery remains nsearch: {},},configuration: () => ({- action: [- { dataSourceId: "http", enabled: true },- { dataSourceId: "visitor", enabled: true },- ],+ action: [{ dataSourceId: "http" }, { dataSourceId: "visitor" }],resourceIds: ["http", "visitor"],}),getGraph: () => ({@@ -635,7 +631,6 @@ test("two visitor Email Resources fail preflight before any action runs", asyncconfiguration: () => ({action: resourceIds.map((dataSourceId) => ({dataSourceId,- enabled: true,})),resourceIds,}),@@ -695,10 +690,7 @@ test.each([undefined, "invalid-address"])(search: {},},configuration: () => ({- action: [- { dataSourceId: "http", enabled: true },- { dataSourceId: "visitor", enabled: true },- ],+ action: [{ dataSourceId: "http" }, { dataSourceId: "visitor" }],resourceIds: ["http", "visitor"],}),getGraph: () => ({@@ -803,10 +795,7 @@ test.each([pathname: "/",},configuration: () => ({- action: [- { dataSourceId: "visitor", enabled: true },- { dataSourceId: "http", enabled: true },- ],+ action: [{ dataSourceId: "visitor" }, { dataSourceId: "http" }],resourceIds: ["visitor", "http"],}),getGraph: () => ({@@ -928,10 +917,7 @@ test.each([false, true])(pathname: "/",},configuration: () => ({- action: [- { dataSourceId: "http", enabled: true },- { dataSourceId: "visitor", enabled: true },- ],+ action: [{ dataSourceId: "http" }, { dataSourceId: "visitor" }],resourceIds: ["http", "visitor"],}),getGraph: () => ({diff --git a/packages/sdk/src/managed-form-resources-generator.test.ts b/packages/sdk/src/managed-form-resources-generator.test.tsindex da493e5718..624b96faa9 100644--- a/packages/sdk/src/managed-form-resources-generator.test.ts+++ b/packages/sdk/src/managed-form-resources-generator.test.ts@@ -2505,7 +2505,6 @@ test.each([configuration: () => ({action: input.destinationDataSourceIds.map((dataSourceId) => ({dataSourceId,- enabled: true,})),resourceIds: ["http", "visitor"],}),diff --git a/packages/sdk/src/resources-generator.test.tsx b/packages/sdk/src/resources-generator.test.tsxindex bdd3b4206d..9862c88909 100644--- a/packages/sdk/src/resources-generator.test.tsx+++ b/packages/sdk/src/resources-generator.test.tsx@@ -78,7 +78,7 @@ test("does not fetch a Form-bound Resource during page load", () => {instanceId: "form",type: "json",name: "action",- value: [{ dataSourceId: "resourceVariableId", enabled: true }],+ value: [{ dataSourceId: "resourceVariableId" }],},]),});@@ -150,8 +150,8 @@ test("does not evaluate configured Form Actions during page load", () => {type: "json",name: "action",value: [- { dataSourceId: "graphql-source", enabled: true },- { dataSourceId: "disabled-source", enabled: false },+ { dataSourceId: "graphql-source" },+ { dataSourceId: "disabled-source" },],},]),@@ -163,7 +163,7 @@ test("does not evaluate configured Form Actions during page load", () => {expect(generated).not.toContain("formData.name");});-test("keeps a page-used Resource selected as a disabled Form Action", () => {+test("keeps a page-used Resource selected as a Form Action", () => {const generated = generatePageResources({scope: createScope(),page: { rootInstanceId: "body" } as Page,@@ -221,7 +221,7 @@ test("keeps a page-used Resource selected as a disabled Form Action", () => {instanceId: "form",type: "json",name: "action",- value: [{ dataSourceId: "form-shared-source", enabled: false }],+ value: [{ dataSourceId: "form-shared-source" }],},]),});diff --git a/packages/template/src/jsx.test.tsx b/packages/template/src/jsx.test.tsxindex 8af5103dc7..94f1e0af08 100644--- a/packages/template/src/jsx.test.tsx+++ b/packages/template/src/jsx.test.tsx@@ -1196,8 +1196,8 @@ test("render Form actions with local Email Resources", () => {expect(props.find(({ name }) => name === "action")).toMatchObject({type: "json",value: [- { dataSourceId: dataSources[0].id, enabled: true },- { dataSourceId: dataSources[1].id, enabled: true },+ { dataSourceId: dataSources[0].id },+ { dataSourceId: dataSources[1].id },],});expect(diff --git a/packages/template/src/jsx.ts b/packages/template/src/jsx.tsindex 3d2d74980f..aa34805e6b 100644--- a/packages/template/src/jsx.ts+++ b/packages/template/src/jsx.ts@@ -772,7 +772,6 @@ export const renderTemplate = (type: "json",value: value.resources.map((resource) => ({dataSourceId: getVariableId(instanceId, resource),- enabled: true,})),});continue;