@wix/agent-skills 1.6.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.
Files changed (154) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/skills/wix-app/SKILL.md +49 -42
  4. package/skills/wix-app/references/BACKEND_EVENT.md +10 -65
  5. package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +101 -406
  6. package/skills/wix-app/references/DASHBOARD_MENU_PLUGIN.md +14 -111
  7. package/skills/wix-app/references/DASHBOARD_MODAL.md +56 -205
  8. package/skills/wix-app/references/DASHBOARD_PAGE.md +19 -98
  9. package/skills/wix-app/references/DASHBOARD_PLUGIN.md +6 -108
  10. package/skills/wix-app/references/DATA_COLLECTION.md +113 -198
  11. package/skills/wix-app/references/EMBEDDED_SCRIPT.md +41 -268
  12. package/skills/wix-app/references/EXTENSION_REGISTRATION.md +27 -76
  13. package/skills/wix-app/references/SERVICE_PLUGIN.md +35 -188
  14. package/skills/wix-app/references/SITE_PLUGIN.md +8 -92
  15. package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +0 -44
  16. package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +19 -330
  17. package/skills/wix-app/references/dashboard-menu-plugin/bookings-slots.md +0 -12
  18. package/skills/wix-app/references/dashboard-menu-plugin/ecommerce-slots.md +7 -0
  19. package/skills/wix-app/references/dashboard-menu-plugin/restaurants-slots.md +0 -12
  20. package/skills/wix-app/references/dashboard-plugin/SLOTS.md +3 -15
  21. package/skills/wix-app/references/service-plugin/ADDITIONAL-FEES.md +2 -18
  22. package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +2 -42
  23. package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +1 -11
  24. package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +1 -11
  25. package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +2 -40
  26. package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +2 -19
  27. package/skills/wix-app/references/service-plugin/VALIDATIONS.md +2 -18
  28. package/skills/wix-app/references/site-plugin/SLOTS.md +17 -68
  29. package/skills/wix-headless/SKILL.md +111 -389
  30. package/skills/wix-headless/references/BUILD.md +307 -0
  31. package/skills/wix-headless/references/DESIGN_SYSTEM.md +115 -0
  32. package/skills/wix-headless/references/DISCOVERY.md +237 -112
  33. package/skills/wix-headless/references/PLAN.md +82 -0
  34. package/skills/wix-headless/references/SEED.md +205 -0
  35. package/skills/wix-headless/references/SETUP.md +140 -134
  36. package/skills/wix-headless/references/astro/COMPOSE.md +142 -0
  37. package/skills/wix-headless/references/{blog → astro/blog}/BLOG_PAGES.md +1 -1
  38. package/skills/wix-headless/references/{blog → astro/blog}/BLOG_SETUP.md +2 -2
  39. package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +214 -0
  40. package/skills/wix-headless/references/{cms → astro/cms}/FAQ_KNOWLEDGE_BASE.md +6 -4
  41. package/skills/wix-headless/references/{cms → astro/cms}/PORTFOLIO.md +5 -5
  42. package/skills/wix-headless/references/{cms → astro/cms}/RESOURCE_LIBRARY.md +5 -5
  43. package/skills/wix-headless/references/{cms → astro/cms}/TEAM_DIRECTORY.md +5 -5
  44. package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +331 -0
  45. package/skills/wix-headless/references/{ecom → astro/ecom}/CART_PAGES.md +1 -1
  46. package/skills/wix-headless/references/{ecom → astro/ecom}/CART_WIRING.md +1 -1
  47. package/skills/wix-headless/references/{ecom → astro/ecom}/COMPONENTS_CSS.md +3 -3
  48. package/skills/wix-headless/references/{forms → astro/forms}/CONTACT_FORM.md +13 -13
  49. package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/COMPONENTS.md +1 -1
  50. package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/PAGES.md +1 -1
  51. package/skills/wix-headless/references/{stores → astro/stores}/BACK_IN_STOCK.md +1 -1
  52. package/skills/wix-headless/references/{stores → astro/stores}/CATEGORY_PAGES.md +12 -13
  53. package/skills/wix-headless/references/{stores → astro/stores}/COMPONENTS_CSS.md +4 -4
  54. package/skills/wix-headless/references/{stores → astro/stores}/HOME_AND_NAV.md +11 -9
  55. package/skills/wix-headless/references/{stores → astro/stores}/PRODUCT_PAGES.md +5 -3
  56. package/skills/wix-headless/references/{stores → astro/stores}/SHARED_WIRING.md +3 -3
  57. package/skills/wix-headless/references/astro/templates/Footer.astro +27 -0
  58. package/skills/wix-headless/references/astro/templates/Layout.astro +132 -0
  59. package/skills/wix-headless/references/astro/templates/Navigation.astro +38 -0
  60. package/skills/wix-headless/references/astro/templates/astro.config.mjs +41 -0
  61. package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +302 -0
  62. package/skills/wix-headless/references/astro/templates/global.css +286 -0
  63. package/skills/wix-headless/references/astro/templates/index.astro +56 -0
  64. package/skills/wix-headless/{templates → references/astro/templates}/stores/back-in-stock.ts +1 -1
  65. package/skills/wix-headless/{templates → references/astro/templates}/stores/components-stores.css +138 -33
  66. package/skills/wix-headless/references/blog/BLOG_CONTENT.md +10 -11
  67. package/skills/wix-headless/references/blog/INSTRUCTIONS.md +5 -5
  68. package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +31 -230
  69. package/skills/wix-headless/references/cms/INSTRUCTIONS.md +13 -8
  70. package/skills/wix-headless/references/custom/INSTRUCTIONS.md +38 -0
  71. package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +10 -10
  72. package/skills/wix-headless/references/forms/INSTRUCTIONS.md +5 -5
  73. package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +11 -11
  74. package/skills/wix-headless/references/images/INSTRUCTIONS.md +47 -50
  75. package/skills/wix-headless/references/seed-recipes.md +49 -0
  76. package/skills/wix-headless/references/shared/AUTHENTICATION.md +110 -0
  77. package/skills/wix-headless/references/shared/BUILD_NOISE.md +2 -2
  78. package/skills/wix-headless/references/shared/DOCS_SEARCH.md +41 -0
  79. package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +17 -17
  80. package/skills/wix-headless/references/shared/IMPLEMENTER.md +20 -29
  81. package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +1 -1
  82. package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +25 -16
  83. package/skills/wix-headless/references/shared/STYLING.md +47 -10
  84. package/skills/wix-headless/references/stores/INSTRUCTIONS.md +25 -25
  85. package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +17 -17
  86. package/skills/wix-headless/references/verticals/_schema.json +31 -117
  87. package/skills/wix-headless/references/verticals/_schema.md +60 -150
  88. package/skills/wix-headless/references/verticals/blog.md +5 -99
  89. package/skills/wix-headless/references/verticals/cms.md +9 -100
  90. package/skills/wix-headless/references/verticals/ecom.md +5 -76
  91. package/skills/wix-headless/references/verticals/forms.md +5 -85
  92. package/skills/wix-headless/references/verticals/gift-cards.md +6 -103
  93. package/skills/wix-headless/references/verticals/stores.md +10 -144
  94. package/skills/wix-headless/scripts/check-manifest.mjs +5 -5
  95. package/skills/wix-headless/scripts/emit-design-tokens.mjs +29 -23
  96. package/skills/wix-headless/scripts/init-site-json.mjs +59 -21
  97. package/skills/wix-headless/scripts/patch-decorative-slots.mjs +67 -43
  98. package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +3 -3
  99. package/skills/wix-headless/scripts/preview.sh +3 -3
  100. package/skills/wix-headless/scripts/release.sh +4 -4
  101. package/skills/wix-headless/scripts/scaffold.sh +75 -20
  102. package/skills/wix-headless/scripts/seed-utilities.sh +50 -12
  103. package/skills/wix-manage/SKILL.md +4 -8
  104. package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +2 -0
  105. package/skills/wix-manage/references/cms/cms-data-items-crud.md +4 -0
  106. package/skills/wix-manage/references/cms/cms-references-and-relationships.md +2 -0
  107. package/skills/wix-manage/references/cms/cms-schema-management.md +4 -0
  108. package/skills/wix-manage/references/ecommerce/api-shipping.md +443 -0
  109. package/skills/wix-manage/references/ecommerce/flow-add-free-shipping.md +5 -6
  110. package/skills/wix-manage/references/ecommerce/flow-fix-coverage-gaps.md +4 -5
  111. package/skills/wix-manage/references/ecommerce/flow-optimize-shipping-rates.md +4 -5
  112. package/skills/wix-manage/references/ecommerce/goal-increase-aov.md +1 -1
  113. package/skills/wix-manage/references/ecommerce/goal-reduce-cart-abandonment.md +1 -2
  114. package/skills/wix-manage/references/ecommerce/guardrail-shipping-health.md +2 -2
  115. package/skills/wix-manage/references/ecommerce/recipe-apply-shipping-recommendations.md +4 -5
  116. package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +7 -7
  117. package/skills/wix-manage/references/ecommerce/setup-discount-rules.md +209 -72
  118. package/skills/wix-manage/references/ecommerce/setup-store-pickup-location.md +9 -10
  119. package/skills/wix-manage/references/ecommerce/skill-graph.md +4 -4
  120. package/skills/wix-manage/references/forms/create-form.md +2 -0
  121. package/skills/wix-manage/references/stores/bulk-create-products-with-options.md +2 -0
  122. package/skills/wix-manage/references/stores/create-product-from-image.md +91 -38
  123. package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +2 -0
  124. package/skills/wix-app/references/custom-element-widget/default-thumbnail.png +0 -0
  125. package/skills/wix-app/references/data-collection/extension-template.ts +0 -107
  126. package/skills/wix-headless/references/ORCHESTRATION.md +0 -269
  127. package/skills/wix-headless/references/commands/install-app.md +0 -42
  128. package/skills/wix-headless/references/commands/mcp-bootstrap.md +0 -28
  129. package/skills/wix-headless/references/designer/INSTRUCTIONS.md +0 -828
  130. package/skills/wix-headless/references/shared/MCP_PREFIX.md +0 -105
  131. package/skills/wix-headless/scripts/copy-utility-templates.mjs +0 -153
  132. package/skills/wix-headless/templates/ecom/components-ecom.css +0 -215
  133. package/skills/wix-manage/references/events/list-events.md +0 -203
  134. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartBadge.tsx +0 -0
  135. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartView.tsx +0 -0
  136. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/cart.astro +0 -0
  137. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/discounts.ts +0 -0
  138. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/thank-you.astro +0 -0
  139. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/GiftCardPurchase.tsx +0 -0
  140. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_home-teaser-snippet.astro +0 -0
  141. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_nav-snippet.astro +0 -0
  142. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/components-gift-cards.css +0 -0
  143. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.astro +0 -0
  144. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.ts +0 -0
  145. /package/skills/wix-headless/{templates → references/astro/templates}/stores/AddToCartButton.tsx +0 -0
  146. /package/skills/wix-headless/{templates → references/astro/templates}/stores/BackInStockForm.tsx +0 -0
  147. /package/skills/wix-headless/{templates → references/astro/templates}/stores/CategoryRail.astro +0 -0
  148. /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductCard.astro +0 -0
  149. /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductPurchase.tsx +0 -0
  150. /package/skills/wix-headless/{templates → references/astro/templates}/stores/SeoTags.astro +0 -0
  151. /package/skills/wix-headless/{templates → references/astro/templates}/stores/categories.ts +0 -0
  152. /package/skills/wix-headless/{templates → references/astro/templates}/stores/category/[slug].astro +0 -0
  153. /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/[slug].astro +0 -0
  154. /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/index.astro +0 -0
@@ -5,7 +5,7 @@ Prerequisites, dependencies, blog service module, and astro config changes for t
5
5
  ## Prerequisites
6
6
 
7
7
  - A Wix Managed Headless project (has `wix.config.json` and `astro.config.mjs`)
8
- - The **Wix Blog app** installed on the connected Wix site (via MCP after scaffolding, or installed via MCP if missing — see `BLOG_CONTENT.md` Step 0)
8
+ - The **Wix Blog app** installed on the connected Wix site (installed via the apps-installer REST endpoint after scaffolding — see `../../blog/BLOG_CONTENT.md` Step 0)
9
9
  - At least one published blog post in the Wix dashboard
10
10
 
11
11
  ## Package Installation
@@ -215,4 +215,4 @@ Key details:
215
215
  - `media.getImageUrl(ref).url` resolves Wix media references to real URLs
216
216
  - `getPostBySlug` returns `null` for missing posts — pages must handle this with a redirect
217
217
  - `queryBlogPosts()` sorts by `firstPublishedDate` descending (newest first)
218
- - `RICH_CONTENT` fieldset is required to get renderable content for `RicosViewer`
218
+ - `RICH_CONTENT` fieldset is required to get renderable content for `RicosViewer`
@@ -0,0 +1,214 @@
1
+ # CMS Foundations — Code Patterns for `@wix/data` (astro)
2
+
3
+ The **rendering / code-patterns** half of CMS foundations: service module template, `@wix/data` SDK queries, image resolution, elevated access, and rich-text (Ricos) rendering — everything a CMS **page** scope needs to read collections and render them in Astro.
4
+
5
+ > **Seeding lives in the business track.** Creating collections and inserting/verifying items via REST is **not** here — it is in `<SKILL_ROOT>/references/cms/CMS_FOUNDATIONS.md` (the `seed` scope's doc). This file is consumed by the `pages` scope; that file by the `seed` scope. The `cms/INSTRUCTIONS.md` router points each scope at the right half.
6
+
7
+ > **Import note (read first).** Page code in this plugin uses `import * as items from "@wix/wix-data-items-sdk"` rather than the documented `import { items } from "@wix/data"`. The Wix-headless docs still show the `@wix/data` form, but `@wix/data` 1.0.448 dropped the `items` re-export — only sub-namespaces (`backups`, `collections`, `permissions`, …) remain, and the documented form fails the build with `'items' is not exported by '@wix/data'`. The actual `items` API (with `query`, `insert`, `update`, `remove`, `bulkInsert`, etc.) lives in `@wix/wix-data-items-sdk`, which `@wix/data` depends on transitively. Importing from there directly works on every current `@wix/data` version. SETUP.md's per-pack install table (Step 4c) installs `@wix/wix-data-items-sdk` (alongside `@wix/data` and `@wix/essentials`) for the cms pack so it's always present. Use the wix-data-items-sdk import everywhere.
8
+
9
+ ## Rendering Ricos rich-text fields
10
+
11
+ Wix CMS stores `RICH_TEXT` / `RICH_CONTENT` fields as **Ricos JSON** — a structured node tree (PARAGRAPH, HEADING, BULLETED_LIST, etc.), not HTML. The dashboard's rich-text editor reads and writes this format.
12
+
13
+ For SSR Astro pages (about, faq, portfolio, team, resource), import the seeded `renderRicos` util from `src/utils/ricos.ts`. The util is shipped by `seed-utilities.sh` (copied from `<SKILL_ROOT>/shared-utilities/ricos.ts` during Setup), so it's already on disk — do NOT inline a Ricos walker in your page.
14
+
15
+ ```astro
16
+ ---
17
+ import * as items from "@wix/wix-data-items-sdk";
18
+ import { auth } from "@wix/essentials";
19
+ import { renderRicos } from "../utils/ricos";
20
+
21
+ const elevatedQuery = auth.elevate(items.query);
22
+ const { items: results } = await elevatedQuery("about-content")
23
+ .limit(1)
24
+ .find();
25
+ const about = results[0];
26
+ const bodyHtml = renderRicos(about?.body);
27
+ ---
28
+
29
+ <article class="prose">
30
+ <h1>{about?.heading}</h1>
31
+ <div set:html={bodyHtml} />
32
+ </article>
33
+ ```
34
+
35
+ The util covers the common subset (PARAGRAPH, HEADING 1-6, BULLETED_LIST / ORDERED_LIST / LIST_ITEM, BLOCKQUOTE, DIVIDER + BOLD / ITALIC / UNDERLINE / LINK decorations). Anything outside that set renders defensively as a `<p>` with the raw text — never throws.
36
+
37
+ > **Why not @wix/ricos?** The blog vertical uses `@wix/ricos`'s React `RicosViewer` as a client island because blog posts can carry the full Ricos feature set (galleries, polls, embedded media). For static CMS pages, that's ~80kb of React for paragraphs and lists — overkill. Use the seeded SSR walker instead.
38
+
39
+ > **Do NOT `set:html={item.body}` directly.** That ships JSON-encoded text into the page (e.g. `[object Object]` or `{"nodes":...}`). Always go through `renderRicos`.
40
+
41
+ > **Critical Rules — Read Before Starting**
42
+ > 1. **Collection IDs have NO namespace** — user collections use just the name (e.g., `"Projects"`). Only Wix App collections use `<namespace>/<name>`. Verify via `curl`: `GET /wix-data/v2/collections?fields=id`.
43
+ > 2. **SDK query pattern** — `items.query("CollectionId").find()`. There is no `items.queryDataItems()` in the SDK.
44
+ > 3. **`auth.elevate` on every query** — without it, restricted collections silently return no items.
45
+ > 4. **CMS only for user collections** — use `@wix/blog` for blog posts, `@wix/stores` for products, `@wix/forms` for form submissions.
46
+
47
+ ## Prerequisites (page-side)
48
+
49
+ - `@wix/data` + `@wix/wix-data-items-sdk` + `@wix/essentials` installed (collected by SETUP.md Step 4c — do NOT install independently).
50
+ - The collections + items already created and seeded by the `seed` scope (see `../../cms/CMS_FOUNDATIONS.md`). Pages only **read**.
51
+
52
+ ## Collection ID Format
53
+
54
+ Native (user-created) CMS collections use **just the collection name** — no namespace prefix.
55
+
56
+ Example: if the collection is called `Projects`, the collection ID is simply `"Projects"`.
57
+
58
+ Only Wix App collections (e.g., `Members/PublicData`, `Locations/Locations`) use a `<namespace>/<name>` format. User-created collections never use a namespace.
59
+
60
+ > **How to verify**: Call `GET /wix-data/v2/collections?fields=id` via `curl` (with the standard REST headers from `../../shared/AUTHENTICATION.md`) and use the exact `id` value from the response. Never guess — the dashboard name may differ from the ID.
61
+
62
+ ## Quick Reference — Inline Query (Simple Pages)
63
+
64
+ For pages that just need to list items from a collection:
65
+
66
+ ```astro
67
+ ---
68
+ import * as items from "@wix/wix-data-items-sdk";
69
+ import { auth } from "@wix/essentials";
70
+
71
+ // Always elevate queries for permission safety
72
+ const elevatedQuery = auth.elevate(items.query);
73
+ const { items: results } = await elevatedQuery("MyCollection")
74
+ .ascending("sortField")
75
+ .limit(50)
76
+ .find();
77
+
78
+ // Fields are directly on each item (NOT item.data.field)
79
+ const myItems = results.map((item) => ({
80
+ name: item.name, // correct
81
+ // name: item.data.name // wrong — REST pattern, not SDK
82
+ }));
83
+ ---
84
+ ```
85
+
86
+ > **Common mistake:** `items.queryDataItems(...)` does NOT exist in the
87
+ > `@wix/data` SDK. The REST API uses `/items/query` with a `dataCollectionId`
88
+ > body field, but the SDK uses `items.query("collectionId")` — a chainable
89
+ > QueryBuilder. Do not confuse REST and SDK patterns.
90
+
91
+ ## Service Module Template
92
+
93
+ Every CMS use case follows the same `src/lib/{usecase}.ts` pattern — a typed interface and query functions that pages import.
94
+
95
+ ```typescript
96
+ import * as items from "@wix/wix-data-items-sdk";
97
+ import { auth } from "@wix/essentials";
98
+ import { media } from "@wix/sdk";
99
+
100
+ // -- Collection ID (use exact name from Wix dashboard — no namespace for native collections) --
101
+ const COLLECTION_ID = "collection-name";
102
+
103
+ // -- Typed interface matching collection fields --
104
+ export interface CollectionItem {
105
+ _id: string;
106
+ title: string;
107
+ slug: string;
108
+ // ...add fields matching your collection schema
109
+ coverImage?: string;
110
+ }
111
+
112
+ // -- Image resolution helper --
113
+ function resolveImage(wixImageUrl: string | undefined, width = 800, height = 600): string | undefined {
114
+ if (!wixImageUrl) return undefined;
115
+ return media.getScaledToFillImageUrl(wixImageUrl, width, height, {});
116
+ }
117
+
118
+ // -- Query all items --
119
+ // Wrap every Wix SDK await in try/catch. If the query throws at SSR, an empty
120
+ // array keeps the page renderable instead of crashing it. (Unguarded SSR
121
+ // awaits truncate Astro's response stream mid-body — nav renders, then blank.)
122
+ export async function queryItems(): Promise<CollectionItem[]> {
123
+ try {
124
+ const elevatedQuery = auth.elevate(items.query);
125
+ const { items: results } = await elevatedQuery(COLLECTION_ID)
126
+ .ascending("orderIndex")
127
+ .limit(50)
128
+ .find();
129
+
130
+ return results.map((item) => ({
131
+ ...item,
132
+ coverImage: resolveImage(item.coverImage),
133
+ })) as CollectionItem[];
134
+ } catch (err) {
135
+ console.error(`[cms:${COLLECTION_ID}] query failed:`, err);
136
+ return [];
137
+ }
138
+ }
139
+
140
+ // -- Get single item by slug --
141
+ export async function getItemBySlug(slug: string): Promise<CollectionItem | null> {
142
+ try {
143
+ const elevatedQuery = auth.elevate(items.query);
144
+ const { items: results } = await elevatedQuery(COLLECTION_ID)
145
+ .eq("slug", slug)
146
+ .limit(1)
147
+ .find();
148
+
149
+ const item = results[0];
150
+ if (!item) return null;
151
+
152
+ return {
153
+ ...item,
154
+ coverImage: resolveImage(item.coverImage),
155
+ } as CollectionItem;
156
+ } catch (err) {
157
+ console.error(`[cms:${COLLECTION_ID}] getItemBySlug failed:`, err);
158
+ return null;
159
+ }
160
+ }
161
+ ```
162
+
163
+ Key details:
164
+ - `auth.elevate(items.query)` wraps the query for restricted collections — always use this by default since collection permissions vary
165
+ - `media.getScaledToFillImageUrl(url, w, h, {})` resolves `wix:image://` URLs to sized CDN URLs
166
+ - Sort by `orderIndex` (ascending) for manually ordered content, or `_createdDate` (descending) for chronological
167
+ - The interface must match the collection fields — check the dashboard, don't guess
168
+
169
+ ## Multi-Image Resolution
170
+
171
+ For collections with image arrays (e.g., gallery images):
172
+
173
+ ```typescript
174
+ function resolveImages(imageUrls: string[] | undefined, width = 800, height = 600): string[] {
175
+ if (!imageUrls || imageUrls.length === 0) return [];
176
+ return imageUrls
177
+ .map((url) => media.getScaledToFillImageUrl(url, width, height, {}))
178
+ .filter(Boolean);
179
+ }
180
+ ```
181
+
182
+ ## Category Filtering Pattern
183
+
184
+ Many use cases filter by category via URL search params (server-rendered, no client JS):
185
+
186
+ ```astro
187
+ ---
188
+ const activeCategory = Astro.url.searchParams.get("category");
189
+ const allItems = await queryItems();
190
+ const filtered = activeCategory
191
+ ? allItems.filter((item) => item.category === activeCategory)
192
+ : allItems;
193
+ const categories = [...new Set(allItems.map((item) => item.category).filter(Boolean))];
194
+ ---
195
+
196
+ <nav>
197
+ <a href="?" class:list={[!activeCategory && "active"]}>All</a>
198
+ {categories.map((cat) => (
199
+ <a
200
+ href={`?category=${encodeURIComponent(cat)}`}
201
+ class:list={[activeCategory === cat && "active"]}
202
+ >{cat}</a>
203
+ ))}
204
+ </nav>
205
+ ```
206
+
207
+ > **Styling note:** Category filter pill styling composes `@theme` tokens as Tailwind utilities at the call site — see `../../shared/STYLING.md`.
208
+
209
+ ## Testing
210
+
211
+ 1. Confirm the collection exists in the Wix dashboard → CMS (the `seed` scope created it — see `../../cms/CMS_FOUNDATIONS.md`).
212
+ 2. Run `npx @wix/cli@latest dev`.
213
+ 3. Navigate to the listing page — should show items.
214
+ 4. Click an item — should navigate to the detail page.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Build a FAQ page using `@wix/data` — Q&A pairs organized by category with accordion UI and client-side search. Use for frequently asked questions, help centers, or knowledge bases.
4
4
 
5
- > Read `CMS_FOUNDATIONS.md` first for shared patterns (service module, image resolution, elevation, MCP seeding).
5
+ > Read `CMS_FOUNDATIONS.md` (this folder — service module, query patterns, image resolution, elevation) for page-rendering patterns, and `../../cms/CMS_FOUNDATIONS.md` for REST-based seeding.
6
6
 
7
7
  ## Collection Schema
8
8
 
@@ -180,6 +180,8 @@ Key details:
180
180
 
181
181
  ### 3. FAQ Page (`src/pages/faq/index.astro`)
182
182
 
183
+ **Layout width:** Center the page column with `container-reading` (from designer `global.css`) or `max-w-6xl mx-auto px-lg` when `--container-6xl` exists in `@theme`. **Do not** use `max-w-3xl` unless `--container-3xl` is declared in `@theme` — with only a spacing scale, Tailwind maps `max-w-3xl` to ~5rem and the FAQ collapses to one word per line. See `references/shared/STYLING.md` § "Prose / reading width".
184
+
183
185
  ```astro
184
186
  ---
185
187
  import Layout from "../../layouts/Layout.astro";
@@ -193,7 +195,7 @@ const categories = [...grouped.entries()].map(([name, items]) => ({ name, items
193
195
 
194
196
  <Layout title="FAQ">
195
197
  <main>
196
- <div>
198
+ <div class="container-reading px-lg">
197
199
  <h1>Frequently Asked Questions</h1>
198
200
  <p>Find answers to common questions below, or use the search to find what you need.</p>
199
201
 
@@ -222,8 +224,8 @@ Key details:
222
224
 
223
225
  1. Create a "FAQ" collection in the Wix dashboard → CMS with the schema above
224
226
  2. Add 6+ FAQ items across 2+ categories, all with `published: true`
225
- 3. Run `npx @wix/cli dev`
227
+ 3. Run `npx @wix/cli@latest dev`
226
228
  4. `/faq` — shows all questions grouped by category
227
229
  5. Click a question — accordion opens with the answer
228
230
  6. Type in search — filters questions in real-time
229
- 7. Click a category jump link — scrolls to that section
231
+ 7. Click a category jump link — scrolls to that section
@@ -2,7 +2,7 @@
2
2
 
3
3
  Build a visual portfolio using `@wix/data` — project grid with category filtering, image galleries, and project detail pages. Use for work samples, case studies, creative projects, or any visual showcase.
4
4
 
5
- > Read `CMS_FOUNDATIONS.md` first for shared patterns (service module, image resolution, elevation, MCP seeding).
5
+ > Read `CMS_FOUNDATIONS.md` (this folder — service module, query patterns, image resolution, elevation) for page-rendering patterns, and `../../cms/CMS_FOUNDATIONS.md` for REST-based seeding.
6
6
 
7
7
  ## Collection Schema
8
8
 
@@ -410,7 +410,7 @@ const featured = await queryFeaturedProjects(3);
410
410
 
411
411
  ## Seed with Images
412
412
 
413
- After seeding projects via MCP, generate cover images (and optionally gallery images) following `../../shared/IMAGE_GENERATION.md` and `CMS_FOUNDATIONS.md` → "MCP Seeding with Images".
413
+ After seeding projects via REST, generate cover images (and optionally gallery images) following `../../shared/IMAGE_GENERATION.md` and `../../cms/CMS_FOUNDATIONS.md` → "Seeding with Images".
414
414
 
415
415
  **Cover image prompt template:**
416
416
 
@@ -431,7 +431,7 @@ Gallery image [N] for [TITLE]: [describe a specific aspect/angle of the project]
431
431
  Example patch:
432
432
 
433
433
  ```
434
- CallWixSiteAPI: PATCH /wix-data/v2/items/{projectId}
434
+ REST: PATCH https://www.wixapis.com/wix-data/v2/items/{projectId}
435
435
  body: {
436
436
  "dataCollectionId": "Projects",
437
437
  "dataItem": {
@@ -448,7 +448,7 @@ body: {
448
448
  1. Create a "Projects" collection in the Wix dashboard → CMS with the schema above
449
449
  2. Add 3+ projects with cover images, categories, and at least one with gallery images
450
450
  3. Mark 1–2 as `featured: true`
451
- 4. Run `npx @wix/cli dev`
451
+ 4. Run `npx @wix/cli@latest dev`
452
452
  5. `/work` — grid with category filter tabs
453
453
  6. Click a category — filters projects
454
- 7. Click a project — detail page with gallery lightbox
454
+ 7. Click a project — detail page with gallery lightbox
@@ -2,7 +2,7 @@
2
2
 
3
3
  Build a downloadable resource library using `@wix/data` — file listings with category filtering, file type badges, and detail pages with download buttons. Use for documents, guides, templates, whitepapers, or any downloadable assets.
4
4
 
5
- > Read `CMS_FOUNDATIONS.md` first for shared patterns (service module, image resolution, elevation, MCP seeding).
5
+ > Read `CMS_FOUNDATIONS.md` (this folder — service module, query patterns, image resolution, elevation) for page-rendering patterns, and `../../cms/CMS_FOUNDATIONS.md` for REST-based seeding.
6
6
 
7
7
  ## Collection Schema
8
8
 
@@ -321,7 +321,7 @@ Key details:
321
321
 
322
322
  ## Seed with Images
323
323
 
324
- After seeding resources via MCP, generate cover images following `../../shared/IMAGE_GENERATION.md` and `CMS_FOUNDATIONS.md` → "MCP Seeding with Images".
324
+ After seeding resources via REST, generate cover images following `../../shared/IMAGE_GENERATION.md` and `../../cms/CMS_FOUNDATIONS.md` → "Seeding with Images".
325
325
 
326
326
  **Prompt template:**
327
327
 
@@ -334,7 +334,7 @@ Cover image for [TITLE], a [FILE TYPE]. Abstract [BRAND AESTHETIC]. Color tones:
334
334
  Example patch:
335
335
 
336
336
  ```
337
- CallWixSiteAPI: PATCH /wix-data/v2/items/{resourceId}
337
+ REST: PATCH https://www.wixapis.com/wix-data/v2/items/{resourceId}
338
338
  body: {
339
339
  "dataCollectionId": "Resources",
340
340
  "dataItem": {
@@ -350,7 +350,7 @@ body: {
350
350
  1. Create a "Resources" collection in the Wix dashboard → CMS with the schema above
351
351
  2. Add 4+ resources across 2+ categories with different file types (PDF, DOC, ZIP)
352
352
  3. Include `fileUrl` links (can be any downloadable URL for testing)
353
- 4. Run `npx @wix/cli dev`
353
+ 4. Run `npx @wix/cli@latest dev`
354
354
  5. `/resources` — shows all resources with category filters and file type badges
355
355
  6. Click a category — filters resources
356
- 7. Click a resource — detail page with download button and related resources
356
+ 7. Click a resource — detail page with download button and related resources
@@ -2,7 +2,7 @@
2
2
 
3
3
  Build a team directory using `@wix/data` — staff cards grouped by department with individual profile pages. Use for about us, our team, meet the staff, or any people directory.
4
4
 
5
- > Read `CMS_FOUNDATIONS.md` first for shared patterns (service module, image resolution, elevation, MCP seeding).
5
+ > Read `CMS_FOUNDATIONS.md` (this folder — service module, query patterns, image resolution, elevation) for page-rendering patterns, and `../../cms/CMS_FOUNDATIONS.md` for REST-based seeding.
6
6
 
7
7
  ## Collection Schema
8
8
 
@@ -266,7 +266,7 @@ if (!member) return Astro.redirect("/404");
266
266
  > **Do not skip:** Team members without photos appear as initial-letter placeholders.
267
267
  > Always ask the user if they want to generate headshot images before moving on.
268
268
 
269
- After seeding team members via MCP, generate headshot images following `../../shared/IMAGE_GENERATION.md` and `CMS_FOUNDATIONS.md` → "MCP Seeding with Images".
269
+ After seeding team members via REST, generate headshot images following `../../shared/IMAGE_GENERATION.md` and `../../cms/CMS_FOUNDATIONS.md` → "Seeding with Images".
270
270
 
271
271
  **Prompt template:**
272
272
 
@@ -279,7 +279,7 @@ Professional headshot portrait of [NAME], [ROLE] at [BUSINESS NAME]. [BRAND AEST
279
279
  Example: after generating and importing the image, patch the team member item:
280
280
 
281
281
  ```
282
- CallWixSiteAPI: PATCH /wix-data/v2/items/{memberId}
282
+ REST: PATCH https://www.wixapis.com/wix-data/v2/items/{memberId}
283
283
  body: {
284
284
  "dataCollectionId": "Team",
285
285
  "dataItem": {
@@ -294,6 +294,6 @@ body: {
294
294
 
295
295
  1. Create a "Team" collection in the Wix dashboard → CMS with the schema above
296
296
  2. Add 4+ members across 2+ departments, with photos and social links
297
- 3. Run `npx @wix/cli dev`
297
+ 3. Run `npx @wix/cli@latest dev`
298
298
  4. `/team` — shows members grouped by department
299
- 5. Click a member — profile page with photo, bio, and social links
299
+ 5. Click a member — profile page with photo, bio, and social links