@atlashub/smartstack-cli 3.32.0 → 3.34.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 (55) 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 +5 -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/package.json +1 -1
  15. package/templates/agents/ba-writer.md +142 -15
  16. package/templates/skills/apex/SKILL.md +7 -1
  17. package/templates/skills/apex/_shared.md +49 -4
  18. package/templates/skills/{ralph-loop → apex}/references/core-seed-data.md +20 -11
  19. package/templates/skills/{ralph-loop → apex}/references/error-classification.md +2 -1
  20. package/templates/skills/apex/references/post-checks.md +238 -3
  21. package/templates/skills/apex/references/smartstack-api.md +47 -7
  22. package/templates/skills/apex/references/smartstack-frontend.md +47 -1
  23. package/templates/skills/apex/references/smartstack-layers.md +3 -1
  24. package/templates/skills/apex/steps/step-00-init.md +48 -1
  25. package/templates/skills/apex/steps/step-01-analyze.md +37 -0
  26. package/templates/skills/apex/steps/step-02-plan.md +36 -0
  27. package/templates/skills/apex/steps/step-03-execute.md +42 -2
  28. package/templates/skills/apex/steps/step-04-examine.md +110 -2
  29. package/templates/skills/business-analyse/SKILL.md +29 -19
  30. package/templates/skills/business-analyse/_module-loop.md +68 -9
  31. package/templates/skills/business-analyse/_shared.md +71 -21
  32. package/templates/skills/business-analyse/questionnaire/00-application.md +4 -2
  33. package/templates/skills/business-analyse/questionnaire/00b-project.md +85 -0
  34. package/templates/skills/business-analyse/references/deploy-modes.md +69 -0
  35. package/templates/skills/business-analyse/references/team-orchestration.md +158 -7
  36. package/templates/skills/business-analyse/schemas/application-schema.json +2 -1
  37. package/templates/skills/business-analyse/schemas/project-schema.json +490 -0
  38. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +2 -1
  39. package/templates/skills/business-analyse/steps/step-00-init.md +30 -4
  40. package/templates/skills/business-analyse/steps/step-01-cadrage.md +62 -2
  41. package/templates/skills/business-analyse/steps/step-01b-applications.md +252 -0
  42. package/templates/skills/business-analyse/steps/step-02-decomposition.md +23 -6
  43. package/templates/skills/business-analyse/steps/step-03d-validate.md +27 -6
  44. package/templates/skills/business-analyse/steps/step-04a-collect.md +111 -0
  45. package/templates/skills/business-analyse/steps/step-05a-handoff.md +296 -103
  46. package/templates/skills/business-analyse/steps/step-05b-deploy.md +46 -14
  47. package/templates/skills/documentation/SKILL.md +92 -2
  48. package/templates/skills/ralph-loop/SKILL.md +9 -17
  49. package/templates/skills/ralph-loop/references/category-rules.md +43 -692
  50. package/templates/skills/ralph-loop/references/compact-loop.md +104 -427
  51. package/templates/skills/ralph-loop/references/team-orchestration.md +13 -14
  52. package/templates/skills/ralph-loop/steps/step-02-execute.md +49 -704
  53. package/templates/skills/ralph-loop/steps/step-03-commit.md +38 -79
  54. package/templates/skills/ralph-loop/steps/step-04-check.md +39 -58
  55. package/templates/skills/ralph-loop/steps/step-05-report.md +12 -123
@@ -17,6 +17,8 @@ All code goes through skills (/controller, /application, /ui-components, /efcore
17
17
  - **ALWAYS** read `references/smartstack-frontend.md` — lazy loading, i18n, page structure, CSS variables
18
18
  - Read `references/smartstack-layers.md` for execution rules per layer
19
19
  - If NOT `{economy_mode}` AND Layer 1 has parallel work: read `references/agent-teams-protocol.md`
20
+ - If `{delegate_mode}` AND seedData tasks exist: read `references/core-seed-data.md` — comprehensive seed data templates
21
+ - If build failure during execution: read `references/error-classification.md` — error diagnosis categories A-F
20
22
 
21
23
  ---
22
24
 
@@ -92,13 +94,24 @@ Code stays in CreateDto, user provides it, validator has regex rule.
92
94
  **For frontend tasks (economy_mode):** Follow the same rules as exec-frontend above:
93
95
  - `MCP scaffold_api_client` → API client + types + React Query hook
94
96
  - `MCP scaffold_routes` with `outputFormat: 'clientRoutes'` for lazy imports
95
- - Pages: use `/ui-components` skill — MANDATORY for entity lists, grids, tables, dashboards
96
- - **Form pages: Create `EntityCreatePage.tsx` (route: `/create`) and `EntityEditPage.tsx` (route: `/:id/edit`)**
97
+ - **INVOKE `/ui-components` skill** (read SKILL.md + ALL patterns) — MANDATORY for ALL page types
98
+ - **Create ALL 4 page types per module:**
99
+ - `ListPage.tsx` — entity list with SmartTable/EntityCard
100
+ - `DetailPage.tsx` — entity detail view
101
+ - `EntityCreatePage.tsx` (route: `/create`) — FULL PAGE form, NEVER modal
102
+ - `EntityEditPage.tsx` (route: `/:id/edit`) — FULL PAGE form, NEVER modal
103
+ - **Wire ALL routes in App.tsx:** `index` (ListPage), `:id` (DetailPage), `create` (CreatePage), `:id/edit` (EditPage)
97
104
  - **FK FIELDS (CRITICAL):** Any Guid FK property (e.g., EmployeeId, DepartmentId) MUST use `EntityLookup` component — NEVER a `<select>` dropdown, NEVER a `<input type="text">`. A `<select>` loaded from API state is NOT a substitute for EntityLookup. See `smartstack-frontend.md` section 6.
98
105
  - **ZERO modals/popups/drawers for forms — ALL forms are full pages with their own URL**
106
+ - **TABS ON DETAIL PAGES (CRITICAL):** Tabs MUST switch content LOCALLY via `setActiveTab()` — NEVER `navigate()` to another page. Sub-resource data (e.g., employee's leaves) loads inline via API call filtered by parent entity ID. See `smartstack-frontend.md` section 3 "Tab Behavior Rules".
99
107
  - **Form tests: Generate `EntityCreatePage.test.tsx` and `EntityEditPage.test.tsx` (co-located)**
100
108
  - **SECTION PERMISSIONS:** After calling `MCP generate_permissions` for the module navRoute (3 segments: `{context}.{app}.{module}`), also call it for EACH section navRoute (4 segments: `{context}.{app}.{module}.{section}`)
101
109
  - **SECTION ROUTES:** After generating module routes, add section child routes to the module's `children` array. Wire `PermissionGuard` for section routes with section-level permissions.
110
+ - **SUB-RESOURCE COMPLETENESS:** If a section controller has sub-resource endpoints (e.g., `[HttpGet("types")]` for LeaveTypes inside LeavesController), you MUST EITHER:
111
+ - Create dedicated frontend pages for the sub-resource (ListPage, CreatePage, EditPage) with routes wired in App.tsx, OR
112
+ - NOT include any `navigate()` button that links to those sub-resource pages
113
+ - **Prefer separate controllers** with `[NavRoute(..., Suffix = "types")]` — see `smartstack-api.md` Sub-Resource Pattern
114
+ - A dead link (navigate to a route with no page) is a BLOCKING issue (POST-CHECK 42)
102
115
  - Read `references/smartstack-frontend.md` for mandatory patterns (sections 3b + 8)
103
116
  - Generate i18n JSON files for all 4 languages (fr, en, it, de) — `src/i18n/locales/{lang}/{module}.json`
104
117
  - All pages must follow loading → error → content pattern with CSS variables
@@ -146,6 +159,12 @@ Spawn 2 teammates (Opus, full tools):
146
159
  → ZERO modals/popups/drawers/dialogs for forms
147
160
  → Back button with navigate(-1) on every form page
148
161
  → See smartstack-frontend.md section 3b for templates
162
+ - **TABS ON DETAIL PAGES (CRITICAL):** Tabs MUST switch content LOCALLY:
163
+ → Tab click handler: setActiveTab(tabKey) ONLY — NEVER navigate() to another page
164
+ → Tab content: render inline with {activeTab === 'tabKey' && <TabContent />}
165
+ → Sub-resource data: fetch via API filtered by parent ID, display in tab panel
166
+ → FORBIDDEN: navigate('../leaves?employee=${id}') in tab handler
167
+ → See smartstack-frontend.md section 3 'Tab Behavior Rules'
149
168
  - **FK FIELDS (CRITICAL):** Foreign key Guid fields (e.g., EmployeeId) MUST use EntityLookup:
150
169
  → NEVER render FK fields as `<input>` — users cannot type GUIDs
151
170
  → NEVER render FK fields as `<select>` — even with API-loaded options, `<select>` is NOT acceptable
@@ -382,6 +401,27 @@ Each file MUST contain these keys: `title`, `description`, `actions`, `labels`,
382
401
 
383
402
  ---
384
403
 
404
+ ## PRD State Update (delegate mode only)
405
+
406
+ > **After completing EACH layer**, update the PRD file so `/ralph-loop` can track progress.
407
+
408
+ ```
409
+ IF delegate_mode:
410
+ After each layer completes successfully:
411
+ Read {delegate_prd_path}
412
+ For each task executed in this layer:
413
+ task.status = 'completed' (or 'failed' if errors)
414
+ task.completed_at = new Date().toISOString()
415
+ task.iteration = 1 (delegate mode = single iteration)
416
+ task.commit_hash = $(git rev-parse --short HEAD)
417
+ task.files_changed = { created: [...files created...], modified: [...files modified...] }
418
+ task.validation = "APEX_PASS" (or error details)
419
+ prd.updated_at = new Date().toISOString()
420
+ Write back to {delegate_prd_path}
421
+ ```
422
+
423
+ ---
424
+
385
425
  ## Commits Per Layer
386
426
 
387
427
  After each layer completes, gates pass, and builds pass:
@@ -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,7 @@ 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
+ | POST-CHECKs | 43 checks from references/post-checks.md | PASS / N/A |
183
266
  | Acceptance criteria | AC1..ACn | {X}/{Y} PASS |
184
267
  ```
185
268
 
@@ -211,3 +294,28 @@ ELSE:
211
294
  The success criteria require: "Tests: 100% pass, >= 80% coverage" — this is impossible without step-07.
212
295
 
213
296
  **NEXT ACTION:** Load `steps/step-07-tests.md` now.
297
+
298
+ ---
299
+
300
+ ## 11. PRD Final Reconciliation (delegate mode only)
301
+
302
+ > **After all validation passes**, ensure the PRD file reflects the completed state.
303
+
304
+ ```
305
+ IF delegate_mode:
306
+ Read {delegate_prd_path}
307
+
308
+ For ALL tasks belonging to this module:
309
+ IF task was executed by apex AND all checks passed:
310
+ Verify task.status == 'completed'
311
+ IF task was NOT in scope (different module):
312
+ Leave unchanged
313
+
314
+ Set prd.updated_at = new Date().toISOString()
315
+
316
+ If ALL module tasks completed:
317
+ Set prd.status = 'completed' (if single module)
318
+ OR leave prd.status = 'in_progress' (if multi-module, other modules remain)
319
+
320
+ Write back to {delegate_prd_path}
321
+ ```
@@ -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)
@@ -52,14 +53,18 @@ Step-00 handles detection automatically:
52
53
  **All outputs saved to PROJECT directory:**
53
54
 
54
55
  ```
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)
56
+ docs/
57
+ business-analyse/v{X.Y}/
58
+ feature.json # PROJECT-level master (only if multi-app: applications, dependencies)
59
+ {context}/ # "business" | "platform" | "personal"
60
+ index.json # BA manifest (auto-updated at handoff, consumed by web app viewer)
61
+ {app}/business-analyse/v{X.Y}/
62
+ feature.json # APPLICATION-level master (modules, dependencies, roles)
63
+ ba-interactive.html # Client-facing interactive review document (deployed at handoff)
64
+ {app}/{module}/business-analyse/v{X.Y}/
65
+ feature.json # MODULE-level detail (entities, UC, FR, permissions, mockups)
62
66
  ```
67
+ > In standalone mode (single app), the project-level file is NOT created and `{context}` is always `business`.
63
68
 
64
69
  **Ralph Loop files (generated by step-05):**
65
70
  ```
@@ -143,10 +148,11 @@ When step-00 detects that the description matches an existing application:
143
148
  4. If no match → new application
144
149
  5. Create master feature.json and proceed to step-01
145
150
 
146
- **New application workflow:**
151
+ **New application workflow (single or multi-app):**
147
152
  - **Step 00:** Detection, scan existing, create master feature.json (draft)
148
153
  - **Step 01:** Cadrage: context, stakeholders, scope, application roles (framed)
149
- - **Step 02:** Decomposition: modules, dependencies, client checkpoint (decomposed)
154
+ - **Step 01b:** *(multi-app only)* Application decomposition: identify applications, contexts, prefixes, inter-app dependencies
155
+ - **Step 02:** Decomposition: modules, dependencies, client checkpoint (decomposed) — per application in multi-app mode
150
156
  - **Step 03a:** Per-module data: sections, entities, business rules, questionnaires
151
157
  - **Step 03b:** Per-module UI: state machines, wireframes, layouts, dashboards
152
158
  - **Step 03c:** Per-module compile: actors, UCs, FRs, permissions, navigation, seed data, i18n
@@ -180,8 +186,9 @@ When step-00 detects that the description matches an existing application:
180
186
  | `{version}` | string | SemVer (1.0, 1.1, 2.0, etc.) |
181
187
  | `{application_name}` | string | Target application name |
182
188
  | `{module_name}` | string | Target module name |
183
- | `{context}` | string | Always "business" for BA |
184
- | `{workflow_mode}` | string | "application" or "module" |
189
+ | `{project_id}` | string | Project identifier (e.g., `PROJ-001`) — only in multi-app mode |
190
+ | `{context}` | string | "business" (default), "platform", or "personal" per application |
191
+ | `{workflow_mode}` | string | "project" (multi-app), "application" (single-app multi-module), or "module" (single) |
185
192
  | `{analysisMode}` | string | Always "interactive" — analysis phase is always interactive with the user |
186
193
  | `{docs_dir}` | string | `docs/business/{app}/{module}/business-analyse/v{X.Y}/` |
187
194
 
@@ -199,8 +206,9 @@ When step-00 detects that the description matches an existing application:
199
206
  | Step | File | Model | Purpose |
200
207
  | ---- | --------------------------------- | ------ | ---------------------------------------------------- |
201
208
  | 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 |
209
+ | 01 | `steps/step-01-cadrage.md` | Opus | Framing: context, stakeholders, scope, application roles + multi-app detection |
210
+ | 01b | `steps/step-01b-applications.md` | Opus | *(multi-app only)* Application decomposition, contexts, prefixes, inter-app dependencies |
211
+ | 02 | `steps/step-02-decomposition.md` | Opus | Module decomposition, dependency graph, client checkpoint (per application in multi-app) |
204
212
  | 03a1 | `steps/step-03a1-setup.md` | Opus | Per-module: setup, sections, questionnaires, cross-refs |
205
213
  | 03a2 | `steps/step-03a2-analysis.md` | Opus | Per-module: objectives, entities, BRs, process flow |
206
214
  | 03b | `steps/step-03b-ui.md` | Opus | Per-module: state machines, wireframes, layouts, dashboards |
@@ -223,7 +231,8 @@ Load ONLY relevant categories based on feature type:
223
231
 
224
232
  | Categorie | Fichier | Questions | Quand charger |
225
233
  | --------- | ------------------------------------- | --------- | ------------- |
226
- | 00 | `questionnaire/00-application.md` | 18 | Si workflow_mode = "application" |
234
+ | 00b | `questionnaire/00b-project.md` | 5 | Si workflow_mode = "project" (multi-app) |
235
+ | 00 | `questionnaire/00-application.md` | 18 | Si workflow_mode = "application" ou "project" |
227
236
  | 01 | `questionnaire/01-context.md` | 32 | Toujours |
228
237
  | 02 | `questionnaire/02-stakeholders.md` | 33 | Toujours |
229
238
  | 03 | `questionnaire/03-scope.md` | 32 | Toujours |
@@ -271,10 +280,11 @@ Load ONLY relevant categories based on feature type:
271
280
  - **Use ba-writer agent** for all JSON writes
272
281
  - **Use ba-reader agent** for all JSON reads
273
282
  - **Follow next_step directive** at end of each step
274
- - **Context: business only** - Reject platform/personal/system contexts
283
+ - **Context:** business-only in standalone mode; business/platform/personal per-application in project mode
275
284
  - **Use parallel agents** for codebase exploration
276
285
  - **Team mode** (2+ modules): After step-02, load `references/team-orchestration.md` and follow team protocol
277
286
  - **Inline mode** (1 module): Classic sequential execution, no team
287
+ - **Project mode** (2+ applications): Application loop wraps module loop — see `_module-loop.md`
278
288
  </execution_rules>
279
289
 
280
290
  <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)
63
+
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.
47
65
 
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.
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
 
@@ -135,15 +159,25 @@ Level 1: Context (business)
135
159
  ## Business Context Validation
136
160
 
137
161
  ```
138
- validate_business_context(context):
139
- IF context IN ['platform', 'personal', 'system'] THEN
140
- ERROR "BA restricted to 'business' context. Contact: support@atlshub.ch"
162
+ validate_business_context(context, workflow_mode):
163
+ IF workflow_mode === "project" THEN
164
+ // In project mode, applications can target any context
165
+ IF context IN ['business', 'platform', 'personal'] THEN
166
+ RETURN true
167
+ END IF
168
+ ERROR "Invalid context '${context}'. Allowed: business, platform, personal"
141
169
  RETURN false
170
+ ELSE
171
+ // In standalone mode, only business context is allowed
172
+ IF context IN ['platform', 'personal', 'system'] THEN
173
+ ERROR "BA restricted to 'business' context in standalone mode. Use multi-application project mode for other contexts."
174
+ RETURN false
175
+ END IF
176
+ RETURN true
142
177
  END IF
143
- RETURN true
144
178
  ```
145
179
 
146
- **CRITICAL:** BusinessAnalyze works ONLY for the `business` context.
180
+ **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
181
 
148
182
  ---
149
183
 
@@ -151,12 +185,18 @@ validate_business_context(context):
151
185
 
152
186
  ```
153
187
  docs/
154
- business/
188
+ business-analyse/ <- PROJECT level (only if multi-app)
189
+ schemas/
190
+ project-schema.json
191
+ v1.0/
192
+ feature.json <- PROJECT master ($schema: ../schemas/project-schema.json)
193
+ {context}/ <- "business" | "platform" | "personal"
155
194
  {application}/
156
195
  business-analyse/
157
- schemas/ <- JSON SCHEMAS (deployed by step-00)
196
+ schemas/ <- JSON SCHEMAS (deployed by step-00)
158
197
  feature-schema.json
159
198
  application-schema.json
199
+ project-schema.json
160
200
  sections/
161
201
  analysis-schema.json
162
202
  discovery-schema.json
@@ -167,17 +207,19 @@ docs/
167
207
  shared/
168
208
  common-defs.json
169
209
  v1.0/
170
- feature.json <- APPLICATION master ($schema: ../schemas/application-schema.json)
210
+ feature.json <- APPLICATION master ($schema: ../schemas/application-schema.json)
171
211
  {module1}/
172
212
  business-analyse/
173
213
  v1.0/
174
- feature.json <- MODULE detail ($schema: ../../../business-analyse/schemas/feature-schema.json)
214
+ feature.json <- MODULE detail ($schema: ../../../business-analyse/schemas/feature-schema.json)
175
215
  {module2}/
176
216
  business-analyse/
177
217
  v1.0/
178
- feature.json <- MODULE detail
218
+ feature.json <- MODULE detail
179
219
  ```
180
220
 
221
+ > In standalone mode (single app), `{context}` is always `business` and the project-level directory is NOT created.
222
+
181
223
  **Ralph Loop Integration (generated by step-05):**
182
224
 
183
225
  ```
@@ -198,6 +240,12 @@ generate_feature_id():
198
240
  new_id = last_id + 1
199
241
  update_config(".business-analyse/config.json", "lastFeatureId", new_id)
200
242
  RETURN format("FEAT-%03d", new_id)
243
+
244
+ generate_project_id():
245
+ last_id = read_config(".business-analyse/config.json", "lastProjectId") OR 0
246
+ new_id = last_id + 1
247
+ update_config(".business-analyse/config.json", "lastProjectId", new_id)
248
+ RETURN format("PROJ-%03d", new_id)
201
249
  ```
202
250
 
203
251
  ---
@@ -206,10 +254,12 @@ generate_feature_id():
206
254
 
207
255
  | Level | Format | Example |
208
256
  |-------|--------|---------|
209
- | Module | `{context}.{app}.{module}.{action}` | `business.sales.orders.read` |
210
- | Section | `{context}.{app}.{module}.{section}.{action}` | `business.sales.orders.dashboard.read` |
257
+ | Module | `{context}.{app}.{module}.{action}` | `business.human-resources.employees.read` |
258
+ | Section | `{context}.{app}.{module}.{section}.{action}` | `business.human-resources.employees.departments.read` |
211
259
 
212
260
  > **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).
261
+ >
262
+ > **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
263
 
214
264
  | Action | Permission | Usage |
215
265
  |--------|------------|-------|
@@ -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