@atlashub/smartstack-cli 3.4.1 → 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 (46) hide show
  1. package/dist/index.js +160 -5
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +4 -3
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/skills/_shared.md +1 -1
  7. package/templates/skills/application/steps/step-04-backend.md +4 -4
  8. package/templates/skills/application/templates-backend.md +4 -4
  9. package/templates/skills/business-analyse/SKILL.md +26 -15
  10. package/templates/skills/business-analyse/_architecture.md +4 -4
  11. package/templates/skills/business-analyse/_elicitation.md +1 -1
  12. package/templates/skills/business-analyse/_module-loop.md +4 -4
  13. package/templates/skills/business-analyse/html/ba-interactive.html +39 -10
  14. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  15. package/templates/skills/business-analyse/questionnaire.md +2 -2
  16. package/templates/skills/business-analyse/react/components.md +1 -1
  17. package/templates/skills/business-analyse/react/schema.md +1 -1
  18. package/templates/skills/business-analyse/references/html-data-mapping.md +4 -3
  19. package/templates/skills/business-analyse/schemas/feature-schema.json +1 -1
  20. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  21. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +1 -0
  22. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  23. package/templates/skills/business-analyse/steps/step-00-init.md +29 -0
  24. package/templates/skills/business-analyse/steps/step-01-cadrage.md +166 -6
  25. package/templates/skills/business-analyse/steps/step-02-decomposition.md +4 -4
  26. package/templates/skills/business-analyse/steps/{step-03a-specify.md → step-03a-data.md} +10 -359
  27. package/templates/skills/business-analyse/steps/step-03b-ui.md +414 -0
  28. package/templates/skills/business-analyse/steps/step-03c-compile.md +343 -0
  29. package/templates/skills/business-analyse/steps/{step-03b-compile.md → step-03d-validate.md} +26 -308
  30. package/templates/skills/business-analyse/steps/step-04-consolidation.md +2 -2
  31. package/templates/skills/business-analyse/steps/step-05a-handoff.md +49 -292
  32. package/templates/skills/business-analyse/steps/step-05b-mapping.md +302 -0
  33. package/templates/skills/business-analyse/steps/step-05c-deploy.md +296 -0
  34. package/templates/skills/business-analyse/steps/step-05d-html.md +326 -0
  35. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  36. package/templates/skills/business-analyse/templates/tpl-handoff.md +6 -6
  37. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +1 -1
  38. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  39. package/templates/skills/controller/steps/step-03-generate.md +2 -1
  40. package/templates/skills/ralph-loop/SKILL.md +17 -2
  41. package/templates/skills/ralph-loop/references/core-seed-data.md +538 -0
  42. package/templates/skills/ralph-loop/steps/step-00-init.md +2 -0
  43. package/templates/skills/ralph-loop/steps/step-01-task.md +273 -7
  44. package/templates/skills/ralph-loop/steps/step-02-execute.md +39 -15
  45. package/templates/skills/ralph-loop/steps/step-04-check.md +87 -4
  46. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -432
@@ -1,432 +0,0 @@
1
- ---
2
- name: step-05b-deploy
3
- description: Generate prd.json, progress.txt, deploy ba-interactive.html, manifest, user choice
4
- model: sonnet
5
- next_step: null
6
- ---
7
-
8
- > **Context files:** `_shared.md`
9
-
10
- # Step 5b: Handoff - Deploy Artifacts
11
-
12
- ## MANDATORY EXECUTION RULES
13
-
14
- - **ALWAYS** verify all module handoffs are complete before generating artifacts
15
- - **ALWAYS** derive prd.json from feature.json (NEVER independently)
16
- - **NEVER** invent entities/FRs/BRs not in feature.json
17
- - **ALWAYS** deploy ba-interactive.html PRE-POPULATED with all data
18
- - **ALWAYS** update BA manifest at docs/business/index.json
19
-
20
- ## YOUR TASK
21
-
22
- Generate deployment artifacts from the handoff data written in step-05a: prd.json (per module), progress.txt, interactive HTML document, BA manifest, and present development approach choice to the user.
23
-
24
- ---
25
-
26
- ## EXECUTION SEQUENCE
27
-
28
- ### 0. Pre-flight Verification
29
-
30
- Before generating ANY artifact, verify step-05a completed successfully:
31
-
32
- ```
33
- FOR each module in modules[]:
34
- Read module feature.json
35
- IF module.handoff === {} OR module.status !== "handed-off":
36
- → BLOCKING ERROR: Module {module.code} has no handoff data
37
- → Return to step-05a-handoff.md
38
- ```
39
-
40
- IF all modules have valid handoff → proceed.
41
-
42
- ---
43
-
44
- ### 1. Generate prd.json (PROGRAMMATIC)
45
-
46
- > **RULE:** prd.json is extracted by CLI code, **NEVER** generated by LLM.
47
- > The `ss derive-prd` command performs a deterministic data transformation from feature.json.
48
-
49
- **For each module:**
50
-
51
- ```
52
- Execute: ss derive-prd --feature {moduleFeaturePath} --output .ralph/prd-{moduleCode}.json
53
- ```
54
-
55
- **For consolidated view (multi-module, optional):**
56
-
57
- ```
58
- Execute: ss derive-prd --application {masterFeaturePath}
59
- → Generates .ralph/prd-{moduleCode}.json for each module
60
- ```
61
-
62
- **Verification:** After execution, read the generated prd.json and display summary:
63
-
64
- ```
65
- prd.json generated for module {moduleCode}:
66
- - Use cases: {count}
67
- - Functional requirements: {count}
68
- - Business rules: {count}
69
- - API endpoints: {count}
70
- - Sections: {count}
71
- - Files to create: {count}
72
- - BR-to-code mappings: {count}
73
- ```
74
-
75
- **Key guarantees:**
76
- - Source MUST reference feature.json path (traceability)
77
- - All data is EXACT COPY from feature.json (no transformation, no invention)
78
- - prd.json version: "2.0.0"
79
- - source.type: "ba-handoff-programmatic"
80
-
81
- ---
82
-
83
- ### 2. Initialize Progress Tracker
84
-
85
- > **Template:** Read `templates/tpl-progress.md` for the complete progress tracker template structure.
86
- > Populate the template with module-specific data from feature.json handoff sections.
87
-
88
- **Progress Tracker Rules:**
89
- - One section per module, in topological order (dependencies first)
90
- - CORE SeedData ALWAYS 5 entries (mandatory)
91
- - Business SeedData varies by module
92
- - Hierarchical task structure (module -> layer -> tasks)
93
- - Each task is independent, assignable checkbox
94
- - Effort estimate per module (simple/medium/complex)
95
- - Summary with totals across all modules
96
- - Cross-module tasks only if multi-module
97
-
98
- ---
99
-
100
- ### 3. Deploy Interactive HTML Document (MANDATORY)
101
-
102
- > **The interactive HTML document is deployed to the project PRE-POPULATED with ALL analysis data.**
103
- > The client opens it in a browser and sees the complete analysis (cadrage, modules, entities, UCs, BRs, wireframes, permissions, consolidation).
104
- > The client can then review, edit, enrich, and export modifications as JSON.
105
- > That JSON can be re-imported via `/business-analyse -x` to update the feature.json.
106
-
107
- **Source:** `html/ba-interactive.html` (relative to skill root = `~/.claude/skills/business-analyse/html/`)
108
-
109
- **Destination:** `docs/business/{app}/business-analyse/v{version}/ba-interactive.html`
110
-
111
- **Deployment steps:**
112
-
113
- #### Step 1: Read source data
114
-
115
- 1. Read the HTML template from skill directory
116
- 2. Read the master feature.json (application level)
117
- 3. Read EACH module feature.json (module level)
118
-
119
- > **Reference:** Read `references/html-data-mapping.md` for the complete FEATURE_DATA and EMBEDDED_ARTIFACTS mapping specification.
120
-
121
- **Key requirements:**
122
- - FEATURE_DATA must be pre-populated with ALL analysis data (empty data = BUG)
123
- - EMBEDDED_ARTIFACTS contains wireframes, E2E diagrams, dependency graph
124
- - Both objects are serialized as JSON with 2-space indentation
125
- - All data mapped from master and module feature.json files
126
-
127
- #### Step 3: Replace placeholders in template
128
-
129
- 1. Serialize the FEATURE_DATA object as JSON (with 2-space indentation for readability)
130
- 2. Serialize the EMBEDDED_ARTIFACTS object as JSON (with 2-space indentation)
131
- 3. Replace `{{FEATURE_DATA}}` with the serialized FEATURE_DATA JSON
132
- 4. Replace `{{EMBEDDED_ARTIFACTS}}` with the serialized EMBEDDED_ARTIFACTS JSON
133
- 5. Replace `{{APPLICATION_NAME}}` → `{application_name}` (still used in `<title>` and header)
134
- 6. Replace `{{APPLICATION_ID}}` → `{feature_id}` (still used in `APP_KEY`)
135
- 7. Replace `{{VERSION}}` → `{version}`
136
- 8. Replace `{{CREATED_AT}}` → `{ISO timestamp}`
137
-
138
- > **NOTE:** `{{APPLICATION_NAME}}`, `{{APPLICATION_ID}}`, `{{VERSION}}`, `{{CREATED_AT}}` still appear
139
- > in the HTML body (`<title>`, header, `APP_KEY`). They MUST be replaced separately from FEATURE_DATA.
140
-
141
- > **NEW:** `{{EMBEDDED_ARTIFACTS}}` is a separate JavaScript variable in the HTML that stores all visual artifacts (wireframes, E2E diagrams, dependency graph) for client-side rendering and export.
142
-
143
- #### Step 4: Write and confirm
144
-
145
- 1. Write the populated HTML to the output directory
146
- 2. Display deployment confirmation:
147
-
148
- ```
149
- ✓ Interactive HTML deployed:
150
- Path: docs/business/{app}/business-analyse/v{version}/ba-interactive.html
151
- Pre-populated with: {stakeholder_count} stakeholders, {module_count} modules,
152
- {total_uc} use cases, {total_br} business rules, {total_entity} entities
153
- Visual artifacts: {total_wireframes} wireframes, {e2e_flow_count} E2E diagrams
154
- Open in browser to review and edit the business analysis.
155
- Export JSON and re-import with: /business-analyse -x <exported-json-path>
156
- ```
157
-
158
- **Why a FINAL deployment at handoff?**
159
- - Step 03 already deploys the HTML incrementally after each module (partial data)
160
- - This final deployment adds the COMPLETE data: all modules + consolidation + handoff info
161
- - The client sees the FULL analysis pre-populated — including cross-module interactions and E2E flows
162
- - The client can review, edit, and enrich directly in the browser
163
- - Any client modifications can be re-imported via `-x` extraction mode
164
- - The HTML is standalone (no server required) with localStorage persistence
165
- - On first open: pre-populated data displays. After client edits: localStorage overrides
166
- - **NOTE:** This overwrites the incremental HTML from step-03 with the complete version
167
-
168
- ---
169
-
170
- ### 4. Update BA Manifest (MANDATORY)
171
-
172
- > **The BA manifest enables the SmartStack web app to discover and display all available business analyses.**
173
- > It is a JSON index file at `docs/business/index.json` that lists all feature.json files.
174
-
175
- **Path:** `docs/business/index.json` (project root relative)
176
-
177
- **Schema:**
178
- ```json
179
- {
180
- "version": "1.0",
181
- "updatedAt": "{ISO timestamp}",
182
- "analyses": [
183
- {
184
- "appCode": "{app_code}",
185
- "appName": "{application_name}",
186
- "moduleCode": null | "{module_code}",
187
- "moduleName": "{module_name}",
188
- "version": "{version}",
189
- "status": "handed-off",
190
- "featureDescription": "{feature_description}",
191
- "path": "{app_code}/business-analyse/v{version}/feature.json",
192
- "updatedAt": "{ISO timestamp}"
193
- }
194
- ]
195
- }
196
- ```
197
-
198
- **Update logic:**
199
-
200
- 1. Read existing manifest at `docs/business/index.json` (or create empty `{ "version": "1.0", "updatedAt": "", "analyses": [] }`)
201
- 2. For the APPLICATION-level feature.json:
202
- - Find existing entry where `appCode == {app_code}` AND `moduleCode == null` AND `version == {version}`
203
- - If found: update `status`, `updatedAt`, `featureDescription`
204
- - If not found: append new entry with `moduleCode: null` and `path: "{app_code}/business-analyse/v{version}/feature.json"`
205
- 3. For EACH MODULE-level feature.json:
206
- - Find existing entry where `appCode == {app_code}` AND `moduleCode == {module_code}` AND `version == {version}`
207
- - If found: update `status`, `updatedAt`, `featureDescription`
208
- - If not found: append new entry with `moduleCode: "{module_code}"` and `path: "{app_code}/{module_code}/business-analyse/v{version}/feature.json"`
209
- 4. Update root `updatedAt` to current timestamp
210
- 5. Write manifest back to `docs/business/index.json`
211
-
212
- **Display confirmation:**
213
- ```
214
- ✓ BA manifest updated: docs/business/index.json
215
- Entries: {total_count} ({app_count} applications, {module_count} modules)
216
- Web viewer: /system/docs/ba
217
- ```
218
-
219
- **Why a manifest?**
220
- - The web app needs to discover available BAs without scanning the filesystem
221
- - Static file serving (no backend API needed)
222
- - Incremental updates: each handoff adds/updates only its entries
223
- - Consumed by the SmartStack web app BA viewer at `/system/docs/ba`
224
-
225
- ---
226
-
227
- ### 5. Completion Summary
228
-
229
- Display the completion summary after successful handoff:
230
-
231
- > **Reference:** Read `templates/tpl-launch-displays.md` for user-facing display templates.
232
-
233
- ```
234
- ═══════════════════════════════════════════════════════════════
235
- [OK] BUSINESS ANALYSE TERMINEE - {application_name}
236
- ═══════════════════════════════════════════════════════════════
237
-
238
- Modules: {count} ({names})
239
- Strategy: {strategy}
240
- Files: {total files across all modules}
241
- Tasks: {total tasks} ({core_count} CORE + {biz_count} business + {dev_count} development)
242
- Complexity: {complexity}
243
- Effort: {total_days} days ({total_hours} hours)
244
-
245
- [DIR] Artefacts generés:
246
- ✓ feature.json (master + per-module) - spécification complète
247
- ✓ .ralph/prd.json or .ralph/prd-{module}.json - task breakdown
248
- ✓ .ralph/progress.txt - tracker de progression
249
- ✓ ba-interactive.html - document de revue interactif
250
-
251
- [TARGET] Prochaines étapes:
252
- 1. Ouvrir ba-interactive.html dans le navigateur
253
- 2. Partager avec les stakeholders pour validation
254
- 3. Si retours --> relancer /business-analyse pour une nouvelle itération
255
- 4. Une fois validé, lancer le développement:
256
-
257
- /ralph-loop -r
258
-
259
- ═══════════════════════════════════════════════════════════════
260
- ```
261
-
262
- **No AskUserQuestion here.** The BA ends after displaying the summary. The user will manually launch `/ralph-loop -r` when ready (typically after stakeholder validation).
263
-
264
- ---
265
-
266
- ## SELF-VERIFICATION (FINAL)
267
-
268
- Before presenting completion summary, VERIFY:
269
-
270
- 1. **`.ralph/prd-{module}.json`** exists for ALL modules (file size > 100 bytes each)
271
- 2. **`.ralph/progress.txt`** exists (file size > 500 bytes)
272
- 3. **`ba-interactive.html`** exists at `docs/business/{app}/business-analyse/v{version}/` and file size > 100KB (pre-populated, not empty template)
273
- 4. **`docs/business/index.json`** exists with correct entry count (1 app + N modules)
274
-
275
- **IF any check fails → GENERATE the missing artifact before presenting completion summary.**
276
-
277
- ---
278
-
279
- ## MODE SUPPORT
280
-
281
- ### Standard Mode
282
-
283
- Full handoff with all implementation details:
284
- - All 7 file categories
285
- - Complete BR-to-code mapping
286
- - Full API endpoint summary
287
- - Detailed prd.json
288
- - Comprehensive progress tracker
289
-
290
- ### Micro Mode (use_case = micro)
291
-
292
- Simplified handoff with minimal scope:
293
- - Only essential CRUD entity + controller
294
- - 3 core SeedData entries (omit some optional ones)
295
- - Basic prd.json with simplified sections
296
- - Lightweight progress.txt
297
- - Display `/ralph-loop -r` command for later use
298
-
299
- ### Delta Mode (use_case = refactoring)
300
-
301
- Focused handoff for changes:
302
- - Only affected modules listed
303
- - Reuse existing implementation patterns
304
- - Highlight what changed vs baseline
305
- - Update only affected prd.json sections
306
- - Progress tracker shows only delta tasks
307
-
308
- ---
309
-
310
- ## OUTPUT
311
-
312
- > **FORBIDDEN:** Do NOT generate separate JSON files (specification.json, analysis.json, etc.).
313
- > **ONLY:** feature.json is the mandatory JSON deliverable.
314
- > **PLUS:** prd.json and progress.txt are additional working files.
315
-
316
- This step enriches **feature.json** (master + per-module) with:
317
- - **handoff** section: complexity, implementationStrategy, moduleOrder, filesToCreate (7 categories), brToCodeMapping, apiEndpointSummary, prdFiles
318
- - **status:** "handed-off"
319
-
320
- Also generates working files and updates the manifest:
321
-
322
- - **ba-interactive.html** (deployed to docs/business/{app}/business-analyse/v{version}/)
323
- - Standalone interactive HTML document for client review
324
- - Pre-populated with application name, ID, version
325
- - Client can edit, add use cases, modify scope, and export JSON
326
- - Re-importable via `/business-analyse -x <exported-json-path>`
327
-
328
- - **.ralph/prd.json** (or .ralph/prd-{module}.json per module structure)
329
- - Derived entirely from feature.json
330
- - Single source of truth for development team
331
- - Includes all entities, use cases, business rules, API endpoints
332
- - Task breakdown and implementation sequence
333
-
334
- - **.ralph/progress.txt**
335
- - Main development task tracker
336
- - Hierarchical structure (module → layer → tasks)
337
- - Checkboxes for progress tracking
338
- - Effort estimates per module
339
- - Cross-module integration tasks (if multi-module)
340
-
341
- Completion: Display summary with `/ralph-loop -r` command for later execution after stakeholder validation.
342
-
343
- ---
344
-
345
- ## EXAMPLES & TEMPLATES
346
-
347
- ### Example: Simple Single Module (Orders)
348
-
349
- **Feature:** Order Management
350
- **Module:** Orders (1 entity, 2 use cases, 3 BRs)
351
-
352
- **Output:**
353
- - feature.json with handoff section
354
- - .ralph/prd.json (single consolidated file)
355
- - .ralph/progress.txt (~150 lines, 20-30 tasks)
356
-
357
- Strategy: Module by module (only 1 module)
358
-
359
- ### Example: Medium Multi-Module (E-Commerce)
360
-
361
- **Feature:** E-Commerce Platform
362
- **Modules:** Customers (4 entities), Products (6 entities), Orders (8 entities), Invoices (3 entities)
363
-
364
- **Dependencies:**
365
- - Customers: Foundation (no deps)
366
- - Products: Foundation (no deps)
367
- - Orders: Depends on Customers + Products
368
- - Invoices: Depends on Orders
369
-
370
- **Output:**
371
- - feature.json (master + 4 module features) with handoff sections
372
- - User chooses: per-module prd (.ralph/prd-customers.json, .ralph/prd-products.json, etc.) or consolidated (.ralph/prd.json)
373
- - .ralph/progress.txt (~400 lines, 100+ tasks)
374
- - Module order: Customers, Products → Orders → Invoices (topological)
375
-
376
- Strategy options: Module by module (recommended), Layer by layer, Hybrid
377
-
378
- ### Example: Complex Multi-Module (ERP)
379
-
380
- **Feature:** Enterprise Resource Planning
381
- **Modules:** Accounting, Sales, Purchasing, Inventory, HR, Finance (20+ entities total, 50+ use cases, 100+ BRs)
382
-
383
- **Output:**
384
- - feature.json (master + 6 module features) with handoff sections
385
- - Per-module prd.json (recommended for complexity management)
386
- - .ralph/progress.txt (~800+ lines, 200+ tasks)
387
-
388
- Complexity: Complex (highest across all modules)
389
- Strategy: Hybrid recommended (Foundation modules layer-by-layer, then dependent modules module-by-module)
390
-
391
- ---
392
-
393
- ## VALIDATION CHECKLIST
394
-
395
- Before presenting handoff to user:
396
-
397
- - [ ] Status verified: "consolidated"
398
- - [ ] Implementation strategy selected or defaulted
399
- - [ ] Complexity calculated for each module and overall
400
- - [ ] filesToCreate: 7 categories complete, no free text
401
- - [ ] **WIREFRAME TRACEABILITY:** Every frontend Page/DashboardPage has `linkedWireframes[]` referencing specification.uiWireframes[].screen
402
- - [ ] **WIREFRAME ACCEPTANCE:** Every frontend Page/DashboardPage has `wireframeAcceptanceCriteria` describing expected layout
403
- - [ ] brToCodeMapping: All business rules from analysis.businessRules[] mapped
404
- - [ ] apiEndpointSummary: Exact copy from specification.apiEndpoints[]
405
- - [ ] prd.json: Derived from feature.json, not independently generated
406
- - [ ] prd.json: Includes all UCs, FRs, BRs, entities, API endpoints from source
407
- - [ ] progress.txt: Hierarchical, all modules in topological order, 5 CORE SeedData per module
408
- - [ ] progress.txt: Frontend tasks reference wireframe identifiers [wireframe: {screen}]
409
- - [ ] Module order: Follows topological dependency graph
410
- - [ ] feature.json updated: handoff section + status "handed-off"
411
- - [ ] All paths use project namespace from .smartstack/config.json
412
- - [ ] No invented requirements (everything traced to feature.json)
413
- - [ ] ba-interactive.html deployed PRE-POPULATED with all analysis data (not empty)
414
- - [ ] BA manifest (docs/business/index.json) updated with current analysis entries
415
- - [ ] User ready for next agent selection
416
-
417
- ---
418
-
419
- ## TROUBLESHOOTING
420
-
421
- | Issue | Resolution |
422
- |-------|-----------|
423
- | All modules missing handoff data | Return to step-05a-handoff.md. Handoff MUST be written to each module feature.json. |
424
- | prd.json generation failed | Verify ss derive-prd command is installed and feature.json path is correct. |
425
- | progress.txt incomplete | Ensure all 5 CORE SeedData entries are present per module. Check topological order. |
426
- | ba-interactive.html deployment failed | Verify output directory exists. Check file permissions. Ensure HTML template is readable. |
427
- | BA manifest not found | Create docs/business/index.json if missing. Use schema provided in section 4. |
428
- | HTML pre-populated but empty | Verify FEATURE_DATA and EMBEDDED_ARTIFACTS objects are serialized correctly. Check JSON syntax. |
429
-
430
- ---
431
-
432
- END OF STEP 5b: DEPLOY ARTIFACTS