@atlashub/smartstack-cli 3.5.0 → 3.6.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 (40) hide show
  1. package/dist/index.js +13 -0
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/skills/business-analyse/SKILL.md +26 -15
  5. package/templates/skills/business-analyse/_architecture.md +1 -1
  6. package/templates/skills/business-analyse/_elicitation.md +1 -1
  7. package/templates/skills/business-analyse/_module-loop.md +4 -4
  8. package/templates/skills/business-analyse/html/ba-interactive.html +39 -10
  9. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  10. package/templates/skills/business-analyse/questionnaire.md +2 -2
  11. package/templates/skills/business-analyse/react/components.md +1 -1
  12. package/templates/skills/business-analyse/react/schema.md +1 -1
  13. package/templates/skills/business-analyse/references/html-data-mapping.md +4 -3
  14. package/templates/skills/business-analyse/schemas/feature-schema.json +1 -1
  15. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  16. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +1 -0
  17. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  18. package/templates/skills/business-analyse/steps/step-00-init.md +29 -0
  19. package/templates/skills/business-analyse/steps/step-01-cadrage.md +166 -6
  20. package/templates/skills/business-analyse/steps/step-02-decomposition.md +4 -4
  21. package/templates/skills/business-analyse/steps/{step-03a-specify.md → step-03a-data.md} +10 -359
  22. package/templates/skills/business-analyse/steps/step-03b-ui.md +414 -0
  23. package/templates/skills/business-analyse/steps/step-03c-compile.md +343 -0
  24. package/templates/skills/business-analyse/steps/{step-03b-compile.md → step-03d-validate.md} +26 -308
  25. package/templates/skills/business-analyse/steps/step-04-consolidation.md +2 -2
  26. package/templates/skills/business-analyse/steps/step-05a-handoff.md +49 -292
  27. package/templates/skills/business-analyse/steps/step-05b-mapping.md +302 -0
  28. package/templates/skills/business-analyse/steps/step-05c-deploy.md +296 -0
  29. package/templates/skills/business-analyse/steps/step-05d-html.md +326 -0
  30. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  31. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +1 -1
  32. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  33. package/templates/skills/controller/steps/step-03-generate.md +2 -1
  34. package/templates/skills/ralph-loop/SKILL.md +17 -2
  35. package/templates/skills/ralph-loop/references/core-seed-data.md +538 -0
  36. package/templates/skills/ralph-loop/steps/step-00-init.md +2 -0
  37. package/templates/skills/ralph-loop/steps/step-01-task.md +25 -2
  38. package/templates/skills/ralph-loop/steps/step-02-execute.md +39 -15
  39. package/templates/skills/ralph-loop/steps/step-04-check.md +87 -4
  40. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -475
@@ -168,7 +168,64 @@ if (hasQueue) {
168
168
  const queue = readJSON(queuePath);
169
169
  const currentModule = queue.modules[queue.currentIndex];
170
170
 
171
- // Mark current module as completed
171
+ // FIX #4: MODULE COMPLETENESS CHECK (MANDATORY before advancing)
172
+ // A module is NOT complete unless all expected layers have at least one completed task.
173
+ // This prevents marking a module as "done" when only backend was implemented.
174
+ const completedCategories = new Set(
175
+ prd.tasks.filter(t => t.status === 'completed').map(t => t.category)
176
+ );
177
+ const expectedCategories = ['domain', 'infrastructure', 'application', 'api', 'frontend', 'test'];
178
+ const missingCategories = expectedCategories.filter(c => !completedCategories.has(c));
179
+
180
+ if (missingCategories.length > 0) {
181
+ console.log(`
182
+ ╔══════════════════════════════════════════════════════════════════╗
183
+ ║ ⚠️ MODULE INCOMPLETE: Missing layers ║
184
+ ╠══════════════════════════════════════════════════════════════════╣
185
+ ║ Module: ${currentModule.code} ║
186
+ ║ Missing: ${missingCategories.join(', ')} ║
187
+ ╠══════════════════════════════════════════════════════════════════╣
188
+ ║ Injecting guardrail tasks for missing layers... ║
189
+ ╚══════════════════════════════════════════════════════════════════╝
190
+ `);
191
+
192
+ // Inject guardrail tasks for each missing category
193
+ let maxId = Math.max(...prd.tasks.map(t => t.id));
194
+ const lastCompletedByCategory = {};
195
+ for (const task of prd.tasks) {
196
+ if (task.status === 'completed') lastCompletedByCategory[task.category] = task.id;
197
+ }
198
+
199
+ for (const cat of missingCategories) {
200
+ maxId++;
201
+ const depId = cat === 'frontend'
202
+ ? (lastCompletedByCategory['api'] || lastCompletedByCategory['application'])
203
+ : cat === 'test'
204
+ ? (lastCompletedByCategory['api'] || lastCompletedByCategory['frontend'])
205
+ : (lastCompletedByCategory['domain'] || lastCompletedByCategory['infrastructure']);
206
+
207
+ prd.tasks.push({
208
+ id: maxId,
209
+ description: `[${cat}] GUARDRAIL: Generate missing ${cat} layer for module ${currentModule.code}`,
210
+ status: 'pending',
211
+ category: cat,
212
+ dependencies: depId ? [depId] : [],
213
+ acceptance_criteria: `${cat} layer fully implemented for module ${currentModule.code}`,
214
+ started_at: null, completed_at: null, iteration: null, commit_hash: null,
215
+ files_changed: { created: [], modified: [] },
216
+ validation: null, error: null, module: currentModule.code
217
+ });
218
+ console.log(` → Injected task ${maxId}: [${cat}] guardrail for ${currentModule.code}`);
219
+ }
220
+
221
+ prd.updated_at = new Date().toISOString();
222
+ writeJSON('.ralph/prd.json', prd);
223
+
224
+ // DO NOT mark module as complete — continue the COMPACT LOOP with new tasks
225
+ // Fall through to section 5 (COMPACT LOOP)
226
+ } else {
227
+
228
+ // Mark current module as completed (only when ALL layers verified)
172
229
  currentModule.status = 'completed';
173
230
  queue.completedModules++;
174
231
 
@@ -231,6 +288,7 @@ if (hasQueue) {
231
288
  ║ ${queue.modules.map(m => m.code + ": " + m.status).join("\n║ ")} ║
232
289
  ╚══════════════════════════════════════════════════════════════════╝
233
290
  `);
291
+ } // end else (module completeness check passed)
234
292
  }
235
293
  ```
236
294
 
@@ -430,9 +488,19 @@ Batch: {tasksToExecute.length} task(s) [{firstCategory}]
430
488
  8. Generate 4-language i18n (fr, en, it, de)
431
489
  9. `npm run typecheck` MUST pass
432
490
 
433
- **IF category = "infrastructure":** Seed data in `Infrastructure/Persistence/Seeding/Data/{Module}/`
491
+ **IF category = "domain":** Entities in `Domain/Entities/{ContextPascal}/{App}/{Module}/`, Enums in `Domain/Enums/{ContextPascal}/{App}/{Module}/`
434
492
 
435
- **IF category = "api":** Controllers in `Api/Controllers/{Context}/{App}/{Entity}Controller.cs`
493
+ **IF category = "application":** Services in `Application/Services/{ContextPascal}/{App}/{Module}/`, DTOs in `Application/DTOs/{ContextPascal}/{App}/{Module}/`
494
+
495
+ **IF category = "infrastructure":**
496
+ - EF configs in `Infrastructure/Persistence/Configurations/{ContextPascal}/{App}/{Module}/`
497
+ - Seed data in `Infrastructure/Persistence/Seeding/Data/{Module}/`
498
+ - **IF task description contains "seed data", "SeedData", or "IClientSeedDataProvider":**
499
+ Read `references/core-seed-data.md` for COMPLETE execution guidance (parameter extraction,
500
+ MCP `generate_permissions` call, code templates, IClientSeedDataProvider, verification checklist).
501
+ **Do NOT improvise core seed data generation.**
502
+
503
+ **IF category = "api":** Controllers in `Api/Controllers/{ContextShort}/{App}/{Entity}Controller.cs`
436
504
 
437
505
  After ALL tasks in batch executed:
438
506
  - Run `mcp__smartstack__validate_conventions` ONCE for the whole batch
@@ -581,17 +649,32 @@ Completion Check:
581
649
  1. ALL tasks have `status: "completed"` or `status: "skipped"`
582
650
  2. Zero tasks with `status: "blocked"` or `status: "failed"`
583
651
  3. The statement is genuinely true
652
+ 4. **Multi-module:** ALL modules in `modules-queue.json` have `status: "completed"`
584
653
 
585
654
  **False promises to escape the loop are FORBIDDEN.**
586
655
 
587
656
  **Always update `prd.status` and `prd.updated_at` before proceeding.**
588
657
 
658
+ **NEVER DELEGATE THE LOOP:**
659
+ - NEVER use the Task tool to spawn a sub-agent for Ralph loop execution.
660
+ - Sub-agents lose ALL skill context and WILL stop prematurely.
661
+ - The ONLY acceptable Task usage: isolated read-only research (e.g., Context7 docs lookup).
662
+
663
+ **MODULE COMPLETENESS (multi-module):**
664
+ - Before advancing to the next module, verify ALL expected layers have completed tasks.
665
+ - Expected layers: domain, infrastructure, application, api, frontend, test.
666
+ - If any layer is missing, inject guardrail tasks and continue the COMPACT LOOP.
667
+ - A module with only backend tasks is NOT complete.
668
+
589
669
  **LOOP CONTINUATION IS MANDATORY:**
590
670
  - After the first full iteration (step-01→02→03→04), ALL subsequent iterations use the COMPACT LOOP in section 5.
591
671
  - DO NOT re-read step-01, step-02, step-03 files. You already know the instructions.
592
672
  - DO NOT stop and wait for user input between iterations.
593
673
  - DO NOT output a summary and pause. The loop is AUTONOMOUS.
594
- - The ONLY reasons to stop: completion, max iterations, dead-end, or user interruption.
674
+ - DO NOT decide to stop because "quality over quantity" or "this is enough for now".
675
+ - DO NOT stop after completing one module when others remain in the queue.
676
+ - DO NOT reduce scope autonomously ("I'll skip frontend/tests to save time").
677
+ - The ONLY reasons to stop: ALL tasks complete (all modules), max iterations, dead-end, or user Ctrl+C.
595
678
  - Stopping for any other reason is a **BUG** that wastes user time and context.
596
679
  - **BATCH tasks of the same category** to reduce iterations (max 5 per batch).
597
680
  - Prefer compact output (1-2 lines per task) over verbose output during the loop.
@@ -1,475 +0,0 @@
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
- **POST-CHECK (BLOCKING — DO NOT SKIP):**
82
-
83
- After `ss derive-prd` execution, read the generated prd-{moduleCode}.json and verify structural integrity:
84
-
85
- ```javascript
86
- const prd = readJSON(`.ralph/prd-${moduleCode}.json`);
87
- const featureHandoff = moduleFeature.handoff.filesToCreate;
88
-
89
- // 1. Verify structure: filesToCreate MUST be under implementation (NOT root level)
90
- if (prd.filesToCreate && !prd.implementation?.filesToCreate) {
91
- BLOCKING_ERROR("prd.json has filesToCreate at ROOT level — this is NOT from ss derive-prd");
92
- BLOCKING_ERROR("Re-run: ss derive-prd --feature {path} --output .ralph/prd-{moduleCode}.json");
93
- STOP;
94
- }
95
-
96
- // 2. Verify ALL 7 categories present and match feature.json
97
- const categories = ['domain', 'application', 'infrastructure', 'api', 'frontend', 'seedData', 'tests'];
98
- for (const cat of categories) {
99
- const prdCount = prd.implementation.filesToCreate[cat]?.length ?? 0;
100
- const featureCount = featureHandoff[cat]?.length ?? 0;
101
- if (prdCount !== featureCount) {
102
- BLOCKING_ERROR(`${cat}: prd has ${prdCount} files but feature.json has ${featureCount}`);
103
- }
104
- }
105
- ```
106
-
107
- Display verification table:
108
-
109
- ```
110
- POST-CHECK: prd-{moduleCode}.json integrity
111
- | Category | feature.json | prd.json | Match |
112
- |----------------|-------------|----------|-------|
113
- | domain | {n} | {n} | OK/FAIL |
114
- | application | {n} | {n} | OK/FAIL |
115
- | infrastructure | {n} | {n} | OK/FAIL |
116
- | api | {n} | {n} | OK/FAIL |
117
- | frontend | {n} | {n} | OK/FAIL |
118
- | seedData | {n} | {n} | OK/FAIL |
119
- | tests | {n} | {n} | OK/FAIL |
120
- ```
121
-
122
- IF ANY category shows FAIL → **STOP AND RE-RUN `ss derive-prd`**. DO NOT proceed with incomplete PRD.
123
-
124
- ---
125
-
126
- ### 2. Initialize Progress Tracker
127
-
128
- > **Template:** Read `templates/tpl-progress.md` for the complete progress tracker template structure.
129
- > Populate the template with module-specific data from feature.json handoff sections.
130
-
131
- **Progress Tracker Rules:**
132
- - One section per module, in topological order (dependencies first)
133
- - CORE SeedData ALWAYS 5 entries (mandatory)
134
- - Business SeedData varies by module
135
- - Hierarchical task structure (module -> layer -> tasks)
136
- - Each task is independent, assignable checkbox
137
- - Effort estimate per module (simple/medium/complex)
138
- - Summary with totals across all modules
139
- - Cross-module tasks only if multi-module
140
-
141
- ---
142
-
143
- ### 3. Deploy Interactive HTML Document (MANDATORY)
144
-
145
- > **The interactive HTML document is deployed to the project PRE-POPULATED with ALL analysis data.**
146
- > The client opens it in a browser and sees the complete analysis (cadrage, modules, entities, UCs, BRs, wireframes, permissions, consolidation).
147
- > The client can then review, edit, enrich, and export modifications as JSON.
148
- > That JSON can be re-imported via `/business-analyse -x` to update the feature.json.
149
-
150
- **Source:** `html/ba-interactive.html` (relative to skill root = `~/.claude/skills/business-analyse/html/`)
151
-
152
- **Destination:** `docs/business/{app}/business-analyse/v{version}/ba-interactive.html`
153
-
154
- **Deployment steps:**
155
-
156
- #### Step 1: Read source data
157
-
158
- 1. Read the HTML template from skill directory
159
- 2. Read the master feature.json (application level)
160
- 3. Read EACH module feature.json (module level)
161
-
162
- > **Reference:** Read `references/html-data-mapping.md` for the complete FEATURE_DATA and EMBEDDED_ARTIFACTS mapping specification.
163
-
164
- **Key requirements:**
165
- - FEATURE_DATA must be pre-populated with ALL analysis data (empty data = BUG)
166
- - EMBEDDED_ARTIFACTS contains wireframes, E2E diagrams, dependency graph
167
- - Both objects are serialized as JSON with 2-space indentation
168
- - All data mapped from master and module feature.json files
169
-
170
- #### Step 3: Replace placeholders in template
171
-
172
- 1. Serialize the FEATURE_DATA object as JSON (with 2-space indentation for readability)
173
- 2. Serialize the EMBEDDED_ARTIFACTS object as JSON (with 2-space indentation)
174
- 3. Replace `{{FEATURE_DATA}}` with the serialized FEATURE_DATA JSON
175
- 4. Replace `{{EMBEDDED_ARTIFACTS}}` with the serialized EMBEDDED_ARTIFACTS JSON
176
- 5. Replace `{{APPLICATION_NAME}}` → `{application_name}` (still used in `<title>` and header)
177
- 6. Replace `{{APPLICATION_ID}}` → `{feature_id}` (still used in `APP_KEY`)
178
- 7. Replace `{{VERSION}}` → `{version}`
179
- 8. Replace `{{CREATED_AT}}` → `{ISO timestamp}`
180
-
181
- > **NOTE:** `{{APPLICATION_NAME}}`, `{{APPLICATION_ID}}`, `{{VERSION}}`, `{{CREATED_AT}}` still appear
182
- > in the HTML body (`<title>`, header, `APP_KEY`). They MUST be replaced separately from FEATURE_DATA.
183
-
184
- > **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.
185
-
186
- #### Step 4: Write and confirm
187
-
188
- 1. Write the populated HTML to the output directory
189
- 2. Display deployment confirmation:
190
-
191
- ```
192
- ✓ Interactive HTML deployed:
193
- Path: docs/business/{app}/business-analyse/v{version}/ba-interactive.html
194
- Pre-populated with: {stakeholder_count} stakeholders, {module_count} modules,
195
- {total_uc} use cases, {total_br} business rules, {total_entity} entities
196
- Visual artifacts: {total_wireframes} wireframes, {e2e_flow_count} E2E diagrams
197
- Open in browser to review and edit the business analysis.
198
- Export JSON and re-import with: /business-analyse -x <exported-json-path>
199
- ```
200
-
201
- **Why a FINAL deployment at handoff?**
202
- - Step 03 already deploys the HTML incrementally after each module (partial data)
203
- - This final deployment adds the COMPLETE data: all modules + consolidation + handoff info
204
- - The client sees the FULL analysis pre-populated — including cross-module interactions and E2E flows
205
- - The client can review, edit, and enrich directly in the browser
206
- - Any client modifications can be re-imported via `-x` extraction mode
207
- - The HTML is standalone (no server required) with localStorage persistence
208
- - On first open: pre-populated data displays. After client edits: localStorage overrides
209
- - **NOTE:** This overwrites the incremental HTML from step-03 with the complete version
210
-
211
- ---
212
-
213
- ### 4. Update BA Manifest (MANDATORY)
214
-
215
- > **The BA manifest enables the SmartStack web app to discover and display all available business analyses.**
216
- > It is a JSON index file at `docs/business/index.json` that lists all feature.json files.
217
-
218
- **Path:** `docs/business/index.json` (project root relative)
219
-
220
- **Schema:**
221
- ```json
222
- {
223
- "version": "1.0",
224
- "updatedAt": "{ISO timestamp}",
225
- "analyses": [
226
- {
227
- "appCode": "{app_code}",
228
- "appName": "{application_name}",
229
- "moduleCode": null | "{module_code}",
230
- "moduleName": "{module_name}",
231
- "version": "{version}",
232
- "status": "handed-off",
233
- "featureDescription": "{feature_description}",
234
- "path": "{app_code}/business-analyse/v{version}/feature.json",
235
- "updatedAt": "{ISO timestamp}"
236
- }
237
- ]
238
- }
239
- ```
240
-
241
- **Update logic:**
242
-
243
- 1. Read existing manifest at `docs/business/index.json` (or create empty `{ "version": "1.0", "updatedAt": "", "analyses": [] }`)
244
- 2. For the APPLICATION-level feature.json:
245
- - Find existing entry where `appCode == {app_code}` AND `moduleCode == null` AND `version == {version}`
246
- - If found: update `status`, `updatedAt`, `featureDescription`
247
- - If not found: append new entry with `moduleCode: null` and `path: "{app_code}/business-analyse/v{version}/feature.json"`
248
- 3. For EACH MODULE-level feature.json:
249
- - Find existing entry where `appCode == {app_code}` AND `moduleCode == {module_code}` AND `version == {version}`
250
- - If found: update `status`, `updatedAt`, `featureDescription`
251
- - If not found: append new entry with `moduleCode: "{module_code}"` and `path: "{app_code}/{module_code}/business-analyse/v{version}/feature.json"`
252
- 4. Update root `updatedAt` to current timestamp
253
- 5. Write manifest back to `docs/business/index.json`
254
-
255
- **Display confirmation:**
256
- ```
257
- ✓ BA manifest updated: docs/business/index.json
258
- Entries: {total_count} ({app_count} applications, {module_count} modules)
259
- Web viewer: /system/docs/ba
260
- ```
261
-
262
- **Why a manifest?**
263
- - The web app needs to discover available BAs without scanning the filesystem
264
- - Static file serving (no backend API needed)
265
- - Incremental updates: each handoff adds/updates only its entries
266
- - Consumed by the SmartStack web app BA viewer at `/system/docs/ba`
267
-
268
- ---
269
-
270
- ### 5. Completion Summary
271
-
272
- Display the completion summary after successful handoff:
273
-
274
- > **Reference:** Read `templates/tpl-launch-displays.md` for user-facing display templates.
275
-
276
- ```
277
- ═══════════════════════════════════════════════════════════════
278
- [OK] BUSINESS ANALYSE TERMINEE - {application_name}
279
- ═══════════════════════════════════════════════════════════════
280
-
281
- Modules: {count} ({names})
282
- Strategy: {strategy}
283
- Files: {total files across all modules}
284
- Tasks: {total tasks} ({core_count} CORE + {biz_count} business + {dev_count} development)
285
- Complexity: {complexity}
286
- Effort: {total_days} days ({total_hours} hours)
287
-
288
- [DIR] Artefacts generés:
289
- ✓ feature.json (master + per-module) - spécification complète
290
- ✓ .ralph/prd.json or .ralph/prd-{module}.json - task breakdown
291
- ✓ .ralph/progress.txt - tracker de progression
292
- ✓ ba-interactive.html - document de revue interactif
293
-
294
- [TARGET] Prochaines étapes:
295
- 1. Ouvrir ba-interactive.html dans le navigateur
296
- 2. Partager avec les stakeholders pour validation
297
- 3. Si retours --> relancer /business-analyse pour une nouvelle itération
298
- 4. Une fois validé, lancer le développement:
299
-
300
- /ralph-loop -r
301
-
302
- ═══════════════════════════════════════════════════════════════
303
- ```
304
-
305
- **No AskUserQuestion here.** The BA ends after displaying the summary. The user will manually launch `/ralph-loop -r` when ready (typically after stakeholder validation).
306
-
307
- ---
308
-
309
- ## SELF-VERIFICATION (FINAL)
310
-
311
- Before presenting completion summary, 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 completion summary.**
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
- - Display `/ralph-loop -r` command for later use
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
- Completion: Display summary with `/ralph-loop -r` command for later execution after stakeholder validation.
385
-
386
- ---
387
-
388
- ## EXAMPLES & TEMPLATES
389
-
390
- ### Example: Simple Single Module (Orders)
391
-
392
- **Feature:** Order Management
393
- **Module:** Orders (1 entity, 2 use cases, 3 BRs)
394
-
395
- **Output:**
396
- - feature.json with handoff section
397
- - .ralph/prd.json (single consolidated file)
398
- - .ralph/progress.txt (~150 lines, 20-30 tasks)
399
-
400
- Strategy: Module by module (only 1 module)
401
-
402
- ### Example: Medium Multi-Module (E-Commerce)
403
-
404
- **Feature:** E-Commerce Platform
405
- **Modules:** Customers (4 entities), Products (6 entities), Orders (8 entities), Invoices (3 entities)
406
-
407
- **Dependencies:**
408
- - Customers: Foundation (no deps)
409
- - Products: Foundation (no deps)
410
- - Orders: Depends on Customers + Products
411
- - Invoices: Depends on Orders
412
-
413
- **Output:**
414
- - feature.json (master + 4 module features) with handoff sections
415
- - User chooses: per-module prd (.ralph/prd-customers.json, .ralph/prd-products.json, etc.) or consolidated (.ralph/prd.json)
416
- - .ralph/progress.txt (~400 lines, 100+ tasks)
417
- - Module order: Customers, Products → Orders → Invoices (topological)
418
-
419
- Strategy options: Module by module (recommended), Layer by layer, Hybrid
420
-
421
- ### Example: Complex Multi-Module (ERP)
422
-
423
- **Feature:** Enterprise Resource Planning
424
- **Modules:** Accounting, Sales, Purchasing, Inventory, HR, Finance (20+ entities total, 50+ use cases, 100+ BRs)
425
-
426
- **Output:**
427
- - feature.json (master + 6 module features) with handoff sections
428
- - Per-module prd.json (recommended for complexity management)
429
- - .ralph/progress.txt (~800+ lines, 200+ tasks)
430
-
431
- Complexity: Complex (highest across all modules)
432
- Strategy: Hybrid recommended (Foundation modules layer-by-layer, then dependent modules module-by-module)
433
-
434
- ---
435
-
436
- ## VALIDATION CHECKLIST
437
-
438
- Before presenting handoff to user:
439
-
440
- - [ ] Status verified: "consolidated"
441
- - [ ] Implementation strategy selected or defaulted
442
- - [ ] Complexity calculated for each module and overall
443
- - [ ] filesToCreate: 7 categories complete, no free text
444
- - [ ] **WIREFRAME TRACEABILITY:** Every frontend Page/DashboardPage has `linkedWireframes[]` referencing specification.uiWireframes[].screen
445
- - [ ] **WIREFRAME ACCEPTANCE:** Every frontend Page/DashboardPage has `wireframeAcceptanceCriteria` describing expected layout
446
- - [ ] brToCodeMapping: All business rules from analysis.businessRules[] mapped
447
- - [ ] apiEndpointSummary: Exact copy from specification.apiEndpoints[]
448
- - [ ] prd.json: Derived from feature.json, not independently generated
449
- - [ ] prd.json: Includes all UCs, FRs, BRs, entities, API endpoints from source
450
- - [ ] progress.txt: Hierarchical, all modules in topological order, 5 CORE SeedData per module
451
- - [ ] progress.txt: Frontend tasks reference wireframe identifiers [wireframe: {screen}]
452
- - [ ] Module order: Follows topological dependency graph
453
- - [ ] feature.json updated: handoff section + status "handed-off"
454
- - [ ] All paths use project namespace from .smartstack/config.json
455
- - [ ] No invented requirements (everything traced to feature.json)
456
- - [ ] ba-interactive.html deployed PRE-POPULATED with all analysis data (not empty)
457
- - [ ] BA manifest (docs/business/index.json) updated with current analysis entries
458
- - [ ] User ready for next agent selection
459
-
460
- ---
461
-
462
- ## TROUBLESHOOTING
463
-
464
- | Issue | Resolution |
465
- |-------|-----------|
466
- | All modules missing handoff data | Return to step-05a-handoff.md. Handoff MUST be written to each module feature.json. |
467
- | prd.json generation failed | Verify ss derive-prd command is installed and feature.json path is correct. |
468
- | progress.txt incomplete | Ensure all 5 CORE SeedData entries are present per module. Check topological order. |
469
- | ba-interactive.html deployment failed | Verify output directory exists. Check file permissions. Ensure HTML template is readable. |
470
- | BA manifest not found | Create docs/business/index.json if missing. Use schema provided in section 4. |
471
- | HTML pre-populated but empty | Verify FEATURE_DATA and EMBEDDED_ARTIFACTS objects are serialized correctly. Check JSON syntax. |
472
-
473
- ---
474
-
475
- END OF STEP 5b: DEPLOY ARTIFACTS