@wix/agent-skills 1.14.0 → 1.15.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 (247) hide show
  1. package/README.md +4 -1
  2. package/package.json +1 -1
  3. package/skills/README.md +23 -0
  4. package/skills/wix-app/SKILL.md +10 -2
  5. package/skills/wix-app/references/AUTO_PATTERNS_DASHBOARD.md +326 -0
  6. package/skills/wix-app/references/CODE_QUALITY.md +1 -0
  7. package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +124 -115
  8. package/skills/wix-app/references/DASHBOARD_PAGE.md +3 -0
  9. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +23 -9
  10. package/skills/wix-app/references/SITE_PLUGIN.md +1 -1
  11. package/skills/wix-app/references/auto-patterns-dashboard/action-cell.md +115 -0
  12. package/skills/wix-app/references/auto-patterns-dashboard/app-config-structure.md +264 -0
  13. package/skills/wix-app/references/auto-patterns-dashboard/app-context.md +37 -0
  14. package/skills/wix-app/references/auto-patterns-dashboard/bulk-actions.md +86 -0
  15. package/skills/wix-app/references/auto-patterns-dashboard/collection-page-actions.md +119 -0
  16. package/skills/wix-app/references/auto-patterns-dashboard/collection-page.md +103 -0
  17. package/skills/wix-app/references/auto-patterns-dashboard/custom-actions-override.md +76 -0
  18. package/skills/wix-app/references/auto-patterns-dashboard/custom-columns-override.md +82 -0
  19. package/skills/wix-app/references/auto-patterns-dashboard/custom-components-override.md +89 -0
  20. package/skills/wix-app/references/auto-patterns-dashboard/custom-header-override.md +124 -0
  21. package/skills/wix-app/references/auto-patterns-dashboard/custom-sections-override.md +91 -0
  22. package/skills/wix-app/references/auto-patterns-dashboard/custom-slots-override.md +71 -0
  23. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-actions.md +70 -0
  24. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-view-actions.md +73 -0
  25. package/skills/wix-app/references/auto-patterns-dashboard/entity-page.md +98 -0
  26. package/skills/wix-app/references/auto-patterns-dashboard/example-patterns.json +278 -0
  27. package/skills/wix-app/references/auto-patterns-dashboard/pages-configuration.md +94 -0
  28. package/skills/wix-app/references/auto-patterns-dashboard/resolved-action.md +43 -0
  29. package/skills/wix-app/references/auto-patterns-dashboard/sdk-utilities.md +66 -0
  30. package/skills/wix-app/references/auto-patterns-dashboard/views.md +76 -0
  31. package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +1 -14
  32. package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +54 -29
  33. package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +2 -2
  34. package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +17 -105
  35. package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +127 -0
  36. package/skills/wix-app/references/editor-react-component/PARTS.md +2 -1
  37. package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +15 -15
  38. package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +25 -53
  39. package/skills/wix-app/scripts/generate-auto-patterns.js +510 -0
  40. package/skills/wix-auth/SKILL.md +12 -0
  41. package/skills/wix-auth/references/device-flow.md +140 -0
  42. package/skills/wix-docs/SKILL.md +188 -0
  43. package/skills/wix-docs/references/API_SPEC_SEARCH.md +213 -0
  44. package/skills/wix-docs/references/EXTRACTING.md +120 -0
  45. package/skills/wix-headless/SKILL.md +84 -130
  46. package/skills/wix-headless/entry/bootstrap.mjs +93 -0
  47. package/skills/wix-headless/entry/skill.md +78 -0
  48. package/skills/wix-headless/references/AI_FEATURES.md +178 -0
  49. package/skills/wix-headless/references/CAPABILITIES.md +84 -0
  50. package/skills/wix-headless/references/DISCOVERY.md +34 -56
  51. package/skills/wix-headless/references/DOC_DISCOVERY.md +37 -0
  52. package/skills/wix-headless/references/FEEDBACK.md +118 -0
  53. package/skills/wix-headless/references/IMAGE_GENERATION.md +69 -0
  54. package/skills/wix-headless/references/SDK_HANDOFF.md +97 -0
  55. package/skills/wix-headless/references/SEED.md +44 -188
  56. package/skills/wix-headless/references/SETUP.md +32 -103
  57. package/skills/wix-headless/references/astro.md +98 -0
  58. package/skills/wix-headless/references/inline-recipes/how-to-code-a-blog.md +196 -0
  59. package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +236 -0
  60. package/skills/wix-headless/references/inline-recipes/how-to-code-bookings.md +279 -0
  61. package/skills/wix-headless/references/inline-recipes/how-to-code-cms.md +163 -0
  62. package/skills/wix-headless/references/inline-recipes/how-to-code-events.md +203 -0
  63. package/skills/wix-headless/references/inline-recipes/how-to-code-forms.md +222 -0
  64. package/skills/wix-headless/references/inline-recipes/how-to-code-members-astro.md +124 -0
  65. package/skills/wix-headless/references/inline-recipes/how-to-code-members-custom-login.md +160 -0
  66. package/skills/wix-headless/references/inline-recipes/how-to-code-members-non-astro.md +118 -0
  67. package/skills/wix-headless/references/inline-recipes/how-to-code-portfolio.md +132 -0
  68. package/skills/wix-headless/references/inline-recipes/how-to-code-pricing-plans.md +124 -0
  69. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-orders.md +188 -0
  70. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-reservations.md +173 -0
  71. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurants.md +161 -0
  72. package/skills/wix-headless/references/inline-recipes/setup-blog.md +175 -0
  73. package/skills/wix-headless/references/inline-recipes/setup-bookings.md +228 -0
  74. package/skills/wix-headless/references/inline-recipes/setup-cms.md +200 -0
  75. package/skills/wix-headless/references/inline-recipes/setup-events.md +196 -0
  76. package/skills/wix-headless/references/inline-recipes/setup-forms.md +174 -0
  77. package/skills/wix-headless/references/inline-recipes/setup-online-store.md +176 -0
  78. package/skills/wix-headless/references/inline-recipes/setup-portfolio.md +153 -0
  79. package/skills/wix-headless/references/inline-recipes/setup-pricing-plans.md +229 -0
  80. package/skills/wix-headless/references/inline-recipes/setup-restaurant-orders.md +161 -0
  81. package/skills/wix-headless/references/inline-recipes/setup-restaurant-reservations.md +117 -0
  82. package/skills/wix-headless/references/inline-recipes/setup-restaurants.md +152 -0
  83. package/skills/wix-headless/references/managed/AUTHENTICATION.md +57 -0
  84. package/skills/wix-headless/references/managed/CONNECT.md +74 -0
  85. package/skills/wix-headless/references/managed/CREATE.md +130 -0
  86. package/skills/wix-headless/references/managed/DEPLOYMENT.md +57 -0
  87. package/skills/wix-headless/references/non-astro.md +59 -0
  88. package/skills/wix-headless/references/self-managed/AUTHENTICATION.md +22 -0
  89. package/skills/wix-headless/references/self-managed/DEPLOYMENT.md +7 -0
  90. package/skills/wix-headless/references/stripe/AUTHENTICATION.md +55 -0
  91. package/skills/wix-headless/references/stripe/DEPLOYMENT.md +63 -0
  92. package/skills/wix-manage/SKILL.md +24 -1
  93. package/skills/wix-manage/references/analytics/query-site-analytics.md +241 -0
  94. package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +1 -1
  95. package/skills/wix-manage/references/bookings/diagnose-availability-issues.md +265 -0
  96. package/skills/wix-manage/references/marketing/create-and-publish-social-post.md +436 -0
  97. package/skills/wix-manage/references/marketing/generate-and-publish-marketing-plan.md +209 -0
  98. package/skills/wix-manage/references/rich-content/author-ricos-rich-content.md +249 -0
  99. package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +51 -0
  100. package/skills/wix-vibe-headless/SKILL.md +136 -0
  101. package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +128 -0
  102. package/skills/wix-vibe-headless/references/blog/wix-blog.js +217 -0
  103. package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +153 -0
  104. package/skills/wix-vibe-headless/references/bookings/wix-bookings-checkout.js +147 -0
  105. package/skills/wix-vibe-headless/references/bookings/wix-bookings-services.js +215 -0
  106. package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +154 -0
  107. package/skills/wix-vibe-headless/references/cms/wix-cms.js +186 -0
  108. package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +142 -0
  109. package/skills/wix-vibe-headless/references/events/wix-events-browse.js +135 -0
  110. package/skills/wix-vibe-headless/references/events/wix-events-registration.js +187 -0
  111. package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +211 -0
  112. package/skills/wix-vibe-headless/references/members/wix-members-auth.js +387 -0
  113. package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +111 -0
  114. package/skills/wix-vibe-headless/references/portfolio/wix-portfolio.js +194 -0
  115. package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +127 -0
  116. package/skills/wix-vibe-headless/references/pricing-plans/wix-pricing-plans.js +157 -0
  117. package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +138 -0
  118. package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-menu.js +224 -0
  119. package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-ordering.js +156 -0
  120. package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-reservations.js +107 -0
  121. package/skills/wix-vibe-headless/references/shared/wix-client.js +186 -0
  122. package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +155 -0
  123. package/skills/wix-vibe-headless/references/storefront/wix-store-cart.js +147 -0
  124. package/skills/wix-vibe-headless/references/storefront/wix-store-catalog.js +142 -0
  125. package/skills/wix-headless/references/BUILD-astro.md +0 -253
  126. package/skills/wix-headless/references/BUILD-own-build.md +0 -167
  127. package/skills/wix-headless/references/BUILD.md +0 -105
  128. package/skills/wix-headless/references/DESIGN_SYSTEM.md +0 -165
  129. package/skills/wix-headless/references/DISCOVERY-connect.md +0 -55
  130. package/skills/wix-headless/references/DISCOVERY-create.md +0 -238
  131. package/skills/wix-headless/references/PLAN-connect.md +0 -19
  132. package/skills/wix-headless/references/PLAN-create.md +0 -17
  133. package/skills/wix-headless/references/PLAN.md +0 -92
  134. package/skills/wix-headless/references/astro/blog/BLOG_PAGES.md +0 -300
  135. package/skills/wix-headless/references/astro/blog/BLOG_SETUP.md +0 -218
  136. package/skills/wix-headless/references/astro/bookings/COMPONENTS.md +0 -45
  137. package/skills/wix-headless/references/astro/bookings/SERVICES_PAGES.md +0 -77
  138. package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +0 -214
  139. package/skills/wix-headless/references/astro/cms/FAQ_KNOWLEDGE_BASE.md +0 -231
  140. package/skills/wix-headless/references/astro/cms/PORTFOLIO.md +0 -453
  141. package/skills/wix-headless/references/astro/cms/RESOURCE_LIBRARY.md +0 -354
  142. package/skills/wix-headless/references/astro/cms/TEAM_DIRECTORY.md +0 -299
  143. package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +0 -351
  144. package/skills/wix-headless/references/astro/ecom/CART_PAGES.md +0 -119
  145. package/skills/wix-headless/references/astro/ecom/CART_WIRING.md +0 -103
  146. package/skills/wix-headless/references/astro/ecom/COMPONENTS_CSS.md +0 -132
  147. package/skills/wix-headless/references/astro/forms/CONTACT_FORM.md +0 -463
  148. package/skills/wix-headless/references/astro/gift-cards/COMPONENTS.md +0 -119
  149. package/skills/wix-headless/references/astro/gift-cards/PAGES.md +0 -129
  150. package/skills/wix-headless/references/astro/stores/BACK_IN_STOCK.md +0 -178
  151. package/skills/wix-headless/references/astro/stores/CATEGORY_PAGES.md +0 -85
  152. package/skills/wix-headless/references/astro/stores/COMPONENTS_CSS.md +0 -129
  153. package/skills/wix-headless/references/astro/stores/HOME_AND_NAV.md +0 -229
  154. package/skills/wix-headless/references/astro/stores/PRODUCT_PAGES.md +0 -215
  155. package/skills/wix-headless/references/astro/stores/SHARED_WIRING.md +0 -165
  156. package/skills/wix-headless/references/astro/templates/Layout.astro +0 -132
  157. package/skills/wix-headless/references/astro/templates/astro.config.mjs +0 -41
  158. package/skills/wix-headless/references/astro/templates/bookings/AvailabilityCalendar.tsx +0 -374
  159. package/skills/wix-headless/references/astro/templates/bookings/BookingForm.tsx +0 -136
  160. package/skills/wix-headless/references/astro/templates/bookings/SeoTags.astro +0 -25
  161. package/skills/wix-headless/references/astro/templates/bookings/ServiceBookingFlow.tsx +0 -71
  162. package/skills/wix-headless/references/astro/templates/bookings/ServiceCard.astro +0 -54
  163. package/skills/wix-headless/references/astro/templates/bookings/booking-confirmation.astro +0 -49
  164. package/skills/wix-headless/references/astro/templates/bookings/bookingDriver.ts +0 -245
  165. package/skills/wix-headless/references/astro/templates/bookings/components-bookings.css +0 -424
  166. package/skills/wix-headless/references/astro/templates/bookings/services/[slug].astro +0 -176
  167. package/skills/wix-headless/references/astro/templates/bookings/services/index.astro +0 -181
  168. package/skills/wix-headless/references/astro/templates/ecom/CartBadge.tsx +0 -84
  169. package/skills/wix-headless/references/astro/templates/ecom/CartView.tsx +0 -543
  170. package/skills/wix-headless/references/astro/templates/ecom/cart.astro +0 -13
  171. package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +0 -302
  172. package/skills/wix-headless/references/astro/templates/ecom/discounts.ts +0 -71
  173. package/skills/wix-headless/references/astro/templates/ecom/thank-you.astro +0 -24
  174. package/skills/wix-headless/references/astro/templates/gift-cards/GiftCardPurchase.tsx +0 -172
  175. package/skills/wix-headless/references/astro/templates/gift-cards/_home-teaser-snippet.astro +0 -42
  176. package/skills/wix-headless/references/astro/templates/gift-cards/_nav-snippet.astro +0 -11
  177. package/skills/wix-headless/references/astro/templates/gift-cards/components-gift-cards.css +0 -220
  178. package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.astro +0 -51
  179. package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.ts +0 -75
  180. package/skills/wix-headless/references/astro/templates/global.css +0 -288
  181. package/skills/wix-headless/references/astro/templates/stores/AddToCartButton.tsx +0 -77
  182. package/skills/wix-headless/references/astro/templates/stores/BackInStockForm.tsx +0 -176
  183. package/skills/wix-headless/references/astro/templates/stores/CategoryRail.astro +0 -69
  184. package/skills/wix-headless/references/astro/templates/stores/ProductCard.astro +0 -79
  185. package/skills/wix-headless/references/astro/templates/stores/ProductPurchase.tsx +0 -397
  186. package/skills/wix-headless/references/astro/templates/stores/SeoTags.astro +0 -21
  187. package/skills/wix-headless/references/astro/templates/stores/back-in-stock.ts +0 -67
  188. package/skills/wix-headless/references/astro/templates/stores/categories.ts +0 -155
  189. package/skills/wix-headless/references/astro/templates/stores/category/[slug].astro +0 -130
  190. package/skills/wix-headless/references/astro/templates/stores/components-stores.css +0 -400
  191. package/skills/wix-headless/references/astro/templates/stores/products/[slug].astro +0 -128
  192. package/skills/wix-headless/references/astro/templates/stores/products/index.astro +0 -101
  193. package/skills/wix-headless/references/blog/BLOG_CONTENT.md +0 -161
  194. package/skills/wix-headless/references/blog/INSTRUCTIONS.md +0 -32
  195. package/skills/wix-headless/references/bookings/FLOW.md +0 -246
  196. package/skills/wix-headless/references/bookings/INSTRUCTIONS.md +0 -95
  197. package/skills/wix-headless/references/bookings/SERVICES_DATA.md +0 -355
  198. package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +0 -176
  199. package/skills/wix-headless/references/cms/INSTRUCTIONS.md +0 -71
  200. package/skills/wix-headless/references/commands/known-apps.json +0 -6
  201. package/skills/wix-headless/references/custom/CONNECTION_PLAN.md +0 -142
  202. package/skills/wix-headless/references/custom/INSTRUCTIONS.md +0 -88
  203. package/skills/wix-headless/references/custom/blog/WIRING.md +0 -52
  204. package/skills/wix-headless/references/custom/bookings/WIRING.md +0 -197
  205. package/skills/wix-headless/references/custom/cms/WIRING.md +0 -97
  206. package/skills/wix-headless/references/custom/ecom/WIRING.md +0 -67
  207. package/skills/wix-headless/references/custom/forms/WIRING.md +0 -101
  208. package/skills/wix-headless/references/custom/stores/WIRING.md +0 -80
  209. package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +0 -59
  210. package/skills/wix-headless/references/forms/INSTRUCTIONS.md +0 -43
  211. package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +0 -51
  212. package/skills/wix-headless/references/images/INSTRUCTIONS.md +0 -357
  213. package/skills/wix-headless/references/seed-recipes.md +0 -49
  214. package/skills/wix-headless/references/shared/AGENTS_MD.md +0 -47
  215. package/skills/wix-headless/references/shared/AUTHENTICATION.md +0 -108
  216. package/skills/wix-headless/references/shared/BUILD_NOISE.md +0 -8
  217. package/skills/wix-headless/references/shared/DESIGN_MD.md +0 -84
  218. package/skills/wix-headless/references/shared/DOCS_SEARCH.md +0 -41
  219. package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +0 -186
  220. package/skills/wix-headless/references/shared/IMPLEMENTER.md +0 -206
  221. package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +0 -97
  222. package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +0 -143
  223. package/skills/wix-headless/references/shared/STYLING.md +0 -140
  224. package/skills/wix-headless/references/stores/INSTRUCTIONS.md +0 -126
  225. package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +0 -252
  226. package/skills/wix-headless/references/verticals/_schema.json +0 -74
  227. package/skills/wix-headless/references/verticals/_schema.md +0 -95
  228. package/skills/wix-headless/references/verticals/blog.md +0 -31
  229. package/skills/wix-headless/references/verticals/bookings.md +0 -41
  230. package/skills/wix-headless/references/verticals/cms.md +0 -30
  231. package/skills/wix-headless/references/verticals/ecom.md +0 -25
  232. package/skills/wix-headless/references/verticals/forms.md +0 -26
  233. package/skills/wix-headless/references/verticals/gift-cards.md +0 -24
  234. package/skills/wix-headless/references/verticals/stores.md +0 -33
  235. package/skills/wix-headless/scripts/check-manifest.mjs +0 -335
  236. package/skills/wix-headless/scripts/compose.mjs +0 -520
  237. package/skills/wix-headless/scripts/emit-design-tokens.mjs +0 -157
  238. package/skills/wix-headless/scripts/flatten.sh +0 -61
  239. package/skills/wix-headless/scripts/generate-images.mjs +0 -242
  240. package/skills/wix-headless/scripts/patch-decorative-slots.mjs +0 -154
  241. package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +0 -190
  242. package/skills/wix-headless/scripts/scaffold.sh +0 -139
  243. package/skills/wix-headless/scripts/seed-utilities.sh +0 -93
  244. package/skills/wix-headless/scripts/write-decorative-json.mjs +0 -62
  245. package/skills/wix-headless/shared-utilities/analytics.ts +0 -40
  246. package/skills/wix-headless/shared-utilities/ricos.ts +0 -179
  247. package/skills/wix-headless/shared-utilities/wix-image.ts +0 -72
@@ -0,0 +1,510 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Auto Patterns Generator Script
5
+ *
6
+ * Generates patterns.json and the page component for @wix/auto-patterns dashboard pages.
7
+ * Replicates the deterministic logic from AutoPatternsGenerator.ts.
8
+ *
9
+ * The page component is written as `<folder>.tsx` (the basename of --output) to
10
+ * match — and overwrite — the stub the Wix CLI scaffolds and registers in
11
+ * `<folder>.extension.ts`. This wires the wrapper up with no manual edit.
12
+ *
13
+ * Usage:
14
+ * node <SKILL_ROOT>/scripts/generate-auto-patterns.js --input <path-to-input.json> --output <target-directory>
15
+ * node <SKILL_ROOT>/scripts/generate-auto-patterns.js --help
16
+ *
17
+ * <SKILL_ROOT> is the absolute path to the wix-app skill bundle (the folder containing SKILL.md).
18
+ * The script is not installed in the user's app repo — invoke it by absolute path from the project directory.
19
+ *
20
+ * Input JSON shape:
21
+ * {
22
+ * "collection": {
23
+ * "idSuffix": "additional-fees",
24
+ * "fields": [{ "key": "feeTitle", "displayName": "Fee Title", "type": "TEXT" }, ...]
25
+ * },
26
+ * "schema": {
27
+ * "content": { "collectionRouteId": "...", ... (20 string fields) },
28
+ * "layout": { "main": [...], "sidebar": [...] },
29
+ * "columns": [{ "id": "feeTitle", "displayName": "Title" }],
30
+ * "gridItem": null | { "titleFieldId": "...", ... }
31
+ * },
32
+ * "relevantCollectionId": "my-namespace/additional-fees",
33
+ * "extensionName": "Additional Fees Manager"
34
+ * }
35
+ *
36
+ * Output:
37
+ * Writes patterns.json and <folder>.tsx to the specified output directory.
38
+ * Prints JSON result to stdout: { "files": ["patterns.json", "<folder>.tsx"] }
39
+ *
40
+ * Exit codes:
41
+ * 0 - Success
42
+ * 1 - Invalid arguments or missing required fields
43
+ * 2 - File system error
44
+ */
45
+
46
+ import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs';
47
+ import { basename, join, resolve } from 'path';
48
+
49
+ // --- Argument parsing ---
50
+
51
+ const args = process.argv.slice(2);
52
+
53
+ function getArg(name) {
54
+ const idx = args.indexOf(`--${name}`);
55
+ if (idx === -1 || idx + 1 >= args.length) return null;
56
+ return args[idx + 1];
57
+ }
58
+
59
+ if (args.includes('--help') || args.includes('-h')) {
60
+ console.log(`Auto Patterns Generator
61
+
62
+ Usage:
63
+ node <SKILL_ROOT>/scripts/generate-auto-patterns.js --input <path> --output <dir>
64
+
65
+ <SKILL_ROOT> is the absolute path to the wix-app skill bundle (the folder containing SKILL.md).
66
+
67
+ Options:
68
+ --input Path to input JSON file (required)
69
+ --output Target directory for generated files (required)
70
+ --help Show this help message
71
+
72
+ Input JSON shape:
73
+ {
74
+ "collection": {
75
+ "idSuffix": "string",
76
+ "fields": [{ "key": "string", "displayName": "string", "type": "string" }]
77
+ },
78
+ "schema": {
79
+ "content": { "collectionRouteId": "string", ... },
80
+ "layout": { "main": [...], "sidebar": [...] },
81
+ "columns": [{ "id": "string", "displayName": "string" }],
82
+ "gridItem": null | { "titleFieldId": "string", ... }
83
+ },
84
+ "relevantCollectionId": "string",
85
+ "extensionName": "string"
86
+ }
87
+
88
+ Output:
89
+ Writes patterns.json and <folder>.tsx to the output directory.
90
+ Prints JSON to stdout: { "files": ["patterns.json", "<folder>.tsx"] }`);
91
+ process.exit(0);
92
+ }
93
+
94
+ const inputPath = getArg('input');
95
+ const outputDir = getArg('output');
96
+
97
+ if (!inputPath) {
98
+ console.error('Error: --input is required. Use --help for usage.');
99
+ process.exit(1);
100
+ }
101
+ if (!outputDir) {
102
+ console.error('Error: --output is required. Use --help for usage.');
103
+ process.exit(1);
104
+ }
105
+
106
+ // --- Read and validate input ---
107
+
108
+ let input;
109
+ try {
110
+ const raw = readFileSync(resolve(inputPath), 'utf-8');
111
+ input = JSON.parse(raw);
112
+ } catch (err) {
113
+ console.error(`Error: Failed to read input file: ${err.message}`);
114
+ process.exit(1);
115
+ }
116
+
117
+ const { collection, schema, relevantCollectionId } = input;
118
+
119
+ if (!collection || !collection.idSuffix || !Array.isArray(collection.fields)) {
120
+ console.error(
121
+ 'Error: Input must include "collection" with "idSuffix" and "fields" array.',
122
+ );
123
+ process.exit(1);
124
+ }
125
+ if (
126
+ !schema ||
127
+ !schema.content ||
128
+ !schema.layout ||
129
+ !Array.isArray(schema.columns)
130
+ ) {
131
+ console.error(
132
+ 'Error: Input must include "schema" with "content", "layout", and "columns".',
133
+ );
134
+ process.exit(1);
135
+ }
136
+
137
+ // --- Generator logic (mirrors AutoPatternsGenerator.ts) ---
138
+
139
+ function generatePatternsConfig(collection, schema) {
140
+ const collectionRouteId = schema.content.collectionRouteId;
141
+ const singularEntityName = schema.content.singularEntityName;
142
+
143
+ // Build field map
144
+ const fieldMap = new Map();
145
+ for (const field of collection.fields) {
146
+ if (field.key && field.displayName) {
147
+ fieldMap.set(field.key, field);
148
+ }
149
+ }
150
+
151
+ const sortableFieldTypes = ['TEXT', 'DATE', 'NUMBER', 'BOOLEAN', 'URL'];
152
+
153
+ // Generate columns
154
+ const columns = schema.columns
155
+ .map((columnConfig) => {
156
+ const field = fieldMap.get(columnConfig.id);
157
+ if (!field || !field.key || !field.type) return null;
158
+
159
+ let width = '200px';
160
+ if (['BOOLEAN', 'IMAGE', 'NUMBER'].includes(field.type)) width = '100px';
161
+ if (field.type === 'URL') width = '300px';
162
+
163
+ return {
164
+ id: field.key,
165
+ name: columnConfig.displayName || field.displayName || 'Field',
166
+ width,
167
+ sortable: sortableFieldTypes.includes(field.type || ''),
168
+ };
169
+ })
170
+ .filter(Boolean);
171
+
172
+ // Generate filters
173
+ const filterableFieldTypes = ['DATE', 'NUMBER', 'BOOLEAN'];
174
+ const filters = columns
175
+ .map((column) => {
176
+ const field = fieldMap.get(column.id);
177
+ if (
178
+ !field ||
179
+ !field.key ||
180
+ !filterableFieldTypes.includes(field.type || '')
181
+ )
182
+ return null;
183
+
184
+ const baseFilter = {
185
+ id: `${field.key}-filter`,
186
+ fieldId: field.key,
187
+ displayName: field.displayName || '',
188
+ tagLabel: field.displayName || '',
189
+ };
190
+
191
+ if (field.type === 'DATE') {
192
+ return {
193
+ ...baseFilter,
194
+ dateConfig: {
195
+ mode: 'COMBINE',
196
+ presets: [
197
+ 'TODAY',
198
+ 'SEVEN_DAYS',
199
+ 'MONTH',
200
+ 'NEXT_SEVEN_DAYS',
201
+ 'NEXT_THIRTY_DAYS',
202
+ ],
203
+ includeTime: false,
204
+ },
205
+ };
206
+ }
207
+ if (field.type === 'NUMBER') {
208
+ return {
209
+ ...baseFilter,
210
+ numberConfig: { allowedDecimals: true },
211
+ };
212
+ }
213
+ if (field.type === 'BOOLEAN') {
214
+ return baseFilter;
215
+ }
216
+ return null;
217
+ })
218
+ .filter(Boolean);
219
+
220
+ // Generate layout (Table + optional Grid)
221
+ const layout = [
222
+ {
223
+ type: 'Table',
224
+ table: {
225
+ columns,
226
+ customColumns: { enabled: true },
227
+ },
228
+ },
229
+ ];
230
+
231
+ if (schema.gridItem) {
232
+ layout.push({
233
+ type: 'Grid',
234
+ grid: {
235
+ item: {
236
+ titleFieldId: schema.gridItem.titleFieldId,
237
+ ...(schema.gridItem.subtitleFieldId
238
+ ? { subtitleFieldId: schema.gridItem.subtitleFieldId }
239
+ : {}),
240
+ ...(schema.gridItem.imageFieldId
241
+ ? { imageFieldId: schema.gridItem.imageFieldId }
242
+ : {}),
243
+ cardContentMode: schema.gridItem.subtitleFieldId ? 'full' : 'title',
244
+ },
245
+ },
246
+ });
247
+ }
248
+
249
+ // Generate entity page layout
250
+ function generateEntityPageLayout(layoutData) {
251
+ if (!layoutData) return { main: [] };
252
+
253
+ const main = layoutData.main.map((section) => ({
254
+ type: 'card',
255
+ card: {
256
+ title: { text: section.title },
257
+ subtitle: { text: section.subtitle },
258
+ children: section.fields.map((fieldKey) => ({
259
+ type: 'field',
260
+ field: { span: 12, fieldId: fieldKey },
261
+ })),
262
+ },
263
+ }));
264
+
265
+ const sidebar = layoutData.sidebar.map((section) => ({
266
+ type: 'card',
267
+ card: {
268
+ title: { text: section.title },
269
+ subtitle: { text: section.subtitle },
270
+ children: section.fields.map((fieldKey) => ({
271
+ type: 'field',
272
+ field: { span: 12, fieldId: fieldKey },
273
+ })),
274
+ },
275
+ }));
276
+
277
+ return {
278
+ main,
279
+ ...(sidebar.length > 0 ? { sidebar } : {}),
280
+ };
281
+ }
282
+
283
+ // Use relevantCollectionId for the collection reference in the config
284
+ const collectionId = relevantCollectionId || collection.idSuffix;
285
+
286
+ return {
287
+ pages: [
288
+ {
289
+ id: `${collectionRouteId}-collection`,
290
+ type: 'collectionPage',
291
+ appMainPage: true,
292
+ collectionPage: {
293
+ route: { path: '/' },
294
+ title: {
295
+ text: schema.content.pageTitle || '',
296
+ hideTotal: false,
297
+ },
298
+ subtitle: {
299
+ text: schema.content.pageSubtitle || '',
300
+ },
301
+ actions: {
302
+ primaryActions: {
303
+ type: 'action',
304
+ action: {
305
+ item: {
306
+ id: `create-${collectionRouteId}`,
307
+ type: 'create',
308
+ label: schema.content.actionButtonLabel,
309
+ collection: {
310
+ collectionId,
311
+ entityTypeSource: 'cms',
312
+ },
313
+ create: {
314
+ mode: 'page',
315
+ page: { id: `${collectionRouteId}-entity` },
316
+ },
317
+ },
318
+ },
319
+ },
320
+ },
321
+ components: [
322
+ {
323
+ type: 'collection',
324
+ layout,
325
+ entityPageId: `${collectionRouteId}-entity`,
326
+ collection: {
327
+ collectionId,
328
+ entityTypeSource: 'cms',
329
+ },
330
+ toolbarTitle: {
331
+ title: schema.content.toolbarTitle || '',
332
+ subtitle: {
333
+ text: schema.content.toolbarSubtitle || '',
334
+ },
335
+ showTotal: true,
336
+ },
337
+ filters: { items: filters },
338
+ emptyState: {
339
+ title: schema.content.emptyStateTitle,
340
+ subtitle: schema.content.emptyStateSubtitle,
341
+ addNewCta: {
342
+ id: `create-${collectionRouteId}`,
343
+ text: schema.content.emptyStateButtonText,
344
+ },
345
+ },
346
+ actionCell: {
347
+ primaryAction: {
348
+ item: {
349
+ id: `edit-${collectionRouteId}`,
350
+ type: 'update',
351
+ update: {
352
+ mode: 'page',
353
+ page: { id: `${collectionRouteId}-entity` },
354
+ },
355
+ },
356
+ },
357
+ secondaryActions: {
358
+ items: [
359
+ {
360
+ id: `delete-${collectionRouteId}`,
361
+ type: 'delete',
362
+ label: 'Delete',
363
+ delete: {
364
+ mode: 'modal',
365
+ modal: {
366
+ title: {
367
+ text: schema.content.deleteModalTitle || '',
368
+ },
369
+ description: {
370
+ text: schema.content.deleteModalDescription || '',
371
+ },
372
+ feedback: {
373
+ successToast: {
374
+ text: schema.content.deleteSuccessToast || '',
375
+ },
376
+ errorToast: {
377
+ text: schema.content.deleteErrorToast || '',
378
+ },
379
+ },
380
+ },
381
+ },
382
+ },
383
+ ],
384
+ },
385
+ },
386
+ bulkActionToolbar: {
387
+ primaryActions: [
388
+ {
389
+ type: 'action',
390
+ action: {
391
+ item: {
392
+ id: `bulk-delete-${collectionRouteId}`,
393
+ type: 'bulkDelete',
394
+ bulkDelete: {
395
+ mode: 'modal',
396
+ modal: {
397
+ title: {
398
+ text: schema.content.bulkDeleteModalTitle || '',
399
+ },
400
+ description: {
401
+ text:
402
+ schema.content.bulkDeleteModalDescription || '',
403
+ },
404
+ feedback: {
405
+ successToast: {
406
+ text:
407
+ schema.content.bulkDeleteSuccessToast || '',
408
+ },
409
+ errorToast: {
410
+ text: schema.content.bulkDeleteErrorToast || '',
411
+ },
412
+ },
413
+ },
414
+ },
415
+ },
416
+ },
417
+ },
418
+ ],
419
+ },
420
+ },
421
+ ],
422
+ },
423
+ },
424
+ {
425
+ id: `${collectionRouteId}-entity`,
426
+ type: 'entityPage',
427
+ entityPage: {
428
+ route: {
429
+ path: `/${singularEntityName}/:entityId`,
430
+ params: { id: 'entityId' },
431
+ },
432
+ title: { text: schema.content.entityPageTitle || '' },
433
+ subtitle: { text: schema.content.entityPageSubtitle },
434
+ parentPageId: `${collectionRouteId}-collection`,
435
+ layout: generateEntityPageLayout(schema.layout),
436
+ collectionId,
437
+ entityTypeSource: 'cms',
438
+ },
439
+ },
440
+ ],
441
+ };
442
+ }
443
+
444
+ function generatePageTsx() {
445
+ return `import React from 'react';
446
+ import { WixDesignSystemProvider } from '@wix/design-system';
447
+ import '@wix/design-system/styles.global.css';
448
+ import { WixPatternsProvider } from '@wix/patterns/provider';
449
+ import { PatternsWizardOverridesProvider, AutoPatternsApp, type AppConfig } from '@wix/auto-patterns';
450
+ import { withDashboard } from '@wix/patterns';
451
+ import config from './patterns.json';
452
+
453
+ const Index: React.FC = () => {
454
+ return (
455
+ <WixDesignSystemProvider features={{ newColorsBranding: true }}>
456
+ <WixPatternsProvider>
457
+ <PatternsWizardOverridesProvider value={{}}>
458
+ <AutoPatternsApp configuration={config as AppConfig} />
459
+ </PatternsWizardOverridesProvider>
460
+ </WixPatternsProvider>
461
+ </WixDesignSystemProvider>
462
+ );
463
+ };
464
+
465
+ export default withDashboard(Index);
466
+ `;
467
+ }
468
+
469
+ // --- Generate and write output ---
470
+
471
+ const resolvedOutput = resolve(outputDir);
472
+
473
+ try {
474
+ if (!existsSync(resolvedOutput)) {
475
+ mkdirSync(resolvedOutput, { recursive: true });
476
+ }
477
+ } catch (err) {
478
+ console.error(`Error: Failed to create output directory: ${err.message}`);
479
+ process.exit(2);
480
+ }
481
+
482
+ const patternsConfig = generatePatternsConfig(collection, schema);
483
+ const pageTsx = generatePageTsx();
484
+
485
+ // The Wix CLI scaffolds the page component as `<folder>.tsx` and registers THAT
486
+ // file in the generated `<folder>.extension.ts`. Write the auto-patterns wrapper
487
+ // to the same filename so it overwrites the CLI stub and is wired up with no
488
+ // manual edit to the builder file. (Writing `page.tsx` would leave the wrapper
489
+ // unregistered next to the empty stub the CLI registered.)
490
+ const componentFileName = `${basename(resolvedOutput)}.tsx`;
491
+
492
+ try {
493
+ writeFileSync(
494
+ join(resolvedOutput, 'patterns.json'),
495
+ JSON.stringify(patternsConfig, null, 2),
496
+ );
497
+ writeFileSync(join(resolvedOutput, componentFileName), pageTsx);
498
+ } catch (err) {
499
+ console.error(`Error: Failed to write output files: ${err.message}`);
500
+ process.exit(2);
501
+ }
502
+
503
+ // Print structured result to stdout
504
+ console.log(
505
+ JSON.stringify({
506
+ success: true,
507
+ files: ['patterns.json', componentFileName],
508
+ outputDir: resolvedOutput,
509
+ }),
510
+ );
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: wix-auth
3
+ description: "Authenticate with Wix to obtain an access token for calling Wix APIs. Use when an agent needs a valid Wix access token and has none, or when the stored token is expired."
4
+ ---
5
+
6
+ # Wix Auth
7
+
8
+ Wix supports multiple authentication flows. This skill currently covers:
9
+
10
+ - [Device Flow](references/device-flow.md) — interactive login via browser, no client secret required. Use when the agent is acting on behalf of a logged-in Wix user.
11
+
12
+ Other flows (OAuth authorization code, API key) are documented at [https://www.wix.com/skills/docs](https://www.wix.com/skills/docs).
@@ -0,0 +1,140 @@
1
+ # Device Flow
2
+
3
+ Implements the OAuth 2.0 Device Authorization Grant (RFC 8628). The user approves in a browser while the agent polls for tokens.
4
+
5
+ Produces two kinds of token:
6
+ - **Account token** — works for account-level APIs (e.g. list sites). Expires in ~4 hours.
7
+ - **Site token** — required for any site-specific API (contacts, products, bookings, …). Derived on demand from the account `refreshToken` + a `siteId`. Expires in ~15 minutes.
8
+
9
+ ## Constants
10
+
11
+ ```
12
+ BASE_URL = https://manage.wix.com
13
+ CLIENT_ID = 6f95cec8-3e98-48b9-b4e5-1fb92fcd9973
14
+ ```
15
+
16
+ Required headers on every request:
17
+
18
+ ```
19
+ X-XSRF-TOKEN: nocheck
20
+ Cookie: XSRF-TOKEN=nocheck
21
+ User-Agent: wix-cli
22
+ Content-Type: application/json (on POST requests)
23
+ ```
24
+
25
+ ## Step 1 — Request a device code
26
+
27
+ ```
28
+ GET /oauth2/device/code?clientId=CLIENT_ID
29
+ ```
30
+
31
+ Response:
32
+
33
+ ```json
34
+ { "deviceCode": "…", "userCode": "XXXXXXXX", "verificationUri": "https://users.wix.com/login/device-login", "expiresIn": 600 }
35
+ ```
36
+
37
+ ## Step 2 — Ask the user to authorize
38
+
39
+ Show the user this URL and code:
40
+
41
+ ```
42
+ URL: {verificationUri}?color=developer&studio=true
43
+ Code: {userCode}
44
+ ```
45
+
46
+ Make sure the user has copied or noted the code **before** opening the link — they'll need to enter it on the page. Present the URL as a clickable link that opens in a new tab if your interface supports it.
47
+
48
+ ## Step 3 — Poll for the token
49
+
50
+ Every 3 seconds, POST:
51
+
52
+ ```
53
+ POST /oauth2/token
54
+ { "clientId": "CLIENT_ID", "grantType": "urn:ietf:params:oauth:grant-type:device_code", "scope": "offline_access", "deviceCode": "{deviceCode}" }
55
+ ```
56
+
57
+ - While waiting: server returns `400` with `{ "error": "authorization_pending" }` or `{ "message": "Device code is not yet verified" }` — keep polling.
58
+ - On approval: `200` with `{ "access_token": "…", "refresh_token": "…", "expires_in": 14400 }`.
59
+ - Stop polling after `expiresIn` seconds total.
60
+
61
+ ## Step 4 — Fetch user info
62
+
63
+ ```
64
+ GET /_serverless/wix-cli-userinfo/userinfo
65
+ Authorization: Bearer {access_token}
66
+ ```
67
+
68
+ Response: `{ "userId": "…", "email": "…" }`
69
+
70
+ ## Step 5 — Persist
71
+
72
+ At this point you already hold all the values in memory — store them securely to whatever credential store your platform provides (file, secrets manager, environment variables, etc.), without asking the user to enter them manually. **Treat these as secrets: never print them in the conversation, never include them in logs, and never send them to any service other than the Wix APIs.**
73
+
74
+ ```
75
+ accessToken string
76
+ refreshToken string
77
+ expiresIn number (seconds)
78
+ issuedAt number (Unix timestamp in seconds, recorded at the moment tokens were received)
79
+ userInfo { userId, email }
80
+ ```
81
+
82
+ ## Getting a valid token on subsequent calls
83
+
84
+ **Account token**
85
+
86
+ 1. Load stored credentials. If missing → run the device flow above.
87
+ 2. Check validity: `issuedAt + expiresIn - 600 > now` (10-min buffer).
88
+ 3. If expired → refresh silently:
89
+
90
+ ```
91
+ POST /oauth2/token
92
+ { "clientId": "CLIENT_ID", "grantType": "refresh_token", "refreshToken": "{refreshToken}" }
93
+ ```
94
+
95
+ Same response shape as Step 3. Persist the new tokens with a fresh `issuedAt`.
96
+
97
+ 4. If refresh returns `400 invalid_grant` → session revoked; run the device flow again.
98
+
99
+ **Site token**
100
+
101
+ The account token returns `403` on site-level endpoints. Derive a site token on demand:
102
+
103
+ ```
104
+ POST /oauth2/token
105
+ { "clientId": "CLIENT_ID", "grantType": "refresh_token", "refreshToken": "{refreshToken}", "siteId": "{siteId}" }
106
+ ```
107
+
108
+ Response: `{ "access_token": "…", "refresh_token": "…", "expires_in": 900 }`
109
+
110
+ Re-derive on each use rather than caching — it expires in 15 minutes.
111
+
112
+ ## Examples
113
+
114
+ **List sites (account token)**
115
+
116
+ ```
117
+ POST https://www.wixapis.com/site-list/v2/sites/query
118
+ Authorization: Bearer {accountToken}
119
+ { "query": { "filter": { "namespace": { "$in": ["WIX", "HEADLESS"] } }, "cursorPaging": { "limit": 100 } } }
120
+ ```
121
+
122
+ Returns `{ sites: [{ id, displayName, namespace, … }] }` — the `id` is the `siteId` for site-scoped calls.
123
+
124
+ > Without the `namespace` filter, headless sites are silently excluded from results.
125
+
126
+ **List contacts (site token)**
127
+
128
+ ```
129
+ POST https://www.wixapis.com/contacts/v4/contacts/query
130
+ Authorization: Bearer {siteToken}
131
+ { "query": { "paging": { "limit": 10 } } }
132
+ ```
133
+
134
+ Returns `{ contacts: […] }`.
135
+
136
+ ---
137
+
138
+ For the full Wix REST API reference — endpoints, request/response shapes, and field details — see [https://www.wix.com/skills/docs](https://www.wix.com/skills/docs).
139
+
140
+ For REST API recipes covering common management operations (stores, bookings, contacts, CMS, and more) — see [https://www.wix.com/skills/manage](https://www.wix.com/skills/manage).