@wix/agent-skills 1.6.0 → 1.8.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 (195) hide show
  1. package/README.md +5 -9
  2. package/package.json +1 -1
  3. package/skills/wix-app/SKILL.md +51 -42
  4. package/skills/wix-app/references/BACKEND_EVENT.md +10 -65
  5. package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +101 -406
  6. package/skills/wix-app/references/DASHBOARD_MENU_PLUGIN.md +14 -111
  7. package/skills/wix-app/references/DASHBOARD_MODAL.md +56 -205
  8. package/skills/wix-app/references/DASHBOARD_PAGE.md +19 -98
  9. package/skills/wix-app/references/DASHBOARD_PLUGIN.md +6 -108
  10. package/skills/wix-app/references/DATA_COLLECTION.md +113 -198
  11. package/skills/wix-app/references/EMBEDDED_SCRIPT.md +41 -268
  12. package/skills/wix-app/references/EXTENSION_REGISTRATION.md +27 -76
  13. package/skills/wix-app/references/SERVICE_PLUGIN.md +35 -188
  14. package/skills/wix-app/references/SITE_PLUGIN.md +8 -92
  15. package/skills/wix-app/references/STORES_VERSIONING.md +1 -0
  16. package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +0 -44
  17. package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +19 -330
  18. package/skills/wix-app/references/dashboard-menu-plugin/bookings-slots.md +0 -12
  19. package/skills/wix-app/references/dashboard-menu-plugin/ecommerce-slots.md +7 -0
  20. package/skills/wix-app/references/dashboard-menu-plugin/restaurants-slots.md +0 -12
  21. package/skills/wix-app/references/dashboard-plugin/SLOTS.md +3 -15
  22. package/skills/wix-app/references/service-plugin/ADDITIONAL-FEES.md +2 -18
  23. package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +2 -42
  24. package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +1 -11
  25. package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +1 -11
  26. package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +2 -40
  27. package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +2 -19
  28. package/skills/wix-app/references/service-plugin/VALIDATIONS.md +2 -18
  29. package/skills/wix-app/references/site-plugin/SLOTS.md +17 -68
  30. package/skills/wix-design-system/SKILL.md +4 -0
  31. package/skills/wix-headless/SKILL.md +131 -386
  32. package/skills/wix-headless/references/BUILD-astro.md +246 -0
  33. package/skills/wix-headless/references/BUILD-own-build.md +167 -0
  34. package/skills/wix-headless/references/BUILD.md +105 -0
  35. package/skills/wix-headless/references/DESIGN_SYSTEM.md +175 -0
  36. package/skills/wix-headless/references/DISCOVERY-connect.md +55 -0
  37. package/skills/wix-headless/references/DISCOVERY-create.md +238 -0
  38. package/skills/wix-headless/references/DISCOVERY.md +50 -306
  39. package/skills/wix-headless/references/PLAN-connect.md +19 -0
  40. package/skills/wix-headless/references/PLAN-create.md +17 -0
  41. package/skills/wix-headless/references/PLAN.md +92 -0
  42. package/skills/wix-headless/references/SEED.md +214 -0
  43. package/skills/wix-headless/references/SETUP.md +73 -248
  44. package/skills/wix-headless/references/{blog → astro/blog}/BLOG_PAGES.md +6 -5
  45. package/skills/wix-headless/references/{blog → astro/blog}/BLOG_SETUP.md +2 -2
  46. package/skills/wix-headless/references/astro/bookings/COMPONENTS.md +337 -0
  47. package/skills/wix-headless/references/astro/bookings/SERVICES_PAGES.md +428 -0
  48. package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +214 -0
  49. package/skills/wix-headless/references/{cms → astro/cms}/FAQ_KNOWLEDGE_BASE.md +14 -12
  50. package/skills/wix-headless/references/{cms → astro/cms}/PORTFOLIO.md +15 -16
  51. package/skills/wix-headless/references/{cms → astro/cms}/RESOURCE_LIBRARY.md +13 -15
  52. package/skills/wix-headless/references/{cms → astro/cms}/TEAM_DIRECTORY.md +11 -11
  53. package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +354 -0
  54. package/skills/wix-headless/references/{ecom → astro/ecom}/CART_PAGES.md +8 -9
  55. package/skills/wix-headless/references/{ecom → astro/ecom}/CART_WIRING.md +6 -6
  56. package/skills/wix-headless/references/{ecom → astro/ecom}/COMPONENTS_CSS.md +6 -6
  57. package/skills/wix-headless/references/{forms → astro/forms}/CONTACT_FORM.md +18 -32
  58. package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/COMPONENTS.md +3 -3
  59. package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/PAGES.md +2 -2
  60. package/skills/wix-headless/references/{stores → astro/stores}/BACK_IN_STOCK.md +7 -7
  61. package/skills/wix-headless/references/{stores → astro/stores}/CATEGORY_PAGES.md +12 -13
  62. package/skills/wix-headless/references/{stores → astro/stores}/COMPONENTS_CSS.md +7 -7
  63. package/skills/wix-headless/references/{stores → astro/stores}/HOME_AND_NAV.md +11 -9
  64. package/skills/wix-headless/references/{stores → astro/stores}/PRODUCT_PAGES.md +11 -9
  65. package/skills/wix-headless/references/{stores → astro/stores}/SHARED_WIRING.md +8 -7
  66. package/skills/wix-headless/references/astro/templates/Footer.astro +27 -0
  67. package/skills/wix-headless/references/astro/templates/Layout.astro +132 -0
  68. package/skills/wix-headless/references/astro/templates/Navigation.astro +38 -0
  69. package/skills/wix-headless/references/astro/templates/astro.config.mjs +41 -0
  70. package/skills/wix-headless/references/astro/templates/bookings/AvailabilityCalendar.tsx +218 -0
  71. package/skills/wix-headless/references/astro/templates/bookings/BookingForm.tsx +194 -0
  72. package/skills/wix-headless/references/astro/templates/bookings/ManageBooking.tsx +84 -0
  73. package/skills/wix-headless/references/astro/templates/bookings/SeoTags.astro +25 -0
  74. package/skills/wix-headless/references/astro/templates/bookings/ServiceBookingFlow.tsx +50 -0
  75. package/skills/wix-headless/references/astro/templates/bookings/ServiceCard.astro +45 -0
  76. package/skills/wix-headless/references/astro/templates/bookings/api/confirm-booking.ts +34 -0
  77. package/skills/wix-headless/references/astro/templates/bookings/api/waitlist.ts +74 -0
  78. package/skills/wix-headless/references/astro/templates/bookings/booking-confirmation.astro +111 -0
  79. package/skills/wix-headless/references/astro/templates/bookings/components-bookings.css +413 -0
  80. package/skills/wix-headless/references/astro/templates/bookings/manage-booking.astro +76 -0
  81. package/skills/wix-headless/references/astro/templates/bookings/services/[slug].astro +81 -0
  82. package/skills/wix-headless/references/astro/templates/bookings/services/index.astro +65 -0
  83. package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +302 -0
  84. package/skills/wix-headless/references/astro/templates/global.css +286 -0
  85. package/skills/wix-headless/references/astro/templates/index.astro +56 -0
  86. package/skills/wix-headless/{templates → references/astro/templates}/stores/back-in-stock.ts +1 -1
  87. package/skills/wix-headless/{templates → references/astro/templates}/stores/components-stores.css +138 -33
  88. package/skills/wix-headless/references/blog/BLOG_CONTENT.md +28 -19
  89. package/skills/wix-headless/references/blog/INSTRUCTIONS.md +6 -6
  90. package/skills/wix-headless/references/bookings/INSTRUCTIONS.md +106 -0
  91. package/skills/wix-headless/references/bookings/SERVICES_DATA.md +295 -0
  92. package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +35 -232
  93. package/skills/wix-headless/references/cms/INSTRUCTIONS.md +39 -8
  94. package/skills/wix-headless/references/commands/known-apps.json +2 -1
  95. package/skills/wix-headless/references/custom/CONNECTION_PLAN.md +142 -0
  96. package/skills/wix-headless/references/custom/INSTRUCTIONS.md +88 -0
  97. package/skills/wix-headless/references/custom/blog/WIRING.md +52 -0
  98. package/skills/wix-headless/references/custom/bookings/WIRING.md +88 -0
  99. package/skills/wix-headless/references/custom/cms/WIRING.md +97 -0
  100. package/skills/wix-headless/references/custom/ecom/WIRING.md +67 -0
  101. package/skills/wix-headless/references/custom/forms/WIRING.md +101 -0
  102. package/skills/wix-headless/references/custom/stores/WIRING.md +80 -0
  103. package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +12 -12
  104. package/skills/wix-headless/references/forms/INSTRUCTIONS.md +6 -6
  105. package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +13 -13
  106. package/skills/wix-headless/references/images/INSTRUCTIONS.md +58 -60
  107. package/skills/wix-headless/references/seed-recipes.md +49 -0
  108. package/skills/wix-headless/references/shared/AGENTS_MD.md +47 -0
  109. package/skills/wix-headless/references/shared/AUTHENTICATION.md +108 -0
  110. package/skills/wix-headless/references/shared/BUILD_NOISE.md +2 -2
  111. package/skills/wix-headless/references/shared/DESIGN_MD.md +85 -0
  112. package/skills/wix-headless/references/shared/DOCS_SEARCH.md +41 -0
  113. package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +40 -39
  114. package/skills/wix-headless/references/shared/IMPLEMENTER.md +92 -41
  115. package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +3 -3
  116. package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +32 -312
  117. package/skills/wix-headless/references/shared/STYLING.md +48 -21
  118. package/skills/wix-headless/references/stores/INSTRUCTIONS.md +59 -29
  119. package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +31 -28
  120. package/skills/wix-headless/references/verticals/_schema.json +31 -117
  121. package/skills/wix-headless/references/verticals/_schema.md +60 -150
  122. package/skills/wix-headless/references/verticals/blog.md +5 -99
  123. package/skills/wix-headless/references/verticals/bookings.md +41 -0
  124. package/skills/wix-headless/references/verticals/cms.md +9 -100
  125. package/skills/wix-headless/references/verticals/ecom.md +6 -77
  126. package/skills/wix-headless/references/verticals/forms.md +5 -85
  127. package/skills/wix-headless/references/verticals/gift-cards.md +6 -103
  128. package/skills/wix-headless/references/verticals/stores.md +10 -144
  129. package/skills/wix-headless/scripts/check-manifest.mjs +148 -11
  130. package/skills/wix-headless/scripts/compose.mjs +540 -0
  131. package/skills/wix-headless/scripts/emit-design-tokens.mjs +136 -53
  132. package/skills/wix-headless/scripts/flatten.sh +61 -0
  133. package/skills/wix-headless/scripts/generate-images.mjs +242 -0
  134. package/skills/wix-headless/scripts/patch-decorative-slots.mjs +67 -43
  135. package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +3 -3
  136. package/skills/wix-headless/scripts/scaffold.sh +113 -27
  137. package/skills/wix-headless/scripts/seed-utilities.sh +50 -12
  138. package/skills/wix-headless/scripts/write-decorative-json.mjs +62 -0
  139. package/skills/wix-manage/SKILL.md +4 -8
  140. package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +2 -0
  141. package/skills/wix-manage/references/cms/cms-data-items-crud.md +4 -0
  142. package/skills/wix-manage/references/cms/cms-references-and-relationships.md +2 -0
  143. package/skills/wix-manage/references/cms/cms-schema-management.md +4 -0
  144. package/skills/wix-manage/references/domains/domain-search-and-purchase.md +10 -7
  145. package/skills/wix-manage/references/ecommerce/api-shipping.md +443 -0
  146. package/skills/wix-manage/references/ecommerce/flow-add-free-shipping.md +5 -6
  147. package/skills/wix-manage/references/ecommerce/flow-fix-coverage-gaps.md +4 -5
  148. package/skills/wix-manage/references/ecommerce/flow-optimize-shipping-rates.md +4 -5
  149. package/skills/wix-manage/references/ecommerce/goal-increase-aov.md +1 -1
  150. package/skills/wix-manage/references/ecommerce/goal-reduce-cart-abandonment.md +1 -2
  151. package/skills/wix-manage/references/ecommerce/guardrail-shipping-health.md +2 -2
  152. package/skills/wix-manage/references/ecommerce/recipe-apply-shipping-recommendations.md +4 -5
  153. package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +7 -7
  154. package/skills/wix-manage/references/ecommerce/setup-discount-rules.md +209 -72
  155. package/skills/wix-manage/references/ecommerce/setup-store-pickup-location.md +9 -10
  156. package/skills/wix-manage/references/ecommerce/skill-graph.md +4 -4
  157. package/skills/wix-manage/references/forms/create-form.md +50 -0
  158. package/skills/wix-manage/references/stores/bulk-create-products-with-options.md +2 -0
  159. package/skills/wix-manage/references/stores/create-product-from-image.md +91 -38
  160. package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +2 -0
  161. package/skills/wix-app/references/custom-element-widget/default-thumbnail.png +0 -0
  162. package/skills/wix-app/references/data-collection/extension-template.ts +0 -107
  163. package/skills/wix-headless/references/ORCHESTRATION.md +0 -269
  164. package/skills/wix-headless/references/commands/install-app.md +0 -42
  165. package/skills/wix-headless/references/commands/mcp-bootstrap.md +0 -28
  166. package/skills/wix-headless/references/designer/INSTRUCTIONS.md +0 -828
  167. package/skills/wix-headless/references/shared/MCP_PREFIX.md +0 -105
  168. package/skills/wix-headless/scripts/copy-utility-templates.mjs +0 -153
  169. package/skills/wix-headless/scripts/finalize-run-json.mjs +0 -141
  170. package/skills/wix-headless/scripts/init-site-json.mjs +0 -63
  171. package/skills/wix-headless/scripts/preview.sh +0 -45
  172. package/skills/wix-headless/scripts/release.sh +0 -73
  173. package/skills/wix-headless/templates/ecom/components-ecom.css +0 -215
  174. package/skills/wix-manage/references/events/list-events.md +0 -203
  175. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartBadge.tsx +0 -0
  176. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartView.tsx +0 -0
  177. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/cart.astro +0 -0
  178. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/discounts.ts +0 -0
  179. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/thank-you.astro +0 -0
  180. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/GiftCardPurchase.tsx +0 -0
  181. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_home-teaser-snippet.astro +0 -0
  182. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_nav-snippet.astro +0 -0
  183. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/components-gift-cards.css +0 -0
  184. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.astro +0 -0
  185. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.ts +0 -0
  186. /package/skills/wix-headless/{templates → references/astro/templates}/stores/AddToCartButton.tsx +0 -0
  187. /package/skills/wix-headless/{templates → references/astro/templates}/stores/BackInStockForm.tsx +0 -0
  188. /package/skills/wix-headless/{templates → references/astro/templates}/stores/CategoryRail.astro +0 -0
  189. /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductCard.astro +0 -0
  190. /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductPurchase.tsx +0 -0
  191. /package/skills/wix-headless/{templates → references/astro/templates}/stores/SeoTags.astro +0 -0
  192. /package/skills/wix-headless/{templates → references/astro/templates}/stores/categories.ts +0 -0
  193. /package/skills/wix-headless/{templates → references/astro/templates}/stores/category/[slug].astro +0 -0
  194. /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/[slug].astro +0 -0
  195. /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/index.astro +0 -0
@@ -3,7 +3,7 @@
3
3
  //
4
4
  // Verifies that every file declared in each loaded pack's `creates:` array
5
5
  // for the named phase exists on disk. If a file is missing, attempts to
6
- // recover by copying the canonical template from <SKILL_ROOT>/templates/<pack>/.
6
+ // recover by copying the canonical template from <SKILL_ROOT>/references/astro/templates/<pack>/.
7
7
  // Outputs a JSON summary of present / recovered / errored files.
8
8
  //
9
9
  // Usage (both modes work):
@@ -11,9 +11,29 @@
11
11
  // curl -s https://dev.wix.com/skills/wix-headless/scripts/check-manifest.mjs \
12
12
  // | node --input-type=module - <project-dir> <phase> <packs-csv>
13
13
  //
14
- // <phase> ∈ { "components", "pages" }
14
+ // <phase> ∈ { "components", "pages", "integration" } (astro scaffold mode; integration = custom frontend)
15
15
  // <packs-csv> = comma-separated pack names (loaded verticals), e.g. "stores,ecom,cms"
16
16
  //
17
+ // Integration mode (frontend = "custom") — verify the CONNECTION, not pack files:
18
+ // node <SKILL_ROOT>/scripts/check-manifest.mjs <project-dir> integration <connection-plan.json> \
19
+ // [--build-output <dir>]
20
+ // where <connection-plan.json> is the connection-plan subagent's returned JSON
21
+ // ({ data: { bindingMap, augmentation, persistenceSwap } } or that object directly).
22
+ // Verifies the connection per the three connection kinds:
23
+ // - bindingMap (none/static) → each region's `file` now carries a Wix SDK script
24
+ // (createClient / @wix/sdk / OAuthStrategy)
25
+ // - augmentation (none/static) → each inject `file` has its component + SDK call
26
+ // (+ a <form> + createSubmission for form capabilities)
27
+ // - persistenceSwap (own/SPA) → each `sourceFile` carries a bundled @wix/sdk import
28
+ // AND a @wix/data CRUD call (items.query/insert/update/remove)
29
+ // …and the always-connect invariant: at least one connection of ANY kind exists.
30
+ // --build-output <dir>: for own-build SPAs, assert the build output dir exists and is
31
+ // non-empty. Run this form POST-BUILD (the dir doesn't exist until `npm run build`);
32
+ // run the plain form post-wiring/pre-build to verify the source connection. Catches the
33
+ // "published the un-built dev entry → 404" failure (SPA plan Break 4).
34
+ // Exit 1 if any claimed connection is missing, zero connections were made, or
35
+ // --build-output was given and the dir is missing/empty.
36
+ //
17
37
  // Note: `node <(curl ...)` does NOT work for .mjs files — Node sees /dev/fd/N
18
38
  // with no extension and rejects ESM syntax. Use the stdin form above.
19
39
  //
@@ -26,14 +46,14 @@
26
46
  // `creates:` array.
27
47
  // - For each `creates:` entry where phase matches:
28
48
  // * If file exists in the project → "present"
29
- // * If missing AND a template exists at `templates/<pack>/<tail>`
49
+ // * If missing AND a template exists at `references/astro/templates/<pack>/<tail>`
30
50
  // (where <tail> is the path under src/pages/ for page files, or the
31
51
  // basename for everything else) → copy/fetch it; record as "recovered".
32
52
  // * Otherwise → record as "missing" with a remediation hint.
33
53
  // - Exit 0 on happy path or recoverable misses.
34
54
  // - Exit 1 if any file is unrecoverably missing.
35
55
 
36
- import { readFileSync, writeFileSync, existsSync, mkdirSync, copyFileSync } from "node:fs";
56
+ import { readFileSync, writeFileSync, existsSync, mkdirSync, copyFileSync, readdirSync } from "node:fs";
37
57
  import { join, dirname, basename, resolve } from "node:path";
38
58
  import { fileURLToPath } from "node:url";
39
59
 
@@ -86,27 +106,144 @@ async function copySkillFile(relPath, destPath) {
86
106
  return true;
87
107
  }
88
108
 
89
- const [, , projectDir, phase, packsCsv] = process.argv;
109
+ // Integration-mode check: verify the connection plan was wired into the site.
110
+ async function checkIntegration(projectDir, planPath, buildOutputDir) {
111
+ if (!existsSync(planPath)) {
112
+ console.error(`check-manifest: connection plan not found at ${planPath}`);
113
+ process.exit(2);
114
+ }
115
+ let plan;
116
+ try {
117
+ plan = JSON.parse(readFileSync(planPath, "utf8"));
118
+ } catch (e) {
119
+ console.error(`check-manifest: could not parse connection plan JSON: ${e.message}`);
120
+ process.exit(2);
121
+ }
122
+ const data = plan.data ?? plan;
123
+ const bindingMap = Array.isArray(data.bindingMap) ? data.bindingMap : [];
124
+ const augmentation = Array.isArray(data.augmentation) ? data.augmentation : [];
125
+ const persistenceSwap = Array.isArray(data.persistenceSwap) ? data.persistenceSwap : [];
126
+
127
+ // A Wix SDK reference is present if the file imports @wix/sdk / calls createClient / OAuthStrategy.
128
+ // Matches BOTH the CDN form (`from "https://esm.sh/@wix/sdk"`) and the bundled form (`from "@wix/sdk"`).
129
+ const SDK_MARKER = /@wix\/sdk|createClient\s*\(|OAuthStrategy\s*\(/;
130
+ // A @wix/data CRUD call is present (persistence swap wired the data layer to the collection).
131
+ const DATA_MARKER = /@wix\/data|items\s*\.\s*(query|insert|update|remove)\s*\(|\.items\s*\.\s*(query|insert|update|remove)\s*\(/;
132
+ const fileHasSdk = (file) => {
133
+ const p = join(projectDir, file);
134
+ if (!existsSync(p)) return { exists: false, sdk: false, data: false, text: "" };
135
+ const text = readFileSync(p, "utf8");
136
+ return { exists: true, sdk: SDK_MARKER.test(text), data: DATA_MARKER.test(text), text };
137
+ };
138
+
139
+ const wired = [];
140
+ const missing = [];
141
+ let anySdk = false;
142
+
143
+ // (a) Each claimed binding-map region's file must now carry a Wix SDK script.
144
+ for (const r of bindingMap) {
145
+ if (!r.file) continue;
146
+ const { exists, sdk } = fileHasSdk(r.file);
147
+ if (exists && sdk) { anySdk = true; wired.push({ kind: "binding", file: r.file, anchor: r.anchor ?? null, entity: r.entity ?? null }); }
148
+ else missing.push({ kind: "binding", file: r.file, anchor: r.anchor ?? null, code: exists ? "REGION_NOT_WIRED" : "FILE_MISSING",
149
+ remediation: exists ? `no Wix SDK <script> found in ${r.file} for region ${r.anchor} — the wiring subagent did not connect it.` : `${r.file} not found in project.` });
150
+ }
151
+
152
+ // (b) Each augmentation's inject file must carry the SDK call (and a <form> for form capabilities).
153
+ for (const a of augmentation) {
154
+ const file = a.injectAt?.file;
155
+ if (!file) { missing.push({ kind: "augmentation", file: null, code: "NO_INJECT_FILE", remediation: `augmentation "${a.capability}" has no injectAt.file.` }); continue; }
156
+ const { exists, sdk, text } = fileHasSdk(file);
157
+ const isForm = /form/i.test(a.app ?? "") || /rsvp|lead|contact|form/i.test(a.capability ?? "") || (a.component ?? "").includes("form");
158
+ const formOk = !isForm || (/<form/i.test(text) && /createSubmission\s*\(/.test(text));
159
+ if (exists && sdk && formOk) { anySdk = true; wired.push({ kind: "augmentation", file, capability: a.capability ?? null, component: a.component ?? null }); }
160
+ else missing.push({ kind: "augmentation", file, capability: a.capability ?? null,
161
+ code: !exists ? "FILE_MISSING" : !sdk ? "AUGMENT_NOT_WIRED" : "FORM_NOT_INJECTED",
162
+ remediation: !exists ? `${file} not found.` : !sdk ? `no Wix SDK <script> in ${file} for the "${a.capability}" augmentation.` : `expected an injected <form> + createSubmission() in ${file} for "${a.capability}".` });
163
+ }
164
+
165
+ // (c) Each persistence swap's source file must carry the bundled SDK import AND a @wix/data CRUD call.
166
+ // (own-build SPAs: the data layer was rewritten in source — not a <script> injection.)
167
+ for (const s of persistenceSwap) {
168
+ const file = s.sourceFile;
169
+ if (!file) { missing.push({ kind: "persistenceSwap", file: null, code: "NO_SOURCE_FILE", remediation: `persistenceSwap entry has no sourceFile (the data-layer file to rewrite / fresh data module to write).` }); continue; }
170
+ const { exists, sdk, data: hasData } = fileHasSdk(file);
171
+ if (exists && sdk && hasData) { anySdk = true; wired.push({ kind: "persistenceSwap", file, collection: s.inferredShape?.collection ?? null }); }
172
+ else missing.push({ kind: "persistenceSwap", file,
173
+ code: !exists ? "FILE_MISSING" : !sdk ? "SDK_NOT_IMPORTED" : "DATA_NOT_WIRED",
174
+ remediation: !exists ? `${file} not found — the data layer was not rewritten / the fresh data module was not written.`
175
+ : !sdk ? `no @wix/sdk import in ${file} — the persistence swap must import createClient/OAuthStrategy (bundled, not CDN).`
176
+ : `no @wix/data CRUD call (items.query/insert/update/remove) in ${file} — the data layer still uses its old storage, not the Wix collection.` });
177
+ }
178
+
179
+ // (d) Always-connect invariant: at least one connection of ANY kind must exist.
180
+ const alwaysConnect = anySdk;
181
+ if (!alwaysConnect) {
182
+ missing.push({ kind: "invariant", code: "NO_CONNECTION", remediation: "ALWAYS-CONNECT VIOLATION: no Wix SDK connection found anywhere in the site. Integration mode must wire, augment, or persistence-swap at least one capability — a hosting-only release is not acceptable." });
183
+ }
184
+
185
+ // (e) Build-output assertion (own-build SPAs, post-build): the deployable dir must exist + be non-empty,
186
+ // so release publishes the built app — not the un-built dev entry that 404s in production.
187
+ let buildOutput = null;
188
+ if (buildOutputDir) {
189
+ const outPath = join(projectDir, buildOutputDir);
190
+ const ok = existsSync(outPath) && readdirSync(outPath).length > 0;
191
+ buildOutput = { dir: buildOutputDir, exists: ok };
192
+ if (!ok) missing.push({ kind: "buildOutput", file: buildOutputDir, code: "BUILD_OUTPUT_MISSING",
193
+ remediation: `build output dir "${buildOutputDir}" is missing or empty — run the project's own build (npm run build) before release and point wix.config.json.site.outputDirectory at it. Never publish the un-built source entry.` });
194
+ }
195
+
196
+ const summary = {
197
+ phase: "integration",
198
+ counts: { wired: wired.length, missing: missing.length, bindingRegions: bindingMap.length, augmentations: augmentation.length, persistenceSwaps: persistenceSwap.length },
199
+ alwaysConnect,
200
+ ...(buildOutput ? { buildOutput } : {}),
201
+ wired,
202
+ missing,
203
+ };
204
+ console.log(JSON.stringify(summary, null, 2));
205
+ process.exit(missing.length > 0 ? 1 : 0);
206
+ }
207
+
208
+ // Parse args: positionals + optional --build-output <dir> (integration only).
209
+ const argv = process.argv.slice(2);
210
+ const positionals = [];
211
+ let buildOutputDir = null;
212
+ for (let i = 0; i < argv.length; i++) {
213
+ const a = argv[i];
214
+ if (a === "--build-output") buildOutputDir = argv[++i];
215
+ else if (a.startsWith("--build-output=")) buildOutputDir = a.slice("--build-output=".length);
216
+ else positionals.push(a);
217
+ }
218
+ const [projectDir, phase, thirdArg] = positionals;
90
219
 
91
- if (!projectDir || !phase || !packsCsv) {
92
- console.error("usage: check-manifest.mjs <project-dir> <phase> <packs-csv>");
220
+ if (!projectDir || !phase || !thirdArg) {
221
+ console.error("usage: check-manifest.mjs <project-dir> <phase> <packs-csv | connection-plan.json> [--build-output <dir>]");
93
222
  process.exit(2);
94
223
  }
95
224
 
225
+ // --- Integration mode: verify the connection was actually wired into the site ---
226
+ if (phase === "integration") {
227
+ await checkIntegration(projectDir, thirdArg, buildOutputDir);
228
+ // checkIntegration exits the process.
229
+ }
230
+
96
231
  if (phase !== "components" && phase !== "pages") {
97
- console.error(`check-manifest: invalid phase "${phase}" — must be "components" or "pages"`);
232
+ console.error(`check-manifest: invalid phase "${phase}" — must be "components", "pages", or "integration"`);
98
233
  process.exit(2);
99
234
  }
100
235
 
236
+ const packsCsv = thirdArg;
237
+
101
238
  const packs = packsCsv.split(",").map((p) => p.trim()).filter(Boolean);
102
239
 
103
240
  // Map a `creates:` file path to its template path (relative to skill root).
104
- // Heuristic: `src/pages/<X>` preserves <X> under templates/<pack>/; everything
105
- // else uses basename only.
241
+ // Heuristic: `src/pages/<X>` preserves <X> under references/astro/templates/<pack>/;
242
+ // everything else uses basename only.
106
243
  function templateRelPath(packName, srcPath) {
107
244
  const pagesMatch = srcPath.match(/^src\/pages\/(.+)$/);
108
245
  const tail = pagesMatch ? pagesMatch[1] : basename(srcPath);
109
- return `templates/${packName}/${tail}`;
246
+ return `references/astro/templates/${packName}/${tail}`;
110
247
  }
111
248
 
112
249
  // Parse `creates:` block from a vertical pack's markdown frontmatter.