@wix/agent-skills 1.5.0 → 1.7.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/README.md +2 -2
- package/package.json +1 -1
- package/skills/wix-app/SKILL.md +49 -42
- package/skills/wix-app/references/BACKEND_EVENT.md +10 -65
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +101 -406
- package/skills/wix-app/references/DASHBOARD_MENU_PLUGIN.md +14 -111
- package/skills/wix-app/references/DASHBOARD_MODAL.md +56 -205
- package/skills/wix-app/references/DASHBOARD_PAGE.md +19 -98
- package/skills/wix-app/references/DASHBOARD_PLUGIN.md +6 -108
- package/skills/wix-app/references/DATA_COLLECTION.md +113 -198
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +15 -1
- package/skills/wix-app/references/EMBEDDED_SCRIPT.md +41 -268
- package/skills/wix-app/references/EXTENSION_REGISTRATION.md +27 -76
- package/skills/wix-app/references/SERVICE_PLUGIN.md +35 -188
- package/skills/wix-app/references/SITE_PLUGIN.md +8 -92
- package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +0 -44
- package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +19 -330
- package/skills/wix-app/references/dashboard-menu-plugin/bookings-slots.md +0 -12
- package/skills/wix-app/references/dashboard-menu-plugin/ecommerce-slots.md +7 -0
- package/skills/wix-app/references/dashboard-menu-plugin/restaurants-slots.md +0 -12
- package/skills/wix-app/references/dashboard-plugin/SLOTS.md +3 -15
- package/skills/wix-app/references/data-collection/WIX_DATA.md +1 -1
- package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +1 -1
- package/skills/wix-app/references/service-plugin/ADDITIONAL-FEES.md +2 -18
- package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +2 -42
- package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +1 -11
- package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +1 -11
- package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +2 -40
- package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +2 -19
- package/skills/wix-app/references/service-plugin/VALIDATIONS.md +2 -18
- package/skills/wix-app/references/site-plugin/SLOTS.md +17 -68
- package/skills/wix-headless/SKILL.md +112 -368
- package/skills/wix-headless/references/BUILD.md +307 -0
- package/skills/wix-headless/references/DESIGN_SYSTEM.md +115 -0
- package/skills/wix-headless/references/DISCOVERY.md +237 -112
- package/skills/wix-headless/references/PLAN.md +82 -0
- package/skills/wix-headless/references/SEED.md +205 -0
- package/skills/wix-headless/references/SETUP.md +250 -94
- package/skills/wix-headless/references/astro/COMPOSE.md +142 -0
- package/skills/wix-headless/references/{blog → astro/blog}/BLOG_PAGES.md +1 -1
- package/skills/wix-headless/references/{blog → astro/blog}/BLOG_SETUP.md +2 -2
- package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +214 -0
- package/skills/wix-headless/references/{cms → astro/cms}/FAQ_KNOWLEDGE_BASE.md +6 -4
- package/skills/wix-headless/references/{cms → astro/cms}/PORTFOLIO.md +5 -5
- package/skills/wix-headless/references/{cms → astro/cms}/RESOURCE_LIBRARY.md +5 -5
- package/skills/wix-headless/references/{cms → astro/cms}/TEAM_DIRECTORY.md +5 -5
- package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +331 -0
- package/skills/wix-headless/references/{ecom → astro/ecom}/CART_PAGES.md +1 -1
- package/skills/wix-headless/references/{ecom → astro/ecom}/CART_WIRING.md +1 -1
- package/skills/wix-headless/references/{ecom → astro/ecom}/COMPONENTS_CSS.md +3 -3
- package/skills/wix-headless/references/{forms → astro/forms}/CONTACT_FORM.md +13 -13
- package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/COMPONENTS.md +1 -1
- package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/PAGES.md +1 -1
- package/skills/wix-headless/references/{stores → astro/stores}/BACK_IN_STOCK.md +1 -1
- package/skills/wix-headless/references/{stores → astro/stores}/CATEGORY_PAGES.md +12 -13
- package/skills/wix-headless/references/{stores → astro/stores}/COMPONENTS_CSS.md +4 -4
- package/skills/wix-headless/references/{stores → astro/stores}/HOME_AND_NAV.md +11 -9
- package/skills/wix-headless/references/{stores → astro/stores}/PRODUCT_PAGES.md +5 -3
- package/skills/wix-headless/references/{stores → astro/stores}/SHARED_WIRING.md +3 -3
- package/skills/wix-headless/references/astro/templates/Footer.astro +27 -0
- package/skills/wix-headless/references/astro/templates/Layout.astro +132 -0
- package/skills/wix-headless/references/astro/templates/Navigation.astro +38 -0
- package/skills/wix-headless/references/astro/templates/astro.config.mjs +41 -0
- package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +302 -0
- package/skills/wix-headless/references/astro/templates/global.css +286 -0
- package/skills/wix-headless/references/astro/templates/index.astro +56 -0
- package/skills/wix-headless/{templates → references/astro/templates}/stores/back-in-stock.ts +1 -1
- package/skills/wix-headless/{templates → references/astro/templates}/stores/components-stores.css +138 -33
- package/skills/wix-headless/references/blog/BLOG_CONTENT.md +10 -11
- package/skills/wix-headless/references/blog/INSTRUCTIONS.md +5 -5
- package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +31 -230
- package/skills/wix-headless/references/cms/INSTRUCTIONS.md +13 -8
- package/skills/wix-headless/references/custom/INSTRUCTIONS.md +38 -0
- package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +10 -10
- package/skills/wix-headless/references/forms/INSTRUCTIONS.md +5 -5
- package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +11 -11
- package/skills/wix-headless/references/images/INSTRUCTIONS.md +47 -50
- package/skills/wix-headless/references/seed-recipes.md +49 -0
- package/skills/wix-headless/references/shared/AUTHENTICATION.md +110 -0
- package/skills/wix-headless/references/shared/BUILD_NOISE.md +2 -2
- package/skills/wix-headless/references/shared/DOCS_SEARCH.md +41 -0
- package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +17 -17
- package/skills/wix-headless/references/shared/IMPLEMENTER.md +20 -29
- package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +1 -1
- package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +25 -16
- package/skills/wix-headless/references/shared/STYLING.md +47 -10
- package/skills/wix-headless/references/stores/INSTRUCTIONS.md +25 -25
- package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +17 -17
- package/skills/wix-headless/references/verticals/_schema.json +31 -117
- package/skills/wix-headless/references/verticals/_schema.md +60 -150
- package/skills/wix-headless/references/verticals/blog.md +5 -99
- package/skills/wix-headless/references/verticals/cms.md +9 -100
- package/skills/wix-headless/references/verticals/ecom.md +5 -76
- package/skills/wix-headless/references/verticals/forms.md +5 -85
- package/skills/wix-headless/references/verticals/gift-cards.md +6 -103
- package/skills/wix-headless/references/verticals/stores.md +10 -144
- package/skills/wix-headless/scripts/check-manifest.mjs +5 -5
- package/skills/wix-headless/scripts/emit-design-tokens.mjs +29 -23
- package/skills/wix-headless/scripts/init-site-json.mjs +59 -21
- package/skills/wix-headless/scripts/patch-decorative-slots.mjs +67 -43
- package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +3 -3
- package/skills/wix-headless/scripts/preview.sh +3 -3
- package/skills/wix-headless/scripts/release.sh +4 -4
- package/skills/wix-headless/scripts/scaffold.sh +75 -20
- package/skills/wix-headless/scripts/seed-utilities.sh +50 -12
- package/skills/wix-manage/SKILL.md +4 -8
- package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +70 -1
- package/skills/wix-manage/references/cms/cms-data-items-crud.md +4 -0
- package/skills/wix-manage/references/cms/cms-references-and-relationships.md +2 -0
- package/skills/wix-manage/references/cms/cms-schema-management.md +4 -0
- package/skills/wix-manage/references/ecommerce/api-shipping.md +443 -0
- package/skills/wix-manage/references/ecommerce/flow-add-free-shipping.md +5 -6
- package/skills/wix-manage/references/ecommerce/flow-fix-coverage-gaps.md +4 -5
- package/skills/wix-manage/references/ecommerce/flow-optimize-shipping-rates.md +4 -5
- package/skills/wix-manage/references/ecommerce/goal-increase-aov.md +1 -1
- package/skills/wix-manage/references/ecommerce/goal-reduce-cart-abandonment.md +1 -2
- package/skills/wix-manage/references/ecommerce/guardrail-shipping-health.md +2 -2
- package/skills/wix-manage/references/ecommerce/recipe-apply-shipping-recommendations.md +4 -5
- package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +7 -7
- package/skills/wix-manage/references/ecommerce/setup-discount-rules.md +209 -72
- package/skills/wix-manage/references/ecommerce/setup-store-pickup-location.md +9 -10
- package/skills/wix-manage/references/ecommerce/skill-graph.md +4 -4
- package/skills/wix-manage/references/forms/create-form.md +2 -0
- package/skills/wix-manage/references/stores/bulk-create-products-with-options.md +2 -0
- package/skills/wix-manage/references/stores/create-product-from-image.md +91 -38
- package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +14 -7
- package/skills/wix-app/references/data-collection/extension-template.ts +0 -107
- package/skills/wix-headless/references/ORCHESTRATION.md +0 -269
- package/skills/wix-headless/references/commands/install-app.md +0 -42
- package/skills/wix-headless/references/commands/mcp-bootstrap.md +0 -28
- package/skills/wix-headless/references/designer/INSTRUCTIONS.md +0 -828
- package/skills/wix-headless/references/shared/MCP_PREFIX.md +0 -105
- package/skills/wix-headless/scripts/copy-utility-templates.mjs +0 -153
- package/skills/wix-headless/templates/ecom/components-ecom.css +0 -215
- package/skills/wix-manage/references/events/list-events.md +0 -203
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartBadge.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartView.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/cart.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/discounts.ts +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/thank-you.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/GiftCardPurchase.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_home-teaser-snippet.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_nav-snippet.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/components-gift-cards.css +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.ts +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/AddToCartButton.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/BackInStockForm.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/CategoryRail.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductCard.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductPurchase.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/SeoTags.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/categories.ts +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/category/[slug].astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/[slug].astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/index.astro +0 -0
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
> ⚠️ **EXPERIMENTAL**: This project is in early development. APIs, skill definitions, and behavior may change without notice. Use at your own risk.
|
|
4
4
|
|
|
5
|
-
Agent skills for building Wix
|
|
5
|
+
Agent skills for building Wix app extensions, managing Wix business solutions, developing headless sites, and using the Wix Design System with AI agents.
|
|
6
6
|
|
|
7
|
-
> **Note**: These skills are designed for the **new Wix CLI**. See [About the Wix CLI](https://dev.wix.com/docs/wix-cli/guides/about-the-wix-cli) to learn more.
|
|
7
|
+
> **Note**: These skills are designed for the **new Wix CLI**. See [About the Wix CLI](https://dev.wix.com/docs/wix-cli/guides/about-the-wix-cli) to learn more. For an overview of how skills work with AI tools, see [About Wix Skills](https://dev.wix.com/docs/api-reference/articles/ai-tools/about-wix-skills).
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
package/package.json
CHANGED
package/skills/wix-app/SKILL.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wix-app
|
|
3
3
|
description: "Build and review Wix CLI app extensions — dashboard pages, modals, plugins, menu plugins, custom element widgets, Editor React components, site plugins, embedded scripts, backend APIs, backend events, service plugins, data collections, and App Market readiness. Use when building ANY feature or extension for a Wix CLI app or preparing a Wix app for App Market review. Triggers on: add, build, create, implement, help me, dashboard, widget, plugin, backend, API, event, collection, embedded script, service plugin, Editor React component, checkout, shipping, tax, discount, SPI, CMS, schema, tracking, popup, admin panel, menu item, modal, validate, test, verify, register extension, App Market, app review, submission readiness."
|
|
4
|
-
compatibility:
|
|
4
|
+
compatibility: requires `@wix/cli` >= 1.1.192.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Wix App Builder
|
|
8
8
|
|
|
9
9
|
Helps build extensions for Wix CLI applications. Covers all extension types: dashboard pages, modals, plugins, menu plugins, custom element widgets, Editor React components, site plugins, embedded scripts, backend APIs, events, service plugins, and data collections.
|
|
10
10
|
|
|
11
|
+
**Scaffolding is owned by the Wix CLI.** For every extension type except Backend API, files, folders, builder boilerplate, UUIDs, and `src/extensions.ts` registration are generated by `wix generate --params`. This skill provides the decision logic, API guidance, configuration semantics, and business-logic patterns that fill in the generated stubs.
|
|
12
|
+
|
|
11
13
|
## ⚠️ MANDATORY WORKFLOW CHECKLIST ⚠️
|
|
12
14
|
|
|
13
15
|
**Before reporting completion to the user, ALL boxes MUST be checked:**
|
|
@@ -20,10 +22,9 @@ Helps build extensions for Wix CLI applications. Covers all extension types: das
|
|
|
20
22
|
- [ ] Explained recommendation with reasoning
|
|
21
23
|
- [ ] **Step 2:** Read extension reference file(s) for the chosen type(s) and the project-wide [CODE_QUALITY.md](references/CODE_QUALITY.md)
|
|
22
24
|
- [ ] **Step 3:** Checked API references; used MCP discovery only for gaps
|
|
23
|
-
- [ ] **Step
|
|
24
|
-
|
|
25
|
-
- [ ]
|
|
26
|
-
- [ ] Invoked `wix-design-system` skill ONLY before writing the first `.tsx`/`.jsx` file that imports `@wix/design-system`. Skip this skill entirely for backend-only or data-only extensions.
|
|
25
|
+
- [ ] **Step 4a:** Scaffolded each CLI-supported extension via `wix generate --params`
|
|
26
|
+
- [ ] **Step 4b:** Filled in business logic in the generated files
|
|
27
|
+
- [ ] Invoked `wix-design-system` skill ONLY before editing the first `.tsx`/`.jsx` file that imports `@wix/design-system`. Skip for backend-only or data-only extensions.
|
|
27
28
|
- [ ] **Step 5:** Ran validation (see [Validation](#validation))
|
|
28
29
|
- [ ] Dependencies installed
|
|
29
30
|
- [ ] TypeScript compiled
|
|
@@ -39,6 +40,7 @@ Helps build extensions for Wix CLI applications. Covers all extension types: das
|
|
|
39
40
|
|
|
40
41
|
| ❌ WRONG | ✅ CORRECT |
|
|
41
42
|
| ------------------------------------------- | ---------------------------------------------- |
|
|
43
|
+
| Hand-writing builder files, folders, UUIDs, or extension registration | Run `wix generate --params` — it owns scaffolding |
|
|
42
44
|
| Implementing without reading the extension reference | Always read the relevant reference file first |
|
|
43
45
|
| Using MCP discovery without checking refs | Check reference files first |
|
|
44
46
|
| Reporting done without validation | Always run validation at the end |
|
|
@@ -79,23 +81,26 @@ Helps build extensions for Wix CLI applications. Covers all extension types: das
|
|
|
79
81
|
|
|
80
82
|
## Extension Types Reference Table
|
|
81
83
|
|
|
82
|
-
| Extension Type
|
|
83
|
-
|
|
|
84
|
-
| Dashboard Page
|
|
85
|
-
| Dashboard Modal
|
|
86
|
-
| Dashboard Plugin
|
|
87
|
-
| Dashboard Menu Plugin | Dashboard |
|
|
88
|
-
| Service Plugin
|
|
89
|
-
| Backend Event Extension | Backend |
|
|
90
|
-
| Backend API
|
|
91
|
-
| Data Collection
|
|
92
|
-
| Editor React component | Site
|
|
93
|
-
| Custom element widget | Site
|
|
94
|
-
| Site Plugin
|
|
95
|
-
| Embedded Script
|
|
84
|
+
| Extension Type | Category | `extensionType` (for `wix generate --params`) | Reference File |
|
|
85
|
+
| --- | --- | --- | --- |
|
|
86
|
+
| Dashboard Page | Dashboard | `DASHBOARD_PAGE` | [DASHBOARD_PAGE.md](references/DASHBOARD_PAGE.md) |
|
|
87
|
+
| Dashboard Modal | Dashboard | `DASHBOARD_MODAL` | [DASHBOARD_MODAL.md](references/DASHBOARD_MODAL.md) |
|
|
88
|
+
| Dashboard Plugin | Dashboard | `DASHBOARD_PLUGIN` | [DASHBOARD_PLUGIN.md](references/DASHBOARD_PLUGIN.md) |
|
|
89
|
+
| Dashboard Menu Plugin | Dashboard | `DASHBOARD_MENU_PLUGIN` | [DASHBOARD_MENU_PLUGIN.md](references/DASHBOARD_MENU_PLUGIN.md) |
|
|
90
|
+
| Service Plugin | Backend | `SERVICE_PLUGIN` | [SERVICE_PLUGIN.md](references/SERVICE_PLUGIN.md) |
|
|
91
|
+
| Backend Event Extension | Backend | `EVENT` | [BACKEND_EVENT.md](references/BACKEND_EVENT.md) |
|
|
92
|
+
| Backend API | Backend | — (manual, see banner below) | [BACKEND_API.md](references/BACKEND_API.md) |
|
|
93
|
+
| Data Collection | Backend | `DATA_COLLECTION` | [DATA_COLLECTION.md](references/DATA_COLLECTION.md) |
|
|
94
|
+
| Editor React component | Site | `EDITOR_REACT_COMPONENT` | [EDITOR_REACT_COMPONENT.md](references/EDITOR_REACT_COMPONENT.md) |
|
|
95
|
+
| Custom element widget | Site | `CUSTOM_ELEMENT` | [CUSTOM_ELEMENT_WIDGET.md](references/CUSTOM_ELEMENT_WIDGET.md) |
|
|
96
|
+
| Site Plugin | Site | `SITE_PLUGIN` | [SITE_PLUGIN.md](references/SITE_PLUGIN.md) |
|
|
97
|
+
| Embedded Script | Site | `EMBEDDED_SCRIPT` | [EMBEDDED_SCRIPT.md](references/EMBEDDED_SCRIPT.md) |
|
|
98
|
+
|
|
96
99
|
**Key constraints:**
|
|
97
100
|
- Dashboard Page cannot use `<Modal />`; use a separate Dashboard Modal and `dashboard.openModal()`.
|
|
98
101
|
|
|
102
|
+
> **⚠️ Backend API is the only extension type the CLI does NOT scaffold.** `wix generate` has no `BACKEND_API` handler. Create files directly per [BACKEND_API.md](references/BACKEND_API.md).
|
|
103
|
+
|
|
99
104
|
## Extension Comparison
|
|
100
105
|
|
|
101
106
|
| Custom element widget vs Editor React component vs Site Plugin | Dashboard Page vs Modal | Service Plugin vs Event |
|
|
@@ -200,7 +205,7 @@ Use the Extension Types Reference Table and decision content above. State extens
|
|
|
200
205
|
- Backend events → `references/backend-event/COMMON-EVENTS.md`
|
|
201
206
|
- Wix Data → `references/data-collection/WIX_DATA.md`
|
|
202
207
|
- Dashboard SDK → `references/dashboard-page/DASHBOARD_API.md`
|
|
203
|
-
- Service Plugin SPIs → `references/service-plugin
|
|
208
|
+
- Service Plugin SPIs → read `references/SERVICE_PLUGIN.md` together with the matching `references/service-plugin/<NAME>.md` leaf
|
|
204
209
|
4. **Verify the specific method/event exists** in references
|
|
205
210
|
5. **ONLY use MCP discovery if NOT found** in reference files
|
|
206
211
|
|
|
@@ -230,15 +235,29 @@ Use the Extension Types Reference Table and decision content above. State extens
|
|
|
230
235
|
**MCP Tools for discovery (when needed):**
|
|
231
236
|
|
|
232
237
|
- `SearchWixSDKDocumentation` - SDK methods and APIs (**Always use maxResults: 5**)
|
|
233
|
-
- `
|
|
238
|
+
- `ReadFullDocsMethodSchema` - Full type schema for a specific SDK method (parameters, return type, permissions)
|
|
239
|
+
- `ReadFullDocsArticle` - Prose guides and conceptual articles only (not for SDK method signatures)
|
|
240
|
+
|
|
241
|
+
### Step 4a: Scaffold via the CLI
|
|
242
|
+
|
|
243
|
+
For each extension **except Backend API**, run `npx wix generate --params '<json>'`. The command returns `{"success":true,"extensionType":"...","newFiles":[...]}` on success.
|
|
244
|
+
|
|
245
|
+
If the command fails because of unknown or invalid params, run `npx wix schema generate --type <extensionType>` to print the JSON Schema for that extension type, fix the `--params` payload, and retry. Do not fall back to manual scaffolding.
|
|
246
|
+
|
|
247
|
+
**What the CLI does automatically:**
|
|
248
|
+
- Creates folders and stub files
|
|
249
|
+
- Generates a fresh UUID for the extension `id`
|
|
250
|
+
- Updates `src/extensions.ts` with the import and `.use()` call
|
|
251
|
+
- Enforces naming rules (kebab-case, hyphen-required custom elements, etc.)
|
|
234
252
|
|
|
235
|
-
|
|
253
|
+
**Backend API exception:** Create `src/pages/api/*.ts` files manually per [BACKEND_API.md](references/BACKEND_API.md).
|
|
236
254
|
|
|
237
|
-
|
|
255
|
+
### Step 4b: Fill in business logic
|
|
238
256
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
-
|
|
257
|
+
Open every path returned in `newFiles` and replace stubbed handler bodies / UI / queries with the user's actual logic, guided by the extension reference file's API and configuration sections.
|
|
258
|
+
|
|
259
|
+
- ⚠️ MANDATORY when using WDS: Invoke the `wix-design-system` skill **before editing your first `.tsx`/`.jsx` file that imports `@wix/design-system`**. Do NOT invoke it preemptively for backend-only or data-only jobs — it adds large content to context that you won't use.
|
|
260
|
+
- ⚠️ MANDATORY when using Data Collections: Use the EXACT collection ID from `idSuffix` (case-sensitive). If `idSuffix` is `"product-recommendations"`, use `<app-namespace>/product-recommendations` NOT `productRecommendations`.
|
|
242
261
|
|
|
243
262
|
### Step 5: Run Validation
|
|
244
263
|
|
|
@@ -299,21 +318,7 @@ The following actions need to be done manually by you:
|
|
|
299
318
|
|
|
300
319
|
## Extension Registration
|
|
301
320
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
**Quick pattern:**
|
|
305
|
-
|
|
306
|
-
```typescript
|
|
307
|
-
import { app } from "@wix/astro/builders";
|
|
308
|
-
import { dashboardpageMyPage } from "./extensions/dashboard/pages/my-page/extensions.ts";
|
|
309
|
-
import { embeddedscriptMyScript } from "./extensions/site/embedded-scripts/my-script/extensions.ts";
|
|
310
|
-
|
|
311
|
-
export default app()
|
|
312
|
-
.use(dashboardpageMyPage)
|
|
313
|
-
.use(embeddedscriptMyScript);
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
Without registration, extensions will not appear or function in the Wix dashboard/editor/site.
|
|
321
|
+
`wix generate --params` updates `src/extensions.ts` automatically for every CLI-supported extension type. The only case that still requires manual editing is Backend API. For background, troubleshooting, and the manual recovery pattern when `src/extensions.ts` drifts, see [EXTENSION_REGISTRATION.md](references/EXTENSION_REGISTRATION.md).
|
|
317
322
|
|
|
318
323
|
---
|
|
319
324
|
|
|
@@ -332,11 +337,13 @@ Stop and report errors if any step fails. Check `.wix/debug.log` on failures.
|
|
|
332
337
|
|
|
333
338
|
## Cost Optimization
|
|
334
339
|
|
|
340
|
+
- **Let the CLI scaffold** — don't burn tokens describing folder layouts or builder boilerplate
|
|
341
|
+
- **Only run `wix schema generate --type <extensionType>`** when `wix generate --params` fails — don't pre-fetch it
|
|
335
342
|
- **Read extension reference first** — always read the relevant extension reference file before implementing
|
|
336
343
|
- **Check API references first** — read relevant API reference files before using MCP discovery
|
|
337
344
|
- **Skip discovery** when all required APIs are in reference files
|
|
338
345
|
- **maxResults: 5** for all MCP SDK searches
|
|
339
|
-
- **
|
|
346
|
+
- **ReadFullDocsMethodSchema** for SDK method schemas; **ReadFullDocsArticle** for prose guides only
|
|
340
347
|
- **Invoke wix-design-system** first when using WDS (prevents import errors)
|
|
341
348
|
|
|
342
349
|
## Documentation
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
# Wix CLI Backend Event Extension
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Event extensions run custom logic when something happens on a site — a contact is created, an order is placed, a booking is confirmed, a blog post is published. Each extension is built on a Wix JavaScript SDK webhook; the CLI subscribes your project to it.
|
|
5
5
|
|
|
6
|
-
Common use cases:
|
|
6
|
+
Common use cases: react to CRM events, sync data on order creation, send notifications when a booking is confirmed.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Scaffold
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Use `wix generate --params` with all required fields:
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
4. [ ] Update `src/extensions.ts` to import and use the new extension
|
|
12
|
+
```bash
|
|
13
|
+
wix generate --params '{"extensionType":"EVENT","folder":"<folder>"}'
|
|
14
|
+
```
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
`folder` must be lowercase alphanumeric and hyphens. The CLI generates the folder, both files, the UUID, and the `src/extensions.ts` registration. The scaffolded handler file imports a sample SDK event (CRM Contact Created) — replace the import and the handler body with the event you actually want.
|
|
18
17
|
|
|
19
18
|
## References
|
|
20
19
|
|
|
@@ -22,63 +21,9 @@ Follow these steps in order when creating an event extension.
|
|
|
22
21
|
| --- | --- |
|
|
23
22
|
| Common events (CRM, eCommerce, Bookings, Blog) | [COMMON-EVENTS.md](backend-event/COMMON-EVENTS.md) |
|
|
24
23
|
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
Two files per event ([docs](https://dev.wix.com/docs/wix-cli/guides/extensions/backend-extensions/events/event-extension-files-and-code)). Only **one** handler per event allowed in the app (including dashboard handlers).
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
src/extensions/backend/events/<event-name>/
|
|
31
|
-
├── <event-name>.extension.ts # Builder: extensions.event({ id, source }) – id is unique GUID
|
|
32
|
-
└── <event-name>.ts # Handler: imports SDK event (e.g. onContactCreated), runs on trigger
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Implementation Pattern
|
|
36
|
-
|
|
37
|
-
### Event builder (`<event-name>.extension.ts`)
|
|
38
|
-
|
|
39
|
-
Use `extensions.event()` from `@wix/astro/builders`. Required fields: `id` (unique GUID), `source` (path to the handler file).
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
import { extensions } from "@wix/astro/builders";
|
|
43
|
-
|
|
44
|
-
export const eventContactCreated = extensions.event({
|
|
45
|
-
id: "{{GENERATE_UUID}}",
|
|
46
|
-
source: "./extensions/backend/events/contact-created/contact-created.ts",
|
|
47
|
-
});
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
**CRITICAL: UUID Generation**
|
|
51
|
-
|
|
52
|
-
The `id` must be a unique, static UUID v4 string. Generate a fresh UUID for each extension—do NOT use `randomUUID()` or copy UUIDs from examples. Replace `{{GENERATE_UUID}}` with a freshly generated UUID like `"a1b2c3d4-e5f6-7890-abcd-ef1234567890"`.
|
|
53
|
-
|
|
54
|
-
### Event handler (`<event-name>.ts`)
|
|
55
|
-
|
|
56
|
-
Import the event from the correct SDK module and pass a handler. Wix invokes the handler with the event payload and metadata when the event occurs. Handler signatures are documented in the [JavaScript SDK reference](https://dev.wix.com/docs/sdk).
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
import { contacts } from "@wix/crm";
|
|
60
|
-
|
|
61
|
-
export default contacts.onContactCreated((event) => {
|
|
62
|
-
console.log("Contact created:", event.entity);
|
|
63
|
-
// Custom logic: sync to CRM, send welcome email, etc.
|
|
64
|
-
});
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Handler can be `async`; ensure errors are caught and logged so one failing handler does not break others.
|
|
68
|
-
|
|
69
|
-
## Extension Registration
|
|
70
|
-
|
|
71
|
-
**Two steps required.**
|
|
72
|
-
|
|
73
|
-
### Step 1: Event builder file
|
|
74
|
-
|
|
75
|
-
Create `<event-name>.extension.ts` inside the event folder (and `<event-name>.ts` for the handler) as shown in [Implementation Pattern](#implementation-pattern) above.
|
|
76
|
-
|
|
77
|
-
### Step 2: Register in main extensions.ts
|
|
78
|
-
|
|
79
|
-
**CRITICAL:** Read [Extension Registration reference](EXTENSION_REGISTRATION.md) and add the event extension to `src/extensions.ts` (import and `.use(eventContactCreated)` or equivalent). Without this, the event extension is not active.
|
|
24
|
+
## Handler implementation
|
|
80
25
|
|
|
81
|
-
|
|
26
|
+
Each handler imports an event from the relevant `@wix/*` SDK module and is `default`-exported (e.g., `export default contacts.onContactCreated((event) => { ... })`). See [COMMON-EVENTS.md](backend-event/COMMON-EVENTS.md) for the SDK module, handler name, payload shape, and required permission for each common event. Handlers can be `async`; wrap logic in try/catch so one failing handler doesn't break others.
|
|
82
27
|
|
|
83
28
|
## Elevating Permissions for API Calls
|
|
84
29
|
|