@zohofinance/commerce 1.0.0 → 1.1.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 (127) hide show
  1. package/README.md +59 -0
  2. package/package.json +2 -2
  3. package/ts-dist/mocks/init-theme/.claude/CLAUDE.md +6 -0
  4. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/SKILL.md +242 -0
  5. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/figma.md +81 -0
  6. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/screenshot.md +54 -0
  7. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/url.md +88 -0
  8. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/spec-table.md +102 -0
  9. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/accessibility.md +110 -0
  10. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/performance.md +127 -0
  11. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/tokens.md +87 -0
  12. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/visual-diff.md +123 -0
  13. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/SKILL.md +605 -0
  14. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/design-tokens.md +105 -0
  15. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/page-json-contract.md +58 -0
  16. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/qa-accessibility.md +35 -0
  17. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/reference-lookup.md +94 -0
  18. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/section-anatomy.md +109 -0
  19. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/SKILL.md +313 -0
  20. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/agent-hierarchy.md +142 -0
  21. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/ask-developer.md +113 -0
  22. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/bootstrap.md +260 -0
  23. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/build-metrics.md +89 -0
  24. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/code-quality.md +186 -0
  25. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/common-pages-agent.md +97 -0
  26. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/dev-server-and-urls.md +136 -0
  27. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/exemplars.md +79 -0
  28. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/figma-discovery.md +138 -0
  29. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/figma-extraction.md +132 -0
  30. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/image-sources.md +84 -0
  31. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/inputs/guidelines-frame.md +178 -0
  32. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/page-builder.md +322 -0
  33. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/page-orchestrator.md +199 -0
  34. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/parallel-fanout.md +152 -0
  35. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/a11y.mjs +129 -0
  36. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/lint-section.mjs +502 -0
  37. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/perf.mjs +134 -0
  38. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/pixel-diff.mjs +206 -0
  39. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/record-build-metrics.mjs +118 -0
  40. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/section-builder.md +131 -0
  41. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/subagent-escalation.md +75 -0
  42. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/transcription-rules.md +98 -0
  43. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/verification.md +227 -0
  44. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/visual-verify-loop.md +117 -0
  45. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/_index.md +4 -0
  46. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/assets.md +105 -0
  47. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/best-practices.md +212 -0
  48. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/custom-scripts.md +294 -0
  49. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/i18n.md +155 -0
  50. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/introduction.md +91 -0
  51. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/layouts.md +158 -0
  52. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/pages.md +156 -0
  53. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/_index.md +4 -0
  54. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/filters.md +419 -0
  55. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/global-objects.md +415 -0
  56. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/schema-types.md +926 -0
  57. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/tags.md +259 -0
  58. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/sections.md +203 -0
  59. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/setup-guide.md +424 -0
  60. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/snippets.md +70 -0
  61. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/theme-structure.md +252 -0
  62. package/ts-dist/mocks/init-theme/.cursor/PLAYBOOK.md +144 -0
  63. package/ts-dist/mocks/init-theme/.cursor/README.md +6 -0
  64. package/ts-dist/mocks/init-theme/.cursor/agents/figma-desktop-mobile-parallel.md +48 -0
  65. package/ts-dist/mocks/init-theme/.cursor/agents/visual-compare.md +221 -0
  66. package/ts-dist/mocks/init-theme/.cursor/commands/add-field.md +83 -0
  67. package/ts-dist/mocks/init-theme/.cursor/commands/add-theme-setting.md +200 -0
  68. package/ts-dist/mocks/init-theme/.cursor/commands/assemble-page.md +72 -0
  69. package/ts-dist/mocks/init-theme/.cursor/commands/audit-page.md +57 -0
  70. package/ts-dist/mocks/init-theme/.cursor/commands/build-page-sections.md +110 -0
  71. package/ts-dist/mocks/init-theme/.cursor/commands/build-section.md +418 -0
  72. package/ts-dist/mocks/init-theme/.cursor/commands/build-theme.md +307 -0
  73. package/ts-dist/mocks/init-theme/.cursor/commands/compare-section.md +358 -0
  74. package/ts-dist/mocks/init-theme/.cursor/commands/create-theme.md +77 -0
  75. package/ts-dist/mocks/init-theme/.cursor/commands/extract-tokens.md +43 -0
  76. package/ts-dist/mocks/init-theme/.cursor/commands/fix-section.md +92 -0
  77. package/ts-dist/mocks/init-theme/.cursor/commands/impact.md +50 -0
  78. package/ts-dist/mocks/init-theme/.cursor/commands/qa-a11y.md +66 -0
  79. package/ts-dist/mocks/init-theme/.cursor/commands/qa-i18n.md +110 -0
  80. package/ts-dist/mocks/init-theme/.cursor/commands/qa-layout.md +127 -0
  81. package/ts-dist/mocks/init-theme/.cursor/commands/qa-performance.md +72 -0
  82. package/ts-dist/mocks/init-theme/.cursor/commands/qa-section.md +84 -0
  83. package/ts-dist/mocks/init-theme/.cursor/commands/qa-sections.md +48 -0
  84. package/ts-dist/mocks/init-theme/.cursor/commands/qa-theme.md +85 -0
  85. package/ts-dist/mocks/init-theme/.cursor/commands/redesign-section.md +177 -0
  86. package/ts-dist/mocks/init-theme/.cursor/commands/refactor-section.md +185 -0
  87. package/ts-dist/mocks/init-theme/.cursor/commands/sync-theme-settings.md +132 -0
  88. package/ts-dist/mocks/init-theme/.cursor/commands/validate-page.md +60 -0
  89. package/ts-dist/mocks/init-theme/.cursor/commands/validate-section-group.md +88 -0
  90. package/ts-dist/mocks/init-theme/.cursor/commands/validate-theme-settings.md +119 -0
  91. package/ts-dist/mocks/init-theme/.cursor/examples/design-instructions-template.md +151 -0
  92. package/ts-dist/mocks/init-theme/.cursor/mcp.json +18 -0
  93. package/ts-dist/mocks/init-theme/.cursor/rules/README.md +160 -0
  94. package/ts-dist/mocks/init-theme/.cursor/rules/accessibility.mdc +24 -0
  95. package/ts-dist/mocks/init-theme/.cursor/rules/add-field.mdc +222 -0
  96. package/ts-dist/mocks/init-theme/.cursor/rules/add-theme-setting.mdc +39 -0
  97. package/ts-dist/mocks/init-theme/.cursor/rules/assemble-page.mdc +130 -0
  98. package/ts-dist/mocks/init-theme/.cursor/rules/audit-page.mdc +92 -0
  99. package/ts-dist/mocks/init-theme/.cursor/rules/build-section.mdc +178 -0
  100. package/ts-dist/mocks/init-theme/.cursor/rules/build-theme.mdc +47 -0
  101. package/ts-dist/mocks/init-theme/.cursor/rules/compare-section.mdc +94 -0
  102. package/ts-dist/mocks/init-theme/.cursor/rules/create-theme.mdc +78 -0
  103. package/ts-dist/mocks/init-theme/.cursor/rules/css.mdc +137 -0
  104. package/ts-dist/mocks/init-theme/.cursor/rules/design-spec-extraction.mdc +255 -0
  105. package/ts-dist/mocks/init-theme/.cursor/rules/extract-tokens.mdc +43 -0
  106. package/ts-dist/mocks/init-theme/.cursor/rules/figma-mcp-resolution.mdc +40 -0
  107. package/ts-dist/mocks/init-theme/.cursor/rules/fix-section.mdc +154 -0
  108. package/ts-dist/mocks/init-theme/.cursor/rules/general.mdc +30 -0
  109. package/ts-dist/mocks/init-theme/.cursor/rules/i18n.mdc +85 -0
  110. package/ts-dist/mocks/init-theme/.cursor/rules/javascript.mdc +85 -0
  111. package/ts-dist/mocks/init-theme/.cursor/rules/liquid-no-hardcoded-strings.mdc +42 -0
  112. package/ts-dist/mocks/init-theme/.cursor/rules/liquid.mdc +171 -0
  113. package/ts-dist/mocks/init-theme/.cursor/rules/mobile-desktop-setting-meta.mdc +34 -0
  114. package/ts-dist/mocks/init-theme/.cursor/rules/naming-convention.mdc +64 -0
  115. package/ts-dist/mocks/init-theme/.cursor/rules/pages.mdc +120 -0
  116. package/ts-dist/mocks/init-theme/.cursor/rules/performance.mdc +51 -0
  117. package/ts-dist/mocks/init-theme/.cursor/rules/qa-section.mdc +134 -0
  118. package/ts-dist/mocks/init-theme/.cursor/rules/redesign-section.mdc +147 -0
  119. package/ts-dist/mocks/init-theme/.cursor/rules/schema-sync.mdc +110 -0
  120. package/ts-dist/mocks/init-theme/.cursor/rules/schema.mdc +360 -0
  121. package/ts-dist/mocks/init-theme/.cursor/rules/share-urls.mdc +68 -0
  122. package/ts-dist/mocks/init-theme/.cursor/skills/browser-verify.md +128 -0
  123. package/ts-dist/mocks/init-theme/.cursor/skills/design-tokens.md +105 -0
  124. package/ts-dist/mocks/init-theme/.cursor/skills/page-json-contract.md +87 -0
  125. package/ts-dist/mocks/init-theme/.cursor/skills/qa-accessibility.md +35 -0
  126. package/ts-dist/mocks/init-theme/.cursor/skills/reference-lookup.md +88 -0
  127. package/ts-dist/mocks/init-theme/.cursor/skills/section-anatomy.md +173 -0
@@ -0,0 +1,227 @@
1
+ # Verification — Chrome DevTools MCP first, simple gates
2
+
3
+ Verification runs per-section, per-page, then theme-wide (Stage 2).
4
+
5
+ ## Primary gates (Chrome DevTools MCP — mandatory)
6
+
7
+ | Gate | Tool | Pass |
8
+ |---|---|---|
9
+ | Visual | `take_screenshot` + Figma `get_screenshot` + vision diff | 0 CRITICAL in `visual-diff.md` |
10
+ | A11y | `lighthouse_audit` navigation mobile | Score ≥ 90 |
11
+ | Perf | `lighthouse_audit` mobile on page routes | Score ≥ 85 |
12
+ | Images | `list_network_requests` | No 404 theme assets (use `asset_url` — `image-sources.md`) |
13
+ | Lint | `lint-section.mjs` at write time | PASS |
14
+
15
+ See `.cursor/skills/browser-verify.md` and `visual-verify-loop.md`.
16
+
17
+ ## Optional release scripts (CI only)
18
+
19
+ `pixel-diff.mjs`, `a11y.mjs`, `perf.mjs` produce JSON artefacts for pipelines. **Do not skip MCP visual compare** because a script passed.
20
+
21
+ ## End-of-run metrics (mandatory)
22
+
23
+ ```bash
24
+ node .claude/skills/theme-from-figma/scripts/record-build-metrics.mjs <theme>
25
+ node .claude/skills/theme-from-figma/scripts/verify-theme.mjs <theme>
26
+ ```
27
+
28
+ Append results to `.claude/scratchpad/<theme>/report.md`. See `build-metrics.md`.
29
+
30
+ ## Per-page gates (Phase 5 of `page-builder.md`)
31
+
32
+ All four gates run for every page. The puppeteer scripts in `scripts/` are the official source of pass/fail.
33
+
34
+ **Non-negotiable.** Verification is the only thing standing between a built theme and a shipped theme that doesn't match the input. In real-world use, agents have skipped verification (returning "passed" without actually invoking the scripts) and shipped output that was structurally identical to the base theme — that's the failure mode that bit a prior build. Each agent's report MUST include the four JSON files produced by the scripts; the consolidator confirms their existence before accepting the page.
35
+
36
+ ### Gate 1 — Pixel diff (visual fidelity)
37
+
38
+ Script: `scripts/pixel-diff.mjs`
39
+
40
+ Inputs:
41
+ - `--rendered-url` — the dev server URL.
42
+ - `--figma-image` — the Figma frame screenshot saved during intake.
43
+ - `--viewport` — `1440x900` for desktop, `375x812` for mobile.
44
+ - `--out` — path to write the JSON report.
45
+
46
+ The script:
47
+ 1. Launches headless Chrome at the viewport.
48
+ 2. Navigates to the rendered URL.
49
+ 3. Waits for `networkidle`.
50
+ 4. Screenshots the page (or section if a selector is given).
51
+ 5. Resizes the Figma reference image to match.
52
+ 6. Runs `pixelmatch` for a region-by-region ΔE diff.
53
+ 7. Outputs a JSON report with diff regions, max ΔE, mean ΔE, total mismatched pixel ratio.
54
+
55
+ **Pass thresholds:**
56
+ - Mean ΔE < 2.0
57
+ - Max ΔE < 5.0 (no single region wildly off)
58
+ - Mismatched pixel ratio < 3%
59
+
60
+ If any threshold fails, the JSON lists the specific regions; the agent edits the responsible section and re-runs only this gate.
61
+
62
+ ### Gate 2 — Accessibility
63
+
64
+ Script: `scripts/a11y.mjs`
65
+
66
+ Inputs:
67
+ - `--url` — the dev server URL.
68
+ - `--selector` — optional, scope to a single section.
69
+ - `--out` — path to write the JSON report.
70
+
71
+ The script:
72
+ 1. Launches headless Chrome.
73
+ 2. Navigates to the URL.
74
+ 3. Injects axe-core (4.10).
75
+ 4. Runs `axe.run()` with WCAG 2.1 AA tags.
76
+ 5. Filters to `impact: critical` and `impact: serious` for the pass/fail decision; reports all impacts in the JSON.
77
+
78
+ **Pass threshold:** zero critical, zero serious violations.
79
+
80
+ Moderate violations are reported and surfaced in the agent's report but don't block the gate. The most common moderate is `color-contrast` — fix when easy, defer when the design intent demands a marginal ratio.
81
+
82
+ ### Gate 3 — Performance
83
+
84
+ Script: `scripts/perf.mjs`
85
+
86
+ Inputs:
87
+ - `--url` — the dev server URL.
88
+ - `--form-factor` — `mobile` (default) or `desktop`.
89
+ - `--out` — path to write the JSON report.
90
+
91
+ The script:
92
+ 1. Launches headless Chrome.
93
+ 2. Runs Lighthouse with the performance category only.
94
+ 3. Outputs JSON with score, LCP, FCP, CLS, TBT, Speed Index.
95
+
96
+ **Pass thresholds (mobile, throttled):**
97
+ - Performance score ≥ 90
98
+ - LCP < 2.5s
99
+ - CLS < 0.1
100
+ - TBT < 200ms
101
+
102
+ Desktop usually passes if mobile does, but the script runs both and reports both.
103
+
104
+ ### Gate 4 — Token / lint compliance
105
+
106
+ This is `scripts/lint-section.mjs`, already run during Phase 4 build. Verification confirms every section file passed lint. If a file slipped through without lint, run it now.
107
+
108
+ ## Running multiple gates in parallel
109
+
110
+ All three puppeteer scripts can run concurrently — they each launch their own Chrome instance. Use bash backgrounding:
111
+
112
+ ```bash
113
+ node .../pixel-diff.mjs --rendered-url $URL --figma-image $D --viewport 1440x900 --out $OUT/pd-d.json &
114
+ node .../pixel-diff.mjs --rendered-url $URL --figma-image $M --viewport 375x812 --out $OUT/pd-m.json &
115
+ node .../a11y.mjs --url $URL --out $OUT/axe.json &
116
+ node .../perf.mjs --url $URL --form-factor mobile --out $OUT/lh.json &
117
+ wait
118
+ ```
119
+
120
+ This brings the verify phase down to ~30s wall-clock from ~2min serial.
121
+
122
+ ---
123
+
124
+ ## Stage 2 — Cross-theme consolidation
125
+
126
+ After all five parallel page agents finish, a single coordinator agent does theme-wide checks:
127
+
128
+ ### 1. Token consistency
129
+
130
+ For each token in `theme.json`, find every direct reference across the theme and confirm they all use the variable, not a hardcoded value. The lint script catches per-file hardcodes; this is the theme-wide assertion.
131
+
132
+ ```bash
133
+ grep -rE '#[0-9a-fA-F]{6}\b' sections/ snippets/ \
134
+ | grep -v 'figma-variables.json' | grep -v '#section-'
135
+ ```
136
+
137
+ Any results → manual review; usually means a section snuck a hardcoded color past the lint.
138
+
139
+ ### 2. Header / footer presence check
140
+
141
+ The index agent built header and footer from the Figma. Confirm:
142
+ - `sections/header.liquid` and `sections/footer.liquid` exist and are non-empty.
143
+
144
+ ```bash
145
+ # Confirm header and footer exist and are non-empty
146
+ test -s sections/header.liquid || { echo "FAIL: header.liquid missing or empty" >&2; exit 1; }
147
+ test -s sections/footer.liquid || { echo "FAIL: footer.liquid missing or empty" >&2; exit 1; }
148
+ ```
149
+
150
+ After the four parallel page agents finish, confirm `header.liquid` and `footer.liquid` are still identical to the snapshot the index agent took when it published the ready-marker:
151
+
152
+ ```bash
153
+ diff sections/header.liquid .claude/scratchpad/<theme>/header.liquid.locked
154
+ diff sections/footer.liquid .claude/scratchpad/<theme>/footer.liquid.locked
155
+ ```
156
+
157
+ ### 3. Navigation correctness
158
+
159
+ Walk the rendered theme: dev server up, navigate `/home → /collections/all → /products/<sample> → /blog → /blog/<sample-post>`. Confirm:
160
+ - Each transition works (no Liquid errors).
161
+ - Header active state correct on each page.
162
+ - Footer renders identically on each page.
163
+ - Browser console has no critical errors.
164
+
165
+ Quickest implementation: a single puppeteer script `scripts/nav-walk.mjs` (not implemented in v1; the agent can do it via Chrome DevTools MCP `navigate_page` + `list_console_messages`). See `.cursor/skills/browser-verify.md`.
166
+
167
+ ### 4. i18n key coverage
168
+
169
+ ```bash
170
+ node .claude/skills/theme-from-figma/scripts/lint-i18n.mjs <theme>
171
+ ```
172
+ (Optional v2; in v1, do a grep-based check: every `t:` key referenced must exist in `i18n/en.schema.json`.)
173
+
174
+ ### 5. Page JSON validity
175
+
176
+ For each `pages/*.json`, validate against the schema of the sections it references. If a page wires `hero-banner` with field `unknownField`, the section schema won't have it and the page won't render — catch this now, not at first deploy.
177
+
178
+ ### 6. Final theme-wide perf run
179
+
180
+ Run `scripts/perf.mjs` against each top-level page route. The per-page agent ran it earlier; this is the final cross-check to confirm no regression from cross-page wiring (header/footer JS loaded on every page might pull down product page perf).
181
+
182
+ ### 7. Produce the consolidated report
183
+
184
+ ```
185
+ THEME: lush_market — BUILD COMPLETE
186
+ Time: 6m12s (bootstrap 28s + parallel pages 4m48s + consolidation 56s)
187
+
188
+ PAGES BUILT:
189
+ index 5 sections all gates pass 1 iteration
190
+ listing 4 sections all gates pass 1 iteration
191
+ product 7 sections all gates pass 2 iterations (a11y contrast fix)
192
+ blog_list 3 sections all gates pass 1 iteration
193
+ blog_detail 2 sections all gates pass 1 iteration
194
+
195
+ LINT METRICS (aggregate):
196
+ Total .liquid files written: 21
197
+ Avg lines per section: 124
198
+ Avg max DOM depth: 4.8
199
+ Avg max classes/element: 9
200
+ Lint failures during build: 4 (all fixed, 0 outstanding)
201
+
202
+ GATES (theme-wide):
203
+ pixel-diff: pass on 5/5 pages (mean ΔE 1.4, max 4.2)
204
+ a11y: pass on 5/5 pages (0 critical, 0 serious; 3 moderate)
205
+ perf: pass on 5/5 pages (avg score 93)
206
+ token cons.: pass (0 hardcoded values)
207
+ nav: pass (5 routes walked, 0 errors)
208
+
209
+ NEEDS_REVIEW (3):
210
+ - hero-banner: figma font weight 850, used 800 (closest available)
211
+ - product-options: 1 moderate axe violation — color-contrast 4.3:1 on disabled state
212
+ - blog-detail: long-form content typography uses scoped classes (correct), but
213
+ the prose styles might benefit from a `prose` plugin sweep
214
+
215
+ NEXT:
216
+ - Theme is ready at lush_market/
217
+ - Review NEEDS_REVIEW items above
218
+ - When approved: cd lush_market && yarn create-theme to package
219
+ ```
220
+
221
+ ## When verification fails after 3 iterations
222
+
223
+ A parallel page agent that exhausts its iteration budget writes `NEEDS_REVIEW` to its report and exits. The coordinator surfaces these to the developer with the specific gate output and the relevant section file path. The developer either:
224
+
225
+ 1. Approves the deviation (theme ships with caveats noted in the report).
226
+ 2. Asks the coordinator to spawn one more focused fix agent on a specific section.
227
+ 3. Adjusts the input (e.g. updates the Figma file) and re-runs the affected page only.
@@ -0,0 +1,117 @@
1
+ # Visual verify loop — Chrome DevTools MCP (mandatory)
2
+
3
+ **Goal:** rendered output must match Figma. No section ships without a structured visual diff showing **0 CRITICAL** items.
4
+
5
+ **Canonical workflow:** `.cursor/skills/browser-verify.md`
6
+ **Image bugs:** `.claude/skills/theme-from-figma/image-sources.md`
7
+
8
+ Puppeteer scripts (`pixel-diff.mjs`, etc.) are optional release artefacts — **Chrome DevTools MCP is the dev-loop source of truth.**
9
+
10
+ ---
11
+
12
+ ## The 3-gate verify (per section AND per page)
13
+
14
+ Run all three gates. Keep it simple — no extra scripts unless MCP is unavailable.
15
+
16
+ | Gate | Chrome DevTools MCP | Pass criteria |
17
+ |---|---|---|
18
+ | **Visual** | `take_screenshot` + Figma `get_screenshot` + agent vision diff | 0 CRITICAL mismatches |
19
+ | **A11y** | `lighthouse_audit` mode `navigation` device `mobile` | Accessibility score ≥ 90, 0 critical axe issues in report |
20
+ | **Perf** | `lighthouse_audit` on page route OR `performance_start_trace` if LCP suspect | Mobile perf ≥ 85 on pages; sections inherit page score |
21
+
22
+ Also always run:
23
+ - `list_console_messages` types `["error","issue"]` — fix section-related errors
24
+ - `list_network_requests` — catch 404 images (usually missing `asset_url`)
25
+
26
+ ---
27
+
28
+ ## Per-section loop (section-builder subagent)
29
+
30
+ ### 1. Preconditions
31
+ - `dev-config.json` exists with `confirmed_by_developer: true` — see `dev-server-and-urls.md`
32
+ - Dev server running with developer's `storeUrl`: `npx @zohofinance/commerce theme dev --storeUrl=<your store url>` (ask them to start, or start and notify; value from `dev-config.json`)
33
+ - Chrome DevTools MCP connected
34
+ - Figma node ID in `figma-spec.json`
35
+ - **Do not `navigate_page` until page URLs are confirmed with the developer**
36
+
37
+ ### 2. Capture (desktop + mobile)
38
+
39
+ ```
40
+ list_pages → select_page (or new_page + pageId for parallel agents)
41
+ emulate → 1440x900
42
+ navigate_page → URL from dev-config.json page_urls (e.g. /home, /products/item-1)
43
+ evaluate_script → scroll #section-<id> into view
44
+ take_screenshot → scratchpad/.../rendered-desktop.png
45
+ list_console_messages → errors/issues
46
+ list_network_requests → 404 on images?
47
+ ```
48
+
49
+ Repeat with `emulate → 375x812,mobile,touch` → `rendered-mobile.png`.
50
+
51
+ **Parallel:** Figma `get_screenshot` desktop + mobile node IDs while browser captures.
52
+
53
+ ### 3. Compare in vision
54
+
55
+ Write `visual-diff.md`:
56
+
57
+ ```markdown
58
+ # Visual diff — <section>
59
+ Desktop: 1440×900 | Mobile: 375×812
60
+
61
+ ## CRITICAL (must fix)
62
+ 1. [IMAGE] Left panel hero image missing — 404 on `hero-left.png` without asset_url
63
+ Fix: `{{ section.settings.image.url | asset_url }}`
64
+
65
+ ## MINOR
66
+ (none)
67
+
68
+ ## SUGGESTION
69
+ (none)
70
+
71
+ Console errors: 0
72
+ Network 404s: 1 (hero-left.png)
73
+ ```
74
+
75
+ ### 4. Fix CRITICAL only, re-loop
76
+
77
+ Max **3 iterations** per section (was 5 — keep it simple). After 3, write `needs-developer.md` and exit.
78
+
79
+ ### 5. Section PASS criteria
80
+
81
+ - `visual-diff.md` exists
82
+ - 0 CRITICAL items
83
+ - No console errors affecting this section
84
+ - No 404 theme assets
85
+
86
+ ---
87
+
88
+ ## Per-page loop (page orchestrator, after assembly)
89
+
90
+ Same 3 gates on the **whole assembled page**:
91
+
92
+ 1. Screenshot full page desktop + mobile (scroll segments if taller than viewport)
93
+ 2. Figma full-page screenshot (`2613:146` etc.)
94
+ 3. Vision diff focused on **inter-section** issues: spacing, order, missing/extra sections
95
+ 4. `lighthouse_audit` navigation mobile on page URL
96
+ 5. Save to `pages/<page>/visual-diff.md` + `pages/<page>/verify/lighthouse.json` if MCP returns path
97
+
98
+ Max **2 page-level iterations**.
99
+
100
+ ---
101
+
102
+ ## What good output looks like
103
+
104
+ ```
105
+ pages/product/sections/product-details/visual-diff.md → 0 CRITICAL
106
+ pages/product/visual-diff.md → 0 CRITICAL
107
+ pages/product/verify/lighthouse-mobile.json → a11y ≥ 90, perf ≥ 85
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Never do
113
+
114
+ - Skip visual verify and claim PASS
115
+ - Write "looks good" without structured diff
116
+ - Use puppeteer-only results when Chrome DevTools MCP is available
117
+ - Forget `asset_url` for schema JSON image defaults (top cause of missing images in dev)
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: "Documentation"
3
+ weight: -1
4
+ ---
@@ -0,0 +1,105 @@
1
+ ---
2
+ title: "Assets"
3
+ weight: 8
4
+ ---
5
+
6
+ # Assets
7
+
8
+ Assets are static files — CSS, JavaScript, images, and fonts — stored in the `assets/` folder.
9
+
10
+ ## Linking Assets
11
+
12
+ Use the `asset_url` filter to generate the correct CDN URL with cache busting:
13
+
14
+ ```liquid
15
+ <!-- Stylesheet -->
16
+ <link rel="stylesheet" href="{{ 'main.css' | asset_url }}">
17
+ ```
18
+ **Output:** `<link rel="stylesheet" href="https://cdn.example.com/assets/main-585919664682927.css">`
19
+
20
+ ```liquid
21
+ <!-- JavaScript -->
22
+ <script src="{{ 'cart.js' | asset_url }}" defer></script>
23
+ ```
24
+ **Output:** `<script src="https://cdn.example.com/assets/cart-123456789.js" defer></script>`
25
+
26
+ ```liquid
27
+ <!-- Image -->
28
+ <img src="{{ 'logo.png' | asset_url }}" alt="Store Logo">
29
+ ```
30
+ **Output:** `<img src="https://cdn.example.com/assets/logo-987654321.png" alt="Store Logo">`
31
+
32
+ > **Important:** Pass only the filename to `asset_url` (e.g., `'main.css'`), not the full path. The filter prepends the CDN URL and uses `fingerprint.json` for cache-busted versioning.
33
+
34
+ ---
35
+
36
+ ## fingerprint.json
37
+
38
+ This file maps original filenames to their cache-busted versions:
39
+
40
+ ```json
41
+ {
42
+ "main.css": "main-585919664682927.css",
43
+ "header.js": "header-317103717237078.js",
44
+ "logo.png": "logo-442891003756812.png"
45
+ }
46
+ ```
47
+
48
+ When you use `{{ 'main.css' | asset_url }}`, Zoho Commerce looks up the fingerprinted filename and prepends the CDN URL. This ensures browsers always load the latest version after deployments.
49
+
50
+ **Generating fingerprint.json:**
51
+
52
+ Use the `create-theme` package to generate fingerprints and package your theme:
53
+
54
+ ```bash
55
+ npx create-theme
56
+ ```
57
+
58
+ This command minifies CSS/JS, fingerprints your assets, validates your code, and creates a deployment-ready `theme.zip`.
59
+
60
+ ---
61
+
62
+ ## Supported File Types
63
+
64
+ | Type | Extensions | Notes |
65
+ |------|-----------|-------|
66
+ | Stylesheets | `.css` | Minify for production |
67
+ | Scripts | `.js` | Use `defer` or `async` attributes |
68
+ | Images | `.png`, `.jpg`, `.svg`, `.webp` | Optimize before uploading |
69
+ | Fonts | `.woff`, `.woff2`, `.ttf` | Prefer `.woff2` for best compression |
70
+ | Data | `.json` | Configuration or structured data |
71
+
72
+ ---
73
+
74
+ ## Using Images in Settings
75
+
76
+ When using `image_picker` in section schemas, use just the filename for default values:
77
+
78
+ ```json
79
+ {
80
+ "type": "image_picker",
81
+ "id": "banner_image",
82
+ "label": "Banner Image",
83
+ "default": {
84
+ "url": "banner_placeholder.webp",
85
+ "enable_customisation": true
86
+ }
87
+ }
88
+ ```
89
+
90
+ In your template, the URL may be either:
91
+ - A filename (for theme defaults): `"banner_placeholder.webp"`
92
+ - A full CDN URL (when admin uploads custom image): `"https://cdn.example.com/uploads/custom-banner.jpg"`
93
+
94
+ Handle both cases appropriately in your Liquid code.
95
+
96
+ ---
97
+
98
+ ## Best Practices
99
+
100
+ - **Use `asset_url` for every theme static file** — never hardcode paths
101
+ - **Pass only filenames** to `asset_url`, not full paths like `/assets/main.css`
102
+ - **Optimize images** before adding them to the assets folder
103
+ - **Minify CSS and JS** for faster page loads (handled automatically by `npx create-theme` during build)
104
+ - **Use descriptive filenames** — `product-gallery.js` not `pg.js`
105
+ - **Run `npx create-theme`** before deploying to update fingerprints
@@ -0,0 +1,212 @@
1
+ ---
2
+ title: "Best Practices"
3
+ weight: 15
4
+ ---
5
+
6
+ # Best Practices
7
+
8
+ Guidelines for building performant, secure, and maintainable Zoho Commerce themes.
9
+
10
+ ---
11
+
12
+ ## Performance
13
+
14
+ ### Minimize Asset Size
15
+
16
+ - Minify CSS and JavaScript before deploying (handled automatically by `npx create-theme` during build)
17
+ - Compress images (use WebP where supported)
18
+ - Prefer `.woff2` fonts over `.ttf` or `.otf`
19
+
20
+ ### Optimize Loading
21
+
22
+ ```liquid
23
+ <!-- Defer non-critical JavaScript -->
24
+ <script src="{{ 'main.js' | asset_url }}" defer></script>
25
+
26
+ <!-- Use async for independent scripts -->
27
+ <script src="{{ 'analytics.js' | asset_url }}" async></script>
28
+
29
+ <!-- Preload critical assets -->
30
+ <link rel="preload" href="{{ 'main.css' | asset_url }}" as="style">
31
+ ```
32
+
33
+ ### Reduce Liquid Processing
34
+
35
+ ```liquid
36
+ <!-- GOOD: Assign once, use many times -->
37
+ {% assign formatted_title = product.title | upcase | truncate: 50 %}
38
+ <span>{{ formatted_title }}</span>
39
+ <meta content="{{ formatted_title }}">
40
+
41
+ <!-- AVOID: Repeating the same filter chain -->
42
+ <span>{{ product.title | upcase | truncate: 50 }}</span>
43
+ <meta content="{{ product.title | upcase | truncate: 50 }}">
44
+ ```
45
+
46
+ ### Limit Loop Output
47
+
48
+ ```liquid
49
+ <!-- Limit collection loops to prevent slow pages -->
50
+ {% for product in collection.products limit: 12 %}
51
+ {% render 'product-card', product: product %}
52
+ {% endfor %}
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Security
58
+
59
+ ### Escape User Content
60
+
61
+ Always escape output that may contain user-generated content:
62
+
63
+ ```liquid
64
+ <!-- Escape text output -->
65
+ {{ customer.first_name | escape }}
66
+ {{ product.description | strip_html }}
67
+
68
+ <!-- Safe for attribute values -->
69
+ <div title="{{ product.title | escape }}">
70
+ ```
71
+
72
+ ### Avoid Inline Scripts from Settings
73
+
74
+ ```liquid
75
+ <!-- AVOID: Injecting settings directly into script -->
76
+ <script>var x = {{ section.settings.value }};</script>
77
+
78
+ <!-- BETTER: Use data attributes -->
79
+ <div data-value="{{ section.settings.value | escape }}"></div>
80
+ <script>
81
+ var x = document.querySelector('[data-value]').dataset.value;
82
+ </script>
83
+ ```
84
+
85
+ ### Use json Filter for Data
86
+
87
+ ```liquid
88
+ <!-- Safe way to pass Liquid data to JavaScript -->
89
+ <script>
90
+ var product = {{ product | json }};
91
+ </script>
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Accessibility
97
+
98
+ ### Semantic HTML
99
+
100
+ ```liquid
101
+ <!-- Use proper heading hierarchy -->
102
+ <h1>{{ page_title }}</h1>
103
+ <h2>{{ section.settings.title }}</h2>
104
+
105
+ <!-- Use semantic elements -->
106
+ <nav>{% render 'navigation' %}</nav>
107
+ <main>{{ content_for_layout }}</main>
108
+ <footer>{% render 'footer' %}</footer>
109
+ ```
110
+
111
+ ### Image Alt Text
112
+
113
+ ```liquid
114
+ <!-- Always provide alt text -->
115
+ {{ product.cover_media | image_tag: alt: product.title }}
116
+
117
+ <!-- Handle missing alt text -->
118
+ {% assign alt = product.cover_media.alt | default: product.title %}
119
+ <img src="{{ product.cover_media | image_url }}" alt="{{ alt }}">
120
+ ```
121
+
122
+ ### Form Labels
123
+
124
+ ```liquid
125
+ <label for="email">{{ "form.email" | t }}</label>
126
+ <input type="email" id="email" name="email" required>
127
+ ```
128
+
129
+ ---
130
+
131
+ ### Use Snippets for Reuse
132
+
133
+ Extract repeated markup into snippets:
134
+
135
+ ```liquid
136
+ <!-- Instead of duplicating product card markup in 5 sections -->
137
+ {% render 'product-card', product: product, show_price: true %}
138
+ ```
139
+
140
+ ### Consistent Naming
141
+
142
+ | Element | Convention | Example |
143
+ |---------|-----------|---------|
144
+ | Files | lowercase, hyphens | `product-card.liquid` |
145
+ | Setting IDs | snake_case | `button_color` |
146
+ | CSS classes | lowercase, hyphens | `product-card--featured` |
147
+ | Variables | snake_case | `sale_price` |
148
+ | Translation keys | dot-separated | `product.add_to_cart` |
149
+
150
+ ### Schema Best Practices
151
+
152
+ - Always set a `default` value for every setting
153
+ - Use translation keys (`t:`) for labels in multi-language themes
154
+ - Group related settings logically
155
+ - Keep sections under 300 lines — split large sections into snippets
156
+
157
+ ---
158
+
159
+ ## Theme Editor UX
160
+
161
+ ### Provide Sensible Defaults
162
+
163
+ Every section should look good out of the box:
164
+
165
+ ```json
166
+ {
167
+ "type": "text",
168
+ "id": "title",
169
+ "label": "Heading",
170
+ "default": "Featured Products"
171
+ }
172
+ ```
173
+
174
+ ### Use Conditional Visibility
175
+
176
+ Hide irrelevant settings based on other setting values:
177
+
178
+ ```json
179
+ {
180
+ "type": "text",
181
+ "id": "button_text",
182
+ "label": "Button Text",
183
+ "default": "Learn More",
184
+ "visible_if": "{{ show_button }}"
185
+ }
186
+ ```
187
+
188
+ ### Order Settings Logically
189
+
190
+ Place the most important settings first (title, content) and styling options last (colors, spacing).
191
+
192
+ ---
193
+
194
+ ## Deployment Checklist
195
+
196
+ Before uploading your theme, verify the items below. Items marked with **auto** are automatically handled by `npx @zohofinance/commerce theme build` — you don't need to do them manually.
197
+
198
+ **You need to verify:**
199
+ - [ ] All settings have default values
200
+ - [ ] No hardcoded text — all strings use `t` filter
201
+ - [ ] Images are compressed and optimized
202
+ - [ ] Tested on mobile and desktop
203
+ - [ ] All sections render correctly in the theme editor
204
+ - [ ] Translation files cover all locales
205
+
206
+ **Handled automatically by the CLI build:**
207
+ - [ ] `fingerprint.json` is generated correctly *(auto)*
208
+ - [ ] CSS and JS are minified *(auto — with `--prod`)*
209
+ - [ ] Liquid, JS and asset files are validated *(auto)*
210
+ - [ ] No broken asset references *(auto)*
211
+
212
+ > Run `npx @zohofinance/commerce theme build --prod` and it takes care of all the auto items above — fingerprinting, minification, Brotli compression, and full validation in one step.