@atlashub/smartstack-cli 3.5.0 → 3.7.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 (34) 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 +24 -19
  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/references/html-data-mapping.md +3 -2
  12. package/templates/skills/business-analyse/schemas/feature-schema.json +1 -1
  13. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  14. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +1 -0
  15. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  16. package/templates/skills/business-analyse/steps/step-00-init.md +37 -1
  17. package/templates/skills/business-analyse/steps/step-01-cadrage.md +166 -6
  18. package/templates/skills/business-analyse/steps/step-02-decomposition.md +4 -4
  19. package/templates/skills/business-analyse/steps/{step-03a-specify.md → step-03a-data.md} +10 -359
  20. package/templates/skills/business-analyse/steps/step-03b-ui.md +414 -0
  21. package/templates/skills/business-analyse/steps/step-03c-compile.md +343 -0
  22. package/templates/skills/business-analyse/steps/{step-03b-compile.md → step-03d-validate.md} +26 -308
  23. package/templates/skills/business-analyse/steps/step-04-consolidation.md +23 -2
  24. package/templates/skills/business-analyse/steps/step-05a-handoff.md +66 -46
  25. package/templates/skills/business-analyse/steps/step-05b-deploy.md +262 -212
  26. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  27. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +1 -1
  28. package/templates/skills/controller/steps/step-03-generate.md +2 -1
  29. package/templates/skills/ralph-loop/SKILL.md +20 -5
  30. package/templates/skills/ralph-loop/references/core-seed-data.md +538 -0
  31. package/templates/skills/ralph-loop/steps/step-00-init.md +79 -1
  32. package/templates/skills/ralph-loop/steps/step-01-task.md +25 -2
  33. package/templates/skills/ralph-loop/steps/step-02-execute.md +39 -15
  34. package/templates/skills/ralph-loop/steps/step-04-check.md +87 -4
@@ -1,25 +1,30 @@
1
1
  ---
2
2
  name: step-05b-deploy
3
- description: Generate prd.json, progress.txt, deploy ba-interactive.html, manifest, user choice
3
+ description: Generate prd.json, deploy artifacts, interactive HTML
4
4
  model: sonnet
5
5
  next_step: null
6
6
  ---
7
7
 
8
- > **Context files:** `_shared.md`
8
+ > **Context files:** _shared.md
9
9
 
10
- # Step 5b: Handoff - Deploy Artifacts
10
+ # Step 5b: Deploy Artifacts & Interactive HTML
11
11
 
12
12
  ## MANDATORY EXECUTION RULES
13
13
 
14
14
  - **ALWAYS** verify all module handoffs are complete before generating artifacts
15
15
  - **ALWAYS** derive prd.json from feature.json (NEVER independently)
16
16
  - **NEVER** invent entities/FRs/BRs not in feature.json
17
- - **ALWAYS** deploy ba-interactive.html PRE-POPULATED with all data
18
17
  - **ALWAYS** update BA manifest at docs/business/index.json
18
+ - **ALWAYS** deploy ba-interactive.html PRE-POPULATED with all data
19
+ - **ALWAYS** follow references/html-data-mapping.md EXACTLY for FEATURE_DATA and EMBEDDED_ARTIFACTS mapping
20
+ - **FEATURE_DATA.moduleSpecs MUST be populated for EACH module** — empty moduleSpecs = BROKEN specification tabs
21
+ - **FEATURE_DATA.cadrage.scope must use HTML keys** (vital/important/optional/excluded) NOT feature.json keys (mustHave/shouldHave/couldHave/outOfScope)
22
+ - **FEATURE_DATA.metadata.vibeCoding must be set** from master.metadata.vibeCoding (controls section visibility)
23
+ - **NEVER leave FEATURE_DATA or EMBEDDED_ARTIFACTS empty or partial**
19
24
 
20
25
  ## YOUR TASK
21
26
 
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.
27
+ Generate deployment artifacts (prd.json, progress.txt, BA manifest) and deploy the interactive HTML document pre-populated with all analysis data.
23
28
 
24
29
  ---
25
30
 
@@ -140,77 +145,7 @@ IF ANY category shows FAIL → **STOP AND RE-RUN `ss derive-prd`**. DO NOT proce
140
145
 
141
146
  ---
142
147
 
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)
148
+ ### 3. Update BA Manifest (MANDATORY)
214
149
 
215
150
  > **The BA manifest enables the SmartStack web app to discover and display all available business analyses.**
216
151
  > It is a JSON index file at `docs/business/index.json` that lists all feature.json files.
@@ -267,11 +202,248 @@ IF ANY category shows FAIL → **STOP AND RE-RUN `ss derive-prd`**. DO NOT proce
267
202
 
268
203
  ---
269
204
 
270
- ### 5. Completion Summary
205
+ ### 4. Read Source Data for HTML
206
+
207
+ 1. Read the HTML template from skill directory: `html/ba-interactive.html` (relative to `~/.claude/skills/business-analyse/`)
208
+ 2. Read the master feature.json (application level)
209
+ 3. Read EACH module feature.json (module level)
210
+
211
+ > **Reference:** Read `references/html-data-mapping.md` for the complete FEATURE_DATA and EMBEDDED_ARTIFACTS mapping specification.
212
+
213
+ **Key requirements:**
214
+ - FEATURE_DATA must be pre-populated with ALL analysis data (empty data = BUG)
215
+ - FEATURE_DATA.**moduleSpecs** MUST be populated for EACH module (use cases, business rules, entities, permissions) — empty moduleSpecs = BROKEN specification tabs
216
+ - FEATURE_DATA.**cadrage.scope** must use HTML keys (vital/important/optional/excluded) NOT feature.json keys (mustHave/shouldHave/couldHave/outOfScope)
217
+ - FEATURE_DATA.**metadata.vibeCoding** must be set from `master.metadata.vibeCoding` (controls section visibility)
218
+ - EMBEDDED_ARTIFACTS contains wireframes, E2E diagrams, dependency graph
219
+ - Both objects are serialized as JSON with 2-space indentation
220
+ - All data mapped from master and module feature.json files — follow `html-data-mapping.md` EXACTLY
221
+
222
+ ---
223
+
224
+ ### 5. Build FEATURE_DATA Object
225
+
226
+ Reference `references/html-data-mapping.md` EXACTLY. The FEATURE_DATA object must contain:
227
+
228
+ **Structure:**
229
+ ```javascript
230
+ const FEATURE_DATA = {
231
+ metadata: {
232
+ applicationName: master.application_name,
233
+ applicationId: master.feature_id,
234
+ version: master.version,
235
+ createdAt: ISO_TIMESTAMP,
236
+ vibeCoding: master.metadata.vibeCoding // "enabled" or "disabled" — controls UI section visibility
237
+ },
238
+ cadrage: {
239
+ goal: master.cadrage.goal,
240
+ vision: master.cadrage.vision,
241
+ success_criteria: master.cadrage.success_criteria,
242
+ scope: {
243
+ // CONVERT feature.json keys to HTML keys:
244
+ // mustHave → vital
245
+ // shouldHave → important
246
+ // couldHave → optional
247
+ // outOfScope → excluded
248
+ vital: master.globalScope.mustHave || [],
249
+ important: master.globalScope.shouldHave || [],
250
+ optional: master.globalScope.couldHave || [],
251
+ excluded: master.globalScope.outOfScope || []
252
+ },
253
+ constraints: master.cadrage.constraints || [],
254
+ risks: master.cadrage.risks || [],
255
+ stakeholders: master.stakeholders || []
256
+ },
257
+ modules: [
258
+ {
259
+ moduleCode: module.code,
260
+ moduleName: module.name,
261
+ moduleDescription: module.description || "",
262
+ // ... per-module fields from feature.json
263
+ }
264
+ ],
265
+ moduleSpecs: {
266
+ // CRITICAL: Must have ONE entry per module with ALL module data
267
+ // Each entry keyed by moduleCode:
268
+ "{moduleCode}": {
269
+ useCases: module.specification.useCases || [],
270
+ businessRules: module.analysis.businessRules || [],
271
+ entities: module.analysis.entities || [],
272
+ permissions: module.specification.permissions || [],
273
+ apiEndpoints: module.specification.apiEndpoints || []
274
+ }
275
+ },
276
+ consolidation: {
277
+ // Cross-module analysis
278
+ integrations: master.consolidation.integrations || [],
279
+ sharedEntities: master.consolidation.sharedEntities || [],
280
+ sequenceDiagrams: master.consolidation.e2eFlows || []
281
+ },
282
+ handoff: {
283
+ // From feature.json handoff section
284
+ complexity: master.handoff.complexity,
285
+ implementationStrategy: master.handoff.implementationStrategy,
286
+ moduleOrder: master.handoff.moduleOrder,
287
+ filesToCreate: master.handoff.filesToCreate,
288
+ brToCodeMapping: master.handoff.brToCodeMapping,
289
+ apiEndpointSummary: master.handoff.apiEndpointSummary
290
+ }
291
+ };
292
+ ```
293
+
294
+ **Build process:**
295
+ 1. Extract metadata from master feature.json
296
+ 2. Extract cadrage from master feature.json (CONVERT scope keys)
297
+ 3. Extract stakeholders from master.stakeholders
298
+ 4. Iterate ALL modules and populate moduleSpecs (THIS IS CRITICAL — empty moduleSpecs = BUG)
299
+ 5. For EACH module, extract:
300
+ - Use cases from specification.useCases
301
+ - Business rules from analysis.businessRules
302
+ - Entities from analysis.entities
303
+ - Permissions from specification.permissions
304
+ - API endpoints from specification.apiEndpoints
305
+ 6. Extract consolidation data (integrations, shared entities, E2E flows)
306
+ 7. Extract handoff section (complexity, strategy, module order, file counts)
307
+
308
+ ---
309
+
310
+ ### 6. Build EMBEDDED_ARTIFACTS Object
311
+
312
+ Extract visual artifacts and diagrams from the analysis:
313
+
314
+ ```javascript
315
+ const EMBEDDED_ARTIFACTS = {
316
+ wireframes: [
317
+ // Extract from each module's specification.uiWireframes
318
+ {
319
+ moduleCode: "{moduleCode}",
320
+ screen: wireframe.screen,
321
+ description: wireframe.description,
322
+ layout: wireframe.layout || "responsive",
323
+ components: wireframe.components || []
324
+ }
325
+ ],
326
+ e2eFlows: [
327
+ // Extract from master consolidation.e2eFlows
328
+ {
329
+ flowName: flow.name,
330
+ description: flow.description,
331
+ sequence: flow.sequence || [],
332
+ modules: flow.modules || []
333
+ }
334
+ ],
335
+ dependencyGraph: {
336
+ // From master consolidation.dependencyGraph
337
+ nodes: master.consolidation.dependencyGraph?.nodes || [],
338
+ edges: master.consolidation.dependencyGraph?.edges || []
339
+ }
340
+ };
341
+ ```
342
+
343
+ **Artifact gathering:**
344
+ 1. Read each module's `specification.uiWireframes[]` and add to wireframes array
345
+ 2. Read master's `consolidation.e2eFlows[]` and add to e2eFlows array
346
+ 3. Read master's `consolidation.dependencyGraph` and include as-is
347
+ 4. Serialize as JSON with 2-space indentation
348
+
349
+ ---
350
+
351
+ ### 7. Replace Placeholders in Template
352
+
353
+ 1. Serialize the FEATURE_DATA object as JSON (with 2-space indentation)
354
+ 2. Serialize the EMBEDDED_ARTIFACTS object as JSON (with 2-space indentation)
355
+ 3. Replace `{{FEATURE_DATA}}` with the serialized FEATURE_DATA JSON
356
+ 4. Replace `{{EMBEDDED_ARTIFACTS}}` with the serialized EMBEDDED_ARTIFACTS JSON
357
+ 5. Replace `{{APPLICATION_NAME}}` with `{application_name}`
358
+ 6. Replace `{{APPLICATION_ID}}` with `{feature_id}`
359
+ 7. Replace `{{VERSION}}` with `{version}`
360
+ 8. Replace `{{CREATED_AT}}` with `{ISO timestamp}`
361
+
362
+ **Verification during replacement:**
363
+ - Ensure FEATURE_DATA JSON is valid (no trailing commas, proper nesting)
364
+ - Ensure EMBEDDED_ARTIFACTS JSON is valid
365
+ - Verify placeholders are completely replaced (grep for `{{` to confirm)
366
+
367
+ ---
368
+
369
+ ### 8. Write and Verify
370
+
371
+ 1. Write the populated HTML to the output directory: `docs/business/{app}/business-analyse/v{version}/ba-interactive.html`
372
+ 2. Display deployment confirmation:
373
+
374
+ ```
375
+ [OK] Interactive HTML deployed:
376
+ Path: docs/business/{app}/business-analyse/v{version}/ba-interactive.html
377
+ Pre-populated with: {stakeholder_count} stakeholders, {module_count} modules,
378
+ {total_uc} use cases, {total_br} business rules, {total_entity} entities
379
+ Visual artifacts: {total_wireframes} wireframes, {e2e_flow_count} E2E diagrams
380
+ Open in browser to review and edit the business analysis.
381
+ Export JSON and re-import with: /business-analyse -x <exported-json-path>
382
+ ```
383
+
384
+ ---
385
+
386
+ ## SELF-VERIFICATION (BEFORE COMPLETION)
271
387
 
272
- Display the completion summary after successful handoff:
388
+ Before displaying completion, VERIFY:
273
389
 
274
- > **Reference:** Read `templates/tpl-launch-displays.md` for user-facing display templates.
390
+ 1. **`.ralph/prd-{module}.json`** exists for ALL modules (file size > 100 bytes each)
391
+ 2. **`.ralph/progress.txt`** exists (file size > 500 bytes)
392
+ 3. **`docs/business/index.json`** exists with correct entry count
393
+ 4. **ba-interactive.html** exists and file size > 100KB
394
+ 5. **FEATURE_DATA contains moduleSpecs** with entries for ALL modules
395
+ 6. **cadrage.scope uses HTML keys** (vital/important/optional/excluded)
396
+
397
+ **IF any check fails → GENERATE the missing artifact before proceeding to completion.**
398
+
399
+ ---
400
+
401
+ ## POST-CHECK (BLOCKING)
402
+
403
+ After writing the HTML file, verify:
404
+
405
+ 1. **File size > 100KB** (indicates pre-populated, not empty template)
406
+ ```bash
407
+ file_size=$(stat --format=%s "{output_path}/ba-interactive.html")
408
+ if [ $file_size -lt 100000 ]; then
409
+ BLOCKING_ERROR("ba-interactive.html is only ${file_size} bytes — not pre-populated")
410
+ fi
411
+ ```
412
+
413
+ 2. **Grep for "moduleSpecs"** — MUST be present in generated HTML
414
+ ```bash
415
+ if ! grep -q '"moduleSpecs"' "{output_path}/ba-interactive.html"; then
416
+ BLOCKING_ERROR("moduleSpecs not found in HTML — FEATURE_DATA not serialized correctly")
417
+ fi
418
+ ```
419
+
420
+ 3. **moduleSpecs must have entries for ALL modules** (not empty object `{}`)
421
+ ```bash
422
+ # Count moduleSpecs entries — should equal module count
423
+ moduleSpec_count=$(grep -o '"moduleCode"' "{output_path}/ba-interactive.html" | wc -l)
424
+ if [ $moduleSpec_count -lt {module_count} ]; then
425
+ BLOCKING_ERROR("moduleSpecs has only ${moduleSpec_count} entries but need {module_count}")
426
+ fi
427
+ ```
428
+
429
+ 4. **cadrage.scope must use HTML keys** (vital/important/optional/excluded)
430
+ ```bash
431
+ if grep -q '"mustHave"' "{output_path}/ba-interactive.html"; then
432
+ BLOCKING_ERROR("cadrage.scope still has feature.json keys (mustHave) — must convert to HTML keys (vital)")
433
+ fi
434
+ ```
435
+
436
+ **IF ANY CHECK FAILS → DO NOT PROCEED. Fix the data mapping and regenerate.**
437
+
438
+ ---
439
+
440
+ ## COMPLETION
441
+
442
+ > **IMPORTANT:** La BA ne lance JAMAIS /ralph-loop automatiquement.
443
+ > Il peut y avoir une phase de revue/modification de la documentation entre les deux étapes.
444
+ > L'utilisateur lance `/ralph-loop` manuellement quand il est prêt.
445
+
446
+ Display completion using the template from `templates/tpl-launch-displays.md`:
275
447
 
276
448
  ```
277
449
  ═══════════════════════════════════════════════════════════════
@@ -285,9 +457,9 @@ Tasks: {total tasks} ({core_count} CORE + {biz_count} business + {dev_count}
285
457
  Complexity: {complexity}
286
458
  Effort: {total_days} days ({total_hours} hours)
287
459
 
288
- [DIR] Artefacts generés:
460
+ [DIR] Artefacts générés:
289
461
  ✓ feature.json (master + per-module) - spécification complète
290
- ✓ .ralph/prd.json or .ralph/prd-{module}.json - task breakdown
462
+ ✓ .ralph/prd-{module}.json - task breakdown per module
291
463
  ✓ .ralph/progress.txt - tracker de progression
292
464
  ✓ ba-interactive.html - document de revue interactif
293
465
 
@@ -302,21 +474,6 @@ Effort: {total_days} days ({total_hours} hours)
302
474
  ═══════════════════════════════════════════════════════════════
303
475
  ```
304
476
 
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
477
  ---
321
478
 
322
479
  ## MODE SUPPORT
@@ -350,115 +507,6 @@ Focused handoff for changes:
350
507
 
351
508
  ---
352
509
 
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
510
  ## TROUBLESHOOTING
463
511
 
464
512
  | Issue | Resolution |
@@ -466,10 +514,12 @@ Before presenting handoff to user:
466
514
  | All modules missing handoff data | Return to step-05a-handoff.md. Handoff MUST be written to each module feature.json. |
467
515
  | prd.json generation failed | Verify ss derive-prd command is installed and feature.json path is correct. |
468
516
  | 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
517
+ | BA manifest not found | Create docs/business/index.json if missing. Use schema provided in section 3. |
518
+ | Manifest entries incorrect | Verify appCode, moduleCode, and version match feature.json metadata exactly. |
519
+ | ba-interactive.html is too small (< 100KB) | FEATURE_DATA not serialized correctly. Verify JSON structure. Re-run FEATURE_DATA build. |
520
+ | moduleSpecs missing from HTML | FEATURE_DATA.moduleSpecs is empty or not included in JSON. Verify each module is iterated and populated. |
521
+ | Scope keys still show "mustHave" instead of "vital" | Conversion from feature.json keys to HTML keys failed. Check cadrage.scope conversion logic. |
522
+ | Wireframes array is empty | Verify each module has specification.uiWireframes. If missing, add wireframe stubs. |
523
+ | dependencyGraph missing | Verify master feature.json has consolidation.dependencyGraph. If missing, create empty nodes/edges arrays. |
524
+ | HTML opens but data blank (localStorage issue) | Clear browser localStorage. HTML will load pre-populated FEATURE_DATA on first load. |
525
+ | Export/re-import fails | Verify exported JSON matches original feature.json schema. Validate with `/business-analyse -x --validate`. |
@@ -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-03a-specify.md
4
+ > **Loaded in:** step-03a-data.md
5
5
 
6
6
  ---
7
7
 
@@ -1,6 +1,6 @@
1
1
  # Skill Launch Display Templates (templates/tpl-launch-displays.md)
2
2
 
3
- > **Used by:** step-05b-deploy (section 5: Completion Summary)
3
+ > **Used by:** step-05b-deploy (Completion Summary)
4
4
  > **Purpose:** User-facing display templates for BA completion
5
5
  > **Note:** No emojis - uses text markers per Claude Code conventions
6
6
 
@@ -33,8 +33,9 @@ Read: templates/templates.md
33
33
 
34
34
  **Target path:**
35
35
  ```
36
- src/SmartStack.Api/Controllers/{area}/{module}Controller.cs
36
+ src/SmartStack.Api/Controllers/{ContextShort}/{Application}/{entity}Controller.cs
37
37
  ```
38
+ > Context mapping: `business` → `Business`, `platform` → `Admin`, `personal` → `User`
38
39
 
39
40
  **Apply template with variables:**
40
41
 
@@ -12,11 +12,11 @@ Execute the Ralph Weegund technique - an iterative development methodology where
12
12
  <quick_start>
13
13
  **Three ways to start Ralph Loop:**
14
14
 
15
- 1. **From Business Analysis (RECOMMENDED - NEW v6.1):**
15
+ 1. **From Business Analysis (RECOMMENDED):**
16
16
  ```bash
17
17
  /business-analyse MyFeature
18
- # At the end, choose "Ralph Loop" automatic launch
19
- # No arguments needed - prd.json already generated
18
+ # At the end, BA offers to launch ralph-loop automatically
19
+ # If PRD files are missing, ralph-loop auto-recovers via ss derive-prd
20
20
  ```
21
21
 
22
22
  2. **Manual start with existing prd.json:**
@@ -311,6 +311,12 @@ Before ANY work, verify MCP servers:
311
311
  | 04 | `steps/step-04-check.md` | Check completion, decide next action |
312
312
  | 05 | `steps/step-05-report.md` | Generate final report |
313
313
 
314
+ **Reference files (loaded conditionally):**
315
+
316
+ | Ref | File | Loaded when |
317
+ |-----|------|-------------|
318
+ | - | `references/core-seed-data.md` | Infrastructure task involves seed data or IClientSeedDataProvider |
319
+
314
320
  </step_files>
315
321
 
316
322
  <file_structure>
@@ -402,14 +408,23 @@ Before ANY work, verify MCP servers:
402
408
 
403
409
  <execution_rules>
404
410
 
411
+ - **NEVER DELEGATE THE LOOP** - The Ralph loop MUST execute in the MAIN agent context. NEVER use the Task tool to spawn a sub-agent for loop execution. Sub-agents lose ALL skill context (step files, COMPACT LOOP logic, MCP requirements, SmartStack conventions) and WILL stop prematurely. This is FORBIDDEN. The only acceptable use of Task is for isolated read-only research (e.g., looking up documentation via Context7).
405
412
  - **Load step files ONCE** - Step files are read only on FIRST iteration. After that, use the COMPACT LOOP in step-04 section 5.
406
413
  - **VERIFY MCP FIRST** - Never skip MCP validation at init
407
414
  - **BATCH same-category tasks** - Execute up to 5 tasks of the same category per iteration (reduces loop iterations from 30+ to ~8)
408
415
  - **COMMIT AFTER EACH BATCH** - One commit per batch, not per individual task
409
416
  - **UPDATE progress.txt** - Persist learnings
410
417
  - **NEVER fake completion** - Only output promise when truly done
411
- - **NEVER STOP THE LOOP** - The loop is AUTONOMOUS. DO NOT pause between iterations. DO NOT wait for user input. Only stop on: completion, max iterations, dead-end, or explicit user interruption. Stopping for any other reason wastes context and causes re-reads.
412
- - **COMPACT OUTPUT** - During loop iterations, use 1-2 lines per task. Save verbose output for the final report.
418
+ - **NEVER STOP THE LOOP** - The loop is AUTONOMOUS. Stopping is a BUG. Specifically FORBIDDEN:
419
+ - DO NOT pause between iterations
420
+ - DO NOT wait for user input
421
+ - DO NOT output a summary and stop ("I'll continue later")
422
+ - DO NOT decide to stop because "quality over quantity" or "this is enough for now"
423
+ - DO NOT stop after completing one module when others remain in the queue
424
+ - DO NOT reduce scope autonomously ("I'll skip frontend/tests to save time")
425
+ - The ONLY valid stop reasons: ALL tasks complete, max iterations reached, dead-end (all remaining blocked/failed), or explicit user interruption via Ctrl+C
426
+ - **CONTEXT BUDGET** - Keep ALL output COMPACT during loop iterations. Verbose reasoning wastes context tokens and causes premature termination. Use 1-2 lines per task during the loop. Save detailed output for the final report ONLY. During init, skip verbose MCP output and keep summaries minimal.
427
+ - **MODULE COMPLETENESS** - A module is NOT complete unless ALL expected layers have completed tasks: domain, infrastructure, application, api, frontend, i18n, test. If any layer is missing, inject guardrail tasks before advancing to the next module.
413
428
  </execution_rules>
414
429
 
415
430
  <success_criteria>