@atlashub/smartstack-cli 4.74.0 → 4.76.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 (121) hide show
  1. package/dist/index.js +152 -31
  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/SKILL.md +2 -2
  9. package/templates/skills/apex/_shared.md +1 -1
  10. package/templates/skills/apex/references/checks/backend-checks.sh +21 -7
  11. package/templates/skills/apex/references/checks/frontend-checks.sh +26 -0
  12. package/templates/skills/apex/references/checks/infrastructure-checks.sh +47 -10
  13. package/templates/skills/apex/references/checks/seed-checks.sh +47 -7
  14. package/templates/skills/apex/references/core-seed-data.md +20 -18
  15. package/templates/skills/apex/references/frontend-route-wiring-app-tsx.md +3 -0
  16. package/templates/skills/apex/references/post-checks.md +23 -3
  17. package/templates/skills/apex/references/smartstack-api.md +4 -4
  18. package/templates/skills/apex/references/smartstack-frontend.md +54 -8
  19. package/templates/skills/apex/references/smartstack-layers.md +6 -6
  20. package/templates/skills/apex/steps/step-00-init.md +75 -1
  21. package/templates/skills/apex/steps/step-03-execute.md +16 -4
  22. package/templates/skills/apex/steps/step-03b-layer1-seed.md +65 -6
  23. package/templates/skills/apex/steps/step-03c-layer2-backend.md +50 -5
  24. package/templates/skills/apex/steps/step-03d-layer3-frontend.md +226 -4
  25. package/templates/skills/apex/steps/step-04-examine.md +163 -0
  26. package/templates/skills/apex-verify/SKILL.md +110 -0
  27. package/templates/skills/apex-verify/references/audit-rules.md +50 -0
  28. package/templates/skills/apex-verify/steps/step-00-init.md +119 -0
  29. package/templates/skills/apex-verify/steps/step-01-nav-audit.md +92 -0
  30. package/templates/skills/apex-verify/steps/step-02-crud-audit.md +127 -0
  31. package/templates/skills/apex-verify/steps/step-03-perm-audit.md +119 -0
  32. package/templates/skills/apex-verify/steps/step-04-route-audit.md +98 -0
  33. package/templates/skills/apex-verify/steps/step-05-report.md +110 -0
  34. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +3 -0
  35. package/templates/skills/application/templates-frontend.md +2 -2
  36. package/templates/skills/business-analyse/SKILL.md +17 -3
  37. package/templates/skills/business-analyse/_shared.md +64 -0
  38. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +34 -26
  39. package/templates/skills/business-analyse/questionnaire/01-context.md +13 -9
  40. package/templates/skills/business-analyse/questionnaire/02-stakeholders-scope.md +20 -27
  41. package/templates/skills/business-analyse/questionnaire.md +86 -9
  42. package/templates/skills/business-analyse/references/03-json-schemas.md +221 -0
  43. package/templates/skills/business-analyse/references/03-post-check-validation.md +208 -0
  44. package/templates/skills/business-analyse/references/03-smartstack-entity-guards.md +32 -0
  45. package/templates/skills/business-analyse/references/04-cross-module-validation.md +95 -0
  46. package/templates/skills/business-analyse/references/04-file-allocation.md +162 -0
  47. package/templates/skills/business-analyse/references/04-naming-audit-checks.md +174 -0
  48. package/templates/skills/business-analyse/references/04-semantic-validation-matrix.md +118 -0
  49. package/templates/skills/business-analyse/references/canonical-json-formats.md +7 -3
  50. package/templates/skills/business-analyse/references/domain-research-playbook.md +234 -0
  51. package/templates/skills/business-analyse/references/entity-sourcing-presentation.md +166 -0
  52. package/templates/skills/business-analyse/references/init-resume-logic.md +70 -0
  53. package/templates/skills/business-analyse/references/module-completeness-challenge.md +174 -0
  54. package/templates/skills/business-analyse/references/multi-app-detection.md +149 -0
  55. package/templates/skills/business-analyse/references/portal-classification.md +52 -0
  56. package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
  57. package/templates/skills/business-analyse/references/validation-checklist.md +35 -6
  58. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +50 -6
  59. package/templates/skills/business-analyse/steps/step-00-init.md +22 -190
  60. package/templates/skills/business-analyse/steps/step-01-cadrage.md +365 -269
  61. package/templates/skills/business-analyse/steps/step-02-structure.md +98 -20
  62. package/templates/skills/business-analyse/steps/step-03-specify.md +810 -229
  63. package/templates/skills/business-analyse/steps/step-04-consolidate.md +509 -278
  64. package/templates/skills/business-analyse-design/SKILL.md +10 -0
  65. package/templates/skills/business-analyse-design/references/screens-post-check.md +221 -0
  66. package/templates/skills/business-analyse-design/references/screens-type-mapping.md +138 -0
  67. package/templates/skills/business-analyse-design/references/smartcomponents-templates.md +225 -0
  68. package/templates/skills/{business-analyse → business-analyse-design}/references/spec-auto-inference.md +117 -117
  69. package/templates/skills/business-analyse-design/steps/step-01-screens.md +36 -162
  70. package/templates/skills/business-analyse-design/steps/step-02-wireframes.md +8 -7
  71. package/templates/skills/business-analyse-design/steps/step-03-navigation.md +89 -42
  72. package/templates/skills/business-analyse-develop/references/compact-loop.md +9 -0
  73. package/templates/skills/business-analyse-develop/references/handoff-quality-gate.md +132 -0
  74. package/templates/skills/business-analyse-develop/references/prd-v3-transformation.md +326 -0
  75. package/templates/skills/business-analyse-develop/references/report-reconciliation.md +140 -0
  76. package/templates/skills/business-analyse-develop/references/report-template.md +142 -0
  77. package/templates/skills/business-analyse-develop/steps/step-01-task.md +5 -177
  78. package/templates/skills/business-analyse-develop/steps/step-02-execute.md +17 -4
  79. package/templates/skills/business-analyse-develop/steps/step-03-commit.md +6 -2
  80. package/templates/skills/business-analyse-develop/steps/step-04-check.md +6 -0
  81. package/templates/skills/business-analyse-develop/steps/step-05-report.md +3 -269
  82. package/templates/skills/business-analyse-handoff/SKILL.md +10 -0
  83. package/templates/skills/business-analyse-handoff/references/agent-handoff-transform-prompt.md +211 -0
  84. package/templates/skills/business-analyse-handoff/references/context-isolation-pattern.md +47 -0
  85. package/templates/skills/business-analyse-handoff/references/handoff-file-inventory.md +49 -0
  86. package/templates/skills/business-analyse-handoff/references/handoff-global-validation.md +142 -0
  87. package/templates/skills/business-analyse-handoff/references/prd-validation-checks.md +125 -0
  88. package/templates/skills/business-analyse-handoff/references/project-index-update.md +98 -0
  89. package/templates/skills/business-analyse-handoff/steps/step-01-transform.md +9 -160
  90. package/templates/skills/business-analyse-handoff/steps/step-02-export.md +10 -99
  91. package/templates/skills/business-analyse-html/SKILL.md +10 -0
  92. package/templates/skills/business-analyse-html/html/ba-interactive.html +504 -97
  93. package/templates/skills/business-analyse-html/html/src/scripts/01-data-init.js +79 -2
  94. package/templates/skills/business-analyse-html/html/src/scripts/02-navigation.js +6 -46
  95. package/templates/skills/business-analyse-html/html/src/scripts/05-render-specs.js +80 -11
  96. package/templates/skills/business-analyse-html/html/src/scripts/06-render-consolidation.js +2 -2
  97. package/templates/skills/business-analyse-html/html/src/scripts/06-render-mockups.js +94 -36
  98. package/templates/skills/business-analyse-html/html/src/scripts/12-render-diagrams.js +162 -0
  99. package/templates/skills/business-analyse-html/html/src/styles/10-diagrams.css +73 -0
  100. package/templates/skills/business-analyse-html/html/src/template.html +2 -0
  101. package/templates/skills/business-analyse-html/references/02-embedded-artifacts-building.md +144 -0
  102. package/templates/skills/business-analyse-html/references/02-feature-data-building.md +143 -0
  103. package/templates/skills/business-analyse-html/references/02-mapping-tables.md +442 -0
  104. package/templates/skills/business-analyse-html/references/02-normalization-helpers.md +139 -0
  105. package/templates/skills/business-analyse-html/references/02-screen-format-detection.md +283 -0
  106. package/templates/skills/business-analyse-html/references/02-self-check-validation.md +199 -0
  107. package/templates/skills/business-analyse-html/references/data-build.md +24 -1
  108. package/templates/skills/business-analyse-html/references/data-mapping.md +119 -17
  109. package/templates/skills/business-analyse-html/steps/step-02-build-data.md +18 -555
  110. package/templates/skills/business-analyse-html/steps/step-04-verify.md +92 -3
  111. package/templates/skills/business-analyse-quick/SKILL.md +807 -0
  112. package/templates/skills/{sketch → business-analyse-quick}/references/domain-heuristics.md +59 -3
  113. package/templates/skills/business-analyse-quick/references/prd-schema.md +268 -0
  114. package/templates/skills/business-analyse-review/SKILL.md +10 -0
  115. package/templates/skills/business-analyse-review/references/review-data-mapping.md +6 -0
  116. package/templates/skills/business-analyse-status/SKILL.md +8 -0
  117. package/templates/skills/dev-start/SKILL.md +143 -307
  118. package/templates/skills/efcore/SKILL.md +13 -0
  119. package/templates/skills/sketch/SKILL.md +15 -153
  120. package/templates/skills/ui-components/SKILL.md +1 -1
  121. package/templates/skills/ui-components/patterns/data-table.md +1 -1
@@ -0,0 +1,234 @@
1
+ # Domain Research Playbook
2
+
3
+ > **Web research is the #1 quality differentiator.**
4
+ > An analysis WITHOUT research is a 2/10 regardless of structural quality.
5
+ > An analysis WITH multi-level research can be 8-10/10.
6
+ > This step takes 2-5 minutes per application and dramatically improves analysis quality.
7
+
8
+ ## MANDATORY — BLOCKING
9
+
10
+ Web research is **MANDATORY and BLOCKING**. This is NOT optional.
11
+
12
+ If WebSearch tool is unavailable:
13
+ 1. Display WARNING to user: "WebSearch indisponible. Qualite d'analyse degradee."
14
+ 2. AskUserQuestion: "Continuer sans recherche web ? (Non recommande — qualite 4/10 max)"
15
+ 3. IF user declines → STOP and recommend fixing WebSearch availability
16
+ 4. IF user confirms → proceed with `{domain_research}.source = "built-in-only"`
17
+ and flag EVERY module with `qualityFlag: "no-web-research"`
18
+ → Load `references/module-completeness-challenge.md` as primary fallback data source
19
+
20
+ ---
21
+
22
+ ## Level 1 : Recherche par APPLICATION (step-01 cadrage)
23
+
24
+ > **WHEN:** During step-01 Phase 1 (ECOUTE), BEFORE engaging the client.
25
+ > **WHO:** For EACH candidate application in a multi-app project, or the single app.
26
+
27
+ For EACH application:
28
+
29
+ ### 1a. Module Discovery Search (MANDATORY)
30
+
31
+ ```
32
+ Query: "{app_type} application modules features complete list"
33
+ ```
34
+
35
+ Examples:
36
+ - "billing invoicing application modules features complete list ERP"
37
+ - "HR human resources application modules features complete list"
38
+ - "CRM application modules features complete list"
39
+ - "project management application modules features complete list"
40
+
41
+ **EXTRACT:**
42
+ - Standard modules for this app type
43
+ - Which are CORE (always present) vs STANDARD vs OPTIONAL
44
+ - Common module names and their scope
45
+ - Module dependencies
46
+
47
+ ### 1b. Competitive Research (MANDATORY)
48
+
49
+ ```
50
+ Query: "best {app_type} software features comparison"
51
+ ```
52
+
53
+ Examples:
54
+ - "best invoicing software features comparison 2025"
55
+ - "best HR software absence management features"
56
+ - "best CRM software features comparison"
57
+ - "best project management software features"
58
+
59
+ **EXTRACT:**
60
+ - What do real commercial products offer? (BambooHR, Sage, Salesforce, etc.)
61
+ - Common features users expect as baseline
62
+ - Differentiating features that add value
63
+ - Features that are table stakes vs nice-to-have
64
+
65
+ ### 1c. Data Model Research (1 per app)
66
+
67
+ ```
68
+ Query: "{app_type} data model entities relationships best practices"
69
+ ```
70
+
71
+ **EXTRACT:**
72
+ - Standard entities and their relationships
73
+ - Common anti-patterns to avoid (e.g., "storing salary on Employee instead of salary history table")
74
+ - Industry-standard naming and cardinality
75
+
76
+ ### Storage Format
77
+
78
+ ```yaml
79
+ {domain_research}.applications[{app_code}]:
80
+ standardModules:
81
+ - name: "Invoices"
82
+ classification: "CORE" # CORE | STANDARD | OPTIONAL
83
+ description: "Invoice lifecycle management"
84
+ standardSections: ["list", "detail", "generate", "dashboard"]
85
+ - name: "CreditNotes"
86
+ classification: "CORE"
87
+ description: "Legally required for invoice corrections/cancellations"
88
+ standardSections: ["list", "detail"]
89
+ competitiveInsights:
90
+ - product: "Sage"
91
+ keyFeatures: ["auto-numbering", "multi-currency", "credit notes", "recurring invoices"]
92
+ - product: "Stripe Invoicing"
93
+ keyFeatures: ["payment tracking", "dunning", "tax calculation"]
94
+ dataModel:
95
+ entities: ["Invoice", "InvoiceLine", "CreditNote", "Payment", "PaymentTerm"]
96
+ relationships: ["Invoice → Client (N:1)", "Invoice → InvoiceLine (1:N)"]
97
+ antiPatterns: ["single invoice entity without credit notes"]
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Level 2 : Recherche par MODULE (step-03 specify)
103
+
104
+ > **WHEN:** During step-03 section A-bis, BEFORE entity specification.
105
+ > **WHO:** For EACH module with >= 2 entities. SKIP: Portal, pure config modules.
106
+
107
+ For EACH module:
108
+
109
+ ### 2a. Section/UX Research (MANDATORY)
110
+
111
+ ```
112
+ Query: "{module_domain} management system features screens views UX"
113
+ ```
114
+
115
+ Examples:
116
+ - "absence management system features screens views"
117
+ - "invoice management application features views UX"
118
+ - "CRM opportunity pipeline features screens"
119
+
120
+ **EXTRACT:**
121
+ - Standard sections/views (list, detail, calendar, kanban, etc.)
122
+ - **Contextual filtered views** — this is CRITICAL:
123
+ - Workflow modules: open-requests, rejected, history, my-{entity}
124
+ - Data modules: by-status, by-period, by-category
125
+ - Dashboard/reporting expectations
126
+ - Standard UX patterns (approval queue, batch actions, etc.)
127
+
128
+ ### 2b. Business Rules Research (MANDATORY for workflow modules)
129
+
130
+ ```
131
+ Query: "{module_domain} business rules validation constraints best practices"
132
+ ```
133
+
134
+ Examples:
135
+ - "absence leave management business rules HR constraints"
136
+ - "invoice billing business rules validation constraints"
137
+ - "CRM opportunity management business rules"
138
+
139
+ **EXTRACT:**
140
+ - **Domain-specific validation rules** (NOT just "date must be valid"):
141
+ - Half-day absences, notice periods, capacity limits
142
+ - Invoice sequential numbering, credit note linking
143
+ - Opportunity probability rules, stage-gate validation
144
+ - Calculation rules with formulas
145
+ - Workflow constraints and edge cases
146
+ - Regulatory/compliance requirements
147
+
148
+ ### 2c. Entity Design Research (1 per complex entity, OPTIONAL)
149
+
150
+ ```
151
+ Query: "{entity_name} entity design pattern ERP best practices"
152
+ ```
153
+
154
+ **EXTRACT:**
155
+ - Standard attributes for this entity type
156
+ - Versioned vs. inline data patterns (e.g., salary history)
157
+ - Common relationships and cardinality
158
+ - Known anti-patterns
159
+
160
+ ### Storage Format
161
+
162
+ ```yaml
163
+ {domain_research}.modules[{module_code}]:
164
+ sections:
165
+ standard: ["list", "detail", "approve", "calendar"]
166
+ contextualViews: ["open-requests", "rejected", "history", "my-balance"]
167
+ dashboard: ["absence-kpi", "team-calendar"]
168
+ businessRules:
169
+ domainSpecific:
170
+ - "Half-day absences (morning/afternoon)"
171
+ - "Minimum 48h notice for planned leave"
172
+ - "Max 30% of team absent simultaneously"
173
+ - "Carry-over days expire after March 31"
174
+ - "Medical certificate for absences > 3 days"
175
+ regulatory:
176
+ - "Minimum 25 days paid leave per year (France)"
177
+ entityPatterns:
178
+ Absence:
179
+ standardAttributes: ["employeeId", "typeId", "startDate", "endDate", "duration", "status", "halfDay"]
180
+ versionedData: []
181
+ workflowStates: ["Draft", "Submitted", "Approved", "Rejected", "Cancelled"]
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Level 3 : Recherche reglementaire (si applicable)
187
+
188
+ > **WHEN:** During step-01 for applicable domains, alongside Level 1 research.
189
+ > **WHO:** Billing/Finance, HR, any domain with legal requirements.
190
+
191
+ ### For Billing/Finance domains:
192
+ ```
193
+ Query: "{country} invoice legal requirements numbering format"
194
+ ```
195
+
196
+ **EXTRACT:** Sequential numbering, immutability of sent invoices, retention period, credit note requirements, VAT rules.
197
+
198
+ ### For HR domains:
199
+ ```
200
+ Query: "{country} absence leave legal requirements types"
201
+ ```
202
+
203
+ **EXTRACT:** Mandatory leave types, minimum days, carry-over rules, medical certificate requirements.
204
+
205
+ Store in: `{domain_research}.regulatory[]`
206
+
207
+ ---
208
+
209
+ ## Search Budget
210
+
211
+ | Project Type | Level 1 (per app) | Level 2 (per module) | Level 3 | Total |
212
+ |---|---|---|---|---|
213
+ | Single-app, 1-3 modules | 3 searches | 2/module = 4-6 | 0-2 | **7-11** |
214
+ | Single-app, 4-6 modules | 3 searches | 2/module = 8-12 | 0-2 | **11-17** |
215
+ | Multi-app (4 apps, ~10 modules) | 3/app = 12 | 2/module = 16-20 | 0-4 | **28-36** |
216
+
217
+ > **Token impact:** Each search returns ~500-1000 tokens. Total for a 4-app project: ~15K-30K tokens.
218
+ > This is a small price for dramatically improved analysis quality.
219
+
220
+ ---
221
+
222
+ ## Critical Notes
223
+
224
+ > **CRITICAL:** This research is INTERNAL context. Do NOT show raw search results to the client.
225
+ > Use the findings to:
226
+ > - **Challenge scope completeness** — flag CORE modules the user didn't mention
227
+ > - **Ground entity architecture** — use real-world data models, not guesswork
228
+ > - **Propose domain-specific business rules** — go beyond generic CRUD validation
229
+ > - **Anticipate contextual views** — workflow modules need filtered views
230
+ > - **Inform proactive suggestions** — "standard billing also includes credit notes because..."
231
+ > - **Prevent common anti-patterns** — catch mistakes before they become architecture
232
+
233
+ > **NEVER use research as an excuse to skip user validation.**
234
+ > Research INFORMS your proposals. The user VALIDATES them.
@@ -0,0 +1,166 @@
1
+ # Entity Sourcing Presentation (4-Phase Flow)
2
+
3
+ > **When the analysis detects a referenced entity/concept (e.g., "Projets" referenced by activities, "Clients" referenced by orders), ALWAYS analyze and recommend BEFORE asking the client.**
4
+ > This pattern detects potential new modules not mentioned in the original brief.
5
+
6
+ ## PHASE 1 — ULTRATHINK: Silent Architecture Analysis (NO output to client)
7
+
8
+ > **The AI reasons about the entity BEFORE presenting options. This is internal thinking only.**
9
+
10
+ ```
11
+ ULTRATHINK — Entity Architecture Analysis for {entity_name}:
12
+
13
+ 1. DOMAIN COHERENCE (from decision tree in reference)
14
+ - Application domain: {app_description}
15
+ - Entity fit: CORE | SUPPORT | PERIPHERAL
16
+ - Justification: {1 sentence — why this entity is/isn't core to the app}
17
+ - Example: "Projets" in a time management app = CORE (without projects, time entries have no target)
18
+ - Example: "Codes d'imputation" in a time management app = SUPPORT (useful for accounting, but not central)
19
+
20
+ 2. ENTITY SCORING (5 criteria, 0-3 each — from scoring grid in reference)
21
+ - Lifecycle: {score}/3 — {brief justification}
22
+ - Actors: {score}/3 — {brief justification}
23
+ - Relations: {score}/3 — {brief justification}
24
+ - Volume: {score}/3 — {brief justification}
25
+ - Autonomy: {score}/3 — {brief justification}
26
+ - TOTAL: {total}/15 → {classification: config_list | in_app | light_module | full_module}
27
+
28
+ 3. PRE-CLASSIFICATION CHECK (from entity patterns in reference)
29
+ - Does {entity_name} match a known pattern? → {yes: which one | no: use scoring}
30
+ - Override needed? → {yes: why | no}
31
+
32
+ 4. RECOMMENDATION
33
+ - Option: {config_list | in_app_section | new_module | external_system}
34
+ - Confidence: HIGH | MEDIUM | LOW
35
+ - Reasoning: {1-2 sentences}
36
+ - Risk if wrong choice: {what goes wrong if user picks a different option}
37
+
38
+ 5. IF recommendation = new_module → PRE-BUILD ARCHITECTURE
39
+ - Module code: {PascalCase}
40
+ - Section `list`: {main entity grid + create action + navigation to detail}
41
+ - Detail page tabs: [{tab_name: content}] (accessible by clicking a row in list)
42
+ - Additional sections: [{code: justification}] (ONLY functional sections: dashboard, approve, import, rapport...)
43
+ - Dependencies: [{which modules reference/are referenced by this entity}]
44
+ - Topological position: layer {N} (foundation if no dependencies)
45
+ ```
46
+
47
+ ## PHASE 2 — Present Analysis & Recommendation to Client
48
+
49
+ **BEFORE the AskUserQuestion, display the analysis as markdown:**
50
+
51
+ ```
52
+ ### {language == "fr" ? "Analyse" : "Analysis"} : {entity_plural}
53
+
54
+ {language == "fr"
55
+ ? "Les **{entity_plural}** sont référencés par {parent_module} ({relationship_description})."
56
+ : "**{entity_plural}** are referenced by {parent_module} ({relationship_description})."}
57
+
58
+ {language == "fr" ? "**Mon analyse :**" : "**My analysis:**"}
59
+ - {language == "fr" ? "Cohérence domaine" : "Domain coherence"} : **{CORE|SUPPORT|PERIPHERAL}** — {justification}
60
+ - {language == "fr" ? "Score de complexité" : "Complexity score"} : **{score}/15** ({classification})
61
+ - {language == "fr" ? "Recommandation" : "Recommendation"} : **{recommended_option}** — {reasoning}
62
+ ```
63
+
64
+ **IF recommendation = new_module AND confidence >= MEDIUM, ALSO display:**
65
+
66
+ ```
67
+ {language == "fr" ? "**Architecture proposée :**" : "**Proposed architecture:**"}
68
+
69
+ | {language == "fr" ? "Niveau" : "Level"} | {language == "fr" ? "Valeur" : "Value"} | {language == "fr" ? "Justification" : "Rationale"} |
70
+ |--------|--------|---------------|
71
+ | Application | `{app_code}` | {app_name} |
72
+ | Module | `{ModuleCode}` | {language == "fr" ? "{pourquoi ce découpage}" : "{why this decomposition}"} |
73
+
74
+ | Section | {language == "fr" ? "Justification" : "Rationale"} | Resources |
75
+ |---------|---------------|-----------|
76
+ | `list` | {language == "fr" ? "Page principale : grille, création, navigation vers détail" : "Main page: grid, create action, navigate to detail"} | {entity}-grid, {entity}-filters, {entity}-form |
77
+ | {additional_section} | {justification} | {resources} |
78
+
79
+ {language == "fr"
80
+ ? "**Page détail** (onglets accessibles depuis la liste) :"
81
+ : "**Detail page** (tabs accessible from list):"}
82
+
83
+ | {language == "fr" ? "Onglet" : "Tab"} | {language == "fr" ? "Contenu" : "Content"} |
84
+ |--------|---------|
85
+ | {language == "fr" ? "Informations" : "Information"} | {language == "fr" ? "Fiche principale" : "Main record"} |
86
+ | {tab_name} | {tab_content} |
87
+
88
+ {language == "fr"
89
+ ? "**Impact :** {ModuleName} deviendra une dépendance de {parent_module} (couche {N} du graphe)."
90
+ : "**Impact:** {ModuleName} will become a dependency of {parent_module} (layer {N} in the graph)."}
91
+ ```
92
+
93
+ ## PHASE 3 — Ask with Recommended Option First
94
+
95
+ **Order the options with the recommendation FIRST, marked "(Recommandé)" / "(Recommended)":**
96
+
97
+ ```
98
+ question: "{language == 'fr'
99
+ ? 'Comment souhaitez-vous gérer les {entity_plural} ?'
100
+ : 'How do you want to manage {entity_plural}?'}"
101
+ header: "{entity_name}"
102
+ options:
103
+ (ORDER: recommended option FIRST, then the 3 remaining options in logical order)
104
+
105
+ IF recommendation = new_module:
106
+ - label: "{language == 'fr' ? 'Nouveau module dédié (Recommandé)' : 'New dedicated module (Recommended)'}"
107
+ description: "{language == 'fr'
108
+ ? 'Module {ModuleCode} avec page liste, détail par onglets, permissions dédiées'
109
+ : '{ModuleCode} module with list page, tabbed detail, dedicated permissions'}"
110
+ - label: "{language == 'fr' ? 'Géré dans l\'app' : 'Managed in app'}"
111
+ description: "..."
112
+ - label: "{language == 'fr' ? 'Système externe' : 'External system'}"
113
+ description: "..."
114
+ - label: "{language == 'fr' ? 'Liste simple en config' : 'Simple config list'}"
115
+ description: "..."
116
+
117
+ IF recommendation = config_list:
118
+ - label: "{language == 'fr' ? 'Liste simple en config (Recommandé)' : 'Simple config list (Recommended)'}"
119
+ description: "{language == 'fr'
120
+ ? 'Table de référence administrable, pas de module dédié'
121
+ : 'Admin-managed reference table, no dedicated module'}"
122
+ - label: "{language == 'fr' ? 'Géré dans l\'app' : 'Managed in app'}"
123
+ description: "..."
124
+ - label: "{language == 'fr' ? 'Nouveau module dédié' : 'New dedicated module'}"
125
+ description: "..."
126
+ - label: "{language == 'fr' ? 'Système externe' : 'External system'}"
127
+ description: "..."
128
+
129
+ IF recommendation = in_app_section:
130
+ - label: "{language == 'fr' ? 'Géré dans l\'app (Recommandé)' : 'Managed in app (Recommended)'}"
131
+ description: "{language == 'fr'
132
+ ? 'Accessible via un onglet dans la page détail de {parent_module}'
133
+ : 'Accessible via a tab in {parent_module} detail page'}"
134
+ - label: "{language == 'fr' ? 'Nouveau module dédié' : 'New dedicated module'}"
135
+ description: "..."
136
+ - label: "{language == 'fr' ? 'Liste simple en config' : 'Simple config list'}"
137
+ description: "..."
138
+ - label: "{language == 'fr' ? 'Système externe' : 'External system'}"
139
+ description: "..."
140
+
141
+ IF recommendation = external_system:
142
+ - label: "{language == 'fr' ? 'Système externe (Recommandé)' : 'External system (Recommended)'}"
143
+ description: "{language == 'fr'
144
+ ? 'Les {entity_plural} viennent d\'un autre système (import ou API)'
145
+ : '{entity_plural} come from another system (import or API)'}"
146
+ - label: "{language == 'fr' ? 'Nouveau module dédié' : 'New dedicated module'}"
147
+ description: "..."
148
+ - label: "{language == 'fr' ? 'Géré dans l\'app' : 'Managed in app'}"
149
+ description: "..."
150
+ - label: "{language == 'fr' ? 'Liste simple en config' : 'Simple config list'}"
151
+ description: "..."
152
+
153
+ IF confidence = LOW (no clear recommendation):
154
+ (all 4 options in neutral order, NO "(Recommandé)" tag)
155
+ ```
156
+
157
+ ## PHASE 4 — Process Answer
158
+
159
+ | Choice | Action |
160
+ |--------|--------|
161
+ | **Géré dans l'app** | Entity becomes a sub-entity of the parent module. Add as a **tab in the detail page** of the referencing module. Note in coverageMatrix with `parentModule` field. |
162
+ | **Nouveau module dédié** | **Add new module to `{pre_analysis}.detected_modules[]`** with the proposed architecture (sections, detail tabs, dependencies). Add to `coverageMatrix` as inScope. The `list` section is ALWAYS the main section. Additional sections ONLY for distinct functional sections (dashboard, approve, import...). `create` and `edit` are ACTIONS within `list` and detail pages, NEVER standalone sections. |
163
+ | **Système externe** | Flag for integration specification. Add to `coverageMatrix` as integration. Load questionnaire materials on integrations if not already covered. |
164
+ | **Liste simple en config** | Entity becomes a lookup/reference table (no dedicated module, no section). Note in coverageMatrix as config data. |
165
+
166
+ > **CRITICAL:** The intelligence of this step is in the ULTRATHINK analysis. The AI must REASON about domain coherence, score the entity, and recommend — not just present 4 neutral options. The client can always override the recommendation, but they should benefit from expert architectural guidance.
@@ -0,0 +1,70 @@
1
+ # Initialize Resume Logic & Error Handling
2
+
3
+ > **Purpose:** Handle interruptions, resume previous workflows, and route based on status.
4
+ > Executed at the end of initialization to check if a workflow can be resumed.
5
+
6
+ ## Error Handling Matrix
7
+
8
+ | Error | Action |
9
+ |-------|--------|
10
+ | Config missing | Create fresh with defaults, continue |
11
+ | Directory creation fails | Check permissions, display error, EXIT |
12
+ | index.json creation fails | Validate ba-writer, retry or fallback |
13
+ | Feature ID not unique | Generate new ID, retry |
14
+
15
+ ## Resume After Interruption
16
+
17
+ If initialization was interrupted:
18
+
19
+ 1. Check `.business-analyse/config.json` for currentFeature or currentProject
20
+ 2. If project ID exists, search for project index.json in `docs/*/v*/` (or legacy `docs/business-analyse/`)
21
+ - If found with scope = "project": resume project mode (see Project Resume below)
22
+ 3. If feature ID exists, search for index.json in `docs/`
23
+ 4. If found, check status and `metadata.workflow.lastCompletedStep`
24
+
25
+ ## Status-Based Resume Routing (check in this order)
26
+
27
+ ### If status = `"handed-off"` or `"consolidated"`
28
+
29
+ → Display: "BA workflow complete. Use /business-analyse-html to generate HTML, /business-analyse-review for corrections."
30
+ → **STOP**
31
+
32
+ ### If status = `"specified"` AND `metadata.workflow.allModulesSpecified === true`
33
+
34
+ → Resume at `step-04-consolidate.md`
35
+ → Display: "All modules specified — resuming at consolidation..."
36
+
37
+ ### If status = `"specified"` AND `metadata.workflow.completedModules.length > 0` AND `metadata.workflow.completedModules.length < metadata.workflow.moduleOrder.length`
38
+
39
+ → Resume at `step-03-specify.md` (continue specifying remaining modules)
40
+ → Display: "Resuming module specification ({completedCount}/{totalCount})..."
41
+
42
+ ### Otherwise
43
+
44
+ → Offer to resume from last completed step
45
+
46
+ ### If not found
47
+
48
+ → Create fresh index.json
49
+
50
+ ## Project Resume (project mode)
51
+
52
+ If a project-level index.json is found (scope = "project"):
53
+
54
+ ### If status = `"draft"` or `"framed"`
55
+
56
+ → Resume at `step-01-cadrage.md`
57
+
58
+ ### If status = `"decomposed"`
59
+
60
+ → Check `metadata.workflow.currentApplicationIndex` and `completedApplications[]`
61
+ → Resume module specification for current application (step-02 or step-03)
62
+
63
+ ### If status = `"specified"`
64
+
65
+ → All applications specified → Resume at `step-04-consolidate.md`
66
+
67
+ ### If status = `"consolidated"`
68
+
69
+ → Display: "BA workflow complete. Use /business-analyse-html to generate HTML."
70
+ → **STOP**
@@ -0,0 +1,174 @@
1
+ # Module Completeness Challenge Reference
2
+
3
+ > **Purpose:** Industry-standard module expectations per application type.
4
+ > Used by step-01 (competitive challenge), step-02 (module completeness validation),
5
+ > and step-03 (section completeness per module).
6
+ > This is a FALLBACK when WebSearch is unavailable and a VALIDATION reference when it is.
7
+
8
+ ---
9
+
10
+ ## Application Archetypes
11
+
12
+ ### HR / Human Resources
13
+
14
+ **Minimum modules: 3**
15
+
16
+ | Module | Classification | Standard Sections | Key Entities |
17
+ |--------|---------------|-------------------|-------------|
18
+ | Employees | CORE | list, detail(tabs: info, contracts, documents, history), dashboard | Employee, Department, Position |
19
+ | Absences/Leave | CORE | list, detail, calendar, approve, open-requests, rejected, history, my-balance | Absence, AbsenceType, AbsenceBalance |
20
+ | Documents | STANDARD | list, detail, upload, my-documents | EmployeeDocument, DocumentType |
21
+ | Evaluations | OPTIONAL | list, detail, campaign, my-evaluation | Evaluation, EvaluationCriteria, Campaign |
22
+ | Organization | OPTIONAL | orgchart, departments | Department (hierarchy) |
23
+
24
+ **Standard business rules (Absences — domain-specific, NOT generic CRUD):**
25
+ - Half-day absences (morning/afternoon selection)
26
+ - Minimum notice period for planned leave (e.g., 48h for non-urgent)
27
+ - Team capacity limit (max % of team absent simultaneously)
28
+ - Probation period restrictions (limited leave types during probation)
29
+ - Carry-over limits and expiry dates (unused days expire after date X)
30
+ - Medical certificate required for absences exceeding N days
31
+ - Holiday calendar integration (exclude public holidays from business days)
32
+ - Consecutive day limits (max N consecutive days for certain leave types)
33
+ - Manager cannot approve their own absences (separation of duties)
34
+ - Balance recalculation on approval/cancellation
35
+
36
+ ---
37
+
38
+ ### CRM
39
+
40
+ **Minimum modules: 3**
41
+
42
+ | Module | Classification | Standard Sections | Key Entities |
43
+ |--------|---------------|-------------------|-------------|
44
+ | Accounts/Clients | CORE | list, detail(tabs: info, contacts, opportunities, documents, history), dashboard | Client, Contact, Address |
45
+ | Opportunities | CORE | list, detail, kanban/pipeline, dashboard, my-opportunities | Opportunity, PipelineStage, Activity |
46
+ | Quotes/Proposals | CORE | list, detail(tabs: info, lines, history) | Quote, QuoteLine |
47
+ | Activities/Tasks | STANDARD | list, detail, calendar, my-activities | Activity, ActivityType |
48
+ | Campaigns | OPTIONAL | list, detail, dashboard, targeting | Campaign, CampaignTarget |
49
+ | Products/Catalog | OPTIONAL | list, detail | Product, ProductCategory |
50
+
51
+ **Standard business rules (Opportunities — domain-specific):**
52
+ - Probability auto-updates based on pipeline stage
53
+ - Mandatory reason when moving to "Lost" stage
54
+ - Close date validation (cannot be in the past for active opps)
55
+ - Weighted pipeline calculation (amount * probability)
56
+ - Stage-gate validation (mandatory fields per stage)
57
+
58
+ ---
59
+
60
+ ### Billing / Invoicing
61
+
62
+ **Minimum modules: 3**
63
+
64
+ | Module | Classification | Standard Sections | Why CORE/STANDARD |
65
+ |--------|---------------|-------------------|-------------------|
66
+ | Invoices (Factures) | CORE | list, detail(tabs: info, lines, payments, history), generate, dashboard, overdue | Base entity — invoice lifecycle |
67
+ | Credit Notes (Avoirs) | CORE | list, detail(tabs: info, lines, history) | **Legally required** to correct/cancel invoices. Cannot have invoicing without credit notes. |
68
+ | Payment Tracking (Paiements) | CORE | list, detail, reconciliation, overdue, my-payments | **The whole point of invoicing** — who paid? who didn't? Partial payments? |
69
+ | Dunning/Collections (Relances) | STANDARD | list, detail, schedule, history, overdue-dashboard | Automated follow-up on unpaid invoices |
70
+ | Reporting | STANDARD | dashboard, export, period-comparison | Financial analysis, tax declarations |
71
+ | Configuration | OPTIONAL | invoice-templates, tax-rates, numbering-rules, payment-terms | Advanced setup |
72
+
73
+ **Why 1-module Billing is ALWAYS wrong:**
74
+ - Credit notes are legally required in most jurisdictions (EU, US, etc.)
75
+ - Payment tracking is the core purpose of invoicing (receivables management)
76
+ - Without dunning/collections, overdue invoices are invisible to the business
77
+ - A billing app without these is just a CRUD form, not a billing system
78
+ - Any web search for "billing software features" confirms these as table stakes
79
+
80
+ **Standard business rules (Invoices — domain-specific):**
81
+ - Sequential invoice numbering (no gaps, legally required)
82
+ - Immutability of sent invoices (cannot modify after sending)
83
+ - Credit note must reference original invoice
84
+ - Auto-transition to "Overdue" when dueDate passes and status != Paid
85
+ - Partial payment support (remainingAmount = total - paidAmount)
86
+ - Auto-generate from timesheet data (T&M projects)
87
+ - PDF generation on send (with legal mentions)
88
+ - Tax calculation rules (VAT, withholding, multi-rate)
89
+
90
+ ---
91
+
92
+ ### Project Management
93
+
94
+ **Minimum modules: 3**
95
+
96
+ | Module | Classification | Standard Sections | Key Entities |
97
+ |--------|---------------|-------------------|-------------|
98
+ | Projects | CORE | list, detail(tabs: info, tasks, team, budget, milestones, history), dashboard | Project, ProjectMember, ProjectBudget |
99
+ | Tasks | CORE | list, detail, kanban, my-tasks | Task, TaskAssignment |
100
+ | Time Tracking | STANDARD | list, timesheet, approve, my-entries | TimeEntry, TimeValidation |
101
+ | Milestones | STANDARD | list, timeline | Milestone |
102
+ | Resources/Team | OPTIONAL | list, allocation, availability | Resource, Allocation |
103
+ | Reports | OPTIONAL | dashboard, export | (aggregation views) |
104
+
105
+ **Standard business rules (Time Tracking — domain-specific):**
106
+ - Cannot log time on closed/completed projects
107
+ - Cannot log more than N hours per day
108
+ - Cannot log time in the future
109
+ - Timesheet submission deadline (e.g., end of week)
110
+ - Manager approval required before invoicing
111
+ - Rate calculation based on employee level/project rate
112
+ - Billable vs non-billable hours tracking
113
+
114
+ ---
115
+
116
+ ### E-commerce / Orders
117
+
118
+ **Minimum modules: 3**
119
+
120
+ | Module | Classification | Standard Sections |
121
+ |--------|---------------|-------------------|
122
+ | Products | CORE | list, detail(tabs: info, variants, pricing, stock), dashboard |
123
+ | Orders | CORE | list, detail(tabs: info, lines, payments, shipping, history), dashboard |
124
+ | Customers | CORE | list, detail(tabs: info, addresses, orders, history) |
125
+ | Inventory | STANDARD | list, movements, alerts |
126
+ | Shipping | STANDARD | list, detail, tracking |
127
+ | Returns | OPTIONAL | list, detail |
128
+
129
+ ---
130
+
131
+ ### Support / Ticketing
132
+
133
+ **Minimum modules: 3**
134
+
135
+ | Module | Classification | Standard Sections |
136
+ |--------|---------------|-------------------|
137
+ | Tickets | CORE | list, detail, dashboard, my-tickets, unassigned |
138
+ | Knowledge Base | CORE | list, detail, search |
139
+ | SLA Management | STANDARD | list, detail, dashboard |
140
+ | Categories | STANDARD | list, detail (hierarchy) |
141
+ | Reports | OPTIONAL | dashboard, export |
142
+
143
+ ---
144
+
145
+ ## Section Archetypes Per Module Pattern
146
+
147
+ ### Workflow Module (approval pattern)
148
+ **MANDATORY sections:** list, detail, approve
149
+ **STANDARD contextual views:** open-requests, rejected, history, my-{entity}
150
+ **OPTIONAL:** dashboard, calendar
151
+
152
+ ### Data-Centric Module (CRUD)
153
+ **MANDATORY sections:** list, detail
154
+ **STANDARD:** dashboard (if > 100 records/month), import, export
155
+ **OPTIONAL:** merge (deduplication)
156
+
157
+ ### Dashboard Module (reporting)
158
+ **MANDATORY sections:** dashboard
159
+ **STANDARD:** export, period-comparison
160
+ **OPTIONAL:** alerts, scheduled-reports
161
+
162
+ ---
163
+
164
+ ## Usage Protocol
165
+
166
+ 1. **step-01 (cadrage):** Use competitive research + this reference to challenge scope BEFORE scope lock
167
+ 2. **step-02 (structure):** Compare identified modules against archetype for EACH application
168
+ - CORE missing = **BLOCKING** AskUserQuestion (add / integrate / exclude with justification)
169
+ - STANDARD missing = WARNING + proactive suggestion
170
+ - Module count below minimum = **BLOCKING** challenge
171
+ 3. **step-03 (specify):** Compare sections against archetype for EACH module
172
+ - Propose missing standard sections via AskUserQuestion (multiSelect)
173
+ - Propose domain-specific business rules from archetype
174
+ 4. **step-04 (consolidate):** Verify all CORE modules accounted for (present or excluded with justification)