@atlashub/smartstack-cli 3.2.0 → 3.3.1

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 (33) hide show
  1. package/dist/index.js +605 -25
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/agents/ba-reader.md +1 -1
  5. package/templates/agents/ba-writer.md +8 -1
  6. package/templates/skills/business-analyse/SKILL.md +21 -23
  7. package/templates/skills/business-analyse/_architecture.md +123 -0
  8. package/templates/skills/business-analyse/_elicitation.md +206 -0
  9. package/templates/skills/business-analyse/_module-loop.md +56 -0
  10. package/templates/skills/business-analyse/_shared.md +75 -531
  11. package/templates/skills/business-analyse/_suggestions.md +34 -0
  12. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  13. package/templates/skills/business-analyse/questionnaire.md +2 -2
  14. package/templates/skills/business-analyse/react/components.md +1 -1
  15. package/templates/skills/business-analyse/react/schema.md +1 -1
  16. package/templates/skills/business-analyse/references/html-data-mapping.md +294 -0
  17. package/templates/skills/business-analyse/schemas/feature-schema.json +1 -1
  18. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  19. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +1 -1
  20. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  21. package/templates/skills/business-analyse/steps/step-00-init.md +13 -10
  22. package/templates/skills/business-analyse/steps/step-01-cadrage.md +2 -0
  23. package/templates/skills/business-analyse/steps/step-02-decomposition.md +5 -3
  24. package/templates/skills/business-analyse/steps/{step-03-specify.md → step-03a-specify.md} +16 -606
  25. package/templates/skills/business-analyse/steps/step-03b-compile.md +670 -0
  26. package/templates/skills/business-analyse/steps/step-04-consolidation.md +7 -5
  27. package/templates/skills/business-analyse/steps/step-05a-handoff.md +727 -0
  28. package/templates/skills/business-analyse/steps/step-05b-deploy.md +479 -0
  29. package/templates/skills/business-analyse/steps/step-06-extract.md +4 -2
  30. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  31. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +161 -0
  32. package/templates/skills/business-analyse/templates/tpl-progress.md +171 -0
  33. package/templates/skills/business-analyse/steps/step-05-handoff.md +0 -1682
@@ -1,11 +1,13 @@
1
1
  ---
2
- name: step-03-specify
3
- description: Iterative per-module specification - sections, entities, BR, permissions, mockups, validation
2
+ name: step-03a-specify
3
+ description: Per-module specification - sections, entities, BR, wireframes, use cases (interactive phase)
4
4
  model: opus
5
- next_step: steps/step-03-specify.md OR steps/step-04-consolidation.md (conditional)
5
+ next_step: steps/step-03b-compile.md
6
6
  ---
7
7
 
8
- # Step 3: Specification (Iterative Per-Module)
8
+ > **Context files:** `_shared.md` | `_elicitation.md` | `_architecture.md` | `_module-loop.md`
9
+
10
+ # Step 3a: Specification (Interactive Phase)
9
11
 
10
12
  ## MANDATORY EXECUTION RULES
11
13
 
@@ -77,7 +79,8 @@ ba-reader.readApplicationContext({feature_id})
77
79
  → Copy cadrage.applicationRoles → module.applicationContext.applicationRoles
78
80
  ```
79
81
 
80
- Update module status in master: "pending" → "in-progress"
82
+ // Update module status in master: "pending" → "in-progress"
83
+ ba-writer.updateModuleStatus({feature_id}, {currentModule.code}, "in-progress")
81
84
 
82
85
  ### 2-ter. Derive Module Discovery Section (MANDATORY)
83
86
 
@@ -801,614 +804,21 @@ Extract business rules specific to this module:
801
804
  > **ID PATTERN:** `BR-{CAT}-{PREFIX}-{NNN}` where CAT = VAL|CALC|WF|SEC|DATA, PREFIX = module initials (2-4 chars)
802
805
  > **category values:** lowercase only: `validation`, `calculation`, `workflow`, `security`, `data`
803
806
 
804
- ### 8. Full Specification
805
-
806
- Generate the complete specification for this module. **Each subsection below includes a STRUCTURE CARD showing the EXACT JSON format. Follow them precisely.**
807
-
808
- #### 8a. Actors
809
-
810
- Inherited from application roles → mapped to module permissions.
811
-
812
- > **STRUCTURE CARD: specification.actors[]**
813
- > ```json
814
- > {
815
- > "role": "Sales Manager",
816
- > "description": "Creates and approves orders",
817
- > "permissions": [
818
- > "business.{app}.{module}.read",
819
- > "business.{app}.{module}.create",
820
- > "business.{app}.{module}.update"
821
- > ]
822
- > }
823
- > ```
824
- > **MANDATORY fields:** `role`, `permissions` (array of permission paths)
825
- > **FORBIDDEN fields:** Do NOT use `systemRole`. Use `permissions` array.
826
-
827
- #### 8b. Use Cases (UC-{PREFIX}-NNN)
828
-
829
- Per section: list, create, read, update, delete, approve, etc.
830
-
831
- > **STRUCTURE CARD: specification.useCases[]**
832
- > ```json
833
- > {
834
- > "id": "UC-{PREFIX}-001",
835
- > "name": "Create Order",
836
- > "primaryActor": "Sales Representative",
837
- > "permission": "business.{app}.{module}.create",
838
- > "preconditions": ["Customer exists", "Products in stock"],
839
- > "postconditions": ["Order created with Draft status"],
840
- > "mainScenario": [
841
- > "1. User navigates to creation form",
842
- > "2. User fills in required fields",
843
- > "3. System validates data (BR-VAL-{PREFIX}-001)",
844
- > "4. System creates the record",
845
- > "5. System displays confirmation"
846
- > ],
847
- > "alternativeScenarios": [
848
- > { "name": "Validation failure", "steps": ["1. System detects invalid data", "2. System highlights errors"] }
849
- > ],
850
- > "errorScenarios": [
851
- > { "name": "Server error", "steps": ["1. System shows error message", "2. Data preserved for retry"] }
852
- > ],
853
- > "linkedRules": ["BR-VAL-{PREFIX}-001", "BR-WF-{PREFIX}-002"]
854
- > }
855
- > ```
856
- > **MANDATORY fields:** `id`, `name`, `primaryActor`, `permission`, `mainScenario`, `linkedRules`
857
- > **FORBIDDEN fields:** Do NOT use `actor` (use `primaryActor`), `linkedBRs` (use `linkedRules`), `linkedFRs` (not in UC, FRs link to UCs instead)
858
-
859
- #### 8c. Functional Requirements (FR-{PREFIX}-NNN)
860
-
861
- Linked to BRs and UCs.
862
-
863
- > **STRUCTURE CARD: specification.functionalRequirements[]**
864
- > ```json
865
- > {
866
- > "id": "FR-{PREFIX}-001",
867
- > "statement": "System MUST validate customer budget before order creation",
868
- > "priority": "must|should|could",
869
- > "linkedRules": ["BR-VAL-{PREFIX}-001"],
870
- > "linkedUseCases": ["UC-{PREFIX}-001"],
871
- > "acceptanceCriteria": [
872
- > "Order rejected if total > budget",
873
- > "Error message displayed with remaining budget"
874
- > ]
875
- > }
876
- > ```
877
- > **MANDATORY fields:** `id`, `statement`, `priority`, `linkedUseCases`
878
- > **FORBIDDEN fields:** Do NOT use `name`/`description` (use `statement` with System MUST/SHOULD/COULD format), `linkedUCs` (use `linkedUseCases`), `linkedBRs` (use `linkedRules`)
879
-
880
- #### 8d. Permission Matrix
881
-
882
- Roles × resources × operations with full paths.
883
-
884
- > **STRUCTURE CARD: specification.permissionMatrix**
885
- > ```json
886
- > {
887
- > "permissions": [
888
- > { "path": "business.{app}.{module}.read", "action": "read", "description": "View records" },
889
- > { "path": "business.{app}.{module}.create", "action": "create", "description": "Create new records" },
890
- > { "path": "business.{app}.{module}.update", "action": "update", "description": "Update existing records" },
891
- > { "path": "business.{app}.{module}.delete", "action": "delete", "description": "Delete records" },
892
- > { "path": "business.{app}.{module}.export", "action": "export", "description": "Export data" }
893
- > ],
894
- > "roleAssignments": [
895
- > { "role": "{App} Admin", "permissions": ["business.{app}.{module}.read", "business.{app}.{module}.create", "business.{app}.{module}.update", "business.{app}.{module}.delete", "business.{app}.{module}.export"] },
896
- > { "role": "{App} Manager", "permissions": ["business.{app}.{module}.read", "business.{app}.{module}.create", "business.{app}.{module}.update"] },
897
- > { "role": "{App} Viewer", "permissions": ["business.{app}.{module}.read"] }
898
- > ]
899
- > }
900
- > ```
901
- > **STRUCTURE:** Object with 2 arrays: `permissions[]` and `roleAssignments[]`
902
- > **FORBIDDEN:** Do NOT use a flat array with `resource`/`roles` fields. Always use the nested structure above.
903
-
904
- #### 8e. Navigation
905
-
906
- Module → Sections → Resources (levels 3-4-5 of the hierarchy).
907
-
908
- > **STRUCTURE CARD: specification.navigation**
909
- > ```json
910
- > {
911
- > "entries": [
912
- > { "level": "module", "code": "{module}", "labels": {"fr": "...", "en": "..."}, "route": "/business/{app}/{module}", "icon": "list" },
913
- > { "level": "section", "code": "list", "labels": {"fr": "Liste", "en": "List", "it": "Elenco", "de": "Liste"}, "route": "/business/{app}/{module}/list", "icon": "list" },
914
- > { "level": "section", "code": "dashboard", "labels": {"fr": "Dashboard", "en": "Dashboard"}, "route": "/business/{app}/{module}/dashboard", "icon": "chart-bar", "isNew": true }
915
- > ]
916
- > }
917
- > ```
918
-
919
- #### 8f. SeedData Core
920
-
921
- 5 MANDATORY typed arrays — each with structured objects, NOT flat strings or objects.
922
-
923
- > **STRUCTURE CARD: specification.seedDataCore**
924
- > ```json
925
- > {
926
- > "navigationModules": [
927
- > { "code": "{module}", "label": "{Module Name}", "icon": "list", "route": "/business/{app}/{module}", "parentCode": "{app}", "sort": 1 }
928
- > ],
929
- > "navigationTranslations": [
930
- > { "moduleCode": "{module}", "language": "fr", "label": "..." },
931
- > { "moduleCode": "{module}", "language": "en", "label": "..." },
932
- > { "moduleCode": "{module}", "language": "it", "label": "..." },
933
- > { "moduleCode": "{module}", "language": "de", "label": "..." }
934
- > ],
935
- > "permissions": [
936
- > { "path": "business.{app}.{module}.read", "action": "read", "description": "View {module}" },
937
- > { "path": "business.{app}.{module}.create", "action": "create", "description": "Create {module}" }
938
- > ],
939
- > "rolePermissions": [
940
- > { "role": "{App} Admin", "permissionPath": "business.{app}.{module}.*" },
941
- > { "role": "{App} Manager", "permissionPath": "business.{app}.{module}.read" }
942
- > ],
943
- > "permissionConstants": [
944
- > { "constantName": "{Module}Read", "path": "business.{app}.{module}.read" },
945
- > { "constantName": "{Module}Create", "path": "business.{app}.{module}.create" }
946
- > ]
947
- > }
948
- > ```
949
- > **MANDATORY:** All 5 arrays must be present. Each element must be an object, NOT a string.
950
- > **FORBIDDEN:** Do NOT use `navigationModule` (singular string), `permissions` as flat string array, `rolePermissions` as flat object, `permissionsConstants` as comma-separated string.
951
-
952
- #### 8g. Gherkin Scenarios
953
-
954
- BDD acceptance tests per UC.
955
-
956
- > **STRUCTURE CARD: specification.gherkinScenarios[]**
957
- > ```json
958
- > {
959
- > "feature": "{Module} Management",
960
- > "scenarios": [
961
- > {
962
- > "name": "Create a new record with valid data",
963
- > "tags": ["@{module}", "@create", "@smoke"],
964
- > "given": ["An authenticated user with role Manager", "No existing record with code 'TEST-001'"],
965
- > "when": ["The user fills the creation form", "The user submits the form"],
966
- > "then": ["The record is created with Draft status", "A success message is displayed"]
967
- > }
968
- > ]
969
- > }
970
- > ```
971
- > **STRUCTURE:** Object with `feature` string + `scenarios[]` array. Each scenario has `given`, `when`, `then` as ARRAYS of strings.
972
- > **FORBIDDEN:** Do NOT use flat arrays of `{uc, scenario, given, when, then}` where given/when/then are single strings.
973
-
974
- #### 8h. Validations
975
-
976
- Field validation rules per entity.
977
-
978
- > **STRUCTURE CARD: specification.validations[]**
979
- > ```json
980
- > {
981
- > "entity": "Order",
982
- > "field": "amount",
983
- > "rules": ["required", "decimal", "min:0.01", "max:999999.99"],
984
- > "errorMessageKey": "validation.{module}.amount.invalid"
985
- > }
986
- > ```
987
- > **MANDATORY fields:** `entity`, `field`, `rules` (array), `errorMessageKey`
988
- > **FORBIDDEN fields:** Do NOT use `rule` (singular string) or `message` (use `errorMessageKey`).
989
-
990
- #### 8i. Business Messages
991
-
992
- Minimum 4: success, error CRUD, error validation, error permission.
993
-
994
- > **STRUCTURE CARD: specification.messages[]**
995
- > ```json
996
- > {
997
- > "code": "{MODULE}-SUCCESS-CREATE",
998
- > "type": "success|error|warning|info",
999
- > "title": "Record Created",
1000
- > "message": "The record {code} has been created successfully.",
1001
- > "i18nKey": "message.{module}.created"
1002
- > }
1003
- > ```
1004
- > **MANDATORY fields:** `code`, `type`, `message`, `i18nKey`
1005
- > **FORBIDDEN:** Do NOT omit `title` or `i18nKey`. Every message MUST have an i18n key.
1006
-
1007
- #### 8j. Entity Lifecycle
1008
-
1009
- State machines for entities with status/state.
1010
- **Note:** If depth = full and 3a-state was executed, lifeCycles are already defined. Verify completeness and add any missing states/transitions.
1011
-
1012
- > **STRUCTURE CARD: specification.lifeCycles[]**
1013
- > ```json
1014
- > {
1015
- > "entity": "Order",
1016
- > "field": "status",
1017
- > "initialState": "draft",
1018
- > "states": [
1019
- > { "id": "draft", "displayName": "Brouillon", "color": "gray", "allowedTransitions": ["submitted"], "isTerminal": false },
1020
- > { "id": "submitted", "displayName": "Soumis", "color": "blue", "allowedTransitions": ["approved", "rejected"], "isTerminal": false },
1021
- > { "id": "approved", "displayName": "Approuvé", "color": "green", "allowedTransitions": ["archived"], "isTerminal": false },
1022
- > { "id": "rejected", "displayName": "Rejeté", "color": "red", "allowedTransitions": [], "isTerminal": true },
1023
- > { "id": "archived", "displayName": "Archivé", "color": "purple", "allowedTransitions": [], "isTerminal": true }
1024
- > ],
1025
- > "transitions": [
1026
- > {
1027
- > "from": "draft", "to": "submitted", "action": "submit",
1028
- > "label": { "fr": "Soumettre", "en": "Submit" },
1029
- > "permission": "business.{app}.{module}.update",
1030
- > "guards": ["BR-VAL-{PREFIX}-001"],
1031
- > "effects": [{ "type": "notification", "target": "role:manager", "template": "{module}-submitted" }],
1032
- > "confirm": true
1033
- > }
1034
- > ]
1035
- > }
1036
- > ```
1037
- > **MANDATORY:** `states` MUST be an array of OBJECTS with `id`, `displayName`, `color`, `allowedTransitions`, `isTerminal`. NEVER use flat string arrays.
1038
- > **Colors:** gray (draft/new), blue (in-progress), green (active/approved), yellow (warning/pending), orange (review), red (error/rejected), purple (archived/terminal)
1039
- > **FORBIDDEN:** Do NOT use `states: ["Active", "Inactive"]` (flat strings), `terminalStates` (use `isTerminal: true` on each state).
1040
-
1041
- #### 8k. API Endpoints
1042
-
1043
- RESTful routes following SmartStack patterns.
1044
-
1045
- > **STRUCTURE CARD: specification.apiEndpoints[]**
1046
- > ```json
1047
- > {
1048
- > "method": "GET|POST|PUT|PATCH|DELETE",
1049
- > "path": "/api/business/{app}/{module}",
1050
- > "permission": "business.{app}.{module}.read",
1051
- > "requestDto": "Get{Module}Query",
1052
- > "responseDto": "{Module}Dto[]",
1053
- > "description": "List all records with pagination and filters"
1054
- > }
1055
- > ```
1056
- > **MANDATORY fields:** `method`, `path`, `permission`, `description`
1057
- > **Recommended:** Include `requestDto` and `responseDto` for implementation clarity.
1058
-
1059
- #### 8l. i18n Keys
1060
-
1061
- Translation keys for all UI text (4 languages: fr, en, it, de).
1062
-
1063
- > **STRUCTURE CARD: specification.i18nKeys**
1064
- > ```json
1065
- > {
1066
- > "title": { "fr": "{Module}", "en": "{Module}", "it": "{Module}", "de": "{Module}" },
1067
- > "list": { "title": { "fr": "Liste", "en": "List" }, "empty": { "fr": "Aucun enregistrement", "en": "No records" } },
1068
- > "create": { "title": { "fr": "Nouveau", "en": "New" } },
1069
- > "detail": { "title": { "fr": "Détail", "en": "Detail" } },
1070
- > "buttons": { "create": { "fr": "Créer", "en": "Create" }, "edit": { "fr": "Modifier", "en": "Edit" }, "delete": { "fr": "Supprimer", "en": "Delete" } },
1071
- > "validation": { "required": { "fr": "Ce champ est requis", "en": "This field is required" } }
1072
- > }
1073
- > ```
1074
-
1075
- ### 9. Per-Module Validation
1076
-
1077
- > **Fused from old step-03-validate.md, run INLINE after specification.**
1078
-
1079
- #### 9a. Completeness Checks
1080
-
1081
- | Section | Minimum | Status |
1082
- |---------|---------|--------|
1083
- | actors | 2 | PASS/FAIL |
1084
- | useCases | 2 | PASS/FAIL |
1085
- | functionalRequirements | 4 | PASS/FAIL |
1086
- | permissionMatrix | 1 resource × 2 roles | PASS/FAIL |
1087
- | entities | 1 | PASS/FAIL |
1088
- | wireframes | 1 per section (BLOCKING) | PASS/FAIL |
1089
- | gherkinScenarios | 2 per UC | PASS/FAIL |
1090
- | validations | 1 | PASS/FAIL |
1091
- | messages | 4 | PASS/FAIL |
1092
- | lifeCycles | 1 (if entity has status) | PASS/FAIL |
1093
- | seedDataCore | 5 sections present | PASS/FAIL (BLOCKING) |
1094
-
1095
- #### 9b. Consistency Checks
1096
-
1097
- - Every UC has ≥1 linked FR
1098
- - Every FR has ≥1 linked BR
1099
- - All BR references exist in analysis.businessRules
1100
- - All actors appear in permissionMatrix
1101
- - Permission paths use full format: `business.{app}.{module}.{resource}.{action}`
1102
- - rolePermissions paths match permissions paths
1103
- - API routes use consistent prefix
1104
-
1105
- #### 9c. Convention Checks
1106
-
1107
- - UC-NNN format
1108
- - FR-NNN format
1109
- - BR-{CATEGORY}-NNN format
1110
- - Entity names PascalCase
1111
- - Field names camelCase
1112
- - Permission paths dot-separated lowercase
1113
-
1114
- #### 9d. Decision
1115
-
1116
- IF validation PASS:
1117
- Display summary, ask client for confirmation
1118
-
1119
- IF validation FAIL:
1120
- Display errors, offer:
1121
- ```
1122
- options:
1123
- - label: "Auto-corriger"
1124
- description: "Corriger automatiquement les erreurs détectées"
1125
- - label: "Réviser manuellement"
1126
- description: "Revenir aux sections problématiques"
1127
- - label: "Forcer la validation"
1128
- description: "Accepter malgré les erreurs (risqué)"
1129
- ```
1130
-
1131
- #### 9e. Write Module Validation Section (MANDATORY)
1132
-
1133
- > **The module feature.json MUST have a `validation` section recording the results of steps 9a-9d.**
1134
-
1135
- ```
1136
- ba-writer.enrichSection({
1137
- featureId: {module_feature_id},
1138
- section: "validation",
1139
- data: {
1140
- validatedAt: "{ISO timestamp}",
1141
- completenessChecks: [
1142
- { "section": "useCases", "count": {count}, "minimum": 2, "status": "PASS|FAIL" },
1143
- { "section": "functionalRequirements", "count": {count}, "minimum": 4, "status": "PASS|FAIL" },
1144
- { "section": "wireframes", "count": {count}, "minimum": {section_count}, "status": "PASS|FAIL" },
1145
- { "section": "seedDataCore", "count": 5, "minimum": 5, "status": "PASS|FAIL" }
1146
- ],
1147
- consistencyChecks: [
1148
- { "check": "UC-FR linkage", "passed": {n}, "warnings": {n}, "errors": {n}, "status": "PASS|FAIL" },
1149
- { "check": "BR references valid", "passed": {n}, "warnings": {n}, "errors": {n}, "status": "PASS|FAIL" },
1150
- { "check": "Permission path format", "passed": {n}, "warnings": {n}, "errors": {n}, "status": "PASS|FAIL" }
1151
- ],
1152
- conventionChecks: [
1153
- { "check": "ID naming with module prefix", "status": "PASS|FAIL", "details": "..." },
1154
- { "check": "Entity names PascalCase", "status": "PASS|FAIL", "details": "..." }
1155
- ],
1156
- semanticChecks: [
1157
- { "check": "orphan-permissions", "module": "{currentModule}", "status": "PASS|WARNING|ERROR", "details": "...", "autoFixed": false },
1158
- { "check": "uc-sans-fr", "module": "{currentModule}", "status": "PASS|WARNING|ERROR", "details": "...", "autoFixed": false },
1159
- { "check": "missing-wireframes", "module": "{currentModule}", "status": "PASS|WARNING|ERROR", "details": "...", "autoFixed": false }
1160
- ],
1161
- warnings: ["List of non-blocking warnings"],
1162
- decision: {
1163
- "approved": true,
1164
- "reason": "All checks passed",
1165
- "approvalMode": "standard",
1166
- "approvedBy": "Client",
1167
- "approvedAt": "{ISO timestamp}"
1168
- }
1169
- }
1170
- })
1171
- ```
1172
-
1173
- ### 10. Module Summary with Roles & Permissions
1174
-
1175
- Display comprehensive summary:
1176
-
1177
- ```
1178
- ═══════════════════════════════════════════════════════════
1179
- MODULE SPÉCIFIÉ: {currentModule} ({currentModuleIndex + 1}/{total})
1180
- ═══════════════════════════════════════════════════════════
1181
-
1182
- | Aspect | Valeur |
1183
- |--------|--------|
1184
- | Entités | {count} ({entity names}) |
1185
- | Business Rules | {count} (VAL: X, CALC: Y, WF: Z) |
1186
- | Use Cases | {count} (UC-001 → UC-NNN) |
1187
- | Exigences | {count} FRs |
1188
- | Sections | {count} ({section names}) |
1189
- | Maquettes | {count} wireframes |
1190
- | Permissions | {count} paths |
1191
- | Tests Gherkin | {count} scénarios |
1192
- | Messages | {count} |
1193
-
1194
- ### Rôles & Permissions pour {currentModule}
1195
- | Rôle | Permissions |
1196
- |------|------------|
1197
- | {App} Admin | business.{app}.{module}.* |
1198
- | {App} Manager | read, create, update, assign |
1199
- | {App} Contributor | read, create, update |
1200
- | {App} Viewer | read |
1201
-
1202
- → Validation: {PASS/FAIL}
1203
- ═══════════════════════════════════════════════════════════
1204
- ```
1205
-
1206
- Ask via AskUserQuestion:
1207
-
1208
- ```
1209
- question: "Le module {currentModule} est-il correctement spécifié ?"
1210
- header: "Module"
1211
- options:
1212
- - label: "Validé"
1213
- description: "Passer au module suivant"
1214
- - label: "Réviser"
1215
- description: "Modifier des éléments du module"
1216
- ```
1217
-
1218
- ### 11. Write Module Feature.json
1219
-
1220
- ```
1221
- // Write analysis section with ALL subsections
1222
- ba-writer.enrichSection({
1223
- featureId: {module_feature_id},
1224
- section: "analysis",
1225
- data: {
1226
- objectives: [{id, objective, metric, target}], // from 6a
1227
- entities: [{name, description, attributes, relationships}], // from 6b — SCHEMA FORMAT
1228
- businessRules: [{id, name, category, statement, priority, conditions, examples, testability}], // from 7 — SCHEMA FORMAT
1229
- processFlow: {entryPoints, mainFlow, decisionPoints, alternativeFlows}, // from 6c
1230
- dataLifecycle: {retentionPeriod, archiveStrategy, gdprCompliance, states} // from 6d
1231
- }
1232
- })
1233
-
1234
- // Write specification section with ALL subsections
1235
- ba-writer.enrichSection({
1236
- featureId: {module_feature_id},
1237
- section: "specification",
1238
- data: {
1239
- actors: [{role, description, permissions}], // 8a
1240
- useCases: [{id, name, primaryActor, permission, mainScenario, linkedRules}], // 8b
1241
- functionalRequirements: [{id, statement, priority, linkedRules, linkedUseCases, acceptanceCriteria}], // 8c
1242
- permissionMatrix: {permissions: [], roleAssignments: []}, // 8d
1243
- navigation: {entries: []}, // 8e
1244
- seedDataCore: {navigationModules, navigationTranslations, permissions, rolePermissions, permissionConstants}, // 8f
1245
- gherkinScenarios: [{feature, scenarios: [{name, tags, given, when, then}]}], // 8g
1246
- validations: [{entity, field, rules, errorMessageKey}], // 8h
1247
- messages: [{code, type, title, message, i18nKey}], // 8i
1248
- lifeCycles: [{entity, field, initialState, states: [{id, displayName, color, allowedTransitions, isTerminal}], transitions}], // 8j
1249
- apiEndpoints: [{method, path, permission, requestDto, responseDto, description}], // 8k
1250
- i18nKeys: {...}, // 8l
1251
- sections: [{code, labels, route, icon, permission, wireframe, useCases, businessRules, resources}], // from 3a-bis
1252
- dashboards: [{code, title, kpis, filters, refreshMode}], // from 3d
1253
- uiWireframes: [{screen, section, mockup, elements, actions, componentMapping, layout}] // from 3b
1254
- }
1255
- })
1256
-
1257
- // Write validation results from step 9
1258
- // (Already written in step 9e above)
1259
-
1260
- ba-writer.updateStatus({module_feature_id}, "specified")
1261
-
1262
- // Update master
1263
- ba-writer.updateModuleStatus({feature_id}, {currentModule.code}, "specified")
1264
- ```
1265
-
1266
- ### 11-bis. Deploy Incremental Interactive HTML (MANDATORY)
1267
-
1268
- > **After each module is specified, deploy/update the interactive HTML document with all available data.**
1269
- > This allows the client to review completed modules while the next module is being specified.
1270
- > The HTML is incrementally enriched: after module 1, only module 1 specs appear; after module 2, both appear; etc.
1271
-
1272
- **Source:** `html/ba-interactive.html` (relative to skill root = `~/.claude/skills/business-analyse/html/`)
1273
-
1274
- **Destination:** `docs/business/{app}/business-analyse/v{version}/ba-interactive.html`
1275
-
1276
- **Steps:**
1277
-
1278
- 1. **Read sources:**
1279
- - Read the HTML template from skill directory
1280
- - Read the master feature.json (application level — now updated with current module status)
1281
- - Read EACH completed module's feature.json (including the one just specified)
1282
-
1283
- 2. **Build FEATURE_DATA object:**
1284
-
1285
- > **Use the EXACT SAME mapping defined in step-05-handoff.md section 9d.**
1286
- > The mapping is identical — the only difference is that `moduleSpecs` only includes completed modules.
1287
- > Modules not yet specified will NOT appear in `moduleSpecs` (their entry in `modules[]` will show `status: "pending"`).
1288
-
1289
- Follow step-05 section 9d "Step 2: Build FEATURE_DATA object" for the complete mapping pseudocode:
1290
- - `metadata`, `cadrage`, `modules[]`, `dependencies[]` → from master feature.json
1291
- - `moduleSpecs[moduleCode]` → only for modules with status "specified" (completed so far)
1292
- - `consolidation` → empty `{ interactions: [], e2eFlows: [] }` (not yet consolidated)
1293
- - `handoff` → empty `{}` (not yet handed off)
1294
-
1295
- 3. **Replace placeholders in template:**
1296
- - Serialize the FEATURE_DATA object as JSON (2-space indentation)
1297
- - Replace `{{FEATURE_DATA}}` with the serialized JSON
1298
- - Replace `{{APPLICATION_NAME}}` → `{application_name}`
1299
- - Replace `{{APPLICATION_ID}}` → `{feature_id}`
1300
- - Replace `{{VERSION}}` → `{version}`
1301
- - Replace `{{CREATED_AT}}` → `{ISO timestamp}`
1302
-
1303
- 4. **Write and confirm:**
1304
-
1305
- ```
1306
- ✓ Interactive HTML updated (incremental):
1307
- Path: docs/business/{app}/business-analyse/v{version}/ba-interactive.html
1308
- Modules included: {completedModules.length}/{totalModules} specified
1309
- - {completedModule1}: {uc_count} UCs, {br_count} BRs, {entity_count} entities
1310
- - {completedModule2}: ...
1311
- Remaining: {pendingModules.join(', ')} (will be added after specification)
1312
- → Client can open in browser to review completed modules now.
1313
- ```
1314
-
1315
- > **WHY incremental?** The client doesn't have to wait until handoff to start reviewing.
1316
- > While module 2 is being specified, the client can already give feedback on module 1.
1317
- > Each incremental deployment OVERWRITES the previous HTML (latest state always).
1318
- > The FINAL deployment at step-05 (handoff) will include consolidation and handoff data.
1319
-
1320
- ---
1321
-
1322
- ### 12. Loop Decision
1323
-
1324
- ```
1325
- ba-writer.advanceModuleLoop({feature_id})
1326
- → Increments currentModuleIndex
1327
- → Updates completedModules
1328
- → Updates currentModule
1329
-
1330
- IF currentModuleIndex < moduleOrder.length:
1331
- Display: "→ Module suivant: {nextModule} ({currentModuleIndex + 1}/{total})"
1332
- Load: steps/step-03-specify.md (RE-ENTER this step)
1333
-
1334
- IF currentModuleIndex >= moduleOrder.length:
1335
- Display: "═══ Tous les modules spécifiés! Passage à la consolidation... ═══"
1336
- ba-writer.updateStatus({feature_id}, "specified")
1337
- Load: steps/step-04-consolidation.md
1338
- ```
1339
-
1340
- ---
1341
-
1342
- ## SINGLE-MODULE MODE
1343
-
1344
- When only 1 module in moduleOrder:
1345
-
1346
- - Same full specification flow
1347
- - Skip cross-module references (section 5)
1348
- - After validation → direct to step-04-consolidation.md (auto-consolidation)
1349
-
1350
- ---
1351
-
1352
- ## RESUME SUPPORT
1353
-
1354
- IF the step is resumed (e.g., after interruption):
1355
-
1356
- ```
1357
- Read metadata.workflow.currentModuleIndex
1358
- Read metadata.workflow.currentModule
1359
- → Resume at the correct module
1360
- → If module has partial data, show what exists and continue from there
1361
- ```
1362
-
1363
- ---
1364
-
1365
- ## CONTEXT MANAGEMENT
1366
-
1367
- | Loaded | Not Loaded |
1368
- |--------|------------|
1369
- | _shared.md | Other module feature.json (full) |
1370
- | feature-schema.json | Questionnaires not needed |
1371
- | Questionnaires for this module | Templates |
1372
- | Completed modules summary (100 lines max) | React viewer files |
1373
-
1374
- ---
1375
-
1376
- ## STATE VARIABLES
1377
-
1378
- | Variable | Description |
1379
- |----------|-------------|
1380
- | `{currentModule}` | Current module being specified |
1381
- | `{currentModuleIndex}` | Index in moduleOrder |
1382
- | `{completedModules}` | Array of already specified module codes |
1383
- | `{module_feature_id}` | Feature ID for the module-level feature.json |
1384
-
1385
807
  ---
1386
808
 
1387
- ## SUCCESS METRICS
809
+ ## SELF-VERIFICATION (MANDATORY before loading step-03b)
1388
810
 
1389
- - All sections walked through with client
1390
- - ASCII mockups generated and validated for EVERY section (1 wireframe per section minimum)
1391
- - Entities defined with business attributes
1392
- - Business rules extracted and categorized
1393
- - Per-module validation PASS
1394
- - Client confirmed module specification
1395
- - Module feature.json written
1396
- - Master updated with module status
1397
- - **Interactive HTML deployed/updated with completed module data (incremental)**
1398
- - Loop advanced correctly
811
+ Before proceeding to step-03b-compile.md, VERIFY:
1399
812
 
1400
- ## FAILURE MODES
813
+ 1. **Module feature.json exists** at expected path (`docs/business/{app}/{module}/business-analyse/v{X.Y}/feature.json`)
814
+ 2. **Module feature.json has analysis section** with `entities[]` (at least 1) and `businessRules[]` (at least 1)
815
+ 3. **Module status in master** = "in-progress" (set by section 2 above)
816
+ 4. **Master modules[].featureJsonPath** for this module ≠ null (set by ba-writer.create)
1401
817
 
1402
- - Validation FAILoffer auto-correct / manual revise / force
1403
- - Client rejects → revise specific sections
1404
- - Cross-module reference error → clarify with client
1405
- - Interruption → resumable via workflow state
818
+ **IF any check fails FIX before proceeding.** Do NOT load step-03b with incomplete data.
1406
819
 
1407
820
  ---
1408
821
 
1409
822
  ## NEXT STEP
1410
823
 
1411
- Conditional:
1412
-
1413
- - IF modules remaining → Re-load `./step-03-specify.md`
1414
- - IF all modules done → Load `./step-04-consolidation.md`
824
+ Load: `steps/step-03b-compile.md`