@atlashub/smartstack-cli 4.74.0 → 4.75.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 (93) hide show
  1. package/dist/index.js +111 -36
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +14 -3
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/agents/ba-reader.md +17 -15
  7. package/templates/agents/ba-writer.md +49 -51
  8. package/templates/skills/apex/_shared.md +1 -1
  9. package/templates/skills/apex/references/checks/backend-checks.sh +21 -7
  10. package/templates/skills/apex/references/checks/infrastructure-checks.sh +47 -10
  11. package/templates/skills/apex/references/frontend-route-wiring-app-tsx.md +3 -0
  12. package/templates/skills/apex/references/post-checks.md +5 -2
  13. package/templates/skills/apex/references/smartstack-frontend.md +53 -7
  14. package/templates/skills/apex/steps/step-00-init.md +74 -0
  15. package/templates/skills/apex/steps/step-03-execute.md +16 -4
  16. package/templates/skills/apex/steps/step-03b-layer1-seed.md +39 -6
  17. package/templates/skills/apex/steps/step-03c-layer2-backend.md +50 -5
  18. package/templates/skills/apex/steps/step-03d-layer3-frontend.md +102 -2
  19. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +3 -0
  20. package/templates/skills/business-analyse/SKILL.md +14 -0
  21. package/templates/skills/business-analyse/_shared.md +27 -0
  22. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +34 -26
  23. package/templates/skills/business-analyse/questionnaire/01-context.md +13 -9
  24. package/templates/skills/business-analyse/questionnaire/02-stakeholders-scope.md +20 -27
  25. package/templates/skills/business-analyse/questionnaire.md +86 -9
  26. package/templates/skills/business-analyse/references/03-json-schemas.md +213 -0
  27. package/templates/skills/business-analyse/references/03-post-check-validation.md +144 -0
  28. package/templates/skills/business-analyse/references/03-smartstack-entity-guards.md +32 -0
  29. package/templates/skills/business-analyse/references/04-cross-module-validation.md +95 -0
  30. package/templates/skills/business-analyse/references/04-file-allocation.md +162 -0
  31. package/templates/skills/business-analyse/references/04-naming-audit-checks.md +174 -0
  32. package/templates/skills/business-analyse/references/04-semantic-validation-matrix.md +118 -0
  33. package/templates/skills/business-analyse/references/domain-research-playbook.md +234 -0
  34. package/templates/skills/business-analyse/references/entity-sourcing-presentation.md +166 -0
  35. package/templates/skills/business-analyse/references/init-resume-logic.md +70 -0
  36. package/templates/skills/business-analyse/references/module-completeness-challenge.md +174 -0
  37. package/templates/skills/business-analyse/references/multi-app-detection.md +149 -0
  38. package/templates/skills/business-analyse/references/portal-classification.md +52 -0
  39. package/templates/skills/business-analyse/references/validation-checklist.md +30 -1
  40. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +37 -4
  41. package/templates/skills/business-analyse/steps/step-00-init.md +22 -190
  42. package/templates/skills/business-analyse/steps/step-01-cadrage.md +365 -269
  43. package/templates/skills/business-analyse/steps/step-02-structure.md +98 -20
  44. package/templates/skills/business-analyse/steps/step-03-specify.md +652 -229
  45. package/templates/skills/business-analyse/steps/step-04-consolidate.md +308 -287
  46. package/templates/skills/business-analyse-design/SKILL.md +10 -0
  47. package/templates/skills/business-analyse-design/references/screens-post-check.md +221 -0
  48. package/templates/skills/business-analyse-design/references/screens-type-mapping.md +138 -0
  49. package/templates/skills/business-analyse-design/references/smartcomponents-templates.md +225 -0
  50. package/templates/skills/{business-analyse → business-analyse-design}/references/spec-auto-inference.md +117 -117
  51. package/templates/skills/business-analyse-design/steps/step-01-screens.md +36 -162
  52. package/templates/skills/business-analyse-design/steps/step-02-wireframes.md +8 -7
  53. package/templates/skills/business-analyse-design/steps/step-03-navigation.md +89 -42
  54. package/templates/skills/business-analyse-develop/references/compact-loop.md +9 -0
  55. package/templates/skills/business-analyse-develop/references/handoff-quality-gate.md +132 -0
  56. package/templates/skills/business-analyse-develop/references/prd-v3-transformation.md +326 -0
  57. package/templates/skills/business-analyse-develop/references/report-reconciliation.md +140 -0
  58. package/templates/skills/business-analyse-develop/references/report-template.md +142 -0
  59. package/templates/skills/business-analyse-develop/steps/step-01-task.md +5 -177
  60. package/templates/skills/business-analyse-develop/steps/step-02-execute.md +17 -4
  61. package/templates/skills/business-analyse-develop/steps/step-03-commit.md +6 -2
  62. package/templates/skills/business-analyse-develop/steps/step-04-check.md +6 -0
  63. package/templates/skills/business-analyse-develop/steps/step-05-report.md +3 -269
  64. package/templates/skills/business-analyse-handoff/SKILL.md +10 -0
  65. package/templates/skills/business-analyse-handoff/references/agent-handoff-transform-prompt.md +208 -0
  66. package/templates/skills/business-analyse-handoff/references/context-isolation-pattern.md +47 -0
  67. package/templates/skills/business-analyse-handoff/references/handoff-file-inventory.md +49 -0
  68. package/templates/skills/business-analyse-handoff/references/handoff-global-validation.md +142 -0
  69. package/templates/skills/business-analyse-handoff/references/prd-validation-checks.md +125 -0
  70. package/templates/skills/business-analyse-handoff/references/project-index-update.md +98 -0
  71. package/templates/skills/business-analyse-handoff/steps/step-01-transform.md +9 -160
  72. package/templates/skills/business-analyse-handoff/steps/step-02-export.md +10 -99
  73. package/templates/skills/business-analyse-html/SKILL.md +10 -0
  74. package/templates/skills/business-analyse-html/html/ba-interactive.html +306 -81
  75. package/templates/skills/business-analyse-html/html/src/scripts/01-data-init.js +15 -2
  76. package/templates/skills/business-analyse-html/html/src/scripts/02-navigation.js +6 -46
  77. package/templates/skills/business-analyse-html/html/src/scripts/06-render-mockups.js +88 -33
  78. package/templates/skills/business-analyse-html/html/src/scripts/12-render-diagrams.js +116 -0
  79. package/templates/skills/business-analyse-html/html/src/styles/10-diagrams.css +73 -0
  80. package/templates/skills/business-analyse-html/html/src/template.html +2 -0
  81. package/templates/skills/business-analyse-html/references/02-embedded-artifacts-building.md +144 -0
  82. package/templates/skills/business-analyse-html/references/02-feature-data-building.md +141 -0
  83. package/templates/skills/business-analyse-html/references/02-mapping-tables.md +442 -0
  84. package/templates/skills/business-analyse-html/references/02-normalization-helpers.md +139 -0
  85. package/templates/skills/business-analyse-html/references/02-screen-format-detection.md +283 -0
  86. package/templates/skills/business-analyse-html/references/02-self-check-validation.md +199 -0
  87. package/templates/skills/business-analyse-html/references/data-build.md +22 -1
  88. package/templates/skills/business-analyse-html/references/data-mapping.md +40 -5
  89. package/templates/skills/business-analyse-html/steps/step-02-build-data.md +12 -555
  90. package/templates/skills/business-analyse-review/SKILL.md +10 -0
  91. package/templates/skills/business-analyse-status/SKILL.md +8 -0
  92. package/templates/skills/dev-start/SKILL.md +143 -307
  93. package/templates/skills/efcore/SKILL.md +13 -0
@@ -121,138 +121,9 @@ existing_projects: array of { projectName, projectId, applications[], version }
121
121
 
122
122
  ## Step 3b: Early Multi-Application Detection from Prompt (NEW)
123
123
 
124
- > **Detect multi-app structure BEFORE asking for a single application name.**
125
- > When the user's prompt describes multiple applications or spans multiple business domains,
126
- > we must recognize this immediately and set `workflow.mode = "project"` to avoid doing cadrage for a single app.
124
+ > **Load** `references/multi-app-detection.md` for the multi-app detection algorithm (Tier 1 patterns, Tier 2 domain diversity scoring, extraction, confirmation).
127
125
 
128
- ### Tier 1 Explicit patterns (ANY match = multi-app detected)
129
-
130
- French patterns:
131
- - "une application X ... une application Y" (two occurrences of "une application")
132
- - "application 1: X ... application 2: Y" (numbered applications)
133
- - "première application ... deuxième application"
134
- - "app 1: ... app 2: ..."
135
-
136
- English patterns:
137
- - "an application (for) X ... an application (for) Y" (two occurrences)
138
- - "application #1: ... application #2: ..." (numbered)
139
- - "first app ... second app"
140
-
141
- If ANY of these patterns is found in `{feature_description}`:
142
- → `isMultiApp = true`, `detectionTier = "explicit"`
143
-
144
- ### Tier 2 — Domain diversity analysis (when Tier 1 does not match)
145
-
146
- ULTRATHINK: Analyze `{feature_description}` to extract distinct business domains.
147
-
148
- **Definition:** A "domain" is an autonomous business perimeter with its own entities and processes (e.g., HR, CRM, Finance, Projects, Sales, Inventory).
149
-
150
- **Algorithm:**
151
- 1. List all business domains mentioned or implied in the description
152
- 2. Classify each domain:
153
- - **DISTINCT** — has its own entities, processes, and lifecycle (e.g., HR vs CRM)
154
- - **RELATED** — is a sub-domain of another (e.g., Payroll is a sub-domain of HR)
155
- 3. Count DISTINCT domains only
156
-
157
- **Threshold:** 2+ DISTINCT domains → `isMultiApp = true`, `detectionTier = "domain-diversity"`
158
-
159
- **False positive protection:**
160
- - "RH complet avec employés, congés, paie, pointage" = 1 domain (HR) with 4 modules, NOT 4 domains
161
- - "HR and Payroll management" = 1 domain (HR) with 2 modules — Payroll is RELATED to HR
162
- - "gestion commerciale avec devis, commandes et facturation" = 1 domain (Sales) with 3 modules
163
- - Only count as DISTINCT when domains have genuinely independent entity models and processes
164
-
165
- ### Extraction algorithm (depends on detection tier)
166
-
167
- **IF Tier 1 (explicit):**
168
-
169
- 1. **Identify boundaries:** Split the prompt at each "une application" / "an application" occurrence. Each block = one candidate.
170
- 2. **Extract per candidate:** For each block, derive `name` (application name), `description` (summary of purpose), and `modules[]` (listed modules/features).
171
- - Example: `[{ name: "RH", description: "gestion des employés, congés, temps", modules: ["Employés", "Congés", "Temps"] }, ...]`
172
- 3. **Detect shared modules:** Collect all module names across all candidates. Any module appearing in more than one candidate is a shared module.
173
- - Example: `sharedModules = ["Temps"]` (appears in both RH and Projet)
174
-
175
- **IF Tier 2 (domain-diversity):**
176
-
177
- 1. Each DISTINCT domain = 1 candidate application:
178
- - `name` = short domain label (e.g., "RH", "CRM", "Finance")
179
- - `description` = user's expressed need for that domain
180
- - `modules[]` = sub-functionalities mentioned (can be empty → "(à définir au cadrage)")
181
- 2. Group RELATED sub-domains under their parent DISTINCT domain as modules
182
- 3. **Detect shared modules:** Same logic as Tier 1 — modules appearing in multiple candidates
183
-
184
- ### Confirmation dialogue
185
-
186
- Display detection result:
187
-
188
- ```
189
- {detectionTier == "explicit"
190
- ? (language == "fr"
191
- ? "### Détection multi-application\n\nJ'ai détecté **{candidates.length} applications** dans votre description :"
192
- : "### Multi-application detection\n\nI detected **{candidates.length} applications** in your description:")
193
- : (language == "fr"
194
- ? "### Détection multi-application\n\nVotre description couvre **{candidates.length} domaines métier distincts**. Chaque domaine pourrait constituer une application séparée :"
195
- : "### Multi-application detection\n\nYour description covers **{candidates.length} distinct business domains**. Each domain could be a separate application:")}
196
-
197
- | # | Application | Modules identifiés |
198
- |---|-------------|-------------------|
199
- {for each candidate: index | name | modules.join(", ") || "(à définir au cadrage)"}
200
-
201
- {sharedModules.length > 0
202
- ? "⚠️ **Modules partagés détectés :** {sharedModules.join(', ')} — ces modules apparaissent dans plusieurs applications. Ils pourraient constituer une application transversale dédiée."
203
- : ""}
204
- ```
205
-
206
- Ask via AskUserQuestion:
207
- ```
208
- question: "{language == 'fr' ? 'Confirmez-vous cette structure multi-application ?' : 'Do you confirm this multi-application structure?'}"
209
- header: "Architecture"
210
- options:
211
- - label: "{language == 'fr' ? 'Oui, {candidates.length} applications' : 'Yes, {candidates.length} applications'}"
212
- description: "{language == 'fr' ? 'Créer un projet avec les applications identifiées' : 'Create a project with the identified applications'}"
213
- - label: "{language == 'fr' ? 'Extraire les modules partagés' : 'Extract shared modules'}" (only if sharedModules.length > 0)
214
- description: "{language == 'fr' ? 'Créer une application dédiée pour {sharedModules.join(', ')} ({candidates.length + 1} applications au total)' : 'Create a dedicated app for {sharedModules.join(', ')} ({candidates.length + 1} total)'}"
215
- - label: "{language == 'fr' ? 'Regrouper certains domaines' : 'Regroup some domains'}" (only if detectionTier == "domain-diversity")
216
- description: "{language == 'fr' ? 'Fusionner des domaines en moins d\\'applications' : 'Merge domains into fewer applications'}"
217
- - label: "{language == 'fr' ? 'Application unique' : 'Single application'}"
218
- description: "{language == 'fr' ? 'Tout regrouper en une seule application avec plusieurs modules' : 'Group everything into one application with multiple modules'}"
219
- ```
220
-
221
- **IF "Oui, N applications" or "Extraire les modules partagés":**
222
-
223
- ```yaml
224
- workflow_mode: "project"
225
- project_name: derived from feature_description
226
- candidate_applications: [{ name, description, modules, context }]
227
- shared_modules_extracted: boolean # true if user chose extraction
228
- ```
229
-
230
- → Skip step 4 (application name) — applications will be confirmed in step-01-cadrage
231
- → Continue to step 5 (language selection)
232
-
233
- **IF "Regrouper certains domaines" (Tier 2 only):**
234
-
235
- Ask via AskUserQuestion:
236
- ```
237
- question: "{language == 'fr' ? 'Comment souhaitez-vous regrouper ces domaines ? (ex: \"RH + Paie ensemble, CRM seul\")' : 'How would you like to regroup these domains? (e.g., \"HR + Payroll together, CRM alone\")'}"
238
- header: "Regroupement"
239
- ```
240
-
241
- Process user response:
242
- 1. Parse the grouping instructions (natural language)
243
- 2. Rebuild `candidate_applications` based on the specified groups
244
- 3. Re-display the confirmation dialogue with the updated candidates
245
-
246
- **IF "Application unique":**
247
-
248
- ```yaml
249
- workflow_mode: "application"
250
- ```
251
-
252
- → Continue to step 4 normally
253
-
254
- **IF no multi-app detected (neither Tier 1 nor Tier 2):**
255
- → Continue to step 4 normally
126
+ Execute the multi-app detection. IF multi-app detected set `workflow_mode = "project"` and skip step 4 (application name). ELSE continue to step 4 normally.
256
127
 
257
128
  ## Step 4: Determine Project Name & Application Name
258
129
 
@@ -365,20 +236,27 @@ ELSE:
365
236
  feature_id: string
366
237
  ```
367
238
 
368
- ## Step 7: Create Output Directory Structure
239
+ ## Step 7: Create Output Directory Structure (EXECUTABLE)
369
240
 
370
241
  ```
371
242
  projectDir = "docs/" + projectSlug + "/v" + version
243
+ docs_dir = projectDir
244
+ ```
372
245
 
373
- IF workflow_type = "new":
374
- mkdir -p {projectDir}
375
- docs_dir = projectDir
246
+ **MANDATORY Execute via Bash tool (NOT just pseudocode):**
376
247
 
377
- ELSE:
378
- // Directory already exists from previous session
379
- docs_dir = projectDir
248
+ ```bash
249
+ mkdir -p "{projectDir}"
250
+ ```
251
+
252
+ **POST-CHECK (BLOCKING):**
253
+
254
+ ```bash
255
+ ls -d "{projectDir}" 2>/dev/null || echo "DIRECTORY_MISSING"
380
256
  ```
381
257
 
258
+ If output contains `DIRECTORY_MISSING` → **BLOCKING ERROR: directory creation failed. Check permissions.**
259
+
382
260
  > **Key change (ba-006):** All project data lives under `docs/{projectSlug}/v{X.Y}/`.
383
261
  > No more `business-analyse/` intermediate directory. Applications and modules are
384
262
  > direct subdirectories: `docs/{projectSlug}/v{X.Y}/{appKebab}/{moduleKebab}/`.
@@ -575,57 +453,11 @@ analysisMode: "interactive"
575
453
  version: string
576
454
  ```
577
455
 
578
- ## Error Handling
579
-
580
- | Error | Action |
581
- |-------|--------|
582
- | Config missing | Create fresh with defaults, continue |
583
- | Directory creation fails | Check permissions, display error, EXIT |
584
- | index.json creation fails | Validate ba-writer, retry or fallback |
585
- | Feature ID not unique | Generate new ID, retry |
586
-
587
- ### Resume After Interruption
588
-
589
- If initialization was interrupted:
590
-
591
- 1. Check `.business-analyse/config.json` for currentFeature or currentProject
592
- 2. If project ID exists, search for project index.json in `docs/*/v*/` (or legacy `docs/business-analyse/`)
593
- - If found with scope = "project": resume project mode (see Project Resume below)
594
- 3. If feature ID exists, search for index.json in `docs/`
595
- 4. If found, check status and `metadata.workflow.lastCompletedStep`:
596
-
597
- **Status-based resume routing (check in this order):**
598
-
599
- - If status = `"handed-off"` or `"consolidated"`:
600
- → Display: "BA workflow complete. Use /business-analyse-html to generate HTML, /business-analyse-review for corrections."
601
- → STOP
602
-
603
- - If status = `"specified"` AND `metadata.workflow.allModulesSpecified === true`:
604
- → Resume at `step-04-consolidate.md`
605
- → Display: "All modules specified — resuming at consolidation..."
606
-
607
- - If status = `"specified"` AND `metadata.workflow.completedModules.length > 0` AND `metadata.workflow.completedModules.length < metadata.workflow.moduleOrder.length`:
608
- → Resume at `step-03-specify.md` (continue specifying remaining modules)
609
- → Display: "Resuming module specification ({completedCount}/{totalCount})..."
610
-
611
- - Otherwise: offer to resume from last completed step
612
-
613
- 5. If not found, create fresh index.json
614
-
615
- **Project Resume (project mode):**
616
-
617
- If a project-level index.json is found (scope = "project"):
618
-
619
- - If status = `"draft"` or `"framed"`:
620
- → Resume at `step-01-cadrage.md`
621
-
622
- - If status = `"decomposed"`:
623
- → Check `metadata.workflow.currentApplicationIndex` and `completedApplications[]`
624
- → Resume module specification for current application (step-02 or step-03)
456
+ ## Error Handling & Resume Logic
625
457
 
626
- - If status = `"specified"`:
627
- → All applications specified → Resume at `step-04-consolidate.md`
458
+ > → **Load** `references/init-resume-logic.md` for error handling matrix, resume detection, and status-based routing (draft → framed → decomposed → specified → consolidated → handed-off).
628
459
 
629
- - If status = `"consolidated"`:
630
- → Display: "BA workflow complete. Use /business-analyse-html to generate HTML."
631
- STOP
460
+ When re-running initialization, check for interrupted workflows:
461
+ 1. Read `.business-analyse/config.json` for currentFeature or currentProject
462
+ 2. Search for existing index.json files in `docs/` hierarchy
463
+ 3. Check status and route appropriately (see reference for status-based routing matrix)