@wix/agent-skills 1.5.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.
- package/README.md +2 -2
- package/package.json +1 -1
- package/skills/wix-app/SKILL.md +49 -42
- package/skills/wix-app/references/BACKEND_EVENT.md +10 -65
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +101 -406
- package/skills/wix-app/references/DASHBOARD_MENU_PLUGIN.md +14 -111
- package/skills/wix-app/references/DASHBOARD_MODAL.md +56 -205
- package/skills/wix-app/references/DASHBOARD_PAGE.md +19 -98
- package/skills/wix-app/references/DASHBOARD_PLUGIN.md +6 -108
- package/skills/wix-app/references/DATA_COLLECTION.md +113 -198
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +15 -1
- package/skills/wix-app/references/EMBEDDED_SCRIPT.md +41 -268
- package/skills/wix-app/references/EXTENSION_REGISTRATION.md +27 -76
- package/skills/wix-app/references/SERVICE_PLUGIN.md +35 -188
- package/skills/wix-app/references/SITE_PLUGIN.md +8 -92
- package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +0 -44
- package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +19 -330
- package/skills/wix-app/references/dashboard-menu-plugin/bookings-slots.md +0 -12
- package/skills/wix-app/references/dashboard-menu-plugin/ecommerce-slots.md +7 -0
- package/skills/wix-app/references/dashboard-menu-plugin/restaurants-slots.md +0 -12
- package/skills/wix-app/references/dashboard-plugin/SLOTS.md +3 -15
- package/skills/wix-app/references/data-collection/WIX_DATA.md +1 -1
- package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +1 -1
- package/skills/wix-app/references/service-plugin/ADDITIONAL-FEES.md +2 -18
- package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +2 -42
- package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +1 -11
- package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +1 -11
- package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +2 -40
- package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +2 -19
- package/skills/wix-app/references/service-plugin/VALIDATIONS.md +2 -18
- package/skills/wix-app/references/site-plugin/SLOTS.md +17 -68
- package/skills/wix-headless/SKILL.md +112 -368
- package/skills/wix-headless/references/BUILD.md +307 -0
- package/skills/wix-headless/references/DESIGN_SYSTEM.md +115 -0
- package/skills/wix-headless/references/DISCOVERY.md +237 -112
- package/skills/wix-headless/references/PLAN.md +82 -0
- package/skills/wix-headless/references/SEED.md +205 -0
- package/skills/wix-headless/references/SETUP.md +250 -94
- package/skills/wix-headless/references/astro/COMPOSE.md +142 -0
- package/skills/wix-headless/references/{blog → astro/blog}/BLOG_PAGES.md +1 -1
- package/skills/wix-headless/references/{blog → astro/blog}/BLOG_SETUP.md +2 -2
- package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +214 -0
- package/skills/wix-headless/references/{cms → astro/cms}/FAQ_KNOWLEDGE_BASE.md +6 -4
- package/skills/wix-headless/references/{cms → astro/cms}/PORTFOLIO.md +5 -5
- package/skills/wix-headless/references/{cms → astro/cms}/RESOURCE_LIBRARY.md +5 -5
- package/skills/wix-headless/references/{cms → astro/cms}/TEAM_DIRECTORY.md +5 -5
- package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +331 -0
- package/skills/wix-headless/references/{ecom → astro/ecom}/CART_PAGES.md +1 -1
- package/skills/wix-headless/references/{ecom → astro/ecom}/CART_WIRING.md +1 -1
- package/skills/wix-headless/references/{ecom → astro/ecom}/COMPONENTS_CSS.md +3 -3
- package/skills/wix-headless/references/{forms → astro/forms}/CONTACT_FORM.md +13 -13
- package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/COMPONENTS.md +1 -1
- package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/PAGES.md +1 -1
- package/skills/wix-headless/references/{stores → astro/stores}/BACK_IN_STOCK.md +1 -1
- package/skills/wix-headless/references/{stores → astro/stores}/CATEGORY_PAGES.md +12 -13
- package/skills/wix-headless/references/{stores → astro/stores}/COMPONENTS_CSS.md +4 -4
- package/skills/wix-headless/references/{stores → astro/stores}/HOME_AND_NAV.md +11 -9
- package/skills/wix-headless/references/{stores → astro/stores}/PRODUCT_PAGES.md +5 -3
- package/skills/wix-headless/references/{stores → astro/stores}/SHARED_WIRING.md +3 -3
- package/skills/wix-headless/references/astro/templates/Footer.astro +27 -0
- package/skills/wix-headless/references/astro/templates/Layout.astro +132 -0
- package/skills/wix-headless/references/astro/templates/Navigation.astro +38 -0
- package/skills/wix-headless/references/astro/templates/astro.config.mjs +41 -0
- package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +302 -0
- package/skills/wix-headless/references/astro/templates/global.css +286 -0
- package/skills/wix-headless/references/astro/templates/index.astro +56 -0
- package/skills/wix-headless/{templates → references/astro/templates}/stores/back-in-stock.ts +1 -1
- package/skills/wix-headless/{templates → references/astro/templates}/stores/components-stores.css +138 -33
- package/skills/wix-headless/references/blog/BLOG_CONTENT.md +10 -11
- package/skills/wix-headless/references/blog/INSTRUCTIONS.md +5 -5
- package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +31 -230
- package/skills/wix-headless/references/cms/INSTRUCTIONS.md +13 -8
- package/skills/wix-headless/references/custom/INSTRUCTIONS.md +38 -0
- package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +10 -10
- package/skills/wix-headless/references/forms/INSTRUCTIONS.md +5 -5
- package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +11 -11
- package/skills/wix-headless/references/images/INSTRUCTIONS.md +47 -50
- package/skills/wix-headless/references/seed-recipes.md +49 -0
- package/skills/wix-headless/references/shared/AUTHENTICATION.md +110 -0
- package/skills/wix-headless/references/shared/BUILD_NOISE.md +2 -2
- package/skills/wix-headless/references/shared/DOCS_SEARCH.md +41 -0
- package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +17 -17
- package/skills/wix-headless/references/shared/IMPLEMENTER.md +20 -29
- package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +1 -1
- package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +25 -16
- package/skills/wix-headless/references/shared/STYLING.md +47 -10
- package/skills/wix-headless/references/stores/INSTRUCTIONS.md +25 -25
- package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +17 -17
- package/skills/wix-headless/references/verticals/_schema.json +31 -117
- package/skills/wix-headless/references/verticals/_schema.md +60 -150
- package/skills/wix-headless/references/verticals/blog.md +5 -99
- package/skills/wix-headless/references/verticals/cms.md +9 -100
- package/skills/wix-headless/references/verticals/ecom.md +5 -76
- package/skills/wix-headless/references/verticals/forms.md +5 -85
- package/skills/wix-headless/references/verticals/gift-cards.md +6 -103
- package/skills/wix-headless/references/verticals/stores.md +10 -144
- package/skills/wix-headless/scripts/check-manifest.mjs +5 -5
- package/skills/wix-headless/scripts/emit-design-tokens.mjs +29 -23
- package/skills/wix-headless/scripts/init-site-json.mjs +59 -21
- package/skills/wix-headless/scripts/patch-decorative-slots.mjs +67 -43
- package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +3 -3
- package/skills/wix-headless/scripts/preview.sh +3 -3
- package/skills/wix-headless/scripts/release.sh +4 -4
- package/skills/wix-headless/scripts/scaffold.sh +75 -20
- package/skills/wix-headless/scripts/seed-utilities.sh +50 -12
- package/skills/wix-manage/SKILL.md +4 -8
- package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +70 -1
- package/skills/wix-manage/references/cms/cms-data-items-crud.md +4 -0
- package/skills/wix-manage/references/cms/cms-references-and-relationships.md +2 -0
- package/skills/wix-manage/references/cms/cms-schema-management.md +4 -0
- package/skills/wix-manage/references/ecommerce/api-shipping.md +443 -0
- package/skills/wix-manage/references/ecommerce/flow-add-free-shipping.md +5 -6
- package/skills/wix-manage/references/ecommerce/flow-fix-coverage-gaps.md +4 -5
- package/skills/wix-manage/references/ecommerce/flow-optimize-shipping-rates.md +4 -5
- package/skills/wix-manage/references/ecommerce/goal-increase-aov.md +1 -1
- package/skills/wix-manage/references/ecommerce/goal-reduce-cart-abandonment.md +1 -2
- package/skills/wix-manage/references/ecommerce/guardrail-shipping-health.md +2 -2
- package/skills/wix-manage/references/ecommerce/recipe-apply-shipping-recommendations.md +4 -5
- package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +7 -7
- package/skills/wix-manage/references/ecommerce/setup-discount-rules.md +209 -72
- package/skills/wix-manage/references/ecommerce/setup-store-pickup-location.md +9 -10
- package/skills/wix-manage/references/ecommerce/skill-graph.md +4 -4
- package/skills/wix-manage/references/forms/create-form.md +2 -0
- package/skills/wix-manage/references/stores/bulk-create-products-with-options.md +2 -0
- package/skills/wix-manage/references/stores/create-product-from-image.md +91 -38
- package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +14 -7
- package/skills/wix-app/references/data-collection/extension-template.ts +0 -107
- package/skills/wix-headless/references/ORCHESTRATION.md +0 -269
- package/skills/wix-headless/references/commands/install-app.md +0 -42
- package/skills/wix-headless/references/commands/mcp-bootstrap.md +0 -28
- package/skills/wix-headless/references/designer/INSTRUCTIONS.md +0 -828
- package/skills/wix-headless/references/shared/MCP_PREFIX.md +0 -105
- package/skills/wix-headless/scripts/copy-utility-templates.mjs +0 -153
- package/skills/wix-headless/templates/ecom/components-ecom.css +0 -215
- package/skills/wix-manage/references/events/list-events.md +0 -203
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartBadge.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartView.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/cart.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/discounts.ts +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/thank-you.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/GiftCardPurchase.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_home-teaser-snippet.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_nav-snippet.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/components-gift-cards.css +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.ts +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/AddToCartButton.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/BackInStockForm.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/CategoryRail.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductCard.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductPurchase.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/SeoTags.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/categories.ts +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/category/[slug].astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/[slug].astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/index.astro +0 -0
|
@@ -1,154 +1,310 @@
|
|
|
1
1
|
# Setup
|
|
2
2
|
|
|
3
|
-
Runs once
|
|
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
|
-
|
|
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
|
+
|
|
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
|
+
|
|
9
|
+
This path assumes DISCOVERY.md's CLI-auth pre-flight has already passed (the foreground check that runs before any `AskUserQuestion`).
|
|
10
|
+
|
|
11
|
+
Mode/track routing (which path runs) is owned by `PLAN.md` § "Frontend-mode routing". Steps 1–5 below are the astro business steps.
|
|
6
12
|
|
|
7
13
|
---
|
|
8
14
|
|
|
9
|
-
## Step
|
|
15
|
+
## Step 1 — Read the scaffolded project config (siteId + appId)
|
|
10
16
|
|
|
11
|
-
|
|
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.
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
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).
|
|
17
|
-
5. Hold the prefix for the whole session. Pass it into **every** subagent prompt as:
|
|
18
|
-
```
|
|
19
|
-
MCP tool prefix: <prefix>
|
|
20
|
-
Use this prefix for every Wix MCP call. Example: <prefix>CallWixSiteAPI, <prefix>WixREADME.
|
|
21
|
-
```
|
|
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).
|
|
22
22
|
|
|
23
|
-
|
|
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.
|
|
24
24
|
|
|
25
|
-
|
|
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.
|
|
26
26
|
|
|
27
27
|
---
|
|
28
28
|
|
|
29
|
-
##
|
|
29
|
+
## Step 2 — Patch site.json with siteId + appId
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
>
|
|
33
|
-
> Launch every operation below as a single concurrent batch. No narration, no *"Now setting up:"*, no transition text between dispatches.
|
|
34
|
-
>
|
|
35
|
-
> 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:
|
|
36
32
|
|
|
37
|
-
|
|
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.
|
|
38
36
|
|
|
39
|
-
The
|
|
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.
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
---
|
|
42
40
|
|
|
43
|
-
|
|
41
|
+
## Step 3 — Invoke the `wix-manage` skill
|
|
44
42
|
|
|
45
|
-
|
|
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.
|
|
46
44
|
|
|
47
|
-
`
|
|
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.
|
|
48
46
|
|
|
49
|
-
|
|
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:
|
|
50
48
|
|
|
51
|
-
|
|
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:
|
|
52
56
|
|
|
53
57
|
```
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
reason: "Install Wix Stores app for <brand>",
|
|
57
|
-
sourceDocUrl: "https://dev.wix.com/docs/picasso/wix-ai-docs/recipes-v2/manage/platform/recipe-install-wix-apps",
|
|
58
|
-
method: "POST",
|
|
59
|
-
url: "https://www.wixapis.com/apps-installer-service/v1/app-instance/install",
|
|
60
|
-
body: {
|
|
61
|
-
tenant: { tenantType: "SITE", id: "<siteId>" },
|
|
62
|
-
appInstance: { appDefId: "<pack.apps[0].appDefId>", enabled: true }
|
|
63
|
-
}
|
|
64
|
-
)
|
|
58
|
+
tenant: { tenantType: "SITE", id: "<siteId>" }
|
|
59
|
+
appInstance: { appDefId: "<pack.apps[N].appDefId>" }
|
|
65
60
|
```
|
|
66
61
|
|
|
67
|
-
|
|
62
|
+
Endpoint: `POST https://www.wixapis.com/apps-installer-service/v1/app-instance/install`.
|
|
68
63
|
|
|
69
|
-
|
|
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.
|
|
70
65
|
|
|
71
|
-
**
|
|
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`.
|
|
72
67
|
|
|
73
|
-
|
|
68
|
+
---
|
|
74
69
|
|
|
75
|
-
|
|
70
|
+
## Step 4 — One concurrent batch
|
|
76
71
|
|
|
77
|
-
|
|
72
|
+
> Fire 4a + 4b + 4c as a single concurrent batch — see `PLAN.md` § "Batching discipline".
|
|
78
73
|
|
|
79
|
-
The
|
|
80
|
-
- Always: `@wix/sdk tailwindcss @tailwindcss/vite`
|
|
81
|
-
- Per loaded pack: each pack's `packages` array
|
|
74
|
+
The dispatch contains three operations:
|
|
82
75
|
|
|
83
|
-
|
|
76
|
+
### 4a. App installs — one `curl` per `pack.apps[*]` (business track, frontend-blind)
|
|
84
77
|
|
|
85
|
-
|
|
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.
|
|
86
79
|
|
|
87
|
-
|
|
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:
|
|
88
81
|
|
|
89
|
-
Example combined command (ecommerce run):
|
|
90
82
|
```bash
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
+
}'
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
|
|
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.
|
|
98
102
|
|
|
99
|
-
**
|
|
100
|
-
1. `MEMORY.md` index entry (one line)
|
|
101
|
-
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.
|
|
102
104
|
|
|
103
|
-
|
|
105
|
+
### 4b. `npx @wix/cli@latest env pull --json`
|
|
104
106
|
|
|
105
|
-
|
|
106
|
-
|------|-----------------|
|
|
107
|
-
| Scaffold project | Immediately on creation (already done in Discovery) |
|
|
108
|
-
| Install apps | Immediately on creation (this dispatch) |
|
|
109
|
-
| Seed data | After Phase 1 Seed returns (Step 6) |
|
|
110
|
-
| Design site | After Phase 2 Design System returns (Step 4) |
|
|
111
|
-
| Generate images | After image subagent returns (may finish later than critical path) |
|
|
112
|
-
| Wire features | After Phase 3 Components + Phase 4 Pages return (Step 7/8) |
|
|
113
|
-
| Install dependencies | After npm install background shell completes (Step 8) |
|
|
114
|
-
| 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.
|
|
115
108
|
|
|
116
|
-
> **
|
|
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.
|
|
117
110
|
|
|
118
|
-
|
|
111
|
+
### 4c. Dispatch background `npm install`
|
|
119
112
|
|
|
120
|
-
|
|
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.
|
|
114
|
+
|
|
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
|
+
```
|
|
120
|
+
|
|
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
|
+
```
|
|
121
141
|
|
|
122
|
-
|
|
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.
|
|
123
143
|
|
|
124
|
-
|
|
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.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Step 5 — Transition to Seed
|
|
153
|
+
|
|
154
|
+
Setup does not print a summary sentence. Setup ends once the Final-scan checks pass.
|
|
125
155
|
|
|
126
156
|
---
|
|
127
157
|
|
|
128
158
|
## npm install recovery
|
|
129
159
|
|
|
130
|
-
|
|
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.
|
|
131
161
|
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
npm install --no-fund --no-audit --legacy-peer-deps <packages>
|
|
135
|
-
```
|
|
162
|
+
If the background `npm install` fails or hangs:
|
|
136
163
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
npm install --prefer-offline --no-fund --no-audit --legacy-peer-deps <packages>
|
|
140
|
-
```
|
|
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.
|
|
141
166
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
npm install --no-fund --no-audit --legacy-peer-deps <packages>
|
|
146
|
-
```
|
|
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.
|
|
168
|
+
|
|
169
|
+
---
|
|
147
170
|
|
|
148
|
-
|
|
171
|
+
## Final scan (MANDATORY)
|
|
172
|
+
|
|
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.
|
|
149
174
|
|
|
150
175
|
---
|
|
151
176
|
|
|
152
|
-
##
|
|
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.
|
|
180
|
+
|
|
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.
|
|
182
|
+
|
|
183
|
+
**Differences from Path A:**
|
|
184
|
+
|
|
185
|
+
| Aspect | Path A (new project) | Path B (existing project) |
|
|
186
|
+
|---|---|---|
|
|
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 |
|
|
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 |
|
|
193
|
+
| Entry file | `src/pages/index.astro` (Astro convention) | **Must be `index.html`** at the configured `outputDirectory` |
|
|
194
|
+
|
|
195
|
+
### Step E1 — Init (replaces scaffold)
|
|
196
|
+
|
|
197
|
+
`cd` into the existing project directory. Run, foreground (it's interactive-ish but non-blocking with `--yes`-style defaults; capture stdout):
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
npm create @wix/new@latest init
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
> Same package + invoker as Path A's scaffold (`npm create @wix/new@latest headless`), only the subcommand differs: **`init` for existing projects, `headless` for new projects**. Do not combine them (`… headless init` is a known regression).
|
|
204
|
+
|
|
205
|
+
This creates a Wix Site + Headless Project (App) connected to that Site, and writes `wix.config.json` in the project root:
|
|
206
|
+
|
|
207
|
+
```jsonc
|
|
208
|
+
{
|
|
209
|
+
"projectType": "Site",
|
|
210
|
+
"appId": "16511cb9-3d3a-4371-a04a-bcc176ae5d50", // SDK clientId
|
|
211
|
+
"siteId": "90b8c952-a7f9-4d79-a2c0-b0ec3e1c1434", // siteId for every REST call this session
|
|
212
|
+
"site": {
|
|
213
|
+
"outputDirectory": "./site" // edit to "./" if the entry file is at project root
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Required follow-ups before continuing:**
|
|
219
|
+
|
|
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.
|
|
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[]`.
|
|
224
|
+
|
|
225
|
+
Recovery ladder:
|
|
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.
|
|
228
|
+
- Network / unknown → surface stderr to the user.
|
|
229
|
+
|
|
230
|
+
### Step E2 — Analyze the project to decide which apps to install
|
|
231
|
+
|
|
232
|
+
The existing-project flow does NOT use vertical-pack inference from the user prompt. Instead, **read the project files** to decide which Wix Business Solutions are needed. Quick heuristic table:
|
|
233
|
+
|
|
234
|
+
| Signal in source files | Pack(s) to install |
|
|
235
|
+
|---|---|
|
|
236
|
+
| Mentions of "event", "wedding", "RSVP", "guests", "ceremony" | `events` (if pack exists), else CMS-backed RSVP via `cms` |
|
|
237
|
+
| `<form>` tags, "Contact us", "Get in touch", email collection | `forms` |
|
|
238
|
+
| Product listings, "buy", "$", "add to cart", price tags | `stores` (transitively pulls `ecom`, `gift-cards`) |
|
|
239
|
+
| Article / blog content, post listings | `blog` |
|
|
240
|
+
| Booking, appointments, calendar | `bookings` (if pack exists) |
|
|
241
|
+
| Restaurant menu, dishes | `restaurants` (if pack exists) |
|
|
242
|
+
| Always | `cms` (any user-editable content) |
|
|
243
|
+
|
|
244
|
+
Read `index.html` and any top-level source files (`*.jsx`, `*.tsx`, `*.html`, `*.js`) to look for these signals. Cap reading at the top 5 source files by size — don't grovel.
|
|
245
|
+
|
|
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.
|
|
247
|
+
|
|
248
|
+
### Step E3 — Install apps
|
|
249
|
+
|
|
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.
|
|
251
|
+
|
|
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.
|
|
253
|
+
|
|
254
|
+
### Step E4 — SDK wiring
|
|
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
|
+
|
|
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.
|
|
259
|
+
|
|
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`.
|
|
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:
|
|
262
|
+
|
|
263
|
+
```js
|
|
264
|
+
import { createClient, OAuthStrategy } from "@wix/sdk";
|
|
265
|
+
const wix = createClient({
|
|
266
|
+
modules: { /* pack modules */ },
|
|
267
|
+
auth: OAuthStrategy({ clientId: "<appId from wix.config.json>" }),
|
|
268
|
+
});
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**Always inline the `appId` literal from `wix.config.json`.** No env vars, no `import.meta.env`, no `window.__WIX_CLIENT_ID__` — read `wix.config.json` once and paste the appId string into every `createClient` call. Keeps the static-site case working with no build step.
|
|
272
|
+
|
|
273
|
+
Capture `{ phase: "sdk-wiring-<pack>", seconds }` per pack.
|
|
274
|
+
|
|
275
|
+
### Step E5 — Release (no build)
|
|
276
|
+
|
|
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.
|
|
278
|
+
|
|
279
|
+
Run release directly:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
npx @wix/cli@latest release
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Capture stdout. The CLI prints `Site published on <url>` on success — extract that URL (same parser logic as `release.sh` uses):
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
sed -nE 's/.*Site published on ([^[:space:]]+).*/\1/p'
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Capture `{ phase: "release", seconds }` around the call. No `{ phase: "build" }` entry in `run.json` for this flow.
|
|
292
|
+
|
|
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`.
|
|
294
|
+
|
|
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`.
|
|
296
|
+
|
|
297
|
+
### Step E6 — Final message
|
|
298
|
+
|
|
299
|
+
Emit **exactly two URLs**, both copy-pasted verbatim from tool output / config (URL discipline from `SKILL.md` § "URL discipline" applies here too):
|
|
300
|
+
|
|
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.
|
|
302
|
+
2. **Dashboard URL** — `https://manage.wix.com/dashboard/<siteId>` where `<siteId>` is the value from `wix.config.json`.
|
|
303
|
+
|
|
304
|
+
Skip Path A's perf one-liner buckets that didn't run. For Path B the perf line is:
|
|
305
|
+
|
|
306
|
+
> `Connected in <Nm Ss> — init <n>s · app-install <n>s · sdk-wiring <n>s · release <n>s`
|
|
307
|
+
|
|
308
|
+
`sdk-wiring` aggregates every `sdk-wiring-<pack>` phase from E4.
|
|
153
309
|
|
|
154
|
-
|
|
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.
|
|
@@ -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 |
|
|
@@ -5,7 +5,7 @@ Prerequisites, dependencies, blog service module, and astro config changes for t
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
7
7
|
- A Wix Managed Headless project (has `wix.config.json` and `astro.config.mjs`)
|
|
8
|
-
- The **Wix Blog app** installed on the connected Wix site (via
|
|
8
|
+
- The **Wix Blog app** installed on the connected Wix site (installed via the apps-installer REST endpoint after scaffolding — see `../../blog/BLOG_CONTENT.md` Step 0)
|
|
9
9
|
- At least one published blog post in the Wix dashboard
|
|
10
10
|
|
|
11
11
|
## Package Installation
|
|
@@ -215,4 +215,4 @@ Key details:
|
|
|
215
215
|
- `media.getImageUrl(ref).url` resolves Wix media references to real URLs
|
|
216
216
|
- `getPostBySlug` returns `null` for missing posts — pages must handle this with a redirect
|
|
217
217
|
- `queryBlogPosts()` sorts by `firstPublishedDate` descending (newest first)
|
|
218
|
-
- `RICH_CONTENT` fieldset is required to get renderable content for `RicosViewer`
|
|
218
|
+
- `RICH_CONTENT` fieldset is required to get renderable content for `RicosViewer`
|