@wix/agent-skills 1.19.2 → 1.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/wix-app/references/SERVICE_PLUGIN.md +14 -1
- package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +7 -6
- package/skills/wix-app/references/service-plugin/ADDITIONAL-FEES.md +4 -0
- package/skills/wix-app/references/service-plugin/AVAILABILITY-TIME-SLOTS-CONFIGURATION.md +118 -0
- package/skills/wix-app/references/service-plugin/BOOKING-POLICY.md +65 -0
- package/skills/wix-app/references/service-plugin/BOOKINGS-PRICING.md +71 -0
- package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +11 -3
- package/skills/wix-app/references/service-plugin/BOOKINGS-VALIDATION.md +137 -0
- package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +23 -16
- package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +4 -0
- package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +4 -2
- package/skills/wix-app/references/service-plugin/REALTIME-PERMISSIONS.md +45 -0
- package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +15 -0
- package/skills/wix-app/references/service-plugin/TOOLS_PROVIDER.md +4 -0
- package/skills/wix-app/references/service-plugin/VALIDATIONS.md +4 -0
- package/skills/wix-headless/references/CAPABILITIES.md +2 -2
- package/skills/wix-headless/references/inline-recipes/experience-store.md +4 -3
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +98 -18
- package/skills/wix-headless/references/managed/DEPLOYMENT.md +8 -8
- package/skills/wix-headless-fast/SKILL.md +200 -34
- package/skills/wix-headless-fast/entry/skill.md +10 -2
- package/skills/wix-headless-fast/install/attach.mjs +253 -0
- package/skills/wix-headless-fast/install/deploy.mjs +109 -9
- package/skills/wix-headless-fast/install/fast-path.mjs +28 -31
- package/skills/wix-headless-fast/references/blog/INSTRUCTIONS.md +224 -60
- package/skills/wix-headless-fast/references/blog/app/components/blog/BlogFeedView.tsx +2 -3
- package/skills/wix-headless-fast/references/blog/app/components/blog/PostView.tsx +2 -3
- package/skills/wix-headless-fast/references/blog/app/hooks/blog/useBlogFeed.ts +24 -116
- package/skills/wix-headless-fast/references/blog/app/hooks/blog/usePost.ts +16 -64
- package/skills/wix-headless-fast/references/blog/app/wix/blog/blog-feed-store.ts +137 -0
- package/skills/wix-headless-fast/references/blog/app/wix/blog/post-store.ts +78 -0
- package/skills/wix-headless-fast/references/blog/app/wix/blog/posts-core.ts +117 -0
- package/skills/wix-headless-fast/references/blog/app/wix/blog/posts.ts +13 -60
- package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy-core.ts +47 -0
- package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy.ts +10 -28
- package/skills/wix-headless-fast/references/blog/app-astro/pages/blog/[...slug].astro +2 -4
- package/skills/wix-headless-fast/references/blog/rest/posts.ts +42 -0
- package/skills/wix-headless-fast/references/blog/rest/taxonomy.ts +62 -0
- package/skills/wix-headless-fast/references/blog/seed/SEED.md +9 -0
- package/skills/wix-headless-fast/references/bookings/INSTRUCTIONS.md +179 -33
- package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServiceBookingView.tsx +2 -1
- package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useBookingFlow.ts +26 -132
- package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useServices.ts +18 -49
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-core.ts +218 -0
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-flow-store.ts +169 -0
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking.ts +57 -142
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-core.ts +92 -0
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-store.ts +90 -0
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services.ts +22 -61
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/types.ts +3 -1
- package/skills/wix-headless-fast/references/bookings/rest/booking.ts +113 -0
- package/skills/wix-headless-fast/references/bookings/rest/services.ts +55 -0
- package/skills/wix-headless-fast/references/bookings/seed/SEED.md +10 -0
- package/skills/wix-headless-fast/references/cms/INSTRUCTIONS.md +236 -62
- package/skills/wix-headless-fast/references/cms/app/hooks/cms/useCollection.ts +19 -52
- package/skills/wix-headless-fast/references/cms/app/hooks/cms/useItem.ts +16 -36
- package/skills/wix-headless-fast/references/cms/app/wix/cms/collection-store.ts +158 -0
- package/skills/wix-headless-fast/references/cms/app/wix/cms/item-store.ts +93 -0
- package/skills/wix-headless-fast/references/cms/app/wix/cms/items-core.ts +177 -0
- package/skills/wix-headless-fast/references/cms/app/wix/cms/items.ts +13 -41
- package/skills/wix-headless-fast/references/cms/rest/items.ts +125 -0
- package/skills/wix-headless-fast/references/cms/seed/SEED.md +9 -0
- package/skills/wix-headless-fast/references/events/INSTRUCTIONS.md +239 -83
- package/skills/wix-headless-fast/references/events/app/components/events/EventConfirmationView.tsx +1 -1
- package/skills/wix-headless-fast/references/events/app/components/events/EventRegistrationView.tsx +7 -5
- package/skills/wix-headless-fast/references/events/app/components/events/EventsView.tsx +2 -2
- package/skills/wix-headless-fast/references/events/app/hooks/events/useEventRegistration.ts +28 -110
- package/skills/wix-headless-fast/references/events/app/hooks/events/useEvents.ts +19 -54
- package/skills/wix-headless-fast/references/events/app/wix/events/events-core.ts +130 -0
- package/skills/wix-headless-fast/references/events/app/wix/events/events-store.ts +97 -0
- package/skills/wix-headless-fast/references/events/app/wix/events/events.ts +13 -94
- package/skills/wix-headless-fast/references/events/app/wix/events/registration-core.ts +113 -0
- package/skills/wix-headless-fast/references/events/app/wix/events/registration-store.ts +156 -0
- package/skills/wix-headless-fast/references/events/app/wix/events/registration.ts +38 -69
- package/skills/wix-headless-fast/references/events/rest/events.ts +57 -0
- package/skills/wix-headless-fast/references/events/rest/registration.ts +83 -0
- package/skills/wix-headless-fast/references/events/seed/SEED.md +9 -0
- package/skills/wix-headless-fast/references/forms/INSTRUCTIONS.md +214 -26
- package/skills/wix-headless-fast/references/forms/app/hooks/forms/useWixForm.ts +35 -267
- package/skills/wix-headless-fast/references/forms/app/wix/forms/form-store.ts +332 -0
- package/skills/wix-headless-fast/references/forms/app/wix/forms/forms-core.ts +238 -0
- package/skills/wix-headless-fast/references/forms/app/wix/forms/forms.ts +28 -243
- package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions-core.ts +216 -0
- package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions.ts +32 -204
- package/skills/wix-headless-fast/references/forms/rest/forms.ts +34 -0
- package/skills/wix-headless-fast/references/forms/rest/submissions.ts +56 -0
- package/skills/wix-headless-fast/references/forms/seed/SEED.md +8 -0
- package/skills/wix-headless-fast/references/forms/seed/seed-forms.mjs +15 -8
- package/skills/wix-headless-fast/references/members/INSTRUCTIONS.md +314 -63
- package/skills/wix-headless-fast/references/members/app/components/members/LoginForm.tsx +1 -1
- package/skills/wix-headless-fast/references/members/app/wix/members/auth-core.ts +105 -0
- package/skills/wix-headless-fast/references/members/app/wix/members/auth.ts +36 -65
- package/skills/wix-headless-fast/references/members/app/wix/members/client.ts +1 -1
- package/skills/wix-headless-fast/references/members/app/wix/members/members-core.ts +43 -0
- package/skills/wix-headless-fast/references/members/app/wix/members/members.ts +11 -32
- package/skills/wix-headless-fast/references/members/rest/auth.ts +215 -0
- package/skills/wix-headless-fast/references/members/rest/members.ts +26 -0
- package/skills/wix-headless-fast/references/portfolio/INSTRUCTIONS.md +238 -59
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionProjectsView.tsx +2 -2
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionsView.tsx +2 -2
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/GalleryMedia.tsx +35 -0
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/ProjectDetailView.tsx +8 -38
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollectionProjects.ts +23 -50
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollections.ts +16 -34
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useProjectDetail.ts +22 -49
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collection-projects-store.ts +82 -0
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collections-store.ts +58 -0
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio-core.ts +177 -0
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio.ts +31 -118
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/project-detail-store.ts +81 -0
- package/skills/wix-headless-fast/references/portfolio/rest/portfolio.ts +75 -0
- package/skills/wix-headless-fast/references/portfolio/seed/SEED.md +8 -0
- package/skills/wix-headless-fast/references/pricing-plans/INSTRUCTIONS.md +212 -51
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlanDetailView.tsx +9 -20
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlansView.tsx +7 -32
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/SubscribeButton.tsx +41 -0
- package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlanPurchase.ts +12 -33
- package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlans.ts +17 -34
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plan-purchase-store.ts +54 -0
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-core.ts +106 -0
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-store.ts +64 -0
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans.ts +7 -55
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase-core.ts +43 -0
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase.ts +11 -34
- package/skills/wix-headless-fast/references/pricing-plans/rest/plans.ts +31 -0
- package/skills/wix-headless-fast/references/pricing-plans/rest/purchase.ts +20 -0
- package/skills/wix-headless-fast/references/pricing-plans/seed/SEED.md +8 -0
- package/skills/wix-headless-fast/references/restaurants/INSTRUCTIONS.md +240 -47
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/MenuView.tsx +2 -2
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartDrawer.tsx +2 -2
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useMenus.ts +14 -35
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useReservation.ts +28 -171
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-core.ts +155 -0
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-store.ts +89 -0
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu.ts +23 -117
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering-core.ts +124 -0
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering.ts +45 -114
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservation-store.ts +193 -0
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations-core.ts +94 -0
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations.ts +15 -87
- package/skills/wix-headless-fast/references/restaurants/rest/menu.ts +60 -0
- package/skills/wix-headless-fast/references/restaurants/rest/ordering.ts +169 -0
- package/skills/wix-headless-fast/references/restaurants/rest/reservations.ts +68 -0
- package/skills/wix-headless-fast/references/restaurants/seed/SEED.md +8 -0
- package/skills/wix-headless-fast/references/shared/SUPPLIED-CONTENT.md +23 -0
- package/skills/wix-headless-fast/references/shared/app/wix/media.ts +55 -1
- package/skills/wix-headless-fast/references/shared/app/wix/sdk.ts +13 -0
- package/skills/wix-headless-fast/references/shared/rest/client.ts +155 -0
- package/skills/wix-headless-fast/references/shared/rest/config.ts +3 -0
- package/skills/wix-headless-fast/references/shared/rest/media.ts +65 -0
- package/skills/wix-headless-fast/references/storefront/INSTRUCTIONS.md +371 -81
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartDrawer.tsx +37 -3
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/FilterPanel.tsx +266 -0
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/OptionPicker.tsx +95 -0
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/QuickAdd.tsx +136 -0
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useProductDetail.ts +29 -130
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useShop.ts +26 -182
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-core.ts +121 -0
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart.ts +53 -136
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog-core.ts +309 -0
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog.ts +73 -230
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/product-detail-store.ts +147 -0
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/shop-store.ts +289 -0
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/types.ts +62 -4
- package/skills/wix-headless-fast/references/storefront/app-astro/layouts/SiteLayout.astro +21 -2
- package/skills/wix-headless-fast/references/storefront/rest/cart.ts +132 -0
- package/skills/wix-headless-fast/references/storefront/rest/catalog.ts +123 -0
- package/skills/wix-headless-fast/references/storefront/seed/SEED.md +25 -5
- package/skills/wix-headless-fast/references/storefront/seed/seed-store.mjs +24 -0
- package/skills/wix-manage/SKILL.md +4 -1
- package/skills/wix-manage/references/ecommerce/ecom-shipping.md +1 -1
- package/skills/wix-manage/references/events/create-wix-event.md +46 -0
- package/skills/wix-manage/references/events/manage-wix-events.md +51 -1
- package/skills/wix-manage/references/google-ads/manage-campaign-lifecycle.md +6 -6
- package/skills/wix-manage/references/seo/manage-seo-suggestions.md +351 -0
- package/skills/wix-vibe-headless/install/deploy.cjs +33 -2
- package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed-with-install.md +1 -1
- package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed.md +13 -4
- package/skills/wix-vibe-headless/platforms/base44-ecom-light.md +1 -1
- package/skills/wix-vibe-headless/platforms/base44.md +19 -4
- package/skills/wix-vibe-headless/platforms/generic.md +6 -0
- package/skills/wix-vibe-headless/references/_shared/nav/nav.tanstack.js +30 -0
- package/skills/wix-vibe-headless/references/_shared/routing.md +86 -0
- package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +44 -0
- package/skills/wix-vibe-headless/references/blog/app/components/PostCard.jsx +1 -1
- package/skills/wix-vibe-headless/references/blog/app/components/PostChips.jsx +1 -1
- package/skills/wix-vibe-headless/references/blog/app/pages/CategoryPage.jsx +1 -1
- package/skills/wix-vibe-headless/references/blog/app/pages/PostDetail.jsx +1 -1
- package/skills/wix-vibe-headless/references/blog/app/pages/TagPage.jsx +1 -1
- package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +42 -0
- package/skills/wix-vibe-headless/references/bookings/app/components/ServiceCard.jsx +1 -1
- package/skills/wix-vibe-headless/references/bookings/app/pages/ServiceDetail.jsx +1 -1
- package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +42 -0
- package/skills/wix-vibe-headless/references/events/app/components/EventCard.jsx +1 -1
- package/skills/wix-vibe-headless/references/events/app/pages/EventDetail.jsx +1 -1
- package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +42 -0
- package/skills/wix-vibe-headless/references/members/app/components/MemberMenu.jsx +1 -1
- package/skills/wix-vibe-headless/references/members/app/components/RequireAuth.jsx +1 -1
- package/skills/wix-vibe-headless/references/members/app/pages/Login.jsx +1 -1
- package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +43 -0
- package/skills/wix-vibe-headless/references/portfolio/app/components/CollectionCard.jsx +1 -1
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectCard.jsx +1 -1
- package/skills/wix-vibe-headless/references/portfolio/app/pages/CollectionPage.jsx +1 -1
- package/skills/wix-vibe-headless/references/portfolio/app/pages/ProjectDetail.jsx +1 -1
- package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +43 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanCard.jsx +1 -1
- package/skills/wix-vibe-headless/references/pricing-plans/app/pages/PlanDetail.jsx +1 -1
- package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +36 -0
- package/skills/wix-vibe-headless/references/shared/app/lib/nav.js +9 -0
- package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +42 -41
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductCard.js +7 -1
- package/skills/wix-vibe-headless/references/storefront/seed/SEED.md +3 -0
- package/skills/wix-vibe-headless/references/storefront/seed/seed-store.cjs +6 -0
- package/skills/wix-headless-fast/install/pin-agents-md.mjs +0 -57
|
@@ -8,6 +8,21 @@
|
|
|
8
8
|
// --stack react — copies only the core (app/) into src/, and writes the public OAuth
|
|
9
9
|
// client id into src/wix/config.ts (pass --client-id, or it's read from
|
|
10
10
|
// wix.config.json's appId when present).
|
|
11
|
+
// --stack lib — a bundled JS project that isn't React (Vue, Svelte, Solid, plain Vite): copies
|
|
12
|
+
// ONLY the data layer — shared app/wix/ (sdk, media, money, config) and each
|
|
13
|
+
// vertical's app/wix/<vertical>/ (data layer, cart store, types, *-core rules) —
|
|
14
|
+
// none of which imports React; writes the client id like react. No hooks, no
|
|
15
|
+
// components, no global.css, no Tailwind deps. The agent writes its framework's
|
|
16
|
+
// stores and components against the same DTO contracts.
|
|
17
|
+
// --stack static — a site with NO bundler (plain HTML/CSS/JS): composes the REST layer flat into
|
|
18
|
+
// <out>/js/wix/ — shared/rest/ (client, media, config) + each vertical's rest/ + the
|
|
19
|
+
// vertical's transport-agnostic core files (types, *-core) from its app/ — writes
|
|
20
|
+
// the client id, and strips it to browser-ready ESM with tsc (comments kept, the
|
|
21
|
+
// .ts sources kept beside the .js). No package.json is touched. Storefront only
|
|
22
|
+
// until other verticals ship a rest/. `--out <dir>` (default: the project root)
|
|
23
|
+
// is the folder the site is served from — the one wix.config.json's
|
|
24
|
+
// site.outputDirectory points at — so the modules land where the pages import
|
|
25
|
+
// them and nothing else in the project gets uploaded.
|
|
11
26
|
//
|
|
12
27
|
// TWO mechanisms, driven by the same vertical arguments:
|
|
13
28
|
// 1. Recursive file copy with force:false — only files that AREN'T there yet are written, so
|
|
@@ -158,17 +173,18 @@ const flag = (name) => {
|
|
|
158
173
|
const stack = flag("stack") ?? "astro";
|
|
159
174
|
const clientIdFlag = flag("client-id");
|
|
160
175
|
const planPath = flag("plan");
|
|
176
|
+
const outDir = flag("out");
|
|
161
177
|
const flagArgs = new Set(
|
|
162
|
-
["--stack", "--client-id", "--plan", stack, clientIdFlag, planPath].filter(Boolean),
|
|
178
|
+
["--stack", "--client-id", "--plan", "--out", stack, clientIdFlag, planPath, outDir].filter(Boolean),
|
|
163
179
|
);
|
|
164
180
|
const requested = [...new Set(argv.filter((a) => !flagArgs.has(a)))];
|
|
165
181
|
|
|
166
182
|
const result = { stack, verticals: [], skillRoot: SKILL_ROOT };
|
|
167
183
|
|
|
168
|
-
if (!["astro", "react"].includes(stack)) {
|
|
184
|
+
if (!["astro", "react", "lib", "static"].includes(stack)) {
|
|
169
185
|
console.log(
|
|
170
186
|
JSON.stringify({
|
|
171
|
-
error: `unknown --stack "${stack}" — expected astro|react`,
|
|
187
|
+
error: `unknown --stack "${stack}" — expected astro|react|lib|static`,
|
|
172
188
|
}),
|
|
173
189
|
);
|
|
174
190
|
process.exit(1);
|
|
@@ -193,6 +209,87 @@ if (!Array.isArray(uploadPolicies)) {
|
|
|
193
209
|
console.log(JSON.stringify({ error: "plan.capabilities.mediaUpload.policies must be an array" }));
|
|
194
210
|
process.exit(1);
|
|
195
211
|
}
|
|
212
|
+
// ---- static stack: the REST layer, composed flat and stripped ------------------------------------
|
|
213
|
+
if (stack === "static") {
|
|
214
|
+
const { spawnSync } = await import("node:child_process");
|
|
215
|
+
const { rmSync } = await import("node:fs");
|
|
216
|
+
const OUT = outDir ? resolve(PROJECT, outDir) : PROJECT;
|
|
217
|
+
const JS = join(OUT, "js", "wix");
|
|
218
|
+
result.out = outDir ?? ".";
|
|
219
|
+
let clientId = clientIdFlag;
|
|
220
|
+
if (!clientId && existsSync(join(PROJECT, "wix.config.json"))) {
|
|
221
|
+
clientId = JSON.parse(readFileSync(join(PROJECT, "wix.config.json"), "utf8")).appId ?? null;
|
|
222
|
+
}
|
|
223
|
+
if (!clientId) {
|
|
224
|
+
console.log(JSON.stringify({ error: "static stack needs the public OAuth client id — run `npm create @wix/new@latest init` here first, or pass --client-id" }));
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
227
|
+
const missing = requested.filter((v) => !existsSync(join(REF, v, "rest")));
|
|
228
|
+
if (missing.length) {
|
|
229
|
+
console.log(JSON.stringify({ error: `no rest/ layer yet for ${missing.map((v) => `"${v}"`).join(", ")} — the static stack ships: ${VERTICALS.filter((v) => existsSync(join(REF, v, "rest"))).join(", ")}` }));
|
|
230
|
+
process.exit(1);
|
|
231
|
+
}
|
|
232
|
+
// Only files that aren't there yet — a re-run restores, never clobbers (same as the copy below).
|
|
233
|
+
cpSync(join(REF, "shared", "rest"), JS, COPY);
|
|
234
|
+
for (const vertical of requested) {
|
|
235
|
+
cpSync(join(REF, vertical, "rest"), JS, COPY);
|
|
236
|
+
// The vertical's transport-agnostic core: types, every *-core.ts, and every *-store.ts under its
|
|
237
|
+
// app/wix/<vertical>/ — the stores are the hooks' logic without React, over the same function
|
|
238
|
+
// names the REST twin exports, so they run against it unchanged.
|
|
239
|
+
const appWix = join(REF, vertical, "app", "wix", vertical);
|
|
240
|
+
for (const f of readdirSync(appWix)) {
|
|
241
|
+
// Every vertical has a types.ts; flat in one folder they would collide, so each lands as
|
|
242
|
+
// <vertical>-types.ts and the vertical's own files are pointed at it below.
|
|
243
|
+
if (f === "types.ts") cpSync(join(appWix, f), join(JS, `${vertical}-types.ts`), COPY);
|
|
244
|
+
else if (f.endsWith("-core.ts") || f.endsWith("-store.ts")) cpSync(join(appWix, f), join(JS, f), COPY);
|
|
245
|
+
}
|
|
246
|
+
const own = new Set([...readdirSync(join(REF, vertical, "rest")), ...readdirSync(appWix)].filter((f) => f.endsWith(".ts") && f !== "types.ts"));
|
|
247
|
+
for (const f of own) {
|
|
248
|
+
const fp = join(JS, f);
|
|
249
|
+
if (!existsSync(fp)) continue;
|
|
250
|
+
const src = readFileSync(fp, "utf8");
|
|
251
|
+
const fixed = src.replace(/from\s+"\.\/types(?:\.js)?"/g, `from "./${vertical}-types.js"`);
|
|
252
|
+
if (fixed !== src) writeFileSync(fp, fixed);
|
|
253
|
+
}
|
|
254
|
+
result.verticals.push(vertical);
|
|
255
|
+
}
|
|
256
|
+
// Browser ESM resolves nothing: every relative import needs its .js. The rest/ files are written
|
|
257
|
+
// that way; the files borrowed from app/wix/ are bundler-style and get the suffix here.
|
|
258
|
+
for (const f of readdirSync(JS).filter((f) => f.endsWith(".ts"))) {
|
|
259
|
+
const src = readFileSync(join(JS, f), "utf8");
|
|
260
|
+
const fixed = src.replace(/(from\s+"\.\/[^"]+?)(?<!\.js)"/g, '$1.js"');
|
|
261
|
+
if (fixed !== src) writeFileSync(join(JS, f), fixed);
|
|
262
|
+
}
|
|
263
|
+
const cfg = join(JS, "config.ts");
|
|
264
|
+
const current = readFileSync(cfg, "utf8");
|
|
265
|
+
if (/WIX_CLIENT_ID: string = ""/.test(current)) {
|
|
266
|
+
writeFileSync(cfg, current.replace(/WIX_CLIENT_ID: string = ""/, `WIX_CLIENT_ID: string = "${clientId}"`));
|
|
267
|
+
result.clientId = "written";
|
|
268
|
+
} else {
|
|
269
|
+
result.clientId = "already_set";
|
|
270
|
+
}
|
|
271
|
+
// Strip to ESM with tsc — comments are the spec for whoever reads js/wix/, so they stay.
|
|
272
|
+
const sources = readdirSync(JS).filter((f) => f.endsWith(".ts")).map((f) => join(JS, f));
|
|
273
|
+
const tsc = spawnSync(
|
|
274
|
+
"npx",
|
|
275
|
+
["-y", "-p", "typescript@5", "tsc", ...sources, "--outDir", JS, "--module", "esnext", "--target", "es2022",
|
|
276
|
+
"--moduleResolution", "bundler", "--lib", "es2022,dom", "--strict", "--skipLibCheck", "--removeComments", "false"],
|
|
277
|
+
{ encoding: "utf8", timeout: 180_000 },
|
|
278
|
+
);
|
|
279
|
+
if (tsc.status !== 0) {
|
|
280
|
+
console.log(JSON.stringify({ ...result, error: `tsc strip failed: ${(tsc.stdout || tsc.stderr || "").slice(-800)}` }));
|
|
281
|
+
process.exit(1);
|
|
282
|
+
}
|
|
283
|
+
rmSync(join(JS, "tsconfig.json"), { force: true });
|
|
284
|
+
result.js = `${outDir ? outDir.replace(/\/$/, "") + "/" : ""}js/wix/*.js`;
|
|
285
|
+
// The note lists what actually landed, so it holds for every vertical (and several at once).
|
|
286
|
+
const stores = readdirSync(JS).filter((f) => f.endsWith("-store.js")).map((f) => `./js/wix/${f}`);
|
|
287
|
+
const dataFiles = readdirSync(JS).filter((f) => f.endsWith(".js") && !f.endsWith("-store.js") && !f.endsWith("-core.js") && !f.endsWith("-types.js") && !["client.js", "config.js", "media.js"].includes(f)).map((f) => `./js/wix/${f}`);
|
|
288
|
+
result.note = `import the data layer (${dataFiles.join(", ")})${stores.length ? ` and the stores (${stores.join(", ")})` : ""} relative to ${outDir ?? "the project root"} in a <script type="module">; the .ts beside them are the same files with types, for reading; point wix.config.json site.outputDirectory at "./${outDir ?? "."}"`;
|
|
289
|
+
console.log(JSON.stringify(result));
|
|
290
|
+
process.exit(0);
|
|
291
|
+
}
|
|
292
|
+
|
|
196
293
|
if (uploadPolicies.length && stack !== "astro") {
|
|
197
294
|
console.log(JSON.stringify({ error: "mediaUpload currently requires --stack astro because it ships a validated server endpoint" }));
|
|
198
295
|
process.exit(1);
|
|
@@ -212,8 +309,9 @@ for (const policy of uploadPolicies) {
|
|
|
212
309
|
}
|
|
213
310
|
|
|
214
311
|
// ---- copy ---------------------------------------------------------------------------------------
|
|
215
|
-
// Shared core — always.
|
|
216
|
-
cpSync(join(REF, "shared", "app"), SRC, COPY);
|
|
312
|
+
// Shared core — always. The lib stack takes only the framework-free wix/ part (no styles).
|
|
313
|
+
if (stack === "lib") cpSync(join(REF, "shared", "app", "wix"), join(SRC, "wix"), COPY);
|
|
314
|
+
else cpSync(join(REF, "shared", "app"), SRC, COPY);
|
|
217
315
|
|
|
218
316
|
if (uploadPolicies.length) {
|
|
219
317
|
cpSync(join(REF, "shared", "capabilities", "media-upload", "app"), SRC, COPY);
|
|
@@ -221,10 +319,12 @@ if (uploadPolicies.length) {
|
|
|
221
319
|
}
|
|
222
320
|
|
|
223
321
|
const unknown = requested.filter((v) => !VERTICALS.includes(v));
|
|
224
|
-
|
|
322
|
+
// lib: only @wix/sdk from the shared deps — the Tailwind pair serves the components, which don't ship there.
|
|
323
|
+
const wantedDeps = stack === "lib" ? { "@wix/sdk": SHARED_DEPS["@wix/sdk"] } : { ...SHARED_DEPS };
|
|
225
324
|
if (uploadPolicies.length) Object.assign(wantedDeps, CAPABILITY_DEPS["media-upload"]);
|
|
226
325
|
for (const vertical of requested.filter((v) => VERTICALS.includes(v))) {
|
|
227
|
-
cpSync(join(REF, vertical, "app"), SRC, COPY);
|
|
326
|
+
if (stack === "lib") cpSync(join(REF, vertical, "app", "wix"), join(SRC, "wix"), COPY);
|
|
327
|
+
else cpSync(join(REF, vertical, "app"), SRC, COPY);
|
|
228
328
|
if (stack === "astro" && existsSync(join(REF, vertical, "app-astro"))) {
|
|
229
329
|
cpSync(join(REF, vertical, "app-astro"), SRC, COPY);
|
|
230
330
|
}
|
|
@@ -386,7 +486,7 @@ if (!clientId && existsSync(join(PROJECT, "wix.config.json"))) {
|
|
|
386
486
|
JSON.parse(readFileSync(join(PROJECT, "wix.config.json"), "utf8")).appId ??
|
|
387
487
|
null;
|
|
388
488
|
}
|
|
389
|
-
if (stack === "react") {
|
|
489
|
+
if (stack === "react" || stack === "lib") {
|
|
390
490
|
if (clientId) {
|
|
391
491
|
const current = readFileSync(CONFIG_TS, "utf8");
|
|
392
492
|
// A non-null id already set wins; only fill the shipped null placeholder.
|
|
@@ -404,7 +504,7 @@ if (stack === "react") {
|
|
|
404
504
|
}
|
|
405
505
|
} else {
|
|
406
506
|
result.clientId =
|
|
407
|
-
|
|
507
|
+
`missing — pass --client-id (the ${stack} stack needs the public OAuth client id)`;
|
|
408
508
|
}
|
|
409
509
|
}
|
|
410
510
|
if (requested.includes("members")) {
|
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
// or for connect/iterate runs (which must NOT scaffold and don't use this script).
|
|
5
5
|
//
|
|
6
6
|
// node <SKILL_ROOT>/install/fast-path.mjs --business-name "<Brand>" --plan plan.json \
|
|
7
|
-
// --vertical <storefront|bookings|…> [--stack astro] [--folder-name <npm-safe-name>]
|
|
7
|
+
// --vertical <storefront|bookings|…> [--stack astro] [--subfolder [--folder-name <npm-safe-name>]]
|
|
8
8
|
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
9
|
+
// The project is created in the CURRENT DIRECTORY — the folder the entry had the agent work from,
|
|
10
|
+
// which already holds the installed skills (`.agents/skills/`), so the project is self-contained
|
|
11
|
+
// and a later session opened in it finds them. `--subfolder` (opt-in) leaves it in a new folder
|
|
12
|
+
// named after the business instead, for a current folder that must stay as it is.
|
|
11
13
|
//
|
|
12
14
|
// It emits ONE JSON event per line and exits in ~35s with BOTH long steps — the dependency
|
|
13
15
|
// install AND the seed — running detached in the background (logs + completion markers
|
|
14
16
|
// reported in the final event), so the caller can build the brand layer while they finish.
|
|
15
17
|
// Steps: scaffold (Wix CLI; requires a logged-in session) → deploy shipped code + deps +
|
|
16
|
-
// lockfile →
|
|
18
|
+
// lockfile → start `npm ci || npm install` detached → start the seed detached.
|
|
17
19
|
import { spawn, spawnSync } from "node:child_process";
|
|
18
20
|
import { existsSync, openSync, readFileSync, readdirSync, renameSync, rmSync } from "node:fs";
|
|
19
21
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -37,8 +39,8 @@ const businessName = flag("business-name");
|
|
|
37
39
|
const planPath = flag("plan");
|
|
38
40
|
const vertical = flag("vertical");
|
|
39
41
|
const stack = flag("stack") ?? "astro";
|
|
40
|
-
// Opt-in:
|
|
41
|
-
const
|
|
42
|
+
// Opt-in: keep the project in a subfolder instead of the current directory.
|
|
43
|
+
const subfolder = argv.includes("--subfolder");
|
|
42
44
|
// --vertical is REQUIRED: a defaulted vertical deploys the wrong code and runs the wrong
|
|
43
45
|
// seed against the plan — fail loudly with the discovered choices instead.
|
|
44
46
|
const knownVerticals = readdirSync(join(SKILL_ROOT, "references"), { withFileTypes: true })
|
|
@@ -56,9 +58,9 @@ const plan = JSON.parse(readFileSync(planPath, "utf8"));
|
|
|
56
58
|
const folderName =
|
|
57
59
|
flag("folder-name") ??
|
|
58
60
|
businessName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
|
|
59
|
-
// `let`:
|
|
60
|
-
// projectDir there, so the detached install/seed and every
|
|
61
|
-
// final location.
|
|
61
|
+
// `let`: the Wix CLI can only scaffold into a subfolder; by default we then move the scaffold up
|
|
62
|
+
// into the current directory and repoint projectDir there, so the detached install/seed and every
|
|
63
|
+
// reported path use the final location.
|
|
62
64
|
let projectDir = resolve(process.cwd(), folderName);
|
|
63
65
|
|
|
64
66
|
// ---- 1 · scaffold -------------------------------------------------------------------------------
|
|
@@ -108,33 +110,28 @@ try { deployResult = JSON.parse(deploy.stdout); } catch { /* keep going with raw
|
|
|
108
110
|
if (deployResult.error) fail("deploy", deployResult.error);
|
|
109
111
|
emit("deployed", deployResult);
|
|
110
112
|
|
|
111
|
-
// ----
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
// ---- 2c · optional --flatten: move the scaffold into the current directory ----------------------
|
|
120
|
-
// OFF by default — the normal output is a self-contained subfolder, unchanged. Opt in when the
|
|
121
|
-
// caller wants the project directly in the current directory (e.g. bootstrapping into an existing
|
|
122
|
-
// repo that must stay one flat tree). Done HERE, before the detached install below, on purpose:
|
|
123
|
-
// no node_modules exists yet, so the move is instant and cannot collide with a running install —
|
|
124
|
-
// the failure mode when a project is flattened by hand after the background install has started.
|
|
125
|
-
// A pure move: the scaffold was created with --skip-git (above), so there is no nested repo to
|
|
126
|
-
// reconcile — git is whatever the destination already is.
|
|
113
|
+
// ---- 2c · place the project in the current directory --------------------------------------------
|
|
114
|
+
// The default. The Wix CLI scaffolds into a subfolder, so the scaffold is moved up into the current
|
|
115
|
+
// directory — the folder that already holds the installed skills — and the subfolder removed. Done
|
|
116
|
+
// HERE, before the detached install below, on purpose: no node_modules exists yet, so the move is
|
|
117
|
+
// instant and cannot collide with a running install. A pure move: the scaffold was created with
|
|
118
|
+
// --skip-git, so there is no nested repo to reconcile — git is whatever the folder already is.
|
|
119
|
+
// Refuses rather than overwrite: an entry that already exists in the current directory stops the
|
|
120
|
+
// move before anything is touched. `--subfolder` skips this step.
|
|
127
121
|
const targetDir = process.cwd();
|
|
128
|
-
if (
|
|
122
|
+
if (!subfolder && projectDir !== targetDir) {
|
|
123
|
+
const entries = readdirSync(projectDir);
|
|
124
|
+
const clashes = entries.filter((e) => existsSync(join(targetDir, e)));
|
|
125
|
+
if (clashes.length) {
|
|
126
|
+
fail("place", `the current directory already has: ${clashes.join(", ")} — run with --subfolder to keep the project in ${folderName}/, or start in an empty folder`);
|
|
127
|
+
}
|
|
129
128
|
try {
|
|
130
|
-
for (const entry of
|
|
131
|
-
renameSync(join(projectDir, entry), join(targetDir, entry));
|
|
132
|
-
}
|
|
129
|
+
for (const entry of entries) renameSync(join(projectDir, entry), join(targetDir, entry));
|
|
133
130
|
rmSync(projectDir, { recursive: true, force: true });
|
|
134
131
|
projectDir = targetDir;
|
|
135
|
-
emit("
|
|
132
|
+
emit("project_placed", { into: targetDir });
|
|
136
133
|
} catch (e) {
|
|
137
|
-
fail("
|
|
134
|
+
fail("place", e?.stack || e);
|
|
138
135
|
}
|
|
139
136
|
}
|
|
140
137
|
|