@atlashub/smartstack-cli 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/index.js +13 -0
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/skills/business-analyse/SKILL.md +26 -15
  5. package/templates/skills/business-analyse/_architecture.md +1 -1
  6. package/templates/skills/business-analyse/_elicitation.md +1 -1
  7. package/templates/skills/business-analyse/_module-loop.md +4 -4
  8. package/templates/skills/business-analyse/html/ba-interactive.html +39 -10
  9. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  10. package/templates/skills/business-analyse/questionnaire.md +2 -2
  11. package/templates/skills/business-analyse/react/components.md +1 -1
  12. package/templates/skills/business-analyse/react/schema.md +1 -1
  13. package/templates/skills/business-analyse/references/html-data-mapping.md +4 -3
  14. package/templates/skills/business-analyse/schemas/feature-schema.json +1 -1
  15. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  16. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +1 -0
  17. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  18. package/templates/skills/business-analyse/steps/step-00-init.md +29 -0
  19. package/templates/skills/business-analyse/steps/step-01-cadrage.md +166 -6
  20. package/templates/skills/business-analyse/steps/step-02-decomposition.md +4 -4
  21. package/templates/skills/business-analyse/steps/{step-03a-specify.md → step-03a-data.md} +10 -359
  22. package/templates/skills/business-analyse/steps/step-03b-ui.md +414 -0
  23. package/templates/skills/business-analyse/steps/step-03c-compile.md +343 -0
  24. package/templates/skills/business-analyse/steps/{step-03b-compile.md → step-03d-validate.md} +26 -308
  25. package/templates/skills/business-analyse/steps/step-04-consolidation.md +2 -2
  26. package/templates/skills/business-analyse/steps/step-05a-handoff.md +49 -292
  27. package/templates/skills/business-analyse/steps/step-05b-mapping.md +302 -0
  28. package/templates/skills/business-analyse/steps/step-05c-deploy.md +296 -0
  29. package/templates/skills/business-analyse/steps/step-05d-html.md +326 -0
  30. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  31. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +1 -1
  32. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  33. package/templates/skills/controller/steps/step-03-generate.md +2 -1
  34. package/templates/skills/ralph-loop/SKILL.md +17 -2
  35. package/templates/skills/ralph-loop/references/core-seed-data.md +538 -0
  36. package/templates/skills/ralph-loop/steps/step-00-init.md +2 -0
  37. package/templates/skills/ralph-loop/steps/step-01-task.md +25 -2
  38. package/templates/skills/ralph-loop/steps/step-02-execute.md +39 -15
  39. package/templates/skills/ralph-loop/steps/step-04-check.md +87 -4
  40. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -475
@@ -0,0 +1,326 @@
1
+ ---
2
+ name: step-05d-html
3
+ description: Deploy ba-interactive.html pre-populated with all analysis data
4
+ model: sonnet
5
+ next_step: null
6
+ ---
7
+
8
+ > **Context files:** `_shared.md`
9
+
10
+ # Step 5d: Deploy Interactive HTML
11
+
12
+ ## MANDATORY EXECUTION RULES
13
+
14
+ - **ALWAYS** deploy ba-interactive.html PRE-POPULATED with all data
15
+ - **ALWAYS** follow references/html-data-mapping.md EXACTLY for FEATURE_DATA and EMBEDDED_ARTIFACTS mapping
16
+ - **FEATURE_DATA.moduleSpecs MUST be populated for EACH module** — empty moduleSpecs = BROKEN specification tabs
17
+ - **FEATURE_DATA.cadrage.scope must use HTML keys** (vital/important/optional/excluded) NOT feature.json keys (mustHave/shouldHave/couldHave/outOfScope)
18
+ - **FEATURE_DATA.metadata.vibeCoding must be set** from master.metadata.vibeCoding (controls section visibility)
19
+ - **NEVER leave FEATURE_DATA or EMBEDDED_ARTIFACTS empty or partial**
20
+
21
+ ## YOUR TASK
22
+
23
+ Deploy the interactive HTML document pre-populated with ALL analysis data. This is the final step of the business analysis workflow. The HTML is the client-facing deliverable for review and can be edited, enriched, and re-imported.
24
+
25
+ ---
26
+
27
+ ## EXECUTION SEQUENCE
28
+
29
+ ### 1. Read Source Data
30
+
31
+ 1. Read the HTML template from skill directory: `html/ba-interactive.html` (relative to `~/.claude/skills/business-analyse/`)
32
+ 2. Read the master feature.json (application level)
33
+ 3. Read EACH module feature.json (module level)
34
+
35
+ > **Reference:** Read `references/html-data-mapping.md` for the complete FEATURE_DATA and EMBEDDED_ARTIFACTS mapping specification.
36
+
37
+ **Key requirements:**
38
+ - FEATURE_DATA must be pre-populated with ALL analysis data (empty data = BUG)
39
+ - FEATURE_DATA.**moduleSpecs** MUST be populated for EACH module (use cases, business rules, entities, permissions) — empty moduleSpecs = BROKEN specification tabs
40
+ - FEATURE_DATA.**cadrage.scope** must use HTML keys (vital/important/optional/excluded) NOT feature.json keys (mustHave/shouldHave/couldHave/outOfScope)
41
+ - FEATURE_DATA.**metadata.vibeCoding** must be set from `master.metadata.vibeCoding` (controls section visibility)
42
+ - EMBEDDED_ARTIFACTS contains wireframes, E2E diagrams, dependency graph
43
+ - Both objects are serialized as JSON with 2-space indentation
44
+ - All data mapped from master and module feature.json files — follow `html-data-mapping.md` EXACTLY
45
+
46
+ ---
47
+
48
+ ### 2. Build FEATURE_DATA Object
49
+
50
+ Reference `references/html-data-mapping.md` EXACTLY. The FEATURE_DATA object must contain:
51
+
52
+ **Structure:**
53
+ ```javascript
54
+ const FEATURE_DATA = {
55
+ metadata: {
56
+ applicationName: master.application_name,
57
+ applicationId: master.feature_id,
58
+ version: master.version,
59
+ createdAt: ISO_TIMESTAMP,
60
+ vibeCoding: master.metadata.vibeCoding // "enabled" or "disabled" — controls UI section visibility
61
+ },
62
+ cadrage: {
63
+ goal: master.cadrage.goal,
64
+ vision: master.cadrage.vision,
65
+ success_criteria: master.cadrage.success_criteria,
66
+ scope: {
67
+ // CONVERT feature.json keys to HTML keys:
68
+ // mustHave → vital
69
+ // shouldHave → important
70
+ // couldHave → optional
71
+ // outOfScope → excluded
72
+ vital: master.globalScope.mustHave || [],
73
+ important: master.globalScope.shouldHave || [],
74
+ optional: master.globalScope.couldHave || [],
75
+ excluded: master.globalScope.outOfScope || []
76
+ },
77
+ constraints: master.cadrage.constraints || [],
78
+ risks: master.cadrage.risks || [],
79
+ stakeholders: master.stakeholders || []
80
+ },
81
+ modules: [
82
+ {
83
+ moduleCode: module.code,
84
+ moduleName: module.name,
85
+ moduleDescription: module.description || "",
86
+ // ... per-module fields from feature.json
87
+ }
88
+ ],
89
+ moduleSpecs: {
90
+ // CRITICAL: Must have ONE entry per module with ALL module data
91
+ // Each entry keyed by moduleCode:
92
+ "{moduleCode}": {
93
+ useCases: module.specification.useCases || [],
94
+ businessRules: module.analysis.businessRules || [],
95
+ entities: module.analysis.entities || [],
96
+ permissions: module.specification.permissions || [],
97
+ apiEndpoints: module.specification.apiEndpoints || []
98
+ }
99
+ },
100
+ consolidation: {
101
+ // Cross-module analysis
102
+ integrations: master.consolidation.integrations || [],
103
+ sharedEntities: master.consolidation.sharedEntities || [],
104
+ sequenceDiagrams: master.consolidation.e2eFlows || []
105
+ },
106
+ handoff: {
107
+ // From feature.json handoff section
108
+ complexity: master.handoff.complexity,
109
+ implementationStrategy: master.handoff.implementationStrategy,
110
+ moduleOrder: master.handoff.moduleOrder,
111
+ filesToCreate: master.handoff.filesToCreate,
112
+ brToCodeMapping: master.handoff.brToCodeMapping,
113
+ apiEndpointSummary: master.handoff.apiEndpointSummary
114
+ }
115
+ };
116
+ ```
117
+
118
+ **Build process:**
119
+ 1. Extract metadata from master feature.json
120
+ 2. Extract cadrage from master feature.json (CONVERT scope keys)
121
+ 3. Extract stakeholders from master.stakeholders
122
+ 4. Iterate ALL modules and populate moduleSpecs (THIS IS CRITICAL — empty moduleSpecs = BUG)
123
+ 5. For EACH module, extract:
124
+ - Use cases from specification.useCases
125
+ - Business rules from analysis.businessRules
126
+ - Entities from analysis.entities
127
+ - Permissions from specification.permissions
128
+ - API endpoints from specification.apiEndpoints
129
+ 6. Extract consolidation data (integrations, shared entities, E2E flows)
130
+ 7. Extract handoff section (complexity, strategy, module order, file counts)
131
+
132
+ ---
133
+
134
+ ### 3. Build EMBEDDED_ARTIFACTS Object
135
+
136
+ Extract visual artifacts and diagrams from the analysis:
137
+
138
+ ```javascript
139
+ const EMBEDDED_ARTIFACTS = {
140
+ wireframes: [
141
+ // Extract from each module's specification.uiWireframes
142
+ {
143
+ moduleCode: "{moduleCode}",
144
+ screen: wireframe.screen,
145
+ description: wireframe.description,
146
+ layout: wireframe.layout || "responsive",
147
+ components: wireframe.components || []
148
+ }
149
+ ],
150
+ e2eFlows: [
151
+ // Extract from master consolidation.e2eFlows
152
+ {
153
+ flowName: flow.name,
154
+ description: flow.description,
155
+ sequence: flow.sequence || [],
156
+ modules: flow.modules || []
157
+ }
158
+ ],
159
+ dependencyGraph: {
160
+ // From master consolidation.dependencyGraph
161
+ nodes: master.consolidation.dependencyGraph?.nodes || [],
162
+ edges: master.consolidation.dependencyGraph?.edges || []
163
+ }
164
+ };
165
+ ```
166
+
167
+ **Artifact gathering:**
168
+ 1. Read each module's `specification.uiWireframes[]` and add to wireframes array
169
+ 2. Read master's `consolidation.e2eFlows[]` and add to e2eFlows array
170
+ 3. Read master's `consolidation.dependencyGraph` and include as-is
171
+ 4. Serialize as JSON with 2-space indentation
172
+
173
+ ---
174
+
175
+ ### 4. Replace Placeholders in Template
176
+
177
+ 1. Serialize the FEATURE_DATA object as JSON (with 2-space indentation)
178
+ 2. Serialize the EMBEDDED_ARTIFACTS object as JSON (with 2-space indentation)
179
+ 3. Replace `{{FEATURE_DATA}}` with the serialized FEATURE_DATA JSON
180
+ 4. Replace `{{EMBEDDED_ARTIFACTS}}` with the serialized EMBEDDED_ARTIFACTS JSON
181
+ 5. Replace `{{APPLICATION_NAME}}` with `{application_name}`
182
+ 6. Replace `{{APPLICATION_ID}}` with `{feature_id}`
183
+ 7. Replace `{{VERSION}}` with `{version}`
184
+ 8. Replace `{{CREATED_AT}}` with `{ISO timestamp}`
185
+
186
+ **Verification during replacement:**
187
+ - Ensure FEATURE_DATA JSON is valid (no trailing commas, proper nesting)
188
+ - Ensure EMBEDDED_ARTIFACTS JSON is valid
189
+ - Verify placeholders are completely replaced (grep for `{{` to confirm)
190
+
191
+ ---
192
+
193
+ ### 5. Write and Verify
194
+
195
+ 1. Write the populated HTML to the output directory: `docs/business/{app}/business-analyse/v{version}/ba-interactive.html`
196
+ 2. Display deployment confirmation:
197
+
198
+ ```
199
+ [OK] Interactive HTML deployed:
200
+ Path: docs/business/{app}/business-analyse/v{version}/ba-interactive.html
201
+ Pre-populated with: {stakeholder_count} stakeholders, {module_count} modules,
202
+ {total_uc} use cases, {total_br} business rules, {total_entity} entities
203
+ Visual artifacts: {total_wireframes} wireframes, {e2e_flow_count} E2E diagrams
204
+ Open in browser to review and edit the business analysis.
205
+ Export JSON and re-import with: /business-analyse -x <exported-json-path>
206
+ ```
207
+
208
+ ---
209
+
210
+ ## POST-CHECK (BLOCKING)
211
+
212
+ After writing the HTML file, verify:
213
+
214
+ 1. **File size > 100KB** (indicates pre-populated, not empty template)
215
+ ```bash
216
+ file_size=$(stat --format=%s "{output_path}/ba-interactive.html")
217
+ if [ $file_size -lt 100000 ]; then
218
+ BLOCKING_ERROR("ba-interactive.html is only ${file_size} bytes — not pre-populated")
219
+ fi
220
+ ```
221
+
222
+ 2. **Grep for "moduleSpecs"** — MUST be present in generated HTML
223
+ ```bash
224
+ if ! grep -q '"moduleSpecs"' "{output_path}/ba-interactive.html"; then
225
+ BLOCKING_ERROR("moduleSpecs not found in HTML — FEATURE_DATA not serialized correctly")
226
+ fi
227
+ ```
228
+
229
+ 3. **moduleSpecs must have entries for ALL modules** (not empty object `{}`)
230
+ ```bash
231
+ # Count moduleSpecs entries — should equal module count
232
+ moduleSpec_count=$(grep -o '"moduleCode"' "{output_path}/ba-interactive.html" | wc -l)
233
+ if [ $moduleSpec_count -lt {module_count} ]; then
234
+ BLOCKING_ERROR("moduleSpecs has only ${moduleSpec_count} entries but need {module_count}")
235
+ fi
236
+ ```
237
+
238
+ 4. **cadrage.scope must use HTML keys** (vital/important/optional/excluded)
239
+ ```bash
240
+ if grep -q '"mustHave"' "{output_path}/ba-interactive.html"; then
241
+ BLOCKING_ERROR("cadrage.scope still has feature.json keys (mustHave) — must convert to HTML keys (vital)")
242
+ fi
243
+ ```
244
+
245
+ **IF ANY CHECK FAILS → DO NOT PROCEED. Fix the data mapping and regenerate.**
246
+
247
+ ---
248
+
249
+ ## SELF-VERIFICATION (FINAL)
250
+
251
+ Before completion, verify:
252
+
253
+ 1. **ba-interactive.html exists** at `docs/business/{app}/business-analyse/v{version}/` and file size > 100KB
254
+ 2. **FEATURE_DATA contains moduleSpecs** with entries for ALL modules (grep for `"moduleSpecs"` — if absent, the specification tabs will be broken)
255
+ 3. **cadrage.scope uses HTML keys** (vital/important/optional/excluded) — NOT feature.json keys
256
+ 4. **EMBEDDED_ARTIFACTS contains wireframes** for all modules with screen names and descriptions
257
+ 5. **All 5 metadata fields populated:** applicationName, applicationId, version, createdAt, vibeCoding
258
+
259
+ **IF any check fails → REGENERATE the HTML immediately.**
260
+
261
+ ---
262
+
263
+ ## WHY A FINAL HTML DEPLOYMENT AT HANDOFF?
264
+
265
+ - Step 03 already deploys the HTML incrementally after each module (partial data)
266
+ - This final deployment adds the COMPLETE data: all modules + consolidation + handoff info
267
+ - The client sees the FULL analysis pre-populated — including cross-module interactions and E2E flows
268
+ - The client can review, edit, and enrich directly in the browser
269
+ - Any client modifications can be re-imported via `-x` extraction mode
270
+ - The HTML is standalone (no server required) with localStorage persistence
271
+ - On first open: pre-populated data displays. After client edits: localStorage overrides
272
+ - **NOTE:** This overwrites the incremental HTML from step-03 with the complete version
273
+
274
+ ---
275
+
276
+ ## OUTPUT
277
+
278
+ The final deliverable:
279
+
280
+ - **ba-interactive.html** (deployed to docs/business/{app}/business-analyse/v{version}/)
281
+ - Standalone interactive HTML document for client review
282
+ - Pre-populated with ALL analysis data (metadata, cadrage, modules, wireframes, E2E flows)
283
+ - FEATURE_DATA and EMBEDDED_ARTIFACTS fully serialized as JSON variables
284
+ - Client can edit, add use cases, modify scope, and export JSON
285
+ - Re-importable via `/business-analyse -x <exported-json-path>`
286
+
287
+ ---
288
+
289
+ ## TROUBLESHOOTING
290
+
291
+ | Issue | Resolution |
292
+ |-------|-----------|
293
+ | ba-interactive.html is too small (< 100KB) | FEATURE_DATA not serialized correctly. Verify JSON structure. Re-run FEATURE_DATA build. |
294
+ | moduleSpecs missing from HTML | FEATURE_DATA.moduleSpecs is empty or not included in JSON. Verify each module is iterated and populated. |
295
+ | Scope keys still show "mustHave" instead of "vital" | Conversion from feature.json keys to HTML keys failed. Check cadrage.scope conversion logic. |
296
+ | Wireframes array is empty | Verify each module has specification.uiWireframes. If missing, add wireframe stubs. |
297
+ | dependencyGraph missing | Verify master feature.json has consolidation.dependencyGraph. If missing, create empty nodes/edges arrays. |
298
+ | HTML opens but data blank (localStorage issue) | Clear browser localStorage. HTML will load pre-populated FEATURE_DATA on first load. |
299
+ | Export/re-import fails | Verify exported JSON matches original feature.json schema. Validate with `/business-analyse -x --validate`. |
300
+
301
+ ---
302
+
303
+ ## FINAL COMPLETION
304
+
305
+ ```
306
+ ═══════════════════════════════════════════════════════════════
307
+ BUSINESS ANALYSE COMPLETE
308
+ ═══════════════════════════════════════════════════════════════
309
+
310
+ All artifacts deployed:
311
+ ✓ feature.json (master + per-module)
312
+ ✓ prd.json (module-level task breakdown)
313
+ ✓ progress.txt (development tracker)
314
+ ✓ ba-interactive.html (client-facing review document)
315
+
316
+ Next steps:
317
+ 1. Share ba-interactive.html with stakeholders
318
+ 2. Gather feedback and edits
319
+ 3. Export modified JSON from HTML
320
+ 4. Re-import with: /business-analyse -x <exported-json-path>
321
+ 5. Launch development: /ralph-loop -r
322
+
323
+ ═══════════════════════════════════════════════════════════════
324
+ ```
325
+
326
+ **Business analysis is now complete. The HTML document is ready for client review.**
@@ -1,7 +1,7 @@
1
1
  # Template Functional Requirements Document
2
2
 
3
3
  > **Usage:** Template for 3-functional-specification.md
4
- > **Loaded in:** step-03a-specify.md
4
+ > **Loaded in:** step-03a-data.md
5
5
 
6
6
  ---
7
7
 
@@ -1,6 +1,6 @@
1
1
  # Skill Launch Display Templates (templates/tpl-launch-displays.md)
2
2
 
3
- > **Used by:** step-05b-deploy (section 5: Completion Summary)
3
+ > **Used by:** step-05c-deploy (section 5: Completion Summary)
4
4
  > **Purpose:** User-facing display templates for BA completion
5
5
  > **Note:** No emojis - uses text markers per Claude Code conventions
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Progress Tracker Template (templates/tpl-progress.md)
2
2
 
3
- > **Used by:** step-05b-deploy (section 2: Initialize Progress Tracker)
3
+ > **Used by:** step-05c-deploy (section 2: Initialize Progress Tracker)
4
4
  > **Purpose:** Template structure for .ralph/progress.txt - populate with module-specific data
5
5
 
6
6
  ## Template
@@ -33,8 +33,9 @@ Read: templates/templates.md
33
33
 
34
34
  **Target path:**
35
35
  ```
36
- src/SmartStack.Api/Controllers/{area}/{module}Controller.cs
36
+ src/SmartStack.Api/Controllers/{ContextShort}/{Application}/{entity}Controller.cs
37
37
  ```
38
+ > Context mapping: `business` → `Business`, `platform` → `Admin`, `personal` → `User`
38
39
 
39
40
  **Apply template with variables:**
40
41
 
@@ -311,6 +311,12 @@ Before ANY work, verify MCP servers:
311
311
  | 04 | `steps/step-04-check.md` | Check completion, decide next action |
312
312
  | 05 | `steps/step-05-report.md` | Generate final report |
313
313
 
314
+ **Reference files (loaded conditionally):**
315
+
316
+ | Ref | File | Loaded when |
317
+ |-----|------|-------------|
318
+ | - | `references/core-seed-data.md` | Infrastructure task involves seed data or IClientSeedDataProvider |
319
+
314
320
  </step_files>
315
321
 
316
322
  <file_structure>
@@ -402,14 +408,23 @@ Before ANY work, verify MCP servers:
402
408
 
403
409
  <execution_rules>
404
410
 
411
+ - **NEVER DELEGATE THE LOOP** - The Ralph loop MUST execute in the MAIN agent context. NEVER use the Task tool to spawn a sub-agent for loop execution. Sub-agents lose ALL skill context (step files, COMPACT LOOP logic, MCP requirements, SmartStack conventions) and WILL stop prematurely. This is FORBIDDEN. The only acceptable use of Task is for isolated read-only research (e.g., looking up documentation via Context7).
405
412
  - **Load step files ONCE** - Step files are read only on FIRST iteration. After that, use the COMPACT LOOP in step-04 section 5.
406
413
  - **VERIFY MCP FIRST** - Never skip MCP validation at init
407
414
  - **BATCH same-category tasks** - Execute up to 5 tasks of the same category per iteration (reduces loop iterations from 30+ to ~8)
408
415
  - **COMMIT AFTER EACH BATCH** - One commit per batch, not per individual task
409
416
  - **UPDATE progress.txt** - Persist learnings
410
417
  - **NEVER fake completion** - Only output promise when truly done
411
- - **NEVER STOP THE LOOP** - The loop is AUTONOMOUS. DO NOT pause between iterations. DO NOT wait for user input. Only stop on: completion, max iterations, dead-end, or explicit user interruption. Stopping for any other reason wastes context and causes re-reads.
412
- - **COMPACT OUTPUT** - During loop iterations, use 1-2 lines per task. Save verbose output for the final report.
418
+ - **NEVER STOP THE LOOP** - The loop is AUTONOMOUS. Stopping is a BUG. Specifically FORBIDDEN:
419
+ - DO NOT pause between iterations
420
+ - DO NOT wait for user input
421
+ - DO NOT output a summary and stop ("I'll continue later")
422
+ - DO NOT decide to stop because "quality over quantity" or "this is enough for now"
423
+ - DO NOT stop after completing one module when others remain in the queue
424
+ - DO NOT reduce scope autonomously ("I'll skip frontend/tests to save time")
425
+ - The ONLY valid stop reasons: ALL tasks complete, max iterations reached, dead-end (all remaining blocked/failed), or explicit user interruption via Ctrl+C
426
+ - **CONTEXT BUDGET** - Keep ALL output COMPACT during loop iterations. Verbose reasoning wastes context tokens and causes premature termination. Use 1-2 lines per task during the loop. Save detailed output for the final report ONLY. During init, skip verbose MCP output and keep summaries minimal.
427
+ - **MODULE COMPLETENESS** - A module is NOT complete unless ALL expected layers have completed tasks: domain, infrastructure, application, api, frontend, i18n, test. If any layer is missing, inject guardrail tasks before advancing to the next module.
413
428
  </execution_rules>
414
429
 
415
430
  <success_criteria>