@wix/agent-skills 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/skills/wix-app/SKILL.md +49 -42
  4. package/skills/wix-app/references/BACKEND_EVENT.md +10 -65
  5. package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +101 -406
  6. package/skills/wix-app/references/DASHBOARD_MENU_PLUGIN.md +14 -111
  7. package/skills/wix-app/references/DASHBOARD_MODAL.md +56 -205
  8. package/skills/wix-app/references/DASHBOARD_PAGE.md +19 -98
  9. package/skills/wix-app/references/DASHBOARD_PLUGIN.md +6 -108
  10. package/skills/wix-app/references/DATA_COLLECTION.md +113 -198
  11. package/skills/wix-app/references/EMBEDDED_SCRIPT.md +41 -268
  12. package/skills/wix-app/references/EXTENSION_REGISTRATION.md +27 -76
  13. package/skills/wix-app/references/SERVICE_PLUGIN.md +35 -188
  14. package/skills/wix-app/references/SITE_PLUGIN.md +8 -92
  15. package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +0 -44
  16. package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +19 -330
  17. package/skills/wix-app/references/dashboard-menu-plugin/bookings-slots.md +0 -12
  18. package/skills/wix-app/references/dashboard-menu-plugin/ecommerce-slots.md +7 -0
  19. package/skills/wix-app/references/dashboard-menu-plugin/restaurants-slots.md +0 -12
  20. package/skills/wix-app/references/dashboard-plugin/SLOTS.md +3 -15
  21. package/skills/wix-app/references/service-plugin/ADDITIONAL-FEES.md +2 -18
  22. package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +2 -42
  23. package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +1 -11
  24. package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +1 -11
  25. package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +2 -40
  26. package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +2 -19
  27. package/skills/wix-app/references/service-plugin/VALIDATIONS.md +2 -18
  28. package/skills/wix-app/references/site-plugin/SLOTS.md +17 -68
  29. package/skills/wix-headless/SKILL.md +111 -389
  30. package/skills/wix-headless/references/BUILD.md +307 -0
  31. package/skills/wix-headless/references/DESIGN_SYSTEM.md +115 -0
  32. package/skills/wix-headless/references/DISCOVERY.md +237 -112
  33. package/skills/wix-headless/references/PLAN.md +82 -0
  34. package/skills/wix-headless/references/SEED.md +205 -0
  35. package/skills/wix-headless/references/SETUP.md +140 -134
  36. package/skills/wix-headless/references/astro/COMPOSE.md +142 -0
  37. package/skills/wix-headless/references/{blog → astro/blog}/BLOG_PAGES.md +1 -1
  38. package/skills/wix-headless/references/{blog → astro/blog}/BLOG_SETUP.md +2 -2
  39. package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +214 -0
  40. package/skills/wix-headless/references/{cms → astro/cms}/FAQ_KNOWLEDGE_BASE.md +6 -4
  41. package/skills/wix-headless/references/{cms → astro/cms}/PORTFOLIO.md +5 -5
  42. package/skills/wix-headless/references/{cms → astro/cms}/RESOURCE_LIBRARY.md +5 -5
  43. package/skills/wix-headless/references/{cms → astro/cms}/TEAM_DIRECTORY.md +5 -5
  44. package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +331 -0
  45. package/skills/wix-headless/references/{ecom → astro/ecom}/CART_PAGES.md +1 -1
  46. package/skills/wix-headless/references/{ecom → astro/ecom}/CART_WIRING.md +1 -1
  47. package/skills/wix-headless/references/{ecom → astro/ecom}/COMPONENTS_CSS.md +3 -3
  48. package/skills/wix-headless/references/{forms → astro/forms}/CONTACT_FORM.md +13 -13
  49. package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/COMPONENTS.md +1 -1
  50. package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/PAGES.md +1 -1
  51. package/skills/wix-headless/references/{stores → astro/stores}/BACK_IN_STOCK.md +1 -1
  52. package/skills/wix-headless/references/{stores → astro/stores}/CATEGORY_PAGES.md +12 -13
  53. package/skills/wix-headless/references/{stores → astro/stores}/COMPONENTS_CSS.md +4 -4
  54. package/skills/wix-headless/references/{stores → astro/stores}/HOME_AND_NAV.md +11 -9
  55. package/skills/wix-headless/references/{stores → astro/stores}/PRODUCT_PAGES.md +5 -3
  56. package/skills/wix-headless/references/{stores → astro/stores}/SHARED_WIRING.md +3 -3
  57. package/skills/wix-headless/references/astro/templates/Footer.astro +27 -0
  58. package/skills/wix-headless/references/astro/templates/Layout.astro +132 -0
  59. package/skills/wix-headless/references/astro/templates/Navigation.astro +38 -0
  60. package/skills/wix-headless/references/astro/templates/astro.config.mjs +41 -0
  61. package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +302 -0
  62. package/skills/wix-headless/references/astro/templates/global.css +286 -0
  63. package/skills/wix-headless/references/astro/templates/index.astro +56 -0
  64. package/skills/wix-headless/{templates → references/astro/templates}/stores/back-in-stock.ts +1 -1
  65. package/skills/wix-headless/{templates → references/astro/templates}/stores/components-stores.css +138 -33
  66. package/skills/wix-headless/references/blog/BLOG_CONTENT.md +10 -11
  67. package/skills/wix-headless/references/blog/INSTRUCTIONS.md +5 -5
  68. package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +31 -230
  69. package/skills/wix-headless/references/cms/INSTRUCTIONS.md +13 -8
  70. package/skills/wix-headless/references/custom/INSTRUCTIONS.md +38 -0
  71. package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +10 -10
  72. package/skills/wix-headless/references/forms/INSTRUCTIONS.md +5 -5
  73. package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +11 -11
  74. package/skills/wix-headless/references/images/INSTRUCTIONS.md +47 -50
  75. package/skills/wix-headless/references/seed-recipes.md +49 -0
  76. package/skills/wix-headless/references/shared/AUTHENTICATION.md +110 -0
  77. package/skills/wix-headless/references/shared/BUILD_NOISE.md +2 -2
  78. package/skills/wix-headless/references/shared/DOCS_SEARCH.md +41 -0
  79. package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +17 -17
  80. package/skills/wix-headless/references/shared/IMPLEMENTER.md +20 -29
  81. package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +1 -1
  82. package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +25 -16
  83. package/skills/wix-headless/references/shared/STYLING.md +47 -10
  84. package/skills/wix-headless/references/stores/INSTRUCTIONS.md +25 -25
  85. package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +17 -17
  86. package/skills/wix-headless/references/verticals/_schema.json +31 -117
  87. package/skills/wix-headless/references/verticals/_schema.md +60 -150
  88. package/skills/wix-headless/references/verticals/blog.md +5 -99
  89. package/skills/wix-headless/references/verticals/cms.md +9 -100
  90. package/skills/wix-headless/references/verticals/ecom.md +5 -76
  91. package/skills/wix-headless/references/verticals/forms.md +5 -85
  92. package/skills/wix-headless/references/verticals/gift-cards.md +6 -103
  93. package/skills/wix-headless/references/verticals/stores.md +10 -144
  94. package/skills/wix-headless/scripts/check-manifest.mjs +5 -5
  95. package/skills/wix-headless/scripts/emit-design-tokens.mjs +29 -23
  96. package/skills/wix-headless/scripts/init-site-json.mjs +59 -21
  97. package/skills/wix-headless/scripts/patch-decorative-slots.mjs +67 -43
  98. package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +3 -3
  99. package/skills/wix-headless/scripts/preview.sh +3 -3
  100. package/skills/wix-headless/scripts/release.sh +4 -4
  101. package/skills/wix-headless/scripts/scaffold.sh +75 -20
  102. package/skills/wix-headless/scripts/seed-utilities.sh +50 -12
  103. package/skills/wix-manage/SKILL.md +4 -8
  104. package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +2 -0
  105. package/skills/wix-manage/references/cms/cms-data-items-crud.md +4 -0
  106. package/skills/wix-manage/references/cms/cms-references-and-relationships.md +2 -0
  107. package/skills/wix-manage/references/cms/cms-schema-management.md +4 -0
  108. package/skills/wix-manage/references/ecommerce/api-shipping.md +443 -0
  109. package/skills/wix-manage/references/ecommerce/flow-add-free-shipping.md +5 -6
  110. package/skills/wix-manage/references/ecommerce/flow-fix-coverage-gaps.md +4 -5
  111. package/skills/wix-manage/references/ecommerce/flow-optimize-shipping-rates.md +4 -5
  112. package/skills/wix-manage/references/ecommerce/goal-increase-aov.md +1 -1
  113. package/skills/wix-manage/references/ecommerce/goal-reduce-cart-abandonment.md +1 -2
  114. package/skills/wix-manage/references/ecommerce/guardrail-shipping-health.md +2 -2
  115. package/skills/wix-manage/references/ecommerce/recipe-apply-shipping-recommendations.md +4 -5
  116. package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +7 -7
  117. package/skills/wix-manage/references/ecommerce/setup-discount-rules.md +209 -72
  118. package/skills/wix-manage/references/ecommerce/setup-store-pickup-location.md +9 -10
  119. package/skills/wix-manage/references/ecommerce/skill-graph.md +4 -4
  120. package/skills/wix-manage/references/forms/create-form.md +2 -0
  121. package/skills/wix-manage/references/stores/bulk-create-products-with-options.md +2 -0
  122. package/skills/wix-manage/references/stores/create-product-from-image.md +91 -38
  123. package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +2 -0
  124. package/skills/wix-app/references/custom-element-widget/default-thumbnail.png +0 -0
  125. package/skills/wix-app/references/data-collection/extension-template.ts +0 -107
  126. package/skills/wix-headless/references/ORCHESTRATION.md +0 -269
  127. package/skills/wix-headless/references/commands/install-app.md +0 -42
  128. package/skills/wix-headless/references/commands/mcp-bootstrap.md +0 -28
  129. package/skills/wix-headless/references/designer/INSTRUCTIONS.md +0 -828
  130. package/skills/wix-headless/references/shared/MCP_PREFIX.md +0 -105
  131. package/skills/wix-headless/scripts/copy-utility-templates.mjs +0 -153
  132. package/skills/wix-headless/templates/ecom/components-ecom.css +0 -215
  133. package/skills/wix-manage/references/events/list-events.md +0 -203
  134. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartBadge.tsx +0 -0
  135. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartView.tsx +0 -0
  136. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/cart.astro +0 -0
  137. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/discounts.ts +0 -0
  138. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/thank-you.astro +0 -0
  139. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/GiftCardPurchase.tsx +0 -0
  140. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_home-teaser-snippet.astro +0 -0
  141. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_nav-snippet.astro +0 -0
  142. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/components-gift-cards.css +0 -0
  143. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.astro +0 -0
  144. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.ts +0 -0
  145. /package/skills/wix-headless/{templates → references/astro/templates}/stores/AddToCartButton.tsx +0 -0
  146. /package/skills/wix-headless/{templates → references/astro/templates}/stores/BackInStockForm.tsx +0 -0
  147. /package/skills/wix-headless/{templates → references/astro/templates}/stores/CategoryRail.astro +0 -0
  148. /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductCard.astro +0 -0
  149. /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductPurchase.tsx +0 -0
  150. /package/skills/wix-headless/{templates → references/astro/templates}/stores/SeoTags.astro +0 -0
  151. /package/skills/wix-headless/{templates → references/astro/templates}/stores/categories.ts +0 -0
  152. /package/skills/wix-headless/{templates → references/astro/templates}/stores/category/[slug].astro +0 -0
  153. /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/[slug].astro +0 -0
  154. /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/index.astro +0 -0
@@ -1,187 +1,195 @@
1
1
  # Setup
2
2
 
3
- Runs once per session, immediately after plan approval. Establishes MCP connectivity, installs apps, pulls env, kicks off npm install in background, writes memory, creates the user-facing roadmap.
3
+ Runs once, immediately after the user approves the plan and Discovery has written `.wix/site.json`. This phase's domain is: install the apps the loaded packs declare, pull the Wix env, run `npm install`, and patch `site.json` with `siteId` + `appId`. Run flow (dispatch timing, background handles, waits, batching, transitions) is owned by `BUILD.md` (Setup is its first run-step).
4
4
 
5
- Target: **~15 seconds on the critical path** (everything after the MCP prefix discovery in Step 0 runs as a single concurrent batch).
5
+ This article covers the **astro (supported) entry path** — Steps 1–5 below + "npm install recovery". The orchestrator scaffolds a fresh Astro project via `scaffold.sh` in `BUILD.md` run-step 0; astro is the only frontend built on disk today.
6
6
 
7
- This article covers **two entry paths**:
7
+ The **Existing project flow (Path B)** at the bottom is **retired** — non-astro (custom) frontends route to the not-available-yet stub (`references/custom/INSTRUCTIONS.md`) instead of running E1–E6. That section is kept as a historical reference only; see its banner.
8
8
 
9
- 1. **New project flow** (the default — Sections "Step 0", "Setup Dispatch", "npm install recovery"). The orchestrator scaffolds a fresh Astro project via `scaffold.sh` in Discovery Step 1, then runs the dispatch below.
10
- 2. **Existing project flow** (see "Existing project flow" at the bottom). The user already has a working frontend (e.g. a Claude Design output, a hand-coded HTML/JSX site) and wants to **connect it** to Wix Headless to get hosting + Business Solutions. No scaffold, no Astro, no design/seed/pages waves — just connect, install needed apps, optionally wire SDK calls, release.
9
+ This path assumes DISCOVERY.md's CLI-auth pre-flight has already passed (the foreground check that runs before any `AskUserQuestion`).
11
10
 
12
- Both paths share **Step 0 (MCP bootstrap)**. Branch immediately after.
13
-
14
- > **Routing decision (do this BEFORE Step 0's dispatch).** Inspect the working directory:
15
- > - **Empty / non-existent / freshly-scaffolded** AND Discovery Step 1's `scaffold.sh` is what populated it → **New project flow** (continue with this article top-to-bottom).
16
- > - **Already contains source files** (`index.html`, `*.jsx`, `*.tsx`, `*.vue`, `package.json` from a non-Wix template, etc.) AND no scaffold was dispatched in Discovery → **Existing project flow** (jump to "Existing project flow" at the bottom; skip the Setup Dispatch).
17
- > - **Contains `wix.config.json`** AND an Astro project structure (`src/`, `astro.config.mjs`) → resume a prior wix-headless run (see `SKILL.md` § "When NOT to Use This Skill" — ask the user "continue or start fresh?").
18
- > - **Contains `wix.config.json`** AND a non-Astro frontend (`index.html` at root, `*.jsx` files) → already-`init`'d existing project; jump to "Existing project flow" § "After init" (skip the init step itself).
11
+ Mode/track routing (which path runs) is owned by `PLAN.md` § "Frontend-mode routing". Steps 1–5 below are the astro business steps.
19
12
 
20
13
  ---
21
14
 
22
- ## Step 0 — MCP Prefix Discovery + Schema Bootstrap (first time only)
15
+ ## Step 1 — Read the scaffolded project config (siteId + appId)
23
16
 
24
- Runs once per session, before any MCP call. Separate from the Setup step because it requires a sequential **discover prefix → verify connectivity → bootstrap schemas** chain.
17
+ **Do not** speculatively `Read <project-slug>/wix.config.json` before the scaffold exists — the speculative read returns `File does not exist` on every fast-Q&A run (the file isn't there yet), emits a `[MED]` anomaly in the trace, and costs 3–5 s of round-trip + recovery thinking.
25
18
 
26
- 1. **Discover the MCP prefix.** Wix MCP tool names take the form `<prefix>WixREADME`. Use whatever tool-discovery primitive your runtime provides to look up `WixREADME` and strip the trailing suffix from the returned tool name — the remainder (ending in `wix-mcp-remote__` or similar) is the **MCP prefix**.
27
- 2. Call `<prefix>WixREADME` once to verify connectivity.
28
- 3. If discovery returns no match or the verify call fails → stop and tell the user: *"Wix MCP tools are not available in this session. Please ensure the Wix MCP server is connected (or that the Wix plugin is enabled), then restart your client."*
29
- 4. **Pre-load Wix MCP tool schemas** — read `<SKILL_ROOT>/references/commands/mcp-bootstrap.md` and follow its single `ToolSearch` invocation. Loads every Wix MCP tool schema the build will use (CallWixSiteAPI, SearchWixRESTDocumentation, ReadFullDocsArticle, ReadFullDocsMethodSchema, SearchWixCLIDocumentation, SearchWixSDKDocumentation, SearchWixHeadlessDocumentation, SearchWixWDSDocumentation, SearchBuildAppsDocumentation, BrowseWixRESTDocsMenu).
30
- 5. Hold the prefix for the whole session. Pass it into **every** subagent prompt as:
31
- ```
32
- MCP tool prefix: <prefix>
33
- Use this prefix for every Wix MCP call. Example: <prefix>CallWixSiteAPI, <prefix>WixREADME.
34
- ```
19
+ Once the scaffolded project exists, read `<project-slug>/wix.config.json` and extract:
20
+ - `siteId` — the site id passed as `--site` to `npx @wix/cli@latest token` and embedded in every install body + as the `wix-site-id` header on every site-scoped REST call. Hold it in orchestrator session scratch.
21
+ - `appId` — the project's appId. Hold it in session scratch (it goes into the SDK's `createClient` inputs in later steps).
35
22
 
36
- See `references/shared/MCP_PREFIX.md` for the tool-not-found recovery procedure that subagents use if the prefix somehow fails downstream.
23
+ **Before `cd`, capture the current working directory as `<site-root>` and hold it in session scratch.** This is where Discovery's `init-site-json.mjs` wrote the slim `.wix/site.json` snapshot. The orchestrator is the **sole** reader/writer of that file; no subagent or downstream script reads it during the run. Hold `<site-root>` as an absolute path so the `cd` into the scaffold subdir below does not lose it.
37
24
 
38
- > **Why the MCP bootstrap is mandatory.** Without it, the first `CallWixSiteAPI` emits `body` as a JSON string (because the schema isn't loaded) and returns `Expected object, received string`. Pinning the schema-load list in `references/commands/mcp-bootstrap.md` and reading it as a discrete step makes the operation impossible to skim past — the orchestrator can skip a footnote; it can't skip a numbered step that resolves to a single concrete tool call.
25
+ `cd` into `<project-slug>/` so all subsequent file ops + shell calls (`npm`, `npx @wix/cli@latest env pull`) are relative to the project root.
39
26
 
40
27
  ---
41
28
 
42
- ## Setup Dispatch — one concurrent batch
29
+ ## Step 2 — Patch site.json with siteId + appId
43
30
 
44
- > **BATCHING — read this twice before proceeding.**
45
- >
46
- > Launch every operation below as a single concurrent batch. No narration, no *"Now setting up:"*, no transition text between dispatches.
47
- >
48
- > Any text adjacent to a dispatch closes the batch and forces remaining operations into separate turns. An earlier run lost 13s to roadmap-tracker calls splitting across 13 turns; an earlier run lost ~50 minutes to an npm install recovery gate. Both are eliminated by strict single-batch dispatch here.
31
+ Discovery wrote `<site-root>/.wix/site.json` with `brand`, `frontend`, and `verticals`. Setup's only addition is patching `siteId` and `appId` in. This is a one-shot in-process JSON edit:
49
32
 
50
- ### Contents of the setup dispatch
33
+ 1. `Read <site-root>/.wix/site.json` (absolute path — `<site-root>` was captured in Step 1, before the `cd` into the scaffold).
34
+ 2. Add the two top-level fields (`siteId`, `appId`) using the values held in session scratch.
35
+ 3. `Write` the updated file back to the same absolute path.
51
36
 
52
- The skill assembles this dispatch dynamically from the loaded vertical packs. The items below list what to emit.
37
+ The file's purpose at this point is **observability + resume detection** — no subagent reads it; the orchestrator is the sole reader/writer. Six lines of edit doesn't justify a script.
53
38
 
54
- #### 1. Verify scaffold completed
39
+ ---
55
40
 
56
- **Before the setup dispatch:** read `<project>/wix.config.json` to confirm the background scaffold from Discovery Step 1 finished. If not, wait for the background scaffold to finish. On scaffold failure, retry the inline `npm create @wix/new` call once (same shell command from DISCOVERY.md Step 1); surface the error if it still fails. Recovery ladder is documented in DISCOVERY.md § "Strict-then-recover" — auth, invalid template, etc.
41
+ ## Step 3 — Invoke the `wix-manage` skill
57
42
 
58
- Once `wix.config.json` exists, extract `siteId` (value of the `siteId` field — this is the businessId for all MCP calls in the session).
43
+ > **Default — just invoke it; do not deliberate.** **Always** invoke `Skill(name="wix-manage")` here. It is near-instant, and it is the *only* thing that both publishes `<wix-manage-root>` into scratch **and loads the recipe files into context** (which Step 4's installs and the whole Seed phase then reuse — SEED.md reads recipes relative to `<wix-manage-root>` and explicitly does **not** re-invoke). **Knowing the `wix-manage` directory path from an earlier `ls`/discovery is NOT a reason to skip the invocation** — a raw filesystem path is not the same as the skill being loaded (the recipes aren't in context). Do not weigh invoke-vs-skip; invoke. The only exception is the Missing-skill fallback below.
59
44
 
60
- `cd` into the project directory so all subsequent file operations and shell commands are relative to it.
45
+ App installation is delegated to `wix-manage`. Use the harness's skill-invocation primitive — in Claude Code that's `Skill(name="wix-manage")`; other harnesses provide an analogous mechanism. **Do not** hardcode a tool-call snippet here; the prose instruction "Invoke the `wix-manage` skill" is the contract, and the harness owns the mechanics. This mirrors `wix-app/SKILL.md:241` ("Invoke the `wix-design-system` skill") and keeps the skill agent-agnostic.
61
46
 
62
- #### 2. The dispatch itself (one concurrent batch)
47
+ After invocation, `wix-manage`'s SKILL.md is in context with absolute paths to its `references/<topic>/` files. Read its app-install recipe by absolute path:
63
48
 
64
- **MCP app installs** — one `<prefix>CallWixSiteAPI` per app in the union of loaded packs' `apps[*]`. Example for an ecommerce run (stores pack contributes one app; cms pack contributes none):
49
+ ```
50
+ Read <wix-manage-root>/references/app-installation/install-wix-apps.md
51
+ ```
52
+
53
+ > **Sequencing note.** Within Step 3, the `Skill` invocation must precede the `Read install-wix-apps.md` (the Read needs the absolute path that `wix-manage`'s SKILL.md publishes).
54
+
55
+ The recipe's Step 2 documents the body shape every Step 4 install call will use:
65
56
 
66
57
  ```
67
- <prefix>CallWixSiteAPI(
68
- siteId: "<siteId>",
69
- reason: "Install Wix Stores app for <brand>",
70
- sourceDocUrl: "https://dev.wix.com/docs/picasso/wix-ai-docs/recipes-v2/manage/platform/recipe-install-wix-apps",
71
- method: "POST",
72
- url: "https://www.wixapis.com/apps-installer-service/v1/app-instance/install",
73
- body: {
74
- tenant: { tenantType: "SITE", id: "<siteId>" },
75
- appInstance: { appDefId: "<pack.apps[0].appDefId>", enabled: true }
76
- }
77
- )
58
+ tenant: { tenantType: "SITE", id: "<siteId>" }
59
+ appInstance: { appDefId: "<pack.apps[N].appDefId>" }
78
60
  ```
79
61
 
80
- > The `CallWixSiteAPI` schema was already loaded by the Step 0 MCP bootstrap, so `body` is correctly typed as a JSON object on the first call. See `references/shared/MCP_PREFIX.md` § "CallWixSiteAPI call conventions".
62
+ Endpoint: `POST https://www.wixapis.com/apps-installer-service/v1/app-instance/install`.
81
63
 
82
- A 200 response with `"enabled": true` confirms success.
64
+ > **Recipe call shape.** Every loaded `wix-manage` recipe is authored in `curl` form. Build each call with the headers documented in `references/shared/AUTHENTICATION.md` (`Authorization: Bearer $TOKEN` + `wix-site-id: $SITE_ID` + `Content-Type: application/json`). The recipe's URL, method, and body are the source of truth — do not re-derive them.
83
65
 
84
- **Packs with `apps: []` (e.g. `cms`)** — record a phase entry in `run.json` anyway: `{phase: "app-install-<pack>", status: "skipped", notes: "Bundled with Wix platform; no install required"}`. Without an explicit skipped entry, `run.json` reads as a silent omission ("did the CMS install run? was it skipped? did it fail?"); the explicit entry makes observability unambiguous.
66
+ > **Missing-skill fallback (only when the `Skill` primitive fails).** This applies **only** when the skill-invocation primitive itself is unavailable — i.e. `wix-manage` is not installed in the current harness and the `Skill(name="wix-manage")` call errors. It is **not** a "use the path you already found" shortcut: a known directory path never justifies skipping the invocation (see the default above). When the invocation genuinely fails, fall back to the install **body shape** documented above (it is REST-shaped and stable; the recipe wraps it but does not transform it), and note the missing skill in the run digest. Do not silently substitute — the canonical entry point is `wix-manage`.
85
67
 
86
- **Namespace propagation:** After app install, the app's API namespace may take up to 30 seconds to register. If a downstream MCP call fails with `UNSUPPORTED_FORM_NAMESPACE`, wait 10 seconds and retry up to 3 times. Phase 1 Seeders handle this retry themselves.
68
+ ---
87
69
 
88
- **Shell: `npx @wix/cli env pull`** (foreground, ~5s). Writes `WIX_CLIENT_ID` to `.env.local`. Idempotent. Skipping this historically caused `Missing environment variable WIX_CLIENT_ID` build failures.
70
+ ## Step 4 — One concurrent batch
89
71
 
90
- **Background shell: `npm install ...`**:
72
+ > Fire 4a + 4b + 4c as a single concurrent batch — see `PLAN.md` § "Batching discipline".
91
73
 
92
- The package list is the union of:
93
- - Always: `@wix/sdk tailwindcss @tailwindcss/vite`
94
- - Per loaded pack: each pack's `packages` array
74
+ The dispatch contains three operations:
95
75
 
96
- > **Do not add any package beyond this set.** If a pack feels like it should have its own SDK (`@wix/<pack-name>`), confirm by reading its `packages:` array. Passive packs (gift-cards) intentionally declare nothing because they're runtime-detected via REST. There is no `@wix/gift-cards` SDK on npm — adding it on a hunch fails with `npm 404`. Same logic for any other pack: the union above is the install list. Period.
76
+ ### 4a. App installs — one `curl` per `pack.apps[*]` (business track, frontend-blind)
97
77
 
98
- Flags: `--no-fund --no-audit --legacy-peer-deps`. `--legacy-peer-deps` is mandatory (Wix SDK transitive peer conflicts). `--no-fund --no-audit` prevent interactive prompts that hang agent sessions.
78
+ This is **business-track** work: the install body is identical per `pack.apps[*]` regardless of the `frontend`/template — it registers Wix apps against the Site and never reads which frontend will consume them.
99
79
 
100
- Because scaffold runs with `--skip-install`, delete the stale lockfile before installing: `rm -f package-lock.json`.
80
+ Mint the site-scoped REST token once and cache it for the rest of the run, then iterate every loaded pack (top-level + transitive via `requires:`) and fire one `curl` per entry in the pack's `apps:` array:
101
81
 
102
- Example combined command (ecommerce run):
103
82
  ```bash
104
- rm -f package-lock.json && npm install --no-fund --no-audit --legacy-peer-deps \
105
- @wix/sdk tailwindcss @tailwindcss/vite \
106
- @wix/stores @wix/ecom @wix/redirects @wix/site \
107
- @wix/data @wix/essentials
83
+ SITE_ID="<siteId>"
84
+ TOKEN=$(npx @wix/cli@latest token --site "$SITE_ID") # once; cache in scratch for the run
85
+
86
+ # per-pack iteration; one curl per pack.apps[*]:
87
+ curl -sS -X POST "https://www.wixapis.com/apps-installer-service/v1/app-instance/install" \
88
+ -H "Authorization: Bearer $TOKEN" \
89
+ -H "wix-site-id: $SITE_ID" \
90
+ -H "Content-Type: application/json" \
91
+ -d '{
92
+ "tenant": { "tenantType": "SITE", "id": "'"$SITE_ID"'" },
93
+ "appInstance": { "appDefId": "<pack.apps[N].appDefId>", "enabled": true }
94
+ }'
108
95
  ```
109
96
 
110
- Capture the background process's handle (whatever your runtime uses to wait on a long-running shell) for later wait in Step 8 (Build & Preview).
97
+ Use `npx @wix/cli@latest token …` (not bare `wix token …`): `@wix/cli` may not be globally installed in every harness, and `npx` resolves to the project-local copy that scaffold just produced. The first invocation auto-fetches the CLI (~3–5 s) if missing; subsequent calls are instant.
98
+
99
+ A 200 response confirms the install. On 401/403, retry the same call once with the cached token per the recovery ladder in `references/shared/AUTHENTICATION.md` — do **not** re-mint (the token is byte-identical for the run); if it still fails, surface the response body — a persistent 401 usually means the CLI session expired and `wix login` is required.
100
+
101
+ **Packs with `apps: []` (e.g. `cms`, `ecom`):** skip the curl but record a phase entry as `{phase: "app-install-<pack>", status: "skipped", notes: "no app required for this pack"}` — the explicit skipped entry keeps run observability unambiguous.
111
102
 
112
- **Memory writes** — two writes:
113
- 1. `MEMORY.md` index entry (one line)
114
- 2. `project`-type memory file with brand, vertical(s), apps, pages, project path, phase: `scaffolding`
103
+ **Packs with `disabled: true` (today: `gift-cards`):** the pack still loads and contributes to the resolved set, but its `apps:` array is empty by design (the user opts in via the dashboard later). No curl. Same `skipped` phase entry as above.
115
104
 
116
- **User-facing roadmap × N** — target 6–8 entries mapped to phase boundaries:
105
+ ### 4b. `npx @wix/cli@latest env pull --json`
117
106
 
118
- | Entry | Marks completed |
119
- |------|-----------------|
120
- | Scaffold project | Immediately on creation (already done in Discovery) |
121
- | Install apps | Immediately on creation (this dispatch) |
122
- | Seed data | After Phase 1 Seed returns (Step 6) |
123
- | Design site | After Phase 2 Design System returns (Step 4) |
124
- | Generate images | After image subagent returns (may finish later than critical path) |
125
- | Wire features | After Phase 3 Components + Phase 4 Pages return (Step 7/8) |
126
- | Install dependencies | After npm install background shell completes (Step 8) |
127
- | Build and preview | After Step 8 |
107
+ Foreground shell, ~5 s. Writes `WIX_CLIENT_ID` to `.env.local`. Idempotent. Skipping this causes `Missing environment variable WIX_CLIENT_ID` build failures in downstream phases.
128
108
 
129
- > **No ampersands in roadmap titles.** Some progress trackers HTML-escape input — `"Build & preview"` renders as literal `Build &amp; preview`. Spell out "and" (or restructure) to avoid `&`. Same for `<`, `>`, `"` and other HTML-meaningful characters.
109
+ > **Always pass `--json`.** Without it the CLI renders an interactive spinner; captured through the tool's non-TTY pipe, every animation frame lands as a separate line of ANSI escapes (`\x1b[2K\x1b[1A…⠙ Pulling…`) and bloats the context for zero signal. `--json` selects the CLI's non-interactive render-to-string path (one clean `{"success": true}` line), and the skill doesn't parse this command's output anyway — it only needs `.env.local` on disk.
130
110
 
131
- > **Avoid the 13-entry sprawl.** Historical runs used one entry per phase-per-feature ("Design page — Home", "Seed stores", "Wire CMS", etc.). Collapse to the phase-boundary list above. Users care about milestones, not sub-phases.
111
+ ### 4c. Dispatch background `npm install`
132
112
 
133
- **Shell: `mkdir -p .wix`** — minimal. No `.wix/logs/`.
113
+ Run `npm install` as a backgrounded shell. Capture the handle as `npm_handle` and the path to `<npm-tempfile>`. Hold both in session scratch.
134
114
 
135
- ### Batching verification
115
+ ```bash
116
+ npm install --no-fund --no-audit --legacy-peer-deps <package-set> \
117
+ 2> <npm-tempfile>
118
+ # dispatched with run_in_background: true; capture as npm_handle
119
+ ```
136
120
 
137
- After the dispatch, the run log should show ~8–12 operations dispatched as one concurrent batch (varies by pack count). If they spread across multiple turns, the batching guidance failed and the skill needs to be tightened.
121
+ `<package-set>` is composed from the resolved pack set (loaded packs from Setup Step 1, including transitives via `requires:`):
122
+
123
+ | Always | Add when pack is loaded |
124
+ |---|---|
125
+ | `@wix/sdk tailwindcss @tailwindcss/vite` | — |
126
+ | | **stores** → `@wix/stores` |
127
+ | | **ecom** (loaded directly or as `requires:` of stores) → `@wix/ecom @wix/redirects` |
128
+ | | **blog** → `@wix/blog @wix/ricos @astrojs/rss @astrojs/sitemap` |
129
+ | | **forms** → `@wix/forms` |
130
+ | | **cms** → `@wix/data @wix/wix-data-items-sdk @wix/essentials` |
131
+ | | **gift-cards** → (none — disabled-by-default pack ships no Astro-time imports) |
132
+
133
+ Concrete example for the most common case (stores prompt; resolved set = stores + ecom + gift-cards + cms):
134
+ ```bash
135
+ npm install --no-fund --no-audit --legacy-peer-deps \
136
+ @wix/sdk @wix/stores @wix/ecom @wix/redirects \
137
+ @wix/data @wix/wix-data-items-sdk @wix/essentials \
138
+ tailwindcss @tailwindcss/vite \
139
+ 2> <npm-tempfile>
140
+ ```
141
+
142
+ > **Why three packages for cms?** `@wix/data` exposes collections / permissions / backups namespaces; the actual `items` API (used by every CMS page for queries) lives in `@wix/wix-data-items-sdk` since `@wix/data` 1.0.448 dropped the `items` re-export (see [astro/cms/CMS_FOUNDATIONS.md](./astro/cms/CMS_FOUNDATIONS.md) § "Import note"). `@wix/essentials` is required for `auth.elevate` — every CMS page elevates queries to bypass per-collection permission checks. Shipping only `@wix/data` produces `'items' is not exported by '@wix/data'` at `astro build`; shipping without `@wix/essentials` produces `Cannot find module '@wix/essentials'` at SSR time.
143
+
144
+ Per pre-flight S0.2, `pnpm install` fails against the `@wix/cli` template — use `npm install --legacy-peer-deps`.
145
+
146
+ **Why per-pack packages live here, not in pack frontmatter:** `references/verticals/_schema.md` is scoped to Discovery; it deliberately excludes `packages:` to keep that schema small. The install set is owned by SETUP.md instead — the lookup table above is the contract. **If you skip the per-pack additions and ship only the always-on three, `astro build` fails at Wave 5 with `Rollup failed to resolve import "@wix/stores"` (or whichever pack-side package the run depends on) and Setup's win on the foreground wall is paid back many times over in a recovery cycle.** When this happens, the build retries after an in-flight `npm install @wix/stores @wix/ecom`, costing ~30 s.
147
+
148
+ Do not invent packages beyond the table above. If a future vertical needs a new package, extend the table here.
138
149
 
139
150
  ---
140
151
 
141
- ## npm install recovery
152
+ ## Step 5 — Transition to Seed
142
153
 
143
- If the background npm install from the Setup dispatch fails or hangs:
154
+ Setup does not print a summary sentence. Setup ends once the Final-scan checks pass.
144
155
 
145
- 1. **Foreground retry with 90-second timeout:**
146
- ```bash
147
- npm install --no-fund --no-audit --legacy-peer-deps <packages>
148
- ```
156
+ ---
149
157
 
150
- 2. **If still hanging, retry with `--prefer-offline`:**
151
- ```bash
152
- npm install --prefer-offline --no-fund --no-audit --legacy-peer-deps <packages>
153
- ```
158
+ ## npm install recovery
154
159
 
155
- 3. **If still hanging, clear the cache:**
156
- ```bash
157
- npm cache clean --force
158
- npm install --no-fund --no-audit --legacy-peer-deps <packages>
159
- ```
160
+ Invoked when `npm_handle` returns non-zero. The handle is dispatched in Step 4c above; the orchestrator waits on it at the seed gate (`BUILD.md`) and runs this recovery ladder there if it failed.
161
+
162
+ If the background `npm install` fails or hangs:
160
163
 
161
- 4. **Last resort:** tell the user: *"npm install is hanging. Please run `npm install --legacy-peer-deps` manually in your terminal, then let me know when it's done."*
164
+ 1. **Foreground retry** with `npm install --no-fund --no-audit --legacy-peer-deps <packages>` (90 s timeout). If that hangs, add `--prefer-offline`; if still hanging, run `npm cache clean --force` and retry once more.
165
+ 2. **Last resort:** ask the user to run `npm install --legacy-peer-deps` manually and report back. Do not silently substitute pnpm/yarn — pre-flight S0.2 confirmed pnpm fails against the `@wix/cli` template.
166
+
167
+ The package set is the union of `@wix/sdk tailwindcss @tailwindcss/vite` (always) plus each loaded pack's frontmatter `packages:` array. The current pack frontmatter does not declare `packages:` blocks — vertical packs are discovery-only at this phase, so the install set is just the always-on three. Do not invent package names.
162
168
 
163
169
  ---
164
170
 
165
- ## After the Setup Dispatch
171
+ ## Final scan (MANDATORY)
166
172
 
167
- Proceed immediately to **Step 3 — Phase 1 Seed + Phase 2 Design System + Image Phase 1** — see `ORCHESTRATION.md`. Do not wait for the background npm install; that's waited on in Step 8.
173
+ Before transitioning to SEED.md in Step 5, verify: `siteId` + `appId` are in `.wix/site.json` (extracted from `wix.config.json`, both non-empty), the cached token mints, every loaded pack with `apps:` got a 200 OK (or a `skipped` phase entry for empty `apps:`), `.env.local` contains `WIX_CLIENT_ID`, and `npm_handle` was dispatched. If any check fails, surface the failure verbatim instead of transitioning to SEED.md.
168
174
 
169
175
  ---
170
176
 
171
- ## Existing project flow
177
+ ## Existing project flow (Path B) — RETIRED, historical reference only
178
+
179
+ > **⚠️ This flow is no longer dispatched.** Non-astro (custom) frontends now route to the **not-available-yet stub** (`references/custom/INSTRUCTIONS.md`); the conductor does not run E1–E6 (`PLAN.md` § "Custom (non-astro) frontends — not available yet", `DISCOVERY.md` § "Custom (non-astro) — not available yet"). The E1–E6 mechanics below — especially the **E4 SDK-wiring recipe** — are retained as the **historical reference / closest prior art** for the eventual custom authoring track (`references/custom/INSTRUCTIONS.md` § "Intended future shape" step 3). Do **not** dispatch this flow; it is documentation, not a live path.
172
180
 
173
- Use this path when the user already has a working frontend on disk (e.g. a Claude Design output, a Vite/React app, a hand-coded `index.html`) and wants to **connect it to Wix Headless** for hosting + Business Solutions. The user explicitly says things like *"connect this to Wix Headless"*, *"add Wix Headless to this project"*, or invokes a prompt that references `wix-headless.dev/skill.md`.
181
+ This path used to run when the user already had a working frontend on disk (Claude Design output, Vite/React app, hand-coded `index.html`) and wanted to **connect it to Wix Headless** for hosting + Business Solutions.
174
182
 
175
- **Differences from the new-project flow:**
183
+ **Differences from Path A:**
176
184
 
177
- | Aspect | New project | Existing project |
185
+ | Aspect | Path A (new project) | Path B (existing project) |
178
186
  |---|---|---|
179
187
  | Project creation | `npm create @wix/new@latest headless` (via `scaffold.sh`) — fresh Astro blank template | `npm create @wix/new@latest init` — wraps the existing project, leaves source untouched |
180
- | Frontend | Generated by Phases 2–5 (Astro + designer + components + pages) | Already exists; orchestrator does **not** generate UI |
181
- | Seeders / Designer / Pages waves | Run | **Skipped** — there is no Astro structure to populate |
182
- | App installs | From inferred vertical packs | From a quick **project analysis** (see below) — only apps the existing project actually needs |
183
- | SDK wiring into source | N/A (designer/pages waves write Astro + SDK calls from scratch) | **Required** — edit the project's existing source files in place to wire each installed app's SDK calls to its corresponding feature surface |
184
- | Build / release | `npx @wix/cli build` + `release` via `release.sh` | `npx @wix/cli release` directly — **no build step**; the existing `index.html` is published as-is |
188
+ | Frontend | Generated by Designer + Components + Pages subagents | Already exists; orchestrator does **not** generate UI |
189
+ | Seeders / Designer / Pages / BUILD | Run | **Skipped** — there is no Astro structure to populate |
190
+ | App installs | From inferred vertical packs | From a quick **project analysis** (see E2) — only apps the existing project actually needs |
191
+ | SDK wiring into source | N/A (subagents write Astro + SDK calls from scratch) | **Required (E4)** — edit the project's existing source files in place |
192
+ | Build / release | `npx @wix/cli@latest build` + `release` via `release.sh` | `npx @wix/cli@latest release` directly — **no build step**; existing `index.html` is published as-is |
185
193
  | Entry file | `src/pages/index.astro` (Astro convention) | **Must be `index.html`** at the configured `outputDirectory` |
186
194
 
187
195
  ### Step E1 — Init (replaces scaffold)
@@ -199,8 +207,8 @@ This creates a Wix Site + Headless Project (App) connected to that Site, and wri
199
207
  ```jsonc
200
208
  {
201
209
  "projectType": "Site",
202
- "appId": "16511cb9-3d3a-4371-a04a-bcc176ae5d50", // SDK clientId
203
- "siteId": "90b8c952-a7f9-4d79-a2c0-b0ec3e1c1434", // businessId for all MCP calls
210
+ "appId": "16511cb9-3d3a-4371-a04a-bcc176ae5d50", // SDK clientId
211
+ "siteId": "90b8c952-a7f9-4d79-a2c0-b0ec3e1c1434", // siteId for every REST call this session
204
212
  "site": {
205
213
  "outputDirectory": "./site" // edit to "./" if the entry file is at project root
206
214
  }
@@ -210,13 +218,13 @@ This creates a Wix Site + Headless Project (App) connected to that Site, and wri
210
218
  **Required follow-ups before continuing:**
211
219
 
212
220
  1. **Entry file must be `index.html`.** If the project's entry is `index.htm`, `main.html`, etc., either rename to `index.html` or ask the user to confirm renaming. Wix Headless hosting serves `index.html` as the site root; anything else 404s.
213
- 2. **`site.outputDirectory` must point at the directory containing `index.html`.** If `index.html` is at the project root, edit `wix.config.json` and set `"outputDirectory": "./"`. Default is `"./site"` which assumes a build output directory.
214
- 3. Extract `siteId` from `wix.config.json` — same role as in the new-project flow (businessId for every MCP call this session).
215
- 4. Capture timing as `{ phase: "init", seconds: <duration>, started, ended }` in `run.json.phases[]`.
221
+ 2. **`site.outputDirectory` must point at the directory containing `index.html`.** If `index.html` is at the project root, use the `Edit` tool on `wix.config.json` to set `"outputDirectory": "./"`. Default is `"./site"` which assumes a build output directory.
222
+ 3. Extract `siteId` and `appId` from `wix.config.json` and hold in session scratch (same role as Path A: `siteId` is the `wix-site-id` header on every REST call).
223
+ 4. Capture `{ phase: "init", seconds, started, ended }` in `run.json.phases[]`.
216
224
 
217
225
  Recovery ladder:
218
- - Auth error → surface `"Run \`npx @wix/cli login\` and retry."` and stop (same as new-project flow).
219
- - `init` already ran here (a `wix.config.json` already exists) → skip Step E1, continue to E2.
226
+ - Auth error → surface `"Run \`npx @wix/cli@latest login\` and retry."` and stop (same as Path A; full ladder in `references/shared/AUTHENTICATION.md`).
227
+ - `wix.config.json` already exists → skip E1, continue to E2.
220
228
  - Network / unknown → surface stderr to the user.
221
229
 
222
230
  ### Step E2 — Analyze the project to decide which apps to install
@@ -237,19 +245,19 @@ Read `index.html` and any top-level source files (`*.jsx`, `*.tsx`, `*.html`, `*
237
245
 
238
246
  > If unsure between two packs, ask the user with `AskUserQuestion`. Don't install everything "just in case" — every app install adds clutter to the user's dashboard.
239
247
 
240
- ### Step E3 — Install apps (reuse new-project flow's install mechanism)
248
+ ### Step E3 — Install apps
241
249
 
242
- For each pack identified in E2, follow `<SKILL_ROOT>/references/commands/install-app.md` — the `CallWixSiteAPI` body, `appName → appDefId` lookup, and recovery ladder are identical to the new-project flow. Capture `{ phase: "app-install-<appName>", seconds }` per install.
250
+ For each pack identified in E2, fire the install `curl` per § Step 4a above — same `tenant` / `appInstance` body, same headers, same recovery ladder (delegated to `wix-manage` per Step 3). Capture `{ phase: "app-install-<pack>", seconds }` per install.
243
251
 
244
- Skip the new-project flow's other Wave-2 operations: **no `env pull` is required** for a pure-static site (only needed if the project will call Wix SDK from server-side / build-time code), **no `npm install`** (the existing project manages its own deps), **no `seed-utilities.sh`** (no Astro `src/utils/` to seed), **no `init-site-json.mjs`** (no `.wix/site.json` lifecycle).
245
-
246
- > If the user wants to wire Wix SDK calls into the existing project (e.g. submit an RSVP form to a Wix CMS collection), then `env pull` + adding `@wix/sdk` + the relevant `@wix/<pack>` packages to the project's own `package.json` IS needed. Treat that as a follow-up sub-task per-pack and let the user confirm before modifying their `package.json`.
252
+ **Skip the rest of Path A's Step 4 batch:** no `env pull` for a pure-static site (only needed if E4 below adds SDK code that reads `WIX_CLIENT_ID` at build time; if so, run `env pull` then), **no `npm install`** (the existing project manages its own deps), **no `seed-utilities.sh`** (it is frontend-track project prep for a skill-scaffolded project; integrate mode has no such project and skips Seed entirely, so the orchestrator never calls it in this flow). `.wix/site.json` itself **was** written by Discovery's "After Approval" step with `frontend: "user-provided"` — that snapshot stays for observability; do not write it again here.
247
253
 
248
254
  ### Step E4 — SDK wiring
249
255
 
256
+ > **The custom frontend track is the long-term home for this step.** When the custom track is built, this SDK-wiring recipe becomes per-pack wiring guides under `references/custom/<pack>/…` that inject `@wix/sdk` calls into the user's existing files (additive-only) — see `references/custom/INSTRUCTIONS.md` § "Intended future shape" step 3. Until that lands, this inline recipe is the **historical reference** (the flow itself is retired — non-astro frontends route to the stub, see the banner at the top of this section).
257
+
250
258
  Installing apps in E3 only registers them against the Site — the existing frontend still ignores them until SDK calls are wired in. For each app installed in E3, find the matching feature surface in the project's source files (the same surfaces E2 detected) and wire its SDK calls inline.
251
259
 
252
- 1. Add `@wix/sdk` + the pack's `packages:` (from `references/verticals/<pack>.md`) to the project's `package.json` (`npm init -y` first if absent), then run the project's install command. `--no-fund --no-audit --legacy-peer-deps`.
260
+ 1. Add `@wix/sdk` + the pack's packages (from § Step 4c's lookup table above) to the project's `package.json` (`npm init -y` first if absent), then run the project's install command with `--no-fund --no-audit --legacy-peer-deps`.
253
261
  2. Edit the source files in place. Follow call patterns from `<SKILL_ROOT>/references/<pack>/INSTRUCTIONS.md` (translate Astro idioms → the project's framework; SDK calls themselves are framework-agnostic). Initialize the client once per file:
254
262
 
255
263
  ```js
@@ -266,12 +274,12 @@ Capture `{ phase: "sdk-wiring-<pack>", seconds }` per pack.
266
274
 
267
275
  ### Step E5 — Release (no build)
268
276
 
269
- **Do NOT run `release.sh`** in this flow — `release.sh` runs `npx @wix/cli build` first, and there is nothing to build. The existing project's `index.html` and its sibling assets already sit at the configured `site.outputDirectory`; Wix just needs to publish that directory as-is. Calling `build` here either no-ops (wastes ~5–15 s) or fails if the project has no Astro/Vite config the Wix CLI knows how to invoke.
277
+ **Do NOT run `release.sh`** in this flow — `release.sh` runs `npx @wix/cli@latest build` first, and there is nothing to build. The existing project's `index.html` and its sibling assets already sit at the configured `site.outputDirectory`; Wix just needs to publish that directory as-is. Calling `build` here either no-ops (wastes ~5–15 s) or fails if the project has no Astro/Vite config the Wix CLI knows how to invoke.
270
278
 
271
279
  Run release directly:
272
280
 
273
281
  ```bash
274
- npx @wix/cli release
282
+ npx @wix/cli@latest release
275
283
  ```
276
284
 
277
285
  Capture stdout. The CLI prints `Site published on <url>` on success — extract that URL (same parser logic as `release.sh` uses):
@@ -282,9 +290,9 @@ sed -nE 's/.*Site published on ([^[:space:]]+).*/\1/p'
282
290
 
283
291
  Capture `{ phase: "release", seconds }` around the call. No `{ phase: "build" }` entry in `run.json` for this flow.
284
292
 
285
- Auth-failure recovery: same as `release.sh` — if stderr mentions login, surface `"Run \`npx @wix/cli login\` and retry."` and stop. Transient errors (`ECONNRESET`, `temporarily unavailable`, etc.) — retry up to 3 times with `attempt * 5` second backoff, mirroring `release.sh`.
293
+ Auth-failure recovery: same as `release.sh` — if stderr mentions login, surface `"Run \`npx @wix/cli@latest login\` and retry."` and stop. Transient errors (`ECONNRESET`, `temporarily unavailable`, etc.) — retry up to 3 times with `attempt * 5` second backoff, mirroring `release.sh`.
286
294
 
287
- > **If the project needs a client build** (Vite, React, Webpack, etc.), run the project's own build command manually (e.g. `npm run build`) before `npx @wix/cli release`, and make sure `site.outputDirectory` points at the build output. Do not use `wix build`.
295
+ > **If the project needs a client build** (Vite, React, Webpack, etc.), run the project's own build command manually (e.g. `npm run build`) before `npx @wix/cli@latest release`, and make sure `site.outputDirectory` points at the build output. Do not use `wix build`.
288
296
 
289
297
  ### Step E6 — Final message
290
298
 
@@ -293,12 +301,10 @@ Emit **exactly two URLs**, both copy-pasted verbatim from tool output / config (
293
301
  1. **Production URL** — bold heading / link at the top. The exact string from `Site published on <url>` in Step E5's stdout. Do not retype or modify.
294
302
  2. **Dashboard URL** — `https://manage.wix.com/dashboard/<siteId>` where `<siteId>` is the value from `wix.config.json`.
295
303
 
296
- Skip the new-project flow's perf one-liner phases that didn't run (`design-system`, `images`, etc.). For Path B the perf line is:
304
+ Skip Path A's perf one-liner buckets that didn't run. For Path B the perf line is:
297
305
 
298
306
  > `Connected in <Nm Ss> — init <n>s · app-install <n>s · sdk-wiring <n>s · release <n>s`
299
307
 
300
308
  `sdk-wiring` aggregates every `sdk-wiring-<pack>` phase from E4.
301
309
 
302
310
  Write a `project`-type memory entry capturing brand (from `wix.config.json`'s implicit project name or ask), siteId, installed apps, and **phase: `connected-existing`** so future sessions know this is an existing-project shell, not a wix-headless-scaffolded build.
303
-
304
- ---
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: design-system-composer
3
+ description: "The Composer role of the wix-headless design-system phase. Applies the Designer's framework-agnostic design spec to the astro frontend by SUBSTITUTING into pinned skeletons at references/astro/templates/ — it does not re-author the fixed bulk. Maps semantic token values to the @theme vocabulary, writes the 6 design-system files (global.css, astro.config.mjs, Layout.astro, Navigation.astro, Footer.astro, index.astro), and owns the component-CSS token contract (every var(--token) a components-<pack>.css references must resolve). Returns a manifest."
4
+ ---
5
+
6
+ # Composer — how the design becomes code
7
+
8
+ You are the **Composer**. The Designer already decided *what the brand looks like* and returned it as a framework-agnostic spec. Your job is *how that becomes code* for the **astro** frontend: you map the spec onto the framework's token vocabulary and **substitute it into pinned skeletons**. You do **not** re-author the fixed bulk — the View-Transitions script, the view-transition / `.nav-progress` CSS, the `@utility btn` family, the `process.env` fix, the markers — all of that is literal in the skeletons. Read a skeleton, fill its `{{…}}` slots, write the file. Substitute; do not re-write.
9
+
10
+ This is deterministic work against pinned templates, so it is fast and low-variance. The whole reason the rewrite-from-scratch failure mode (which roughly doubled the old design-system wall) is gone is that you never regenerate the bulk.
11
+
12
+ > **Framework:** astro only. The skeletons live at `<SKILL_ROOT>/references/astro/templates/`. Custom (non-astro) frontends never reach the Composer — they route to the not-available-yet stub (`references/custom/INSTRUCTIONS.md`) before the build flow runs. If your prompt ever names a non-astro frontend, return `status: "failed"` with `errors: [{code: "FRONTEND_NOT_SUPPORTED"}]` — do not improvise a second framework.
13
+
14
+ ## Self-Loading
15
+
16
+ 1. Read `<SKILL_ROOT>/references/shared/RETURN_CONTRACT.md` — structured-return format.
17
+ 2. Read `<SKILL_ROOT>/references/shared/STYLING.md` — the three styling categories and, in particular, § "Required tokens — the component-CSS template contract" (the token set you must guarantee). You own that contract now.
18
+
19
+ No REST calls, no MCP — this is frontend-only work.
20
+
21
+ **Do NOT `Read .wix/site.json`.** Every input is inlined in your prompt.
22
+
23
+ ## Inputs (entirely from your prompt)
24
+
25
+ - **`designTokens`** — the Designer's spec (`colors`, `fonts`, `spacing`, `radii`, `containers`), bare-key form.
26
+ - **`shell`** — brand-voice strings: `heroHeadline`, `heroSub`, `footerTagline`, `navBrandMark`.
27
+ - **Brand** — `{ name, description }`.
28
+ - **Navigation links** — JSON array of `{href, label}`. Use labels **verbatim**.
29
+ - **Loaded packs**, **Packs with components**, **Disabled packs** — comma-joined lists.
30
+ - **Project directory** — the scaffold subdir (CWD).
31
+
32
+ ## What you write (the 6 files)
33
+
34
+ Read each skeleton from `<SKILL_ROOT>/references/astro/templates/`, substitute, write to the project. The fixed bulk in every skeleton is literal — change only the documented `{{…}}` slots.
35
+
36
+ > **Read skeletons by file, never the directory (`EISDIR`).** `Read <SKILL_ROOT>/references/astro/templates/` fails with `EISDIR: illegal operation on a directory` and costs a wasted recovery round-trip. Read each of the six by its exact path: `<SKILL_ROOT>/references/astro/templates/global.css`, `…/astro.config.mjs`, `…/Layout.astro`, `…/Navigation.astro`, `…/Footer.astro`, `…/index.astro` (issue the six `Read`s as one concurrent batch). If you must discover them first, `Glob` the directory (`…/templates/*`) — never `Read` it.
37
+
38
+ **Pre-write: scaffold may still be in flight.** A scaffold file you need (`Layout.astro` stub, `astro.config.mjs`) may not yet be present. Before reading one, if a `Read` returns "file does not exist", wait 5 s and retry, cap 6 attempts (~30 s). The 6-attempt cap is hard — do not check a 7th time; return `status: "failed"` with `errors: [{code: "SCAFFOLD_NOT_COMPLETE"}]` immediately on attempt 6's miss. (Reading the *skeletons* under `<SKILL_ROOT>` never needs this — they are always present.)
39
+
40
+ **Read each destination before you overwrite it.** The scaffold ships stubs for several of your six targets (today: `src/layouts/Layout.astro`, `src/pages/index.astro`, `astro.config.mjs`). The harness **blocks a `Write` to an existing file you have not `Read` this run** (`File has not been read yet`). So your batched reads must include the *destination* project paths for any file the scaffold created — not only the `<SKILL_ROOT>` skeletons. Practically: in the same concurrent batch, `Read` both the skeleton and the destination for `Layout.astro`, `index.astro`, and `astro.config.mjs` (the latter you read anyway to merge); `global.css`, `Navigation.astro`, and `Footer.astro` are net-new, so a destination read isn't required (but is harmless if the scaffold happens to ship them).
41
+
42
+ ### Token contract (do this first — it gates everything)
43
+
44
+ Map the Designer's `designTokens` into the `@theme` palette that goes in `global.css`, and **guarantee every required token resolves**. Per `STYLING.md` § "Required tokens", the `components-<pack>.css` templates reference a fixed set via `var(--token)`. Your `@theme` MUST declare all of:
45
+
46
+ - `--color-{paper,paper-warm,ink,mute,rule,accent}` (required), `--color-{ink-soft,cream,error}` (recommended).
47
+ - `--font-{display,body}`.
48
+ - the full `--spacing-{2xs,xs,sm,md,lg,xl,2xl,3xl,4xl}` scale.
49
+ - `--radius-{sm,md}` (required), `--radius-{lg,xl}` (recommended).
50
+ - a **container scale** separate from spacing: `--container-{prose,md,3xl,6xl}` minimum.
51
+
52
+ If the Designer's spec is missing a required role, **derive** a sensible value (e.g. `ink-soft` ≈ `ink` lightened, `paper-warm` ≈ `paper` warmed) rather than dropping the token — a missing required token renders components unstyled. Map each group with the fixed prefix: `colors.<k>` → `--color-<k>`, `fonts.<k>` → `--font-<k>`, `spacing.<k>` → `--spacing-<k>`, `radii.<k>` → `--radius-<k>`, `containers.<k>` → `--container-<k>`.
53
+
54
+ > **Container ≠ spacing.** Tailwind v4 maps `max-w-3xl` → `var(--container-3xl)`, not `var(--spacing-3xl)`. Never set a `--container-*` to a spacing value — a reading column is ~`42rem`, not `5rem`, or pages collapse to one word per line.
55
+
56
+ ### 1. `global.css`
57
+
58
+ Substitute the `{{theme}}` block in the skeleton with the `@theme` palette you built above — every `--color-*`, `--font-*`, `--spacing-*`, `--container-*`, `--radius-*` line. **Everything else in the skeleton is literal** (the `@utility container-reading`/`btn`, base layer, button family, decorative + site-shell + view-transition + nav-submenu + category-rail CSS). Do not add component-specific classes (`.product-card`, `.cart-summary`, …) — those live in `components-<pack>.css`, owned by Phase 3.
59
+
60
+ ### 2. `astro.config.mjs`
61
+
62
+ This is a **merge, not a clobber** — the scaffold's config varies. Read the scaffold's `astro.config.mjs` and apply exactly two mutations (the skeleton shows the target shape):
63
+ 1. Register the Tailwind v4 Vite plugin: `import tailwindcss from "@tailwindcss/vite";` and merge `tailwindcss()` into `vite.plugins` (preserve any existing `vite` settings — `server.allowedHosts`, etc.).
64
+ 2. Fix the bare `process.env` line (`const isBuild = process.env.NODE_ENV == "production";`) to the `globalThis` guard so strict `tsc --noEmit` passes without `@types/node`.
65
+
66
+ ### 3. `Layout.astro`
67
+
68
+ Fully replace the scaffold stub. Substitute:
69
+ - `{{components-css-imports}}` — one `import '../styles/components-<pack>.css';` per pack in **"Packs with components"**, in that order. Packs without components (e.g. `cms`) get **no** import — importing a file no agent writes breaks the build. If "Packs with components" is empty, remove the placeholder line entirely.
70
+ - `{{fonts.googleHref}}` — the Google Fonts stylesheet href for the chosen `display` + `body` families (e.g. `https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@...&family=Inter:wght@400;500;600&display=swap`). If both fonts are system fonts, remove the `<link rel="stylesheet">` line.
71
+ - `{{brand.name}}` — the default `<title>`.
72
+
73
+ The View-Transitions `<script>`, the `nav-progress` div, the `ClientRouter`, the `Props` interface, and the `hasSeoTags` pattern are **literal** — keep them.
74
+
75
+ ### 4. `Navigation.astro`
76
+
77
+ Substitute `{{shell.navBrandMark}}` and `{{nav.links}}` (one `<li class="site-nav-item"><a href={href}>{label}</a></li>` per inlined nav link, labels **verbatim** — no editorial rebrands like "Journal" for `/about`). Keep the `<!-- nav:links -->` marker, the empty `<div class="nav-actions">`, the `transition:persist`, and the hamburger literal. Do **not** add `/products`, cart, login, or account links — packs splice those at the marker in Phase 4.
78
+
79
+ ### 5. `Footer.astro`
80
+
81
+ Substitute `{{brand.name}}`, `{{shell.footerTagline}}`, and `{{nav.links}}` (mirror/subset of the same array, labels verbatim). Keep `transition:persist` literal.
82
+
83
+ ### 6. `index.astro`
84
+
85
+ Substitute `{{shell.heroHeadline}}`, `{{shell.heroSub}}`, `{{brand.name}}`, and `{{home-markers}}`. For `{{home-markers}}`, emit one `<!-- home:<pack> -->` marker per **loaded pack that contributes a home section** (today: `stores`, `gift-cards`). Emit a marker **only** for such packs — never one no pack will fill (no `<!-- home:cms -->`; CMS owns brand-story directly, which the skeleton already renders). Keep the hero + brand-story structure and both `data-decorative-slot` placeholders literal and **empty** (the orchestrator injects `<img>` after Image Phase 1).
86
+
87
+ ## Disabled-pack discipline
88
+
89
+ A pack in **"Disabled packs"** (today: only `gift-cards`) ships dormant. Its `<!-- home:<pack> -->` / `<!-- nav:links -->` markers are the **only** acceptable touchpoints. Do **not** add hero CTAs, footer links, brand-story callouts, or any other entry point pointing at a disabled pack's route — users click through to a feature that does not exist yet. Treat disabled packs as code-only: they appear in your marker emission, never in visible UI you author.
90
+
91
+ ## Self-checks before returning
92
+
93
+ 1. **Component-CSS imports.** For every pack in "Packs with components", grep your written `Layout.astro` for `components-<pack>.css`. If any is missing, add it. If unrecoverable, return `status: "partial"` with `errors: [{code: "MISSING_COMPONENT_CSS_IMPORT", pack: "<name>"}]`. (The orchestrator also re-verifies this after you return — at the seed gate — but catch it here.)
94
+ 2. **Required-token coverage.** Confirm every required token from the contract above is present in the `@theme` block you wrote. A missing one renders components unstyled.
95
+ 3. **Container vs spacing.** Confirm no `--container-*` was set to a spacing value.
96
+ 4. **Marker hygiene.** No marker emitted for a pack that does not contribute; both decorative slots present and empty.
97
+
98
+ If a check fails and you cannot fix it, return `status: "partial"` with the specific `errors` code rather than shipping silently.
99
+
100
+ ## Return contract
101
+
102
+ A single fenced JSON block per `<SKILL_ROOT>/references/shared/RETURN_CONTRACT.md`, last content in your message — a manifest of what you wrote:
103
+
104
+ ```json
105
+ {
106
+ "status": "complete",
107
+ "phase": "compose",
108
+ "data": {
109
+ "filesWritten": [
110
+ "src/styles/global.css",
111
+ "astro.config.mjs",
112
+ "src/layouts/Layout.astro",
113
+ "src/components/Navigation.astro",
114
+ "src/components/Footer.astro",
115
+ "src/pages/index.astro"
116
+ ],
117
+ "componentCssImports": ["stores", "ecom"],
118
+ "homeMarkers": ["home:stores"],
119
+ "tokensApplied": { "colors": 9, "spacing": 9, "containers": 4, "radii": 2, "fonts": 2 }
120
+ },
121
+ "files": [ "...same as filesWritten..." ]
122
+ }
123
+ ```
124
+
125
+ No trailing prose after the closing fence.
126
+
127
+ ## Anti-patterns
128
+
129
+ | WRONG | CORRECT |
130
+ |---|---|
131
+ | Re-author the View-Transitions script, btn family, or view-transition CSS | Keep the skeleton bulk literal; substitute only `{{…}}` slots |
132
+ | Rewrite `global.css` from scratch to "clean it up" | Substitute `{{theme}}`; the rest is pinned (this is the variance win) |
133
+ | Overwrite `astro.config.mjs` with the skeleton verbatim | Merge the two mutations into the scaffold's own config |
134
+ | `import '../styles/components-cms.css'` (cms has no components) | One import only per pack in "Packs with components" |
135
+ | Drop a required token because the Designer omitted it | Derive a sensible value — required tokens must resolve |
136
+ | Set `--container-3xl` to `--spacing-3xl`'s value | Containers are widths (~`42rem`+), a separate axis from spacing |
137
+ | Coin label rebrands ("Journal" → /about) or add `/products`/cart links | Nav labels verbatim; packs splice their links at the marker |
138
+ | Add a hero CTA / footer link to a disabled-pack route | Disabled packs are code-only — markers are the sole touchpoint |
139
+ | Emit `<!-- home:cms -->` or a marker for a non-contributing pack | One marker per contributing loaded pack only |
140
+ | `Read <SKILL_ROOT>/references/astro/templates/` (the directory) | `EISDIR` — Read each of the six skeletons by its exact file path (batch the six Reads); `Glob` if you must discover them |
141
+ | `Read .wix/site.json` for brand/tokens | Every input is inlined in your prompt |
142
+ | Branch to a non-astro / custom frontend | astro only; return `FRONTEND_NOT_SUPPORTED` otherwise |
@@ -296,4 +296,4 @@ export async function GET(context) {
296
296
  }
297
297
  ```
298
298
 
299
- > Requires the `site` property in `astro.config.mjs` (set in BLOG_SETUP.md step 1).
299
+ > Requires the `site` property in `astro.config.mjs` (set in BLOG_SETUP.md step 1).