@atlashub/smartstack-cli 3.1.0 → 3.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 (39) hide show
  1. package/.documentation/prd-json-v2.0.0.md +396 -0
  2. package/.documentation/testing-ba-e2e.md +462 -0
  3. package/dist/index.js +605 -25
  4. package/dist/index.js.map +1 -1
  5. package/package.json +6 -2
  6. package/templates/agents/ba-reader.md +1 -1
  7. package/templates/agents/ba-writer.md +8 -1
  8. package/templates/skills/business-analyse/SKILL.md +46 -31
  9. package/templates/skills/business-analyse/_architecture.md +123 -0
  10. package/templates/skills/business-analyse/_elicitation.md +206 -0
  11. package/templates/skills/business-analyse/_module-loop.md +56 -0
  12. package/templates/skills/business-analyse/_shared.md +75 -531
  13. package/templates/skills/business-analyse/_suggestions.md +34 -0
  14. package/templates/skills/business-analyse/html/ba-interactive.html +146 -57
  15. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  16. package/templates/skills/business-analyse/questionnaire.md +22 -17
  17. package/templates/skills/business-analyse/react/components.md +1 -1
  18. package/templates/skills/business-analyse/react/schema.md +1 -1
  19. package/templates/skills/business-analyse/references/html-data-mapping.md +294 -0
  20. package/templates/skills/business-analyse/schemas/feature-schema.json +1 -1
  21. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  22. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +1 -1
  23. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  24. package/templates/skills/business-analyse/steps/step-00-init.md +85 -59
  25. package/templates/skills/business-analyse/steps/step-01-cadrage.md +2 -0
  26. package/templates/skills/business-analyse/steps/step-02-decomposition.md +5 -3
  27. package/templates/skills/business-analyse/steps/{step-03-specify.md → step-03a-specify.md} +16 -606
  28. package/templates/skills/business-analyse/steps/step-03b-compile.md +670 -0
  29. package/templates/skills/business-analyse/steps/step-04-consolidation.md +7 -5
  30. package/templates/skills/business-analyse/steps/step-05a-handoff.md +727 -0
  31. package/templates/skills/business-analyse/steps/step-05b-deploy.md +479 -0
  32. package/templates/skills/business-analyse/steps/step-06-extract.md +134 -4
  33. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  34. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +161 -0
  35. package/templates/skills/business-analyse/templates/tpl-progress.md +171 -0
  36. package/templates/skills/ralph-loop/SKILL.md +138 -20
  37. package/templates/skills/ralph-loop/steps/step-01-task.md +75 -18
  38. package/templates/skills/ralph-loop/steps/step-04-check.md +72 -5
  39. package/templates/skills/business-analyse/steps/step-05-handoff.md +0 -1414
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "analysis-schema.json",
4
4
  "title": "SmartStack BA - Analysis",
5
- "description": "Module-level analysis: objectives, business rules, entities, process flows, integrations, data lifecycle. Enriched by step-03-specify.",
5
+ "description": "Module-level analysis: objectives, business rules, entities, process flows, integrations, data lifecycle. Enriched by step-03a-specify.",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "objectives": {
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "handoff-schema.json",
4
4
  "title": "SmartStack BA - Handoff",
5
- "description": "Module-level handoff: file mapping (7 categories), BR-to-code mapping, API endpoint summary. Used by step-05-handoff.",
5
+ "description": "Module-level handoff: file mapping (7 categories), BR-to-code mapping, API endpoint summary. Used by step-05a-handoff.",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "complexity": { "type": "string", "enum": ["simple", "medium", "complex"] },
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "specification-schema.json",
4
4
  "title": "SmartStack BA - Specification",
5
- "description": "Module-level specification: actors, use cases, FRs, permissions, navigation, wireframes, dashboards, sections, resources. Enriched by step-03-specify.",
5
+ "description": "Module-level specification: actors, use cases, FRs, permissions, navigation, wireframes, dashboards, sections, resources. Enriched by step-03b-compile.",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "actors": {
@@ -4,6 +4,8 @@ description: Initialize Business Analysis - Parse flags, route use case, create
4
4
  next_step: steps/step-01-cadrage.md
5
5
  ---
6
6
 
7
+ > **Context files:** `_shared.md`
8
+
7
9
  # Step 00: Initialize Business Analysis
8
10
 
9
11
  Initialize the business analysis workflow by parsing input flags, routing to the appropriate use case handler, and creating the initial feature.json structure.
@@ -37,7 +39,6 @@ question_mode: false
37
39
  refactor_mode: false
38
40
  micro_mode: false
39
41
  extract_mode: false
40
- interactive_mode: false
41
42
  application_mode: false # Multi-module application analysis
42
43
  ```
43
44
 
@@ -52,7 +53,6 @@ application_mode: false # Multi-module application analysis
52
53
  | `-q` | `--question` | Question mode | next arg = FEAT-ID, remaining = question text |
53
54
  | `-r` | `--refactor` | Refactoring mode | next arg = FEAT-ID, remaining = change description |
54
55
  | `-m` | `--micro` | Micro feature mode | none |
55
- | `-i` | `--interactive` | Interactive mode | none |
56
56
  | `-x` | `--extract` | Extract mode: import from interactive HTML export | next arg = JSON file path |
57
57
  | `-app` | `--application` | Application mode: multi-module analysis | none |
58
58
 
@@ -232,25 +232,7 @@ mcp__smartstack__validate_conventions({ checks: ["tables"] })
232
232
  **DO NOT** continue to Step 4 or any subsequent step.
233
233
  **STOP the skill immediately.**
234
234
 
235
- ## Step 4: Interactive Mode
236
-
237
- If `-i` or `--interactive` flag is set, prompt for confirmation.
238
-
239
- **Prompt:**
240
- ```
241
- Confirm initialization with:
242
- - Use Case: {use_case}
243
- - Application: {application_name}
244
- - Module: {module_name}
245
- - Auto Mode: {auto_mode}
246
- - Economy Mode: {economy_mode}
247
-
248
- Continue? (y/n)
249
- ```
250
-
251
- If 'n', EXIT.
252
-
253
- ## Step 5: Validate Business Context
235
+ ## Step 4: Validate Business Context
254
236
 
255
237
  Verify that the business context is properly configured.
256
238
 
@@ -275,23 +257,27 @@ Verify that the business context is properly configured.
275
257
  }
276
258
  ```
277
259
 
278
- ## Step 6: Determine Application and Module
260
+ ## Step 5: Determine Application and Module
279
261
 
280
262
  Scan for existing applications and modules.
281
263
 
282
- **Scan order:**
283
- 1. Primary: `docs/business/` (modern structure)
284
- - List subdirectories = applications
285
- - Inside each app, list subdirectories = modules
286
- 2. Fallback: `.business-analyse/business/` (legacy)
287
- - Same structure as above
264
+ **Scan location:** `docs/business/` (modern structure only)
265
+
266
+ ```
267
+ 1. List subdirectories in `docs/business/` = applications
268
+ 2. For each app, list subdirectories = modules
269
+ 3. IF no applications found:
270
+ Will create new under docs/business/
271
+ ```
272
+
273
+ **Legacy structure (`.business-analyse/business/`) is NO LONGER SUPPORTED.**
288
274
 
289
275
  **Logic:**
290
276
  ```
291
277
  IF auto_mode = true:
292
278
  application_name = first found app OR "default"
293
279
  module_name = first found module OR "default"
294
- ELSE (interactive):
280
+ ELSE:
295
281
  Prompt: "Select application: [list]"
296
282
  Prompt: "Select module: [list]"
297
283
  OR: "Create new application: {name}"
@@ -304,21 +290,24 @@ application_name: string
304
290
  module_name: string
305
291
  ```
306
292
 
307
- ## Step 7: Select Language
293
+ ## Step 6: Select Language
308
294
 
309
295
  Determine the language for analysis and code generation.
310
296
 
311
297
  **Check config:**
312
298
  - Retrieve `businessContext.language` from config
313
- - Default: "en" (English)
299
+ - Default: "fr" (Francais)
314
300
 
315
- **If interactive:**
301
+ **If not in config OR auto_mode = false:**
316
302
  ```
317
- Select language:
318
- [ ] English (en)
319
- [ ] French (fr)
320
- [ ] Spanish (es)
321
- [ ] Custom: {input}
303
+ Ask via AskUserQuestion:
304
+ question: "Quelle langue pour l'analyse ?"
305
+ header: "Langue"
306
+ options:
307
+ - label: "Francais (fr)"
308
+ - label: "English (en)"
309
+ - label: "Italiano (it)"
310
+ - label: "Deutsch (de)"
322
311
  ```
323
312
 
324
313
  **Store:**
@@ -326,7 +315,7 @@ Select language:
326
315
  language: string (code, e.g., "en", "fr")
327
316
  ```
328
317
 
329
- ## Step 8: Generate Feature ID
318
+ ## Step 7: Generate Feature ID
330
319
 
331
320
  Create a unique feature identifier.
332
321
 
@@ -345,7 +334,7 @@ ELSE:
345
334
  feature_id: string
346
335
  ```
347
336
 
348
- ## Step 9: Create Output Directory Structure
337
+ ## Step 8: Create Output Directory Structure
349
338
 
350
339
  Create the directory hierarchy for feature documentation.
351
340
 
@@ -370,20 +359,35 @@ docs_dir: "docs/business/{app}/{module}/business-analyse/v{version}"
370
359
  output_dir: same as docs_dir
371
360
  ```
372
361
 
373
- ## Step 9-bis: Deploy JSON Schemas to Project (MANDATORY)
362
+ ## Step 8-bis: Deploy JSON Schemas to Project (MANDATORY)
374
363
 
375
364
  > **The JSON Schemas MUST be present in the project alongside the generated feature.json files.**
376
365
  > Without schemas, feature.json files cannot be validated and have no structural reference.
377
366
 
378
- **Check if schemas already deployed:**
367
+ **Performance optimization:** Use cache file to avoid redundant deployments.
368
+
369
+ ### Cache-based deployment logic:
370
+
371
+ **Step 1: Check deployment cache**
372
+
373
+ Cache file location: `docs/business/{app}/business-analyse/.schema-cache.json`
374
+
379
375
  ```
380
- IF EXISTS docs/business/{app}/business-analyse/schemas/feature-schema.json:
381
- Skip deployment (schemas already present)
376
+ IF EXISTS docs/business/{app}/business-analyse/.schema-cache.json:
377
+ Read cache file
378
+ IF cache.version == "{CLI_VERSION}" (from package.json):
379
+ Display: "✓ Schemas already deployed ({CLI_VERSION}) - skipping"
380
+ SKIP deployment (trust cache)
381
+ → Go to Step 10
382
+ ELSE:
383
+ Display: "⚠ Schema version mismatch (cache: {cache.version}, current: {CLI_VERSION})"
384
+ Proceed to deployment
382
385
  ELSE:
383
- Deploy schemas
386
+ Display: "Deploying schemas (first time)..."
387
+ Proceed to deployment
384
388
  ```
385
389
 
386
- **Deploy all schema files from skill directory to project:**
390
+ **Step 2: Deploy schemas (if needed)**
387
391
 
388
392
  Source: `schemas/` (relative to skill root = `~/.claude/skills/business-analyse/schemas/`)
389
393
  Destination: `docs/business/{app}/business-analyse/schemas/`
@@ -411,13 +415,43 @@ docs/business/{app}/business-analyse/schemas/
411
415
  1. Use Glob to find all `.json` files in `schemas/` directory (skill-relative)
412
416
  2. For each file, Read from skill directory and Write to project directory
413
417
  3. Preserve the subdirectory structure (sections/, shared/)
418
+ 4. Display progress: "Deploying schema {i}/{total}: {filename}"
419
+
420
+ **Step 3: Write cache file (after successful deployment)**
421
+
422
+ ```json
423
+ {
424
+ "version": "{CLI_VERSION}",
425
+ "deployedAt": "{ISO timestamp}",
426
+ "schemas": [
427
+ "feature-schema.json",
428
+ "application-schema.json",
429
+ "sections/metadata-schema.json",
430
+ "sections/discovery-schema.json",
431
+ "sections/analysis-schema.json",
432
+ "sections/specification-schema.json",
433
+ "sections/validation-schema.json",
434
+ "sections/handoff-schema.json",
435
+ "shared/common-defs.json"
436
+ ]
437
+ }
438
+ ```
439
+
440
+ Write to: `docs/business/{app}/business-analyse/.schema-cache.json`
441
+
442
+ Display: "✓ Schemas deployed successfully (9 files)"
414
443
 
415
444
  **Store:**
416
445
  ```yaml
417
446
  schemas_dir: "docs/business/{app}/business-analyse/schemas"
418
447
  ```
419
448
 
420
- ## Step 10: Create Master feature.json
449
+ **Performance gain:**
450
+ - First deployment: ~12 seconds (unchanged)
451
+ - Subsequent deployments: **~0 seconds (skipped via cache)** ✨
452
+ - Cache invalidation: automatic on skill version upgrade
453
+
454
+ ## Step 9: Create Master feature.json
421
455
 
422
456
  Create the master feature document using ba-writer agent.
423
457
 
@@ -526,7 +560,7 @@ ba-writer.createApplicationFeature({
526
560
  {docs_dir}/feature.json
527
561
  ```
528
562
 
529
- ## Step 11: Update Config
563
+ ## Step 10: Update Config
530
564
 
531
565
  Update `.business-analyse/config.json` with new feature information.
532
566
 
@@ -543,12 +577,11 @@ Update `.business-analyse/config.json` with new feature information.
543
577
  },
544
578
  "lastInitialized": "{ISO timestamp}",
545
579
  "autoMode": {auto_mode},
546
- "economyMode": {economy_mode},
547
- "interactiveMode": {interactive_mode}
580
+ "economyMode": {economy_mode}
548
581
  }
549
582
  ```
550
583
 
551
- ## Step 12: Display Summary
584
+ ## Step 11: Display Summary
552
585
 
553
586
  Show initialization results in a clear table format.
554
587
 
@@ -576,13 +609,13 @@ NEXT STEP: step-01-analyse ({use_case} mode)
576
609
  ═══════════════════════════════════════════════════════════════
577
610
  ```
578
611
 
579
- ## Step 13: Load Next Step
612
+ ## Step 12: Load Next Step
580
613
 
581
614
  **All modes except question (-q), micro (-m), and extract (-x):**
582
615
  After showing initialization summary, proceed to `./step-01-cadrage.md`
583
616
 
584
617
  **Question mode (-q):** EXIT after ba-reader answers the question.
585
- **Micro mode (-m):** Load `./step-05-handoff.md` directly.
618
+ **Micro mode (-m):** Load `./step-05a-handoff.md` directly.
586
619
  **Extract mode (-x):** Load `./step-06-extract.md` with `{json_data}` from parsed JSON file.
587
620
 
588
621
  **Pass context variables:**
@@ -596,7 +629,6 @@ language: string
596
629
  docs_dir: string
597
630
  auto_mode: boolean
598
631
  economy_mode: boolean
599
- interactive_mode: boolean
600
632
  mcp_available: boolean
601
633
  workflow_mode: string
602
634
  ```
@@ -625,9 +657,3 @@ If initialization was interrupted:
625
657
  3. If found, offer to resume from last completed step
626
658
  4. If not found, create fresh feature.json
627
659
 
628
- ### Clean Fallbacks
629
-
630
- If modern paths unavailable:
631
- 1. Search `.business-analyse/business/` (legacy)
632
- 2. Create new structure under `docs/business/` regardless
633
- 3. Log migration notice (automated, non-blocking)
@@ -5,6 +5,8 @@ model: opus
5
5
  next_step: steps/step-02-decomposition.md
6
6
  ---
7
7
 
8
+ > **Context files:** `_shared.md` | `_elicitation.md` | `_architecture.md` | `_suggestions.md`
9
+
8
10
  # Step 1: Cadrage (Framing)
9
11
 
10
12
  ## MANDATORY EXECUTION RULES
@@ -2,9 +2,11 @@
2
2
  name: step-02-decomposition
3
3
  description: Module decomposition - identify modules, dependency graph, topological sort, client checkpoint
4
4
  model: sonnet
5
- next_step: steps/step-03-specify.md
5
+ next_step: steps/step-03a-specify.md
6
6
  ---
7
7
 
8
+ > **Context files:** `_shared.md`
9
+
8
10
  # Step 2: Decomposition
9
11
 
10
12
  ## MANDATORY EXECUTION RULES
@@ -36,7 +38,7 @@ ba-reader.findFeature({feature_id})
36
38
 
37
39
  IF status already "decomposed":
38
40
  Display: "Decomposition already completed. Loading next step."
39
- Load: steps/step-03-specify.md
41
+ Load: steps/step-03a-specify.md
40
42
  STOP
41
43
 
42
44
  ### 2. Module Identification
@@ -290,4 +292,4 @@ When `workflow.mode = "module"` or only 1 scope item identified:
290
292
 
291
293
  ## NEXT STEP
292
294
 
293
- Load: `./step-03-specify.md`
295
+ Load: `./step-03a-specify.md`