@atlashub/smartstack-cli 4.18.0 → 4.20.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 (164) hide show
  1. package/package.json +1 -1
  2. package/templates/agents/ba-reader.md +86 -80
  3. package/templates/agents/ba-writer.md +318 -415
  4. package/templates/agents/docs-context-reader.md +3 -3
  5. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +133 -0
  6. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +126 -0
  7. package/templates/skills/apex/SKILL.md +29 -16
  8. package/templates/skills/apex/_shared.md +62 -9
  9. package/templates/skills/apex/references/analysis-methods.md +8 -6
  10. package/templates/skills/apex/references/challenge-questions.md +5 -5
  11. package/templates/skills/apex/references/core-seed-data.md +68 -45
  12. package/templates/skills/apex/references/frontend-route-wiring-app-tsx.md +26 -21
  13. package/templates/skills/apex/references/parallel-execution.md +156 -0
  14. package/templates/skills/apex/references/person-extension-pattern.md +12 -12
  15. package/templates/skills/apex/references/post-checks.md +1748 -1726
  16. package/templates/skills/apex/references/smartstack-api.md +63 -57
  17. package/templates/skills/apex/references/smartstack-frontend-compliance.md +594 -0
  18. package/templates/skills/apex/references/smartstack-frontend.md +1246 -1842
  19. package/templates/skills/apex/references/smartstack-layers.md +98 -145
  20. package/templates/skills/apex/steps/step-00-init.md +30 -6
  21. package/templates/skills/apex/steps/step-01-analyze.md +27 -23
  22. package/templates/skills/apex/steps/step-02-plan.md +12 -12
  23. package/templates/skills/apex/steps/step-03-execute.md +198 -143
  24. package/templates/skills/apex/steps/step-04-examine.md +24 -93
  25. package/templates/skills/apex/steps/step-05-deep-review.md +16 -16
  26. package/templates/skills/apex/steps/step-06-resolve.md +9 -9
  27. package/templates/skills/apex/steps/step-07-tests.md +3 -1
  28. package/templates/skills/apex/steps/step-08-run-tests.md +1 -1
  29. package/templates/skills/business-analyse/SKILL.md +182 -301
  30. package/templates/skills/business-analyse/_shared.md +119 -336
  31. package/templates/skills/business-analyse/html/ba-interactive.html +706 -85
  32. package/templates/skills/business-analyse/html/build-html.js +41 -3
  33. package/templates/skills/business-analyse/html/src/partials/cadrage-context.html +34 -0
  34. package/templates/skills/business-analyse/html/src/partials/cadrage-risks.html +48 -0
  35. package/templates/skills/business-analyse/html/src/partials/cadrage-scope.html +49 -0
  36. package/templates/skills/business-analyse/html/src/partials/cadrage-stakeholders.html +55 -0
  37. package/templates/skills/business-analyse/html/src/partials/cadrage-success.html +34 -0
  38. package/templates/skills/business-analyse/html/src/partials/consol-datamodel.html +8 -0
  39. package/templates/skills/business-analyse/html/src/partials/consol-flows.html +29 -0
  40. package/templates/skills/business-analyse/html/src/partials/consol-interactions.html +8 -0
  41. package/templates/skills/business-analyse/html/src/partials/consol-permissions.html +8 -0
  42. package/templates/skills/business-analyse/html/src/partials/decomp-dependencies.html +38 -0
  43. package/templates/skills/business-analyse/html/src/partials/decomp-modules.html +51 -0
  44. package/templates/skills/business-analyse/html/src/partials/handoff-summary.html +24 -0
  45. package/templates/skills/business-analyse/html/src/partials/module-spec-container.html +4 -0
  46. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +17 -1
  47. package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +32 -6
  48. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +100 -63
  49. package/templates/skills/business-analyse/html/src/scripts/06-render-mockups.js +372 -0
  50. package/templates/skills/business-analyse/html/src/scripts/07-render-handoff.js +1 -1
  51. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +41 -13
  52. package/templates/skills/business-analyse/html/src/styles/09-mockups-html.css +136 -0
  53. package/templates/skills/business-analyse/html/src/template.html +1 -1
  54. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +7 -5
  55. package/templates/skills/business-analyse/questionnaire/01-context.md +11 -157
  56. package/templates/skills/business-analyse/questionnaire/02-stakeholders-scope.md +101 -0
  57. package/templates/skills/business-analyse/questionnaire/03-data-ui.md +92 -0
  58. package/templates/skills/business-analyse/questionnaire/04-risks-metrics.md +6 -0
  59. package/templates/skills/business-analyse/questionnaire/05-cross-module.md +69 -0
  60. package/templates/skills/business-analyse/questionnaire.md +22 -280
  61. package/templates/skills/business-analyse/react/application-viewer.md +2 -2
  62. package/templates/skills/business-analyse/react/components.md +4 -4
  63. package/templates/skills/business-analyse/react/i18n-template.md +1 -1
  64. package/templates/skills/business-analyse/react/schema.md +14 -14
  65. package/templates/skills/business-analyse/references/acceptance-criteria.md +21 -21
  66. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +3 -3
  67. package/templates/skills/business-analyse/references/compilation-structure-cards.md +1 -1
  68. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +5 -5
  69. package/templates/skills/business-analyse/references/deploy-data-build.md +12 -11
  70. package/templates/skills/business-analyse/references/deploy-modes.md +10 -10
  71. package/templates/skills/business-analyse/references/detection-strategies.md +6 -6
  72. package/templates/skills/business-analyse/references/html-data-mapping.md +15 -15
  73. package/templates/skills/business-analyse/references/naming-conventions.md +4 -4
  74. package/templates/skills/business-analyse/references/review-data-mapping.md +29 -29
  75. package/templates/skills/business-analyse/references/robustness-checks.md +36 -36
  76. package/templates/skills/business-analyse/references/spec-auto-inference.md +2 -2
  77. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  78. package/templates/skills/business-analyse/references/ui-resource-cards.md +1 -1
  79. package/templates/skills/business-analyse/references/validation-checklist.md +3 -3
  80. package/templates/skills/business-analyse/references/wireframe-svg-style-guide.md +2 -2
  81. package/templates/skills/business-analyse/schemas/application-schema.json +8 -8
  82. package/templates/skills/business-analyse/schemas/feature-schema.json +3 -3
  83. package/templates/skills/business-analyse/schemas/index-schema.json +47 -0
  84. package/templates/skills/business-analyse/schemas/project-schema.json +6 -6
  85. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  86. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +5 -3
  87. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +4 -4
  88. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  89. package/templates/skills/business-analyse/schemas/shared/common-defs.json +4 -4
  90. package/templates/skills/business-analyse/steps/step-00-init.md +68 -77
  91. package/templates/skills/business-analyse/steps/step-01-cadrage.md +50 -216
  92. package/templates/skills/business-analyse/steps/step-02-structure.md +175 -0
  93. package/templates/skills/business-analyse/steps/step-03-specify.md +198 -0
  94. package/templates/skills/business-analyse/steps/step-04-consolidate.md +478 -0
  95. package/templates/skills/business-analyse/steps/step-05-deploy.md +220 -0
  96. package/templates/skills/business-analyse/steps/step-06-review.md +51 -69
  97. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  98. package/templates/skills/business-analyse/templates/tpl-handoff.md +20 -17
  99. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +2 -2
  100. package/templates/skills/business-analyse/templates-react.md +2 -2
  101. package/templates/skills/derive-prd/SKILL.md +92 -0
  102. package/templates/skills/derive-prd/references/acceptance-criteria.md +169 -0
  103. package/templates/skills/derive-prd/references/entity-domain-mapping.md +115 -0
  104. package/templates/skills/{business-analyse → derive-prd}/references/handoff-file-templates.md +131 -120
  105. package/templates/skills/{business-analyse → derive-prd}/references/handoff-mappings.md +95 -95
  106. package/templates/skills/{business-analyse → derive-prd}/references/handoff-seeddata-generation.md +312 -312
  107. package/templates/skills/{business-analyse → derive-prd}/references/prd-generation.md +262 -263
  108. package/templates/skills/derive-prd/references/readiness-scoring.md +104 -0
  109. package/templates/skills/derive-prd/schemas/handoff-schema.json +95 -0
  110. package/templates/skills/derive-prd/steps/step-00-validate.md +130 -0
  111. package/templates/skills/derive-prd/steps/step-01-transform.md +206 -0
  112. package/templates/skills/derive-prd/steps/step-02-export.md +181 -0
  113. package/templates/skills/{business-analyse → derive-prd}/templates/tpl-progress.md +172 -172
  114. package/templates/skills/documentation/SKILL.md +7 -0
  115. package/templates/skills/ralph-loop/SKILL.md +2 -1
  116. package/templates/skills/ralph-loop/references/init-resume-recovery.md +1 -1
  117. package/templates/skills/ralph-loop/steps/step-01-task.md +2 -2
  118. package/templates/skills/apex/references/agent-teams-protocol.md +0 -203
  119. package/templates/skills/business-analyse/_architecture.md +0 -124
  120. package/templates/skills/business-analyse/_elicitation.md +0 -206
  121. package/templates/skills/business-analyse/_module-loop.md +0 -115
  122. package/templates/skills/business-analyse/_rules.md +0 -142
  123. package/templates/skills/business-analyse/_suggestions.md +0 -34
  124. package/templates/skills/business-analyse/questionnaire/00-application.md +0 -160
  125. package/templates/skills/business-analyse/questionnaire/00b-project.md +0 -85
  126. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +0 -189
  127. package/templates/skills/business-analyse/questionnaire/03-scope.md +0 -164
  128. package/templates/skills/business-analyse/questionnaire/04-data.md +0 -88
  129. package/templates/skills/business-analyse/questionnaire/05-integrations.md +0 -58
  130. package/templates/skills/business-analyse/questionnaire/06-security.md +0 -68
  131. package/templates/skills/business-analyse/questionnaire/07-ui.md +0 -76
  132. package/templates/skills/business-analyse/questionnaire/08-performance.md +0 -42
  133. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -45
  134. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -58
  135. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +0 -59
  136. package/templates/skills/business-analyse/questionnaire/12-migration.md +0 -58
  137. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +0 -69
  138. package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +0 -135
  139. package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +0 -136
  140. package/templates/skills/business-analyse/references/agent-module-prompt.md +0 -366
  141. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +0 -557
  142. package/templates/skills/business-analyse/references/cache-warming-strategy.md +0 -566
  143. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +0 -41
  144. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +0 -74
  145. package/templates/skills/business-analyse/references/cadrage-pre-analysis.md +0 -115
  146. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +0 -68
  147. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +0 -85
  148. package/templates/skills/business-analyse/references/team-orchestration.md +0 -1093
  149. package/templates/skills/business-analyse/references/validate-incremental-html.md +0 -121
  150. package/templates/skills/business-analyse/steps/step-01b-applications.md +0 -419
  151. package/templates/skills/business-analyse/steps/step-02-decomposition.md +0 -387
  152. package/templates/skills/business-analyse/steps/step-03a-data.md +0 -16
  153. package/templates/skills/business-analyse/steps/step-03a1-setup.md +0 -486
  154. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +0 -300
  155. package/templates/skills/business-analyse/steps/step-03b-ui.md +0 -405
  156. package/templates/skills/business-analyse/steps/step-03c-compile.md +0 -516
  157. package/templates/skills/business-analyse/steps/step-03d-validate.md +0 -691
  158. package/templates/skills/business-analyse/steps/step-04-consolidation.md +0 -17
  159. package/templates/skills/business-analyse/steps/step-04a-collect.md +0 -415
  160. package/templates/skills/business-analyse/steps/step-04b-analyze.md +0 -163
  161. package/templates/skills/business-analyse/steps/step-04c-decide.md +0 -186
  162. package/templates/skills/business-analyse/steps/step-05a-handoff.md +0 -937
  163. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -522
  164. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +0 -703
@@ -0,0 +1,95 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "handoff-schema.json",
4
+ "title": "SmartStack BA - Handoff",
5
+ "description": "Module-level handoff: file mapping (8 categories), BR-to-code mapping, API endpoint summary. Used by /derive-prd skill.",
6
+ "type": "object",
7
+ "properties": {
8
+ "complexity": { "type": "string", "enum": ["simple", "medium", "complex"] },
9
+ "filesToCreate": {
10
+ "type": "object",
11
+ "properties": {
12
+ "domain": { "type": "array", "items": { "$ref": "#/$defs/fileSpec" } },
13
+ "application": { "type": "array", "items": { "$ref": "#/$defs/fileSpec" } },
14
+ "infrastructure": { "type": "array", "items": { "$ref": "#/$defs/fileSpec" } },
15
+ "api": { "type": "array", "items": { "$ref": "#/$defs/fileSpec" } },
16
+ "frontend": { "type": "array", "items": { "$ref": "#/$defs/fileSpec" } },
17
+ "seedData": { "type": "array", "items": { "$ref": "#/$defs/fileSpec" } },
18
+ "tests": { "type": "array", "items": { "$ref": "#/$defs/fileSpec" } },
19
+ "documentation": { "type": "array", "items": { "$ref": "#/$defs/fileSpec" } }
20
+ },
21
+ "required": ["domain", "application", "infrastructure", "api", "frontend", "seedData", "tests", "documentation"]
22
+ },
23
+ "brToCodeMapping": {
24
+ "type": "array",
25
+ "description": "Maps each business rule to its implementation points across layers",
26
+ "items": {
27
+ "type": "object",
28
+ "required": ["ruleId", "implementationPoints"],
29
+ "properties": {
30
+ "ruleId": { "type": "string", "description": "BR-XXX identifier from analysis.businessRules" },
31
+ "title": { "type": "string" },
32
+ "implementationPoints": {
33
+ "type": "array",
34
+ "items": {
35
+ "type": "object",
36
+ "required": ["layer", "component"],
37
+ "properties": {
38
+ "layer": { "type": "string", "description": "Architecture layer (Domain, Application, Infrastructure, API, Frontend)" },
39
+ "component": { "type": "string", "description": "File name (e.g., Order.cs, OrdersController.cs)" },
40
+ "method": { "type": "string" },
41
+ "implementation": { "type": "string" }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ },
48
+ "apiEndpointSummary": {
49
+ "type": "array",
50
+ "description": "Subset of specification.apiEndpoints enriched with linkedUC. MUST use EXACT same routes as specification.",
51
+ "items": {
52
+ "type": "object",
53
+ "properties": {
54
+ "operation": { "type": "string" },
55
+ "method": { "type": "string", "enum": ["GET", "POST", "PUT", "DELETE", "PATCH"] },
56
+ "route": { "type": "string" },
57
+ "linkedUC": { "type": "string" },
58
+ "permissions": { "type": "string" }
59
+ }
60
+ }
61
+ },
62
+ "ralphPrd": {
63
+ "type": "object",
64
+ "description": "Embedded Ralph Loop task breakdown (also exported to .ralph/prd.json by ss derive-prd)",
65
+ "properties": {
66
+ "tasks": {
67
+ "type": "array",
68
+ "items": {
69
+ "type": "object",
70
+ "properties": {
71
+ "id": { "type": "integer" },
72
+ "description": { "type": "string" },
73
+ "category": { "type": "string", "enum": ["domain", "seedData", "seedDataCore", "application", "infrastructure", "api", "frontend", "i18n", "test", "validation"] },
74
+ "dependencies": { "type": "array", "items": { "type": "integer" } },
75
+ "acceptanceCriteria": { "type": "string" }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ },
82
+ "$defs": {
83
+ "fileSpec": {
84
+ "type": "object",
85
+ "required": ["path", "type", "module"],
86
+ "properties": {
87
+ "path": { "type": "string" },
88
+ "type": { "type": "string" },
89
+ "module": { "type": "string" },
90
+ "description": { "type": "string" },
91
+ "dependencies": { "type": "array", "items": { "type": "string" } }
92
+ }
93
+ }
94
+ }
95
+ }
@@ -0,0 +1,130 @@
1
+ ---
2
+ name: step-00-validate
3
+ description: Detect input, validate BA readiness, acceptance criteria gate
4
+ model: sonnet
5
+ next_step: steps/step-01-transform.md
6
+ ---
7
+
8
+ > **Context files:** `references/acceptance-criteria.md` | `references/readiness-scoring.md`
9
+
10
+ # Step 00: Validate BA Readiness
11
+
12
+ ## MANDATORY EXECUTION RULES
13
+
14
+ - **ALWAYS** verify status = "consolidated" for all modules before proceeding
15
+ - **ALWAYS** validate acceptance criteria (AC-01 to AC-17) per module
16
+ - **BLOCKING** if any module has readiness score < 100% on blocking ACs
17
+ - **NEVER** proceed to transform if any module fails readiness gate
18
+
19
+ ## YOUR TASK
20
+
21
+ Detect the BA feature input, verify all modules are consolidated, validate acceptance criteria as a pre-gate, calculate readiness scores, and display the readiness table.
22
+
23
+ ---
24
+
25
+ ## EXECUTION SEQUENCE
26
+
27
+ ### 1. Detect Input
28
+
29
+ ```
30
+ IF --feature <path> provided:
31
+ featurePath = <path>
32
+ ELSE:
33
+ // Auto-detect from docs/
34
+ Scan docs/ for index.json files with status = "consolidated"
35
+ IF found exactly 1:
36
+ featurePath = found path
37
+ ELSE IF found > 1:
38
+ Display list and ask user to specify --feature <path>
39
+ STOP
40
+ ELSE:
41
+ BLOCKING ERROR: "No consolidated BA feature found. Run /business-analyse first."
42
+ STOP
43
+ ```
44
+
45
+ ### 2. Load Feature & Verify Consolidation
46
+
47
+ ```
48
+ // Determine workflow mode
49
+ IF project-level index.json exists:
50
+ projectFeature = ba-reader.findProjectFeature()
51
+ FOR each app in projectFeature.applications:
52
+ appFeature = ba-reader.findFeature(app.featureJsonPath)
53
+ IF appFeature.status !== "consolidated":
54
+ BLOCKING ERROR: "Application {app.code} not consolidated (status: {appFeature.status})"
55
+ → Run /business-analyse step-04 first
56
+ feature = projectFeature
57
+ modules = projectFeature.applications.flatMap(app => app.modules)
58
+ ELSE:
59
+ feature = ba-reader.findFeature(featurePath)
60
+ IF feature.status !== "consolidated":
61
+ BLOCKING ERROR: "Feature status: {feature.status}, expected consolidated"
62
+ → Run /business-analyse step-04 first
63
+ modules = feature.modules
64
+ ```
65
+
66
+ ### 3. Validate Acceptance Criteria Per Module
67
+
68
+ For **EACH module**, run the acceptance criteria bash script from `references/acceptance-criteria.md`:
69
+
70
+ ```bash
71
+ MODULE_JSON="{module_feature_json_path}"
72
+ node -e "
73
+ const fs = require('fs');
74
+ const data = JSON.parse(fs.readFileSync(process.argv[1], 'utf-8'));
75
+ // ... (full AC-01 to AC-17 script from references/acceptance-criteria.md)
76
+ " "$MODULE_JSON"
77
+ ```
78
+
79
+ Collect results per module: PASS count, FAIL count, WARNING count.
80
+
81
+ ### 4. Calculate Readiness Score
82
+
83
+ > **Reference:** Read `references/readiness-scoring.md` for the full algorithm.
84
+
85
+ For each module:
86
+ - Count blocking ACs passed vs total blocking ACs
87
+ - Score = (blocking passed / blocking total) x 100
88
+ - Non-blocking score = (non-blocking passed / non-blocking total) x 100
89
+
90
+ ### 5. Apply Readiness Gate
91
+
92
+ ```
93
+ FOR each module:
94
+ IF readiness_score < 100%:
95
+ BLOCKING ERROR: "Module {moduleCode} readiness: {score}% — {failed_count} blocking ACs failed"
96
+ Display failed ACs with recovery actions
97
+ → Run /business-analyse to fix, then retry /derive-prd
98
+ STOP
99
+
100
+ IF non_blocking_score < 80%:
101
+ WARNING: "Module {moduleCode} non-blocking score: {score}% — consider fixing before handoff"
102
+ ```
103
+
104
+ ### 6. Display Readiness Table
105
+
106
+ ```
107
+ ══════════════════════════════════════════════════════════════
108
+ DERIVE-PRD — BA READINESS VALIDATION
109
+ ══════════════════════════════════════════════════════════════
110
+
111
+ Feature: {feature_name}
112
+ Applications: {app_count} (project mode only)
113
+ Modules: {module_count}
114
+
115
+ ┌──────────────┬──────────┬────────────┬──────────────┬────────┐
116
+ │ Module │ Status │ Blocking │ Non-blocking │ Ready │
117
+ ├──────────────┼──────────┼────────────┼──────────────┼────────┤
118
+ │ {module1} │ consol. │ 16/16 100% │ 1/1 100% │ YES │
119
+ │ {module2} │ consol. │ 16/16 100% │ 1/1 100% │ YES │
120
+ └──────────────┴──────────┴────────────┴──────────────┴────────┘
121
+
122
+ → All modules READY — proceeding to transform...
123
+ ══════════════════════════════════════════════════════════════
124
+ ```
125
+
126
+ ---
127
+
128
+ ## NEXT STEP
129
+
130
+ Load: `steps/step-01-transform.md`
@@ -0,0 +1,206 @@
1
+ ---
2
+ name: step-01-transform
3
+ description: Build handoff data per module - 8 categories with all gap fixes
4
+ model: sonnet
5
+ next_step: steps/step-02-export.md
6
+ ---
7
+
8
+ > **Context files:** `references/handoff-file-templates.md` | `references/handoff-mappings.md` | `references/handoff-seeddata-generation.md` | `references/entity-domain-mapping.md`
9
+
10
+ # Step 01: Transform (Handoff Data Generation)
11
+
12
+ ## MANDATORY EXECUTION RULES
13
+
14
+ - **ALWAYS** process modules in topological order (dependencies first)
15
+ - **ALWAYS** map to 8 categories (including "documentation")
16
+ - **ALWAYS** propagate personRoleConfig verbatim from analysis.entities[]
17
+ - **ALWAYS** separate seedData into core/business categories
18
+ - **ALWAYS** map entity to domain file path (1:1)
19
+ - **ALWAYS** include dependencies[] per file entry
20
+ - **NEVER** invent entities/FRs/BRs not in module JSON files
21
+ - **ALL** API routes from specification.apiEndpoints (exact copy)
22
+
23
+ ## YOUR TASK
24
+
25
+ For each module in topological order, build the complete handoff data with 8 file categories, BR-to-code mapping, API endpoint summary, and write to feature.json via ba-writer.
26
+
27
+ ---
28
+
29
+ ## EXECUTION SEQUENCE
30
+
31
+ For **EACH module** in topological order:
32
+
33
+ ### 1. Calculate Complexity
34
+
35
+ ```json
36
+ {
37
+ "complexity": "simple|medium|complex",
38
+ "complexityDetails": {
39
+ "entities": {count},
40
+ "useCases": {count},
41
+ "businessRules": {count},
42
+ "calculated": "{level} (entities<=X, UCs<=Y, BRs<=Z)"
43
+ }
44
+ }
45
+ ```
46
+
47
+ | Criteria | Simple | Medium | Complex |
48
+ |----------|--------|--------|---------|
49
+ | Entities | <=3 | <=6 | >6 |
50
+ | Use Cases | <=5 | <=12 | >12 |
51
+ | Business Rules | <=10 | <=20 | >20 |
52
+
53
+ **Global complexity** = highest across all modules.
54
+
55
+ ### 2. Map Specification to Files (8 Categories)
56
+
57
+ > **Reference:** Read `references/handoff-file-templates.md` for complete JSON templates.
58
+ > All backend paths MUST include `{ApplicationName}/` hierarchy.
59
+
60
+ | Category | Source | Key rules |
61
+ |----------|--------|-----------|
62
+ | **Domain** | `analysis.entities[]` | Entities, ValueObjects, Enums |
63
+ | **Application** | `analysis.useCases[]` | Services, DTOs, Validators |
64
+ | **Infrastructure** | `analysis.entities[]` | EF Configurations, DbSet |
65
+ | **API** | `specification.apiEndpoints[]` | Controllers (exact copy) |
66
+ | **Frontend** | `specification.uiWireframes[]` | Pages, Components, Hooks; split by file (NOT monolithic) |
67
+ | **SeedData** | `specification.seedDataCore` | CORE (2 app-level + per-module) + business |
68
+ | **Tests** | All layers | Unit, Integration, Security tests |
69
+ | **Documentation** | All layers | Technical docs, user guides, API specs (can be empty `[]`) |
70
+
71
+ **Frontend Task Splitting (MANDATORY):**
72
+ - Each page as separate entry (not bundled mega-task)
73
+ - Include `linkedWireframes[]` + `wireframeAcceptanceCriteria`
74
+ - FK fields: `"fkFields": ["EmployeeId->Employee", "DepartmentId->Department"]`
75
+ - ALL pages use `/ui-components` skill
76
+ - Route wiring: separate entry in `filesToCreate.frontend`
77
+
78
+ **Route Convention (CRITICAL):**
79
+ - Transform PascalCase module codes to kebab-case in NavigationModule/Section routes
80
+ - Example: `"HumanResources"` -> `"/human-resources"` (NEVER include `/business/` prefix)
81
+
82
+ **Documentation Category:**
83
+ - Include `doc-data.ts` for documentation data export
84
+ - Include API specification files if applicable
85
+ - Can be empty `[]` if no documentation is planned at this stage
86
+ - Will be populated later by `/documentation` skill after `/ralph-loop`
87
+
88
+ ### 3. Map Business Rules to Code
89
+
90
+ > **Reference:** Read `references/handoff-mappings.md` — Section "Business Rules to Code Mapping"
91
+
92
+ For each BR in `analysis.businessRules[]` of EACH module:
93
+ - ruleId, title, module, severity (critical/high/medium/low)
94
+ - implementationPoints: Array of {layer, component, method, implementation} across all layers
95
+
96
+ ### 4. Propagate personRoleConfig (GAP #2 Fix)
97
+
98
+ For each entity in `analysis.entities[]`:
99
+ - IF entity has `personRoleConfig` property:
100
+ - Copy verbatim into handoff entity data
101
+ - Ensures `/apex` and `/ralph-loop` receive person extension configuration
102
+ - See `references/handoff-mappings.md` — Section "Person Extension Mapping"
103
+
104
+ ### 5. Separate SeedData Core/Business (GAP #3 Fix)
105
+
106
+ Each seedData entry MUST include a `category` field:
107
+
108
+ ```json
109
+ {
110
+ "path": "src/Infrastructure/Persistence/Seeding/Data/NavigationApplicationSeedData.cs",
111
+ "type": "SeedData",
112
+ "category": "core",
113
+ "module": "shared"
114
+ }
115
+ ```
116
+
117
+ - `category: "core"` — Navigation, Permissions, Roles (mandatory infrastructure)
118
+ - `category: "business"` — Domain-specific reference/lookup data
119
+
120
+ > **Reference:** Read `references/handoff-seeddata-generation.md` for complete core seed generation.
121
+
122
+ ### 6. Map Entity to Domain File (GAP #4 Fix)
123
+
124
+ > **Reference:** Read `references/entity-domain-mapping.md` for complete mapping rules.
125
+
126
+ 1:1 mapping from BA entity to Domain file:
127
+
128
+ | BA Element | Domain File Path |
129
+ |------------|-----------------|
130
+ | Entity | `src/Domain/Entities/{App}/{Module}/{EntityName}.cs` |
131
+ | ValueObject | `src/Domain/{Module}/ValueObjects/{VOName}.cs` |
132
+ | Enum | `src/Domain/{Module}/Enums/{EnumName}.cs` |
133
+
134
+ ### 7. Add Dependencies per File Entry (GAP #7 Fix)
135
+
136
+ Each file entry includes `dependencies[]` ordered by layer:
137
+
138
+ | Layer | Dependencies |
139
+ |-------|-------------|
140
+ | domain | `[]` (no dependencies) |
141
+ | infrastructure | `["domain"]` |
142
+ | application | `["domain"]` |
143
+ | api | `["application"]` |
144
+ | seedData | `["domain", "infrastructure"]` |
145
+ | frontend | `["api"]` |
146
+ | tests | `["domain", "application", "infrastructure", "api"]` |
147
+ | documentation | `[]` |
148
+
149
+ ### 8. API Endpoint Summary
150
+
151
+ > **ABSOLUTE RULE:** Copy **EXACTLY** from `specification.apiEndpoints[]`. **NEVER** reinvent routes.
152
+
153
+ For each endpoint: operation, method, route, linkedUC, linkedFR, permissions, requestSchema, responseSchema, errorCodes, module.
154
+
155
+ ### 9. Write Handoff to Feature.json
156
+
157
+ ```
158
+ FOR i = 0 to modules.length-1:
159
+ 1. moduleCode = modules[i].code
160
+ 2. moduleFeature = ba-reader.findFeature(modules[i].featureJsonPath)
161
+ 3. Build handoff payload:
162
+ - complexity (from step 1)
163
+ - filesToCreate (full 8-category structure, filtered for this module)
164
+ - brToCodeMapping (from step 3)
165
+ - apiEndpointSummary (from step 8)
166
+ - prdFile: ".ralph/prd-{moduleCode}.json"
167
+ - totalFiles: count from filesToCreate
168
+ - totalTasks: estimated from complexity
169
+ - handedOffAt: ISO timestamp
170
+ 4. Write via ba-writer.enrichModuleHandoff({ moduleFeatureId, handoffData })
171
+ 5. Display: "handoff {i+1}/{N}: {moduleCode} ({fileCount} files)"
172
+ ```
173
+
174
+ ### 10. POST-CHECK Per Module (BLOCKING)
175
+
176
+ For each module, verify:
177
+
178
+ ```javascript
179
+ const handoff = moduleFeature.handoff;
180
+
181
+ // 1. Handoff not empty
182
+ if (!handoff || Object.keys(handoff).length === 0) {
183
+ BLOCKING_ERROR("Module {moduleCode}: handoff is empty");
184
+ }
185
+
186
+ // 2. All 8 categories present
187
+ const categories = ['domain', 'application', 'infrastructure', 'api', 'frontend', 'seedData', 'tests', 'documentation'];
188
+ const missing = categories.filter(cat => !handoff.filesToCreate[cat]);
189
+ if (missing.length > 0) {
190
+ BLOCKING_ERROR("Module {moduleCode}: missing categories: " + missing.join(', '));
191
+ }
192
+
193
+ // 3. BR-to-code mapping non-empty
194
+ if (!handoff.brToCodeMapping || handoff.brToCodeMapping.length === 0) {
195
+ BLOCKING_ERROR("Module {moduleCode}: brToCodeMapping is empty");
196
+ }
197
+
198
+ // 4. Display pass
199
+ console.log("POST-CHECK PASS: {moduleCode} — 8 categories, {brCount} BRs mapped");
200
+ ```
201
+
202
+ ---
203
+
204
+ ## NEXT STEP
205
+
206
+ Load: `steps/step-02-export.md`
@@ -0,0 +1,181 @@
1
+ ---
2
+ name: step-02-export
3
+ description: Generate PRD files, verify integrity, output progress tracker and manifest
4
+ model: sonnet
5
+ ---
6
+
7
+ > **Context files:** `references/prd-generation.md` | `templates/tpl-progress.md`
8
+
9
+ # Step 02: Export (PRD + Verification)
10
+
11
+ ## MANDATORY EXECUTION RULES
12
+
13
+ - **ALWAYS** generate PRD via `ss derive-prd` CLI command (deterministic, never LLM)
14
+ - **ALWAYS** verify PRD structure: $version=3.0.0, implementation.filesToCreate, 8 categories
15
+ - **ALWAYS** verify file counts match between PRD and handoff
16
+ - **ALWAYS** generate progress.txt from template
17
+ - **ALWAYS** update BA manifest (docs/index.json)
18
+ - **NEVER** skip POST-CHECK validation
19
+
20
+ ## YOUR TASK
21
+
22
+ For each module, generate PRD files via CLI, verify integrity, create progress tracker, update manifest, and display completion summary.
23
+
24
+ ---
25
+
26
+ ## EXECUTION SEQUENCE
27
+
28
+ ### 1. Generate PRD Files
29
+
30
+ For EACH module:
31
+
32
+ ```bash
33
+ ss derive-prd --feature {moduleFeaturePath} --output .ralph/prd-{moduleCode}.json
34
+ ```
35
+
36
+ ### 2. POST-CHECK PRD (BLOCKING)
37
+
38
+ > **Reference:** Read `references/prd-generation.md` for complete validation rules.
39
+
40
+ ```javascript
41
+ const prd = readJSON(`.ralph/prd-${moduleCode}.json`);
42
+ const featureHandoff = moduleFeature.handoff.filesToCreate;
43
+
44
+ // Check 1: Version
45
+ if (prd.$version !== "3.0.0") {
46
+ BLOCKING_ERROR("PRD version must be 3.0.0, got: " + prd.$version);
47
+ }
48
+
49
+ // Check 2: filesToCreate under implementation (not root)
50
+ if (prd.filesToCreate && !prd.implementation?.filesToCreate) {
51
+ BLOCKING_ERROR("prd.json has filesToCreate at ROOT — not from ss derive-prd");
52
+ STOP;
53
+ }
54
+
55
+ // Check 3: All 8 categories present
56
+ const categories = ['domain', 'application', 'infrastructure', 'api', 'frontend', 'seedData', 'tests', 'documentation'];
57
+ const missingCategories = categories.filter(cat => !prd.implementation.filesToCreate[cat]);
58
+ if (missingCategories.length > 0) {
59
+ BLOCKING_ERROR("Missing categories: " + missingCategories.join(', '));
60
+ }
61
+
62
+ // Check 4: File counts match
63
+ for (const cat of categories) {
64
+ const prdCount = prd.implementation.filesToCreate[cat]?.length ?? 0;
65
+ const featureCount = featureHandoff[cat]?.length ?? 0;
66
+ if (prdCount !== featureCount) {
67
+ BLOCKING_ERROR(`${cat}: prd=${prdCount} but feature=${featureCount}`);
68
+ }
69
+ }
70
+ ```
71
+
72
+ Display verification table showing all 8 categories match between module JSON files and prd.json.
73
+
74
+ ### 3. Generate modules-queue.json (if 2+ modules)
75
+
76
+ ```json
77
+ {
78
+ "queue": [
79
+ { "moduleCode": "{code}", "order": 1, "dependencies": [], "complexity": "simple" },
80
+ { "moduleCode": "{code}", "order": 2, "dependencies": ["{dep}"], "complexity": "medium" }
81
+ ],
82
+ "totalModules": {count},
83
+ "strategy": "topological"
84
+ }
85
+ ```
86
+
87
+ Write to: `.ralph/modules-queue.json`
88
+
89
+ ### 4. Generate progress.txt
90
+
91
+ > **Template:** Read `templates/tpl-progress.md` for complete structure.
92
+ > **Data source:** Populate with module-specific data from index.json.
93
+
94
+ - One section per module in topological order
95
+ - CORE SeedData: 5 entries (mandatory)
96
+ - Business SeedData: per module (varies)
97
+ - Hierarchical task structure (module -> layer -> tasks)
98
+ - Each task: checkbox, description, effort, dependencies
99
+ - Summary with totals across all modules
100
+ - Cross-module tasks IF multi-module
101
+
102
+ Write to: `.ralph/progress.txt`
103
+
104
+ ### 5. Update BA Manifest (docs/index.json)
105
+
106
+ **Schema:**
107
+
108
+ ```json
109
+ {
110
+ "version": "1.0",
111
+ "updatedAt": "{ISO timestamp}",
112
+ "analyses": [
113
+ {
114
+ "appCode": "{app_code}",
115
+ "appName": "{application_name}",
116
+ "moduleCode": null | "{module_code}",
117
+ "moduleName": "{module_name}",
118
+ "version": "{version}",
119
+ "status": "handed-off",
120
+ "featureDescription": "{description}",
121
+ "path": "{app_code}/business-analyse/v{version}/index.json",
122
+ "updatedAt": "{ISO timestamp}"
123
+ }
124
+ ]
125
+ }
126
+ ```
127
+
128
+ **Update logic:**
129
+
130
+ 1. Read existing manifest (or create empty)
131
+ 2. **PROJECT MODE:** Add/update project entry + all app entries + all module entries per app
132
+ 3. **SINGLE-APP MODE:** Update app entry + module entries for this app
133
+ 4. Write manifest back with updated timestamp
134
+ 5. Display: "BA manifest updated: docs/index.json ({total} entries)"
135
+
136
+ ### 6. Display Completion Summary
137
+
138
+ ```
139
+ ══════════════════════════════════════════════════════════════
140
+ DERIVE-PRD COMPLETE — {application_name}
141
+ ══════════════════════════════════════════════════════════════
142
+
143
+ Modules: {count} ({names})
144
+ Complexity: {simple|medium|complex}
145
+ Files: {total across all modules}
146
+ Tasks: {total}
147
+
148
+ Readiness Scores:
149
+ ┌──────────────┬────────────┬──────────────┐
150
+ │ Module │ Blocking │ Files │
151
+ ├──────────────┼────────────┼──────────────┤
152
+ │ {module1} │ 100% │ {count} │
153
+ │ {module2} │ 100% │ {count} │
154
+ └──────────────┴────────────┴──────────────┘
155
+
156
+ Artifacts generated:
157
+ .ralph/prd-{module}.json — Task breakdown per module
158
+ .ralph/progress.txt — Progression tracker
159
+ .ralph/modules-queue.json — Module execution order (if multi-module)
160
+ docs/index.json — BA manifest (status: handed-off)
161
+
162
+ [NEXT] Development:
163
+ 1. Run /ralph-loop to begin implementation
164
+ 2. Modules will be processed in topological order
165
+ 3. Each module PRD contains {total_files} files across 8 categories
166
+
167
+ ══════════════════════════════════════════════════════════════
168
+ ```
169
+
170
+ ---
171
+
172
+ ## SELF-VERIFICATION (BEFORE COMPLETION)
173
+
174
+ 1. `.ralph/prd-{module}.json` exists for ALL modules (>100 bytes each)
175
+ 2. `.ralph/progress.txt` exists (>500 bytes)
176
+ 3. `.ralph/modules-queue.json` exists (if 2+ modules)
177
+ 4. `docs/index.json` updated with correct entry count and status "handed-off"
178
+ 5. All PRD files have $version=3.0.0, implementation.filesToCreate, 8 categories
179
+ 6. File counts match between PRD and handoff for all categories
180
+
181
+ **IF any check fails -> fix before completing.**