@atlashub/smartstack-cli 2.9.0 → 3.1.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 (90) hide show
  1. package/.documentation/agents.html +1 -371
  2. package/.documentation/business-analyse.html +81 -17
  3. package/.documentation/cli-commands.html +1 -1
  4. package/.documentation/commands.html +1 -1
  5. package/.documentation/efcore.html +1 -1
  6. package/.documentation/gitflow.html +1 -1
  7. package/.documentation/hooks.html +27 -66
  8. package/.documentation/index.html +166 -166
  9. package/.documentation/init.html +6 -7
  10. package/.documentation/installation.html +1 -1
  11. package/.documentation/ralph-loop.html +1 -9
  12. package/.documentation/test-web.html +15 -39
  13. package/dist/index.js +23 -16
  14. package/dist/index.js.map +1 -1
  15. package/dist/mcp-entry.mjs +1302 -223
  16. package/dist/mcp-entry.mjs.map +1 -1
  17. package/package.json +1 -1
  18. package/templates/agents/efcore/db-deploy.md +1 -1
  19. package/templates/agents/efcore/migration.md +26 -10
  20. package/templates/agents/efcore/rebase-snapshot.md +24 -7
  21. package/templates/agents/efcore/squash.md +73 -57
  22. package/templates/agents/gitflow/commit.md +138 -18
  23. package/templates/agents/gitflow/exec.md +1 -1
  24. package/templates/agents/gitflow/finish.md +79 -62
  25. package/templates/agents/gitflow/init-clone.md +186 -0
  26. package/templates/agents/gitflow/init-detect.md +137 -0
  27. package/templates/agents/gitflow/init-validate.md +210 -0
  28. package/templates/agents/gitflow/init.md +231 -74
  29. package/templates/agents/gitflow/merge.md +115 -33
  30. package/templates/agents/gitflow/pr.md +151 -46
  31. package/templates/agents/gitflow/start.md +76 -33
  32. package/templates/agents/gitflow/status.md +41 -71
  33. package/templates/hooks/appsettings-guard.sh +76 -0
  34. package/templates/hooks/ef-migration-check.md +1 -1
  35. package/templates/hooks/hooks.json +9 -0
  36. package/templates/project/appsettings.json.template +8 -2
  37. package/templates/project/test-frontend/msw/handlers.ts +58 -0
  38. package/templates/project/test-frontend/msw/server.ts +25 -0
  39. package/templates/project/test-frontend/setup.ts +16 -0
  40. package/templates/project/test-frontend/test-utils.tsx +59 -0
  41. package/templates/project/test-frontend/vitest.config.ts +31 -0
  42. package/templates/skills/_resources/config-safety.md +61 -0
  43. package/templates/skills/_resources/formatting-guide.md +2 -2
  44. package/templates/skills/application/SKILL.md +12 -3
  45. package/templates/skills/application/steps/step-04-backend.md +21 -0
  46. package/templates/skills/application/steps/step-07-tests.md +259 -120
  47. package/templates/skills/business-analyse/SKILL.md +57 -28
  48. package/templates/skills/business-analyse/_shared.md +70 -39
  49. package/templates/skills/business-analyse/html/ba-interactive.html +2596 -0
  50. package/templates/skills/business-analyse/questionnaire/00-application.md +123 -131
  51. package/templates/skills/business-analyse/questionnaire/01-context.md +173 -24
  52. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +170 -50
  53. package/templates/skills/business-analyse/questionnaire/03-scope.md +154 -48
  54. package/templates/skills/business-analyse/questionnaire/10-documentation.md +1 -1
  55. package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +135 -0
  56. package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +136 -0
  57. package/templates/skills/business-analyse/questionnaire.md +55 -46
  58. package/templates/skills/business-analyse/steps/step-00-init.md +24 -2
  59. package/templates/skills/business-analyse/steps/step-01-cadrage.md +31 -20
  60. package/templates/skills/business-analyse/steps/step-03-specify.md +58 -0
  61. package/templates/skills/business-analyse/steps/step-05-handoff.md +301 -1
  62. package/templates/skills/business-analyse/steps/step-06-extract.md +518 -0
  63. package/templates/skills/check-version/SKILL.md +1 -1
  64. package/templates/skills/efcore/steps/db/step-deploy.md +22 -3
  65. package/templates/skills/efcore/steps/db/step-reset.md +27 -4
  66. package/templates/skills/efcore/steps/db/step-seed.md +46 -2
  67. package/templates/skills/efcore/steps/db/step-status.md +14 -0
  68. package/templates/skills/efcore/steps/migration/step-01-check.md +31 -5
  69. package/templates/skills/efcore/steps/migration/step-02-create.md +20 -4
  70. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +60 -0
  71. package/templates/skills/efcore/steps/shared/step-00-init.md +47 -8
  72. package/templates/skills/efcore/steps/squash/step-03-create.md +27 -5
  73. package/templates/skills/gitflow/SKILL.md +91 -29
  74. package/templates/skills/gitflow/_shared.md +144 -2
  75. package/templates/skills/gitflow/phases/status.md +11 -1
  76. package/templates/skills/gitflow/steps/step-commit.md +1 -1
  77. package/templates/skills/gitflow/steps/step-init.md +202 -39
  78. package/templates/skills/gitflow/steps/step-pr.md +17 -5
  79. package/templates/skills/gitflow/templates/config.json +10 -1
  80. package/templates/skills/ralph-loop/SKILL.md +22 -15
  81. package/templates/skills/ralph-loop/steps/step-01-task.md +89 -4
  82. package/templates/skills/ralph-loop/steps/step-02-execute.md +408 -23
  83. package/templates/skills/ralph-loop/steps/step-03-commit.md +84 -2
  84. package/templates/skills/ralph-loop/steps/step-04-check.md +235 -6
  85. package/templates/skills/ralph-loop/steps/step-05-report.md +115 -0
  86. package/templates/skills/validate-feature/SKILL.md +83 -0
  87. package/templates/skills/validate-feature/steps/step-01-compile.md +38 -0
  88. package/templates/skills/validate-feature/steps/step-02-unit-tests.md +45 -0
  89. package/templates/skills/validate-feature/steps/step-03-integration-tests.md +53 -0
  90. package/templates/skills/validate-feature/steps/step-04-api-smoke.md +157 -0
@@ -915,6 +915,296 @@ Status journey: analyze → consolidate → **handed-off**
915
915
 
916
916
  ---
917
917
 
918
+ ### 9d. Deploy Interactive HTML Document (MANDATORY)
919
+
920
+ > **The interactive HTML document is deployed to the project PRE-POPULATED with ALL analysis data.**
921
+ > The client opens it in a browser and sees the complete analysis (cadrage, modules, entities, UCs, BRs, wireframes, permissions, consolidation).
922
+ > The client can then review, edit, enrich, and export modifications as JSON.
923
+ > That JSON can be re-imported via `/business-analyse -x` to update the feature.json.
924
+
925
+ **Source:** `html/ba-interactive.html` (relative to skill root = `~/.claude/skills/business-analyse/html/`)
926
+
927
+ **Destination:** `docs/business/{app}/business-analyse/v{version}/ba-interactive.html`
928
+
929
+ **Deployment steps:**
930
+
931
+ #### Step 1: Read source data
932
+
933
+ 1. Read the HTML template from skill directory
934
+ 2. Read the master feature.json (application level)
935
+ 3. Read EACH module feature.json (module level)
936
+
937
+ #### Step 2: Build FEATURE_DATA object
938
+
939
+ > **CRITICAL:** The HTML `data` object MUST be pre-populated with ALL analysis data.
940
+ > An empty data object is a **BUG** — the client would see a blank page.
941
+
942
+ Build a JSON object following this **exact mapping** from feature.json to the HTML data model:
943
+
944
+ ```javascript
945
+ {
946
+ metadata: {
947
+ applicationName: master.metadata.application, // e.g. "RH"
948
+ applicationId: master.id, // e.g. "FEAT-001"
949
+ version: master.version, // e.g. "1.0"
950
+ createdAt: master.metadata.createdAt,
951
+ lastModified: master.metadata.updatedAt
952
+ },
953
+ cadrage: {
954
+ problem: {
955
+ description: master.cadrage.problem, // string → problem.description
956
+ trigger: master.cadrage.trigger, // string → problem.trigger
957
+ impactedPeople: "", // not in feature.json, client fills
958
+ history: "",
959
+ consequences: ""
960
+ },
961
+ current: {
962
+ tools: master.cadrage.asIs, // string → current.tools
963
+ steps: [], // client can add process steps
964
+ painPoints: master.cadrage.stakeholders
965
+ .flatMap(s => s.painPoints || []).join("\n"), // aggregate all painPoints
966
+ errors: ""
967
+ },
968
+ vision: {
969
+ changes: master.cadrage.toBe, // string → vision.changes
970
+ results: master.cadrage.acceptanceCriteria
971
+ .map(ac => ac.criterion).join("\n"), // AC → results (one per line)
972
+ successSign: ""
973
+ },
974
+ stakeholders: master.cadrage.stakeholders.map(s => ({
975
+ role: s.role,
976
+ function: s.function || "",
977
+ tasks: s.tasks || [],
978
+ frequency: mapFrequency(s.frequency), // "Quotidien"→"daily", etc.
979
+ access: mapAccess(s.involvement), // "decision-maker"→"admin", "end-user"→"contributor"
980
+ frustrations: (s.painPoints || []).join("\n")
981
+ })),
982
+ scope: {
983
+ vital: (master.cadrage.globalScope.mustHave || [])
984
+ .map(item => ({ name: item, description: "" })), // string[] → {name,description}[]
985
+ important: (master.cadrage.globalScope.shouldHave || [])
986
+ .map(item => ({ name: item, description: "" })),
987
+ optional: (master.cadrage.globalScope.couldHave || [])
988
+ .map(item => ({ name: item, description: "" })),
989
+ excluded: (master.cadrage.globalScope.outOfScope || [])
990
+ .map(item => ({ name: item, description: "" }))
991
+ },
992
+ risks: (master.cadrage.risks || []).map(r => ({
993
+ description: r.description,
994
+ probability: r.probability, // "high" | "medium" | "low"
995
+ impact: r.impact,
996
+ mitigation: r.mitigation || ""
997
+ })),
998
+ assumptions: "",
999
+ success: {
1000
+ definition: (master.cadrage.acceptanceCriteria || [])
1001
+ .map(ac => ac.criterion).join("\n"),
1002
+ metrics: "",
1003
+ timeline: "",
1004
+ minimumConditions: ""
1005
+ }
1006
+ },
1007
+ modules: master.modules.map(m => ({
1008
+ code: m.code,
1009
+ name: m.code, // module code as name
1010
+ description: m.description || "",
1011
+ featureType: m.featureType || "data-centric",
1012
+ priority: m.priority || "must",
1013
+ entities: m.entities || [],
1014
+ status: m.status || "handed-off"
1015
+ })),
1016
+ dependencies: (master.dependencyGraph?.edges || []).map(e => ({
1017
+ from: e.from,
1018
+ to: e.to,
1019
+ description: e.description || ""
1020
+ })),
1021
+ moduleSpecs: {
1022
+ // FOR EACH module: read module feature.json, then map:
1023
+ // [moduleCode]: { useCases, businessRules, entities, permissions, notes, mockupNotes }
1024
+ },
1025
+ consolidation: {
1026
+ interactions: (master.consolidation?.crossModuleInteractions || []).map(i => ({
1027
+ from: i.fromModule,
1028
+ to: i.toModule,
1029
+ description: i.description || ""
1030
+ })),
1031
+ e2eFlows: (master.consolidation?.e2eFlows || []).map(f => ({
1032
+ name: f.name,
1033
+ steps: (f.steps || []).map(s => ({ module: s.module, action: s.action })),
1034
+ actors: (f.steps || []).map(s => s.permission).join(", ")
1035
+ }))
1036
+ },
1037
+ handoff: master.handoff || {}
1038
+ }
1039
+ ```
1040
+
1041
+ **Module specs mapping** — for EACH module in `master.modules[]`:
1042
+
1043
+ 1. Read the module feature.json at `master.modules[i].featureJsonPath`
1044
+ 2. Map to `moduleSpecs[moduleCode]`:
1045
+
1046
+ ```javascript
1047
+ moduleSpecs[moduleCode] = {
1048
+ useCases: (moduleFeature.specification?.useCases || []).map(uc => ({
1049
+ name: uc.name,
1050
+ actor: uc.primaryActor,
1051
+ steps: (uc.mainScenario || []).join("\n"), // array → newline-separated string
1052
+ alternative: (uc.alternativeScenarios || [])
1053
+ .map(a => a.name + ": " + (a.steps || []).join(", ")).join("\n")
1054
+ })),
1055
+ businessRules: (moduleFeature.analysis?.businessRules || []).map(br => ({
1056
+ name: br.name,
1057
+ category: br.category, // "validation"|"calculation"|"workflow"|"security"|"data"
1058
+ statement: br.statement,
1059
+ example: (br.examples || []).map(e => e.input + " → " + e.expected).join("; ")
1060
+ })),
1061
+ entities: (moduleFeature.analysis?.entities || []).map(ent => ({
1062
+ name: ent.name,
1063
+ description: ent.description || "",
1064
+ attributes: (ent.attributes || []).map(a => ({
1065
+ name: a.name,
1066
+ description: a.description || ""
1067
+ })),
1068
+ relationships: (ent.relationships || []).map(r =>
1069
+ r.target + " (" + r.type + ") - " + (r.description || "")
1070
+ )
1071
+ })),
1072
+ permissions: buildPermissionKeys(moduleFeature), // see below
1073
+ notes: "",
1074
+ mockupNotes: (moduleFeature.specification?.uiWireframes || [])
1075
+ .map(w => "[" + w.screen + "]\n" + w.mockup).join("\n\n")
1076
+ }
1077
+ ```
1078
+
1079
+ **Permission keys** — the HTML uses `"Role|Action"` format (e.g. `"RH Admin|Consulter"`):
1080
+
1081
+ ```javascript
1082
+ function buildPermissionKeys(moduleFeature) {
1083
+ const keys = [];
1084
+ const matrix = moduleFeature.specification?.permissionMatrix;
1085
+ if (!matrix) return keys;
1086
+ const actionMap = { read: "Consulter", create: "Creer", update: "Modifier",
1087
+ delete: "Supprimer", validate: "Valider", export: "Exporter",
1088
+ submit: "Valider", import: "Creer" };
1089
+ (matrix.roleAssignments || []).forEach(ra => {
1090
+ (ra.permissions || []).forEach(permPath => {
1091
+ const action = permPath.split(".").pop(); // last segment = action
1092
+ const uiAction = actionMap[action] || action;
1093
+ keys.push(ra.role + "|" + uiAction);
1094
+ });
1095
+ });
1096
+ return keys;
1097
+ }
1098
+ ```
1099
+
1100
+ **Frequency mapping:**
1101
+ ```
1102
+ "Quotidien" → "daily", "Hebdomadaire" → "weekly", "Mensuel" → "monthly"
1103
+ Default: "daily"
1104
+ ```
1105
+
1106
+ **Access mapping (involvement → access):**
1107
+ ```
1108
+ "decision-maker" → "admin", "end-user" with manager-like tasks → "manager"
1109
+ "end-user" → "contributor", "observer" → "viewer"
1110
+ Default: "contributor"
1111
+ ```
1112
+
1113
+ #### Step 3: Replace placeholders in template
1114
+
1115
+ 1. Serialize the FEATURE_DATA object as JSON (with 2-space indentation for readability)
1116
+ 2. Replace `{{FEATURE_DATA}}` with the serialized JSON
1117
+ 3. Replace `{{APPLICATION_NAME}}` → `{application_name}` (still used in `<title>` and header)
1118
+ 4. Replace `{{APPLICATION_ID}}` → `{feature_id}` (still used in `APP_KEY`)
1119
+ 5. Replace `{{VERSION}}` → `{version}`
1120
+ 6. Replace `{{CREATED_AT}}` → `{ISO timestamp}`
1121
+
1122
+ > **NOTE:** `{{APPLICATION_NAME}}`, `{{APPLICATION_ID}}`, `{{VERSION}}`, `{{CREATED_AT}}` still appear
1123
+ > in the HTML body (`<title>`, header, `APP_KEY`). They MUST be replaced separately from FEATURE_DATA.
1124
+
1125
+ #### Step 4: Write and confirm
1126
+
1127
+ 1. Write the populated HTML to the output directory
1128
+ 2. Display deployment confirmation:
1129
+
1130
+ ```
1131
+ ✓ Interactive HTML deployed:
1132
+ Path: docs/business/{app}/business-analyse/v{version}/ba-interactive.html
1133
+ Pre-populated with: {stakeholder_count} stakeholders, {module_count} modules,
1134
+ {total_uc} use cases, {total_br} business rules, {total_entity} entities
1135
+ Open in browser to review and edit the business analysis.
1136
+ Export JSON and re-import with: /business-analyse -x <exported-json-path>
1137
+ ```
1138
+
1139
+ **Why a FINAL deployment at handoff?**
1140
+ - Step 03 already deploys the HTML incrementally after each module (partial data)
1141
+ - This final deployment adds the COMPLETE data: all modules + consolidation + handoff info
1142
+ - The client sees the FULL analysis pre-populated — including cross-module interactions and E2E flows
1143
+ - The client can review, edit, and enrich directly in the browser
1144
+ - Any client modifications can be re-imported via `-x` extraction mode
1145
+ - The HTML is standalone (no server required) with localStorage persistence
1146
+ - On first open: pre-populated data displays. After client edits: localStorage overrides
1147
+ - **NOTE:** This overwrites the incremental HTML from step-03 with the complete version
1148
+
1149
+ ---
1150
+
1151
+ ### 9e. Update BA Manifest (MANDATORY)
1152
+
1153
+ > **The BA manifest enables the SmartStack web app to discover and display all available business analyses.**
1154
+ > It is a JSON index file at `docs/business/index.json` that lists all feature.json files.
1155
+
1156
+ **Path:** `docs/business/index.json` (project root relative)
1157
+
1158
+ **Schema:**
1159
+ ```json
1160
+ {
1161
+ "version": "1.0",
1162
+ "updatedAt": "{ISO timestamp}",
1163
+ "analyses": [
1164
+ {
1165
+ "appCode": "{app_code}",
1166
+ "appName": "{application_name}",
1167
+ "moduleCode": null | "{module_code}",
1168
+ "moduleName": "{module_name}",
1169
+ "version": "{version}",
1170
+ "status": "handed-off",
1171
+ "featureDescription": "{feature_description}",
1172
+ "path": "{app_code}/business-analyse/v{version}/feature.json",
1173
+ "updatedAt": "{ISO timestamp}"
1174
+ }
1175
+ ]
1176
+ }
1177
+ ```
1178
+
1179
+ **Update logic:**
1180
+
1181
+ 1. Read existing manifest at `docs/business/index.json` (or create empty `{ "version": "1.0", "updatedAt": "", "analyses": [] }`)
1182
+ 2. For the APPLICATION-level feature.json:
1183
+ - Find existing entry where `appCode == {app_code}` AND `moduleCode == null` AND `version == {version}`
1184
+ - If found: update `status`, `updatedAt`, `featureDescription`
1185
+ - If not found: append new entry with `moduleCode: null` and `path: "{app_code}/business-analyse/v{version}/feature.json"`
1186
+ 3. For EACH MODULE-level feature.json:
1187
+ - Find existing entry where `appCode == {app_code}` AND `moduleCode == {module_code}` AND `version == {version}`
1188
+ - If found: update `status`, `updatedAt`, `featureDescription`
1189
+ - If not found: append new entry with `moduleCode: "{module_code}"` and `path: "{app_code}/{module_code}/business-analyse/v{version}/feature.json"`
1190
+ 4. Update root `updatedAt` to current timestamp
1191
+ 5. Write manifest back to `docs/business/index.json`
1192
+
1193
+ **Display confirmation:**
1194
+ ```
1195
+ ✓ BA manifest updated: docs/business/index.json
1196
+ Entries: {total_count} ({app_count} applications, {module_count} modules)
1197
+ Web viewer: /system/docs/ba
1198
+ ```
1199
+
1200
+ **Why a manifest?**
1201
+ - The web app needs to discover available BAs without scanning the filesystem
1202
+ - Static file serving (no backend API needed)
1203
+ - Incremental updates: each handoff adds/updates only its entries
1204
+ - Consumed by the SmartStack web app BA viewer at `/system/docs/ba`
1205
+
1206
+ ---
1207
+
918
1208
  ### 10. User Choice: Next Agent
919
1209
 
920
1210
  Present development options after successful handoff:
@@ -935,6 +1225,7 @@ Generated Artifacts:
935
1225
  ✓ feature.json (master + per-module) - enhanced with handoff section
936
1226
  ✓ .ralph/prd.json or .ralph/prd-{module}.json - derived from feature.json
937
1227
  ✓ .ralph/progress.txt - comprehensive task tracker
1228
+ ✓ ba-interactive.html - client-facing interactive review document
938
1229
  ✓ Implementation strategy selected: {strategy}
939
1230
 
940
1231
  Next: Choose development approach
@@ -1003,7 +1294,14 @@ This step enriches **feature.json** (master + per-module) with:
1003
1294
  - **handoff** section: complexity, implementationStrategy, moduleOrder, filesToCreate (7 categories), brToCodeMapping, apiEndpointSummary, prdFiles
1004
1295
  - **status:** "handed-off"
1005
1296
 
1006
- Also generates two working files:
1297
+ Also generates working files and updates the manifest:
1298
+
1299
+ - **ba-interactive.html** (deployed to docs/business/{app}/business-analyse/v{version}/)
1300
+ - Standalone interactive HTML document for client review
1301
+ - Pre-populated with application name, ID, version
1302
+ - Client can edit, add use cases, modify scope, and export JSON
1303
+ - Re-importable via `/business-analyse -x <exported-json-path>`
1304
+
1007
1305
  - **.ralph/prd.json** (or .ralph/prd-{module}.json per module structure)
1008
1306
  - Derived entirely from feature.json
1009
1307
  - Single source of truth for development team
@@ -1092,6 +1390,8 @@ Before presenting handoff to user:
1092
1390
  - [ ] feature.json updated: handoff section + status "handed-off"
1093
1391
  - [ ] All paths use project namespace from .smartstack/config.json
1094
1392
  - [ ] No invented requirements (everything traced to feature.json)
1393
+ - [ ] ba-interactive.html deployed PRE-POPULATED with all analysis data (not empty)
1394
+ - [ ] BA manifest (docs/business/index.json) updated with current analysis entries
1095
1395
  - [ ] User ready for next agent selection
1096
1396
 
1097
1397
  ---