@atlashub/smartstack-cli 3.33.0 → 3.35.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 (65) hide show
  1. package/.documentation/agents.html +5 -1
  2. package/.documentation/apex.html +644 -0
  3. package/.documentation/business-analyse.html +81 -1
  4. package/.documentation/cli-commands.html +5 -1
  5. package/.documentation/commands.html +5 -1
  6. package/.documentation/efcore.html +5 -1
  7. package/.documentation/gitflow.html +5 -1
  8. package/.documentation/hooks.html +5 -1
  9. package/.documentation/index.html +60 -2
  10. package/.documentation/init.html +414 -1
  11. package/.documentation/installation.html +5 -1
  12. package/.documentation/ralph-loop.html +365 -216
  13. package/.documentation/test-web.html +5 -1
  14. package/dist/index.js +32 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/mcp-entry.mjs +7 -24
  17. package/dist/mcp-entry.mjs.map +1 -1
  18. package/package.json +1 -2
  19. package/templates/agents/ba-writer.md +142 -15
  20. package/templates/mcp-scaffolding/controller.cs.hbs +5 -1
  21. package/templates/skills/apex/SKILL.md +9 -3
  22. package/templates/skills/apex/_shared.md +49 -4
  23. package/templates/skills/{ralph-loop → apex}/references/core-seed-data.md +20 -11
  24. package/templates/skills/{ralph-loop → apex}/references/error-classification.md +2 -1
  25. package/templates/skills/apex/references/post-checks.md +463 -3
  26. package/templates/skills/apex/references/smartstack-api.md +76 -8
  27. package/templates/skills/apex/references/smartstack-frontend.md +74 -1
  28. package/templates/skills/apex/references/smartstack-layers.md +21 -3
  29. package/templates/skills/apex/steps/step-00-init.md +121 -1
  30. package/templates/skills/apex/steps/step-01-analyze.md +58 -0
  31. package/templates/skills/apex/steps/step-02-plan.md +36 -0
  32. package/templates/skills/apex/steps/step-03-execute.md +114 -7
  33. package/templates/skills/apex/steps/step-04-examine.md +116 -2
  34. package/templates/skills/business-analyse/SKILL.md +31 -20
  35. package/templates/skills/business-analyse/_module-loop.md +68 -9
  36. package/templates/skills/business-analyse/_shared.md +80 -21
  37. package/templates/skills/business-analyse/questionnaire/00-application.md +4 -2
  38. package/templates/skills/business-analyse/questionnaire/00b-project.md +85 -0
  39. package/templates/skills/business-analyse/references/deploy-modes.md +69 -0
  40. package/templates/skills/business-analyse/references/team-orchestration.md +158 -7
  41. package/templates/skills/business-analyse/schemas/application-schema.json +15 -1
  42. package/templates/skills/business-analyse/schemas/project-schema.json +490 -0
  43. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +2 -1
  44. package/templates/skills/business-analyse/steps/step-00-init.md +220 -38
  45. package/templates/skills/business-analyse/steps/step-01-cadrage.md +184 -5
  46. package/templates/skills/business-analyse/steps/step-01b-applications.md +423 -0
  47. package/templates/skills/business-analyse/steps/step-02-decomposition.md +23 -6
  48. package/templates/skills/business-analyse/steps/step-03c-compile.md +14 -2
  49. package/templates/skills/business-analyse/steps/step-03d-validate.md +32 -7
  50. package/templates/skills/business-analyse/steps/step-04a-collect.md +111 -0
  51. package/templates/skills/business-analyse/steps/step-05a-handoff.md +296 -103
  52. package/templates/skills/business-analyse/steps/step-05b-deploy.md +46 -14
  53. package/templates/skills/documentation/SKILL.md +92 -2
  54. package/templates/skills/ralph-loop/SKILL.md +14 -17
  55. package/templates/skills/ralph-loop/references/category-rules.md +63 -683
  56. package/templates/skills/ralph-loop/references/compact-loop.md +188 -428
  57. package/templates/skills/ralph-loop/references/section-splitting.md +439 -0
  58. package/templates/skills/ralph-loop/references/team-orchestration.md +13 -14
  59. package/templates/skills/ralph-loop/steps/step-01-task.md +27 -0
  60. package/templates/skills/ralph-loop/steps/step-02-execute.md +80 -691
  61. package/templates/skills/ralph-loop/steps/step-03-commit.md +38 -79
  62. package/templates/skills/ralph-loop/steps/step-04-check.md +39 -58
  63. package/templates/skills/ralph-loop/steps/step-05-report.md +31 -123
  64. package/scripts/health-check.sh +0 -168
  65. package/scripts/postinstall.js +0 -18
@@ -51,6 +51,83 @@ Verify:
51
51
  - No orphan routes
52
52
  ```
53
53
 
54
+ ### 3b. Frontend Page Completeness (BLOCKING)
55
+
56
+ > **ROOT CAUSE (test-v4-015):** Frontend generation created List + Detail pages but SKIPPED
57
+ > Create + Edit pages. ListPage buttons navigated to /create and /:id/edit → white screen / 404.
58
+ > Tests were also missing. This section catches that failure mode.
59
+
60
+ ```bash
61
+ PAGE_DIR=$(find . -path "*/src/pages" -not -path "*/node_modules/*" -type d 2>/dev/null | head -1)
62
+ APP_TSX=$(find . -name "App.tsx" -not -path "*/node_modules/*" 2>/dev/null | head -1)
63
+
64
+ if [ -n "$PAGE_DIR" ]; then
65
+ # Check each module's ListPage for dead navigation links
66
+ LIST_PAGES=$(find "$PAGE_DIR" -name "*ListPage.tsx" -o -name "*sPage.tsx" 2>/dev/null | grep -v test | grep -v node_modules)
67
+ FAIL=false
68
+ for LIST_PAGE in $LIST_PAGES; do
69
+ LP_DIR=$(dirname "$LIST_PAGE")
70
+ MOD=$(basename "$LP_DIR")
71
+
72
+ HAS_CREATE_NAV=$(grep -P "navigate\(.*['/]create" "$LIST_PAGE" 2>/dev/null)
73
+ HAS_EDIT_NAV=$(grep -P "navigate\(.*['/]edit" "$LIST_PAGE" 2>/dev/null)
74
+
75
+ CREATE_PAGE=$(find "$LP_DIR" -name "*CreatePage.tsx" 2>/dev/null | head -1)
76
+ EDIT_PAGE=$(find "$LP_DIR" -name "*EditPage.tsx" 2>/dev/null | head -1)
77
+
78
+ if [ -n "$HAS_CREATE_NAV" ] && [ -z "$CREATE_PAGE" ]; then
79
+ echo "BLOCKING: $MOD ListPage navigates to /create but CreatePage does NOT exist → dead link"
80
+ FAIL=true
81
+ fi
82
+ if [ -n "$HAS_EDIT_NAV" ] && [ -z "$EDIT_PAGE" ]; then
83
+ echo "BLOCKING: $MOD ListPage navigates to /:id/edit but EditPage does NOT exist → dead link"
84
+ FAIL=true
85
+ fi
86
+ done
87
+
88
+ # Check route wiring in App.tsx
89
+ if [ -n "$APP_TSX" ]; then
90
+ CREATE_PAGES=$(find "$PAGE_DIR" -name "*CreatePage.tsx" 2>/dev/null | grep -v test)
91
+ EDIT_PAGES=$(find "$PAGE_DIR" -name "*EditPage.tsx" 2>/dev/null | grep -v test)
92
+ if [ -n "$CREATE_PAGES" ] && ! grep -qP "path:.*create" "$APP_TSX"; then
93
+ echo "BLOCKING: CreatePage exists but no 'create' route in App.tsx"
94
+ FAIL=true
95
+ fi
96
+ if [ -n "$EDIT_PAGES" ] && ! grep -qP "path:.*:id/edit" "$APP_TSX"; then
97
+ echo "BLOCKING: EditPage exists but no ':id/edit' route in App.tsx"
98
+ FAIL=true
99
+ fi
100
+ fi
101
+
102
+ # Check test files exist for form pages
103
+ FORM_PAGES=$(find "$PAGE_DIR" -name "*CreatePage.tsx" -o -name "*EditPage.tsx" 2>/dev/null | grep -v test)
104
+ if [ -n "$FORM_PAGES" ]; then
105
+ for FP in $FORM_PAGES; do
106
+ TF="${FP%.tsx}.test.tsx"
107
+ if [ ! -f "$TF" ]; then
108
+ echo "BLOCKING: Form page missing test: $FP → expected $TF"
109
+ FAIL=true
110
+ fi
111
+ done
112
+ fi
113
+
114
+ # Check at least SOME tests exist when pages exist
115
+ PAGE_COUNT=$(find "$PAGE_DIR" -name "*.tsx" ! -name "*.test.tsx" 2>/dev/null | grep -v node_modules | wc -l)
116
+ TEST_COUNT=$(find "$PAGE_DIR" -name "*.test.tsx" 2>/dev/null | grep -v node_modules | wc -l)
117
+ if [ "$PAGE_COUNT" -gt 0 ] && [ "$TEST_COUNT" -eq 0 ]; then
118
+ echo "BLOCKING: $PAGE_COUNT pages but ZERO test files"
119
+ FAIL=true
120
+ fi
121
+
122
+ if [ "$FAIL" = true ]; then
123
+ echo "Fix: Go back to step-03 and generate missing pages/tests/routes"
124
+ # MUST fix before proceeding
125
+ fi
126
+ fi
127
+ ```
128
+
129
+ **If ANY check fails → return to step-03 to generate the missing pages, tests, or routes.**
130
+
54
131
  ---
55
132
 
56
133
  ## 4. Build Verification
@@ -66,7 +143,13 @@ dotnet clean && dotnet restore && dotnet build
66
143
  npm run typecheck
67
144
  ```
68
145
 
69
- **BLOCKING:** Both must pass. If failure, fix and retry.
146
+ **BLOCKING:** Both must pass. If failure, classify error per `references/error-classification.md` before attempting fix:
147
+ - Category A (missing package) → `dotnet add package` → rebuild
148
+ - Category B (assembly conflict) → resolve version → rebuild
149
+ - Category C (DI missing) → fix DI registration → rebuild
150
+ - Category D (migration broken) → fix migration → rebuild
151
+ - Category E (config) → fix config → rebuild
152
+ - Category F (source code) → fix code → rebuild
70
153
 
71
154
  ---
72
155
 
@@ -179,7 +262,13 @@ AC2: {criterion} → PASS / FAIL (evidence: {file:line or test})
179
262
  | Security | TenantId filter, RequirePermission, no Guid.Empty, no !.Value | PASS / N/A |
180
263
  | Seed data | completeness, deterministic GUIDs, no ContextId/RoleId constants | PASS / N/A |
181
264
  | Code quality | PaginatedResult, EntityLookup (no FK select/input), CSS vars, search param | PASS / N/A |
182
- | POST-CHECKs | 30 checks from references/post-checks.md | PASS / N/A |
265
+ | Migration completeness | ModelSnapshot covers ALL DbSet entities (POST-CHECK 44, 49) | PASS / N/A |
266
+ | NavRoute kebab-case | NavRoute + permissions use kebab-case (POST-CHECK 48) | PASS / N/A |
267
+ | DateOnly DTOs | Date fields use DateOnly not string (POST-CHECK 47) | PASS / N/A |
268
+ | I18n registration | Namespaces registered in i18n config (POST-CHECK 45) | PASS / N/A |
269
+ | Validators DI | FluentValidation registered in DI (POST-CHECK 46) | PASS / N/A |
270
+ | Route/NavRoute conflict | No [Route] alongside [NavRoute] on controllers (POST-CHECK 50) | PASS / N/A |
271
+ | POST-CHECKs | 50 checks from references/post-checks.md | PASS / N/A |
183
272
  | Acceptance criteria | AC1..ACn | {X}/{Y} PASS |
184
273
  ```
185
274
 
@@ -211,3 +300,28 @@ ELSE:
211
300
  The success criteria require: "Tests: 100% pass, >= 80% coverage" — this is impossible without step-07.
212
301
 
213
302
  **NEXT ACTION:** Load `steps/step-07-tests.md` now.
303
+
304
+ ---
305
+
306
+ ## 11. PRD Final Reconciliation (delegate mode only)
307
+
308
+ > **After all validation passes**, ensure the PRD file reflects the completed state.
309
+
310
+ ```
311
+ IF delegate_mode:
312
+ Read {delegate_prd_path}
313
+
314
+ For ALL tasks belonging to this module:
315
+ IF task was executed by apex AND all checks passed:
316
+ Verify task.status == 'completed'
317
+ IF task was NOT in scope (different module):
318
+ Leave unchanged
319
+
320
+ Set prd.updated_at = new Date().toISOString()
321
+
322
+ If ALL module tasks completed:
323
+ Set prd.status = 'completed' (if single module)
324
+ OR leave prd.status = 'in_progress' (if multi-module, other modules remain)
325
+
326
+ Write back to {delegate_prd_path}
327
+ ```
@@ -5,13 +5,14 @@ argument-hint: "<feature description>"
5
5
  ---
6
6
 
7
7
  <objective>
8
- Execute business analysis workflows. This skill produces a single feature.json progressively enriched at each step, published to docs/business/ for web app rendering.
8
+ Execute business analysis workflows. This skill produces feature.json files progressively enriched at each step, published to docs/ for web app rendering.
9
9
 
10
- **Two use cases:**
11
- 1. **New application** — full analysis workflow for a new business need
10
+ **Three use cases:**
11
+ 1. **New application** — full analysis workflow for a new business need (single or multi-application)
12
12
  2. **Update** — delta changes on an existing application or module
13
+ 3. **Multi-application project** — when a project spans multiple independent applications (e.g., HR Management + Employee Self-Service)
13
14
 
14
- The skill auto-detects which use case applies by scanning existing features in `docs/business/`.
15
+ The skill auto-detects which use case applies by scanning existing features in `docs/business/`, `docs/platform/`, `docs/personal/`, and `docs/business-analyse/`.
15
16
 
16
17
  **Architecture highlights:**
17
18
  - Conditional context loading: each step loads only the shared files it needs (~54% context reduction)
@@ -42,6 +43,7 @@ The skill auto-detects which use case applies by scanning existing features in `
42
43
 
43
44
  Step-00 handles detection automatically:
44
45
  - **New vs Update**: scans `docs/business/` for existing applications
46
+ - **Single vs Multi-app**: multi-app detection in step-01, application identity confirmed in step-01b (always)
45
47
  - **Single vs Multi-module**: determined during step-02 decomposition
46
48
  - **Language**: detected from config or asked once
47
49
  - **Review mode**: if `-review` flag, routes directly to step-06
@@ -52,14 +54,18 @@ Step-00 handles detection automatically:
52
54
  **All outputs saved to PROJECT directory:**
53
55
 
54
56
  ```
55
- docs/business/
56
- index.json # BA manifest (auto-updated at handoff, consumed by web app viewer)
57
- {app}/business-analyse/v{X.Y}/
58
- feature.json # APPLICATION-level master (modules, dependencies, roles)
59
- ba-interactive.html # Client-facing interactive review document (deployed at handoff)
60
- {app}/{module}/business-analyse/v{X.Y}/
61
- feature.json # MODULE-level detail (entities, UC, FR, permissions, mockups)
57
+ docs/
58
+ business-analyse/v{X.Y}/
59
+ feature.json # PROJECT-level master (only if multi-app: applications, dependencies)
60
+ {context}/ # "business" | "platform" | "personal"
61
+ index.json # BA manifest (auto-updated at handoff, consumed by web app viewer)
62
+ {app}/business-analyse/v{X.Y}/
63
+ feature.json # APPLICATION-level master (modules, dependencies, roles)
64
+ ba-interactive.html # Client-facing interactive review document (deployed at handoff)
65
+ {app}/{module}/business-analyse/v{X.Y}/
66
+ feature.json # MODULE-level detail (entities, UC, FR, permissions, mockups)
62
67
  ```
68
+ > In standalone mode (single app), the project-level file is NOT created and `{context}` is always `business`.
63
69
 
64
70
  **Ralph Loop files (generated by step-05):**
65
71
  ```
@@ -143,10 +149,11 @@ When step-00 detects that the description matches an existing application:
143
149
  4. If no match → new application
144
150
  5. Create master feature.json and proceed to step-01
145
151
 
146
- **New application workflow:**
152
+ **New application workflow (single or multi-app):**
147
153
  - **Step 00:** Detection, scan existing, create master feature.json (draft)
148
154
  - **Step 01:** Cadrage: context, stakeholders, scope, application roles (framed)
149
- - **Step 02:** Decomposition: modules, dependencies, client checkpoint (decomposed)
155
+ - **Step 01b:** Application identity (always): confirm code, route, icon, seed data (lightweight single-app / full decomposition multi-app)
156
+ - **Step 02:** Decomposition: modules, dependencies, client checkpoint (decomposed) — per application in multi-app mode
150
157
  - **Step 03a:** Per-module data: sections, entities, business rules, questionnaires
151
158
  - **Step 03b:** Per-module UI: state machines, wireframes, layouts, dashboards
152
159
  - **Step 03c:** Per-module compile: actors, UCs, FRs, permissions, navigation, seed data, i18n
@@ -180,8 +187,9 @@ When step-00 detects that the description matches an existing application:
180
187
  | `{version}` | string | SemVer (1.0, 1.1, 2.0, etc.) |
181
188
  | `{application_name}` | string | Target application name |
182
189
  | `{module_name}` | string | Target module name |
183
- | `{context}` | string | Always "business" for BA |
184
- | `{workflow_mode}` | string | "application" or "module" |
190
+ | `{project_id}` | string | Project identifier (e.g., `PROJ-001`) — only in multi-app mode |
191
+ | `{context}` | string | "business" (default), "platform", or "personal" per application |
192
+ | `{workflow_mode}` | string | "project" (multi-app), "application" (single-app multi-module), or "module" (single) |
185
193
  | `{analysisMode}` | string | Always "interactive" — analysis phase is always interactive with the user |
186
194
  | `{docs_dir}` | string | `docs/business/{app}/{module}/business-analyse/v{X.Y}/` |
187
195
 
@@ -199,12 +207,13 @@ When step-00 detects that the description matches an existing application:
199
207
  | Step | File | Model | Purpose |
200
208
  | ---- | --------------------------------- | ------ | ---------------------------------------------------- |
201
209
  | 00 | `steps/step-00-init.md` | Sonnet | Auto-detect new/update, scan existing, create master feature.json |
202
- | 01 | `steps/step-01-cadrage.md` | Opus | Framing: context, stakeholders, scope, application roles |
203
- | 02 | `steps/step-02-decomposition.md` | Opus | Module decomposition, dependency graph, client checkpoint |
210
+ | 01 | `steps/step-01-cadrage.md` | Opus | Framing: context, stakeholders, scope, application roles + multi-app detection |
211
+ | 01b | `steps/step-01b-applications.md` | Opus | Application identity: confirm code, route, icon, seedData (lightweight single-app, full decomposition multi-app) |
212
+ | 02 | `steps/step-02-decomposition.md` | Opus | Module decomposition, dependency graph, client checkpoint (per application in multi-app) |
204
213
  | 03a1 | `steps/step-03a1-setup.md` | Opus | Per-module: setup, sections, questionnaires, cross-refs |
205
214
  | 03a2 | `steps/step-03a2-analysis.md` | Opus | Per-module: objectives, entities, BRs, process flow |
206
215
  | 03b | `steps/step-03b-ui.md` | Opus | Per-module: state machines, wireframes, layouts, dashboards |
207
- | 03c | `steps/step-03c-compile.md` | Opus | Per-module: actors, UCs, FRs, permissions, navigation, seedDataCore (7 arrays), i18n |
216
+ | 03c | `steps/step-03c-compile.md` | Opus | Per-module: actors, UCs, FRs, permissions, navigation, seedDataCore (9 arrays), i18n |
208
217
  | 03d | `steps/step-03d-validate.md` | Sonnet | Per-module: validation, write, incremental HTML, loop decision |
209
218
  | 04a | `steps/step-04a-collect.md` | Opus | Collect module summaries & cross-module interactions |
210
219
  | 04b | `steps/step-04b-analyze.md` | Opus | Analyze permission coherence, semantic validation, E2E flows |
@@ -223,7 +232,8 @@ Load ONLY relevant categories based on feature type:
223
232
 
224
233
  | Categorie | Fichier | Questions | Quand charger |
225
234
  | --------- | ------------------------------------- | --------- | ------------- |
226
- | 00 | `questionnaire/00-application.md` | 18 | Si workflow_mode = "application" |
235
+ | 00b | `questionnaire/00b-project.md` | 5 | Si workflow_mode = "project" (multi-app) |
236
+ | 00 | `questionnaire/00-application.md` | 18 | Si workflow_mode = "application" ou "project" |
227
237
  | 01 | `questionnaire/01-context.md` | 32 | Toujours |
228
238
  | 02 | `questionnaire/02-stakeholders.md` | 33 | Toujours |
229
239
  | 03 | `questionnaire/03-scope.md` | 32 | Toujours |
@@ -271,10 +281,11 @@ Load ONLY relevant categories based on feature type:
271
281
  - **Use ba-writer agent** for all JSON writes
272
282
  - **Use ba-reader agent** for all JSON reads
273
283
  - **Follow next_step directive** at end of each step
274
- - **Context: business only** - Reject platform/personal/system contexts
284
+ - **Context:** business-only in standalone mode; business/platform/personal per-application in project mode
275
285
  - **Use parallel agents** for codebase exploration
276
286
  - **Team mode** (2+ modules): After step-02, load `references/team-orchestration.md` and follow team protocol
277
287
  - **Inline mode** (1 module): Classic sequential execution, no team
288
+ - **Project mode** (2+ applications): Application loop wraps module loop — see `_module-loop.md`
278
289
  </execution_rules>
279
290
 
280
291
  <team_mode>
@@ -1,11 +1,11 @@
1
1
  # Business Analysis - Module Loop Protocol (_module-loop.md)
2
2
 
3
3
  > **Loaded by:** step-03a1-setup, step-03b-ui, step-03c-compile, step-03d-validate
4
- > **Purpose:** State management and iteration logic for multi-module specification loop
4
+ > **Purpose:** State management and iteration logic for multi-module specification loop + application loop (project mode)
5
5
 
6
6
  ---
7
7
 
8
- ## State Management
8
+ ## State Management (Application Mode — single app)
9
9
 
10
10
  ```json
11
11
  {
@@ -21,20 +21,61 @@
21
21
  }
22
22
  ```
23
23
 
24
- ## Loop Logic (end of each step-03 iteration)
24
+ ## State Management (Project Mode multi app)
25
25
 
26
+ Project-level feature.json tracks the application loop:
27
+
28
+ ```json
29
+ {
30
+ "metadata": {
31
+ "workflow": {
32
+ "mode": "project",
33
+ "applicationOrder": ["HumanResources", "EmployeeSelfService"],
34
+ "currentApplicationIndex": 0,
35
+ "completedApplications": [],
36
+ "currentApplication": "HumanResources"
37
+ }
38
+ }
39
+ }
26
40
  ```
27
- 1. Mark current module as "validated" in master feature.json
41
+
42
+ Each application-level feature.json tracks its own module loop (same as application mode).
43
+
44
+ ## Module Loop Logic (end of each step-03 iteration)
45
+
46
+ ```
47
+ 1. Mark current module as "validated" in application-level feature.json
28
48
  2. Add to completedModules[]
29
49
  3. IF currentModuleIndex + 1 < moduleOrder.length:
30
50
  currentModuleIndex++
31
51
  currentModule = moduleOrder[currentModuleIndex]
32
- Write master feature.json
52
+ Write application-level feature.json
33
53
  Display: "Module {name} complete. Next: {next_name} ({N}/{total})"
34
54
  RE-LOAD: steps/step-03a1-setup.md
35
- 4. ELSE:
36
- master.status = "specified"
37
- Load: steps/step-04a-collect.md
55
+ 4. ELSE (all modules for current application specified):
56
+ IF workflow.mode === "project":
57
+ Execute APPLICATION LOOP LOGIC (below)
58
+ ELSE:
59
+ application.status = "specified"
60
+ Load: steps/step-04a-collect.md
61
+ ```
62
+
63
+ ## Application Loop Logic (project mode only)
64
+
65
+ > Only applicable when `workflow.mode === "project"` in the project-level feature.json.
66
+
67
+ ```
68
+ 1. Mark current application as "specified" in project feature.json
69
+ ba-writer.updateApplicationStatus(projectId, currentApp, "specified")
70
+ 2. Add to completedApplications[]
71
+ ba-writer.advanceApplicationLoop(projectId)
72
+ 3. IF currentApplicationIndex + 1 < applicationOrder.length:
73
+ Display: "═══ Application {currentApp} complete ({N}/{total}). Next: {nextApp} ═══"
74
+ Load: steps/step-02-decomposition.md (for next application's module decomposition)
75
+ 4. ELSE (all applications specified):
76
+ Display: "═══ All applications specified! Proceeding to cross-application consolidation... ═══"
77
+ project.status = "specified"
78
+ Load: steps/step-04a-collect.md (with cross-application consolidation)
38
79
  ```
39
80
 
40
81
  ## Context Management During Loop
@@ -43,14 +84,32 @@ To prevent context explosion as modules accumulate:
43
84
  - **Current module:** Load full module feature.json
44
85
  - **Completed modules:** Only load compact summary via `ba-reader.getCompletedModulesSummary()` (max 100 lines)
45
86
  - **Master feature.json:** Only read workflow state + application roles
87
+ - **In project mode — completed applications:** Only load compact summary via `ba-reader.getCompletedApplicationsSummary()` (max 50 lines per app)
46
88
 
47
89
  ## Resume After Interruption
48
90
 
91
+ ### Application Mode (single app)
49
92
  ```
50
- 1. ba-reader.findApplicationFeature() -> locate master feature.json
93
+ 1. ba-reader.findApplicationFeature() -> locate application-level feature.json
51
94
  2. Read metadata.workflow.currentModuleIndex
52
95
  3. IF currentModule has a feature.json with status != "validated":
53
96
  Resume step-03a1-setup for that module
54
97
  4. ELSE:
55
98
  Start step-03a1-setup for next module
56
99
  ```
100
+
101
+ ### Project Mode (multi app)
102
+ ```
103
+ 1. ba-reader.findProjectFeature() -> locate project-level feature.json
104
+ 2. Read metadata.workflow.currentApplicationIndex
105
+ 3. Locate current application's feature.json
106
+ 4. Read application's metadata.workflow.currentModuleIndex
107
+ 5. IF currentModule has a feature.json with status != "validated":
108
+ Resume step-03a1-setup for that module in that application
109
+ 6. ELSE IF application has unspecified modules:
110
+ Start step-03a1-setup for next module in current application
111
+ 7. ELSE IF more applications remain:
112
+ Start step-02-decomposition for next application
113
+ 8. ELSE:
114
+ All done → Resume step-04a-collect
115
+ ```
@@ -12,25 +12,41 @@
12
12
 
13
13
  ## JSON-First Architecture
14
14
 
15
- All BA outputs are stored in **two levels** of feature.json, enriched progressively:
15
+ All BA outputs are stored in up to **three levels** of feature.json, enriched progressively:
16
+
17
+ ### Project-Level (Multi-App Master) — Only if 2+ applications
18
+ **Path:** `docs/business-analyse/v{X.Y}/feature.json`
19
+ **Schema:** `docs/business-analyse/schemas/project-schema.json`
20
+ **$schema:** `"../schemas/project-schema.json"`
21
+
22
+ | Step | Section enriched | Status after |
23
+ |------|-----------------|--------------|
24
+ | 00-init | metadata | draft |
25
+ | 01-cadrage | cadrage (global problem, stakeholders, scope, roles) | framed |
26
+ | 01b-applications | applications[], applicationDependencyGraph | decomposed |
27
+ | 02-05 | applications[].status updated per iteration | specified → handed-off |
28
+
29
+ > **Backward compatibility:** If only 1 application is identified, the project level is NOT created. The application-level feature.json remains the master (current behavior).
16
30
 
17
31
  ### Application-Level (Master)
18
- **Path:** `docs/business/{app}/business-analyse/v{X.Y}/feature.json`
19
- **Schema:** `docs/business/{app}/business-analyse/schemas/application-schema.json` (deployed to project by step-00)
32
+ **Path:** `docs/{context}/{app}/business-analyse/v{X.Y}/feature.json`
33
+ **Schema:** `docs/{context}/{app}/business-analyse/schemas/application-schema.json` (deployed to project by step-00)
20
34
  **$schema:** `"../schemas/application-schema.json"` (relative in feature.json)
21
35
 
22
36
  | Step | Section enriched | Status after |
23
37
  |------|-----------------|--------------|
24
- | 00-init | metadata | draft |
38
+ | 00-init (or 01b) | metadata | draft |
25
39
  | 01-cadrage | cadrage (problem, stakeholders, scope, roles) | framed |
26
40
  | 02-decomposition | modules, dependencyGraph | decomposed |
27
41
  | 03-specify | modules[].status updated per iteration | specified |
28
42
  | 04-consolidation | consolidation | consolidated |
29
43
  | 05-handoff | (per-module handoff) | handed-off |
30
44
 
45
+ > **{context}** = `business` (default) | `platform` | `personal` — determined per application. In standalone mode, always `business`.
46
+
31
47
  ### Module-Level (Per Module)
32
- **Path:** `docs/business/{app}/{module}/business-analyse/v{X.Y}/feature.json`
33
- **Schema:** `docs/business/{app}/business-analyse/schemas/feature-schema.json` (deployed to project by step-00)
48
+ **Path:** `docs/{context}/{app}/{module}/business-analyse/v{X.Y}/feature.json`
49
+ **Schema:** `docs/{context}/{app}/business-analyse/schemas/feature-schema.json` (deployed to project by step-00)
34
50
  **$schema:** `"../../../business-analyse/schemas/feature-schema.json"` (relative in feature.json)
35
51
 
36
52
  | Step | Section enriched | Status after |
@@ -42,10 +58,18 @@ All BA outputs are stored in **two levels** of feature.json, enriched progressiv
42
58
  | 03-specify (validate) | validation | validated |
43
59
 
44
60
  **Agents:**
45
- - **ba-writer**: Writes/updates feature.json (create, enrichSection, updateStatus, createVersion, createApplicationFeature, advanceModuleLoop)
46
- - **ba-reader**: Reads feature.json (findFeature, readSection, answerQuestion, getSummaryForSkill, readApplicationContext, getCompletedModulesSummary)
61
+ - **ba-writer**: Writes/updates feature.json (create, enrichSection, updateStatus, createVersion, createApplicationFeature, createProjectFeature, enrichApplicationRegistry, advanceModuleLoop, advanceApplicationLoop)
62
+ - **ba-reader**: Reads feature.json (findFeature, findProjectFeature, readSection, answerQuestion, getSummaryForSkill, readApplicationContext, getCompletedModulesSummary, getCompletedApplicationsSummary)
47
63
 
48
- **Schemas:** Deployed to project at `docs/business/{app}/business-analyse/schemas/` (9 files). Source: `schemas/` in skill directory. Every feature.json includes `$schema` relative reference.
64
+ **Schemas:** Deployed to project at `docs/{context}/{app}/business-analyse/schemas/` (10 files, including project-schema.json). Source: `schemas/` in skill directory. Every feature.json includes `$schema` relative reference.
65
+
66
+ ### Workflow Modes
67
+
68
+ | Mode | Trigger | Master Level | Loop |
69
+ |------|---------|-------------|------|
70
+ | `"module"` | 1 module only | Application | No loop |
71
+ | `"application"` | 1 app, 2+ modules | Application | Module loop |
72
+ | `"project"` | 2+ applications | Project | Application loop → Module loop per app |
49
73
 
50
74
  ---
51
75
 
@@ -74,6 +98,15 @@ Level 1: Context (business)
74
98
  Level 4: Section (approve) ← sidebar nav (workflow)
75
99
  ```
76
100
 
101
+ **CRITICAL — Application identification (Level 2):**
102
+ The application is formally identified in step-01b (ALWAYS, even for single-app mode):
103
+ - Code: PascalCase (e.g., "HumanResources")
104
+ - Route: kebab-case (e.g., "/business/human-resources")
105
+ - Icon: Lucide icon name
106
+ - Sort order: position in navigation
107
+ This creates the `seedDataCore.navigationApplications` entry that links modules to their parent application.
108
+ The `seedDataCore.applicationRoles` entries are also built from `cadrage.applicationRoles`.
109
+
77
110
  | BA Phase | Levels treated | What is defined |
78
111
  |----------|---------------|-----------------|
79
112
  | Cadrage (step-01) | Context + Application | Problem, stakeholders, scope, application-level roles |
@@ -135,15 +168,25 @@ Level 1: Context (business)
135
168
  ## Business Context Validation
136
169
 
137
170
  ```
138
- validate_business_context(context):
139
- IF context IN ['platform', 'personal', 'system'] THEN
140
- ERROR "BA restricted to 'business' context. Contact: support@atlshub.ch"
171
+ validate_business_context(context, workflow_mode):
172
+ IF workflow_mode === "project" THEN
173
+ // In project mode, applications can target any context
174
+ IF context IN ['business', 'platform', 'personal'] THEN
175
+ RETURN true
176
+ END IF
177
+ ERROR "Invalid context '${context}'. Allowed: business, platform, personal"
141
178
  RETURN false
179
+ ELSE
180
+ // In standalone mode, only business context is allowed
181
+ IF context IN ['platform', 'personal', 'system'] THEN
182
+ ERROR "BA restricted to 'business' context in standalone mode. Use multi-application project mode for other contexts."
183
+ RETURN false
184
+ END IF
185
+ RETURN true
142
186
  END IF
143
- RETURN true
144
187
  ```
145
188
 
146
- **CRITICAL:** BusinessAnalyze works ONLY for the `business` context.
189
+ **CRITICAL:** In standalone mode (single application), BA works ONLY for the `business` context. In project mode (multi-application), each application can target `business`, `platform`, or `personal` contexts.
147
190
 
148
191
  ---
149
192
 
@@ -151,12 +194,18 @@ validate_business_context(context):
151
194
 
152
195
  ```
153
196
  docs/
154
- business/
197
+ business-analyse/ <- PROJECT level (only if multi-app)
198
+ schemas/
199
+ project-schema.json
200
+ v1.0/
201
+ feature.json <- PROJECT master ($schema: ../schemas/project-schema.json)
202
+ {context}/ <- "business" | "platform" | "personal"
155
203
  {application}/
156
204
  business-analyse/
157
- schemas/ <- JSON SCHEMAS (deployed by step-00)
205
+ schemas/ <- JSON SCHEMAS (deployed by step-00)
158
206
  feature-schema.json
159
207
  application-schema.json
208
+ project-schema.json
160
209
  sections/
161
210
  analysis-schema.json
162
211
  discovery-schema.json
@@ -167,17 +216,19 @@ docs/
167
216
  shared/
168
217
  common-defs.json
169
218
  v1.0/
170
- feature.json <- APPLICATION master ($schema: ../schemas/application-schema.json)
219
+ feature.json <- APPLICATION master ($schema: ../schemas/application-schema.json)
171
220
  {module1}/
172
221
  business-analyse/
173
222
  v1.0/
174
- feature.json <- MODULE detail ($schema: ../../../business-analyse/schemas/feature-schema.json)
223
+ feature.json <- MODULE detail ($schema: ../../../business-analyse/schemas/feature-schema.json)
175
224
  {module2}/
176
225
  business-analyse/
177
226
  v1.0/
178
- feature.json <- MODULE detail
227
+ feature.json <- MODULE detail
179
228
  ```
180
229
 
230
+ > In standalone mode (single app), `{context}` is always `business` and the project-level directory is NOT created.
231
+
181
232
  **Ralph Loop Integration (generated by step-05):**
182
233
 
183
234
  ```
@@ -198,6 +249,12 @@ generate_feature_id():
198
249
  new_id = last_id + 1
199
250
  update_config(".business-analyse/config.json", "lastFeatureId", new_id)
200
251
  RETURN format("FEAT-%03d", new_id)
252
+
253
+ generate_project_id():
254
+ last_id = read_config(".business-analyse/config.json", "lastProjectId") OR 0
255
+ new_id = last_id + 1
256
+ update_config(".business-analyse/config.json", "lastProjectId", new_id)
257
+ RETURN format("PROJ-%03d", new_id)
201
258
  ```
202
259
 
203
260
  ---
@@ -206,10 +263,12 @@ generate_feature_id():
206
263
 
207
264
  | Level | Format | Example |
208
265
  |-------|--------|---------|
209
- | Module | `{context}.{app}.{module}.{action}` | `business.sales.orders.read` |
210
- | Section | `{context}.{app}.{module}.{section}.{action}` | `business.sales.orders.dashboard.read` |
266
+ | Module | `{context}.{app}.{module}.{action}` | `business.human-resources.employees.read` |
267
+ | Section | `{context}.{app}.{module}.{section}.{action}` | `business.human-resources.employees.departments.read` |
211
268
 
212
269
  > **Rule:** Use module-level permissions for standard CRUD. Use section-level permissions only when a section requires distinct access control (e.g., dashboard, approve, import).
270
+ >
271
+ > **CRITICAL — All segments use kebab-case:** Multi-word codes MUST have hyphens. `human-resources`, NOT `humanresources`. Matches NavRoute convention. SmartStack.app ref: `business.support-client.my-tickets.read`
213
272
 
214
273
  | Action | Permission | Usage |
215
274
  |--------|------------|-------|
@@ -1,8 +1,10 @@
1
1
  # Categorie 0 : Identite de l'application
2
2
 
3
- > **Charge par :** step-01-cadrage.md (mode application uniquement)
4
- > **Quand :** Toujours charge quand le mode est "application" (multi-module)
3
+ > **Charge par :** step-01-cadrage.md (mode application uniquement) ou step-01b-applications.md (mode project)
4
+ > **Quand :** Toujours charge quand le mode est "application" (multi-module) ou "project" (multi-application)
5
5
  > **Objectif :** Definir le cadre global de l'application avant d'entrer dans les details
6
+ >
7
+ > **Mode projet :** Si `workflow.mode === "project"`, certaines questions ont deja ete repondues au niveau projet (probleme, stakeholders, vision). Se concentrer sur l'identite specifique a cette application : nom, contexte, prefixe, roles specialises. Ne PAS re-demander les stakeholders et le probleme global.
6
8
 
7
9
  ---
8
10