@wix/agent-skills 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +111 -0
- package/package.json +29 -0
- package/skills/wix-app/SKILL.md +344 -0
- package/skills/wix-app/references/APP_IDENTIFIERS.md +35 -0
- package/skills/wix-app/references/APP_MARKET_REVIEW.md +311 -0
- package/skills/wix-app/references/APP_VALIDATION.md +171 -0
- package/skills/wix-app/references/BACKEND_API.md +233 -0
- package/skills/wix-app/references/BACKEND_EVENT.md +116 -0
- package/skills/wix-app/references/CODE_QUALITY.md +33 -0
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +587 -0
- package/skills/wix-app/references/DASHBOARD_MENU_PLUGIN.md +157 -0
- package/skills/wix-app/references/DASHBOARD_MODAL.md +283 -0
- package/skills/wix-app/references/DASHBOARD_PAGE.md +403 -0
- package/skills/wix-app/references/DASHBOARD_PLUGIN.md +205 -0
- package/skills/wix-app/references/DATA_COLLECTION.md +451 -0
- package/skills/wix-app/references/DOCUMENTATION.md +42 -0
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +65 -0
- package/skills/wix-app/references/EMBEDDED_SCRIPT.md +468 -0
- package/skills/wix-app/references/EXTENSION_REGISTRATION.md +96 -0
- package/skills/wix-app/references/SERVICE_PLUGIN.md +235 -0
- package/skills/wix-app/references/SITE_PLUGIN.md +436 -0
- package/skills/wix-app/references/STORES_VERSIONING.md +334 -0
- package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +84 -0
- package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +345 -0
- package/skills/wix-app/references/dashboard-menu-plugin/blog-slots.md +71 -0
- package/skills/wix-app/references/dashboard-menu-plugin/bookings-slots.md +58 -0
- package/skills/wix-app/references/dashboard-menu-plugin/crm-slots.md +8 -0
- package/skills/wix-app/references/dashboard-menu-plugin/ecommerce-slots.md +17 -0
- package/skills/wix-app/references/dashboard-menu-plugin/events-slots.md +29 -0
- package/skills/wix-app/references/dashboard-menu-plugin/restaurants-slots.md +27 -0
- package/skills/wix-app/references/dashboard-menu-plugin/stores-slots.md +35 -0
- package/skills/wix-app/references/dashboard-page/API_SPEC.md +138 -0
- package/skills/wix-app/references/dashboard-page/DASHBOARD_API.md +573 -0
- package/skills/wix-app/references/dashboard-page/DYNAMIC_PARAMETERS.md +269 -0
- package/skills/wix-app/references/dashboard-page/ECOM_NAVIGATION.md +164 -0
- package/skills/wix-app/references/dashboard-plugin/SLOTS.md +294 -0
- package/skills/wix-app/references/data-collection/WIX_DATA.md +270 -0
- package/skills/wix-app/references/data-collection/extension-template.ts +107 -0
- package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +138 -0
- package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +454 -0
- package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +165 -0
- package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +576 -0
- package/skills/wix-app/references/editor-react-component/DIRECTIONALITY.md +170 -0
- package/skills/wix-app/references/editor-react-component/EDIT-FLOW.md +6 -0
- package/skills/wix-app/references/editor-react-component/PARTS.md +25 -0
- package/skills/wix-app/references/editor-react-component/PROPS-VS-CSS.md +203 -0
- package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +167 -0
- package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +137 -0
- package/skills/wix-app/references/service-plugin/ADDITIONAL-FEES.md +112 -0
- package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +118 -0
- package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +87 -0
- package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +86 -0
- package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +135 -0
- package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +79 -0
- package/skills/wix-app/references/service-plugin/VALIDATIONS.md +68 -0
- package/skills/wix-app/references/site-plugin/EXAMPLES.md +311 -0
- package/skills/wix-app/references/site-plugin/SLOTS.md +263 -0
- package/skills/wix-design-system/SKILL.md +129 -0
- package/skills/wix-design-system/references/file-structure.md +56 -0
- package/skills/wix-design-system/scripts/wds.cjs +531 -0
- package/skills/wix-headless/SKILL.md +418 -0
- package/skills/wix-headless/references/DISCOVERY.md +332 -0
- package/skills/wix-headless/references/ORCHESTRATION.md +269 -0
- package/skills/wix-headless/references/SETUP.md +154 -0
- package/skills/wix-headless/references/blog/BLOG_CONTENT.md +152 -0
- package/skills/wix-headless/references/blog/BLOG_PAGES.md +299 -0
- package/skills/wix-headless/references/blog/BLOG_SETUP.md +218 -0
- package/skills/wix-headless/references/blog/INSTRUCTIONS.md +32 -0
- package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +373 -0
- package/skills/wix-headless/references/cms/FAQ_KNOWLEDGE_BASE.md +229 -0
- package/skills/wix-headless/references/cms/INSTRUCTIONS.md +40 -0
- package/skills/wix-headless/references/cms/PORTFOLIO.md +454 -0
- package/skills/wix-headless/references/cms/RESOURCE_LIBRARY.md +356 -0
- package/skills/wix-headless/references/cms/TEAM_DIRECTORY.md +299 -0
- package/skills/wix-headless/references/commands/install-app.md +42 -0
- package/skills/wix-headless/references/commands/known-apps.json +5 -0
- package/skills/wix-headless/references/commands/mcp-bootstrap.md +28 -0
- package/skills/wix-headless/references/designer/INSTRUCTIONS.md +828 -0
- package/skills/wix-headless/references/ecom/CART_PAGES.md +120 -0
- package/skills/wix-headless/references/ecom/CART_WIRING.md +103 -0
- package/skills/wix-headless/references/ecom/COMPONENTS_CSS.md +132 -0
- package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +59 -0
- package/skills/wix-headless/references/forms/CONTACT_FORM.md +477 -0
- package/skills/wix-headless/references/forms/INSTRUCTIONS.md +43 -0
- package/skills/wix-headless/references/gift-cards/COMPONENTS.md +119 -0
- package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +51 -0
- package/skills/wix-headless/references/gift-cards/PAGES.md +129 -0
- package/skills/wix-headless/references/images/INSTRUCTIONS.md +359 -0
- package/skills/wix-headless/references/shared/BUILD_NOISE.md +8 -0
- package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +185 -0
- package/skills/wix-headless/references/shared/IMPLEMENTER.md +155 -0
- package/skills/wix-headless/references/shared/MCP_PREFIX.md +105 -0
- package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +97 -0
- package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +423 -0
- package/skills/wix-headless/references/shared/STYLING.md +117 -0
- package/skills/wix-headless/references/stores/BACK_IN_STOCK.md +178 -0
- package/skills/wix-headless/references/stores/CATEGORY_PAGES.md +86 -0
- package/skills/wix-headless/references/stores/COMPONENTS_CSS.md +129 -0
- package/skills/wix-headless/references/stores/HOME_AND_NAV.md +227 -0
- package/skills/wix-headless/references/stores/INSTRUCTIONS.md +96 -0
- package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +249 -0
- package/skills/wix-headless/references/stores/PRODUCT_PAGES.md +213 -0
- package/skills/wix-headless/references/stores/SHARED_WIRING.md +164 -0
- package/skills/wix-headless/references/verticals/_schema.json +160 -0
- package/skills/wix-headless/references/verticals/_schema.md +185 -0
- package/skills/wix-headless/references/verticals/blog.md +125 -0
- package/skills/wix-headless/references/verticals/cms.md +121 -0
- package/skills/wix-headless/references/verticals/ecom.md +96 -0
- package/skills/wix-headless/references/verticals/forms.md +106 -0
- package/skills/wix-headless/references/verticals/gift-cards.md +121 -0
- package/skills/wix-headless/references/verticals/stores.md +167 -0
- package/skills/wix-headless/scripts/check-manifest.mjs +198 -0
- package/skills/wix-headless/scripts/copy-utility-templates.mjs +153 -0
- package/skills/wix-headless/scripts/emit-design-tokens.mjs +77 -0
- package/skills/wix-headless/scripts/finalize-run-json.mjs +141 -0
- package/skills/wix-headless/scripts/init-site-json.mjs +63 -0
- package/skills/wix-headless/scripts/patch-decorative-slots.mjs +124 -0
- package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +190 -0
- package/skills/wix-headless/scripts/preview.sh +45 -0
- package/skills/wix-headless/scripts/release.sh +73 -0
- package/skills/wix-headless/scripts/scaffold.sh +53 -0
- package/skills/wix-headless/scripts/seed-utilities.sh +55 -0
- package/skills/wix-headless/shared-utilities/analytics.ts +40 -0
- package/skills/wix-headless/shared-utilities/ricos.ts +179 -0
- package/skills/wix-headless/shared-utilities/wix-image.ts +72 -0
- package/skills/wix-headless/templates/ecom/CartBadge.tsx +84 -0
- package/skills/wix-headless/templates/ecom/CartView.tsx +543 -0
- package/skills/wix-headless/templates/ecom/cart.astro +13 -0
- package/skills/wix-headless/templates/ecom/components-ecom.css +215 -0
- package/skills/wix-headless/templates/ecom/discounts.ts +71 -0
- package/skills/wix-headless/templates/ecom/thank-you.astro +24 -0
- package/skills/wix-headless/templates/gift-cards/GiftCardPurchase.tsx +172 -0
- package/skills/wix-headless/templates/gift-cards/_home-teaser-snippet.astro +42 -0
- package/skills/wix-headless/templates/gift-cards/_nav-snippet.astro +11 -0
- package/skills/wix-headless/templates/gift-cards/components-gift-cards.css +219 -0
- package/skills/wix-headless/templates/gift-cards/gift-cards.astro +51 -0
- package/skills/wix-headless/templates/gift-cards/gift-cards.ts +75 -0
- package/skills/wix-headless/templates/stores/AddToCartButton.tsx +77 -0
- package/skills/wix-headless/templates/stores/BackInStockForm.tsx +176 -0
- package/skills/wix-headless/templates/stores/CategoryRail.astro +69 -0
- package/skills/wix-headless/templates/stores/ProductCard.astro +79 -0
- package/skills/wix-headless/templates/stores/ProductPurchase.tsx +397 -0
- package/skills/wix-headless/templates/stores/SeoTags.astro +21 -0
- package/skills/wix-headless/templates/stores/back-in-stock.ts +67 -0
- package/skills/wix-headless/templates/stores/categories.ts +155 -0
- package/skills/wix-headless/templates/stores/category/[slug].astro +130 -0
- package/skills/wix-headless/templates/stores/components-stores.css +295 -0
- package/skills/wix-headless/templates/stores/products/[slug].astro +128 -0
- package/skills/wix-headless/templates/stores/products/index.astro +101 -0
- package/skills/wix-manage/SKILL.md +280 -0
- package/skills/wix-manage/references/app-installation/install-wix-apps.md +155 -0
- package/skills/wix-manage/references/app-installation/list-installed-apps.md +124 -0
- package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +226 -0
- package/skills/wix-manage/references/bookings/booking-service-policy-setup.md +95 -0
- package/skills/wix-manage/references/bookings/booking-system-integration-gaps.md +416 -0
- package/skills/wix-manage/references/bookings/bookings-staff-setup.md +255 -0
- package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +462 -0
- package/skills/wix-manage/references/bookings/end-to-end-booking-flow.md +278 -0
- package/skills/wix-manage/references/bookings/external-calendar-integration.md +258 -0
- package/skills/wix-manage/references/bookings/multi-resource-service-creation.md +231 -0
- package/skills/wix-manage/references/calendar/configure-default-business-hours.md +226 -0
- package/skills/wix-manage/references/cms/cms-data-items-crud.md +422 -0
- package/skills/wix-manage/references/cms/cms-data-operations-extended.md +263 -0
- package/skills/wix-manage/references/cms/cms-ecommerce-catalog-integration.md +136 -0
- package/skills/wix-manage/references/cms/cms-references-and-relationships.md +160 -0
- package/skills/wix-manage/references/cms/cms-schema-management.md +143 -0
- package/skills/wix-manage/references/contacts/bulk-delete-contacts.md +73 -0
- package/skills/wix-manage/references/contacts/bulk-label-and-unlabel-contacts.md +67 -0
- package/skills/wix-manage/references/domains/domain-search-and-purchase.md +434 -0
- package/skills/wix-manage/references/ecommerce/api-recommendation-tracking.md +420 -0
- package/skills/wix-manage/references/ecommerce/flow-add-free-shipping.md +267 -0
- package/skills/wix-manage/references/ecommerce/flow-bundle-and-save.md +290 -0
- package/skills/wix-manage/references/ecommerce/flow-fix-coverage-gaps.md +300 -0
- package/skills/wix-manage/references/ecommerce/flow-optimize-shipping-rates.md +364 -0
- package/skills/wix-manage/references/ecommerce/flow-seasonal-promotion.md +315 -0
- package/skills/wix-manage/references/ecommerce/flow-stock-mover.md +308 -0
- package/skills/wix-manage/references/ecommerce/flow-upsell-boost.md +271 -0
- package/skills/wix-manage/references/ecommerce/goal-clear-inventory.md +118 -0
- package/skills/wix-manage/references/ecommerce/goal-drive-cross-sells.md +122 -0
- package/skills/wix-manage/references/ecommerce/goal-increase-aov.md +132 -0
- package/skills/wix-manage/references/ecommerce/goal-reduce-cart-abandonment.md +148 -0
- package/skills/wix-manage/references/ecommerce/goal-seasonal-revenue.md +146 -0
- package/skills/wix-manage/references/ecommerce/guardrail-discount-conflicts.md +118 -0
- package/skills/wix-manage/references/ecommerce/guardrail-margin-protection.md +88 -0
- package/skills/wix-manage/references/ecommerce/guardrail-rate-pricing-sanity.md +108 -0
- package/skills/wix-manage/references/ecommerce/guardrail-shipping-health.md +124 -0
- package/skills/wix-manage/references/ecommerce/recipe-apply-shipping-recommendations.md +299 -0
- package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +582 -0
- package/skills/wix-manage/references/ecommerce/setup-coupons.md +338 -0
- package/skills/wix-manage/references/ecommerce/setup-discount-rules.md +444 -0
- package/skills/wix-manage/references/ecommerce/setup-shipping-rates.md +86 -0
- package/skills/wix-manage/references/ecommerce/setup-shipping-regions.md +56 -0
- package/skills/wix-manage/references/ecommerce/setup-store-pickup-location.md +209 -0
- package/skills/wix-manage/references/ecommerce/skill-graph.md +139 -0
- package/skills/wix-manage/references/ecommerce/troubleshoot-checkout-delivery-dropoff.md +124 -0
- package/skills/wix-manage/references/ecommerce/troubleshoot-discount-not-applying.md +95 -0
- package/skills/wix-manage/references/events/list-events.md +203 -0
- package/skills/wix-manage/references/forms/create-form.md +260 -0
- package/skills/wix-manage/references/get-paid/create-payment-links.md +212 -0
- package/skills/wix-manage/references/get-paid/how-to-setup-wix-payments.md +57 -0
- package/skills/wix-manage/references/get-paid/payment-links-for-bookings.md +101 -0
- package/skills/wix-manage/references/media/upload-media-to-wix.md +216 -0
- package/skills/wix-manage/references/pricing-plans/create-and-update-pricing-plans.md +77 -0
- package/skills/wix-manage/references/pricing-plans/pricing-plans-bookings-integration.md +166 -0
- package/skills/wix-manage/references/restaurants/wix-restaurants-setup.md +336 -0
- package/skills/wix-manage/references/rich-content/ricos-converter-service.md +295 -0
- package/skills/wix-manage/references/site-properties/change-payment-currency-site-properties.md +59 -0
- package/skills/wix-manage/references/sites/create-site-from-template.md +183 -0
- package/skills/wix-manage/references/sites/query-sites.md +125 -0
- package/skills/wix-manage/references/stores/add-store-pages-to-site.md +57 -0
- package/skills/wix-manage/references/stores/bulk-create-products-with-options.md +1041 -0
- package/skills/wix-manage/references/stores/create-product-catalog-v1.md +125 -0
- package/skills/wix-manage/references/stores/create-product-from-image.md +824 -0
- package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +566 -0
- package/skills/wix-manage/references/stores/find-products-query-and-search-catalog-v3.md +194 -0
- package/skills/wix-manage/references/stores/query-products-catalog-v1.md +80 -0
- package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +99 -0
- package/skills/wix-manage/references/stores/update-product-pre-order.md +213 -0
- package/skills/wix-manage/references/stores/update-product-with-options.md +318 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gift-cards-implementer
|
|
3
|
+
description: "Implements the passive Wix Gift Cards vertical — runtime probe util, GiftCardPurchase island, /gift-cards page, and conditional nav/home contributions. Scopes: components, pages. Extends references/shared/IMPLEMENTER.md."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Gift Cards Implementer
|
|
7
|
+
|
|
8
|
+
Extends `references/shared/IMPLEMENTER.md`. Read that file first for phase routing, MCP prefix, site.json read pattern, return contract, style conventions, and common failure modes.
|
|
9
|
+
|
|
10
|
+
## Scope routing
|
|
11
|
+
|
|
12
|
+
| Scope | Phase | Reference |
|
|
13
|
+
|-------|-------|-----------|
|
|
14
|
+
| `components` | Components (probe util, React island, scoped CSS) | `./COMPONENTS.md` |
|
|
15
|
+
| `pages` | Pages (gift-cards landing + Navigation/index patches) | `./PAGES.md` |
|
|
16
|
+
|
|
17
|
+
This pack has **no `seed` scope** — the dashboard's eGift Card template is the source of truth and we never seed denominations from code.
|
|
18
|
+
|
|
19
|
+
## Files this vertical creates / contributes
|
|
20
|
+
|
|
21
|
+
See `<SKILL_ROOT>/references/verticals/gift-cards.md` frontmatter (`creates:` and `contributes:` blocks).
|
|
22
|
+
|
|
23
|
+
## Pre-return file-existence assertion (pages scope)
|
|
24
|
+
|
|
25
|
+
Before returning `status: "complete"` from the `pages` scope, verify every file in `creates:` (phase: pages) plus the patched files in `contributes:` exists on disk. If a declared file is missing, return `status: "partial"` with `errors: [{ code: "PHASE4_FILE_MISSING", path: "<expected path>" }]` rather than claiming success.
|
|
26
|
+
|
|
27
|
+
## Templates
|
|
28
|
+
|
|
29
|
+
Canonical templates live at `<SKILL_ROOT>/templates/gift-cards/`. Your `components` and `pages` scopes read these and adapt them — don't invent markup or logic.
|
|
30
|
+
|
|
31
|
+
Components (`components` scope):
|
|
32
|
+
- `<SKILL_ROOT>/templates/gift-cards/gift-cards.ts`
|
|
33
|
+
- `<SKILL_ROOT>/templates/gift-cards/GiftCardPurchase.tsx`
|
|
34
|
+
- `<SKILL_ROOT>/templates/gift-cards/components-gift-cards.css`
|
|
35
|
+
|
|
36
|
+
Pages (`pages` scope):
|
|
37
|
+
- `<SKILL_ROOT>/templates/gift-cards/gift-cards.astro`
|
|
38
|
+
- `<SKILL_ROOT>/templates/gift-cards/_nav-snippet.astro` — exact contribution to insert at `<!-- nav:links -->` in `Navigation.astro`
|
|
39
|
+
- `<SKILL_ROOT>/templates/gift-cards/_home-teaser-snippet.astro` — exact contribution to insert at `<!-- home:gift-cards -->` in `index.astro`
|
|
40
|
+
|
|
41
|
+
## Gift-cards-specific failure modes
|
|
42
|
+
|
|
43
|
+
| Wrong | Right |
|
|
44
|
+
|---|---|
|
|
45
|
+
| Hardcode denominations in code | Always read `presetVariants` from the live API (`getGiftCardProduct()`) |
|
|
46
|
+
| Call `createGiftCardProduct` or any seeding op | Never seed; the dashboard owns the template |
|
|
47
|
+
| Wrap calls in `auth.elevate(...)` | The probe is visitor-scoped already; elevation breaks it |
|
|
48
|
+
| Forget to import `getGiftCardProduct` when patching `Navigation.astro` or `index.astro` | When inserting at a marker, also add the corresponding import + frontmatter call to that file |
|
|
49
|
+
| Drop or rename the marker comment after inserting | Preserve the marker line — future re-runs and other verticals depend on it |
|
|
50
|
+
| Render the page when probe returns `null` | Redirect to `/` (`Astro.redirect("/", 302)`) so users following stale links never see a broken page |
|
|
51
|
+
| Skip memoization of `getGiftCardProduct()` | Module-level cache promise — Navigation, home, and page render in the same request and must coalesce to one fetch |
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Phase 4 Pages — Gift Cards
|
|
2
|
+
|
|
3
|
+
Launched in **Step 7** alongside other verticals' `pages` scopes. Writes the `/gift-cards` route and patches `Navigation.astro` + `index.astro` at their declared markers. The Components scope's outputs (`src/utils/gift-cards.ts`, `src/components/GiftCardPurchase.tsx`, `src/styles/components-gift-cards.css`) must already exist before this scope runs.
|
|
4
|
+
|
|
5
|
+
## Scope
|
|
6
|
+
|
|
7
|
+
Files this agent OWNS (writes fresh):
|
|
8
|
+
|
|
9
|
+
- `src/pages/gift-cards.astro` — landing page; redirects to `/` when probe returns null
|
|
10
|
+
|
|
11
|
+
Files this agent PATCHES (insert at marker, preserve everything else):
|
|
12
|
+
|
|
13
|
+
- `src/components/Navigation.astro` — insert "Gift Cards" link at `<!-- nav:links -->`
|
|
14
|
+
- `src/pages/index.astro` — insert home teaser at `<!-- home:gift-cards -->`
|
|
15
|
+
|
|
16
|
+
Files this agent MUST NOT touch:
|
|
17
|
+
- `src/utils/gift-cards.ts`, `src/components/GiftCardPurchase.tsx`, `src/styles/components-gift-cards.css` — Components scope.
|
|
18
|
+
- Any other vertical's nav/home contributions.
|
|
19
|
+
- `Layout.astro`, `global.css`, or any product/cart/checkout page.
|
|
20
|
+
|
|
21
|
+
## Critical rules
|
|
22
|
+
|
|
23
|
+
1. **Marker-based patching.** Read the shell file, locate the exact marker comment string (`<!-- nav:links -->` or `<!-- home:gift-cards -->`), insert your snippet immediately AFTER the marker line, preserve the marker line itself. See `references/shared/IMPLEMENTER.md` § "Contributing to shared files via markers".
|
|
24
|
+
2. **Inject the import + frontmatter call when patching.** When inserting at `<!-- nav:links -->` in `Navigation.astro`, also add `import { getGiftCardProduct } from "../utils/gift-cards";` and `const giftCardsEnabled = (await getGiftCardProduct()) !== null;` to the file's frontmatter (top of the file). Same for `index.astro`'s home teaser. Do NOT assume another vertical added them.
|
|
25
|
+
3. **SSR error guards.** Wrap `getGiftCardProduct()` calls in try/catch with safe fallback (`giftCardsEnabled = false` / `giftCardProduct = null`). See `references/shared/IMPLEMENTER.md` § "SSR error guards". Although the helper itself never throws, the guard cost is zero and protects against future regressions.
|
|
26
|
+
4. **Redirect rather than render** when the page-level probe returns null. `if (!product) return Astro.redirect("/", 302);` — same pattern as private/disabled-feature routes elsewhere.
|
|
27
|
+
5. **Memoization is per-request.** Navigation, home, and the page may all call `getGiftCardProduct()` on the same request — the helper coalesces them into one fetch. You do not need to thread the result through Astro context.
|
|
28
|
+
6. **No HTML comments in `.astro` frontmatter** — frontmatter is TypeScript; use `//` or `/* */`.
|
|
29
|
+
7. **Image rendering uses `resolveWixImageUrl`** — the gift-card product's `image` field is a Wix media object identical in shape to product/blog images. Import from `../utils/wix-image`.
|
|
30
|
+
|
|
31
|
+
## Template files
|
|
32
|
+
|
|
33
|
+
Snippets to insert at markers live as standalone template fragments. Read each, substitute any contract-class adaptations, paste at the marker.
|
|
34
|
+
|
|
35
|
+
- `templates/gift-cards.astro` — full landing page
|
|
36
|
+
- `templates/_nav-snippet.astro` — single line for `Navigation.astro` (the `{giftCardsEnabled && <a>...</a>}` expression)
|
|
37
|
+
- `templates/_home-teaser-snippet.astro` — multi-line block for `index.astro` (the `{giftCardProduct && <section>...</section>}` block)
|
|
38
|
+
|
|
39
|
+
## Implementation
|
|
40
|
+
|
|
41
|
+
### 1. `src/pages/gift-cards.astro`
|
|
42
|
+
|
|
43
|
+
Use template `templates/gift-cards.astro`.
|
|
44
|
+
|
|
45
|
+
Frontmatter:
|
|
46
|
+
```astro
|
|
47
|
+
---
|
|
48
|
+
import Layout from "../layouts/Layout.astro";
|
|
49
|
+
import GiftCardPurchase from "../components/GiftCardPurchase.tsx";
|
|
50
|
+
import { getGiftCardProduct } from "../utils/gift-cards";
|
|
51
|
+
import { resolveWixImageUrl } from "../utils/wix-image";
|
|
52
|
+
|
|
53
|
+
const product = await getGiftCardProduct();
|
|
54
|
+
if (!product) return Astro.redirect("/", 302);
|
|
55
|
+
|
|
56
|
+
const heroImage = resolveWixImageUrl(product.image, 800, 800);
|
|
57
|
+
---
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Body: hero image + name + description + `<GiftCardPurchase client:load product={product} />` + fineprint paragraph. All page-level CSS is already shipped via `components-gift-cards.css` (Components scope) — do not duplicate styles inside the `.astro` file's `<style>` block.
|
|
61
|
+
|
|
62
|
+
### 2. Patch `src/components/Navigation.astro`
|
|
63
|
+
|
|
64
|
+
1. Read the file.
|
|
65
|
+
2. Add to frontmatter (above the `---` close): `import { getGiftCardProduct } from "../utils/gift-cards"; const giftCardsEnabled = (await getGiftCardProduct()) !== null;` (split across two lines as needed).
|
|
66
|
+
3. Locate the line containing `<!-- nav:links -->`. Insert immediately after it:
|
|
67
|
+
```astro
|
|
68
|
+
{giftCardsEnabled && <a href="/gift-cards">Gift Cards</a>}
|
|
69
|
+
```
|
|
70
|
+
4. If other verticals (stores, blog, forms) already inserted at the same marker, preserve every existing line — your snippet appends.
|
|
71
|
+
|
|
72
|
+
### 3. Patch `src/pages/index.astro`
|
|
73
|
+
|
|
74
|
+
1. Read the file.
|
|
75
|
+
2. Add to frontmatter:
|
|
76
|
+
```astro
|
|
77
|
+
import { getGiftCardProduct } from "../utils/gift-cards";
|
|
78
|
+
import { resolveWixImageUrl } from "../utils/wix-image";
|
|
79
|
+
|
|
80
|
+
const giftCardProduct = await getGiftCardProduct();
|
|
81
|
+
const giftCardImage = giftCardProduct
|
|
82
|
+
? resolveWixImageUrl(giftCardProduct.image, 800, 600)
|
|
83
|
+
: null;
|
|
84
|
+
```
|
|
85
|
+
(`resolveWixImageUrl` import may already be present from the stores patcher — if so, do not re-import.)
|
|
86
|
+
3. Locate the line containing `<!-- home:gift-cards -->`. Insert the teaser snippet immediately after it (see `templates/_home-teaser-snippet.astro`).
|
|
87
|
+
|
|
88
|
+
## Verification
|
|
89
|
+
|
|
90
|
+
After writing/patching, grep the project to confirm:
|
|
91
|
+
- `Navigation.astro` contains both the marker and the new link expression.
|
|
92
|
+
- `index.astro` contains both the marker and the new `<section class="gift-card-teaser">` block.
|
|
93
|
+
- `/gift-cards.astro` exists and references `GiftCardPurchase` (Components scope's island).
|
|
94
|
+
|
|
95
|
+
## Return format
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"status": "complete",
|
|
100
|
+
"phase": "gift-cards-pages",
|
|
101
|
+
"scope": "pages",
|
|
102
|
+
"summary": "Wrote /gift-cards page; patched Navigation + home with conditional gift-card surfaces",
|
|
103
|
+
"data": {
|
|
104
|
+
"pageWritten": true,
|
|
105
|
+
"navigationPatched": true,
|
|
106
|
+
"homePatched": true,
|
|
107
|
+
"markersFound": ["<!-- nav:links -->", "<!-- home:gift-cards -->"]
|
|
108
|
+
},
|
|
109
|
+
"files": [
|
|
110
|
+
"src/pages/gift-cards.astro",
|
|
111
|
+
"src/components/Navigation.astro",
|
|
112
|
+
"src/pages/index.astro"
|
|
113
|
+
],
|
|
114
|
+
"errors": []
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
If a marker is missing, return `status: "partial"` with `errors: [{ code: "MARKER_NOT_FOUND", file: "<path>", marker: "<marker>" }]`. Do NOT invent your own insertion point — that signals the designer foundation didn't scaffold the shell correctly and should be fixed upstream.
|
|
119
|
+
|
|
120
|
+
## Anti-patterns
|
|
121
|
+
|
|
122
|
+
| WRONG | CORRECT |
|
|
123
|
+
|-------|---------|
|
|
124
|
+
| Render the page when probe returns null | `Astro.redirect("/", 302)` |
|
|
125
|
+
| Skip the import-injection step (assume another vertical added `getGiftCardProduct`) | Always inject the import + the `await` call when patching, scoped to the file you're touching |
|
|
126
|
+
| Replace the marker comment with the inserted snippet | Insert AFTER the marker; preserve the marker line |
|
|
127
|
+
| Move CSS into `<style>` blocks inside `.astro` files | Page/teaser CSS lives in `components-gift-cards.css` (Components scope) |
|
|
128
|
+
| Hardcode `<title>"Gift Cards"</title>` | Use `title={\`${product.name}\`}` so the dashboard owner controls naming |
|
|
129
|
+
| Conditionally re-render the page when the app is enabled later | The Astro page is server-rendered each request — the probe runs every time, so dashboard changes are picked up without rebuild |
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: images-agent
|
|
3
|
+
description: "Generates images for the site. Two scopes: image-phase-1-decorative (hero/about/background art, no dependencies, dispatched in Step 3) and image-phase-2-entity (product/blog/CMS item images, needs Phase 1 Seed entity IDs, dispatched in Step 4.5 alongside Phase 3 Components)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Images Agent — Scope-Based Image Generation
|
|
7
|
+
|
|
8
|
+
Generates site images in two scopes dispatched separately by the parent skill. Uses Wix AI (Runware) for generation and Wix Media for hosting — all via MCP, no user credentials required.
|
|
9
|
+
|
|
10
|
+
**Nothing else blocks on image generation.** Phases 1–4 and the core pipeline all proceed independently. Products, posts, and pages work without images. Each image phase enriches them when it finishes.
|
|
11
|
+
|
|
12
|
+
## Scope Routing
|
|
13
|
+
|
|
14
|
+
Your prompt includes `Scope: <name>`. Map it to an image phase:
|
|
15
|
+
|
|
16
|
+
| Scope | When dispatched | Depends on | Output |
|
|
17
|
+
|---|---|---|---|
|
|
18
|
+
| `image-phase-1-decorative` | Step 3 (background) | Brand context only | Decorative images for hero / about / backgrounds; written to `.wix/image-urls.md` |
|
|
19
|
+
| `image-phase-2-entity` | Step 4.5 (background, alongside Phase 3 Components) | Phase 1 Seed return data (entity IDs in prompt) | Entity images attached to products / blog posts / CMS items via MCP PATCH |
|
|
20
|
+
|
|
21
|
+
If your prompt is missing a `Scope:` line, stop and ask the parent — do not guess.
|
|
22
|
+
|
|
23
|
+
## Self-Loading
|
|
24
|
+
|
|
25
|
+
1. Read `../shared/IMAGE_GENERATION.md` — Wix AI image generation + Wix Media import recipe (including the **required** batched-call pattern)
|
|
26
|
+
2. Read `../shared/MCP_PREFIX.md` — MCP tool prefix for Wix API calls
|
|
27
|
+
3. **Prefer the inlined recipe below and `IMAGE_GENERATION.md` over external docs.** When a PATCH or API call fails:
|
|
28
|
+
1. **FIRST re-read your own recipe** in this file (INSTRUCTIONS.md § for that entity type) — it likely covers the error.
|
|
29
|
+
2. If the recipe covers it, follow the recipe. Do NOT look up external docs for errors your recipe already handles.
|
|
30
|
+
3. **ONLY** if you've re-read the recipe AND the error is genuinely not covered, fall back to `SearchWixRESTDocumentation` / `ReadFullDocsArticle`.
|
|
31
|
+
|
|
32
|
+
Known errors already covered by this recipe (do not look up externally):
|
|
33
|
+
- **428** from product PATCH → missing `options`/`variantsInfo` → see § "Products" step 1
|
|
34
|
+
- **400** `"Expected an object"` from product PATCH → missing `revision` → see § "Products" step 4
|
|
35
|
+
- **400** `unsupportedParameter` → strip `steps`/`CFGScale` → see § "Error Handling"
|
|
36
|
+
- **400** `unsupportedDimensions` → see § "Error Handling"
|
|
37
|
+
- **400** `invalidTaskUUID` → `taskUUID` must be valid UUIDv4 → see § "Quick Reference"
|
|
38
|
+
|
|
39
|
+
## Quick Reference: Generation Call Shape
|
|
40
|
+
|
|
41
|
+
Before the first MCP call, ensure the `CallWixSiteAPI` tool schema is loaded (the orchestrator's Step 0 MCP bootstrap covers this for the whole session per `<SKILL_ROOT>/references/commands/mcp-bootstrap.md` — only re-load if you hit a tool-not-found error). Use your runtime's tool-discovery primitive to look up the suffix.
|
|
42
|
+
|
|
43
|
+
**All generation tool calls for an image phase MUST be in one concurrent batch.** The exact shape depends on the model — see `../shared/IMAGE_GENERATION.md` § "Required: minimize round-trips" for the rule. In short:
|
|
44
|
+
|
|
45
|
+
- **`google:4@2` (the default):** N concurrent 1-task `CallWixSiteAPI` calls as siblings in one batch. (Batched N≥3 times out at 504 on this model.)
|
|
46
|
+
- **`bfl:5@1`, `runware:400@1`:** one batched `CallWixSiteAPI` call with N tasks in the body array.
|
|
47
|
+
|
|
48
|
+
Example task body (same for both patterns — only the distribution across tool calls changes):
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
<prefix>CallWixSiteAPI: POST https://www.wixapis.com/runwareschemaless/v1/request
|
|
52
|
+
body: [
|
|
53
|
+
{
|
|
54
|
+
"taskType": "imageInference",
|
|
55
|
+
"taskUUID": "550e8400-e29b-41d4-a716-446655440000",
|
|
56
|
+
"outputType": "URL",
|
|
57
|
+
"outputFormat": "PNG",
|
|
58
|
+
"positivePrompt": "<prompt-for-image>",
|
|
59
|
+
"height": 1024,
|
|
60
|
+
"width": 1024,
|
|
61
|
+
"model": "google:4@2",
|
|
62
|
+
"numberResults": 1
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Extract `data[i].imageURL` from each response. Import each to Wix Media immediately. **Do NOT send `steps` or `CFGScale`** with `google:4@2` — both cause a 400 error. `taskUUID` must be a valid UUIDv4 (`uuidgen` or `crypto.randomUUID()`) — Runware rejects human-readable slugs with `400 invalidTaskUUID`.
|
|
68
|
+
|
|
69
|
+
### Mandatory pre-call procedure — construct ALL tasks FIRST, then dispatch in ONE message
|
|
70
|
+
|
|
71
|
+
Image Phase 2 serializes into 6+ sequential calls across multiple turns when you compose and send tasks one-at-a-time. The fix is to build the full task set first and dispatch them as a single concurrent batch.
|
|
72
|
+
|
|
73
|
+
**Required procedure (do this, exactly, every time):**
|
|
74
|
+
|
|
75
|
+
1. **Plan all image prompts in your text response FIRST.** Write out every entity you need to generate for, with its prompt text, dimensions, and UUIDv4. Use a numbered list or table. Do not start any tool calls yet.
|
|
76
|
+
|
|
77
|
+
2. **Compose the full task set** as a fenced JSON block in your text. Verify the count matches the entity count.
|
|
78
|
+
|
|
79
|
+
3. **Dispatch in one concurrent batch.** For `google:4@2`: N concurrent sibling calls, each with one task. For other models: one tool call with all N tasks in `body`.
|
|
80
|
+
|
|
81
|
+
4. **After generation returns:** make all N import calls as **sibling calls in one concurrent batch** (not sequential messages). Same for PATCH calls — all N as siblings in one message.
|
|
82
|
+
|
|
83
|
+
That gives you exactly 3 concurrent batches for the whole image phase: 1 generate dispatch, 1 batch of imports, 1 batch of PATCHes.
|
|
84
|
+
|
|
85
|
+
Concurrent siblings are safe across all three stages (gen, import, PATCH). Wix Media imports do not rate-limit at typical scales (≤10/run); product PATCHes against distinct entity IDs do not produce revision conflicts because each entity has independent revision tracking. The 3-message recipe (one batch per stage) typically completes in ~190 s end-to-end vs ~480 s for the same 4 entities done sequentially — ~2.5× speedup.
|
|
86
|
+
|
|
87
|
+
**Self-check before the generate dispatch:**
|
|
88
|
+
- [ ] You have planned all N tasks with UUIDv4 `taskUUID` values
|
|
89
|
+
- [ ] All generate tool calls will be in one concurrent batch (siblings for `google:4@2`, or one block with N tasks for other models)
|
|
90
|
+
- [ ] You wrote out the full plan in your text before making any tool call
|
|
91
|
+
|
|
92
|
+
### Expected tool-call budget
|
|
93
|
+
|
|
94
|
+
Image Phase 2 for N products + M CMS items: ~1 schema-load + 1 product query + 1 batched generate + (N+M) imports + (N+M) PATCHes ≈ 2(N+M) + 3 calls. For 4 entities that's ~11 calls. If above 20, check for unnecessary doc reads or re-queries.
|
|
95
|
+
|
|
96
|
+
## Scope: `image-phase-1-decorative` (Step 3 — no dependencies)
|
|
97
|
+
|
|
98
|
+
Generate site-wide decorative images that don't depend on any entity. Used by the Phase 2 Design System agent + Phase 4 Pages agents for hero sections, about pages, and backgrounds.
|
|
99
|
+
|
|
100
|
+
**What to generate** is determined by the `decorativeSlots` list in your prompt — generate exactly those keys, no more, no less. Typical canonical keys: `hero`, `about`, `productsHeader`, `cmsHeader`. Do not invent additional keys (`background`, `aboutFeature`, etc.) — orphan keys ship as unused images and unfilled slots show as empty placeholders. The orchestrator composes this list from the loaded verticals + the designer's slot vocabulary (`references/designer/INSTRUCTIONS.md` § common rule #7); the two must agree.
|
|
101
|
+
|
|
102
|
+
**Inputs (from your prompt):**
|
|
103
|
+
- Brand name, business type, aesthetic direction
|
|
104
|
+
- Color palette (hex codes)
|
|
105
|
+
- `decorativeSlots: string[]` — the exact slot keys to generate (REQUIRED). If absent, return `status: "failed"` with `reason: "decorativeSlots not provided in prompt"` rather than guessing.
|
|
106
|
+
- Page list (context only — slot keys are authoritative)
|
|
107
|
+
|
|
108
|
+
**Process (must follow this order):**
|
|
109
|
+
|
|
110
|
+
1. **Craft all image prompts up front** using brand context — see `IMAGE_GENERATION.md` § "Prompt guidelines".
|
|
111
|
+
2. **Dispatch all generation tool calls in one concurrent batch** — siblings for `google:4@2` (1 task each, N blocks in parallel), or one batched call for other models (N tasks in `body`). Required, not optional — see `IMAGE_GENERATION.md` § "Required: minimize round-trips per image phase". Sequential 1-task calls across multiple turns is an anti-pattern; never do it.
|
|
112
|
+
3. **Import each to Wix Media** via `<prefix>CallWixSiteAPI: POST /site-media/v1/files/import`. Imports can parallelize (sibling `CallWixSiteAPI` tool calls in one message).
|
|
113
|
+
4. **Write `.wix/image-urls.md`** with all resolved URLs, keyed by purpose:
|
|
114
|
+
```markdown
|
|
115
|
+
# Image URLs
|
|
116
|
+
|
|
117
|
+
## hero
|
|
118
|
+
- url: https://static.wixstatic.com/media/...
|
|
119
|
+
|
|
120
|
+
## about
|
|
121
|
+
- url: https://static.wixstatic.com/media/...
|
|
122
|
+
```
|
|
123
|
+
5. Return the structured JSON block per `../shared/RETURN_CONTRACT.md` (see § Return below).
|
|
124
|
+
|
|
125
|
+
Page design agents read `.wix/image-urls.md` and use the URLs. If the file doesn't exist when a page agent runs, the page agent uses placeholder styling instead — nothing blocks.
|
|
126
|
+
|
|
127
|
+
## Scope: `image-phase-2-entity` (Step 4.5 — Phase 1 Seed data inline)
|
|
128
|
+
|
|
129
|
+
Generate images for products, blog posts, and CMS items. Attach via MCP PATCH calls.
|
|
130
|
+
|
|
131
|
+
> **Parent must NOT paste a PATCH/Update body template.** This INSTRUCTIONS.md owns the recipe per entity type (Products, Blog Posts, CMS Items) — including the exact write-shape (`media.itemsInfo.items[].url` + echoed `options`/`variantsInfo` + `revision`, no `fieldMask`) and the failure-mode mappings. An inline template in the parent prompt causes drift; the wrong shape (e.g. `media.main.image` + `fieldMask`) returns `400 "Expected an object"` on every product. Parents should pass `Phase 1 Seed return data` and `Brand context` only.
|
|
132
|
+
|
|
133
|
+
**Phase 1 Seed entity IDs are in your prompt, not on disk.** Your parent passes a `Phase 1 Seed return data:` block containing:
|
|
134
|
+
- `products: [{id, name, slug, variantId, ...}, ...]` — if stores pack loaded
|
|
135
|
+
- `collections: [{name, itemIds, fields}, ...]` — if cms pack loaded
|
|
136
|
+
- `blogPosts: [{id, title, ...}, ...]` — if blog pack loaded
|
|
137
|
+
|
|
138
|
+
**Do not poll for sidecars.** `.wix/logs/<feature>-data.md` is a deprecated coordination pattern (see `../shared/RETURN_CONTRACT.md`). If the `Phase 1 Seed return data:` block is missing from your prompt, return `status: "failed"` with `reason: "Phase 1 Seed return data not provided; image-phase-2-entity cannot run without entity IDs"` — do not sleep, do not read sidecars, do not query Phase 1 Seed data from MCP.
|
|
139
|
+
|
|
140
|
+
**Process per entity type (must follow):**
|
|
141
|
+
|
|
142
|
+
1. **Craft all image prompts** for this entity type up front, using each entity's own context (name, description, title, etc.).
|
|
143
|
+
2. **Dispatch all generation tool calls in one concurrent batch** — same dispatch shape as Phase 1 Decorative:
|
|
144
|
+
- For `google:4@2` (default): N parallel sibling `CallWixSiteAPI` tool calls, one task each.
|
|
145
|
+
- For `bfl:5@1` / `runware:400@1` / others: ONE batched call with all N tasks in `body`.
|
|
146
|
+
See `IMAGE_GENERATION.md` § "Required: minimize round-trips per image phase". Sequential 1-task calls across multiple turns is an anti-pattern.
|
|
147
|
+
|
|
148
|
+
**`google:4@2` 504 retry.** Even with N concurrent siblings, individual tasks intermittently 504. When the response array contains an entry with `errorMessage: "Request timed out"` or HTTP 504, retry **only the failing task(s)** in a follow-up batch — do NOT re-dispatch the whole batch. Cap at 1 retry per task; if it 504s twice, fall back to `bfl:5@1` for that task or skip it (entity gets no image; user can upload from dashboard).
|
|
149
|
+
|
|
150
|
+
**N≥6 entities — stagger.** When you have 6 or more entities of one type, split into pairs of 3 parallel siblings rather than 6+ in one shot. Runware throttles google:4@2 above ~4 concurrent tasks per request burst, and the timeout ladder gets steeper. Two messages with 3 siblings each is reliably faster than one message with 6 + multiple retries. (Heuristic — refine after more runs collect data.)
|
|
151
|
+
3. **Import each to Wix Media**. Imports can parallelize.
|
|
152
|
+
4. **PATCH each entity** with its image URL / file ID. PATCH calls can also parallelize (sibling `CallWixSiteAPI` tool calls in one message).
|
|
153
|
+
|
|
154
|
+
### Products (if `products` is in your prompt)
|
|
155
|
+
|
|
156
|
+
1. Entity IDs come from your prompt's `Phase 1 Seed return data.products[].id`. Do NOT re-query products for slugs/names (already inline).
|
|
157
|
+
|
|
158
|
+
> **428 prevention (MANDATORY):** You MUST fetch each product's existing `options` and `variantsInfo` before step 4. The Update Product endpoint validates variant-option alignment on every PATCH and **returns 428 if either is missing**.
|
|
159
|
+
|
|
160
|
+
> **Critical:** `POST /stores/v3/products/query` does **NOT** return `variantsInfo` — even when you pass `fields: [VARIANT_OPTION_CHOICE_NAMES, MERCHANT_DATA, MEDIA_ITEMS_INFO]`. It returns `options` only. Using the bulk-query endpoint produces 428 on every product with variants. Use per-product GETs.
|
|
161
|
+
|
|
162
|
+
> **Use per-product GET instead of bulk query:**
|
|
163
|
+
> ```
|
|
164
|
+
> <prefix>CallWixSiteAPI: GET /stores/v3/products/{productId} // no body
|
|
165
|
+
> ```
|
|
166
|
+
> GET returns both `options` and `variantsInfo` in one shot. Parallelize the N GETs as sibling `CallWixSiteAPI` tool calls in one concurrent batch so they fan out without adding to the critical path.
|
|
167
|
+
|
|
168
|
+
> If you skip this and get a 428, re-read this section — do not look up external docs.
|
|
169
|
+
|
|
170
|
+
2. Generate images — ONE batched generation call with N tasks (one per product).
|
|
171
|
+
|
|
172
|
+
3. Import each to Wix Media — parallelize with sibling calls.
|
|
173
|
+
|
|
174
|
+
4. PATCH each product with its image + preserved options/variantsInfo + product `revision`:
|
|
175
|
+
```
|
|
176
|
+
<prefix>CallWixSiteAPI: PATCH /stores/v3/products/{productId}
|
|
177
|
+
body: {
|
|
178
|
+
"product": {
|
|
179
|
+
"revision": "<product.revision from step 1's GET>",
|
|
180
|
+
"media": {
|
|
181
|
+
"itemsInfo": {
|
|
182
|
+
"items": [
|
|
183
|
+
{ "url": "<wixstatic-url>", "altText": "<product name or short description>" }
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"options": <existing options from product query>,
|
|
188
|
+
"variantsInfo": <existing variantsInfo from product query>
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
**`revision` is mandatory** — omitting it returns `400 "Expected an object"` with no useful hint. Read it from each product's GET response in step 1 and echo it back on the PATCH. Do NOT use `media.main.image` — `media.itemsInfo.items[].url` is the write-shape; `media.main.image` is the read-shape on product responses (they are asymmetric).
|
|
193
|
+
|
|
194
|
+
**DO NOT add `fieldMask` to this PATCH.** The endpoint runs cross-field validation (options ↔ variants) BEFORE applying the field mask, so even though `fieldMask: { paths: ["media"] }` should "only update media", the validator sees variants without options and returns 428 `MISSING_VARIANT_OPTION`. Send the full product body shown above (id, revision, media, options, variantsInfo) and let the server merge — no fieldMask.
|
|
195
|
+
|
|
196
|
+
PATCH calls parallelize — dispatch as concurrent sibling calls. Parallel PATCHes against different product IDs do NOT cause revision conflicts: each entity has independent revision tracking.
|
|
197
|
+
|
|
198
|
+
**409 `INVALID_REVISION` recovery.** If a single PATCH returns 409 with `{"applicationError": {"code": "INVALID_REVISION", ...}}`, the product's actual revision has advanced past the value you cached in step 1's GET. This typically happens against an already-built site (re-runs, remediation runs) where the user edited products via the dashboard between builds. Recovery is per-failure, not whole-batch:
|
|
199
|
+
|
|
200
|
+
1. Re-fetch the failed product: `<prefix>CallWixSiteAPI: GET /stores/v3/products/{productId}`. Read the new `revision`.
|
|
201
|
+
2. Retry the PATCH once with the new revision.
|
|
202
|
+
3. If the retry also fails with 409, surface the error — something else is mutating the entity faster than we can react. Don't loop.
|
|
203
|
+
|
|
204
|
+
Successful PATCHes from the original parallel batch keep their state; only the 409'd entity needs the recovery. Cap at one retry per failed entity. Append to `run.json.recoveries[]`: `{ "code": "INVALID_REVISION_RETRY", "entityId": "<id>", "originalRevision": "<x>", "actualRevision": "<y>" }`.
|
|
205
|
+
|
|
206
|
+
### Blog Posts (if `blogPosts` is in your prompt)
|
|
207
|
+
|
|
208
|
+
1. Entity IDs come from `Phase 1 Seed return data.blogPosts[].id` in your prompt. Title / excerpt for image context come from the prompt too. No re-query needed unless you need fields not in the return.
|
|
209
|
+
|
|
210
|
+
2. Generate images — ONE batched generation call with N tasks.
|
|
211
|
+
|
|
212
|
+
3. Import to Wix Media — save the **`file.fileUrl`** (file ID), not the full URL.
|
|
213
|
+
|
|
214
|
+
4. PATCH each draft post's cover image:
|
|
215
|
+
```
|
|
216
|
+
<prefix>CallWixSiteAPI: PATCH /blog/v3/draft-posts/{draftPostId}
|
|
217
|
+
body: {
|
|
218
|
+
"draftPost": {
|
|
219
|
+
"media": { "wixMedia": { "image": { "id": "<file-id-from-fileUrl>" } } }
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
5. **Re-publish** each updated post (PATCHing a published post makes it unpublished):
|
|
225
|
+
```
|
|
226
|
+
<prefix>CallWixSiteAPI: POST /blog/v3/draft-posts/{draftPostId}/publish
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Re-publish calls parallelize — dispatch as concurrent sibling calls.
|
|
230
|
+
|
|
231
|
+
### CMS Items (if `collections` is in your prompt)
|
|
232
|
+
|
|
233
|
+
Key constraint: `wix-data/v2/items` updates are **full-record replaces** (via PUT). Writing only `{data: {image: "..."}}` **erases every other field** on the item — heading, body, question, answer, anything the CMS seeder populated. You MUST read the existing item first and merge the image field into its `data` before writing.
|
|
234
|
+
|
|
235
|
+
The `PATCH /wix-data/v2/items/{itemId}` endpoint exists but requires a JsonPatch-shaped `fieldModifications` array, not a plain `{dataItem: {data}}` body. Do NOT use PATCH for this scope — it has rejected the documented shape in production and led agents to fall back to a destructive PUT. Use read-merge-PUT instead.
|
|
236
|
+
|
|
237
|
+
1. Your prompt lists `collections[].itemIds` for each collection with an image field. **Fetch the existing item data** once per collection via `POST /wix-data/v2/items/query` — you cannot skip this step because you need every existing field to merge-preserve.
|
|
238
|
+
```
|
|
239
|
+
<prefix>CallWixSiteAPI: POST https://www.wixapis.com/wix-data/v2/items/query
|
|
240
|
+
body: {
|
|
241
|
+
"dataCollectionId": "<collection>",
|
|
242
|
+
"query": { "filter": { "_id": { "$in": ["<itemId1>", "<itemId2>", ...] } } }
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
Retain the full `data` object from each result — you'll merge into it.
|
|
246
|
+
|
|
247
|
+
2. Generate images — ONE batched generation call with N tasks across all applicable items.
|
|
248
|
+
|
|
249
|
+
3. Import to Wix Media.
|
|
250
|
+
|
|
251
|
+
4. **PUT each item's full record** with the image field merged into the existing `data`:
|
|
252
|
+
```
|
|
253
|
+
<prefix>CallWixSiteAPI: PUT https://www.wixapis.com/wix-data/v2/items/{itemId}
|
|
254
|
+
body: {
|
|
255
|
+
"dataCollectionId": "<collection>",
|
|
256
|
+
"dataItem": {
|
|
257
|
+
"id": "{itemId}",
|
|
258
|
+
"data": { ...existingData, "<imageField>": "<wixstatic-url>" }
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
`...existingData` MUST include every non-system field you read in step 1 (`heading`, `body`, etc.). System fields (`_id`, `_owner`, `_createdDate`, `_updatedDate`) don't need to be echoed back — Wix repopulates them.
|
|
263
|
+
|
|
264
|
+
**Failure mode — do NOT ship with this pattern:**
|
|
265
|
+
```
|
|
266
|
+
// WRONG — wipes heading + body
|
|
267
|
+
PUT /wix-data/v2/items/{itemId}
|
|
268
|
+
body: { "dataCollectionId": "<c>", "dataItem": { "id": "...", "data": { "image": "..." } } }
|
|
269
|
+
```
|
|
270
|
+
Without the read-merge step, an `about-content` item loses its seeded `heading` and `body` when Image Phase 2 attaches the image — the About page then renders only its fallback copy.
|
|
271
|
+
|
|
272
|
+
PUT calls parallelize — dispatch all items across all collections as sibling `CallWixSiteAPI` tool calls in one concurrent batch.
|
|
273
|
+
|
|
274
|
+
## MCP Tool Prefix
|
|
275
|
+
|
|
276
|
+
Your prompt includes a `MCP tool prefix:` line. Use it for every Wix MCP call. If a call returns "tool not found", re-discover the tool via your runtime's tool-discovery primitive (look up the suffix `CallWixSiteAPI`). See `../shared/MCP_PREFIX.md` § "Defensive fallback".
|
|
277
|
+
|
|
278
|
+
## Return Contract
|
|
279
|
+
|
|
280
|
+
At the end, emit a structured JSON block per `../shared/RETURN_CONTRACT.md`. Do **not** write `.wix/logs/images.md` — sidecars are deprecated; the parent reads your return JSON directly.
|
|
281
|
+
|
|
282
|
+
### `image-phase-1-decorative` return
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
{
|
|
286
|
+
"status": "complete" | "partial" | "failed",
|
|
287
|
+
"phase": "image-phase-1-decorative",
|
|
288
|
+
"scope": "image-phase-1-decorative",
|
|
289
|
+
"summary": "Generated N decorative images; uploaded to Wix Media; wrote .wix/image-urls.md",
|
|
290
|
+
"data": {
|
|
291
|
+
"decorativeCount": 3,
|
|
292
|
+
"purposes": ["hero", "about", "background"],
|
|
293
|
+
"model": "google:4@2",
|
|
294
|
+
"totalCredits": 0.297
|
|
295
|
+
},
|
|
296
|
+
"files": [".wix/image-urls.md"],
|
|
297
|
+
"errors": []
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### `image-phase-2-entity` return
|
|
302
|
+
|
|
303
|
+
```json
|
|
304
|
+
{
|
|
305
|
+
"status": "complete" | "partial" | "failed",
|
|
306
|
+
"phase": "image-phase-2-entity",
|
|
307
|
+
"scope": "image-phase-2-entity",
|
|
308
|
+
"summary": "Generated + attached images: 6 products, 1 CMS item",
|
|
309
|
+
"data": {
|
|
310
|
+
"entityCount": { "products": 6, "cmsAboutContent": 1, "blogPosts": 0 },
|
|
311
|
+
"model": "google:4@2",
|
|
312
|
+
"totalCredits": 0.693
|
|
313
|
+
},
|
|
314
|
+
"files": [],
|
|
315
|
+
"errors": []
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
The JSON block MUST be the **last** content in your message (see `../shared/RETURN_CONTRACT.md` § "Observed failure mode").
|
|
320
|
+
|
|
321
|
+
## Error Handling
|
|
322
|
+
|
|
323
|
+
| Error | Action |
|
|
324
|
+
|---|---|
|
|
325
|
+
| `unsupportedParameter` (400) | Strip `steps`/`CFGScale` (or whichever field the response names) and retry once |
|
|
326
|
+
| `unsupportedDimensions` (400) | Retry with `1024×1024` / `1376×768` / `1200×896`, or a value from the error payload's supported list |
|
|
327
|
+
| 428 from product PATCH | Missing `options`/`variantsInfo` — re-read § "Products" step 1; query the product for existing `options` + `variantsInfo`; retry PATCH with those fields included. This recipe covers it — do not look up external docs. |
|
|
328
|
+
| 400 `"Expected an object"` from product PATCH | Missing `revision` in the `product` body — re-read § "Products" step 4; the PATCH body needs `"revision": "<product.revision from step 1 GET>"`. |
|
|
329
|
+
| 400 `invalidTaskUUID` from Runware | `taskUUID` must be valid UUIDv4. Regenerate with `uuidgen` / `crypto.randomUUID()` and retry. |
|
|
330
|
+
| Model unavailable / rate limited | Switch to an alternative model (`bfl:5@1`, `runware:400@1`) and retry once; skip if still failing |
|
|
331
|
+
| Credit exhaustion | Stop generating, return `status: "partial"` with `data.decorativeCount` / `data.entityCount` listing what was completed, and `errors: [{code: "CREDITS_EXHAUSTED", message: "..."}]` |
|
|
332
|
+
| Generation fails (5xx, timeout) | Skip this image, continue with others |
|
|
333
|
+
| Wix Media import fails | Skip this image, continue |
|
|
334
|
+
| Entity PATCH fails | Log the failure in `errors`, continue with other entities |
|
|
335
|
+
| Phase 1 Seed data missing from prompt (Image Phase 2 only) | Return `status: "failed"` immediately; do not poll or re-query |
|
|
336
|
+
|
|
337
|
+
**Never block other agents on image failures.** Products, posts, and pages work without images.
|
|
338
|
+
|
|
339
|
+
## Anti-Patterns
|
|
340
|
+
|
|
341
|
+
| WRONG | CORRECT |
|
|
342
|
+
|-------|---------|
|
|
343
|
+
| N sequential 1-task `CallWixSiteAPI` generation calls across multiple turns | All generation tool calls in one concurrent batch — parallel siblings for `google:4@2`, or one batched call for other models. See IMAGE_GENERATION.md § "Required: minimize round-trips per image phase" |
|
|
344
|
+
| Poll `.wix/logs/<feature>-data.md` sidecars to learn Phase 1 Seed is done | Phase 1 Seed data is inline in your prompt — if missing, return `failed` |
|
|
345
|
+
| `sleep 60` loop to wait for Phase 1 Seed | No waiting, no polling — prompt has the data or the agent fails |
|
|
346
|
+
| Write `.wix/logs/images.md` sidecar | Sidecars are deprecated — return structured JSON per `RETURN_CONTRACT.md` |
|
|
347
|
+
| Re-query Phase 1 Seed entity IDs via MCP | IDs are in your prompt; re-querying wastes a round-trip |
|
|
348
|
+
| Generic prompts ("a product photo") | Use brand context, product name, aesthetic direction |
|
|
349
|
+
| Ignore color palette from prompt | Reference actual hex codes in image prompts |
|
|
350
|
+
| Request text in images | Always include "no text, no watermarks" |
|
|
351
|
+
| Send `steps` or `CFGScale` with `google:4@2` | Omit both — `google:4@2` rejects them with `unsupportedParameter` |
|
|
352
|
+
| Use free-form sizes (e.g., `800×600`) | Use allowed dimensions only — `1024×1024`, `1376×768`, `1200×896` |
|
|
353
|
+
| Use blog post `file.url` for cover image | Blog posts need `file.fileUrl` (file ID) for `media.wixMedia.image.id` |
|
|
354
|
+
| Block on image failures | Skip failed images, continue with others |
|
|
355
|
+
| PATCH products without `options`/`variantsInfo` | Always query products first for these fields — PATCH returns 428 without them (see § "Products" step 1) |
|
|
356
|
+
| PUT a CMS item with only `{data: {image: "..."}}` | Read-merge-write: query the item, merge image into existing `data`, PUT the full record (see § "CMS Items" step 4). Writing only `image` erases seeded heading/body/etc. |
|
|
357
|
+
| Use `PATCH /wix-data/v2/items/{itemId}` with `{dataItem: {data}}` | PATCH requires JsonPatch `fieldModifications` — use read-merge-PUT instead (see § "CMS Items") |
|
|
358
|
+
| Hit a 428 → immediately search external docs | Re-read § "Products" step 1 first — it covers 428. Only use external docs if your recipe genuinely doesn't cover the error (see § "Self-Loading" step 3) |
|
|
359
|
+
| Default to `ReadFullDocsArticle` for API errors already covered by your recipe | Re-read your own recipe first; fall back to MCP doc tools only for errors genuinely not covered (see § "Self-Loading" step 3) |
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Build-output noise — known false positives
|
|
2
|
+
|
|
3
|
+
Read this only if `npx @wix/cli build` surfaces warnings or errors and you're trying to decide whether they're real. A clean build emits a few warnings that are NOT real failures:
|
|
4
|
+
|
|
5
|
+
- **`Astro.request.headers used on prerendered page`** — emitted by the `@wix/astro` integration's middleware on every prerendered route. Internal to the integration, not from skill-emitted code. Ignore.
|
|
6
|
+
- **`Failed to resolve dependency: @wix/stores, present in client 'optimizeDeps.include'`** — Vite warning. The integration speculatively lists `@wix/stores` in `optimizeDeps` regardless of whether the project depends on it. Harmless.
|
|
7
|
+
|
|
8
|
+
Do NOT add filters, edit config, or attempt to silence these — they're upstream and stable. Surface to the user only if a real build failure needs context.
|