@atlashub/smartstack-cli 3.6.0 → 3.8.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/package.json +3 -2
  2. package/templates/skills/business-analyse/SKILL.md +6 -12
  3. package/templates/skills/business-analyse/_architecture.md +1 -1
  4. package/templates/skills/business-analyse/html/ba-interactive.html +3058 -2252
  5. package/templates/skills/business-analyse/html/build-html.js +77 -0
  6. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +129 -0
  7. package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +22 -0
  8. package/templates/skills/business-analyse/html/src/scripts/03-render-cadrage.js +208 -0
  9. package/templates/skills/business-analyse/html/src/scripts/04-render-modules.js +211 -0
  10. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +542 -0
  11. package/templates/skills/business-analyse/html/src/scripts/06-render-consolidation.js +105 -0
  12. package/templates/skills/business-analyse/html/src/scripts/07-render-handoff.js +90 -0
  13. package/templates/skills/business-analyse/html/src/scripts/08-editing.js +45 -0
  14. package/templates/skills/business-analyse/html/src/scripts/09-export.js +65 -0
  15. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +165 -0
  16. package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +139 -0
  17. package/templates/skills/business-analyse/html/src/styles/01-variables.css +38 -0
  18. package/templates/skills/business-analyse/html/src/styles/02-layout.css +101 -0
  19. package/templates/skills/business-analyse/html/src/styles/03-navigation.css +62 -0
  20. package/templates/skills/business-analyse/html/src/styles/04-cards.css +196 -0
  21. package/templates/skills/business-analyse/html/src/styles/05-modules.css +325 -0
  22. package/templates/skills/business-analyse/html/src/styles/06-wireframes.css +230 -0
  23. package/templates/skills/business-analyse/html/src/styles/07-comments.css +184 -0
  24. package/templates/skills/business-analyse/html/src/styles/08-review-panel.css +229 -0
  25. package/templates/skills/business-analyse/html/src/template.html +622 -0
  26. package/templates/skills/business-analyse/react/components.md +1 -1
  27. package/templates/skills/business-analyse/react/schema.md +1 -1
  28. package/templates/skills/business-analyse/references/html-data-mapping.md +2 -2
  29. package/templates/skills/business-analyse/schemas/feature-schema.json +1 -1
  30. package/templates/skills/business-analyse/steps/step-00-init.md +8 -1
  31. package/templates/skills/business-analyse/steps/step-03d-validate.md +1 -1
  32. package/templates/skills/business-analyse/steps/step-04-consolidation.md +21 -0
  33. package/templates/skills/business-analyse/steps/step-05a-handoff.md +273 -10
  34. package/templates/skills/business-analyse/steps/{step-05d-html.md → step-05b-deploy.md} +262 -63
  35. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +1 -1
  36. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  37. package/templates/skills/ralph-loop/SKILL.md +3 -3
  38. package/templates/skills/ralph-loop/steps/step-00-init.md +77 -1
  39. package/templates/skills/business-analyse/steps/step-05b-mapping.md +0 -302
  40. package/templates/skills/business-analyse/steps/step-05c-deploy.md +0 -296
@@ -1,7 +1,7 @@
1
1
  # React Components - Business Analyse Viewer
2
2
 
3
3
  > **Usage:** React component that renders feature.json directly
4
- > **Loaded in:** step-05d-html.md
4
+ > **Loaded in:** step-05b-deploy.md
5
5
  > **Data source (module):** `docs/business/{app}/{module}/business-analyse/v{X.Y}/feature.json`
6
6
  > **Data source (application):** `docs/business/{app}/business-analyse/v{X.Y}/feature.json`
7
7
  > **Related:** `react/application-viewer.md` for application-level view
@@ -1,7 +1,7 @@
1
1
  # TypeScript Schema - Feature JSON Types
2
2
 
3
3
  > **Usage:** TypeScript interfaces aligned with feature-schema.json and application-schema.json
4
- > **Loaded in:** step-05d-html.md (for web app rendering)
4
+ > **Loaded in:** step-05b-deploy.md (for web app rendering)
5
5
  > **Source (module):** `docs/business/{app}/{module}/business-analyse/v{X.Y}/feature.json`
6
6
  > **Source (application):** `docs/business/{app}/business-analyse/v{X.Y}/feature.json`
7
7
 
@@ -1,6 +1,6 @@
1
1
  # HTML Data Mapping Reference (references/html-data-mapping.md)
2
2
 
3
- > **Used by:** step-05d-html (Deploy Interactive HTML), step-03d-validate (incremental HTML)
3
+ > **Used by:** step-05b-deploy (Deploy Interactive HTML), step-03d-validate (incremental HTML)
4
4
  > **Purpose:** Exact mapping from feature.json to HTML FEATURE_DATA and EMBEDDED_ARTIFACTS objects
5
5
 
6
6
  ---
@@ -283,7 +283,7 @@ EMBEDDED_ARTIFACTS.dependencyGraph = {
283
283
 
284
284
  ---
285
285
 
286
- ## Usage in step-05d-html
286
+ ## Usage in step-05b-deploy
287
287
 
288
288
  1. Serialize the FEATURE_DATA object as JSON (with 2-space indentation for readability)
289
289
  2. Serialize the EMBEDDED_ARTIFACTS object as JSON (with 2-space indentation)
@@ -43,7 +43,7 @@
43
43
  }
44
44
  },
45
45
 
46
- "$comment": "Sub-schema loading guide per BA step: step-00-init → metadata-schema.json | step-01-cadrage → discovery-schema.json (module) OR application-schema.json (master) | step-02-decomposition → application-schema.json (modules[], dependencyGraph) | step-03a-data → analysis-schema.json | step-03b-ui → specification-schema.json (wireframes, layouts) | step-03c-compile → specification-schema.json | step-03d-validate → validation-schema.json | step-04-consolidation → validation-schema.json + application-schema.json (consolidation) | step-05a-handoff → handoff-schema.json | step-05b-mapping → handoff-schema.json (brToCodeMapping, apiEndpointSummary) | step-05c-deploy → (prd, progress, manifest) | step-05d-html → (ba-interactive.html)",
46
+ "$comment": "Sub-schema loading guide per BA step: step-00-init → metadata-schema.json | step-01-cadrage → discovery-schema.json (module) OR application-schema.json (master) | step-02-decomposition → application-schema.json (modules[], dependencyGraph) | step-03a-data → analysis-schema.json | step-03b-ui → specification-schema.json (wireframes, layouts) | step-03c-compile → specification-schema.json | step-03d-validate → validation-schema.json | step-04-consolidation → validation-schema.json + application-schema.json (consolidation) | step-05a-handoff → handoff-schema.json (filesToCreate, brToCodeMapping, apiEndpointSummary) | step-05b-deploy → (prd, progress, manifest, ba-interactive.html)",
47
47
 
48
48
  "$defs": {
49
49
  "stepStatus": { "$ref": "shared/common-defs.json#/$defs/stepStatus" },
@@ -416,5 +416,12 @@ If initialization was interrupted:
416
416
 
417
417
  1. Check `.business-analyse/config.json` for currentFeature
418
418
  2. If feature ID exists, search for feature.json in `docs/business/`
419
- 3. If found, offer to resume from last completed step
419
+ 3. If found, check `metadata.workflow.lastCompletedStep`:
420
+ - If `"step-04-consolidation"` AND status = `"consolidated"`:
421
+ → Resume directly at `step-05a-handoff.md` (skip steps 00-04)
422
+ → Display: "Resuming from consolidation — proceeding to handoff..."
423
+ - If status = `"handed-off"` AND `.ralph/prd-*.json` files missing:
424
+ → Resume at `step-05b-deploy.md` (only deploy artifacts needed)
425
+ → Display: "Handoff complete but artifacts missing — deploying..."
426
+ - Otherwise: offer to resume from last completed step
420
427
  4. If not found, create fresh feature.json
@@ -244,7 +244,7 @@ ba-writer.updateModuleStatus({feature_id}, {currentModule.code}, "specified")
244
244
 
245
245
  2. **Build FEATURE_DATA object:**
246
246
 
247
- > **Use the EXACT SAME mapping defined in step-05d-html.md and references/html-data-mapping.md.**
247
+ > **Use the EXACT SAME mapping defined in step-05b-deploy.md and references/html-data-mapping.md.**
248
248
  > The mapping is identical — the only difference is that `moduleSpecs` only includes completed modules.
249
249
  > Modules not yet specified will NOT appear in `moduleSpecs` (their entry in `modules[]` will show `status: "pending"`).
250
250
 
@@ -531,6 +531,27 @@ When only 1 module:
531
531
 
532
532
  ---
533
533
 
534
+ ## WORKFLOW STATE SAVE (for resume support)
535
+
536
+ After consolidation approval, update workflow state to enable resume if context is exhausted during handoff steps:
537
+
538
+ ```
539
+ ba-writer.enrichSection({
540
+ featureId: {feature_id},
541
+ section: "metadata.workflow",
542
+ data: {
543
+ lastCompletedStep: "step-04-consolidation",
544
+ readyForHandoff: true
545
+ }
546
+ })
547
+ ```
548
+
549
+ > **Why:** Steps 05a-05b arrive late in the conversation when context may be near exhaustion.
550
+ > If BA is interrupted during handoff, the user can resume with `/business-analyse` which will
551
+ > detect `lastCompletedStep: "step-04-consolidation"` and resume directly at step-05a.
552
+
553
+ ---
554
+
534
555
  ## NEXT STEP
535
556
 
536
557
  Load: `./step-05a-handoff.md`
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: step-05a-handoff
3
- description: Build the development handoff data - verify consolidation, choose implementation strategy, calculate complexity, and map specification to files (7 categories)
3
+ description: Build development handoff data, map business rules to code, write handoff to feature.json
4
4
  model: sonnet
5
- next_step: steps/step-05b-mapping.md
5
+ next_step: steps/step-05b-deploy.md
6
6
  ---
7
7
 
8
8
  > **Context files:** `_shared.md` | `_architecture.md`
@@ -21,7 +21,7 @@ next_step: steps/step-05b-mapping.md
21
21
 
22
22
  ## YOUR TASK
23
23
 
24
- Build the development handoff data: verify consolidation, choose implementation strategy, calculate complexity, and map specification to files (7 categories). BR-to-code mapping, API summary, and writing to feature.json are handled in step-05b.
24
+ Build the development handoff data: verify consolidation, choose implementation strategy, calculate complexity, map specification to files (7 categories), map business rules to code, generate API endpoint summary, and write handoff to EACH module feature.json.
25
25
 
26
26
  ---
27
27
 
@@ -467,18 +467,281 @@ Test files:
467
467
 
468
468
  ---
469
469
 
470
- ## SELF-VERIFICATION (MANDATORY before loading step-05b-mapping)
470
+ ### 5. Map Business Rules to Code
471
471
 
472
- Before proceeding to step-05b-mapping.md, VERIFY:
472
+ Derive from `analysis.businessRules[]` of **EACH module**.
473
473
 
474
- - **filesToCreate** has all 7 categories populated (domain, application, infrastructure, api, frontend, seedData, tests) for each module
475
- - **Complexity** calculated for all modules using the matrix from section 3
476
- - **Implementation strategy** chosen (for multi-module features)
474
+ Generate complete mapping for each BR:
477
475
 
478
- **IF any check fails → FIX before proceeding.** The mapping and write operations in step-05b depend on complete handoff data structure.
476
+ ```json
477
+ {
478
+ "brToCodeMapping": [
479
+ {
480
+ "ruleId": "BR-VAL-001",
481
+ "title": "Order total must equal sum of item prices",
482
+ "module": "{moduleCode}",
483
+ "severity": "critical",
484
+ "implementationPoints": [
485
+ {
486
+ "layer": "Domain",
487
+ "component": "Order.cs",
488
+ "method": "CalculateTotal()",
489
+ "implementation": "Validate sum equals sum of OrderItems.Price"
490
+ },
491
+ {
492
+ "layer": "Application",
493
+ "component": "CreateOrderService.cs",
494
+ "method": "Handle()",
495
+ "implementation": "Calculate total before persisting"
496
+ },
497
+ {
498
+ "layer": "API",
499
+ "component": "OrdersController.cs",
500
+ "method": "CreateOrder()",
501
+ "implementation": "Return validation error if total mismatch"
502
+ },
503
+ {
504
+ "layer": "Frontend",
505
+ "component": "OrderForm.tsx",
506
+ "method": "calculateTotal()",
507
+ "implementation": "Real-time calculation on item change"
508
+ }
509
+ ]
510
+ },
511
+ {
512
+ "ruleId": "BR-SEC-002",
513
+ "title": "User can only view orders from their tenant",
514
+ "module": "{moduleCode}",
515
+ "severity": "critical",
516
+ "implementationPoints": [
517
+ {
518
+ "layer": "Domain",
519
+ "component": "Order.cs",
520
+ "method": "Validate()",
521
+ "implementation": "Check TenantId matches user context"
522
+ },
523
+ {
524
+ "layer": "Infrastructure",
525
+ "component": "OrderRepository.cs",
526
+ "method": "GetUserOrders()",
527
+ "implementation": "Filter by TenantId in WHERE clause"
528
+ },
529
+ {
530
+ "layer": "API",
531
+ "component": "OrdersController.cs",
532
+ "method": "GetOrders()",
533
+ "implementation": "Enforce permission check + tenant filter"
534
+ }
535
+ ]
536
+ }
537
+ ]
538
+ }
539
+ ```
540
+
541
+ For each BR include:
542
+ - **ruleId**: Reference to analysis.businessRules[].id
543
+ - **title**: The rule statement
544
+ - **module**: Which module it belongs to
545
+ - **severity**: "critical", "high", "medium", "low"
546
+ - **implementationPoints**: Array of {layer, component, method, implementation}
547
+
548
+ Layers: Domain, Application, Infrastructure, API, Frontend
549
+
550
+ ---
551
+
552
+ ### 6. API Endpoint Summary
553
+
554
+ > **ABSOLUTE RULE:** Copy **EXACTLY** from `specification.apiEndpoints[]`. **NEVER** reinvent routes.
555
+
556
+ Generate summary with full details:
557
+
558
+ ```json
559
+ {
560
+ "apiEndpointSummary": [
561
+ {
562
+ "operation": "ListOrders",
563
+ "method": "GET",
564
+ "route": "/api/business/orders",
565
+ "linkedUC": "UC-001",
566
+ "linkedFR": "FR-001",
567
+ "permissions": ["business.orders.read"],
568
+ "requestSchema": { "type": "query", "params": ["pageNumber", "pageSize", "status"] },
569
+ "responseSchema": { "type": "PaginatedOrderDto[]" },
570
+ "errorCodes": [401, 403, 400, 500],
571
+ "module": "{moduleCode}"
572
+ },
573
+ {
574
+ "operation": "CreateOrder",
575
+ "method": "POST",
576
+ "route": "/api/business/orders",
577
+ "linkedUC": "UC-002",
578
+ "linkedFR": "FR-002",
579
+ "permissions": ["business.orders.create"],
580
+ "requestSchema": { "type": "body", "schema": "CreateOrderDto" },
581
+ "responseSchema": { "type": "OrderDto" },
582
+ "errorCodes": [400, 401, 403, 422, 500],
583
+ "module": "{moduleCode}"
584
+ }
585
+ ]
586
+ }
587
+ ```
588
+
589
+ For each endpoint:
590
+ - **operation**: Use case name or operation name
591
+ - **method**: HTTP method (GET, POST, PUT, DELETE, PATCH)
592
+ - **route**: Full API path from specification
593
+ - **linkedUC**: Use case ID(s) this endpoint implements
594
+ - **linkedFR**: Feature requirement ID(s)
595
+ - **permissions**: Array of exact permission paths
596
+ - **requestSchema**: Input contract (query params or body)
597
+ - **responseSchema**: Output contract
598
+ - **errorCodes**: Expected HTTP error codes
599
+ - **module**: Which module
600
+
601
+ Total endpoints = count of specification.apiEndpoints[] across all modules.
602
+
603
+ ---
604
+
605
+ ### 7. Write Handoff to Feature.json
606
+
607
+ > **BLOCKING RULE: The handoff MUST be written in EACH module feature.json.**
608
+ > A handoff at master level alone is INSUFFICIENT. Ralph-loop consumes module-level handoffs.
609
+ > An empty module handoff (`"handoff": {}`) is a CRITICAL BUG that blocks all downstream generation.
610
+
611
+ #### 7a. Module Handoff Loop (MANDATORY)
612
+
613
+ > **STRUCTURE CARD: handoff** — Field names are EXACT. Include ALL fields below.
614
+ > **PATH RULE:** All backend paths MUST include `{ContextPascal}/{ApplicationName}/` hierarchy (see section 4).
615
+ > ```json
616
+ > {
617
+ > "complexity": "simple|medium|complex",
618
+ > "filesToCreate": {
619
+ > "domain": [{"path": "src/Domain/Entities/{Ctx}/{App}/{Mod}/{Entity}.cs", "type": "Entity|ValueObject|Enum", "linkedFRs": [], "linkedUCs": [], "module": "..."}],
620
+ > "application": [{"path": "src/Application/Services/{Ctx}/{App}/{Mod}/{Svc}Service.cs", "type": "Service|Dto|Validator", "linkedFRs": [], "linkedUCs": [], "module": "..."}],
621
+ > "infrastructure": [{"path": "src/Infrastructure/Persistence/Configurations/{Ctx}/{App}/{Mod}/{Entity}Configuration.cs", "type": "EFConfiguration", "linkedFRs": [], "module": "..."}],
622
+ > "api": [{"path": "src/API/Controllers/{CtxShort}/{App}/{Entity}Controller.cs", "type": "ApiController", "linkedUCs": [], "linkedFRs": [], "module": "..."}],
623
+ > "frontend": [{"path": "src/pages/{Mod}/{Page}Page.tsx", "type": "Page|Component|Hook|DashboardPage", "linkedUCs": [], "linkedWireframes": [], "module": "..."}],
624
+ > "seedData": [{"path": "src/Infrastructure/Persistence/Seeding/Data/{Mod}/...SeedData.cs", "type": "SeedData", "category": "core|business", "source": "...", "module": "..."}],
625
+ > "tests": [{"path": "src/Tests/Unit/Domain/{Ctx}/{App}/{Mod}/{Entity}Tests.cs", "type": "UnitTests|IntegrationTests|SecurityTests", "linkedFRs": [], "linkedUCs": [], "module": "..."}]
626
+ > },
627
+ > "brToCodeMapping": [{"ruleId": "BR-...", "files": ["path1", "path2"], "implementation": "description"}],
628
+ > "apiEndpointSummary": [{"method": "GET|POST|PUT|DELETE", "path": "/api/...", "permission": "business.{app}.{module}.{action}", "linkedUC": "UC-..."}],
629
+ > "prdFile": ".ralph/prd-{module}.json",
630
+ > "totalFiles": 0,
631
+ > "totalTasks": 0,
632
+ > "handedOffAt": "{ISO timestamp}"
633
+ > }
634
+ > ```
635
+ > **MANDATORY fields:** ALL of the above. `filesToCreate` MUST have all 7 categories (even if empty arrays).
636
+ > **FORBIDDEN:** `handoff: {}` (empty object is a CRITICAL BUG). Missing `brToCodeMapping` or `apiEndpointSummary`.
637
+
638
+ **For i = 0; i < modules.length; i++:**
639
+
640
+ ```
641
+ 1. moduleCode = modules[i].code
642
+ 2. moduleFeatureId = modules[i].featureJsonPath or find via ba-reader.findFeature()
643
+ 3. Read the module feature.json via ba-reader.findFeature(moduleFeatureId)
644
+ 4. Build the handoff payload for THIS module:
645
+ - complexity (from section 3 calculation)
646
+ - filesToCreate (full 7-category structure from section 4, filtered for this module)
647
+ - brToCodeMapping (from section 5, filtered for this module)
648
+ - apiEndpointSummary (from section 6, filtered for this module)
649
+ - prdFile path
650
+ - totalFiles count
651
+ - totalTasks count
652
+ - handedOffAt timestamp
653
+
654
+ 5. Write via ba-writer:
655
+ ba-writer.enrichModuleHandoff({
656
+ moduleFeatureId: {moduleFeatureId},
657
+ handoffData: {
658
+ complexity: "{simple|medium|complex}",
659
+ filesToCreate: {...},
660
+ brToCodeMapping: [...],
661
+ apiEndpointSummary: [...],
662
+ prdFile: ".ralph/prd-{moduleCode}.json",
663
+ totalFiles: {count},
664
+ totalTasks: {count},
665
+ handedOffAt: "{ISO timestamp}"
666
+ }
667
+ })
668
+
669
+ 6. VERIFICATION (MANDATORY - done automatically by enrichModuleHandoff):
670
+ - handoff !== {}
671
+ - handoff.filesToCreate has 7 categories
672
+ - handoff.brToCodeMapping.length > 0
673
+ IF verification fails → STOP, report error, do NOT continue
674
+
675
+ 7. Display progress:
676
+ "✓ Handoff module {i+1}/{N} : {moduleCode} ({fileCount} fichiers, {brCount} BRs mappées)"
677
+ ```
678
+
679
+ #### 7b. Master Handoff (after ALL modules written successfully)
680
+
681
+ ```
682
+ ba-writer.enrichSection({
683
+ featureId: {feature_id},
684
+ section: "handoff",
685
+ data: {
686
+ status: "handed-off",
687
+ complexity: "{simple|medium|complex}",
688
+ implementationStrategy: "{strategy}",
689
+ moduleCount: {count},
690
+ moduleOrder: [...],
691
+ totalFilesToCreate: {sum across all modules},
692
+ totalTasks: {sum across all modules},
693
+ prdStructure: "per-module | consolidated",
694
+ prdFiles: [
695
+ { module: "{module1}", path: ".ralph/prd-{module1}.json" },
696
+ { module: "{module2}", path: ".ralph/prd-{module2}.json" }
697
+ ],
698
+ progressTrackerPath: ".ralph/progress.txt",
699
+ handedOffAt: "{ISO timestamp}"
700
+ }
701
+ })
702
+ ```
703
+
704
+ #### 7c. Final Verification (BLOCKING)
705
+
706
+ ```
707
+ count = 0
708
+ FOR each module in modules[]:
709
+ Read module feature.json
710
+ IF module.handoff !== {} AND module.status === "handed-off":
711
+ count++
712
+
713
+ IF count < modules.length:
714
+ → BLOCKING ERROR: {modules.length - count} modules missing handoff
715
+ → List the missing modules by name
716
+ → DO NOT proceed to step-05b
717
+ → Return to 7a for missing modules only
718
+
719
+ IF count === modules.length:
720
+ ba-writer.updateStatus({feature_id}, "handed-off")
721
+ Display: "✓ Handoff complet: {count}/{modules.length} modules avec handoff valide"
722
+ ```
723
+
724
+ Status journey: analyze → consolidate → handed-off
725
+
726
+ ---
727
+
728
+ ## SELF-VERIFICATION
729
+
730
+ Before proceeding to step-05b-deploy.md, VERIFY:
731
+
732
+ 1. **filesToCreate** has all 7 categories populated (domain, application, infrastructure, api, frontend, seedData, tests) for each module
733
+ 2. **Complexity** calculated for all modules
734
+ 3. **Implementation strategy** chosen (for multi-module features)
735
+ 4. **ALL module feature.json** have `handoff.brToCodeMapping.length > 0`
736
+ 5. **ALL module feature.json** have `handoff.apiEndpointSummary.length > 0`
737
+ 6. **ALL module feature.json** status = "handed-off"
738
+ 7. **Master feature.json** has `handoff` section with implementationStrategy, moduleOrder, totalFilesToCreate
739
+ 8. **Master status** = "handed-off"
740
+
741
+ **IF any check fails → FIX before proceeding.**
479
742
 
480
743
  ---
481
744
 
482
745
  ## NEXT STEP
483
746
 
484
- Load: `steps/step-05b-mapping.md`
747
+ Load: `steps/step-05b-deploy.md`