@atlashub/smartstack-cli 3.1.0 → 3.3.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 (39) hide show
  1. package/.documentation/prd-json-v2.0.0.md +396 -0
  2. package/.documentation/testing-ba-e2e.md +462 -0
  3. package/dist/index.js +605 -25
  4. package/dist/index.js.map +1 -1
  5. package/package.json +6 -2
  6. package/templates/agents/ba-reader.md +1 -1
  7. package/templates/agents/ba-writer.md +8 -1
  8. package/templates/skills/business-analyse/SKILL.md +46 -31
  9. package/templates/skills/business-analyse/_architecture.md +123 -0
  10. package/templates/skills/business-analyse/_elicitation.md +206 -0
  11. package/templates/skills/business-analyse/_module-loop.md +56 -0
  12. package/templates/skills/business-analyse/_shared.md +75 -531
  13. package/templates/skills/business-analyse/_suggestions.md +34 -0
  14. package/templates/skills/business-analyse/html/ba-interactive.html +146 -57
  15. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  16. package/templates/skills/business-analyse/questionnaire.md +22 -17
  17. package/templates/skills/business-analyse/react/components.md +1 -1
  18. package/templates/skills/business-analyse/react/schema.md +1 -1
  19. package/templates/skills/business-analyse/references/html-data-mapping.md +294 -0
  20. package/templates/skills/business-analyse/schemas/feature-schema.json +1 -1
  21. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  22. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +1 -1
  23. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  24. package/templates/skills/business-analyse/steps/step-00-init.md +85 -59
  25. package/templates/skills/business-analyse/steps/step-01-cadrage.md +2 -0
  26. package/templates/skills/business-analyse/steps/step-02-decomposition.md +5 -3
  27. package/templates/skills/business-analyse/steps/{step-03-specify.md → step-03a-specify.md} +16 -606
  28. package/templates/skills/business-analyse/steps/step-03b-compile.md +670 -0
  29. package/templates/skills/business-analyse/steps/step-04-consolidation.md +7 -5
  30. package/templates/skills/business-analyse/steps/step-05a-handoff.md +727 -0
  31. package/templates/skills/business-analyse/steps/step-05b-deploy.md +479 -0
  32. package/templates/skills/business-analyse/steps/step-06-extract.md +134 -4
  33. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  34. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +161 -0
  35. package/templates/skills/business-analyse/templates/tpl-progress.md +171 -0
  36. package/templates/skills/ralph-loop/SKILL.md +138 -20
  37. package/templates/skills/ralph-loop/steps/step-01-task.md +75 -18
  38. package/templates/skills/ralph-loop/steps/step-04-check.md +72 -5
  39. package/templates/skills/business-analyse/steps/step-05-handoff.md +0 -1414
@@ -0,0 +1,479 @@
1
+ ---
2
+ name: step-05b-deploy
3
+ description: Generate prd.json, progress.txt, deploy ba-interactive.html, manifest, user choice
4
+ model: sonnet
5
+ next_step: null
6
+ ---
7
+
8
+ > **Context files:** `_shared.md`
9
+
10
+ # Step 5b: Handoff - Deploy Artifacts
11
+
12
+ ## MANDATORY EXECUTION RULES
13
+
14
+ - **ALWAYS** verify all module handoffs are complete before generating artifacts
15
+ - **ALWAYS** derive prd.json from feature.json (NEVER independently)
16
+ - **NEVER** invent entities/FRs/BRs not in feature.json
17
+ - **ALWAYS** deploy ba-interactive.html PRE-POPULATED with all data
18
+ - **ALWAYS** update BA manifest at docs/business/index.json
19
+
20
+ ## YOUR TASK
21
+
22
+ Generate deployment artifacts from the handoff data written in step-05a: prd.json (per module), progress.txt, interactive HTML document, BA manifest, and present development approach choice to the user.
23
+
24
+ ---
25
+
26
+ ## EXECUTION SEQUENCE
27
+
28
+ ### 0. Pre-flight Verification
29
+
30
+ Before generating ANY artifact, verify step-05a completed successfully:
31
+
32
+ ```
33
+ FOR each module in modules[]:
34
+ Read module feature.json
35
+ IF module.handoff === {} OR module.status !== "handed-off":
36
+ → BLOCKING ERROR: Module {module.code} has no handoff data
37
+ → Return to step-05a-handoff.md
38
+ ```
39
+
40
+ IF all modules have valid handoff → proceed.
41
+
42
+ ---
43
+
44
+ ### 1. Generate prd.json (PROGRAMMATIC)
45
+
46
+ > **RULE:** prd.json is extracted by CLI code, **NEVER** generated by LLM.
47
+ > The `ss derive-prd` command performs a deterministic data transformation from feature.json.
48
+
49
+ **For each module:**
50
+
51
+ ```
52
+ Execute: ss derive-prd --feature {moduleFeaturePath} --output .ralph/prd-{moduleCode}.json
53
+ ```
54
+
55
+ **For consolidated view (multi-module, optional):**
56
+
57
+ ```
58
+ Execute: ss derive-prd --application {masterFeaturePath}
59
+ → Generates .ralph/prd-{moduleCode}.json for each module
60
+ ```
61
+
62
+ **Verification:** After execution, read the generated prd.json and display summary:
63
+
64
+ ```
65
+ prd.json generated for module {moduleCode}:
66
+ - Use cases: {count}
67
+ - Functional requirements: {count}
68
+ - Business rules: {count}
69
+ - API endpoints: {count}
70
+ - Sections: {count}
71
+ - Files to create: {count}
72
+ - BR-to-code mappings: {count}
73
+ ```
74
+
75
+ **Key guarantees:**
76
+ - Source MUST reference feature.json path (traceability)
77
+ - All data is EXACT COPY from feature.json (no transformation, no invention)
78
+ - prd.json version: "2.0.0"
79
+ - source.type: "ba-handoff-programmatic"
80
+
81
+ ---
82
+
83
+ ### 2. Initialize Progress Tracker
84
+
85
+ > **Template:** Read `templates/tpl-progress.md` for the complete progress tracker template structure.
86
+ > Populate the template with module-specific data from feature.json handoff sections.
87
+
88
+ **Progress Tracker Rules:**
89
+ - One section per module, in topological order (dependencies first)
90
+ - CORE SeedData ALWAYS 5 entries (mandatory)
91
+ - Business SeedData varies by module
92
+ - Hierarchical task structure (module -> layer -> tasks)
93
+ - Each task is independent, assignable checkbox
94
+ - Effort estimate per module (simple/medium/complex)
95
+ - Summary with totals across all modules
96
+ - Cross-module tasks only if multi-module
97
+
98
+ ---
99
+
100
+ ### 3. Deploy Interactive HTML Document (MANDATORY)
101
+
102
+ > **The interactive HTML document is deployed to the project PRE-POPULATED with ALL analysis data.**
103
+ > The client opens it in a browser and sees the complete analysis (cadrage, modules, entities, UCs, BRs, wireframes, permissions, consolidation).
104
+ > The client can then review, edit, enrich, and export modifications as JSON.
105
+ > That JSON can be re-imported via `/business-analyse -x` to update the feature.json.
106
+
107
+ **Source:** `html/ba-interactive.html` (relative to skill root = `~/.claude/skills/business-analyse/html/`)
108
+
109
+ **Destination:** `docs/business/{app}/business-analyse/v{version}/ba-interactive.html`
110
+
111
+ **Deployment steps:**
112
+
113
+ #### Step 1: Read source data
114
+
115
+ 1. Read the HTML template from skill directory
116
+ 2. Read the master feature.json (application level)
117
+ 3. Read EACH module feature.json (module level)
118
+
119
+ > **Reference:** Read `references/html-data-mapping.md` for the complete FEATURE_DATA and EMBEDDED_ARTIFACTS mapping specification.
120
+
121
+ **Key requirements:**
122
+ - FEATURE_DATA must be pre-populated with ALL analysis data (empty data = BUG)
123
+ - EMBEDDED_ARTIFACTS contains wireframes, E2E diagrams, dependency graph
124
+ - Both objects are serialized as JSON with 2-space indentation
125
+ - All data mapped from master and module feature.json files
126
+
127
+ #### Step 3: Replace placeholders in template
128
+
129
+ 1. Serialize the FEATURE_DATA object as JSON (with 2-space indentation for readability)
130
+ 2. Serialize the EMBEDDED_ARTIFACTS object as JSON (with 2-space indentation)
131
+ 3. Replace `{{FEATURE_DATA}}` with the serialized FEATURE_DATA JSON
132
+ 4. Replace `{{EMBEDDED_ARTIFACTS}}` with the serialized EMBEDDED_ARTIFACTS JSON
133
+ 5. Replace `{{APPLICATION_NAME}}` → `{application_name}` (still used in `<title>` and header)
134
+ 6. Replace `{{APPLICATION_ID}}` → `{feature_id}` (still used in `APP_KEY`)
135
+ 7. Replace `{{VERSION}}` → `{version}`
136
+ 8. Replace `{{CREATED_AT}}` → `{ISO timestamp}`
137
+
138
+ > **NOTE:** `{{APPLICATION_NAME}}`, `{{APPLICATION_ID}}`, `{{VERSION}}`, `{{CREATED_AT}}` still appear
139
+ > in the HTML body (`<title>`, header, `APP_KEY`). They MUST be replaced separately from FEATURE_DATA.
140
+
141
+ > **NEW:** `{{EMBEDDED_ARTIFACTS}}` is a separate JavaScript variable in the HTML that stores all visual artifacts (wireframes, E2E diagrams, dependency graph) for client-side rendering and export.
142
+
143
+ #### Step 4: Write and confirm
144
+
145
+ 1. Write the populated HTML to the output directory
146
+ 2. Display deployment confirmation:
147
+
148
+ ```
149
+ ✓ Interactive HTML deployed:
150
+ Path: docs/business/{app}/business-analyse/v{version}/ba-interactive.html
151
+ Pre-populated with: {stakeholder_count} stakeholders, {module_count} modules,
152
+ {total_uc} use cases, {total_br} business rules, {total_entity} entities
153
+ Visual artifacts: {total_wireframes} wireframes, {e2e_flow_count} E2E diagrams
154
+ Open in browser to review and edit the business analysis.
155
+ Export JSON and re-import with: /business-analyse -x <exported-json-path>
156
+ ```
157
+
158
+ **Why a FINAL deployment at handoff?**
159
+ - Step 03 already deploys the HTML incrementally after each module (partial data)
160
+ - This final deployment adds the COMPLETE data: all modules + consolidation + handoff info
161
+ - The client sees the FULL analysis pre-populated — including cross-module interactions and E2E flows
162
+ - The client can review, edit, and enrich directly in the browser
163
+ - Any client modifications can be re-imported via `-x` extraction mode
164
+ - The HTML is standalone (no server required) with localStorage persistence
165
+ - On first open: pre-populated data displays. After client edits: localStorage overrides
166
+ - **NOTE:** This overwrites the incremental HTML from step-03 with the complete version
167
+
168
+ ---
169
+
170
+ ### 4. Update BA Manifest (MANDATORY)
171
+
172
+ > **The BA manifest enables the SmartStack web app to discover and display all available business analyses.**
173
+ > It is a JSON index file at `docs/business/index.json` that lists all feature.json files.
174
+
175
+ **Path:** `docs/business/index.json` (project root relative)
176
+
177
+ **Schema:**
178
+ ```json
179
+ {
180
+ "version": "1.0",
181
+ "updatedAt": "{ISO timestamp}",
182
+ "analyses": [
183
+ {
184
+ "appCode": "{app_code}",
185
+ "appName": "{application_name}",
186
+ "moduleCode": null | "{module_code}",
187
+ "moduleName": "{module_name}",
188
+ "version": "{version}",
189
+ "status": "handed-off",
190
+ "featureDescription": "{feature_description}",
191
+ "path": "{app_code}/business-analyse/v{version}/feature.json",
192
+ "updatedAt": "{ISO timestamp}"
193
+ }
194
+ ]
195
+ }
196
+ ```
197
+
198
+ **Update logic:**
199
+
200
+ 1. Read existing manifest at `docs/business/index.json` (or create empty `{ "version": "1.0", "updatedAt": "", "analyses": [] }`)
201
+ 2. For the APPLICATION-level feature.json:
202
+ - Find existing entry where `appCode == {app_code}` AND `moduleCode == null` AND `version == {version}`
203
+ - If found: update `status`, `updatedAt`, `featureDescription`
204
+ - If not found: append new entry with `moduleCode: null` and `path: "{app_code}/business-analyse/v{version}/feature.json"`
205
+ 3. For EACH MODULE-level feature.json:
206
+ - Find existing entry where `appCode == {app_code}` AND `moduleCode == {module_code}` AND `version == {version}`
207
+ - If found: update `status`, `updatedAt`, `featureDescription`
208
+ - If not found: append new entry with `moduleCode: "{module_code}"` and `path: "{app_code}/{module_code}/business-analyse/v{version}/feature.json"`
209
+ 4. Update root `updatedAt` to current timestamp
210
+ 5. Write manifest back to `docs/business/index.json`
211
+
212
+ **Display confirmation:**
213
+ ```
214
+ ✓ BA manifest updated: docs/business/index.json
215
+ Entries: {total_count} ({app_count} applications, {module_count} modules)
216
+ Web viewer: /system/docs/ba
217
+ ```
218
+
219
+ **Why a manifest?**
220
+ - The web app needs to discover available BAs without scanning the filesystem
221
+ - Static file serving (no backend API needed)
222
+ - Incremental updates: each handoff adds/updates only its entries
223
+ - Consumed by the SmartStack web app BA viewer at `/system/docs/ba`
224
+
225
+ ---
226
+
227
+ ### 5. User Choice: Next Agent
228
+
229
+ Present development options after successful handoff:
230
+
231
+ ```
232
+ ═══════════════════════════════════════════════════════════════
233
+ ✓ HANDOFF COMPLETE - {application_name}
234
+ ═══════════════════════════════════════════════════════════════
235
+
236
+ Modules: {count} ({names})
237
+ Strategy: {strategy}
238
+ Files: {total files across all modules}
239
+ Tasks: {total tasks} ({core_count} CORE + {biz_count} business + {dev_count} development)
240
+ Complexity: {complexity}
241
+ Effort: {total_days} days ({total_hours} hours)
242
+
243
+ Generated Artifacts:
244
+ ✓ feature.json (master + per-module) - enhanced with handoff section
245
+ ✓ .ralph/prd.json or .ralph/prd-{module}.json - derived from feature.json
246
+ ✓ .ralph/progress.txt - comprehensive task tracker
247
+ ✓ ba-interactive.html - client-facing interactive review document
248
+ ✓ Implementation strategy selected: {strategy}
249
+
250
+ Next: Choose development approach
251
+ ═══════════════════════════════════════════════════════════════
252
+ ```
253
+
254
+ Ask via AskUserQuestion:
255
+
256
+ ```
257
+ question: "Quelle approche de développement souhaitez-vous utiliser ?"
258
+ header: "Approche de développement"
259
+ options:
260
+ - label: "Feature Full (Recommandé)"
261
+ description: "Génération parallèle rapide (code + tests). Couverture 70-80%. ~{hours/3} heures."
262
+ - label: "Ralph Loop"
263
+ description: "Développement itératif task-par-task avec cycle : Analyse → Dev (backend + tests unitaires + tests non-régression + frontend + tests + documentation) → Validation → Correction → Test ... jusqu'à 100% tests pass. Couverture 95-100%. ~{hours} heures."
264
+ - label: "Terminer le BA"
265
+ description: "Finir l'analyse, développement manuel par l'équipe."
266
+ ```
267
+
268
+ **Recommendations by complexity:**
269
+ - **Simple:** Feature Full (1-3 days) or Ralph Loop (2-4 days)
270
+ - **Medium:** Ralph Loop recommended (5-10 days), Feature Full possible (3-6 days)
271
+ - **Complex:** Ralph Loop strongly recommended (10-20 days), Feature Full (8-12 days)
272
+
273
+ ---
274
+
275
+ ### 5-bis. Execute User Choice (Automatic Skill Launch)
276
+
277
+ > Automatically launch the chosen development approach for seamless transition.
278
+
279
+ **After receiving AskUserQuestion response:**
280
+
281
+ > **Reference:** Read `templates/tpl-launch-displays.md` for user-facing display templates.
282
+
283
+ **Implementation:**
284
+
285
+ ```javascript
286
+ const choice = userAnswer; // "Feature Full (Recommandé)" | "Ralph Loop" | "Terminer le BA"
287
+ const choiceLabel = choice.replace(/\s*\(.*?\)\s*$/g, '').trim();
288
+
289
+ if (choiceLabel === "Ralph Loop") {
290
+ // Display: Ralph Loop explanation and configuration (from tpl-launch-displays.md)
291
+ // Then launch: Skill({ skill: "ralph-loop" });
292
+ // EXIT - ralph-loop takes over
293
+
294
+ } else if (choiceLabel === "Feature Full") {
295
+ // Display: Feature Full configuration summary (from tpl-launch-displays.md)
296
+ // Then launch: Skill({ skill: "feature-full" });
297
+ // EXIT
298
+
299
+ } else {
300
+ // Display: BA completion summary and next steps (from tpl-launch-displays.md)
301
+ // EXIT gracefully
302
+ }
303
+ ```
304
+
305
+ **Error handling:** If Skill() call fails, display manual launch instructions (see tpl-launch-displays.md).
306
+
307
+ ---
308
+
309
+ ## SELF-VERIFICATION (FINAL)
310
+
311
+ Before presenting user choice, VERIFY:
312
+
313
+ 1. **`.ralph/prd-{module}.json`** exists for ALL modules (file size > 100 bytes each)
314
+ 2. **`.ralph/progress.txt`** exists (file size > 500 bytes)
315
+ 3. **`ba-interactive.html`** exists at `docs/business/{app}/business-analyse/v{version}/` and file size > 100KB (pre-populated, not empty template)
316
+ 4. **`docs/business/index.json`** exists with correct entry count (1 app + N modules)
317
+
318
+ **IF any check fails → GENERATE the missing artifact before presenting user choice.**
319
+
320
+ ---
321
+
322
+ ## MODE SUPPORT
323
+
324
+ ### Standard Mode
325
+
326
+ Full handoff with all implementation details:
327
+ - All 7 file categories
328
+ - Complete BR-to-code mapping
329
+ - Full API endpoint summary
330
+ - Detailed prd.json
331
+ - Comprehensive progress tracker
332
+
333
+ ### Micro Mode (use_case = micro)
334
+
335
+ Simplified handoff with minimal scope:
336
+ - Only essential CRUD entity + controller
337
+ - 3 core SeedData entries (omit some optional ones)
338
+ - Basic prd.json with simplified sections
339
+ - Lightweight progress.txt
340
+ - Auto-suggest Feature Full for rapid development
341
+
342
+ ### Delta Mode (use_case = refactoring)
343
+
344
+ Focused handoff for changes:
345
+ - Only affected modules listed
346
+ - Reuse existing implementation patterns
347
+ - Highlight what changed vs baseline
348
+ - Update only affected prd.json sections
349
+ - Progress tracker shows only delta tasks
350
+
351
+ ---
352
+
353
+ ## OUTPUT
354
+
355
+ > **FORBIDDEN:** Do NOT generate separate JSON files (specification.json, analysis.json, etc.).
356
+ > **ONLY:** feature.json is the mandatory JSON deliverable.
357
+ > **PLUS:** prd.json and progress.txt are additional working files.
358
+
359
+ This step enriches **feature.json** (master + per-module) with:
360
+ - **handoff** section: complexity, implementationStrategy, moduleOrder, filesToCreate (7 categories), brToCodeMapping, apiEndpointSummary, prdFiles
361
+ - **status:** "handed-off"
362
+
363
+ Also generates working files and updates the manifest:
364
+
365
+ - **ba-interactive.html** (deployed to docs/business/{app}/business-analyse/v{version}/)
366
+ - Standalone interactive HTML document for client review
367
+ - Pre-populated with application name, ID, version
368
+ - Client can edit, add use cases, modify scope, and export JSON
369
+ - Re-importable via `/business-analyse -x <exported-json-path>`
370
+
371
+ - **.ralph/prd.json** (or .ralph/prd-{module}.json per module structure)
372
+ - Derived entirely from feature.json
373
+ - Single source of truth for development team
374
+ - Includes all entities, use cases, business rules, API endpoints
375
+ - Task breakdown and implementation sequence
376
+
377
+ - **.ralph/progress.txt**
378
+ - Main development task tracker
379
+ - Hierarchical structure (module → layer → tasks)
380
+ - Checkboxes for progress tracking
381
+ - Effort estimates per module
382
+ - Cross-module integration tasks (if multi-module)
383
+
384
+ Next agent selection via user question:
385
+ 1. **Feature Full** - Parallel rapid code generation (70-80% coverage)
386
+ 2. **Ralph Loop** - Sequential task-driven development (95-100% coverage)
387
+ 3. **End BA** - Manual development by team
388
+
389
+ ---
390
+
391
+ ## EXAMPLES & TEMPLATES
392
+
393
+ ### Example: Simple Single Module (Orders)
394
+
395
+ **Feature:** Order Management
396
+ **Module:** Orders (1 entity, 2 use cases, 3 BRs)
397
+
398
+ **Output:**
399
+ - feature.json with handoff section
400
+ - .ralph/prd.json (single consolidated file)
401
+ - .ralph/progress.txt (~150 lines, 20-30 tasks)
402
+
403
+ Strategy: Module by module (only 1 module)
404
+
405
+ ### Example: Medium Multi-Module (E-Commerce)
406
+
407
+ **Feature:** E-Commerce Platform
408
+ **Modules:** Customers (4 entities), Products (6 entities), Orders (8 entities), Invoices (3 entities)
409
+
410
+ **Dependencies:**
411
+ - Customers: Foundation (no deps)
412
+ - Products: Foundation (no deps)
413
+ - Orders: Depends on Customers + Products
414
+ - Invoices: Depends on Orders
415
+
416
+ **Output:**
417
+ - feature.json (master + 4 module features) with handoff sections
418
+ - User chooses: per-module prd (.ralph/prd-customers.json, .ralph/prd-products.json, etc.) or consolidated (.ralph/prd.json)
419
+ - .ralph/progress.txt (~400 lines, 100+ tasks)
420
+ - Module order: Customers, Products → Orders → Invoices (topological)
421
+
422
+ Strategy options: Module by module (recommended), Layer by layer, Hybrid
423
+
424
+ ### Example: Complex Multi-Module (ERP)
425
+
426
+ **Feature:** Enterprise Resource Planning
427
+ **Modules:** Accounting, Sales, Purchasing, Inventory, HR, Finance (20+ entities total, 50+ use cases, 100+ BRs)
428
+
429
+ **Output:**
430
+ - feature.json (master + 6 module features) with handoff sections
431
+ - Per-module prd.json (recommended for complexity management)
432
+ - .ralph/progress.txt (~800+ lines, 200+ tasks)
433
+
434
+ Complexity: Complex (highest across all modules)
435
+ Strategy: Hybrid recommended (Foundation modules layer-by-layer, then dependent modules module-by-module)
436
+
437
+ ---
438
+
439
+ ## VALIDATION CHECKLIST
440
+
441
+ Before presenting handoff to user:
442
+
443
+ - [ ] Status verified: "consolidated"
444
+ - [ ] Implementation strategy selected or defaulted
445
+ - [ ] Complexity calculated for each module and overall
446
+ - [ ] filesToCreate: 7 categories complete, no free text
447
+ - [ ] **WIREFRAME TRACEABILITY:** Every frontend Page/DashboardPage has `linkedWireframes[]` referencing specification.uiWireframes[].screen
448
+ - [ ] **WIREFRAME ACCEPTANCE:** Every frontend Page/DashboardPage has `wireframeAcceptanceCriteria` describing expected layout
449
+ - [ ] brToCodeMapping: All business rules from analysis.businessRules[] mapped
450
+ - [ ] apiEndpointSummary: Exact copy from specification.apiEndpoints[]
451
+ - [ ] prd.json: Derived from feature.json, not independently generated
452
+ - [ ] prd.json: Includes all UCs, FRs, BRs, entities, API endpoints from source
453
+ - [ ] progress.txt: Hierarchical, all modules in topological order, 5 CORE SeedData per module
454
+ - [ ] progress.txt: Frontend tasks reference wireframe identifiers [wireframe: {screen}]
455
+ - [ ] Module order: Follows topological dependency graph
456
+ - [ ] feature.json updated: handoff section + status "handed-off"
457
+ - [ ] All paths use project namespace from .smartstack/config.json
458
+ - [ ] No invented requirements (everything traced to feature.json)
459
+ - [ ] ba-interactive.html deployed PRE-POPULATED with all analysis data (not empty)
460
+ - [ ] BA manifest (docs/business/index.json) updated with current analysis entries
461
+ - [ ] User ready for next agent selection
462
+
463
+ ---
464
+
465
+ ## TROUBLESHOOTING
466
+
467
+ | Issue | Resolution |
468
+ |-------|-----------|
469
+ | All modules missing handoff data | Return to step-05a-handoff.md. Handoff MUST be written to each module feature.json. |
470
+ | prd.json generation failed | Verify ss derive-prd command is installed and feature.json path is correct. |
471
+ | progress.txt incomplete | Ensure all 5 CORE SeedData entries are present per module. Check topological order. |
472
+ | ba-interactive.html deployment failed | Verify output directory exists. Check file permissions. Ensure HTML template is readable. |
473
+ | BA manifest not found | Create docs/business/index.json if missing. Use schema provided in section 4. |
474
+ | User choice question failed | Catch AskUserQuestion error and display manual instructions for skill launch. |
475
+ | HTML pre-populated but empty | Verify FEATURE_DATA and EMBEDDED_ARTIFACTS objects are serialized correctly. Check JSON syntax. |
476
+
477
+ ---
478
+
479
+ END OF STEP 5b: DEPLOY ARTIFACTS
@@ -5,6 +5,8 @@ model: sonnet
5
5
  next_step: null
6
6
  ---
7
7
 
8
+ > **Context files:** `_shared.md`
9
+
8
10
  # Step 6: Extraction depuis le document interactif
9
11
 
10
12
  ## REGLES D'EXECUTION
@@ -67,13 +69,27 @@ Lire le fichier passe en argument : {extract_path}
67
69
  "businessRules": [{ "id": "", "name": "", "category": "", "statement": "", "example": "" }],
68
70
  "entities": [{ "name": "", "description": "", "attributes": [{ "name": "", "description": "" }], "relationships": [] }],
69
71
  "permissions": [],
70
- "notes": "",
71
- "mockupNotes": ""
72
+ "notes": ""
72
73
  }
73
74
  },
74
75
  "consolidation": {
75
76
  "interactions": [],
76
- "e2eFlows": [{ "name": "", "steps": [{ "module": "", "action": "" }], "actors": "" }]
77
+ "e2eFlows": [{ "name": "", "steps": [{ "module": "", "action": "" }], "actors": "", "diagram": "" }]
78
+ },
79
+ "artifacts": {
80
+ "wireframes": {
81
+ "{moduleCode}": [
82
+ { "screen": "", "section": "", "format": "ascii|svg", "content": "", "description": "",
83
+ "elements": [], "actions": [], "componentMapping": [], "layout": {}, "permissionsRequired": [] }
84
+ ]
85
+ },
86
+ "e2eFlows": [
87
+ { "name": "", "diagram": "", "steps": [], "actors": "", "modules": "" }
88
+ ],
89
+ "dependencyGraph": {
90
+ "nodes": [{ "id": "", "label": "", "type": "" }],
91
+ "edges": [{ "from": "", "to": "", "description": "" }]
92
+ }
77
93
  }
78
94
  }
79
95
  ```
@@ -407,6 +423,113 @@ ba-writer.enrichSection({
407
423
  ba-writer.updateStatus({feature_id}, "consolidated")
408
424
  ```
409
425
 
426
+ ### 6-bis. Extraire et reconstituer les artefacts visuels (NEW)
427
+
428
+ > Visual artifacts (wireframes, E2E diagrams, dependency graph) are extracted from the exported JSON and reconstituted into feature.json.
429
+
430
+ **IF** `artifacts` exists in exported JSON:
431
+
432
+ #### Extract wireframes per module
433
+
434
+ Pour chaque module dans `artifacts.wireframes`:
435
+
436
+ ```
437
+ FOR EACH moduleCode IN artifacts.wireframes:
438
+ moduleWireframes = artifacts.wireframes[moduleCode]
439
+
440
+ // Locate the module feature.json
441
+ moduleFeature = ba-reader.findModuleFeature({feature_id}, moduleCode)
442
+
443
+ // Map wireframes to specification.uiWireframes[]
444
+ uiWireframes = moduleWireframes.map(wf => ({
445
+ "screen": wf.screen,
446
+ "section": wf.section,
447
+ "mockupFormat": wf.format,
448
+ "mockup": wf.content,
449
+ "description": wf.description || "",
450
+ "elements": wf.elements || [],
451
+ "actions": wf.actions || [],
452
+ "permissionsRequired": wf.permissionsRequired || [],
453
+ "componentMapping": wf.componentMapping || [],
454
+ "layout": wf.layout || null
455
+ }))
456
+
457
+ // Write to module feature.json (enriching specification section)
458
+ ba-writer.enrichSection({
459
+ featureId: moduleFeature.id,
460
+ section: "specification",
461
+ data: { uiWireframes: uiWireframes }
462
+ })
463
+ ```
464
+
465
+ **Validation:** For each wireframe:
466
+ - `screen` must be unique within module
467
+ - `mockupFormat` must be "ascii" or "svg"
468
+ - `mockup` content must not be empty
469
+ - `componentMapping` array must have at least one entry
470
+ - `layout` object must have `type` and `regions` if present
471
+
472
+ #### Extract E2E flow diagrams
473
+
474
+ IF `artifacts.e2eFlows` exists:
475
+
476
+ ```
477
+ e2eFlows = artifacts.e2eFlows.map(flow => ({
478
+ "name": flow.name,
479
+ "modules": flow.modules.split(" → ").map(m => m.trim()), // "OrderManagement → Invoicing" → ["OrderManagement", "Invoicing"]
480
+ "steps": flow.steps || [],
481
+ "diagram": flow.diagram, // NEW: ASCII diagram preserved
482
+ "actors": flow.actors.split(", ").map(a => a.trim())
483
+ }))
484
+
485
+ // Merge with existing e2eFlows from consolidation.e2eFlows
486
+ ba-writer.enrichSection({
487
+ featureId: {feature_id},
488
+ section: "consolidation",
489
+ data: { e2eFlows: e2eFlows }
490
+ })
491
+ ```
492
+
493
+ **Validation:** For each E2E flow:
494
+ - `diagram` must not be empty if present
495
+ - `modules` array must match modules defined in master feature.json
496
+ - `steps` must have at least 2 entries (cross-module flow)
497
+
498
+ #### Extract dependency graph (optional)
499
+
500
+ IF `artifacts.dependencyGraph` exists:
501
+
502
+ ```
503
+ dependencyGraph = {
504
+ "nodes": artifacts.dependencyGraph.nodes.map(n => ({
505
+ "id": n.id,
506
+ "label": n.label || n.id,
507
+ "type": n.type || "data-centric"
508
+ })),
509
+ "edges": artifacts.dependencyGraph.edges.map(e => ({
510
+ "from": e.from,
511
+ "to": e.to,
512
+ "description": e.description || ""
513
+ }))
514
+ }
515
+
516
+ // Write to master feature.json
517
+ ba-writer.enrichSection({
518
+ featureId: {feature_id},
519
+ section: "decomposition",
520
+ data: { dependencyGraph: dependencyGraph }
521
+ })
522
+ ```
523
+
524
+ **Post-extraction summary:**
525
+
526
+ ```
527
+ ✓ Artefacts visuels extraits:
528
+ - Wireframes: {total_wireframe_count} across {module_count} modules
529
+ - E2E diagrams: {e2e_flow_count}
530
+ - Dependency graph: {node_count} nodes, {edge_count} edges
531
+ ```
532
+
410
533
  ### 7. Resume de l'extraction
411
534
 
412
535
  Afficher un resume comparatif :
@@ -432,11 +555,18 @@ Afficher un resume comparatif :
432
555
  | Regles metier | {total} | analysis.businessRules |
433
556
  | Entites | {total} | analysis.entities |
434
557
  | Parcours E2E | {count} | consolidation.e2eFlows |
558
+ | Maquettes (wireframes) | {total} | specification.uiWireframes[] |
559
+ | Diagrammes E2E | {count} | consolidation.e2eFlows[].diagram |
435
560
 
436
561
  Fichiers generes :
437
562
  - docs/business/{app}/business-analyse/v1.0/feature.json (master)
438
563
  - docs/business/{app}/{module}/business-analyse/v1.0/feature.json (par module)
439
564
 
565
+ Artefacts visuels preserves :
566
+ - Toutes les maquettes ASCII/SVG validees lors de la specification
567
+ - Tous les diagrammes E2E pour les flux cross-module
568
+ - Graphe de dependances entre modules
569
+
440
570
  ═══════════════════════════════════════════════════════════════
441
571
  ```
442
572
 
@@ -455,7 +585,7 @@ options:
455
585
  ```
456
586
 
457
587
  SI "Enrichir" → charger step-01-cadrage.md (les donnees existantes seront preservees)
458
- SI "Handoff" → charger step-05-handoff.md
588
+ SI "Handoff" → charger step-05a-handoff.md
459
589
  SI "Terminer" → EXIT
460
590
 
461
591
  ---
@@ -1,7 +1,7 @@
1
1
  # Template Functional Requirements Document
2
2
 
3
3
  > **Usage:** Template for 3-functional-specification.md
4
- > **Loaded in:** step-03-specify.md
4
+ > **Loaded in:** step-03a-specify.md
5
5
 
6
6
  ---
7
7