@atlashub/smartstack-cli 4.23.0 → 4.25.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 (27) hide show
  1. package/package.json +1 -1
  2. package/templates/skills/ba-generate-html/html/ba-interactive.html +950 -1055
  3. package/templates/skills/ba-generate-html/html/src/scripts/01-data-init.js +1 -2
  4. package/templates/skills/ba-generate-html/html/src/scripts/02-navigation.js +0 -1
  5. package/templates/skills/ba-generate-html/html/src/scripts/03-render-cadrage.js +0 -39
  6. package/templates/skills/ba-generate-html/html/src/scripts/05-render-specs.js +0 -1
  7. package/templates/skills/ba-generate-html/html/src/scripts/07-render-handoff.js +0 -1
  8. package/templates/skills/ba-generate-html/html/src/scripts/08-editing.js +133 -135
  9. package/templates/skills/ba-generate-html/html/src/scripts/10-comments.js +199 -199
  10. package/templates/skills/ba-generate-html/html/src/scripts/11-review-panel.js +165 -166
  11. package/templates/skills/ba-generate-html/html/src/styles/05-modules.css +444 -454
  12. package/templates/skills/ba-generate-html/html/src/template.html +0 -49
  13. package/templates/skills/ba-generate-html/references/data-build.md +176 -182
  14. package/templates/skills/ba-generate-html/references/data-mapping.md +295 -301
  15. package/templates/skills/ba-generate-html/steps/step-01-collect.md +1 -1
  16. package/templates/skills/ba-generate-html/steps/step-02-build-data.md +0 -9
  17. package/templates/skills/derive-prd/SKILL.md +9 -9
  18. package/templates/skills/derive-prd/references/acceptance-criteria.md +166 -116
  19. package/templates/skills/derive-prd/references/entity-domain-mapping.md +5 -5
  20. package/templates/skills/derive-prd/references/handoff-file-templates.md +12 -12
  21. package/templates/skills/derive-prd/references/handoff-mappings.md +13 -14
  22. package/templates/skills/derive-prd/references/handoff-seeddata-generation.md +1 -1
  23. package/templates/skills/derive-prd/references/readiness-scoring.md +41 -50
  24. package/templates/skills/derive-prd/schemas/handoff-schema.json +2 -2
  25. package/templates/skills/derive-prd/steps/step-00-validate.md +73 -52
  26. package/templates/skills/derive-prd/steps/step-01-transform.md +86 -43
  27. package/templates/skills/ba-generate-html/html/src/partials/cadrage-risks.html +0 -48
@@ -29,8 +29,8 @@ Transforms consolidated BA data into structured handoff and PRD files.
29
29
 
30
30
  ## Input
31
31
 
32
- - Consolidated BA feature (`status = "consolidated"`)
33
- - Source: `docs/{app}/{module}/business-analyse/v{X.Y}/index.json`
32
+ - Consolidated BA feature (`status = "consolidated"` or `"specified"`)
33
+ - Source: `docs/{app}/business-analyse/v{X.Y}/index.json` (app-level) + `docs/{app}/{module}/business-analyse/v{X.Y}/` (flat files per module)
34
34
  - Usage: `--feature <path>` or auto-detection from `docs/`
35
35
 
36
36
  ## Output
@@ -45,14 +45,14 @@ Transforms consolidated BA data into structured handoff and PRD files.
45
45
 
46
46
  ## Handoff Categories (8)
47
47
 
48
- | Category | Source | Key rules |
48
+ | Category | Source (flat files) | Key rules |
49
49
  |----------|--------|-----------|
50
- | **domain** | `analysis.entities[]` | Entities, ValueObjects, Enums |
51
- | **application** | `analysis.useCases[]` | Services, DTOs, Validators |
52
- | **infrastructure** | `analysis.entities[]` | EF Configurations, DbSet |
53
- | **api** | `specification.apiEndpoints[]` | Controllers (exact copy) |
54
- | **frontend** | `specification.uiWireframes[]` | Pages, Components, Hooks |
55
- | **seedData** | `specification.seedDataCore` | CORE + business |
50
+ | **domain** | `entities.json > entities[]` | Entities, ValueObjects, Enums |
51
+ | **application** | `usecases.json > useCases[]` | Services, DTOs, Validators |
52
+ | **infrastructure** | `entities.json > entities[]` | EF Configurations, DbSet |
53
+ | **api** | Generated from useCases + entities | Controllers |
54
+ | **frontend** | `screens.json > screens[]` | Pages, Components, Hooks |
55
+ | **seedData** | Generated from entities + permissions | CORE + business |
56
56
  | **tests** | All layers | Unit, Integration, Security tests |
57
57
  | **documentation** | All layers | Technical docs, user guides, API specs |
58
58
 
@@ -1,169 +1,219 @@
1
1
  # Module Acceptance Criteria (Shared Reference)
2
2
 
3
- > **Loaded by:** step-03-specify (post-check), step-05-deploy (pre-handoff gate), ralph-loop step-01-task (input validation)
4
- > **Purpose:** Define measurable, bash-verifiable acceptance criteria that a module MUST pass before being marked "specified".
5
- > **Key principle:** These checks read the REAL JSON files on disk — NOT in-memory data the model "thinks" it wrote.
3
+ > **Loaded by:** step-00-validate (pre-gate), step-01-transform (post-check)
4
+ > **Purpose:** Define measurable, bash-verifiable acceptance criteria that a module MUST pass.
5
+ > **Key principle:** These checks read the REAL JSON files on disk — NOT in-memory data.
6
6
 
7
7
  ---
8
8
 
9
- ## Why Bash-Verifiable?
9
+ ## Architecture: Flat-File Format
10
10
 
11
- All previous checks were **pseudocode interpreted by the model**. The model can "decide" a check passes even when it fails (hallucination of validation). Bash checks are **objective** they read the actual file and count real elements.
11
+ `/business-analyse` generates **separate JSON files** per module:
12
+
13
+ | File | Content | Root key |
14
+ |------|---------|----------|
15
+ | `index.json` | Metadata, file references, summary | `metadata`, `files`, `summary` |
16
+ | `entities.json` | Entity definitions | `entities[]` |
17
+ | `rules.json` | Business rules | `rules[]` |
18
+ | `usecases.json` | Use cases | `useCases[]` |
19
+ | `permissions.json` | Roles and permission matrix | `roles[]`, `permissionPaths[]`, `matrix[]` |
20
+ | `screens.json` | UI screen specifications | `screens[]` |
21
+
22
+ The validation script **assembles** these files before checking.
12
23
 
13
24
  ---
14
25
 
15
- ## Acceptance Criteria Table
16
-
17
- | # | Criterion | Minimum | Field Path | Blocking | Category |
18
- |---|-----------|---------|------------|----------|----------|
19
- | AC-01 | Entities present | 2 | `analysis.entities[]` | YES | Data Model |
20
- | AC-02 | Entity attributes have `type` field | ALL | `analysis.entities[].attributes[].type` | YES | Data Model |
21
- | AC-03 | Use cases present | 2 | `specification.useCases[]` | YES | Requirements |
22
- | AC-04 | Functional requirements present | 4 | `specification.functionalRequirements[]` | YES | Requirements |
23
- | AC-05 | Wireframes present | 1 | `specification.uiWireframes[] \|\| specification.wireframes[]` | YES | UI |
24
- | AC-06 | Wireframes >= sections | count match | wireframes.length >= sections.length | YES | UI |
25
- | AC-07 | Wireframe content non-empty | ALL | `wireframe.mockup \|\| wireframe.ascii \|\| wireframe.content` | YES | UI |
26
- | AC-08 | Sections present | 1 | `specification.sections[]` | YES | UI |
27
- | AC-09 | SeedDataCore 9 arrays non-empty | 9/9 | `specification.seedDataCore.*` | YES | Seed Data |
28
- | AC-10 | Gherkin scenarios is array | `Array.isArray` | `specification.gherkinScenarios` | YES | Format |
29
- | AC-11 | API endpoints present | 1 | `specification.apiEndpoints[]` | YES | API |
30
- | AC-12 | Messages present | 4 | `specification.messages[]` | YES | Messages |
31
- | AC-13 | Validations present | 1 | `specification.validations[]` | YES | Validation |
32
- | AC-14 | Wireframe field naming | canonical | `screen` not `title`, `mockup` not `ascii` | WARNING | Convention |
33
- | AC-15 | Validation rules format | ALL array | `specification.validations[].rules` is `Array` | YES | Format |
34
- | AC-16 | Messages have `message` field | ALL present | `specification.messages[].message` truthy | YES | Format |
35
- | AC-17 | Gherkin content structure | ALL valid | Each element has `feature` (string) + `scenarios` (array) | YES | Format |
26
+ ## AC Split: Input vs Output
27
+
28
+ ACs are split into two groups based on **when** they can be validated:
29
+
30
+ ### Input ACs (checked in step-00-validate)
31
+
32
+ These verify data that `/business-analyse` produces:
33
+
34
+ | # | Criterion | Minimum | Source File | Blocking |
35
+ |---|-----------|---------|-------------|----------|
36
+ | AC-01 | Entities present | 2 | `entities.json > entities[]` | YES |
37
+ | AC-02 | Entity attributes have `type` field | ALL | `entities.json > entities[].attributes[].type` | YES |
38
+ | AC-03 | Use cases present | 2 | `usecases.json > useCases[]` | YES |
39
+ | AC-04 | Business rules present | 2 | `rules.json > rules[]` | YES |
40
+ | AC-05 | Screens present | 1 | `screens.json > screens[]` | YES |
41
+ | AC-06 | Permissions present | 1 | `permissions.json > permissionPaths[]` | YES |
42
+ | AC-07 | Module status consolidated or specified | match | `index.json > metadata.status` | YES |
43
+
44
+ ### Output ACs (checked in step-01 post-transform)
45
+
46
+ These verify data that `/derive-prd` step-01 generates:
47
+
48
+ | # | Criterion | Minimum | Location | Blocking |
49
+ |---|-----------|---------|----------|----------|
50
+ | AC-08 | Handoff has 8 categories | 8 | `handoff.filesToCreate` | YES |
51
+ | AC-09 | BR-to-code mapping present | 1 | `handoff.brToCodeMapping[]` | YES |
52
+ | AC-10 | API endpoint summary present | 1 | `handoff.apiEndpointSummary[]` | YES |
53
+ | AC-11 | SeedData entries have category | ALL | `handoff.filesToCreate.seedData[].category` | YES |
36
54
 
37
55
  ---
38
56
 
39
- ## Bash Verification Script (node -e)
57
+ ## Input Validation Script (step-00)
40
58
 
41
- > **Usage:** Called from step-03 post-check after writing module JSON files.
42
- > Also callable standalone for debugging: `node -e "..." path/to/index.json`
59
+ > **Usage:** Validates BA flat files before transformation.
60
+ > Resolves file paths from module `index.json > files` references.
43
61
 
44
62
  ```bash
45
- MODULE_JSON="{module_feature_json_path}"
63
+ MODULE_DIR="{module_ba_dir}"
46
64
  node -e "
47
65
  const fs = require('fs');
48
- const data = JSON.parse(fs.readFileSync(process.argv[1], 'utf-8'));
49
- const spec = data.specification || {};
50
- const analysis = data.analysis || {};
51
- const wf = spec.uiWireframes || spec.wireframes || [];
52
- const sections = spec.sections || [];
53
- const sdc = spec.seedDataCore || {};
54
-
55
- const checks = [
56
- ['AC-01: entities >= 2', (analysis.entities||[]).length, 2],
57
- ['AC-03: useCases >= 2', (spec.useCases||[]).length, 2],
58
- ['AC-04: FRs >= 4', (spec.functionalRequirements||[]).length, 4],
59
- ['AC-05: wireframes >= 1', wf.length, 1],
60
- ['AC-06: wireframes >= sections', wf.length, sections.length],
61
- ['AC-08: sections >= 1', sections.length, 1],
62
- ['AC-09: seedDataCore 9 arrays', Object.keys(sdc).filter(k => Array.isArray(sdc[k]) && sdc[k].length > 0).length, 9],
63
- ['AC-10: gherkin is array', Array.isArray(spec.gherkinScenarios) ? 1 : 0, 1],
64
- ['AC-11: apiEndpoints >= 1', (spec.apiEndpoints||[]).length, 1],
65
- ['AC-12: messages >= 4', (spec.messages||[]).length, 4],
66
- ['AC-13: validations >= 1', (spec.validations||[]).length, 1]
67
- ];
66
+ const path = require('path');
67
+ const dir = process.argv[1];
68
+
69
+ // Load index.json
70
+ const index = JSON.parse(fs.readFileSync(path.join(dir, 'index.json'), 'utf-8'));
71
+ const files = index.files || {};
72
+
73
+ // Load flat files (with fallbacks)
74
+ function loadFile(key) {
75
+ const ref = files[key];
76
+ if (!ref || !ref.path) return null;
77
+ const filePath = path.join(dir, ref.path);
78
+ if (!fs.existsSync(filePath)) return null;
79
+ return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
80
+ }
81
+
82
+ const entitiesData = loadFile('entities') || {};
83
+ const usecasesData = loadFile('usecases') || {};
84
+ const rulesData = loadFile('rules') || {};
85
+ const permissionsData = loadFile('permissions') || {};
86
+ const screensData = loadFile('screens') || {};
87
+
88
+ const entities = entitiesData.entities || [];
89
+ const useCases = usecasesData.useCases || [];
90
+ const rules = rulesData.rules || [];
91
+ const permissions = permissionsData.permissionPaths || permissionsData.permissions || [];
92
+ const screens = screensData.screens || [];
93
+ const status = index.metadata?.status || 'unknown';
68
94
 
69
95
  const fails = [];
70
- checks.forEach(c => {
71
- if (c[1] < c[2]) {
72
- fails.push(c);
73
- console.error('FAIL: ' + c[0] + ' = ' + c[1] + ' (min: ' + c[2] + ')');
74
- }
75
- });
76
-
77
- // AC-02: Entity attribute types
78
- const badAttrs = (analysis.entities||[]).flatMap(e =>
79
- (e.attributes||[]).filter(a => !a.type).map(a => e.name + '.' + a.name)
96
+
97
+ // AC-01: Entities >= 2
98
+ if (entities.length < 2) {
99
+ fails.push('AC-01: entities = ' + entities.length + ' (min: 2)');
100
+ console.error('FAIL: AC-01: entities >= 2 = ' + entities.length + ' (min: 2)');
101
+ }
102
+
103
+ // AC-02: Entity attributes have type
104
+ const badAttrs = entities.flatMap(e =>
105
+ (e.attributes || []).filter(a => !a.type).map(a => e.name + '.' + a.name)
80
106
  );
81
107
  if (badAttrs.length > 0) {
82
- fails.push(['AC-02: attr.type missing', badAttrs.length, 0]);
83
- console.error('FAIL: AC-02: ' + badAttrs.length + ' attributes without type: ' + badAttrs.slice(0, 5).join(', ') + (badAttrs.length > 5 ? '...' : ''));
108
+ fails.push('AC-02: ' + badAttrs.length + ' attributes without type');
109
+ console.error('FAIL: AC-02: ' + badAttrs.length + ' attributes without type: ' + badAttrs.slice(0, 5).join(', '));
84
110
  }
85
111
 
86
- // AC-07: Wireframe content non-empty
87
- const emptyWf = wf.filter(w => !w.mockup && !w.ascii && !w.content);
88
- if (emptyWf.length > 0) {
89
- fails.push(['AC-07: wireframe content empty', emptyWf.length, 0]);
90
- console.error('FAIL: AC-07: ' + emptyWf.length + ' wireframes have EMPTY content');
112
+ // AC-03: Use cases >= 2
113
+ if (useCases.length < 2) {
114
+ fails.push('AC-03: useCases = ' + useCases.length + ' (min: 2)');
115
+ console.error('FAIL: AC-03: useCases >= 2 = ' + useCases.length + ' (min: 2)');
91
116
  }
92
117
 
93
- // AC-14: Wireframe field naming (WARNING only)
94
- const badFields = wf.filter(w => w.title || w.ascii || (w.name && !w.screen));
95
- if (badFields.length > 0) {
96
- console.warn('WARNING: AC-14: ' + badFields.length + ' wireframes use non-canonical field names (title/ascii/name)');
118
+ // AC-04: Business rules >= 2
119
+ if (rules.length < 2) {
120
+ fails.push('AC-04: rules = ' + rules.length + ' (min: 2)');
121
+ console.error('FAIL: AC-04: rules >= 2 = ' + rules.length + ' (min: 2)');
97
122
  }
98
123
 
99
- // AC-15: Validation rules format (rules must be array, not string)
100
- const badRules = (spec.validations||[]).filter(v => v.rules && !Array.isArray(v.rules));
101
- if (badRules.length > 0) {
102
- fails.push(['AC-15: validations[].rules not array', badRules.length, 0]);
103
- console.error('FAIL: AC-15: ' + badRules.length + ' validations have rules as string instead of array');
124
+ // AC-05: Screens >= 1
125
+ if (screens.length < 1) {
126
+ fails.push('AC-05: screens = ' + screens.length + ' (min: 1)');
127
+ console.error('FAIL: AC-05: screens >= 1 = ' + screens.length + ' (min: 1)');
104
128
  }
105
129
 
106
- // AC-16: Messages must have 'message' field
107
- const noMsg = (spec.messages||[]).filter(m => !m.message);
108
- if (noMsg.length > 0) {
109
- fails.push(['AC-16: messages[].message missing', noMsg.length, 0]);
110
- console.error('FAIL: AC-16: ' + noMsg.length + ' messages missing "message" field');
130
+ // AC-06: Permissions >= 1
131
+ if (permissions.length < 1) {
132
+ fails.push('AC-06: permissions = ' + permissions.length + ' (min: 1)');
133
+ console.error('FAIL: AC-06: permissions >= 1 = ' + permissions.length + ' (min: 1)');
111
134
  }
112
135
 
113
- // AC-17: Gherkin content structure (each element needs feature + scenarios[])
114
- if (Array.isArray(spec.gherkinScenarios)) {
115
- const badGherkin = spec.gherkinScenarios.filter(g => !g.feature || !Array.isArray(g.scenarios));
116
- if (badGherkin.length > 0) {
117
- fails.push(['AC-17: gherkin content invalid', badGherkin.length, 0]);
118
- console.error('FAIL: AC-17: ' + badGherkin.length + ' gherkin entries missing feature or scenarios[]');
119
- }
136
+ // AC-07: Status consolidated or specified
137
+ if (status !== 'consolidated' && status !== 'specified') {
138
+ fails.push('AC-07: status = ' + status + ' (expected: consolidated or specified)');
139
+ console.error('FAIL: AC-07: status = ' + status + ' (expected: consolidated or specified)');
120
140
  }
121
141
 
122
142
  // Summary
123
143
  if (fails.length > 0) {
124
- console.error('\\nBLOCKING: ' + fails.length + ' acceptance criteria FAILED');
144
+ console.error('\\nBLOCKING: ' + fails.length + ' input acceptance criteria FAILED');
125
145
  process.exit(1);
126
146
  }
127
- console.log('PASS: All acceptance criteria met (AC-01 to AC-17)');
128
- " "$MODULE_JSON"
147
+ console.log('PASS: All input acceptance criteria met (AC-01 to AC-07)');
148
+ console.log(' entities: ' + entities.length + ', useCases: ' + useCases.length + ', rules: ' + rules.length + ', screens: ' + screens.length + ', permissions: ' + permissions.length);
149
+ " "$MODULE_DIR"
129
150
  ```
130
151
 
131
152
  ---
132
153
 
133
- ## Integration Points
154
+ ## Output Validation Script (step-01 post-check)
134
155
 
135
- ### 1. step-03-specify.md (post-check)
156
+ > **Usage:** Validates handoff data after step-01 transformation.
136
157
 
137
- After writing module JSON files, run the bash script above.
138
- IF FAIL → re-execute section 11 write with corrected data → re-run until PASS.
158
+ ```bash
159
+ MODULE_JSON="{module_index_json_path}"
160
+ node -e "
161
+ const fs = require('fs');
162
+ const data = JSON.parse(fs.readFileSync(process.argv[1], 'utf-8'));
163
+ const handoff = data.handoff || {};
164
+ const ftc = handoff.filesToCreate || {};
165
+
166
+ const fails = [];
167
+
168
+ // AC-08: All 8 categories present
169
+ const categories = ['domain', 'application', 'infrastructure', 'api', 'frontend', 'seedData', 'tests', 'documentation'];
170
+ const missing = categories.filter(cat => !ftc[cat]);
171
+ if (missing.length > 0) {
172
+ fails.push('AC-08: missing categories: ' + missing.join(', '));
173
+ console.error('FAIL: AC-08: missing categories: ' + missing.join(', '));
174
+ }
139
175
 
140
- ### 2. step-05-deploy.md (pre-handoff gate)
176
+ // AC-09: BR-to-code mapping present
177
+ if (!handoff.brToCodeMapping || handoff.brToCodeMapping.length === 0) {
178
+ fails.push('AC-09: brToCodeMapping is empty');
179
+ console.error('FAIL: AC-09: brToCodeMapping is empty');
180
+ }
141
181
 
142
- Before writing handoff for each module, run the bash script on the module index.json.
143
- IF FAIL STOP handoff for this module, report which criteria failed.
182
+ // AC-10: API endpoint summary present
183
+ if (!handoff.apiEndpointSummary || handoff.apiEndpointSummary.length === 0) {
184
+ fails.push('AC-10: apiEndpointSummary is empty');
185
+ console.error('FAIL: AC-10: apiEndpointSummary is empty');
186
+ }
144
187
 
145
- ### 3. ralph-loop step-01-task.md (input validation)
188
+ // AC-11: SeedData entries have category
189
+ const seedEntries = ftc.seedData || [];
190
+ const noCat = seedEntries.filter(s => !s.category);
191
+ if (noCat.length > 0) {
192
+ fails.push('AC-11: ' + noCat.length + ' seedData entries missing category');
193
+ console.error('FAIL: AC-11: ' + noCat.length + ' seedData entries missing category field');
194
+ }
146
195
 
147
- At PRD load time, run the bash script on each module index.json.
148
- IF FAIL BLOCKING: "Module {name} does not meet acceptance criteria — run /business-analyse to fix".
149
- This prevents ralph-loop from generating code from incomplete specifications.
196
+ if (fails.length > 0) {
197
+ console.error('\\nBLOCKING: ' + fails.length + ' output acceptance criteria FAILED');
198
+ process.exit(1);
199
+ }
200
+ console.log('PASS: All output acceptance criteria met (AC-08 to AC-11)');
201
+ " "$MODULE_JSON"
202
+ ```
150
203
 
151
204
  ---
152
205
 
153
- ## Recovery Actions per Criterion
206
+ ## Recovery Actions
154
207
 
155
208
  | Criterion | Recovery |
156
209
  |-----------|----------|
157
- | AC-01/02 | Re-run step-03 entity specification |
158
- | AC-03/04 | Re-run step-03 use case / functional requirements |
159
- | AC-05/06/07 | Re-run step-03 wireframe generation |
160
- | AC-08 | Re-run step-03 section definition |
161
- | AC-09 | Re-run step-03 seedDataCore transform |
162
- | AC-10 | Auto-fix: wrap in array `[gherkinScenarios]` |
163
- | AC-11 | Re-run step-03 API endpoints |
164
- | AC-12 | Re-run step-03 messages |
165
- | AC-13 | Re-run step-03 validations |
166
- | AC-14 | Auto-fix: rename title→screen, ascii→mockup |
167
- | AC-15 | Auto-fix: wrap string in array `[rules]` |
168
- | AC-16 | Auto-fix: copy `description` → `message` |
169
- | AC-17 | Re-run step-03 gherkin — ensure each entry has `feature` string + `scenarios` array |
210
+ | AC-01/02 | Re-run `/business-analyse` entity specification |
211
+ | AC-03 | Re-run `/business-analyse` use case specification |
212
+ | AC-04 | Re-run `/business-analyse` business rules specification |
213
+ | AC-05 | Re-run `/business-analyse` screen specification |
214
+ | AC-06 | Re-run `/business-analyse` permission specification |
215
+ | AC-07 | Run `/business-analyse` step-04 consolidation |
216
+ | AC-08 | Re-run `/derive-prd` step-01 transform (missing categories) |
217
+ | AC-09 | Re-run `/derive-prd` step-01 transform (BR mapping) |
218
+ | AC-10 | Re-run `/derive-prd` step-01 transform (API endpoints) |
219
+ | AC-11 | Re-run `/derive-prd` step-01 transform (seedData categories) |
@@ -12,8 +12,8 @@ Each entity identified during business analysis maps to exactly one file in the
12
12
  ### Entity -> Domain Entity File
13
13
 
14
14
  ```
15
- BA: analysis.entities[].name = "{EntityName}"
16
- analysis.entities[].module = "{ModuleCode}"
15
+ BA: entities.json > entities[].name = "{EntityName}"
16
+ entities.json > entities[].module = "{ModuleCode}"
17
17
  metadata.application = "{AppName}"
18
18
 
19
19
  Domain: src/SmartStack.{AppName}.Domain/{ModuleCode}/Entities/{EntityName}.cs
@@ -21,7 +21,7 @@ Domain: src/SmartStack.{AppName}.Domain/{ModuleCode}/Entities/{EntityName}.cs
21
21
 
22
22
  **Example:**
23
23
  ```
24
- BA: analysis.entities[].name = "Employee"
24
+ BA: entities.json > entities[].name = "Employee"
25
25
  module = "Employees"
26
26
  application = "HumanResources"
27
27
 
@@ -31,7 +31,7 @@ Domain: src/SmartStack.HumanResources.Domain/Employees/Entities/Employee.cs
31
31
  ### ValueObject -> Domain ValueObject File
32
32
 
33
33
  ```
34
- BA: analysis.entities[].valueObjects[].name = "{VOName}"
34
+ BA: entities.json > entities[].valueObjects[].name = "{VOName}"
35
35
 
36
36
  Domain: src/SmartStack.{AppName}.Domain/{ModuleCode}/ValueObjects/{VOName}.cs
37
37
  ```
@@ -47,7 +47,7 @@ Domain: src/SmartStack.HumanResources.Domain/Employees/ValueObjects/Address.cs
47
47
  ### Enum -> Domain Enum File
48
48
 
49
49
  ```
50
- BA: analysis.entities[].enums[].name = "{EnumName}"
50
+ BA: entities.json > entities[].enums[].name = "{EnumName}"
51
51
  OR attributes with type "enum" and enumValues[]
52
52
 
53
53
  Domain: src/SmartStack.{AppName}.Domain/{ModuleCode}/Enums/{EnumName}.cs
@@ -6,7 +6,7 @@
6
6
 
7
7
  ## 4.1 Domain Files
8
8
 
9
- From `analysis.entities[]`:
9
+ From `entities.json > entities[]`:
10
10
 
11
11
  ```json
12
12
  "domain": [
@@ -18,7 +18,7 @@ Include: Value objects, Enums (`src/Domain/Enums/...`), Domain exceptions (`src/
18
18
 
19
19
  ## 4.2 Application Files
20
20
 
21
- From `analysis.useCases[]`:
21
+ From `usecases.json > useCases[]`:
22
22
 
23
23
  ```json
24
24
  "application": [
@@ -32,7 +32,7 @@ Include: Service per UC cluster, DTOs for API contracts, Validators (FluentValid
32
32
 
33
33
  ## 4.3 Infrastructure Files
34
34
 
35
- From `analysis.entities[]`:
35
+ From `entities.json > entities[]`:
36
36
 
37
37
  ```json
38
38
  "infrastructure": [
@@ -44,7 +44,7 @@ Include: EF Core config per entity, DbSet in IExtensionsDbContext, DI registrati
44
44
 
45
45
  ## 4.4 API Files
46
46
 
47
- From `specification.apiEndpoints[]`:
47
+ Generated from `usecases.json` + `entities.json`:
48
48
 
49
49
  ```json
50
50
  "api": [
@@ -56,7 +56,7 @@ Include: One controller per aggregate root, all HTTP methods, error handling
56
56
 
57
57
  ## 4.5 Frontend Files
58
58
 
59
- From `specification.uiWireframes[]`, `specification.dashboards[]` and `analysis.useCases[]`:
59
+ From `screens.json > screens[]` and `usecases.json > useCases[]`:
60
60
 
61
61
  > **WIREFRAME TRACEABILITY:** Every frontend file MUST include `linkedWireframes[]` referencing wireframe `screen` identifiers.
62
62
 
@@ -86,13 +86,13 @@ From `specification.uiWireframes[]`, `specification.dashboards[]` and `analysis.
86
86
 
87
87
  ```json
88
88
  "seedData": [
89
- { "path": "src/Infrastructure/Persistence/Seeding/Data/NavigationApplicationSeedData.cs", "type": "SeedData", "category": "core", "source": "specification.seedDataCore.navigationApplications", "module": "shared", "description": "Application-level navigation seed data. Created ONCE per application (FIRST). Provides ApplicationId for modules and roles." },
90
- { "path": "src/Infrastructure/Persistence/Seeding/Data/ApplicationRolesSeedData.cs", "type": "SeedData", "category": "core", "source": "specification.seedDataCore.rolePermissions", "module": "shared", "description": "Application-scoped role definitions (admin, manager, contributor, viewer). Created ONCE per application. Provides role entries for SeedRolesAsync()." },
91
- { "path": "src/Infrastructure/Persistence/Seeding/Data/{ModuleName}/NavigationModuleSeedData.cs", "type": "SeedData", "category": "core", "source": "specification.seedDataCore.navigationModules", "module": "{moduleCode}" },
92
- { "path": "src/Infrastructure/Persistence/Seeding/Data/{ModuleName}/NavigationSectionSeedData.cs", "type": "SeedData", "category": "core", "source": "specification.seedDataCore.navigationSections", "module": "{moduleCode}", "description": "MANDATORY when sections defined. Seeds section-level navigation entries (list, dashboard, etc.) with full absolute routes." },
93
- { "path": "src/Infrastructure/Persistence/Seeding/Data/{ModuleName}/PermissionsSeedData.cs", "type": "SeedData", "category": "core", "source": "specification.seedDataCore.permissions", "module": "{moduleCode}" },
94
- { "path": "src/Infrastructure/Persistence/Seeding/Data/{ModuleName}/RolesSeedData.cs", "type": "SeedData", "category": "core", "source": "specification.seedDataCore.rolePermissions", "module": "{moduleCode}" },
95
- { "path": "src/Infrastructure/Persistence/Seeding/Data/{ModuleName}/{Entity}SeedData.cs", "type": "SeedData", "category": "business", "source": "specification.seedDataBusiness.{module}", "module": "{moduleCode}" }
89
+ { "path": "src/Infrastructure/Persistence/Seeding/Data/NavigationApplicationSeedData.cs", "type": "SeedData", "category": "core", "source": "generated from permissions.json + screens.json", "module": "shared", "description": "Application-level navigation seed data. Created ONCE per application (FIRST). Provides ApplicationId for modules and roles." },
90
+ { "path": "src/Infrastructure/Persistence/Seeding/Data/ApplicationRolesSeedData.cs", "type": "SeedData", "category": "core", "source": "generated from permissions.json + screens.json", "module": "shared", "description": "Application-scoped role definitions (admin, manager, contributor, viewer). Created ONCE per application. Provides role entries for SeedRolesAsync()." },
91
+ { "path": "src/Infrastructure/Persistence/Seeding/Data/{ModuleName}/NavigationModuleSeedData.cs", "type": "SeedData", "category": "core", "source": "generated from permissions.json + screens.json", "module": "{moduleCode}" },
92
+ { "path": "src/Infrastructure/Persistence/Seeding/Data/{ModuleName}/NavigationSectionSeedData.cs", "type": "SeedData", "category": "core", "source": "generated from permissions.json + screens.json", "module": "{moduleCode}", "description": "MANDATORY when sections defined. Seeds section-level navigation entries (list, dashboard, etc.) with full absolute routes." },
93
+ { "path": "src/Infrastructure/Persistence/Seeding/Data/{ModuleName}/PermissionsSeedData.cs", "type": "SeedData", "category": "core", "source": "generated from permissions.json + screens.json", "module": "{moduleCode}" },
94
+ { "path": "src/Infrastructure/Persistence/Seeding/Data/{ModuleName}/RolesSeedData.cs", "type": "SeedData", "category": "core", "source": "generated from permissions.json + screens.json", "module": "{moduleCode}" },
95
+ { "path": "src/Infrastructure/Persistence/Seeding/Data/{ModuleName}/{Entity}SeedData.cs", "type": "SeedData", "category": "business", "source": "generated from entities.json", "module": "{moduleCode}" }
96
96
  ]
97
97
  ```
98
98
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Business Rules to Code Mapping
4
4
 
5
- Derive from module index.json `analysis.businessRules[]` of **EACH module**.
5
+ Derive from module `rules.json > rules[]` of **EACH module**.
6
6
 
7
7
  Generate complete mapping for each BR:
8
8
 
@@ -26,21 +26,21 @@ Generate complete mapping for each BR:
26
26
  ```
27
27
 
28
28
  For each BR include:
29
- - **ruleId**: Reference to analysis.businessRules[].id
29
+ - **ruleId**: Reference to `rules.json > rules[].id`
30
30
  - **title**: The rule statement
31
31
  - **module**: Which module it belongs to
32
- - **severity**: "critical", "high", "medium", "low"
32
+ - **severity**: From `rule.severity` (blocking, info, etc.) mapped to "critical", "high", "medium", "low"
33
33
  - **implementationPoints**: Array of {layer, component, method, implementation}
34
34
 
35
35
  Layers: Domain, Application, Infrastructure, API, Frontend
36
36
 
37
37
  ## Person Extension Mapping
38
38
 
39
- When an entity has `personRoleConfig` in its analysis data, it MUST be carried into the PRD:
39
+ When an entity has `personRoleConfig` in its entity data, it MUST be carried into the PRD:
40
40
 
41
- | Source (index.json) | Target (PRD) |
42
- |----------------------|--------------|
43
- | `analysis.entities[].personRoleConfig` | `modules[].entities[].personRoleConfig` |
41
+ | Source (entities.json) | Target (PRD) |
42
+ |------------------------|--------------|
43
+ | `entities[].personRoleConfig` | `modules[].entities[].personRoleConfig` |
44
44
  | `personRoleConfig.userLinkMode` | Determines scaffold options: `isPersonRole: true, userLinkMode: "{mode}"` |
45
45
  | `personRoleConfig.inheritedFields` | Fields to exclude from entity (mandatory) or mark as fallback (optional) |
46
46
 
@@ -50,7 +50,8 @@ The `personRoleConfig` object is passed through verbatim to ensure `/apex` and `
50
50
 
51
51
  ## API Endpoint Summary
52
52
 
53
- > **ABSOLUTE RULE:** Copy **EXACTLY** from index.json `specification.apiEndpoints[]`. **NEVER** reinvent routes.
53
+ > **Generated by step-01 from `usecases.json > useCases[]` + `entities.json > entities[]` + `permissions.json`.**
54
+ > BA does not produce apiEndpoints directly -- they are derived during transformation.
54
55
 
55
56
  ```json
56
57
  {
@@ -60,7 +61,6 @@ The `personRoleConfig` object is passed through verbatim to ensure `/apex` and `
60
61
  "method": "GET",
61
62
  "route": "/api/orders",
62
63
  "linkedUC": "UC-001",
63
- "linkedFR": "FR-001",
64
64
  "permissions": ["orders.read"],
65
65
  "requestSchema": { "type": "query", "params": ["pageNumber", "pageSize", "status"] },
66
66
  "responseSchema": { "type": "PaginatedOrderDto[]" },
@@ -72,7 +72,6 @@ The `personRoleConfig` object is passed through verbatim to ensure `/apex` and `
72
72
  "method": "POST",
73
73
  "route": "/api/orders",
74
74
  "linkedUC": "UC-002",
75
- "linkedFR": "FR-002",
76
75
  "permissions": ["orders.create"],
77
76
  "requestSchema": { "type": "body", "schema": "CreateOrderDto" },
78
77
  "responseSchema": { "type": "OrderDto" },
@@ -84,11 +83,11 @@ The `personRoleConfig` object is passed through verbatim to ensure `/apex` and `
84
83
  ```
85
84
 
86
85
  For each endpoint:
87
- - **operation**: Use case name
86
+ - **operation**: Derived from use case name
88
87
  - **method**: HTTP method (GET, POST, PUT, DELETE, PATCH)
89
- - **route**: Full API path from specification
90
- - **linkedUC/linkedFR**: Use case and feature requirement IDs
91
- - **permissions**: Array of exact permission paths
88
+ - **route**: Generated from app/module path convention
89
+ - **linkedUC**: Use case ID from usecases.json
90
+ - **permissions**: Array of permission paths from permissions.json
92
91
  - **requestSchema**: Input contract (query params or body)
93
92
  - **responseSchema**: Output contract
94
93
  - **errorCodes**: Expected HTTP error codes
@@ -306,7 +306,7 @@ IF seedDataCore.navigationSections.length === 0:
306
306
  ```javascript
307
307
  ba-writer.enrichSection({
308
308
  featureId: {feature_id},
309
- section: "specification.seedDataCore",
309
+ section: "generated seedData (core)",
310
310
  data: seedDataCore
311
311
  })
312
312
  ```