@wix/agent-skills 1.21.0 → 1.23.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 (269) hide show
  1. package/package.json +1 -1
  2. package/skills/wix-app/SKILL.md +71 -7
  3. package/skills/wix-app/references/APP_VALIDATION.md +16 -10
  4. package/skills/wix-app/references/DASHBOARD_PAGE.md +11 -25
  5. package/skills/wix-app/references/DATA_COLLECTION.md +16 -219
  6. package/skills/wix-app/references/SDK_MODULE_MAP.md +2 -0
  7. package/skills/wix-app/references/dashboard-page/DATA_SOURCES.md +182 -0
  8. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE.md +97 -0
  9. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_COLLECTION.md +184 -0
  10. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_ROUTER.md +203 -0
  11. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_SETTINGS.md +44 -0
  12. package/skills/wix-app/references/dashboard-page/QUERY_AND_PAGING.md +182 -0
  13. package/skills/wix-app/references/dashboard-page/TABLE_STATE.md +133 -0
  14. package/skills/wix-app/references/dashboard-page/UX_SUCCESS_MODEL.md +10 -5
  15. package/skills/wix-app/references/data-collection/LIFECYCLE.md +68 -0
  16. package/skills/wix-app/references/data-collection/PERMISSIONS.md +47 -0
  17. package/skills/wix-app/references/data-collection/SCHEMA.md +181 -0
  18. package/skills/wix-app/references/data-collection/WIX_DATA.md +38 -66
  19. package/skills/wix-headless-fast/SKILL.md +95 -230
  20. package/skills/wix-headless-fast/cold-start/bootstrap.mjs +156 -0
  21. package/skills/wix-headless-fast/{entry/skill.md → cold-start/cold-start.md} +17 -14
  22. package/skills/wix-headless-fast/guides/existing-site.md +78 -0
  23. package/skills/wix-headless-fast/guides/migration.md +43 -0
  24. package/skills/wix-headless-fast/guides/reference-mode.md +100 -0
  25. package/skills/wix-headless-fast/install/AGENTS.md +9 -4
  26. package/skills/wix-headless-fast/install/agents-md.mjs +5 -1
  27. package/skills/wix-headless-fast/install/attach.mjs +25 -47
  28. package/skills/wix-headless-fast/install/check.mjs +87 -0
  29. package/skills/wix-headless-fast/install/context.mjs +126 -0
  30. package/skills/wix-headless-fast/install/deploy.mjs +106 -80
  31. package/skills/wix-headless-fast/install/lock.mjs +55 -0
  32. package/skills/wix-headless-fast/install/setup.mjs +83 -23
  33. package/skills/wix-headless-fast/install/templates.mjs +168 -0
  34. package/skills/wix-manage/SKILL.md +3 -3
  35. package/skills/wix-manage/references/app-installation/install-wix-apps.md +68 -2
  36. package/skills/wix-manage/references/contacts/bulk-label-and-unlabel-contacts.md +37 -4
  37. package/skills/wix-manage/references/ecommerce/ecom-pricing.md +29 -3
  38. package/skills/wix-manage/references/google-ads/google-ads-dashboard-navigation.md +27 -0
  39. package/skills/wix-manage/references/google-ads/manage-campaign-success-guide.md +83 -37
  40. package/skills/wix-manage/references/sites/site-import.md +101 -37
  41. package/skills/wix-headless-fast/references/blog/INSTRUCTIONS.md +0 -303
  42. package/skills/wix-headless-fast/references/blog/app/components/blog/BlogFeedView.tsx +0 -136
  43. package/skills/wix-headless-fast/references/blog/app/components/blog/PostView.tsx +0 -112
  44. package/skills/wix-headless-fast/references/blog/app/components/blog/RichContent.tsx +0 -42
  45. package/skills/wix-headless-fast/references/blog/app/hooks/blog/useBlogFeed.ts +0 -31
  46. package/skills/wix-headless-fast/references/blog/app/hooks/blog/usePost.ts +0 -22
  47. package/skills/wix-headless-fast/references/blog/app/wix/blog/blog-feed-store.ts +0 -137
  48. package/skills/wix-headless-fast/references/blog/app/wix/blog/post-store.ts +0 -78
  49. package/skills/wix-headless-fast/references/blog/app/wix/blog/posts-core.ts +0 -117
  50. package/skills/wix-headless-fast/references/blog/app/wix/blog/posts.ts +0 -52
  51. package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy-core.ts +0 -47
  52. package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy.ts +0 -58
  53. package/skills/wix-headless-fast/references/blog/app/wix/blog/types.ts +0 -62
  54. package/skills/wix-headless-fast/references/blog/app-astro/layouts/SiteLayout.astro +0 -40
  55. package/skills/wix-headless-fast/references/blog/app-astro/pages/blog/[...slug].astro +0 -97
  56. package/skills/wix-headless-fast/references/blog/app-astro/pages/blog.astro +0 -24
  57. package/skills/wix-headless-fast/references/blog/lock/astro/package-lock.json +0 -16156
  58. package/skills/wix-headless-fast/references/blog/rest/posts.ts +0 -42
  59. package/skills/wix-headless-fast/references/blog/rest/taxonomy.ts +0 -62
  60. package/skills/wix-headless-fast/references/blog/seed/SEED.md +0 -81
  61. package/skills/wix-headless-fast/references/blog/seed/read-site.mjs +0 -22
  62. package/skills/wix-headless-fast/references/blog/seed/seed-blog.mjs +0 -287
  63. package/skills/wix-headless-fast/references/bookings/INSTRUCTIONS.md +0 -277
  64. package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServiceBookingView.tsx +0 -144
  65. package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServicesView.tsx +0 -119
  66. package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useBookingFlow.ts +0 -32
  67. package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useServices.ts +0 -23
  68. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-core.ts +0 -218
  69. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-flow-store.ts +0 -169
  70. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking.ts +0 -121
  71. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-core.ts +0 -92
  72. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-store.ts +0 -90
  73. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services.ts +0 -57
  74. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/types.ts +0 -72
  75. package/skills/wix-headless-fast/references/bookings/app-astro/layouts/SiteLayout.astro +0 -40
  76. package/skills/wix-headless-fast/references/bookings/app-astro/pages/services/[slug].astro +0 -76
  77. package/skills/wix-headless-fast/references/bookings/app-astro/pages/services.astro +0 -22
  78. package/skills/wix-headless-fast/references/bookings/lock/astro/package-lock.json +0 -11962
  79. package/skills/wix-headless-fast/references/bookings/rest/booking.ts +0 -113
  80. package/skills/wix-headless-fast/references/bookings/rest/services.ts +0 -55
  81. package/skills/wix-headless-fast/references/bookings/seed/SEED.md +0 -71
  82. package/skills/wix-headless-fast/references/bookings/seed/read-site.mjs +0 -28
  83. package/skills/wix-headless-fast/references/bookings/seed/seed-bookings.mjs +0 -302
  84. package/skills/wix-headless-fast/references/cms/INSTRUCTIONS.md +0 -355
  85. package/skills/wix-headless-fast/references/cms/app/hooks/cms/useCollection.ts +0 -50
  86. package/skills/wix-headless-fast/references/cms/app/hooks/cms/useItem.ts +0 -37
  87. package/skills/wix-headless-fast/references/cms/app/wix/cms/collection-store.ts +0 -158
  88. package/skills/wix-headless-fast/references/cms/app/wix/cms/item-store.ts +0 -93
  89. package/skills/wix-headless-fast/references/cms/app/wix/cms/items-core.ts +0 -177
  90. package/skills/wix-headless-fast/references/cms/app/wix/cms/items.ts +0 -123
  91. package/skills/wix-headless-fast/references/cms/app/wix/cms/types.ts +0 -75
  92. package/skills/wix-headless-fast/references/cms/app-astro/layouts/SiteLayout.astro +0 -41
  93. package/skills/wix-headless-fast/references/cms/lock/astro/package-lock.json +0 -11262
  94. package/skills/wix-headless-fast/references/cms/rest/items.ts +0 -125
  95. package/skills/wix-headless-fast/references/cms/seed/SEED.md +0 -112
  96. package/skills/wix-headless-fast/references/cms/seed/read-site.mjs +0 -20
  97. package/skills/wix-headless-fast/references/cms/seed/seed-cms.mjs +0 -324
  98. package/skills/wix-headless-fast/references/events/INSTRUCTIONS.md +0 -307
  99. package/skills/wix-headless-fast/references/events/app/components/events/EventConfirmationView.tsx +0 -66
  100. package/skills/wix-headless-fast/references/events/app/components/events/EventRegistrationView.tsx +0 -178
  101. package/skills/wix-headless-fast/references/events/app/components/events/EventsView.tsx +0 -118
  102. package/skills/wix-headless-fast/references/events/app/hooks/events/useEventRegistration.ts +0 -35
  103. package/skills/wix-headless-fast/references/events/app/hooks/events/useEvents.ts +0 -24
  104. package/skills/wix-headless-fast/references/events/app/wix/events/events-core.ts +0 -130
  105. package/skills/wix-headless-fast/references/events/app/wix/events/events-store.ts +0 -97
  106. package/skills/wix-headless-fast/references/events/app/wix/events/events.ts +0 -55
  107. package/skills/wix-headless-fast/references/events/app/wix/events/registration-core.ts +0 -113
  108. package/skills/wix-headless-fast/references/events/app/wix/events/registration-store.ts +0 -156
  109. package/skills/wix-headless-fast/references/events/app/wix/events/registration.ts +0 -97
  110. package/skills/wix-headless-fast/references/events/app/wix/events/types.ts +0 -61
  111. package/skills/wix-headless-fast/references/events/app-astro/layouts/SiteLayout.astro +0 -40
  112. package/skills/wix-headless-fast/references/events/app-astro/pages/event-confirmation.astro +0 -12
  113. package/skills/wix-headless-fast/references/events/app-astro/pages/events/[slug].astro +0 -80
  114. package/skills/wix-headless-fast/references/events/app-astro/pages/events.astro +0 -21
  115. package/skills/wix-headless-fast/references/events/lock/astro/package-lock.json +0 -11884
  116. package/skills/wix-headless-fast/references/events/rest/events.ts +0 -57
  117. package/skills/wix-headless-fast/references/events/rest/registration.ts +0 -83
  118. package/skills/wix-headless-fast/references/events/seed/SEED.md +0 -95
  119. package/skills/wix-headless-fast/references/events/seed/read-site.mjs +0 -26
  120. package/skills/wix-headless-fast/references/events/seed/seed-events.mjs +0 -276
  121. package/skills/wix-headless-fast/references/forms/INSTRUCTIONS.md +0 -340
  122. package/skills/wix-headless-fast/references/forms/app/hooks/forms/useWixForm.ts +0 -85
  123. package/skills/wix-headless-fast/references/forms/app/wix/forms/form-store.ts +0 -332
  124. package/skills/wix-headless-fast/references/forms/app/wix/forms/forms-core.ts +0 -238
  125. package/skills/wix-headless-fast/references/forms/app/wix/forms/forms.ts +0 -54
  126. package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions-core.ts +0 -216
  127. package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions.ts +0 -59
  128. package/skills/wix-headless-fast/references/forms/app/wix/forms/types.ts +0 -135
  129. package/skills/wix-headless-fast/references/forms/lock/astro/package-lock.json +0 -10593
  130. package/skills/wix-headless-fast/references/forms/rest/forms.ts +0 -34
  131. package/skills/wix-headless-fast/references/forms/rest/submissions.ts +0 -56
  132. package/skills/wix-headless-fast/references/forms/seed/SEED.md +0 -116
  133. package/skills/wix-headless-fast/references/forms/seed/read-site.mjs +0 -20
  134. package/skills/wix-headless-fast/references/forms/seed/seed-forms.mjs +0 -327
  135. package/skills/wix-headless-fast/references/members/INSTRUCTIONS.md +0 -316
  136. package/skills/wix-headless-fast/references/members/app/components/members/AccountView.tsx +0 -60
  137. package/skills/wix-headless-fast/references/members/app/components/members/LoginForm.tsx +0 -155
  138. package/skills/wix-headless-fast/references/members/app/components/members/MemberMenu.tsx +0 -78
  139. package/skills/wix-headless-fast/references/members/app/components/members/RequireAuth.tsx +0 -47
  140. package/skills/wix-headless-fast/references/members/app/hooks/members/useMember.ts +0 -66
  141. package/skills/wix-headless-fast/references/members/app/wix/members/auth-core.ts +0 -105
  142. package/skills/wix-headless-fast/references/members/app/wix/members/auth.ts +0 -59
  143. package/skills/wix-headless-fast/references/members/app/wix/members/client.ts +0 -53
  144. package/skills/wix-headless-fast/references/members/app/wix/members/member-store.ts +0 -122
  145. package/skills/wix-headless-fast/references/members/app/wix/members/members-core.ts +0 -43
  146. package/skills/wix-headless-fast/references/members/app/wix/members/members.ts +0 -29
  147. package/skills/wix-headless-fast/references/members/app/wix/members/types.ts +0 -21
  148. package/skills/wix-headless-fast/references/members/app-astro/layouts/SiteLayout.astro +0 -42
  149. package/skills/wix-headless-fast/references/members/app-astro/pages/account.astro +0 -10
  150. package/skills/wix-headless-fast/references/members/app-astro/pages/login.astro +0 -11
  151. package/skills/wix-headless-fast/references/members/lock/astro/package-lock.json +0 -10329
  152. package/skills/wix-headless-fast/references/members/rest/auth.ts +0 -215
  153. package/skills/wix-headless-fast/references/members/rest/members.ts +0 -26
  154. package/skills/wix-headless-fast/references/members/seed/SEED.md +0 -39
  155. package/skills/wix-headless-fast/references/members/seed/read-site.mjs +0 -15
  156. package/skills/wix-headless-fast/references/members/seed/seed-members.mjs +0 -94
  157. package/skills/wix-headless-fast/references/portfolio/INSTRUCTIONS.md +0 -315
  158. package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionProjectsView.tsx +0 -110
  159. package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionsView.tsx +0 -90
  160. package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/GalleryMedia.tsx +0 -35
  161. package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/ProjectDetailView.tsx +0 -85
  162. package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollectionProjects.ts +0 -32
  163. package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollections.ts +0 -21
  164. package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useProjectDetail.ts +0 -31
  165. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collection-projects-store.ts +0 -82
  166. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collections-store.ts +0 -58
  167. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio-core.ts +0 -177
  168. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio.ts +0 -78
  169. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/project-detail-store.ts +0 -81
  170. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/types.ts +0 -55
  171. package/skills/wix-headless-fast/references/portfolio/app-astro/layouts/SiteLayout.astro +0 -40
  172. package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio/[slug].astro +0 -30
  173. package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio.astro +0 -21
  174. package/skills/wix-headless-fast/references/portfolio/app-astro/pages/projects/[slug].astro +0 -29
  175. package/skills/wix-headless-fast/references/portfolio/lock/astro/package-lock.json +0 -10197
  176. package/skills/wix-headless-fast/references/portfolio/rest/portfolio.ts +0 -75
  177. package/skills/wix-headless-fast/references/portfolio/seed/SEED.md +0 -86
  178. package/skills/wix-headless-fast/references/portfolio/seed/read-site.mjs +0 -20
  179. package/skills/wix-headless-fast/references/portfolio/seed/seed-portfolio.mjs +0 -256
  180. package/skills/wix-headless-fast/references/pricing-plans/INSTRUCTIONS.md +0 -296
  181. package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlanDetailView.tsx +0 -47
  182. package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlansView.tsx +0 -101
  183. package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/SubscribeButton.tsx +0 -41
  184. package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlanPurchase.ts +0 -16
  185. package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlans.ts +0 -22
  186. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plan-purchase-store.ts +0 -54
  187. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-core.ts +0 -106
  188. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-store.ts +0 -64
  189. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans.ts +0 -27
  190. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase-core.ts +0 -43
  191. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase.ts +0 -22
  192. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/types.ts +0 -30
  193. package/skills/wix-headless-fast/references/pricing-plans/app-astro/layouts/SiteLayout.astro +0 -41
  194. package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans/[slug].astro +0 -40
  195. package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans.astro +0 -21
  196. package/skills/wix-headless-fast/references/pricing-plans/lock/astro/package-lock.json +0 -11226
  197. package/skills/wix-headless-fast/references/pricing-plans/rest/plans.ts +0 -31
  198. package/skills/wix-headless-fast/references/pricing-plans/rest/purchase.ts +0 -20
  199. package/skills/wix-headless-fast/references/pricing-plans/seed/SEED.md +0 -79
  200. package/skills/wix-headless-fast/references/pricing-plans/seed/read-site.mjs +0 -21
  201. package/skills/wix-headless-fast/references/pricing-plans/seed/seed-pricing-plans.mjs +0 -279
  202. package/skills/wix-headless-fast/references/restaurants/INSTRUCTIONS.md +0 -360
  203. package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/MenuView.tsx +0 -142
  204. package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartButton.tsx +0 -26
  205. package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartDrawer.tsx +0 -121
  206. package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/ReservationView.tsx +0 -155
  207. package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useMenus.ts +0 -34
  208. package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useOrderCart.ts +0 -43
  209. package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useReservation.ts +0 -34
  210. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-core.ts +0 -155
  211. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-store.ts +0 -89
  212. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu.ts +0 -71
  213. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/order-store.ts +0 -103
  214. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering-core.ts +0 -124
  215. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering.ts +0 -185
  216. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservation-store.ts +0 -193
  217. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations-core.ts +0 -94
  218. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations.ts +0 -74
  219. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/types.ts +0 -168
  220. package/skills/wix-headless-fast/references/restaurants/app-astro/layouts/SiteLayout.astro +0 -47
  221. package/skills/wix-headless-fast/references/restaurants/app-astro/pages/menu.astro +0 -22
  222. package/skills/wix-headless-fast/references/restaurants/app-astro/pages/reservations.astro +0 -12
  223. package/skills/wix-headless-fast/references/restaurants/lock/astro/package-lock.json +0 -12560
  224. package/skills/wix-headless-fast/references/restaurants/rest/menu.ts +0 -60
  225. package/skills/wix-headless-fast/references/restaurants/rest/ordering.ts +0 -169
  226. package/skills/wix-headless-fast/references/restaurants/rest/reservations.ts +0 -68
  227. package/skills/wix-headless-fast/references/restaurants/seed/SEED.md +0 -89
  228. package/skills/wix-headless-fast/references/restaurants/seed/read-site.mjs +0 -25
  229. package/skills/wix-headless-fast/references/restaurants/seed/seed-restaurants.mjs +0 -499
  230. package/skills/wix-headless-fast/references/shared/CONTENT.md +0 -22
  231. package/skills/wix-headless-fast/references/shared/CUSTOM_OPERATIONS.md +0 -73
  232. package/skills/wix-headless-fast/references/shared/DESIGN.md +0 -26
  233. package/skills/wix-headless-fast/references/shared/SUPPLIED-CONTENT.md +0 -23
  234. package/skills/wix-headless-fast/references/shared/app/styles/global.css +0 -52
  235. package/skills/wix-headless-fast/references/shared/app/wix/config.ts +0 -15
  236. package/skills/wix-headless-fast/references/shared/app/wix/media.ts +0 -81
  237. package/skills/wix-headless-fast/references/shared/app/wix/money.ts +0 -24
  238. package/skills/wix-headless-fast/references/shared/app/wix/sdk.ts +0 -89
  239. package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app/wix/media-upload/client.ts +0 -46
  240. package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app-astro/pages/api/wix/media-upload.ts +0 -46
  241. package/skills/wix-headless-fast/references/shared/rest/client.ts +0 -155
  242. package/skills/wix-headless-fast/references/shared/rest/config.ts +0 -3
  243. package/skills/wix-headless-fast/references/shared/rest/media.ts +0 -65
  244. package/skills/wix-headless-fast/references/shared/seed/images.mjs +0 -145
  245. package/skills/wix-headless-fast/references/shared/seed/read-site.mjs +0 -99
  246. package/skills/wix-headless-fast/references/storefront/INSTRUCTIONS.md +0 -612
  247. package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartButton.tsx +0 -26
  248. package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartDrawer.tsx +0 -155
  249. package/skills/wix-headless-fast/references/storefront/app/components/storefront/FilterPanel.tsx +0 -266
  250. package/skills/wix-headless-fast/references/storefront/app/components/storefront/OptionPicker.tsx +0 -95
  251. package/skills/wix-headless-fast/references/storefront/app/components/storefront/QuickAdd.tsx +0 -136
  252. package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useCart.ts +0 -48
  253. package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useProductDetail.ts +0 -39
  254. package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useShop.ts +0 -34
  255. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-core.ts +0 -121
  256. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-store.ts +0 -107
  257. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart.ts +0 -138
  258. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog-core.ts +0 -314
  259. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog.ts +0 -133
  260. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/product-detail-store.ts +0 -147
  261. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/shop-store.ts +0 -289
  262. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/types.ts +0 -169
  263. package/skills/wix-headless-fast/references/storefront/app-astro/layouts/SiteLayout.astro +0 -65
  264. package/skills/wix-headless-fast/references/storefront/lock/astro/package-lock.json +0 -12247
  265. package/skills/wix-headless-fast/references/storefront/rest/cart.ts +0 -132
  266. package/skills/wix-headless-fast/references/storefront/rest/catalog.ts +0 -123
  267. package/skills/wix-headless-fast/references/storefront/seed/SEED.md +0 -130
  268. package/skills/wix-headless-fast/references/storefront/seed/read-site.mjs +0 -38
  269. package/skills/wix-headless-fast/references/storefront/seed/seed-store.mjs +0 -561
@@ -1,75 +0,0 @@
1
- // Portfolio reads over REST — the twin of app/wix/portfolio/portfolio.ts. Same exports, same DTOs;
2
- // the rules and mappers come from portfolio-core (the SAME file the SDK transport uses, deployed
3
- // flat next to this one by deploy.mjs --stack static), so this file is only the transport: one
4
- // fetch with a literal URL and body per function. Every call here is a public read, safe from a
5
- // browser with a visitor token. Porting: keep the paths, keep the bodies, port the core once.
6
- // docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/collections/list-collections.md
7
- // docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/collections/query-collections.md
8
- // docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/projects/list-projects.md
9
- // docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/projects/query-projects.md
10
- // docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/project-items/list-project-items.md
11
- import { wixRequest } from "./client.js";
12
- import { imgSrc } from "./media.js";
13
- import {
14
- galleryItems,
15
- visibleCollection,
16
- visibleCollections,
17
- visibleProject,
18
- visibleProjects,
19
- type Raw,
20
- type VideoSrc,
21
- } from "./portfolio-core.js";
22
- import type { CollectionSummary, GalleryItem, ProjectDetail, ProjectSummary } from "./types.js";
23
-
24
- // REST never returns the bare wix:video:// string — videoInfo arrives as { resolutions, posters },
25
- // which the core reads directly. A string here has no resolver on this transport → dropped.
26
- const videoSrc: VideoSrc = () => null;
27
-
28
- /** Visible collections in dashboard order. GET /portfolio/v1/collections?paging.limit=N → { collections } */
29
- export async function fetchCollections({ limit = 100 } = {}): Promise<CollectionSummary[]> {
30
- const res = await wixRequest<Raw>("/portfolio/v1/collections", { method: "GET", query: { "paging.limit": String(limit) } });
31
- return visibleCollections((res?.collections ?? []) as Raw[], imgSrc);
32
- }
33
-
34
- /**
35
- * One visible collection by URL slug; null when missing or hidden → a real 404.
36
- * POST /portfolio/v1/collections/query { query: { filter: { slug }, cursorPaging: { limit: 1 } } } → { collections }
37
- */
38
- export async function fetchCollectionBySlug(slug: string): Promise<CollectionSummary | null> {
39
- const res = await wixRequest<Raw>("/portfolio/v1/collections/query", {
40
- body: { query: { filter: { slug }, cursorPaging: { limit: 1 } } },
41
- });
42
- return visibleCollection(res?.collections?.[0] as Raw | undefined, imgSrc);
43
- }
44
-
45
- /** Visible projects in list order, optionally one collection's. GET /portfolio/v1/projects?paging.limit=N → { projects } */
46
- export async function fetchProjects({
47
- collectionId,
48
- limit = 100,
49
- }: { collectionId?: string; limit?: number } = {}): Promise<ProjectSummary[]> {
50
- const res = await wixRequest<Raw>("/portfolio/v1/projects", { method: "GET", query: { "paging.limit": String(limit) } });
51
- return visibleProjects((res?.projects ?? []) as Raw[], collectionId, imgSrc, videoSrc);
52
- }
53
-
54
- /**
55
- * One visible project with its details rows by URL slug; null when missing or hidden.
56
- * POST /portfolio/v1/projects/query { query: { filter: { slug }, cursorPaging: { limit: 1 } } } → { projects }
57
- */
58
- export async function fetchProjectBySlug(slug: string): Promise<ProjectDetail | null> {
59
- const res = await wixRequest<Raw>("/portfolio/v1/projects/query", {
60
- body: { query: { filter: { slug }, cursorPaging: { limit: 1 } } },
61
- });
62
- return visibleProject(res?.projects?.[0] as Raw | undefined, imgSrc, videoSrc);
63
- }
64
-
65
- /**
66
- * A project's gallery in dashboard order; IMAGE and VIDEO items only.
67
- * GET /portfolio/v1/projectItems/{projectId}/items?paging.limit=100 → { items }
68
- */
69
- export async function fetchProjectGallery(projectId: string): Promise<GalleryItem[]> {
70
- const res = await wixRequest<Raw>(`/portfolio/v1/projectItems/${encodeURIComponent(projectId)}/items`, {
71
- method: "GET",
72
- query: { "paging.limit": "100" },
73
- });
74
- return galleryItems((res?.items ?? []) as Raw[], imgSrc, videoSrc);
75
- }
@@ -1,86 +0,0 @@
1
- # Portfolio — seeding
2
-
3
- Seed by **running `seed-portfolio.mjs` with a plan file** — don't hand-write the REST calls.
4
- The script mints its own site token via the Wix CLI (logged-in session + `wix.config.json`
5
- required), installs the Portfolio app if needed, and creates everything in the right order:
6
- collections first (a project's `collectionIds` are NOT validated — a wrong id silently
7
- orphans the project), then projects, gallery items, and covers.
8
-
9
- ```bash
10
- # from the project root (where wix.config.json lives):
11
- node <SKILL_ROOT>/references/portfolio/seed/seed-portfolio.mjs plan.json
12
- ```
13
-
14
- `plan.json` is plain data — write it from the brief. **Default to 2 collections × 2 projects
15
- each** (the seed shows the shape; the owner adds the rest in the dashboard) and make them
16
- exercise the UI: every collection and project gets a cover, every project gets 2–3 gallery
17
- `items` (a portfolio without images looks broken), and a couple of projects get `details`
18
- rows (Role, Year, Client…).
19
-
20
- ```json
21
- {
22
- "collections": [
23
- { "title": "Brand Identity", "description": "Logo systems and visual identities.",
24
- "coverImageUrl": "https://…" },
25
- { "title": "Editorial", "description": "Print and digital editorial design.",
26
- "coverImageUrl": "https://…" }
27
- ],
28
- "projects": [
29
- { "title": "Northwind Rebrand", "description": "Full identity refresh for a logistics firm.",
30
- "collection": "Brand Identity",
31
- "details": [ { "label": "Role", "text": "Brand & Art Direction" }, { "label": "Year", "text": "2025" } ],
32
- "coverImageUrl": "https://…",
33
- "items": [
34
- { "sortOrder": 1, "title": "Logo system", "imageUrl": "https://…" },
35
- { "sortOrder": 2, "title": "Stationery", "imageUrl": "https://…" }
36
- ] },
37
- { "title": "Harbor Coffee", "description": "Packaging and label suite.",
38
- "collection": "Brand Identity", "coverImageUrl": "https://…",
39
- "items": [ { "sortOrder": 1, "title": "Label set", "imageUrl": "https://…" } ] },
40
- { "title": "Field Notes Quarterly", "description": "Magazine layout and typography.",
41
- "collection": "Editorial", "coverImageUrl": "https://…",
42
- "items": [ { "sortOrder": 1, "title": "Spread", "imageUrl": "https://…" } ] },
43
- { "title": "City Guides", "description": "Travel series covers.",
44
- "collection": "Editorial", "coverImageUrl": "https://…",
45
- "items": [ { "sortOrder": 1, "title": "Covers", "imageUrl": "https://…" } ] }
46
- ]
47
- }
48
- ```
49
-
50
- - `collection` — a collection **title from this plan**; resolved to its created id. A project
51
- without one belongs to no collection (reachable only from an all-projects list).
52
- - `details` — optional `[{ label, text }]` rows; render on the project page. Omit for none.
53
- - Every image field's default is a prompt (`coverImagePrompt` / `items[].imagePrompt` —
54
- AI-generated, ~1 Wix AI credit per image, account-billed): brand-contextual — subject,
55
- aesthetic/mood, palette, lighting — always ending "no text, no watermarks". At least one image in the set shows the real subject of the business — the actual product/space/service, not abstract decoration. For an asset the user actually supplied
56
- use a path (`coverImagePath` / `items[].imagePath` — a file on this machine, uploaded to
57
- Wix Media) or a url (`coverImageUrl` / `items[].imageUrl` — their own hosted URL; verify it
58
- with `curl -sI` → 200) — never a stock-photo or guessed URL. All images —
59
- covers and gallery items alike — resolve in one parallel wave and never block the seed; a
60
- failed image skips just that item/cover. The **cover** is the
61
- listing thumbnail; **items** are the detail-page gallery — separate entities, both wanted.
62
- If a project has only a cover, reuse its url as item 1 so the gallery isn't empty.
63
- - `sortOrder` (1, 2, 3…) sets the gallery render order.
64
- - `hidden` defaults to shown — omit it; send `hidden: true` only to hide an entity.
65
- - Gallery items seed as images only; the owner adds videos in the dashboard.
66
- - A fresh Portfolio install ships sample content ("My Portfolio" + sample projects). **Seeding
67
- is additive — never delete or overwrite existing content**; if removing the samples seems
68
- wanted, ask the owner first.
69
-
70
- ## Supplied content
71
-
72
- The general rules are in `references/shared/SUPPLIED-CONTENT.md`. For a portfolio, each project the
73
- user lists is one entry. Its title becomes `title`; its category or series becomes `collection`
74
- (and joins the `collections` list); client, role, year and similar facts become `details`; their
75
- cover image becomes `coverImageUrl`; their project images become `items` in the order given. A
76
- photo with no caption gets its file name as `title`.
77
-
78
- ## Escape hatch — individual functions
79
- `setupPortfolio` composes exported steps — `installPortfolioApp`, `createCollections`,
80
- `createProjects`, `importImage`, `attachProjectCovers`, `attachCollectionCovers`,
81
- `createProjectItems`, `listCollections`, `listProjects`, plus `makeCtx()` — import them only
82
- for a partial re-seed.
83
-
84
- ## Reference
85
- Unexpected shape or an uncovered operation → read the live Wix API reference; the
86
- authoritative source recipe is `wix-headless/references/inline-recipes/setup-portfolio.md`.
@@ -1,20 +0,0 @@
1
- // What the portfolio holds: collections and projects.
2
- // node <SKILL_ROOT>/references/portfolio/seed/read-site.mjs [--site <siteId>] [--limit <n>]
3
- import { runReader } from "../../shared/seed/read-site.mjs";
4
-
5
- const PORTFOLIO_APP_ID = "d90652a2-f5a1-4c7c-84c4-d4cdcc41f130";
6
- const D = "https://dev.wix.com/docs/api-reference/business-solutions/portfolio";
7
-
8
- await runReader({
9
- vertical: "portfolio",
10
- appId: PORTFOLIO_APP_ID,
11
- async read(api, { limit }) {
12
- const cols = await api.call({ method: "GET", path: "/portfolio/v1/collections", docs: `${D}/collections/list-collections` });
13
- const projs = await api.tryCall({ method: "GET", path: "/portfolio/v1/projects", docs: `${D}/projects/list-projects` });
14
- return {
15
- collections: (cols.collections ?? []).map((c) => ({ id: c.id, title: c.title, slug: c.slug, hidden: c.hidden ?? false, cover: !!c.coverImage })),
16
- projectCount: (projs?.projects ?? []).length,
17
- projects: (projs?.projects ?? []).slice(0, limit).map((p) => ({ title: p.title, slug: p.slug, hidden: p.hidden ?? false, collections: (p.collectionIds ?? []).length, cover: !!p.coverImage })),
18
- };
19
- },
20
- });
@@ -1,256 +0,0 @@
1
- // Portfolio seed — a BUILD-TIME script, never shipped in the app. Run from the project root
2
- // (where wix.config.json lives) with a plan file:
3
- //
4
- // node <SKILL_ROOT>/references/portfolio/seed/seed-portfolio.mjs plan.json
5
- //
6
- // It mints its own site token via the Wix CLI, installs the Wix Portfolio app if needed,
7
- // creates collections then projects (collections FIRST — a project's collectionIds are NOT
8
- // validated, so a wrong id is silently accepted and orphans the project), creates each
9
- // project's gallery items, and imports+attaches cover images. Prints a JSON result to stdout.
10
- //
11
- // Plan shape (see SEED.md):
12
- // { "collections": [{ "title", "description"?, "hidden"?, "coverImageUrl"? | "coverImagePrompt"? }],
13
- // "projects": [{ "title", "description"?, "hidden"?,
14
- // "collection"? (title), // resolved to that collection's id
15
- // "details"?: [{ "label", "text" }],
16
- // "coverImageUrl"? | "coverImagePrompt"?,
17
- // "items"?: [{ "sortOrder", "title"?, "imageUrl" | "imagePrompt" }] }] }
18
- //
19
- // Seeding is ADDITIVE — never deletes or overwrites existing content. A fresh Portfolio
20
- // install ships its own sample content ("My Portfolio" + sample projects); removing it is the
21
- // owner's call, not this script's. Unexpected shapes → read the live API reference;
22
- // authoritative source recipe: wix-headless/references/inline-recipes/setup-portfolio.md.
23
- import { execFileSync } from "node:child_process";
24
- import { readFileSync } from "node:fs";
25
- import { resolveItemImages } from "../../shared/seed/images.mjs";
26
-
27
- const API = "https://www.wixapis.com";
28
- const PORTFOLIO_APP_ID = "d90652a2-f5a1-4c7c-84c4-d4cdcc41f130";
29
-
30
- export function makeCtx({ cwd = process.cwd() } = {}) {
31
- const config = JSON.parse(readFileSync(`${cwd}/wix.config.json`, "utf8"));
32
- const siteId = config.siteId ?? config.projectId;
33
- if (!siteId) throw new Error("wix.config.json has no siteId — is this a Wix CLI project?");
34
- const token = execFileSync("npx", ["@wix/cli@latest", "token", "--site", siteId], {
35
- encoding: "utf8",
36
- cwd,
37
- }).trim();
38
- if (!token) throw new Error("The Wix CLI returned no token — run `npx @wix/cli@latest login` first.");
39
- return { token, siteId };
40
- }
41
-
42
- async function req(ctx, path, { method = "POST", body } = {}) {
43
- const res = await fetch(API + path, {
44
- method,
45
- headers: {
46
- Authorization: `Bearer ${ctx.token}`,
47
- "wix-site-id": ctx.siteId,
48
- "Content-Type": "application/json",
49
- },
50
- body: body ? JSON.stringify(body) : undefined,
51
- });
52
- const json = await res.json().catch(() => ({}));
53
- if (!res.ok) throw new Error(`${method} ${path} -> ${res.status}: ${JSON.stringify(json).slice(0, 400)}`);
54
- return json;
55
- }
56
-
57
- // ---- operations ----------------------------------------------------------------------------------
58
-
59
- // Idempotent — re-installing returns 200.
60
- // docs: https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix.md
61
- export async function installPortfolioApp(ctx) {
62
- try {
63
- await req(ctx, "/apps-installer-service/v1/app-instance/install", { body: {
64
- tenant: { tenantType: "SITE", id: ctx.siteId },
65
- appInstance: { appDefId: PORTFOLIO_APP_ID, enabled: true },
66
- } });
67
- } catch {
68
- /* already installed is fine */
69
- }
70
- }
71
-
72
- // Read-only listing helpers (partial re-seeds, verification).
73
- // docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/collections/list-collections.md
74
- export async function listCollections(ctx) {
75
- const r = await req(ctx, "/portfolio/v1/collections", { method: "GET" });
76
- return (r.collections ?? []).map((c) => ({ id: c.id, title: c.title, slug: c.slug }));
77
- }
78
- // docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/projects/list-projects.md
79
- export async function listProjects(ctx) {
80
- const r = await req(ctx, "/portfolio/v1/projects", { method: "GET" });
81
- return (r.projects ?? []).map((p) => ({ id: p.id, title: p.title, slug: p.slug }));
82
- }
83
-
84
- // STEP 1 — collections. The display name is `title`, not `name`; `slug` auto-generates from
85
- // the title; `hidden` defaults to false = shown (omit it — send true only to hide). No
86
- // bulk-create: one call per collection.
87
- // docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/collections/create-collection.md
88
- export async function createCollections(ctx, collections) {
89
- const out = [];
90
- for (const c of collections) {
91
- const body = { collection: { title: c.title, description: c.description } };
92
- if (c.hidden) body.collection.hidden = true;
93
- const r = await req(ctx, "/portfolio/v1/collections", { body });
94
- out.push({ id: r.collection?.id, slug: r.collection?.slug, revision: r.collection?.revision });
95
- }
96
- return out;
97
- }
98
-
99
- // STEP 2 — projects, AFTER collections: collectionIds must hold real ids from createCollections
100
- // (they are NOT validated — a wrong/missing id silently orphans the project). `details` is an
101
- // optional [{ label, text }] array. No bulk-create: one call per project.
102
- // docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/projects/create-project.md
103
- export async function createProjects(ctx, projects) {
104
- const out = [];
105
- for (const p of projects) {
106
- const project = {
107
- title: p.title,
108
- description: p.description,
109
- collectionIds: p.collectionIds ?? [],
110
- };
111
- if (p.details) project.details = p.details;
112
- if (p.hidden) project.hidden = true;
113
- const r = await req(ctx, "/portfolio/v1/projects", { body: { project } });
114
- out.push({ id: r.project?.id, slug: r.project?.slug, revision: r.project?.revision });
115
- }
116
- return out;
117
- }
118
-
119
- // Portfolio binds covers + gallery items by Wix Media file ID — an external url must be
120
- // imported first (a raw url renders nothing); a plan `imagePrompt`/`coverImagePrompt` is
121
- // generated (Wix AI, 1 credit) then imported. Both live in the shared util (parallel,
122
- // resilient, never blocks the seed).
123
- export { importImage } from "../../shared/seed/images.mjs";
124
-
125
- // Cover = the listing-card thumbnail. PATCH per entity, echoing the current revision (missing/
126
- // stale revision fails); height + width are required alongside the imported file id.
127
- // docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/projects/update-project.md
128
- // One PATCH per entity; a failure on one must not cost the rest theirs. Returns
129
- // { attached: [id], failures: [{ id, error }] } — the caller counts what persisted, not what was sent.
130
- async function attachEach(ctx, items, urlOf, bodyOf) {
131
- const attached = [];
132
- const failures = [];
133
- for (const it of items) {
134
- try { await req(ctx, urlOf(it), { method: "PATCH", body: bodyOf(it) }); attached.push(it.id); }
135
- catch (e) { failures.push({ id: it.id, error: e?.message ?? String(e) }); }
136
- }
137
- return { attached, failures };
138
- }
139
- export async function attachProjectCovers(ctx, items) {
140
- return attachEach(ctx, items, (it) => `/portfolio/v1/projects/${it.id}`,
141
- (it) => ({ project: { id: it.id, revision: it.revision, coverImage: { imageInfo: { id: it.imageId, height: it.height, width: it.width } } } }));
142
- }
143
- // docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/collections/update-collection.md
144
- export async function attachCollectionCovers(ctx, items) {
145
- return attachEach(ctx, items, (it) => `/portfolio/v1/collections/${it.id}`,
146
- (it) => ({ collection: { id: it.id, revision: it.revision, coverImage: { imageInfo: { id: it.imageId, height: it.height, width: it.width } } } }));
147
- }
148
-
149
- // The detail-page gallery is a SEPARATE `item` entity — one POST per image; sortOrder (1,2,3…)
150
- // sets render order. Lowercase `items` — `/Items` 404s. There is NO public list endpoint.
151
- // docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/project-items/create-project-item.md
152
- export async function createProjectItems(ctx, items) {
153
- const out = [];
154
- for (const it of items) {
155
- const r = await req(ctx, "/portfolio/v1/items", {
156
- body: { item: { projectId: it.projectId, sortOrder: it.sortOrder, title: it.title, image: { imageInfo: { id: it.imageId, height: it.height, width: it.width } } } },
157
- });
158
- out.push({ id: r.item?.id });
159
- }
160
- return out;
161
- }
162
-
163
- /**
164
- * ONE-CALL seed: install → collections → projects (into collections) → gallery items →
165
- * covers, ids threaded in memory. The default path.
166
- */
167
- export async function setupPortfolio(ctx, { collections = [], projects = [] } = {}) {
168
- await installPortfolioApp(ctx);
169
-
170
- const cols = await createCollections(ctx, collections);
171
- const idByTitle = new Map(collections.map((c, i) => [c.title, cols[i].id]));
172
-
173
- const projs = await createProjects(
174
- ctx,
175
- projects.map((p) => ({
176
- title: p.title,
177
- description: p.description,
178
- details: p.details,
179
- hidden: p.hidden,
180
- collectionIds: p.collection ? [idByTitle.get(p.collection)].filter(Boolean) : [],
181
- })),
182
- );
183
-
184
- // Pass 2 — images: gallery items + project covers + collection covers, flattened into ONE
185
- // parallel wave (import by url / generate by prompt), then mapped back to each attach.
186
- // A failed image skips just that item/cover; the seed's exit never depends on images.
187
- const specs = [];
188
- const galleryRefs = [];
189
- projects.forEach((p, pi) => {
190
- for (const it of p.items ?? []) {
191
- galleryRefs.push({ pi, it, spec: specs.length });
192
- specs.push({ path: it.imagePath, url: it.imageUrl, prompt: it.imagePrompt, displayName: `${it.title || "item"}.png` });
193
- }
194
- });
195
- const projCoverAt = specs.length;
196
- projects.forEach((p) => specs.push({ path: p.coverImagePath, url: p.coverImageUrl, prompt: p.coverImagePrompt, displayName: `${p.title || "project"}-cover.png` }));
197
- const colCoverAt = specs.length;
198
- collections.forEach((c) => specs.push({ path: c.coverImagePath, url: c.coverImageUrl, prompt: c.coverImagePrompt, displayName: `${c.title || "collection"}-cover.png` }));
199
- const files = await resolveItemImages(ctx, specs);
200
- const dims = { height: 1024, width: 1024 };
201
-
202
- const itemsFlat = galleryRefs
203
- .map(({ pi, it, spec }) => (files[spec] && projs[pi]?.id
204
- ? { projectId: projs[pi].id, sortOrder: it.sortOrder, title: it.title, imageId: files[spec].id, ...dims }
205
- : null))
206
- .filter(Boolean);
207
- let items = [];
208
- try {
209
- if (itemsFlat.length) items = await createProjectItems(ctx, itemsFlat);
210
- } catch {
211
- /* the remaining gallery items stay unseeded */
212
- }
213
-
214
- const projCovers = projs
215
- .map((p, i) => (files[projCoverAt + i] && p.id
216
- ? { id: p.id, revision: p.revision, imageId: files[projCoverAt + i].id, ...dims }
217
- : null))
218
- .filter(Boolean);
219
- const colCovers = cols
220
- .map((c, i) => (files[colCoverAt + i] && c.id
221
- ? { id: c.id, revision: c.revision, imageId: files[colCoverAt + i].id, ...dims }
222
- : null))
223
- .filter(Boolean);
224
- // coversAttached counts the PATCHes that succeeded; coverFailures names the rest. Neither blocks the seed.
225
- let coversAttached = 0;
226
- const coverFailures = [];
227
- if (projCovers.length) { const r = await attachProjectCovers(ctx, projCovers); coversAttached += r.attached.length; coverFailures.push(...r.failures.map((f) => ({ project: f.id, error: f.error }))); }
228
- if (colCovers.length) { const r = await attachCollectionCovers(ctx, colCovers); coversAttached += r.attached.length; coverFailures.push(...r.failures.map((f) => ({ collection: f.id, error: f.error }))); }
229
-
230
- return {
231
- collections: cols,
232
- projects: projs,
233
- itemsCreated: items.length,
234
- coversAttached,
235
- coverFailures,
236
- };
237
- }
238
-
239
- // ---- CLI entry ----------------------------------------------------------------------------------
240
-
241
- const invokedDirectly = process.argv[1] && import.meta.url.endsWith(process.argv[1].split("/").pop());
242
- if (invokedDirectly) {
243
- const planPath = process.argv[2];
244
- if (!planPath) {
245
- console.error("usage: node seed-portfolio.mjs <plan.json> (run from the project root)");
246
- process.exit(1);
247
- }
248
- const plan = JSON.parse(readFileSync(planPath, "utf8"));
249
- const ctx = makeCtx();
250
- setupPortfolio(ctx, plan)
251
- .then((result) => console.log(JSON.stringify(result, null, 2)))
252
- .catch((e) => {
253
- console.error(e.message);
254
- process.exit(1);
255
- });
256
- }