@decocms/start 0.19.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 (185) hide show
  1. package/.cursor/skills/deco-api-call-dedup/SKILL.md +443 -0
  2. package/.cursor/skills/deco-apps-architecture/SKILL.md +255 -0
  3. package/.cursor/skills/deco-apps-architecture/app-pattern.md +288 -0
  4. package/.cursor/skills/deco-apps-architecture/commerce-types.md +239 -0
  5. package/.cursor/skills/deco-apps-architecture/new-app-guide.md +268 -0
  6. package/.cursor/skills/deco-apps-architecture/scripts-codegen.md +148 -0
  7. package/.cursor/skills/deco-apps-architecture/shared-utils.md +181 -0
  8. package/.cursor/skills/deco-apps-architecture/vtex-deep-structure.md +253 -0
  9. package/.cursor/skills/deco-apps-architecture/website-app.md +169 -0
  10. package/.cursor/skills/deco-apps-vtex-porting/SKILL.md +189 -0
  11. package/.cursor/skills/deco-apps-vtex-porting/adaptation-patterns.md +335 -0
  12. package/.cursor/skills/deco-apps-vtex-porting/commerce-porting.md +155 -0
  13. package/.cursor/skills/deco-apps-vtex-porting/cookie-auth-patterns.md +148 -0
  14. package/.cursor/skills/deco-apps-vtex-porting/structure-map.md +234 -0
  15. package/.cursor/skills/deco-apps-vtex-porting/transform-mapping.md +99 -0
  16. package/.cursor/skills/deco-apps-vtex-porting/website-porting.md +194 -0
  17. package/.cursor/skills/deco-apps-vtex-review/SKILL.md +234 -0
  18. package/.cursor/skills/deco-async-rendering-architecture/SKILL.md +270 -0
  19. package/.cursor/skills/deco-async-rendering-site-guide/SKILL.md +417 -0
  20. package/.cursor/skills/deco-cms-layout-caching/SKILL.md +293 -0
  21. package/.cursor/skills/deco-cms-route-config/SKILL.md +388 -0
  22. package/.cursor/skills/deco-core-architecture/SKILL.md +185 -0
  23. package/.cursor/skills/deco-core-architecture/blocks.md +196 -0
  24. package/.cursor/skills/deco-core-architecture/deco-vs-deco-start.md +191 -0
  25. package/.cursor/skills/deco-core-architecture/engine.md +220 -0
  26. package/.cursor/skills/deco-core-architecture/hooks-components.md +157 -0
  27. package/.cursor/skills/deco-core-architecture/plugins-clients.md +136 -0
  28. package/.cursor/skills/deco-core-architecture/runtime.md +116 -0
  29. package/.cursor/skills/deco-core-architecture/site-usage.md +165 -0
  30. package/.cursor/skills/deco-e2e-testing/SKILL.md +372 -0
  31. package/.cursor/skills/deco-e2e-testing/discovery.md +337 -0
  32. package/.cursor/skills/deco-e2e-testing/scripts/scaffold.sh +81 -0
  33. package/.cursor/skills/deco-e2e-testing/selectors.md +175 -0
  34. package/.cursor/skills/deco-e2e-testing/templates/package.json +18 -0
  35. package/.cursor/skills/deco-e2e-testing/templates/playwright.config.ts +65 -0
  36. package/.cursor/skills/deco-e2e-testing/templates/scripts/baseline.ts +279 -0
  37. package/.cursor/skills/deco-e2e-testing/templates/scripts/run-e2e.ts +194 -0
  38. package/.cursor/skills/deco-e2e-testing/templates/specs/ecommerce-flow.spec.ts +612 -0
  39. package/.cursor/skills/deco-e2e-testing/templates/tsconfig.json +12 -0
  40. package/.cursor/skills/deco-e2e-testing/templates/utils/metrics-collector.ts +918 -0
  41. package/.cursor/skills/deco-e2e-testing/troubleshooting.md +602 -0
  42. package/.cursor/skills/deco-edge-caching/SKILL.md +316 -0
  43. package/.cursor/skills/deco-full-analysis/SKILL.md +898 -0
  44. package/.cursor/skills/deco-full-analysis/checklists/asset-optimization.md +251 -0
  45. package/.cursor/skills/deco-full-analysis/checklists/bug-fix.md +189 -0
  46. package/.cursor/skills/deco-full-analysis/checklists/cache-strategy.md +144 -0
  47. package/.cursor/skills/deco-full-analysis/checklists/dependency-update.md +150 -0
  48. package/.cursor/skills/deco-full-analysis/checklists/hydration-fix.md +191 -0
  49. package/.cursor/skills/deco-full-analysis/checklists/image-optimization.md +180 -0
  50. package/.cursor/skills/deco-full-analysis/checklists/loader-optimization.md +165 -0
  51. package/.cursor/skills/deco-full-analysis/checklists/seo-fix.md +183 -0
  52. package/.cursor/skills/deco-full-analysis/checklists/site-cleanup.md +281 -0
  53. package/.cursor/skills/deco-full-analysis/discovery.md +548 -0
  54. package/.cursor/skills/deco-incident-debugging/SKILL.md +378 -0
  55. package/.cursor/skills/deco-incident-debugging/headless-mode.md +510 -0
  56. package/.cursor/skills/deco-incident-debugging/learnings-index.md +227 -0
  57. package/.cursor/skills/deco-incident-debugging/triage-workflow.md +312 -0
  58. package/.cursor/skills/deco-islands-migration/SKILL.md +251 -0
  59. package/.cursor/skills/deco-loader-n-plus-1-detector/SKILL.md +275 -0
  60. package/.cursor/skills/deco-performance-audit/SKILL.md +530 -0
  61. package/.cursor/skills/deco-performance-audit/tools-reference.md +428 -0
  62. package/.cursor/skills/deco-performance-audit/workflow.md +457 -0
  63. package/.cursor/skills/deco-server-functions-invoke/SKILL.md +92 -0
  64. package/.cursor/skills/deco-server-functions-invoke/architecture.md +166 -0
  65. package/.cursor/skills/deco-server-functions-invoke/generator.md +122 -0
  66. package/.cursor/skills/deco-server-functions-invoke/problem.md +98 -0
  67. package/.cursor/skills/deco-server-functions-invoke/troubleshooting.md +110 -0
  68. package/.cursor/skills/deco-site-deployment/SKILL.md +396 -0
  69. package/.cursor/skills/deco-site-memory-debugging/SKILL.md +121 -0
  70. package/.cursor/skills/deco-site-memory-debugging/cdp-connection.md +222 -0
  71. package/.cursor/skills/deco-site-memory-debugging/memory-analysis.md +362 -0
  72. package/.cursor/skills/deco-site-patterns/SKILL.md +124 -0
  73. package/.cursor/skills/deco-site-patterns/app-composition.md +337 -0
  74. package/.cursor/skills/deco-site-patterns/client-patterns.md +341 -0
  75. package/.cursor/skills/deco-site-patterns/cms-wiring.md +230 -0
  76. package/.cursor/skills/deco-site-patterns/section-patterns.md +340 -0
  77. package/.cursor/skills/deco-site-scaling-tuning/SKILL.md +240 -0
  78. package/.cursor/skills/deco-site-scaling-tuning/analysis-scripts.md +267 -0
  79. package/.cursor/skills/deco-start-architecture/SKILL.md +218 -0
  80. package/.cursor/skills/deco-start-architecture/admin-protocol.md +156 -0
  81. package/.cursor/skills/deco-start-architecture/cms-resolution.md +201 -0
  82. package/.cursor/skills/deco-start-architecture/code-quality.md +158 -0
  83. package/.cursor/skills/deco-start-architecture/gap-analysis.md +129 -0
  84. package/.cursor/skills/deco-start-architecture/sdk-utilities.md +197 -0
  85. package/.cursor/skills/deco-start-architecture/worker-entry-caching.md +154 -0
  86. package/.cursor/skills/deco-startup-analysis/SKILL.md +248 -0
  87. package/.cursor/skills/deco-storefront-test-checklist/SKILL.md +369 -0
  88. package/.cursor/skills/deco-tanstack-hydration-fixes/SKILL.md +468 -0
  89. package/.cursor/skills/deco-tanstack-navigation/SKILL.md +681 -0
  90. package/.cursor/skills/deco-tanstack-search/SKILL.md +411 -0
  91. package/.cursor/skills/deco-tanstack-storefront-patterns/SKILL.md +1013 -0
  92. package/.cursor/skills/deco-to-tanstack-migration/SKILL.md +518 -0
  93. package/.cursor/skills/deco-to-tanstack-migration/references/codemod-commands.md +174 -0
  94. package/.cursor/skills/deco-to-tanstack-migration/references/commerce/README.md +78 -0
  95. package/.cursor/skills/deco-to-tanstack-migration/references/deco-framework/README.md +128 -0
  96. package/.cursor/skills/deco-to-tanstack-migration/references/gotchas.md +719 -0
  97. package/.cursor/skills/deco-to-tanstack-migration/references/imports/README.md +70 -0
  98. package/.cursor/skills/deco-to-tanstack-migration/references/platform-hooks/README.md +154 -0
  99. package/.cursor/skills/deco-to-tanstack-migration/references/signals/README.md +220 -0
  100. package/.cursor/skills/deco-to-tanstack-migration/references/vite-config/README.md +78 -0
  101. package/.cursor/skills/deco-to-tanstack-migration/templates/package-json.md +55 -0
  102. package/.cursor/skills/deco-to-tanstack-migration/templates/root-route.md +110 -0
  103. package/.cursor/skills/deco-to-tanstack-migration/templates/router.md +96 -0
  104. package/.cursor/skills/deco-to-tanstack-migration/templates/setup-ts.md +167 -0
  105. package/.cursor/skills/deco-to-tanstack-migration/templates/vite-config.md +122 -0
  106. package/.cursor/skills/deco-to-tanstack-migration/templates/worker-entry.md +67 -0
  107. package/.cursor/skills/deco-typescript-fixes/SKILL.md +178 -0
  108. package/.cursor/skills/deco-typescript-fixes/common-fixes.md +330 -0
  109. package/.cursor/skills/deco-typescript-fixes/strategy.md +148 -0
  110. package/.cursor/skills/deco-variant-selection-perf/SKILL.md +272 -0
  111. package/.cursor/skills/deco-vtex-fetch-cache/SKILL.md +225 -0
  112. package/.cursor/skills/find-skills/SKILL.md +133 -0
  113. package/.cursor/skills/incident-report/SKILL.md +179 -0
  114. package/.cursor/skills/incident-report/references/5-whys.md +75 -0
  115. package/.cursor/skills/incident-report/templates/client-report.md +187 -0
  116. package/.cursor/skills/incident-report/templates/internal-report.md +206 -0
  117. package/.cursor/skills/template-skill/SKILL.md +38 -0
  118. package/.github/workflows/release.yml +32 -0
  119. package/.releaserc.json +25 -0
  120. package/CLAUDE.md +135 -0
  121. package/GAP_ANALYSIS.md +224 -0
  122. package/GAP_ANALYSIS_V2.md +1013 -0
  123. package/biome.json +39 -0
  124. package/knip.json +5 -0
  125. package/package.json +87 -0
  126. package/scripts/generate-blocks.ts +69 -0
  127. package/scripts/generate-invoke.ts +378 -0
  128. package/scripts/generate-schema.ts +657 -0
  129. package/src/admin/cors.ts +29 -0
  130. package/src/admin/decofile.ts +72 -0
  131. package/src/admin/index.ts +24 -0
  132. package/src/admin/invoke.ts +163 -0
  133. package/src/admin/liveControls.ts +29 -0
  134. package/src/admin/meta.ts +70 -0
  135. package/src/admin/render.ts +205 -0
  136. package/src/admin/schema.ts +686 -0
  137. package/src/admin/setup.ts +44 -0
  138. package/src/cms/index.ts +59 -0
  139. package/src/cms/loader.ts +180 -0
  140. package/src/cms/registry.ts +162 -0
  141. package/src/cms/resolve.ts +1005 -0
  142. package/src/cms/sectionLoaders.ts +294 -0
  143. package/src/hooks/DecoPageRenderer.tsx +444 -0
  144. package/src/hooks/LazySection.tsx +109 -0
  145. package/src/hooks/LiveControls.tsx +108 -0
  146. package/src/hooks/SectionErrorFallback.tsx +85 -0
  147. package/src/hooks/index.ts +8 -0
  148. package/src/index.ts +5 -0
  149. package/src/matchers/builtins.ts +184 -0
  150. package/src/matchers/posthog.ts +154 -0
  151. package/src/middleware/decoState.ts +55 -0
  152. package/src/middleware/healthMetrics.ts +131 -0
  153. package/src/middleware/index.ts +80 -0
  154. package/src/middleware/liveness.ts +21 -0
  155. package/src/middleware/observability.ts +205 -0
  156. package/src/routes/adminRoutes.ts +83 -0
  157. package/src/routes/cmsRoute.ts +302 -0
  158. package/src/routes/components.tsx +34 -0
  159. package/src/routes/index.ts +15 -0
  160. package/src/sdk/analytics.ts +72 -0
  161. package/src/sdk/cacheHeaders.ts +268 -0
  162. package/src/sdk/cachedLoader.ts +206 -0
  163. package/src/sdk/clx.ts +3 -0
  164. package/src/sdk/cookie.ts +39 -0
  165. package/src/sdk/createInvoke.ts +57 -0
  166. package/src/sdk/csp.ts +59 -0
  167. package/src/sdk/env.ts +27 -0
  168. package/src/sdk/index.ts +63 -0
  169. package/src/sdk/instrumentedFetch.ts +137 -0
  170. package/src/sdk/invoke.ts +133 -0
  171. package/src/sdk/mergeCacheControl.ts +150 -0
  172. package/src/sdk/redirects.ts +217 -0
  173. package/src/sdk/requestContext.ts +184 -0
  174. package/src/sdk/serverTimings.ts +68 -0
  175. package/src/sdk/signal.ts +41 -0
  176. package/src/sdk/sitemap.ts +143 -0
  177. package/src/sdk/urlUtils.ts +117 -0
  178. package/src/sdk/useDevice.ts +82 -0
  179. package/src/sdk/useId.ts +7 -0
  180. package/src/sdk/useScript.ts +101 -0
  181. package/src/sdk/workerEntry.ts +703 -0
  182. package/src/sdk/wrapCaughtErrors.ts +107 -0
  183. package/src/types/index.ts +39 -0
  184. package/src/types/widgets.ts +13 -0
  185. package/tsconfig.json +13 -0
@@ -0,0 +1,548 @@
1
+ # Site Discovery Guide
2
+
3
+ Step-by-step process to analyze a Deco site's implementation.
4
+
5
+ ## Step 1: Framework & Dependencies
6
+
7
+ Read `deno.json` to understand:
8
+
9
+ ```typescript
10
+ // Key things to extract:
11
+ {
12
+ "imports": {
13
+ "@deco/deco": "...", // Deco version
14
+ "@deco/dev": "...", // Dev tools version
15
+ "apps/": "...", // Apps source (official or forked)
16
+ "preact": "...", // UI library
17
+ "$fresh/": "..." // Fresh framework (if present)
18
+ },
19
+ "tasks": {
20
+ "dev": "...", // How to run locally
21
+ "start": "...", // Production start
22
+ "build": "..." // Build command
23
+ }
24
+ }
25
+ ```
26
+
27
+ ### Determine Stack Type
28
+
29
+ | Indicator | Stack |
30
+ |-----------|-------|
31
+ | `$fresh/` import | Fresh (SSR + Islands) |
32
+ | `@deco/deco/htmx` import | HTMX |
33
+ | `islands/` directory | Fresh (interactive) |
34
+ | `hx-*` attributes in sections | HTMX |
35
+
36
+ ### Detect Platform
37
+
38
+ | Import Pattern | Platform |
39
+ |----------------|----------|
40
+ | `apps/vtex/` usage in blocks | VTEX |
41
+ | `apps/shopify/` usage | Shopify |
42
+ | `apps/wake/` usage | Wake |
43
+ | `apps/vnda/` usage | VNDA |
44
+
45
+ ### Check for Unused Platform Files
46
+
47
+ Most Deco sites start from templates that include files for **all** platforms. If the site only uses one platform (e.g., VTEX), the other platform files are dead code.
48
+
49
+ ```bash
50
+ # Find platform-specific files that might be unused
51
+ for platform in vtex shopify wake linx vnda nuvemshop; do
52
+ echo "$platform: $(find . -name "*$platform*" -type f 2>/dev/null | wc -l) files"
53
+ done
54
+
55
+ # Check which platform is actually configured
56
+ grep -r "__resolveType.*apps/vtex\|apps/shopify\|apps/wake" .deco/blocks/ | head -5
57
+ ```
58
+
59
+ **Common locations of unused platform files:**
60
+ - `components/header/Buttons/Cart/{platform}.tsx`
61
+ - `components/minicart/{platform}/Cart.tsx`
62
+ - `components/product/AddToCartButton/{platform}.tsx`
63
+ - `islands/AddToCartButton/{platform}.tsx`
64
+ - `islands/Header/Cart/{platform}.tsx`
65
+
66
+ **Document in AGENTS.md:**
67
+ ```markdown
68
+ ## Platform Cleanup Status
69
+
70
+ | Check | Status |
71
+ |-------|--------|
72
+ | Active platform | VTEX |
73
+ | Unused platform files | 25 files (shopify, wake, linx, vnda, nuvemshop) |
74
+ | Platform switching logic | Components have unnecessary conditionals |
75
+ | Recommended action | Run site-cleanup checklist |
76
+ ```
77
+
78
+ See [site-cleanup.md](checklists/site-cleanup.md) for detailed cleanup steps.
79
+
80
+ ---
81
+
82
+ ## Step 2: Apps Configuration
83
+
84
+ Check which apps are installed by looking at:
85
+
86
+ 1. **deno.json imports**: `apps/` source
87
+ 2. **apps/ directory**: Local app configurations
88
+ 3. **.deco/blocks/**: Which app loaders/sections are used
89
+
90
+ ### Common App Patterns
91
+
92
+ ```json
93
+ // .deco/blocks/site.json or apps config
94
+ {
95
+ "__resolveType": "apps/vtex/mod.ts",
96
+ "account": "storename",
97
+ "platform": "vtex"
98
+ }
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Step 3: Page Blocks Analysis
104
+
105
+ List all page blocks:
106
+ ```bash
107
+ ls .deco/blocks/pages-*.json
108
+ ```
109
+
110
+ Key pages to identify:
111
+ | Page Type | Common Block Names |
112
+ |-----------|-------------------|
113
+ | Home | `pages-Home*`, `pages-Principal*` |
114
+ | PDP | `pages-PDP*`, `pages-Product*` |
115
+ | PLP | `pages-PLP*`, `pages-Category*` |
116
+ | Search | `pages-Search*`, `pages-Busca*` |
117
+ | Cart | `pages-Cart*`, `pages-Carrinho*` |
118
+ | Checkout | `pages-Checkout*` |
119
+ | Login | `pages-Login*`, `pages-SignIn*` |
120
+ | My Account | `pages-MyAccount*`, `pages-Account*` |
121
+
122
+ ### Analyze a Page Block
123
+
124
+ ```json
125
+ // .deco/blocks/pages-Home-123.json
126
+ {
127
+ "name": "Home (principal)",
128
+ "__resolveType": "website/pages/Page.tsx",
129
+ "sections": [
130
+ // List of sections on this page
131
+ { "__resolveType": "site/sections/Header/Header.tsx" },
132
+ { "__resolveType": "site/sections/Hero/HeroBanner.tsx" },
133
+ // Lazy sections
134
+ {
135
+ "__resolveType": "website/sections/Rendering/Lazy.tsx",
136
+ "section": { "__resolveType": "site/sections/Product/ProductShelf.tsx" }
137
+ }
138
+ ]
139
+ }
140
+ ```
141
+
142
+ ### Section Resolution Types
143
+
144
+ | Pattern | Meaning |
145
+ |---------|---------|
146
+ | `site/sections/*` | Custom section in this repo |
147
+ | `website/sections/*` | From website app |
148
+ | `vtex/sections/*` | From VTEX app |
149
+ | `Rendering/Lazy.tsx` | Lazy-loaded wrapper |
150
+ | `Rendering/Deferred.tsx` | Deferred loading |
151
+
152
+ ### Build Lazy Loading Map
153
+
154
+ For each key page, identify:
155
+ 1. Which sections are above-the-fold (sync rendered)
156
+ 2. Which sections are wrapped in `Rendering/Lazy.tsx`
157
+
158
+ ```bash
159
+ # Find all lazy sections in page blocks
160
+ grep -r "Rendering/Lazy.tsx" .deco/blocks/pages-*.json
161
+ ```
162
+
163
+ Document in a table:
164
+ | Page | Lazy Sections | Above Fold |
165
+ |------|---------------|------------|
166
+ | Home | ProductShelf, Reviews | HeroBanner, Categories |
167
+
168
+ ---
169
+
170
+ ## Step 3.5: Map Navigation Flow
171
+
172
+ Trace how users navigate between pages:
173
+
174
+ ### Key Entry Points
175
+ 1. **Home** (`/`) - Main landing
176
+ 2. **Search** (`/s?q=`) - Search results
177
+ 3. **Direct PDP** (via external link)
178
+
179
+ ### Connection Points
180
+ Look for:
181
+ - Links in sections that point to other pages
182
+ - Category menu structure
183
+ - Product card click targets
184
+ - Call-to-action buttons
185
+
186
+ ### Build Navigation Diagram
187
+ ```
188
+ Home (/)
189
+ ├── Search (/s) ───────────────────┐
190
+ ├── Category (PLP) ────────────────┤
191
+ │ └── Subcategory ─────────────┤
192
+ └── Product Cards ────────────────→┴─→ PDP (/:slug/p)
193
+ ├── Add to Cart → Minicart
194
+ └── Buy Now → Checkout
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Step 4: Custom Code Inventory
200
+
201
+ ### Sections
202
+ ```bash
203
+ find sections -name "*.tsx" | wc -l # Count
204
+ find sections -name "*.tsx" # List
205
+ ```
206
+
207
+ Categorize by directory:
208
+ - `sections/Header/` - Header components
209
+ - `sections/Footer/` - Footer components
210
+ - `sections/Product/` - Product display
211
+ - `sections/Content/` - Content blocks
212
+ - `sections/Gallery/` - Image galleries
213
+
214
+ ### Loaders
215
+ ```bash
216
+ find loaders -name "*.ts" | wc -l # Count
217
+ find loaders -name "*.ts" # List
218
+ ```
219
+
220
+ Important loaders to note:
221
+ - Search loaders (intelligent search, suggestions)
222
+ - Product loaders (details, recommendations)
223
+ - User loaders (geolocation, session)
224
+
225
+ ### Caching Inventory
226
+
227
+ Audit which loaders have cache headers:
228
+
229
+ ```bash
230
+ # Find loaders WITH cache
231
+ grep -l "export const cache" loaders/**/*.ts
232
+
233
+ # Find loaders WITHOUT cache (potential issues)
234
+ grep -L "export const cache" loaders/**/*.ts
235
+ ```
236
+
237
+ For each loader, check for:
238
+ ```typescript
239
+ // Good: Has caching
240
+ export const cache = "stale-while-revalidate";
241
+ export const cacheKey = (props: Props) => `${props.id}`;
242
+
243
+ // Bad: No caching - every request hits origin
244
+ export default async function loader(props: Props) { ... }
245
+ ```
246
+
247
+ Build a caching inventory table:
248
+ | Loader | Cache | TTL | Priority to Fix |
249
+ |--------|-------|-----|-----------------|
250
+ | `loaders/search/intelligenseSearch.ts` | ❌ None | - | 🔴 High (hot path) |
251
+ | `loaders/product/buyTogether.ts` | ✅ SWR | 5min | - |
252
+ | `loaders/getUserGeolocation.ts` | ❌ None | - | 🟡 Medium |
253
+
254
+ ### Actions
255
+ ```bash
256
+ find actions -name "*.ts" | wc -l # Count
257
+ find actions -name "*.ts" # List
258
+ ```
259
+
260
+ Common actions:
261
+ - Cart operations
262
+ - Newsletter signup
263
+ - User authentication
264
+
265
+ ### Islands (Fresh interactive components)
266
+ ```bash
267
+ find islands -name "*.tsx" | wc -l # Count
268
+ find islands -name "*.tsx" # List
269
+ ```
270
+
271
+ ---
272
+
273
+ ## Step 5: Understanding Custom Implementations
274
+
275
+ ### Search for Deco Docs
276
+ Use `SearchDecoCx` to understand patterns:
277
+
278
+ ```
279
+ SearchDecoCx({ query: "lazy loading sections" })
280
+ SearchDecoCx({ query: "caching loaders" })
281
+ SearchDecoCx({ query: "VTEX integration" })
282
+ ```
283
+
284
+ ### Common Customizations
285
+
286
+ | Customization | Where to Look |
287
+ |---------------|---------------|
288
+ | Custom search | `loaders/search/` |
289
+ | Product enrichment | `loaders/product/` |
290
+ | Cart modifications | `actions/cart/` |
291
+ | Header/Menu | `sections/Header/`, `.deco/blocks/Header*.json` |
292
+ | Checkout flow | `sections/Checkout/`, `routes/` |
293
+
294
+ ---
295
+
296
+ ## Step 5.5: Document Debugging Tips
297
+
298
+ Gather common debugging scenarios for this specific site:
299
+
300
+ ### Debug Flags
301
+ ```
302
+ ?__d - Server timing with loader breakdown
303
+ ?__d=verbose - Extended debug info
304
+ ```
305
+
306
+ ### Common Issues to Document
307
+
308
+ | Issue | How to Debug |
309
+ |-------|--------------|
310
+ | Section not rendering | Check `.deco/blocks/pages-*.json` for `__resolveType` |
311
+ | Loader returning empty | Add `console.log`, check browser devtools |
312
+ | Slow page load | Check lazy sections with `?__d` flag |
313
+ | Cache not working | Verify `export const cache` in loader file |
314
+ | Platform API errors | Check account config in `.deco/blocks/` |
315
+
316
+ ### Find Platform Configuration
317
+ ```bash
318
+ # VTEX
319
+ grep -r "myvtex.com" .deco/blocks/ --include="*.json"
320
+
321
+ # Shopify
322
+ grep -r "myshopify.com" .deco/blocks/ --include="*.json"
323
+ ```
324
+
325
+ ### Trace Lazy Section Performance
326
+ In browser devtools, filter Network tab by `/deco/render` to see:
327
+ - Which sections are lazy-loaded
328
+ - Their response times
329
+ - Cache hit/miss (x-cache header)
330
+
331
+ ---
332
+
333
+ ## Step 6: Block Validation
334
+
335
+ Run the block validator (validate-blocks) to check configuration health:
336
+
337
+ ```bash
338
+ # Run directly from any deco site (no installation needed)
339
+ deno run -A https://deco.cx/validate -report validation-report.json
340
+ ```
341
+
342
+ > **Note:** This command works without any setup. Just run it from the site's root directory.
343
+
344
+ ### What to Capture
345
+
346
+ | Category | What to Document |
347
+ |----------|------------------|
348
+ | **Error Count** | Sections/loaders/actions with type mismatches |
349
+ | **Unused Count** | Files not referenced in any block |
350
+ | **Warning Count** | Extra properties not in Props |
351
+ | **Top Errors** | List files with most errors |
352
+
353
+ ### Using the JSON Report
354
+
355
+ The `-report` flag generates a structured JSON file:
356
+
357
+ ```json
358
+ {
359
+ "timestamp": "2024-01-15T10:30:00.000Z",
360
+ "summary": {
361
+ "totalSections": 133,
362
+ "totalErrors": 15,
363
+ "totalWarnings": 4,
364
+ "unusedSections": 8,
365
+ "validSections": 110
366
+ },
367
+ "sectionsWithErrors": [...],
368
+ "unusedSections": [...]
369
+ }
370
+ ```
371
+
372
+ Use this to automatically populate AGENTS.md Block Health section.
373
+
374
+ ### Generate Diagnostics MD Report
375
+
376
+ After running validation, create a human-readable diagnostics file (`BLOCKS_DIAGNOSTICS.md`):
377
+
378
+ ```bash
379
+ # 1. Run validation with JSON report
380
+ deno run -A https://deco.cx/validate -report validation-report.json
381
+
382
+ # 2. Read the JSON and create BLOCKS_DIAGNOSTICS.md with:
383
+ ```
384
+
385
+ **BLOCKS_DIAGNOSTICS.md should contain:**
386
+
387
+ | Section | Content |
388
+ |---------|---------|
389
+ | **Summary Table** | Total files, valid %, errors, warnings, unused |
390
+ | **Critical Issues** | Top errors grouped by root cause with impact assessment |
391
+ | **Sections with Errors** | Table of files, error counts, issue descriptions |
392
+ | **Loader/Action Errors** | Separate table for non-section files |
393
+ | **Warnings** | Props interface issues, extra properties |
394
+ | **Unused Code Inventory** | Categorized lists: sections, loaders, actions |
395
+ | **Recommendations** | Prioritized fixes (Priority 1/2/3 with impact level) |
396
+ | **How to Re-run** | Commands to regenerate reports |
397
+
398
+ **Example structure:**
399
+
400
+ ```markdown
401
+ # Block Validation Diagnostics - [Site Name]
402
+
403
+ **Generated:** [Date]
404
+
405
+ ## Summary
406
+
407
+ | Metric | Count |
408
+ |--------|-------|
409
+ | **Total files analyzed** | 139 |
410
+ | **Valid (no issues)** | 82 (59%) |
411
+ | **With errors** | 13 (9%) |
412
+ | **Unused files** | 42 (30%) |
413
+ | **Total errors** | 367 |
414
+
415
+ ## Critical Issues
416
+
417
+ ### 1. Footer Type Mismatch (327 errors)
418
+
419
+ **File:** `sections/Footer/Footer.tsx`
420
+ **Impact:** HIGH - Affects 62 pages
421
+
422
+ The `security.images` property changed schema...
423
+
424
+ ## Unused Code (42 files)
425
+
426
+ ### Unused Sections (14 files)
427
+ | Section | Notes |
428
+ |---------|-------|
429
+ | `sections/ShippingSimulation.tsx` | Consider removal |
430
+
431
+ ### Unused Loaders (23 files)
432
+ | Category | Files |
433
+ |----------|-------|
434
+ | **SAP Integration** | getUser.ts, createUploadLink.ts, ... |
435
+
436
+ ## Recommendations
437
+
438
+ ### Priority 1 - Fix Footer Schema (HIGH)
439
+ ...
440
+ ```
441
+
442
+ ### Common Error Types
443
+
444
+ | Error | Meaning | Fix |
445
+ |-------|---------|-----|
446
+ | "required property missing" | Block JSON missing a required prop | Add the property to the block |
447
+ | "expected array, got object" | Type mismatch | Fix JSON structure |
448
+ | "Props interface not found in file" | Can't parse Props from TSX | Check file exports |
449
+ | "not used in any JSON" | Section/loader/action has no occurrences | Consider removing or adding to a page |
450
+ | "property not defined in type" | Extra prop in JSON | Remove with `-rm-vars` |
451
+
452
+ ### Block Health Table for AGENTS.md
453
+
454
+ ```markdown
455
+ ## Block Health
456
+
457
+ | Status | Count |
458
+ |--------|-------|
459
+ | ✅ Valid | 85 |
460
+ | ⚠️ Warnings | 3 |
461
+ | ⚠️ Unused | 14 |
462
+ | ❌ Errors | 8 |
463
+
464
+ **Files with errors** (fix these):
465
+ - sections/Product/NotFound.tsx (7 errors)
466
+ - loaders/SAP/createCase.ts (9 errors)
467
+
468
+ **Unused files** (candidates for removal):
469
+ - sections/Product/Wishlist.tsx
470
+ - sections/Social/InstagramPosts.tsx
471
+ ```
472
+
473
+ ---
474
+
475
+ ## Step 7: Git History Analysis
476
+
477
+ ### Top Contributors
478
+ ```bash
479
+ git log --format='%an <%ae>' | sort | uniq -c | sort -rn | head -10
480
+ ```
481
+
482
+ ### Recent Activity
483
+ ```bash
484
+ git log --oneline -20
485
+ ```
486
+
487
+ ### File Change Frequency
488
+ ```bash
489
+ git log --format='' --name-only | sort | uniq -c | sort -rn | head -20
490
+ ```
491
+
492
+ ---
493
+
494
+ ## Step 7: Generate AGENTS.md
495
+
496
+ Compile all findings into AGENTS.md:
497
+
498
+ 1. **Framework Summary** - Versions, stack type
499
+ 2. **Platform Details** - VTEX/Shopify/etc config
500
+ 3. **Page Architecture** - Key pages and their blocks
501
+ 4. **Custom Code** - Sections, loaders, actions count
502
+ 5. **Top Contributors** - Code owners
503
+ 6. **Run Commands** - How to start locally
504
+ 7. **Important Files** - Key files to know
505
+
506
+ ---
507
+
508
+ ## Step 8: Update README.md
509
+
510
+ If README is missing or outdated, update:
511
+
512
+ 1. **Project Description** - What is this site?
513
+ 2. **Quick Start** - How to run
514
+ 3. **Prerequisites** - Deno version, env vars
515
+ 4. **Architecture Link** - Point to AGENTS.md
516
+ 5. **Contributing** - How to contribute
517
+
518
+ ### README Template
519
+
520
+ ```markdown
521
+ # [Site Name]
522
+
523
+ [Brief description]
524
+
525
+ ## Quick Start
526
+
527
+ \`\`\`bash
528
+ # Install Deno (if needed)
529
+ curl -fsSL https://deno.land/install.sh | sh
530
+
531
+ # Run locally
532
+ deno task dev
533
+ \`\`\`
534
+
535
+ ## Architecture
536
+
537
+ See [AGENTS.md](./AGENTS.md) for detailed architecture documentation.
538
+
539
+ ## Environment Variables
540
+
541
+ Copy `.env.example` to `.env` and configure:
542
+ - `VTEX_ACCOUNT` - VTEX account name
543
+ - ...
544
+
545
+ ## Top Contributors
546
+
547
+ [Auto-generated from git history]
548
+ ```