@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
@@ -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)
@@ -0,0 +1,149 @@
1
+ # Multi-App Detection Algorithm
2
+
3
+ > **Purpose:** Detect and extract multiple applications from user prompts using a two-tier approach.
4
+ > Executed early in initialization to determine `workflow_mode` ("application" vs "project").
5
+
6
+ ## Overview
7
+
8
+ When the user's prompt describes multiple applications or spans multiple business domains, we must recognize this immediately and set `workflow.mode = "project"` to avoid doing cadrage for a single app.
9
+
10
+ ## Tier 1 — Explicit Patterns (ANY match = multi-app detected)
11
+
12
+ ### French patterns:
13
+ - "une application X ... une application Y" (two occurrences of "une application")
14
+ - "application 1: X ... application 2: Y" (numbered applications)
15
+ - "première application ... deuxième application"
16
+ - "app 1: ... app 2: ..."
17
+
18
+ ### English patterns:
19
+ - "an application (for) X ... an application (for) Y" (two occurrences)
20
+ - "application #1: ... application #2: ..." (numbered)
21
+ - "first app ... second app"
22
+
23
+ ### Decision:
24
+
25
+ If ANY of these patterns is found in `{feature_description}`:
26
+ → `isMultiApp = true`, `detectionTier = "explicit"`
27
+
28
+ ## Tier 2 — Domain Diversity Analysis (when Tier 1 does not match)
29
+
30
+ ### Definition
31
+
32
+ A "domain" is an autonomous business perimeter with its own entities and processes (e.g., HR, CRM, Finance, Projects, Sales, Inventory).
33
+
34
+ ### Algorithm
35
+
36
+ ULTRATHINK: Analyze `{feature_description}` to extract distinct business domains.
37
+
38
+ 1. List all business domains mentioned or implied in the description
39
+ 2. Classify each domain:
40
+ - **DISTINCT** — has its own entities, processes, and lifecycle (e.g., HR vs CRM)
41
+ - **RELATED** — is a sub-domain of another (e.g., Payroll is a sub-domain of HR)
42
+ 3. Count DISTINCT domains only
43
+
44
+ ### Threshold
45
+
46
+ 2+ DISTINCT domains → `isMultiApp = true`, `detectionTier = "domain-diversity"`
47
+
48
+ ### False Positive Protection
49
+
50
+ - "RH complet avec employés, congés, paie, pointage" = 1 domain (HR) with 4 modules, NOT 4 domains
51
+ - "HR and Payroll management" = 1 domain (HR) with 2 modules — Payroll is RELATED to HR
52
+ - "gestion commerciale avec devis, commandes et facturation" = 1 domain (Sales) with 3 modules
53
+ - Only count as DISTINCT when domains have genuinely independent entity models and processes
54
+
55
+ ## Extraction Algorithm (depends on detection tier)
56
+
57
+ ### IF Tier 1 (explicit):
58
+
59
+ 1. **Identify boundaries:** Split the prompt at each "une application" / "an application" occurrence. Each block = one candidate.
60
+ 2. **Extract per candidate:** For each block, derive `name` (application name), `description` (summary of purpose), and `modules[]` (listed modules/features).
61
+ - Example: `[{ name: "RH", description: "gestion des employés, congés, temps", modules: ["Employés", "Congés", "Temps"] }, ...]`
62
+ 3. **Detect shared modules:** Collect all module names across all candidates. Any module appearing in more than one candidate is a shared module.
63
+ - Example: `sharedModules = ["Temps"]` (appears in both RH and Projet)
64
+
65
+ ### IF Tier 2 (domain-diversity):
66
+
67
+ 1. Each DISTINCT domain = 1 candidate application:
68
+ - `name` = short domain label (e.g., "RH", "CRM", "Finance")
69
+ - `description` = user's expressed need for that domain
70
+ - `modules[]` = sub-functionalities mentioned (can be empty → "(à définir au cadrage)")
71
+ 2. Group RELATED sub-domains under their parent DISTINCT domain as modules
72
+ 3. **Detect shared modules:** Same logic as Tier 1 — modules appearing in multiple candidates
73
+
74
+ ## Confirmation Dialogue
75
+
76
+ Display detection result:
77
+
78
+ ```
79
+ {detectionTier == "explicit"
80
+ ? (language == "fr"
81
+ ? "### Détection multi-application\n\nJ'ai détecté **{candidates.length} applications** dans votre description :"
82
+ : "### Multi-application detection\n\nI detected **{candidates.length} applications** in your description:")
83
+ : (language == "fr"
84
+ ? "### Détection multi-application\n\nVotre description couvre **{candidates.length} domaines métier distincts**. Chaque domaine pourrait constituer une application séparée :"
85
+ : "### Multi-application detection\n\nYour description covers **{candidates.length} distinct business domains**. Each domain could be a separate application:")}
86
+
87
+ | # | Application | Modules identifiés |
88
+ |---|-------------|-------------------|
89
+ {for each candidate: index | name | modules.join(", ") || "(à définir au cadrage)"}
90
+
91
+ {sharedModules.length > 0
92
+ ? "⚠️ **Modules partagés détectés :** {sharedModules.join(', ')} — ces modules apparaissent dans plusieurs applications. Ils pourraient constituer une application transversale dédiée."
93
+ : ""}
94
+ ```
95
+
96
+ ### AskUserQuestion Options
97
+
98
+ ```
99
+ question: "{language == 'fr' ? 'Confirmez-vous cette structure multi-application ?' : 'Do you confirm this multi-application structure?'}"
100
+ header: "Architecture"
101
+ options:
102
+ - label: "{language == 'fr' ? 'Oui, {candidates.length} applications' : 'Yes, {candidates.length} applications'}"
103
+ description: "{language == 'fr' ? 'Créer un projet avec les applications identifiées' : 'Create a project with the identified applications'}"
104
+ - label: "{language == 'fr' ? 'Extraire les modules partagés' : 'Extract shared modules'}" (only if sharedModules.length > 0)
105
+ 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)'}"
106
+ - label: "{language == 'fr' ? 'Regrouper certains domaines' : 'Regroup some domains'}" (only if detectionTier == "domain-diversity")
107
+ description: "{language == 'fr' ? 'Fusionner des domaines en moins d\\'applications' : 'Merge domains into fewer applications'}"
108
+ - label: "{language == 'fr' ? 'Application unique' : 'Single application'}"
109
+ description: "{language == 'fr' ? 'Tout regrouper en une seule application avec plusieurs modules' : 'Group everything into one application with multiple modules'}"
110
+ ```
111
+
112
+ ## Handling User Responses
113
+
114
+ ### IF "Oui, N applications" or "Extraire les modules partagés":
115
+
116
+ ```yaml
117
+ workflow_mode: "project"
118
+ project_name: derived from feature_description
119
+ candidate_applications: [{ name, description, modules, context }]
120
+ shared_modules_extracted: boolean # true if user chose extraction
121
+ ```
122
+
123
+ → Skip step 4 (application name) — applications will be confirmed in step-01-cadrage
124
+ → Continue to step 5 (language selection)
125
+
126
+ ### IF "Regrouper certains domaines" (Tier 2 only):
127
+
128
+ Ask via AskUserQuestion:
129
+ ```
130
+ 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\")'}"
131
+ header: "Regroupement"
132
+ ```
133
+
134
+ Process user response:
135
+ 1. Parse the grouping instructions (natural language)
136
+ 2. Rebuild `candidate_applications` based on the specified groups
137
+ 3. Re-display the confirmation dialogue with the updated candidates
138
+
139
+ ### IF "Application unique":
140
+
141
+ ```yaml
142
+ workflow_mode: "application"
143
+ ```
144
+
145
+ → Continue to step 4 normally
146
+
147
+ ### IF no multi-app detected (neither Tier 1 nor Tier 2):
148
+
149
+ → Continue to step 4 normally
@@ -0,0 +1,52 @@
1
+ # Portal Classification
2
+
3
+ > **Note :** La detection initiale des utilisateurs externes a lieu dans le batch 1 (4a).
4
+ > Ce bloc RESOUT la detection en classifiant les stakeholders et configurant le portail.
5
+
6
+ ## External Signals Detection
7
+
8
+ ```
9
+ EXTERNAL_SIGNALS = ["client", "customer", "fournisseur", "supplier", "partenaire",
10
+ "partner", "portail", "portal", "externe", "external", "tiers", "third-party",
11
+ "organisation cliente"]
12
+ ```
13
+
14
+ ## SmartStack Native Support
15
+
16
+ > **SmartStack gère nativement les utilisateurs externes :**
17
+ > - **Person Extension Pattern** : User → Employee, Contact, Customer via `UserId` FK
18
+ > - **Organisation Extension** : Organisation → Client, Supplier via `OrganisationId` FK
19
+ > - **Multi-tenant** : portail et interne déployés sur des tenants séparés automatiquement
20
+
21
+ ## Classification and Portal Mode Resolution
22
+
23
+ SI `_portalDetected` (from batch 1) OU un profil stakeholder (batch 2) match EXTERNAL_SIGNALS :
24
+ → **Auto-classifier** chaque stakeholder : `audience: "internal" | "external" | "shared"`
25
+ → **Auto-déduire** `_portalMode` :
26
+
27
+ | Stakeholders détectés | `_portalMode` |
28
+ |----------------------|---------------|
29
+ | Internes + Externes | `"dual"` |
30
+ | Uniquement externes | `"portal-only"` |
31
+ | Uniquement internes | `"internal-only"` |
32
+
33
+ ## Portal Module Rule (SCOPE LOCK)
34
+
35
+ SI `_portalMode = "dual"` ou `"portal-only"`:
36
+ Un portail = UN module "Portal" avec des sections view par entite.
37
+ INTERDICTION de creer des modules separes MyAccount, MyProjects, MyInvoices.
38
+ Le module Portal aura des sections (view/inherit) pour chaque zone accessible.
39
+
40
+ ## Client Notification
41
+
42
+ → **Informer le client** (statement, PAS de question) :
43
+
44
+ ```
45
+ "{language == 'fr'
46
+ ? 'J\'ai détecté des utilisateurs externes ({profiles}). SmartStack déploiera automatiquement un portail dédié ({_portalMode}) avec isolation multi-tenant. Les extensions Person/Organisation gèrent nativement la séparation des profils internes et externes.'
47
+ : 'I detected external users ({profiles}). SmartStack will automatically deploy a dedicated portal ({_portalMode}) with multi-tenant isolation. Person/Organisation extensions natively handle the separation of internal and external profiles.'}"
48
+ ```
49
+
50
+ ## Default Case
51
+
52
+ SI aucun profil ne match EXTERNAL_SIGNALS → `_portalMode = "internal-only"` (défaut silencieux, rien à informer).
@@ -262,7 +262,36 @@ const checklist = {
262
262
  details: "Modules need field validation rules"
263
263
  },
264
264
 
265
- // SECTION 10: GHERKIN SCENARIOS (BLOCKING for format, WARNING for count)
265
+ // SECTION 10: ANALYSIS DEPTH (BLOCKING)
266
+ analysisDepthRules: {
267
+ check: "Business rules include domain-specific rules (not just generic CRUD)",
268
+ status: countDomainSpecificRules(analysis.businessRules) >= 2 ? "PASS" : "FAIL",
269
+ blocking: true,
270
+ details: "Module must have at least 2 domain-specific rules beyond basic validation. " +
271
+ "Generic rules: date coherence, required fields, unique constraints, basic workflow transitions. " +
272
+ "Domain-specific: half-day absences, team capacity limits, carry-over expiry, " +
273
+ "invoice sequential numbering, credit note linking, opportunity probability rules, etc. " +
274
+ "If C-pre (Business Rules Domain Research) was executed, these should come from web research."
275
+ },
276
+
277
+ sectionCompleteness: {
278
+ check: "Workflow modules have contextual filtered views",
279
+ status: (moduleFeatureType === "workflow" && hasContextualViews(analysis.anticipatedSections)) ? "PASS" : "FAIL",
280
+ blocking: true,
281
+ details: "Workflow modules must have at least 1 contextual filtered view " +
282
+ "(e.g., open-requests, rejected, my-X, history) beyond the base CRUD sections. " +
283
+ "A workflow module with only list/detail/approve is incomplete."
284
+ },
285
+
286
+ webResearchPerformed: {
287
+ check: "Web research was performed for this module",
288
+ status: module.domainResearchSource !== "built-in-only" ? "PASS" : "WARNING",
289
+ blocking: false,
290
+ details: "Modules without web research have lower completeness confidence. " +
291
+ "Domain-specific rules and sections may be missing."
292
+ },
293
+
294
+ // SECTION 11: GHERKIN SCENARIOS (BLOCKING for format, WARNING for count)
266
295
  gherkinFormat: {
267
296
  check: "gherkinScenarios is ARRAY (not single object)",
268
297
  status: Array.isArray(specification.gherkinScenarios) ? "PASS" : "FAIL",
@@ -29,18 +29,51 @@
29
29
  "category": { "type": "string", "enum": ["validation", "calculation", "workflow", "security", "data"] },
30
30
  "statement": { "type": "string", "description": "IF ... THEN ... ELSE ..." },
31
31
  "priority": { "type": "string", "enum": ["must", "should", "could"] },
32
- "conditions": { "type": "array", "items": { "type": "string" } },
32
+ "conditions": {
33
+ "type": "array",
34
+ "items": {
35
+ "oneOf": [
36
+ { "type": "string" },
37
+ {
38
+ "type": "object",
39
+ "properties": {
40
+ "entity": { "type": "string" },
41
+ "field": { "type": "string" },
42
+ "operator": { "type": "string", "enum": ["==", "!=", ">", "<", ">=", "<=", "in", "not-in", "is-null", "is-not-null"] },
43
+ "value": {}
44
+ }
45
+ }
46
+ ]
47
+ }
48
+ },
33
49
  "examples": {
34
50
  "type": "array",
35
51
  "items": {
36
52
  "type": "object",
53
+ "required": ["input", "expected"],
37
54
  "properties": {
38
- "input": { "type": "string" },
39
- "expected": { "type": "string" }
55
+ "input": { "type": "string", "description": "Concrete input values" },
56
+ "expected": { "type": "string", "description": "Expected result/behavior" }
57
+ }
58
+ }
59
+ },
60
+ "testability": { "type": "string" },
61
+ "formula": { "type": "string", "description": "BR-CALC calculation formulas" },
62
+ "sectionCode": { "type": "string", "description": "Section code the rule applies to" },
63
+ "severity": { "type": "string", "enum": ["blocking", "warning", "info"] },
64
+ "consequences": {
65
+ "type": "array",
66
+ "items": {
67
+ "type": "object",
68
+ "required": ["type", "target"],
69
+ "properties": {
70
+ "type": { "type": "string", "enum": ["notification", "field-update", "status-change", "block-action", "recalculate"] },
71
+ "target": { "type": "string" },
72
+ "description": { "type": "string" }
40
73
  }
41
74
  }
42
75
  },
43
- "testability": { "type": "string" }
76
+ "domainSpecific": { "type": "boolean", "default": false, "description": "True if from domain research" }
44
77
  }
45
78
  }
46
79
  },