@atlashub/smartstack-cli 3.21.0 → 3.22.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 (28) hide show
  1. package/dist/index.js +17 -5
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +68 -3
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/skills/application/references/application-roles-template.md +2 -2
  7. package/templates/skills/application/steps/step-05-frontend.md +40 -35
  8. package/templates/skills/application/templates-frontend.md +64 -36
  9. package/templates/skills/business-analyse/html/ba-interactive.html +80 -6
  10. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +38 -6
  11. package/templates/skills/business-analyse/html/src/styles/06-wireframes.css +42 -0
  12. package/templates/skills/business-analyse/references/acceptance-criteria.md +169 -0
  13. package/templates/skills/business-analyse/references/deploy-data-build.md +5 -3
  14. package/templates/skills/business-analyse/references/handoff-file-templates.md +2 -1
  15. package/templates/skills/business-analyse/references/naming-conventions.md +245 -0
  16. package/templates/skills/business-analyse/references/validate-incremental-html.md +26 -4
  17. package/templates/skills/business-analyse/references/validation-checklist.md +31 -11
  18. package/templates/skills/business-analyse/references/wireframe-svg-style-guide.md +335 -0
  19. package/templates/skills/business-analyse/steps/step-03b-ui.md +59 -0
  20. package/templates/skills/business-analyse/steps/step-03c-compile.md +114 -0
  21. package/templates/skills/business-analyse/steps/step-03d-validate.md +144 -22
  22. package/templates/skills/business-analyse/steps/step-05a-handoff.md +114 -2
  23. package/templates/skills/business-analyse/steps/step-05b-deploy.md +28 -0
  24. package/templates/skills/ralph-loop/references/category-rules.md +5 -2
  25. package/templates/skills/ralph-loop/references/compact-loop.md +52 -1
  26. package/templates/skills/ralph-loop/references/core-seed-data.md +232 -21
  27. package/templates/skills/ralph-loop/steps/step-01-task.md +36 -4
  28. package/templates/skills/ralph-loop/steps/step-02-execute.md +81 -0
@@ -0,0 +1,335 @@
1
+ # Wireframe SVG Style Guide
2
+
3
+ > **Purpose:** Self-contained specification for generating professional SVG wireframes from ASCII art.
4
+ > This document is sent as the FULL prompt to a Sonnet Task agent alongside the ASCII wireframe.
5
+ > Referenced by: `validate-incremental-html.md` (Step 3-bis), `step-05b-deploy.md` (Section 7-bis)
6
+
7
+ ## Agent Prompt Template
8
+
9
+ > **USAGE:** Read this section, replace `{placeholders}` with actual wireframe data, send as the complete prompt to a Task(sonnet) agent. The agent returns ONLY the SVG markup string.
10
+
11
+ ---
12
+
13
+ You are a professional UI wireframe designer. Convert the following ASCII wireframe into a high-quality SVG wireframe that looks like a modern web application mockup.
14
+
15
+ ### Input
16
+
17
+ **Screen name:** `{screenName}`
18
+ **Module:** `{moduleName}`
19
+ **Section type:** `{sectionType}` (list|detail|create|dashboard|approve)
20
+ **ASCII wireframe:**
21
+ ```
22
+ {asciiContent}
23
+ ```
24
+
25
+ **Element metadata (if available):**
26
+ ```json
27
+ {elementsJson}
28
+ ```
29
+
30
+ ### Output Requirements
31
+
32
+ Return ONLY the SVG markup as a single `<svg>` element. No explanation, no markdown, no code fences.
33
+ The SVG must be self-contained (no external fonts, no external CSS, no `<image>` tags).
34
+
35
+ ### Visual Design System
36
+
37
+ #### Viewport & Canvas
38
+ - `viewBox="0 0 960 {dynamicHeight}"` — width fixed at 960, height adapts to content
39
+ - Minimum height: 540 for list views, 720 for detail views, 480 for dashboards
40
+ - Background: `#1e293b` (dark card background matching the HTML theme)
41
+ - 24px padding on all sides
42
+ - Root element: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 {height}">`
43
+
44
+ #### Color Palette (MUST use these exact colors)
45
+
46
+ | Role | Color | Usage |
47
+ |------|-------|-------|
48
+ | Background | `#1e293b` | Main canvas, card backgrounds |
49
+ | Surface | `#0f172a` | Input fields, table cells, nested panels |
50
+ | Border | `#334155` | All borders, dividers, table lines |
51
+ | Border light | `#475569` | Hover states, active borders |
52
+ | Primary | `#6366f1` | Primary buttons, active tabs, selected items |
53
+ | Primary hover | `#4f46e5` | Button hover state accent |
54
+ | Primary light | `#818cf8` | Links, column headers, highlighted text |
55
+ | Accent | `#06b6d4` | Secondary actions, info badges |
56
+ | Text bright | `#e2e8f0` | Headings, table header text, important labels |
57
+ | Text | `#b8c4d1` | Body text, table cell content |
58
+ | Text muted | `#8a9bb0` | Placeholders, secondary labels, pagination |
59
+ | Success | `#22c55e` | Active/approved status badges |
60
+ | Success bg | `rgba(34,197,94,0.15)` | Status badge background |
61
+ | Warning | `#eab308` | Pending/draft status badges |
62
+ | Warning bg | `rgba(234,179,8,0.15)` | Status badge background |
63
+ | Error | `#ef4444` | Error states, delete buttons |
64
+ | Gray | `#94a3b8` | Inactive/draft status |
65
+ | Gray bg | `rgba(100,116,139,0.15)` | Status badge background |
66
+ | Row hover | `rgba(99,102,241,0.05)` | Table row hover |
67
+ | Shadow | `rgba(0,0,0,0.25)` | Drop shadow for cards |
68
+
69
+ #### Typography (embedded via system fonts)
70
+
71
+ - Font family: `'Inter', 'Segoe UI', system-ui, sans-serif` (use `font-family` attribute on EVERY `<text>`)
72
+ - Page title: 18px, font-weight 600, color `#e2e8f0`
73
+ - Section heading: 14px, font-weight 600, color `#e2e8f0`
74
+ - Table header: 11px, font-weight 600, text-transform uppercase, letter-spacing 0.05em, color `#8a9bb0`
75
+ - Body text / table cells: 13px, font-weight 400, color `#b8c4d1`
76
+ - Button text: 13px, font-weight 500, color `#ffffff`
77
+ - Small text / badges: 11px, font-weight 500
78
+ - Placeholder text: 13px, font-weight 400, color `#8a9bb0`, font-style italic
79
+
80
+ ---
81
+
82
+ ### Component Patterns
83
+
84
+ #### Buttons (Primary)
85
+ ```xml
86
+ <rect x="{x}" y="{y}" width="{w}" height="36" rx="6" fill="#6366f1"/>
87
+ <text x="{x+w/2}" y="{y+22}" text-anchor="middle"
88
+ font-family="Inter,Segoe UI,system-ui,sans-serif" font-size="13"
89
+ font-weight="500" fill="#ffffff">{label}</text>
90
+ ```
91
+
92
+ #### Buttons (Secondary/Ghost)
93
+ ```xml
94
+ <rect x="{x}" y="{y}" width="{w}" height="36" rx="6" fill="none" stroke="#334155" stroke-width="1"/>
95
+ <text x="{x+w/2}" y="{y+22}" text-anchor="middle"
96
+ font-family="Inter,Segoe UI,system-ui,sans-serif" font-size="13"
97
+ font-weight="500" fill="#b8c4d1">{label}</text>
98
+ ```
99
+
100
+ #### Input Fields
101
+ ```xml
102
+ <rect x="{x}" y="{y}" width="{w}" height="40" rx="6" fill="#0f172a" stroke="#334155" stroke-width="1"/>
103
+ <text x="{x+12}" y="{y+25}" font-family="Inter,Segoe UI,system-ui,sans-serif"
104
+ font-size="13" fill="#8a9bb0" font-style="italic">{placeholder}</text>
105
+ ```
106
+
107
+ #### Search Bar (input with magnifying glass icon)
108
+ ```xml
109
+ <rect x="{x}" y="{y}" width="{w}" height="40" rx="6" fill="#0f172a" stroke="#334155" stroke-width="1"/>
110
+ <circle cx="{x+22}" cy="{y+18}" r="7" fill="none" stroke="#8a9bb0" stroke-width="1.5"/>
111
+ <line x1="{x+27}" y1="{y+23}" x2="{x+31}" y2="{y+27}" stroke="#8a9bb0" stroke-width="1.5" stroke-linecap="round"/>
112
+ <text x="{x+40}" y="{y+25}" font-family="Inter,Segoe UI,system-ui,sans-serif"
113
+ font-size="13" fill="#8a9bb0" font-style="italic">Rechercher...</text>
114
+ ```
115
+
116
+ #### Dropdown / Select
117
+ ```xml
118
+ <rect x="{x}" y="{y}" width="{w}" height="40" rx="6" fill="#0f172a" stroke="#334155" stroke-width="1"/>
119
+ <text x="{x+12}" y="{y+25}" font-family="Inter,Segoe UI,system-ui,sans-serif"
120
+ font-size="13" fill="#b8c4d1">{selectedValue}</text>
121
+ <path d="M{x+w-24},{y+16} l6,8 l6,-8" fill="#8a9bb0"/>
122
+ ```
123
+
124
+ #### Data Table
125
+ - Header row: background `#0f172a`, text uppercase 11px, color `#8a9bb0`, letter-spacing 0.05em
126
+ - Data rows: alternating `#1e293b` and `rgba(15,23,42,0.5)`, height 44px
127
+ - Row hover: one sample row with `rgba(99,102,241,0.05)` fill
128
+ - Column dividers: `stroke="#334155"` at 0.5 opacity
129
+ - Cell padding: 16px horizontal
130
+ - Header height: 40px
131
+ - Action column (rightmost): 3-dot vertical ellipsis menu icon
132
+
133
+ #### Status Badges
134
+ ```xml
135
+ <!-- Active/Approved (green) -->
136
+ <rect x="{x}" y="{y}" width="{w}" height="22" rx="11" fill="rgba(34,197,94,0.15)"/>
137
+ <circle cx="{x+10}" cy="{y+11}" r="3" fill="#4ade80"/>
138
+ <text x="{x+18}" y="{y+15}" font-family="Inter,Segoe UI,system-ui,sans-serif"
139
+ font-size="11" font-weight="500" fill="#4ade80">{label}</text>
140
+
141
+ <!-- Pending/Warning (yellow) -->
142
+ <rect x="{x}" y="{y}" width="{w}" height="22" rx="11" fill="rgba(234,179,8,0.15)"/>
143
+ <circle cx="{x+10}" cy="{y+11}" r="3" fill="#facc15"/>
144
+ <text x="{x+18}" y="{y+15}" font-family="Inter,Segoe UI,system-ui,sans-serif"
145
+ font-size="11" font-weight="500" fill="#facc15">{label}</text>
146
+
147
+ <!-- Inactive/Draft (gray) -->
148
+ <rect x="{x}" y="{y}" width="{w}" height="22" rx="11" fill="rgba(100,116,139,0.15)"/>
149
+ <circle cx="{x+10}" cy="{y+11}" r="3" fill="#94a3b8"/>
150
+ <text x="{x+18}" y="{y+15}" font-family="Inter,Segoe UI,system-ui,sans-serif"
151
+ font-size="11" font-weight="500" fill="#94a3b8">{label}</text>
152
+ ```
153
+
154
+ #### Cards / Panels
155
+ ```xml
156
+ <defs>
157
+ <filter id="shadow" x="-2%" y="-2%" width="104%" height="104%">
158
+ <feDropShadow dx="0" dy="2" stdDeviation="4" flood-color="#000000" flood-opacity="0.25"/>
159
+ </filter>
160
+ </defs>
161
+ <rect x="{x}" y="{y}" width="{w}" height="{h}" rx="12" fill="#1e293b" stroke="#334155" stroke-width="1" filter="url(#shadow)"/>
162
+ ```
163
+
164
+ #### Tabs
165
+ ```xml
166
+ <!-- Active tab -->
167
+ <rect x="{x}" y="{y}" width="{w}" height="36" rx="6" fill="#6366f1"/>
168
+ <text x="{x+w/2}" y="{y+22}" text-anchor="middle" font-family="Inter,Segoe UI,system-ui,sans-serif"
169
+ font-size="13" font-weight="500" fill="#ffffff">{label}</text>
170
+
171
+ <!-- Inactive tab -->
172
+ <rect x="{x}" y="{y}" width="{w}" height="36" rx="6" fill="transparent"/>
173
+ <text x="{x+w/2}" y="{y+22}" text-anchor="middle" font-family="Inter,Segoe UI,system-ui,sans-serif"
174
+ font-size="13" font-weight="400" fill="#8a9bb0">{label}</text>
175
+ ```
176
+
177
+ #### Pagination
178
+ ```xml
179
+ <text x="{x}" y="{y}" font-family="Inter,Segoe UI,system-ui,sans-serif"
180
+ font-size="12" fill="#8a9bb0">1-25 de 142</text>
181
+ <!-- Active page -->
182
+ <rect x="{px}" y="{py}" width="28" height="28" rx="6" fill="#6366f1"/>
183
+ <text x="{px+14}" y="{py+18}" text-anchor="middle" font-family="Inter,Segoe UI,system-ui,sans-serif"
184
+ font-size="12" font-weight="500" fill="#fff">1</text>
185
+ <!-- Inactive page -->
186
+ <rect x="{px+32}" y="{py}" width="28" height="28" rx="6" fill="none" stroke="#334155"/>
187
+ <text x="{px+46}" y="{py+18}" text-anchor="middle" font-family="Inter,Segoe UI,system-ui,sans-serif"
188
+ font-size="12" fill="#8a9bb0">2</text>
189
+ ```
190
+
191
+ #### KPI Cards (Dashboard)
192
+ ```xml
193
+ <rect x="{x}" y="{y}" width="{w}" height="80" rx="8" fill="#334155"/>
194
+ <text x="{x+w/2}" y="{y+35}" text-anchor="middle" font-family="Inter,Segoe UI,system-ui,sans-serif"
195
+ font-size="22" font-weight="700" fill="#e2e8f0">{value}</text>
196
+ <text x="{x+w/2}" y="{y+55}" text-anchor="middle" font-family="Inter,Segoe UI,system-ui,sans-serif"
197
+ font-size="11" fill="#8a9bb0">{label}</text>
198
+ ```
199
+
200
+ #### Chart Placeholder (Dashboard)
201
+ ```xml
202
+ <rect x="{x}" y="{y}" width="{w}" height="180" rx="8" fill="none"
203
+ stroke="#334155" stroke-dasharray="6,4"/>
204
+ <text x="{x+w/2}" y="{y+90}" text-anchor="middle" font-family="Inter,Segoe UI,system-ui,sans-serif"
205
+ font-size="13" fill="#8a9bb0">{chartLabel}</text>
206
+ ```
207
+
208
+ #### Back Button / Navigation
209
+ ```xml
210
+ <path d="M{x},{y+10} l-8,-10 l8,-10" fill="none" stroke="#818cf8" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
211
+ <text x="{x+8}" y="{y+5}" font-family="Inter,Segoe UI,system-ui,sans-serif"
212
+ font-size="13" font-weight="500" fill="#818cf8">Retour a la liste</text>
213
+ ```
214
+
215
+ #### Form Layout (2-column)
216
+ ```xml
217
+ <!-- Label -->
218
+ <text x="{x}" y="{y}" font-family="Inter,Segoe UI,system-ui,sans-serif"
219
+ font-size="12" font-weight="500" fill="#8a9bb0">{fieldLabel}</text>
220
+ <!-- Input below label (12px gap) -->
221
+ <rect x="{x}" y="{y+8}" width="{colWidth}" height="40" rx="6" fill="#0f172a" stroke="#334155" stroke-width="1"/>
222
+ <text x="{x+12}" y="{y+33}" font-family="Inter,Segoe UI,system-ui,sans-serif"
223
+ font-size="13" fill="#b8c4d1">{value or placeholder}</text>
224
+ ```
225
+
226
+ ---
227
+
228
+ ### Section-Specific Layout Rules
229
+
230
+ **List Page Layout:**
231
+ 1. Page header (title left + primary action button right) at y=24
232
+ 2. Filter bar below header (search + dropdowns) at y=72
233
+ 3. Data table occupying remaining space at y=128
234
+ 4. Pagination bar at bottom
235
+
236
+ **Detail Page Layout:**
237
+ 1. Back button + breadcrumb at y=24
238
+ 2. Entity header (code + name + status badge + action buttons) at y=60
239
+ 3. Horizontal divider at y=100
240
+ 4. Tab bar at y=112
241
+ 5. Active tab content area at y=160
242
+
243
+ **Create/Edit Form Layout:**
244
+ 1. Form title at y=24
245
+ 2. Two-column grid of form fields (label above input) starting at y=64
246
+ 3. Horizontal divider before actions
247
+ 4. Cancel + Submit buttons right-aligned at bottom
248
+
249
+ **Dashboard Layout:**
250
+ 1. KPI cards in a 4-column grid at y=24
251
+ 2. 2-column grid of chart placeholders at y=128
252
+ 3. Optional filter bar above KPIs
253
+
254
+ ---
255
+
256
+ ### Quality Rules (MANDATORY)
257
+
258
+ 1. **Every `<text>` element** MUST have the `font-family` attribute set
259
+ 2. **No external dependencies** — no `<use>`, no `<image>`, no `xlink:href`
260
+ 3. **All text must be readable** — contrast ratio >=4.5:1 on its background
261
+ 4. **Consistent spacing** — 24px margin, 16px padding, 12px gap between form fields
262
+ 5. **Rounded corners everywhere** — `rx="6"` minimum for interactive elements, `rx="12"` for cards
263
+ 6. **No `<style>` blocks** — all styling via inline attributes (inline SVG in HTML can conflict with host CSS)
264
+ 7. **viewBox only, no width/height on root `<svg>`** — let the container handle sizing
265
+ 8. **Use realistic but fictional data** — French locale, Swiss franc format (12'500.00 CHF), European dates (15.01.2026)
266
+ 9. **Match the ASCII structure exactly** — same number of columns, same sections, same buttons. Do not add or remove UI elements.
267
+ 10. **Ensure table columns match** — if ASCII shows 5 columns, SVG must show exactly 5 columns with the same headers
268
+
269
+ ---
270
+
271
+ ### Fallback
272
+
273
+ If you cannot produce a valid SVG (e.g., ASCII is too ambiguous or malformed), return EXACTLY the string:
274
+ ```
275
+ FALLBACK_ASCII
276
+ ```
277
+ This signals the system to use the ASCII wireframe instead.
278
+
279
+ ---
280
+
281
+ ## Orchestration Instructions
282
+
283
+ > **FOR the agent executing step-03d 11-bis or step-05b**: Follow this process to generate SVGs.
284
+
285
+ ### Step-by-step process:
286
+
287
+ 1. **Read** this file to get the prompt template (the "Agent Prompt Template" section above)
288
+
289
+ 2. **Collect** all wireframes that need SVG:
290
+ ```javascript
291
+ const wireframesToProcess = [];
292
+ for (const [moduleCode, wireframes] of Object.entries(EMBEDDED_ARTIFACTS.wireframes)) {
293
+ for (let i = 0; i < wireframes.length; i++) {
294
+ const wf = wireframes[i];
295
+ if (wf.content && !wf.svgContent) {
296
+ wireframesToProcess.push({ moduleCode, index: i, wf });
297
+ }
298
+ }
299
+ }
300
+ ```
301
+
302
+ 3. **Spawn parallel Task(sonnet) agents** — ONE per wireframe, ALL in a single message:
303
+ ```
304
+ FOR EACH { moduleCode, index, wf } in wireframesToProcess:
305
+ Task(sonnet) prompt = this file's prompt template with substitutions:
306
+ {screenName} = wf.screen
307
+ {moduleName} = moduleCode
308
+ {sectionType} = wf.section
309
+ {asciiContent} = wf.content
310
+ {elementsJson} = JSON.stringify(wf.elements || [])
311
+ ```
312
+
313
+ 4. **Collect and validate** results:
314
+ ```javascript
315
+ FOR EACH result:
316
+ // Strip markdown code fences if agent wrapped output
317
+ let svg = result.trim();
318
+ if (svg.startsWith('```')) {
319
+ svg = svg.replace(/^```(?:xml|svg|html)?\n?/, '').replace(/\n?```$/, '').trim();
320
+ }
321
+
322
+ IF svg starts with "<svg" AND svg contains "</svg>":
323
+ EMBEDDED_ARTIFACTS.wireframes[moduleCode][index].svgContent = svg
324
+ ELSE:
325
+ // Graceful fallback: leave svgContent as null
326
+ // HTML renders ASCII automatically
327
+ ```
328
+
329
+ 5. **Display summary** (non-blocking):
330
+ ```
331
+ SVG wireframes: {generated}/{total} generated successfully
332
+ ```
333
+
334
+ > **CRITICAL:** SVG generation is NEVER blocking. If all generations fail, deployment
335
+ > proceeds with ASCII-only wireframes. SVG is an enhancement, not a requirement.
@@ -196,6 +196,13 @@ A wireframe without `componentMapping` or `layout` will FAIL validation in step
196
196
  > ```
197
197
  > **FORBIDDEN FORMAT:** wireframe with only `name` + `mockup` + `layout: "grid"` (string).
198
198
  > Every wireframe MUST have ALL fields above. Missing metadata causes empty frames in the HTML documentation.
199
+ >
200
+ > **FORBIDDEN FIELD NAMES (will cause EMPTY wireframes in HTML):**
201
+ > - `"ascii"` → use `"mockup"` (the HTML deploy maps `mockup` → `content`)
202
+ > - `"title"` → use `"screen"` (the HTML deploy maps `screen` → `screen`)
203
+ > - `"content"` → use `"mockup"` (source field must be `mockup`, `content` is the HTML-side name)
204
+ > - `"name"` → use `"screen"` (source field must be `screen`, `name` is a fallback only)
205
+ > The agent MUST write wireframes using the EXACT field names in the STRUCTURE CARD above.
199
206
 
200
207
  > **IF client rejects a mockup:** Revise and re-propose until validated. Do NOT proceed without client approval on the layout.
201
208
 
@@ -348,6 +355,58 @@ Before proceeding to step-03c-compile.md, VERIFY:
348
355
 
349
356
  ---
350
357
 
358
+ ### INTERMEDIATE WRITE: Persist Wireframes Immediately (MANDATORY)
359
+
360
+ > **WHY:** Wireframes exist only in conversation memory between step-03b and step-03d section 11.
361
+ > If the context is truncated (token limit, long conversation), wireframes are LOST forever.
362
+ > By writing them NOW, we guarantee persistence regardless of context management.
363
+
364
+ After SELF-VERIFICATION passes, persist wireframes to the module feature.json:
365
+
366
+ ```
367
+ ba-writer.enrichSection({
368
+ featureId: {module_feature_id},
369
+ section: "specification.uiWireframes",
370
+ data: {uiWireframes array from memory}
371
+ })
372
+ ```
373
+
374
+ > **NOTE:** step-03d section 11 will do a FULL write of all specification data.
375
+ > This intermediate write ensures wireframes survive context truncation.
376
+ > step-03d will OVERWRITE this with the complete data — no conflict.
377
+
378
+ ### POST-CHECK: Wireframe Persistence Verification (BLOCKING)
379
+
380
+ > **This check runs AFTER the intermediate write to verify wireframes are actually persisted.**
381
+ > It reads the REAL file on disk — not in-memory data the model "thinks" it wrote.
382
+
383
+ ```bash
384
+ MODULE_JSON="{module_feature_json_path}"
385
+ node -e "
386
+ const fs = require('fs');
387
+ const data = JSON.parse(fs.readFileSync(process.argv[1], 'utf-8'));
388
+ const spec = data.specification || {};
389
+ const wf = spec.uiWireframes || spec.wireframes || [];
390
+ const sections = spec.sections || [];
391
+ console.log('WIREFRAMES: ' + wf.length);
392
+ console.log('SECTIONS: ' + sections.length);
393
+ if (wf.length === 0) { console.error('BLOCKING: 0 wireframes found in feature.json'); process.exit(1); }
394
+ if (wf.length < sections.length) { console.error('BLOCKING: ' + wf.length + ' wireframes < ' + sections.length + ' sections'); process.exit(1); }
395
+ const empty = wf.filter(w => !w.mockup && !w.ascii && !w.content);
396
+ if (empty.length > 0) { console.error('BLOCKING: ' + empty.length + ' wireframes have EMPTY mockup content'); process.exit(1); }
397
+ const badFields = wf.filter(w => !w.screen || w.title || w.ascii);
398
+ if (badFields.length > 0) { console.error('WARNING: ' + badFields.length + ' wireframes use forbidden field names (title/ascii) — auto-fix needed'); }
399
+ console.log('PASS: All ' + wf.length + ' wireframes present with content');
400
+ " "$MODULE_JSON"
401
+ ```
402
+
403
+ IF this check FAILS:
404
+ - Re-read the wireframes from conversation context (they were displayed as ASCII art)
405
+ - Re-write them to feature.json using ba-writer with correct field names (`screen`, `mockup`, `mockupFormat`)
406
+ - Re-run the POST-CHECK until PASS
407
+
408
+ ---
409
+
351
410
  ## NEXT STEP
352
411
 
353
412
  Load: `steps/step-03c-compile.md`
@@ -85,6 +85,71 @@ Generate the complete specification for this module. **Each subsection below inc
85
85
  >
86
86
  > **BaseEntity inheritance:** All entities inherit `tenantId`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy` from SmartStack.BaseEntity. Do NOT redeclare these. Document this once at the top of the entities section.
87
87
 
88
+ #### ENTITY ATTRIBUTE FORMAT POST-CHECK (BLOCKING — runs for EVERY module including the first)
89
+
90
+ > **CRITICAL:** This check ensures EVERY entity attribute has a structured `type` field.
91
+ > It runs for ALL modules, not just modules 2+. The first module is NOT exempt.
92
+ > Without `type`, ralph-loop cannot generate correct C# properties, EF configurations, or validators.
93
+
94
+ After compiling entities for this module, verify and auto-fix:
95
+
96
+ ```javascript
97
+ const entities = analysis.entities || [];
98
+ let autoFixCount = 0;
99
+ for (const entity of entities) {
100
+ for (const attr of entity.attributes || []) {
101
+ if (!attr.type) {
102
+ // BLOCKING: attribute has no type — likely free-text validation only
103
+ console.error(`BLOCKING: ${entity.name}.${attr.name} has no "type" field`);
104
+ console.error(` Found: ${JSON.stringify(attr)}`);
105
+ console.error(` Expected: { "name": "${attr.name}", "type": "string|int|decimal|...", "maxLength": ..., "required": ... }`);
106
+ // AUTO-FIX: Infer type from validation string or attribute name
107
+ if (attr.validation?.match(/max\s*\d+/i) || attr.name.match(/name|title|code|description|label|email|phone|address/i)) {
108
+ attr.type = "string";
109
+ const maxMatch = attr.validation?.match(/max\s*(\d+)/i);
110
+ if (maxMatch) attr.maxLength = parseInt(maxMatch[1]);
111
+ } else if (attr.name.match(/id$/i)) {
112
+ attr.type = "Guid";
113
+ } else if (attr.name.match(/date|At$/i)) {
114
+ attr.type = "DateTime";
115
+ } else if (attr.name.match(/is[A-Z]|has[A-Z]|active|enabled/)) {
116
+ attr.type = "bool";
117
+ } else if (attr.name.match(/amount|salary|rate|price|total/i)) {
118
+ attr.type = "decimal";
119
+ } else if (attr.name.match(/count|number|order|sort|index/i)) {
120
+ attr.type = "int";
121
+ }
122
+ // Default to string if no pattern matched
123
+ if (!attr.type) attr.type = "string";
124
+ autoFixCount++;
125
+ }
126
+ // Normalize free-text validation into structured maxLength
127
+ if (typeof attr.validation === 'string' && !attr.maxLength) {
128
+ const maxMatch = attr.validation.match(/max\s*(\d+)/i);
129
+ if (maxMatch) attr.maxLength = parseInt(maxMatch[1]);
130
+ }
131
+ // Ensure required defaults to true if absent
132
+ if (attr.required === undefined) attr.required = true;
133
+ }
134
+ }
135
+ if (autoFixCount > 0) {
136
+ console.warn(`AUTO-FIXED ${autoFixCount} attributes with missing type — verify correctness`);
137
+ }
138
+ ```
139
+
140
+ > **Type inference priority table:**
141
+ >
142
+ > | Attribute name pattern | Inferred type | Example |
143
+ > |----------------------|---------------|---------|
144
+ > | `name\|title\|code\|description\|label\|email\|phone\|address` | `string` | `positionTitle` → `string` |
145
+ > | `*Id` (ends with Id) | `Guid` | `departmentId` → `Guid` |
146
+ > | `*date\|*At` (ends with date/At) | `DateTime` | `hireDate` → `DateTime` |
147
+ > | `is*\|has*\|active\|enabled` | `bool` | `isActive` → `bool` |
148
+ > | `amount\|salary\|rate\|price\|total` | `decimal` | `hourlyRate` → `decimal` |
149
+ > | `count\|number\|order\|sort\|index` | `int` | `displayOrder` → `int` |
150
+ > | `validation` contains `max NNN` | `string` + `maxLength: NNN` | `"Max 200"` → `string`, `200` |
151
+ > | No match | `string` (safe default) | — |
152
+
88
153
  ---
89
154
 
90
155
  #### 8a. Actors
@@ -446,8 +511,55 @@ Before loading step-03d-validate, verify all 12 subsections (8a-8l) are populate
446
511
  11. **8k. API Endpoints** - RESTful routes with permissions
447
512
  12. **8l. i18n Keys** - Translation keys in 4 languages (fr, en, it, de)
448
513
 
514
+ 13. **Wireframes present** — `(specification.uiWireframes || specification.wireframes || []).length >= 1` (BLOCKING)
515
+ Quick check: the wireframe data from step-03b MUST still be in memory OR persisted to feature.json
516
+ (step-03b now writes wireframes intermediately). If wireframes are empty:
517
+ - First, re-read the module feature.json to check if step-03b wrote them
518
+ - If present in file but not in memory → load them from file
519
+ - If absent everywhere → **STOP** and reload step-03b to regenerate wireframes
520
+
449
521
  **IF any subsection is missing → STOP and request the missing data before proceeding.**
450
522
 
523
+ **ABSOLUTE FORMAT CHECKS (apply to ALL modules, including the first):**
524
+
525
+ > These checks validate against the canonical schema — NOT comparatively against another module.
526
+ > They run BEFORE the SCHEMA UNIFORMITY comparative check, ensuring the first module has the
527
+ > correct format before being used as baseline for subsequent modules.
528
+
529
+ ```javascript
530
+ // Gherkin MUST be array (not single object)
531
+ if (!Array.isArray(specification.gherkinScenarios)) {
532
+ console.warn('AUTO-FIX: gherkinScenarios is object, wrapping in array');
533
+ specification.gherkinScenarios = [specification.gherkinScenarios];
534
+ }
535
+
536
+ // Validations[].rules MUST be array (not singular rule string)
537
+ for (const v of specification.validations || []) {
538
+ if (typeof v.rules === 'string') { v.rules = [v.rules]; }
539
+ if (v.rule && !v.rules) {
540
+ v.rules = Array.isArray(v.rule) ? v.rule : [v.rule];
541
+ delete v.rule;
542
+ }
543
+ }
544
+
545
+ // Messages MUST have "message" field (not only "description")
546
+ for (const m of specification.messages || []) {
547
+ if (!m.message && m.description) { m.message = m.description; }
548
+ }
549
+
550
+ // Wireframes MUST use canonical field names
551
+ const wireframes = specification.uiWireframes || specification.wireframes || [];
552
+ for (const wf of wireframes) {
553
+ if (wf.title && !wf.screen) { wf.screen = wf.title; delete wf.title; }
554
+ if (wf.ascii && !wf.mockup) { wf.mockup = wf.ascii; delete wf.ascii; }
555
+ if (wf.content && !wf.mockup) { wf.mockup = wf.content; delete wf.content; }
556
+ if (wf.name && !wf.screen) { wf.screen = wf.name; delete wf.name; }
557
+ }
558
+ specification.uiWireframes = wireframes;
559
+
560
+ // Entity attributes MUST have "type" field (already checked in ENTITY ATTRIBUTE FORMAT POST-CHECK above)
561
+ ```
562
+
451
563
  **SCHEMA UNIFORMITY CHECK (multi-module mode):**
452
564
  IF this is NOT the first module in moduleOrder:
453
565
  Compare THIS module's specification structure against the FIRST specified module:
@@ -456,6 +568,8 @@ IF this is NOT the first module in moduleOrder:
456
568
  - `messages[]` MUST have `message` field in ALL modules
457
569
  - `specification.apiEndpoints[]` MUST be present in ALL modules
458
570
  - `specification.i18nKeys` MUST be present in ALL modules
571
+ - `analysis.entities[].attributes[].type` MUST be present on ALL attributes in ALL modules
572
+ - IF first module has free-text-only attributes without `type` field → AUTO-FIX with type inference
459
573
  IF any structural divergence detected → AUTO-FIX to match the canonical format before proceeding.
460
574
 
461
575
  ---