@atlashub/smartstack-cli 2.1.0 → 2.3.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 (38) hide show
  1. package/.documentation/business-analyse.html +1503 -1058
  2. package/dist/index.js +92 -55
  3. package/dist/index.js.map +1 -1
  4. package/package.json +10 -7
  5. package/templates/agents/ba-reader.md +250 -0
  6. package/templates/agents/ba-writer.md +210 -0
  7. package/templates/agents/docs-context-reader.md +51 -33
  8. package/templates/skills/_shared.md +2 -0
  9. package/templates/skills/business-analyse/SKILL.md +120 -108
  10. package/templates/skills/business-analyse/_shared.md +136 -146
  11. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +478 -0
  12. package/templates/skills/business-analyse/questionnaire/01-context.md +3 -15
  13. package/templates/skills/business-analyse/questionnaire/03-scope.md +7 -7
  14. package/templates/skills/business-analyse/questionnaire/08-performance.md +7 -21
  15. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -13
  16. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -13
  17. package/templates/skills/business-analyse/questionnaire/12-migration.md +1 -1
  18. package/templates/skills/business-analyse/questionnaire.md +72 -76
  19. package/templates/skills/business-analyse/react/components.md +317 -154
  20. package/templates/skills/business-analyse/react/i18n-template.md +167 -106
  21. package/templates/skills/business-analyse/react/schema.md +474 -107
  22. package/templates/skills/business-analyse/schemas/feature-schema.json +860 -0
  23. package/templates/skills/business-analyse/steps/step-00-init.md +395 -285
  24. package/templates/skills/business-analyse/steps/step-01-analyse.md +523 -0
  25. package/templates/skills/business-analyse/steps/step-02-specify.md +899 -0
  26. package/templates/skills/business-analyse/steps/step-03-validate.md +1009 -0
  27. package/templates/skills/business-analyse/steps/step-04-handoff.md +1802 -0
  28. package/templates/skills/business-analyse/templates/tpl-handoff.md +49 -64
  29. package/templates/skills/business-analyse/steps/step-01-discover.md +0 -737
  30. package/templates/skills/business-analyse/steps/step-02-analyse.md +0 -299
  31. package/templates/skills/business-analyse/steps/step-03-specify.md +0 -472
  32. package/templates/skills/business-analyse/steps/step-04-validate.md +0 -335
  33. package/templates/skills/business-analyse/steps/step-05-handoff.md +0 -741
  34. package/templates/skills/business-analyse/steps/step-06-doc-html.md +0 -320
  35. package/templates/skills/business-analyse/templates/00-context.md +0 -105
  36. package/templates/skills/business-analyse/templates/tpl-brd.md +0 -97
  37. package/templates/skills/business-analyse/templates/tpl-discovery.md +0 -78
  38. package/templates/skills/business-analyse/tracking/change-template.md +0 -30
@@ -1,36 +1,85 @@
1
- # Business Analysis - Shared Functions (v2 - Progressive Loading)
1
+ # Business Analysis - Shared Functions (v3 - JSON-First Progressive Loading)
2
2
 
3
3
  > **Ref:** This file contains common functions for all BA phases.
4
- > **Version:** 2.0 - Optimized for progressive loading
4
+ > **Version:** 3.0 - JSON-First architecture with progressive loading
5
5
 
6
6
  ---
7
7
 
8
8
  ## Architecture Progressive
9
9
 
10
- Le skill BusinessAnalyse utilise le **chargement progressif** pour minimiser le contexte:
10
+ The BusinessAnalyse skill uses **progressive loading** to minimize context:
11
11
 
12
12
  ```
13
- SKILL.md (entry point)
13
+ SKILL.md (entry point) → routes to use case
14
14
 
15
- steps/step-00-init.md (parse flags, create state)
15
+ steps/step-00-init.md (parse flags, create feature.json via ba-writer)
16
16
 
17
- steps/step-01-discover.md (charge questionnaire/XX.md on-demand)
17
+ steps/step-01-analyse.md (merged discovery+BRD, loads questionnaire/*.md)
18
18
 
19
- steps/step-02-analyse.md (charge templates/tpl-brd.md)
19
+ steps/step-02-specify.md (FRD + use cases + permissions)
20
20
 
21
- steps/step-03-specify.md (charge templates/tpl-frd.md)
21
+ steps/step-03-validate.md (validation gate)
22
22
 
23
- steps/step-04-validate.md (validation gate)
24
-
25
- steps/step-05-handoff.md (charge templates/tpl-handoff.md)
26
-
27
- steps/step-06-doc-html.md (charge react/*.md on-demand)
23
+ steps/step-04-handoff.md (generates ralph prd.json)
28
24
  ```
29
25
 
26
+ **No digest files needed** — each step reads/writes `feature.json` directly via `ba-writer` and `ba-reader` agents.
27
+
30
28
  **Benefit:** ~70% context reduction per phase
31
29
 
32
30
  ---
33
31
 
32
+ ## JSON-First Architecture
33
+
34
+ All BA outputs are stored in a single `feature.json` file, enriched progressively:
35
+
36
+ | Step | Section enriched | Status after |
37
+ |------|-----------------|--------------|
38
+ | 00-init | metadata | draft |
39
+ | 01-analyse | discovery + analysis + suggestions | analysed |
40
+ | 02-specify | specification | specified |
41
+ | 03-validate | validation | approved |
42
+ | 04-handoff | handoff | handed-off |
43
+
44
+ **Agents:**
45
+ - **ba-writer**: Writes/updates feature.json (create, enrichSection, updateStatus, createVersion)
46
+ - **ba-reader**: Reads feature.json (findFeature, readSection, answerQuestion, getSummaryForSkill)
47
+
48
+ **Schema:** `schemas/feature-schema.json`
49
+
50
+ **Cross-references in JSON:**
51
+ - `specification.useCases[].linkedRules` → `analysis.businessRules[].id`
52
+ - `specification.functionalRequirements[].linkedUseCases` → `specification.useCases[].id`
53
+ - `specification.functionalRequirements[].linkedRules` → `analysis.businessRules[].id`
54
+ - `handoff.brToCodeMapping[].ruleId` → `analysis.businessRules[].id`
55
+
56
+ ---
57
+
58
+ ## Use Case Routing
59
+
60
+ | Flag | Use Case | Workflow |
61
+ |------|----------|---------|
62
+ | (none) | New feature | step-00 → step-01 → step-02 → step-03 → step-04 |
63
+ | `-q FEAT-ID "question"` | Question | ba-reader.answerQuestion → EXIT |
64
+ | `-r FEAT-ID "change"` | Refactoring | ba-writer.createVersion → step-01 (delta) → step-02 → step-03 → step-04 |
65
+ | `-m` | Micro-feature | step-00 (minimal) → step-01 (micro) → step-02 (minimal) → step-03 (auto) → step-04 (simplified) |
66
+
67
+ ### Delta Mode (Refactoring)
68
+ - ba-reader loads existing feature.json
69
+ - ba-writer creates new version folder (v{X.Y+1})
70
+ - step-01 only asks questions about the CHANGE, not the entire module
71
+ - step-02 only adds/modifies affected UCs, FRs, permissions
72
+ - Existing data preserved, only delta applied
73
+
74
+ ### Micro Mode
75
+ - Questions: entity, fields, values, who can change (4-6 questions max)
76
+ - step-01: simplified analysis (no ULTRATHINK, no proactive suggestions)
77
+ - step-02: minimal specification (1-2 UCs, standard CRUD)
78
+ - step-03: auto-validation (structural check only)
79
+ - step-04: simplified handoff
80
+
81
+ ---
82
+
34
83
  ## Business Context Validation
35
84
 
36
85
  ```
@@ -166,29 +215,21 @@ Route pattern : `/business/{application}/{module}/{section}`
166
215
  ## Feature Directory Structure
167
216
 
168
217
  ```
169
- .business-analyse/
170
- ├── config.json # Global config
171
- └── business/
172
- └── {application}/
173
- └── modules/
174
- └── {module}/
175
- └── features/
176
- └── {FEAT-NNN}/
177
- ├── 00-context.md # State persistence
178
- ├── 1-discovery.md
179
- ├── 2-business-requirements.md
180
- ├── 3-functional-specification.md
181
- ├── validation.json
182
- ├── 4-development-handoff.md
183
- └── tracking/
184
- ├── changes/
185
- │ └── CHANGE-NNN.md
186
- ├── bugs/
187
- ├── hotfixes/
188
- └── docs-manifest-entry.json
218
+ docs/
219
+ ├── business/
220
+ └── {application}/
221
+ └── {module}/
222
+ │ ├── business-analyse/
223
+ │ │ ├── v1.0/
224
+ │ │ │ └── feature.json
225
+ │ │ └── v1.1/
226
+ │ │ └── feature.json
227
+ │ └── user-guide/ ← post-development (separate skill)
228
+ │ └── v1.0/
229
+ │ └── guide.json
189
230
  ```
190
231
 
191
- **Ralph Loop Integration (generated by step-05):**
232
+ **Ralph Loop Integration (generated by step-04):**
192
233
 
193
234
  ```
194
235
  .ralph/
@@ -198,7 +239,7 @@ Route pattern : `/business/{application}/{module}/{section}`
198
239
  └── reports/
199
240
  ```
200
241
 
201
- > **Note:** `.ralph/prd.json` is generated by step-05-handoff from the file mapping, business rules, and test requirements. It provides an atomic task list following the SmartStack layer order (Domain -> Application -> Infrastructure -> API -> Frontend -> i18n -> Tests -> Validation).
242
+ > **Note:** `.ralph/prd.json` is generated by step-04-handoff from the feature.json mapping, business rules, and test requirements. It provides an atomic task list following the SmartStack layer order (Domain Application Infrastructure API Frontend i18n Tests Validation).
202
243
 
203
244
  ---
204
245
 
@@ -219,12 +260,10 @@ generate_feature_id():
219
260
  | Step | Model | Reason |
220
261
  |------|-------|--------|
221
262
  | 00-init | Haiku | Quick structure setup |
222
- | 01-discover | **Opus** | ULTRATHINK elicitation |
223
- | 02-analyse | Sonnet | BRD modeling |
224
- | 03-specify | Sonnet | FRD + Use Cases |
225
- | 04-validate | Haiku | Binary gate |
226
- | 05-handoff | **Opus** | Zero-ambiguity prompt |
227
- | 06-doc-html | Sonnet | React + Context7 |
263
+ | 01-analyse | **Opus** | ULTRATHINK merged discovery+BRD |
264
+ | 02-specify | Sonnet | FRD + Use Cases |
265
+ | 03-validate | Haiku | Binary gate |
266
+ | 04-handoff | **Opus** | Zero-ambiguity prompt |
228
267
 
229
268
  ---
230
269
 
@@ -245,13 +284,19 @@ generate_feature_id():
245
284
 
246
285
  | Category | Questions | Batches |
247
286
  |----------|-----------|---------|
248
- | 01-context | Q1.1-Q1.8 | 2 calls (Q1.1-Q1.4 then Q1.5-Q1.8) |
249
- | 02-stakeholders | Q2.1-Q2.8 | 2 calls (Q2.1-Q2.4 then Q2.5-Q2.8) |
250
- | 03-scope | Q3.1-Q3.8 | 2 calls (Q3.1-Q3.4 then Q3.5-Q3.8) |
251
- | 04-data | Q4.1-Q4.8 | 2 calls (Q4.1-Q4.4 then Q4.5-Q4.8) |
252
- | 05-integrations | Q5.1-Q5.8 | 2 calls (Q5.1-Q5.4 then Q5.5-Q5.8) |
253
- | 06-security | Q6.1-Q6.8 | 2 calls (Q6.1-Q6.4 then Q6.5-Q6.8) |
254
- | 07-10 | Q7-Q10 | 1-2 calls each |
287
+ | 01-context | Q1.1-Q1.4 | 1 call |
288
+ | 02-stakeholders | Q2.1-Q2.8 | 2 calls |
289
+ | 03-scope | Q3.1-Q3.8 | 2 calls |
290
+ | 04-data | Q4.1-Q4.8 | 2 calls |
291
+ | 05-integrations | Q5.1-Q5.8 | 2 calls |
292
+ | 06-security | Q6.1-Q6.8 | 2 calls |
293
+ | 07-ui | Q7.1-Q7.8 | 2 calls |
294
+ | 08-performance | Q8.1-Q8.4 | 1 call |
295
+ | 09-constraints | Q9.1-Q9.4 | 1 call |
296
+ | 10-documentation | Q10.1-Q10.4 | 1 call |
297
+ | 11-data-lifecycle | Q11.1-Q11.8 | 2 calls |
298
+ | 12-migration | Q12.1-Q12.8 | 2 calls |
299
+ | 13-cross-module | Q13.1-Q13.8 | 2 calls |
255
300
 
256
301
  ### AskUserQuestion Format
257
302
 
@@ -306,7 +351,7 @@ AskUserQuestion({
306
351
 
307
352
  ## Elicitation Techniques
308
353
 
309
- > **Loaded by:** step-01-discover (Opus ULTRATHINK)
354
+ > **Loaded by:** step-01-analyse (Opus ULTRATHINK)
310
355
  > **Purpose:** Guide HOW to question, not just WHAT to ask.
311
356
 
312
357
  ### Technique 1: Solution → Problem Reframing
@@ -373,7 +418,7 @@ For every list answer, challenge completeness:
373
418
 
374
419
  ## ULTRATHINK
375
420
 
376
- Behavioral mode for critical phases (01, 02, 03, 05):
421
+ Behavioral mode for critical phases (01, 02, 04):
377
422
 
378
423
  ```
379
424
  ULTRATHINK MODE:
@@ -394,7 +439,21 @@ DO NOT:
394
439
 
395
440
  ---
396
441
 
397
- ## Context7 (Step 06)
442
+ ## Proactive Suggestions
443
+
444
+ After scope definition in step-01, the skill suggests complementary modules/sections:
445
+
446
+ 1. Analyze feature type and scope from questionnaire answers
447
+ 2. Load `patterns/suggestion-catalog.md`
448
+ 3. Match against catalog patterns
449
+ 4. Present suggestions via AskUserQuestion (accept/reject per suggestion)
450
+ 5. Store in feature.json.suggestions[]
451
+
452
+ Accepted suggestions become candidates for future /business-analyse runs.
453
+
454
+ ---
455
+
456
+ ## Context7 (Step 04)
398
457
 
399
458
  ```
400
459
  Prompt pattern:
@@ -441,53 +500,40 @@ Libraries:
441
500
 
442
501
  | Type | Path |
443
502
  |------|------|
444
- | Documentation | `web/smartstack-web/src/pages/docs/business/{app}/{module}/` |
503
+ | BA Feature | `docs/business/{app}/{module}/business-analyse/v{X.Y}/feature.json` |
504
+ | User Guide | `docs/business/{app}/{module}/user-guide/v{X.Y}/guide.json` |
445
505
  | i18n | `web/smartstack-web/src/i18n/locales/{lang}/` |
446
- | Route | `/docs/business/{app}/{module}` |
447
506
 
448
507
  ---
449
508
 
450
509
  ## State Persistence
451
510
 
452
- The `00-context.md` file persists state between steps:
453
-
454
- ```markdown
455
- # Business Analysis: {{feature_id}}
511
+ State is persisted in `feature.json.metadata` and `feature.json.metadata.steps`. Each step reads/writes via `ba-writer` and `ba-reader` agents.
456
512
 
457
- ## Progress
458
- | Step | Status | Started | Completed |
459
- |------|--------|---------|-----------|
460
- | 00-init | Complete | ... | ... |
461
- | 01-discover | In Progress | ... | - |
462
- ...
463
-
464
- ## State Variables
465
- | Variable | Value |
466
- |----------|-------|
467
- | feature_id | FEAT-001 |
468
- | application_name | Sales |
469
- ...
513
+ ```json
514
+ {
515
+ "metadata": {
516
+ "featureId": "FEAT-001",
517
+ "status": "analysed",
518
+ "steps": {
519
+ "00-init": { "completed": "2025-02-01T10:00:00Z" },
520
+ "01-analyse": { "completed": "2025-02-01T11:30:00Z" },
521
+ "02-specify": { "inProgress": true }
522
+ }
523
+ }
524
+ }
470
525
  ```
471
526
 
472
- **Read:** Each step starts by reading 00-context.md
473
- **Write:** Each step updates 00-context.md at the end
474
-
475
527
  ---
476
528
 
477
529
  ## Resume Workflow
478
530
 
479
531
  ```
480
- resume_workflow(task_id):
481
- 1. Search .business-analyse/ for matching feature
482
- 2. Read 00-context.md
483
- 3. Find last "Complete" step in Progress table
484
- 4. Return next step to load
485
-
486
- Example:
487
- /business-analyse -r FEAT-001
488
- → Reads .business-analyse/.../FEAT-001/00-context.md
489
- → Finds "01-discover: Complete, 02-analyse: Pending"
490
- → Loads step-02-analyse.md
532
+ resume_workflow(feat_id):
533
+ 1. ba-reader.findFeature(feat_id) latest feature.json
534
+ 2. Read feature.json.metadata.steps → find last completed step
535
+ 3. Load next step file
536
+ 4. If not found in docs/: fallback to .business-analyse/ (legacy)
491
537
  ```
492
538
 
493
539
  ---
@@ -496,9 +542,9 @@ Example:
496
542
 
497
543
  ```
498
544
  {STEP_NAME} - {feature_id}
499
- ├── Status: {Complete/In Progress}
500
- ├── Key metric: {value}
501
- ├── Output: {file created}
545
+ ├── Status: {status in feature.json}
546
+ ├── Section enriched: {discovery|analysis|specification|validation|handoff}
547
+ ├── feature.json: {path}
502
548
  └── Next: {next step name}
503
549
  ```
504
550
 
@@ -512,7 +558,7 @@ Example:
512
558
 
513
559
  ### Configuration
514
560
 
515
- Le champ `language` dans `.business-analyse/config.json` définit la langue :
561
+ Le champ `language` dans `feature.json.metadata.language` définit la langue :
516
562
 
517
563
  | Langue | Code | Défaut |
518
564
  |--------|------|--------|
@@ -528,14 +574,14 @@ Le champ `language` dans `.business-analyse/config.json` définit la langue :
528
574
  | Questions `AskUserQuestion` (labels, descriptions, options) | **OUI** — toujours dans `{language}` |
529
575
  | Reformulations et résumés de catégorie | **OUI** — toujours dans `{language}` |
530
576
  | Relances et follow-ups (Elicitation Guide) | **OUI** — traduire les probes à la volée |
531
- | Documents générés (discovery, BRD, FRD, handoff) | **OUI** — rédigés dans `{language}` |
577
+ | Documents générés (discovery, analysis, specification, handoff) | **OUI** — rédigés dans `{language}` |
532
578
  | Référence technique interne (patterns, architecture) | NON — reste en langue du fichier |
533
579
  | Noms de code (entités, permissions, paths) | NON — toujours en anglais (convention plateforme) |
534
580
 
535
581
  ### Règle
536
582
 
537
583
  ```
538
- 1. Lire {language} depuis 00-context.md (défaut: "fr")
584
+ 1. Lire {language} depuis feature.json.metadata.language (défaut: "fr")
539
585
  2. Adapter TOUTE communication AskUserQuestion dans {language}
540
586
  3. Les exemples de probes/relances dans les questionnaires sont en français
541
587
  → Si {language} ≠ "fr", les traduire à la volée
@@ -563,62 +609,6 @@ Le champ `language` dans `.business-analyse/config.json` définit la langue :
563
609
 
564
610
  ---
565
611
 
566
- ## Progressive Loading Benefits
567
-
568
- | Aspect | Before | After | Gain |
569
- |--------|--------|-------|------|
570
- | Questionnaire | 283 L (all) | 40-60 L (per category) | ~75% |
571
- | FRD Templates | 477 L (all) | 80-150 L (per type) | ~70% |
572
- | React Templates | 580 L (all) | 250-350 L (per need) | ~45% |
573
- | **Total/step** | ~1,340 L | ~300-400 L | **~70%** |
574
-
575
- ---
576
-
577
- ## Context Digest (Between Steps)
578
-
579
- Each step produces a compressed digest file (max 50 lines) at completion to reduce token usage in the next step.
580
-
581
- **File naming:** `{output_dir}/digest-{step_number}.md` (e.g., `digest-01.md`, `digest-02.md`)
582
-
583
- | Section | Max Lines | Content |
584
- |---------|-----------|---------|
585
- | Changes | 10 | Files modified with brief description |
586
- | Decisions | 10 | Key architectural decisions |
587
- | Findings | 10 | Issues found, patterns identified |
588
- | State | 5 | Updated state variables |
589
- | Next | 5 | What the next step needs to know |
590
-
591
- **Protocol:**
592
- - **Generate:** Each step writes `digest-{step_number}.md` before completing
593
- - **Read:** Next step reads `digest-{prev_step_number}.md` instead of full output files
594
- - **Resume mode (`-r`):** Reads full output files directly (digest is for progressive loading only)
595
- - **Step-00:** Does not read a digest (it is the first step)
596
- - **Step-00:** Generates `digest-00.md` with initial state variables and configuration
597
-
598
- **Template:**
599
- ```markdown
600
- # Digest: Step {NN} - {Step Name}
601
-
602
- ## Changes
603
- - {file}: {brief description}
604
-
605
- ## Decisions
606
- - {decision and rationale}
607
-
608
- ## Findings
609
- - {finding}
610
-
611
- ## State Updates
612
- | Variable | New Value |
613
- |----------|-----------|
614
- | {var} | {value} |
615
-
616
- ## For Next Step
617
- - {what the next step needs to know}
618
- ```
619
-
620
- ---
621
-
622
612
  ## Support
623
613
 
624
614
  Contact: **support@atlshub.ch**