@atlashub/smartstack-cli 4.56.0 → 4.58.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 (23) hide show
  1. package/dist/index.js +62 -13
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/project/Dockerfile.frontend.template +3 -3
  5. package/templates/skills/business-analyse/_shared.md +69 -21
  6. package/templates/skills/business-analyse/references/canonical-json-formats.md +1 -1
  7. package/templates/skills/business-analyse/references/naming-conventions.md +12 -2
  8. package/templates/skills/business-analyse/steps/step-00-init.md +54 -21
  9. package/templates/skills/business-analyse/steps/step-01-cadrage.md +6 -2
  10. package/templates/skills/business-analyse/steps/step-02-structure.md +13 -3
  11. package/templates/skills/business-analyse/steps/step-03-specify.md +14 -1
  12. package/templates/skills/business-analyse/steps/step-04-consolidate.md +3 -1
  13. package/templates/skills/business-analyse-design/steps/step-01-screens.md +12 -1
  14. package/templates/skills/business-analyse-design/steps/step-03-navigation.md +4 -3
  15. package/templates/skills/business-analyse-handoff/steps/step-01-transform.md +2 -2
  16. package/templates/skills/business-analyse-handoff/steps/step-02-export.md +15 -13
  17. package/templates/skills/business-analyse-html/SKILL.md +14 -0
  18. package/templates/skills/business-analyse-html/steps/step-01-collect.md +12 -6
  19. package/templates/skills/business-analyse-html/steps/step-03-render.md +7 -4
  20. package/templates/skills/business-analyse-html/steps/step-04-verify.md +3 -3
  21. package/templates/skills/business-analyse-review/steps/step-00-init.md +7 -2
  22. package/templates/skills/business-analyse-review/steps/step-01-apply.md +6 -7
  23. package/templates/skills/business-analyse-status/SKILL.md +19 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlashub/smartstack-cli",
3
- "version": "4.56.0",
3
+ "version": "4.58.0",
4
4
  "description": "SmartStack Claude Code automation toolkit - GitFlow, EF Core migrations, prompts and more",
5
5
  "author": {
6
6
  "name": "SmartStack",
@@ -11,14 +11,14 @@ WORKDIR /app
11
11
  ARG VITE_API_URL
12
12
  ARG VITE_WS_URL
13
13
 
14
- # Copy package files for npm cache
15
- COPY package.json package-lock.json ./
14
+ # Copy package files for npm cache (context = project root)
15
+ COPY web/{{ProjectNameLower}}-web/package.json web/{{ProjectNameLower}}-web/package-lock.json ./
16
16
 
17
17
  # Install dependencies (cached layer)
18
18
  RUN npm install
19
19
 
20
20
  # Copy source code
21
- COPY . .
21
+ COPY web/{{ProjectNameLower}}-web/ .
22
22
 
23
23
  # Build for production
24
24
  RUN npm run build:prod
@@ -8,23 +8,24 @@ Feature data is stored as granular JSON files, NOT markdown. Each module has an
8
8
 
9
9
  ```
10
10
  docs/
11
- business-analyse/v{X.Y}/
12
- index.json ← Project index (multi-app only)
13
- cadrage.json ← Project-level framing
14
- {app}/
15
- business-analyse/v{X.Y}/
16
- index.json Application index
17
- cadrage.json App-level framing
18
- {module}/
19
- business-analyse/v{X.Y}/
20
- index.json Module index
21
- entities.json Entities, attributes, relations
22
- rules.json Business rules
23
- usecases.json Use cases
24
- permissions.json Permissions matrix
25
- screens.json Interface specs (sections, resources, mockups)
26
- validation.json Validation results
27
- handoff.json File mapping, API specs
11
+ {projet-slug}/ ← Project (kebab-case, 100% autonomous)
12
+ v{X.Y}/
13
+ index.json ← Project master index
14
+ cadrage.json ← Project-level framing
15
+ consolidation.json ← Cross-module validation
16
+ navigation.json Navigation tree
17
+ validation.json Validation results
18
+ ba-interactive.html ← Generated HTML deliverable
19
+ {app-kebab}/ ← Application (kebab-case)
20
+ index.json Application index
21
+ {module-kebab}/ Module (kebab-case)
22
+ index.json Module index
23
+ entities.json Entities, attributes, relations
24
+ rules.json Business rules
25
+ usecases.json Use cases
26
+ permissions.json Permissions matrix
27
+ screens.json Interface specs (sections, resources, mockups)
28
+ handoff.json ← File mapping, API specs
28
29
  ```
29
30
 
30
31
  ### Index.json structure
@@ -72,10 +73,12 @@ Steps load only the files they need:
72
73
  ### Workflow detection
73
74
 
74
75
  ```
75
- 1. Check for existing docs/**/index.json → mode = "update"
76
+ 1. Check for existing docs/*/v*/index.json → mode = "update"
76
77
  2. Otherwise → mode = "new"
77
78
  ```
78
79
 
80
+ > **Legacy detection:** Also check `docs/business-analyse/v*/index.json` and `docs/*/business-analyse/v*/index.json` for backward compatibility with pre-ba-006 projects.
81
+
79
82
  > **Note:** Review mode (`ba-review.json`) is handled by the `/business-analyse-review` skill.
80
83
 
81
84
  ## Navigation Hierarchy
@@ -91,11 +94,54 @@ Maps to SmartStack DB tables:
91
94
 
92
95
  ### Naming conventions
93
96
 
94
- - **Application code**: PascalCase (e.g., `HumanResources`)
95
- - **Module code**: PascalCase (e.g., `Employees`)
97
+ - **Project directory**: kebab-case slug (e.g., `projet-rh`, `commande-repas`)
98
+ - **Application directory**: kebab-case (e.g., `human-resources`) — derived from PascalCase code via `toKebabCase()`
99
+ - **Module directory**: kebab-case (e.g., `employees`) — derived from PascalCase code via `toKebabCase()`
100
+ - **Application code** (in JSON): PascalCase (e.g., `HumanResources`)
101
+ - **Module code** (in JSON): PascalCase (e.g., `Employees`)
96
102
  - **Section code**: kebab-case (e.g., `list`, `detail`, `dashboard`)
97
103
  - **Resource code**: kebab-case (e.g., `employees-grid`, `employee-form`)
98
104
 
105
+ ### Directory name conversion
106
+
107
+ ```javascript
108
+ function toKebabCase(code) {
109
+ return code
110
+ .replace(/([a-z0-9])([A-Z])/g, '$1-$2')
111
+ .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
112
+ .toLowerCase();
113
+ }
114
+ ```
115
+
116
+ ### Project detection and selection
117
+
118
+ Projects are discovered by glob — no central registry:
119
+
120
+ ```
121
+ 1. Glob: docs/*/v*/index.json
122
+ 2. If 0 projects → ERROR "No project found. Run /business-analyse first."
123
+ 3. If 1 project → auto-select
124
+ 4. If N projects → AskUserQuestion "Which project?"
125
+ Options: [{label: "{slug} (v{X.Y})", description: "{appCount} apps, {moduleCount} modules, status: {status}"}, ...]
126
+ 5. Store selection in .business-analyse/config.json
127
+ ```
128
+
129
+ ### Path resolution helpers
130
+
131
+ ```javascript
132
+ function resolveProjectDir(projectSlug, version) {
133
+ return `docs/${projectSlug}/v${version}`;
134
+ }
135
+
136
+ function resolveAppDir(projectDir, appCode) {
137
+ return `${projectDir}/${toKebabCase(appCode)}`;
138
+ }
139
+
140
+ function resolveModuleDir(projectDir, appCode, moduleCode) {
141
+ return `${projectDir}/${toKebabCase(appCode)}/${toKebabCase(moduleCode)}`;
142
+ }
143
+ ```
144
+
99
145
  ## Permission Paths
100
146
 
101
147
  Format: `{ApplicationCode}.{ModuleCode}.{Action}`
@@ -111,12 +157,14 @@ For section-level: `{ApplicationCode}.{ModuleCode}.{SectionCode}.{Action}`
111
157
  ### ba-writer
112
158
 
113
159
  Writes granular JSON files. Key operations:
114
- - `create(scope, data)` — Create index.json + initial files
160
+ - `create(scope, data)` — Create index.json + initial files in `docs/{projectSlug}/v{X.Y}/`
115
161
  - `enrichSection(fileType, data)` — Write to specific file (entities.json, rules.json, etc.)
116
162
  - `updateIndex(summary)` — Update index.json metadata and summary
117
163
  - `createVersion(type)` — Create new version (major/minor)
118
164
  - `applyReview(reviewData)` — Apply ba-review.json corrections
119
165
 
166
+ All paths follow the pattern: `docs/{projectSlug}/v{X.Y}/{appKebab}/{moduleKebab}/`
167
+
120
168
  ### ba-reader
121
169
 
122
170
  Reads via index.json. Key operations:
@@ -1,7 +1,7 @@
1
1
  # Canonical JSON Formats Reference
2
2
 
3
3
  > **Purpose:** Single source of truth for all JSON file formats produced by the BA pipeline.
4
- > **Used by:** `/business-analyse` (step-03), `/business-analyse-design` (step-01), `/business-analyse-html`, `/business-analyse-handoff`, `/business-analyse-develop`
4
+ > **Used by:** `step-03`, `/business-analyse-design` (step-01), `/business-analyse-html`, `/business-analyse-handoff`, `/business-analyse-develop`
5
5
  > **Rule:** All producers MUST write canonical format. All consumers MUST accept canonical + deprecated fallbacks.
6
6
 
7
7
  ---
@@ -13,6 +13,14 @@
13
13
  - `metadata.application` = **PascalCase** (e.g., `"HumanResources"`)
14
14
  - Used for: C# namespaces, file paths, class names, folder structure
15
15
 
16
+ ### In Directory Names (BA docs structure)
17
+
18
+ - **Project directories**: kebab-case slug chosen by user (e.g., `projet-rh`, `commande-repas`)
19
+ - **Application directories**: kebab-case derived from PascalCase code (e.g., `HumanResources` → `human-resources`)
20
+ - **Module directories**: kebab-case derived from PascalCase code (e.g., `Employees` → `employees`, `TimeManagement` → `time-management`)
21
+ - **"My*" modules**: treated as normal modules (e.g., `MyFollowUp` → `my-follow-up`)
22
+ - Path pattern: `docs/{project-slug}/v{X.Y}/{app-kebab}/{module-kebab}/`
23
+
16
24
  ### In URL Routes
17
25
 
18
26
  - **kebab-case lowercase** (e.g., `"/human-resources/employees"`)
@@ -86,7 +94,8 @@ const route = `/${toKebabCase(appCode)}/${toKebabCase(moduleCode)}`;
86
94
  ```javascript
87
95
  function toKebabCase(code) {
88
96
  return code
89
- .replace(/([a-z])([A-Z])/g, '$1-$2')
97
+ .replace(/([a-z0-9])([A-Z])/g, '$1-$2')
98
+ .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
90
99
  .toLowerCase();
91
100
  }
92
101
  ```
@@ -104,7 +113,8 @@ const webPath = `/${navRoute.split('.').map(toKebabCase).join('/')}`;
104
113
  ```typescript
105
114
  function toKebabCase(str: string): string {
106
115
  return str
107
- .replace(/([a-z])([A-Z])/g, '$1-$2')
116
+ .replace(/([a-z0-9])([A-Z])/g, '$1-$2')
117
+ .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
108
118
  .toLowerCase();
109
119
  }
110
120
  ```
@@ -84,8 +84,8 @@ mcp__smartstack__validate_conventions({ checks: ["tables"] })
84
84
 
85
85
  Execute workflow detection algorithm:
86
86
  1. **Review Mode Detection:** Check if `{feature_description}` starts with `-review`
87
- 2. **Existing Projects Scanner:** Glob `docs/business-analyse/*/index.json` (project-level)
88
- 3. **Existing Applications Scanner:** Glob `docs/*/business-analyse/*/index.json`
87
+ 2. **Existing Projects Scanner:** Glob `docs/*/v*/index.json` (new ba-006 format)
88
+ 3. **Legacy Scanner (backward compat):** Glob `docs/business-analyse/*/index.json` AND `docs/*/business-analyse/*/index.json` (pre-ba-006 format)
89
89
  4. **Similarity Analysis:** Score user intent against existing apps (>= 80 = strong match)
90
90
  5. **Decision Tree:** Prompt user with relevant options
91
91
 
@@ -117,7 +117,7 @@ existing_apps: array of { app, featureId, description, version }
117
117
  existing_projects: array of { projectName, projectId, applications[], version }
118
118
  ```
119
119
 
120
- > **Project Resume Detection:** If a project-level index.json is found at `docs/business-analyse/*/index.json`, check its `metadata.workflow` to determine resume point. The project may have partially completed applications.
120
+ > **Project Resume Detection:** If a project-level index.json is found at `docs/*/v*/index.json`, check its `metadata.workflow` to determine resume point. The project may have partially completed applications. Also check legacy path `docs/business-analyse/*/index.json` for backward compat.
121
121
 
122
122
  ## Step 3b: Early Multi-Application Detection from Prompt (NEW)
123
123
 
@@ -254,9 +254,36 @@ workflow_mode: "application"
254
254
  **IF no multi-app detected (neither Tier 1 nor Tier 2):**
255
255
  → Continue to step 4 normally
256
256
 
257
- ## Step 4: Determine Application Name
257
+ ## Step 4: Determine Project Name & Application Name
258
258
 
259
- > **This step is SKIPPED if `workflow_mode = "project"` (multi-app detected in step 3b).**
259
+ ### 4a. Project Name (ALWAYS creates the top-level directory)
260
+
261
+ ```
262
+ IF workflow_type = "update":
263
+ projectSlug = existing project slug (from step 3 detection)
264
+ → Skip to 4b
265
+
266
+ ELSE:
267
+ Analyze {feature_description} to derive a project slug
268
+ Ask via AskUserQuestion:
269
+ question: "{language == 'fr' ? 'Quel nom pour ce projet ?' : 'What name for this project?'}"
270
+ header: "Project"
271
+ options:
272
+ - label: "{detected_slug}"
273
+ description: "{language == 'fr' ? 'Nom détecté depuis votre description (sera le dossier docs/)' : 'Name detected from description (will be the docs/ folder)'}"
274
+ - label: "{language == 'fr' ? 'Autre' : 'Other'}"
275
+ description: "{language == 'fr' ? 'Saisir un nom personnalisé' : 'Enter a custom name'}"
276
+
277
+ Ensure projectSlug is kebab-case:
278
+ projectSlug = userAnswer
279
+ .toLowerCase()
280
+ .replace(/[^a-z0-9\s-]/g, '')
281
+ .replace(/\s+/g, '-')
282
+ .replace(/-+/g, '-')
283
+ .trim()
284
+ ```
285
+
286
+ ### 4b. Application Name
260
287
 
261
288
  ```
262
289
  IF workflow_mode = "project":
@@ -268,17 +295,18 @@ ELSE IF workflow_type = "update":
268
295
  ELSE:
269
296
  Analyze {feature_description} to extract application name
270
297
  Ask via AskUserQuestion:
271
- question: "Quel nom pour cette application ?"
298
+ question: "{language == 'fr' ? 'Quel nom pour cette application ?' : 'What name for this application?'}"
272
299
  header: "Application"
273
300
  options:
274
301
  - label: "{detected_name}"
275
- description: "Nom détecté depuis votre description"
276
- - label: "Autre"
277
- description: "Saisir un nom personnalisé"
302
+ description: "{language == 'fr' ? 'Nom détecté depuis votre description' : 'Name detected from description'}"
303
+ - label: "{language == 'fr' ? 'Autre' : 'Other'}"
304
+ description: "{language == 'fr' ? 'Saisir un nom personnalisé' : 'Enter a custom name'}"
278
305
  ```
279
306
 
280
307
  **Store:**
281
308
  ```yaml
309
+ projectSlug: string # kebab-case directory name (e.g., "projet-rh")
282
310
  application_name: string # or project_name if project mode
283
311
  ```
284
312
 
@@ -340,22 +368,25 @@ feature_id: string
340
368
  ## Step 7: Create Output Directory Structure
341
369
 
342
370
  ```
343
- IF workflow_mode = "project":
344
- // Project mode: create project-level directory + per-app directories later
345
- mkdir -p docs/business-analyse/v1.0
346
- docs_dir = "docs/business-analyse/v{version}"
371
+ projectDir = "docs/" + projectSlug + "/v" + version
347
372
 
348
- ELSE IF workflow_type = "new":
349
- mkdir -p docs/{application_name}/business-analyse/v1.0
350
- docs_dir = "docs/{app}/business-analyse/v{version}"
373
+ IF workflow_type = "new":
374
+ mkdir -p {projectDir}
375
+ docs_dir = projectDir
351
376
 
352
377
  ELSE:
353
- Directory already exists from previous session
378
+ // Directory already exists from previous session
379
+ docs_dir = projectDir
354
380
  ```
355
381
 
382
+ > **Key change (ba-006):** All project data lives under `docs/{projectSlug}/v{X.Y}/`.
383
+ > No more `business-analyse/` intermediate directory. Applications and modules are
384
+ > direct subdirectories: `docs/{projectSlug}/v{X.Y}/{appKebab}/{moduleKebab}/`.
385
+
356
386
  **Store:**
357
387
  ```yaml
358
- docs_dir: string
388
+ docs_dir: string # e.g., "docs/projet-rh/v1.0"
389
+ projectSlug: string # e.g., "projet-rh"
359
390
  ```
360
391
 
361
392
  ## Step 8: Deploy JSON Schemas to Project (MANDATORY)
@@ -405,7 +436,7 @@ IF workflow_mode = "project":
405
436
  }
406
437
  })
407
438
 
408
- Output path: docs/business-analyse/v{version}/index.json
439
+ Output path: docs/{projectSlug}/v{version}/index.json
409
440
  Thematic files — EXACTLY these 3, NO OTHERS:
410
441
  - cadrage.json
411
442
  - validation.json
@@ -441,7 +472,7 @@ ELSE:
441
472
  }
442
473
  })
443
474
 
444
- Output path: docs/{app}/business-analyse/v{version}/index.json
475
+ Output path: docs/{projectSlug}/v{version}/index.json
445
476
  Thematic files — EXACTLY these 3, NO OTHERS:
446
477
  - cadrage.json
447
478
  - validation.json
@@ -474,6 +505,7 @@ Write ALL context variables to `.business-analyse/config.json`. This file is the
474
505
  "currentFeature": {
475
506
  "id": "{feature_id}",
476
507
  "version": "{version}",
508
+ "projectSlug": "{projectSlug}",
477
509
  "docsDir": "{docs_dir}",
478
510
  "workflowType": "{workflow_type}",
479
511
  "workflowMode": "{workflow_mode}",
@@ -530,6 +562,7 @@ feature_id: string # FEAT-NNN (single-app) or PROJ-NNN (project)
530
562
  feature_description: string
531
563
  workflow_type: "new" | "update"
532
564
  workflow_mode: "application" | "project"
565
+ projectSlug: string # kebab-case directory name (e.g., "projet-rh")
533
566
  application_name: string # Single-app: app name. Project: project name.
534
567
  applicationCode: string # PascalCase derived from application_name (preliminary, confirmed in step-01)
535
568
  project_id: string | null # PROJ-NNN if project mode, null if single-app
@@ -556,7 +589,7 @@ version: string
556
589
  If initialization was interrupted:
557
590
 
558
591
  1. Check `.business-analyse/config.json` for currentFeature or currentProject
559
- 2. If project ID exists, search for project index.json in `docs/business-analyse/`
592
+ 2. If project ID exists, search for project index.json in `docs/*/v*/` (or legacy `docs/business-analyse/`)
560
593
  - If found with scope = "project": resume project mode (see Project Resume below)
561
594
  3. If feature ID exists, search for index.json in `docs/`
562
595
  4. If found, check status and `metadata.workflow.lastCompletedStep`:
@@ -26,10 +26,13 @@ next_step: steps/step-02-structure.md
26
26
  Re-read session variables from `.business-analyse/config.json` (do NOT rely on LLM memory):
27
27
  ```javascript
28
28
  const config = readJSON('.business-analyse/config.json').currentFeature;
29
- const { id: feature_id, docsDir: docs_dir, application: application_name,
29
+ const { id: feature_id, docsDir: docs_dir, projectSlug, application: application_name,
30
30
  applicationCode, workflowMode: workflow_mode, language, version } = config;
31
31
  ```
32
32
 
33
+ > **Path resolution (ba-006):** `docs_dir` points to `docs/{projectSlug}/v{version}`.
34
+ > Cadrage.json is written directly in `{docs_dir}/cadrage.json`.
35
+
33
36
  ## YOUR TASK
34
37
 
35
38
  Frame the analysis scope at the **application level** through an interactive conversation with the client: understand the problem, stakeholders, scope, and define application-level roles. The analysis phase is ALWAYS interactive — the AI listens, reformulates, challenges, and validates with the user.
@@ -90,7 +93,7 @@ Launch 4 agents in parallel:
90
93
  Agent 1: Search for existing domain entities (Glob: **/Domain/**/*.cs)
91
94
  Agent 2: Search for existing services/integrations (Grep: IService, IRepository)
92
95
  Agent 3: Search for existing page patterns (Glob: **/pages/**/*.tsx)
93
- Agent 4: Scan existing BA documentation (Glob: docs/**/business-analyse/**/index.json)
96
+ Agent 4: Scan existing BA documentation (Glob: docs/*/v*/index.json, docs/**/business-analyse/**/index.json)
94
97
  → For each found file: read metadata.application, metadata.module, status, modules[].code
95
98
  → Also scan: docs/**/*.md (ERD, guides, specs)
96
99
 
@@ -227,6 +230,7 @@ _preAnalysis:
227
230
  ```
228
231
  ## {language == "fr" ? "Voici ce que j'ai compris de votre besoin" : "Here is my understanding of your need"}
229
232
 
233
+ **Projet :** {projectSlug}
230
234
  **Application :** {detected application name}
231
235
  **Objectif :** {reformulation in 2-3 sentences of the global need — in the client's own words, not technical jargon}
232
236
 
@@ -16,8 +16,15 @@ Identify the complete hierarchy **Application > Module > Section > Resource** fr
16
16
  Re-read session variables from `.business-analyse/config.json`:
17
17
  ```javascript
18
18
  const config = readJSON('.business-analyse/config.json').currentFeature;
19
- const { id: feature_id, docsDir: docs_dir, application: application_name,
19
+ const { id: feature_id, docsDir: docs_dir, projectSlug, application: application_name,
20
20
  applicationCode, workflowMode: workflow_mode, language } = config;
21
+
22
+ // Path helpers (ba-006)
23
+ function toKebabCase(code) {
24
+ return code.replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2').toLowerCase();
25
+ }
26
+ function resolveAppDir(appCode) { return `${docs_dir}/${toKebabCase(appCode)}`; }
27
+ function resolveModuleDir(appCode, moduleCode) { return `${docs_dir}/${toKebabCase(appCode)}/${toKebabCase(moduleCode)}`; }
21
28
  ```
22
29
 
23
30
  ## Prerequisites
@@ -185,10 +192,13 @@ Ask: "Does this structure match your vision? Any missing modules, sections, or r
185
192
  ## Output
186
193
 
187
194
  Write via ba-writer:
188
- 1. **Application index** (`docs/{app}/business-analyse/v1.0/index.json`) with modules list
189
- 2. **Module registrations** in application index
195
+ 1. **Application index** (`{docs_dir}/{appKebab}/index.json`) with modules list
196
+ 2. **Module directories** created as `{docs_dir}/{appKebab}/{moduleKebab}/`
190
197
  3. **Each module's anticipated sections** as `anticipatedSections` in module data
191
198
 
199
+ > **ba-006 path pattern:** `docs/{projectSlug}/v{X.Y}/{appKebab}/{moduleKebab}/`
200
+ > No `business-analyse/` intermediate directory.
201
+
192
202
  ### Data written
193
203
 
194
204
  ```json
@@ -16,10 +16,21 @@ For each module (in dependency order), produce complete specifications: entities
16
16
  Re-read session variables from `.business-analyse/config.json`:
17
17
  ```javascript
18
18
  const config = readJSON('.business-analyse/config.json').currentFeature;
19
- const { id: feature_id, docsDir: docs_dir, application: application_name,
19
+ const { id: feature_id, docsDir: docs_dir, projectSlug, application: application_name,
20
20
  applicationCode, workflowMode: workflow_mode, language } = config;
21
+
22
+ // Path helpers (ba-006)
23
+ function toKebabCase(code) {
24
+ return code.replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2').toLowerCase();
25
+ }
26
+ function resolveModuleDir(appCode, moduleCode) {
27
+ return `${docs_dir}/${toKebabCase(appCode)}/${toKebabCase(moduleCode)}`;
28
+ }
21
29
  ```
22
30
 
31
+ > **Module directory (ba-006):** `mod.dir = resolveModuleDir(applicationCode, module.code)`
32
+ > Example: `docs/projet-rh/v1.0/human-resources/employees/`
33
+
23
34
  ## Prerequisites
24
35
 
25
36
  - Step 02 (structure) completed
@@ -301,6 +312,8 @@ const errors = [];
301
312
  const warnings = [];
302
313
 
303
314
  for (const mod of modules) {
315
+ // mod.dir = resolveModuleDir(applicationCode, mod.code)
316
+ // e.g., docs/projet-rh/v1.0/human-resources/employees/
304
317
  const ent = READ(mod.dir + '/entities.json')?.entities || [];
305
318
  const ucs = READ(mod.dir + '/usecases.json')?.useCases || [];
306
319
  const brs = READ(mod.dir + '/rules.json')?.rules || [];
@@ -21,10 +21,12 @@ next_step: none
21
21
  Re-read session variables from `.business-analyse/config.json`:
22
22
  ```javascript
23
23
  const config = readJSON('.business-analyse/config.json').currentFeature;
24
- const { id: feature_id, docsDir: docs_dir, application: application_name,
24
+ const { id: feature_id, docsDir: docs_dir, projectSlug, application: application_name,
25
25
  applicationCode, workflowMode: workflow_mode, language } = config;
26
26
  ```
27
27
 
28
+ > **Consolidation output (ba-006):** Written to `{projectDir}/consolidation.json`.
29
+
28
30
  ## YOUR TASK
29
31
  Consolidate all modules by validating cross-module interactions, permission coherence, data model integrity, E2E flows, and global risks. Obtain client approval and write consolidation data.
30
32
 
@@ -16,10 +16,21 @@ For each module, define all sections and resources with detailed interface speci
16
16
  Re-read session variables (do NOT rely on LLM memory from prior skill invocation):
17
17
  ```javascript
18
18
  const config = readJSON('.business-analyse/config.json').currentFeature;
19
- const { id: feature_id, docsDir: docs_dir, application: application_name,
19
+ const { id: feature_id, docsDir: docs_dir, projectSlug, application: application_name,
20
20
  applicationCode, language } = config;
21
+
22
+ // Path helpers (ba-006)
23
+ function toKebabCase(code) {
24
+ return code.replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2').toLowerCase();
25
+ }
26
+ function resolveModuleDir(appCode, moduleCode) {
27
+ return `${docs_dir}/${toKebabCase(appCode)}/${toKebabCase(moduleCode)}`;
28
+ }
21
29
  ```
22
30
 
31
+ > **screens.json output (ba-006):** Written to `resolveModuleDir(appCode, moduleCode)/screens.json`
32
+ > Example: `docs/projet-rh/v1.0/human-resources/employees/screens.json`
33
+
23
34
  ## Prerequisites
24
35
 
25
36
  - `/business-analyse` completed (entities, usecases, permissions exist)
@@ -99,7 +99,8 @@ Application
99
99
 
100
100
  ### 4. Write navigation.json
101
101
 
102
- Write via ba-writer at project level (alongside master index.json). Update index.json with navigation.json reference.
102
+ Write via ba-writer at project level: `{docs_dir}/navigation.json` (e.g., `docs/projet-rh/v1.0/navigation.json`).
103
+ Update index.json with navigation.json reference.
103
104
 
104
105
  ## Validation
105
106
 
@@ -123,8 +124,8 @@ Write via ba-writer at project level (alongside master index.json). Update index
123
124
 
124
125
  | Artifact | Path |
125
126
  |-----------------|-----------------------------------|
126
- | screens.json | {module-path}/screens.json |
127
- | navigation.json | {project-path}/navigation.json |
127
+ | screens.json | {docs_dir}/{app-kebab}/{module-kebab}/screens.json |
128
+ | navigation.json | {docs_dir}/navigation.json |
128
129
 
129
130
  NEXT STEPS:
130
131
  1. Run /business-analyse-html to produce the interactive HTML with mockups
@@ -63,14 +63,14 @@ For **EACH module** in topological order, use the **Agent tool** (subagent_type:
63
63
  Transform module "{moduleCode}" for handoff.
64
64
 
65
65
  ## Input
66
- - Module BA directory: {moduleDir}
66
+ - Module BA directory: {moduleDir} // ba-006: {docs_dir}/{appKebab}/{moduleKebab}/
67
67
  - Application code: {appCode}
68
68
  - Application name: {appName}
69
69
  - Feature description: {featureDescription}
70
70
  - Module index: {moduleDir}/index.json
71
71
 
72
72
  ## Instructions
73
- Read the following 5 files from {moduleDir}:
73
+ Read the following 5 files from {moduleDir} (ba-006: docs/{projectSlug}/v{X.Y}/{appKebab}/{moduleKebab}/):
74
74
  1. entities.json → entities[]
75
75
  2. usecases.json → useCases[] (canonical key: "useCases", fallback: "usecases")
76
76
  3. rules.json → rules[] (canonical key: "rules", fallback: "businessRules")
@@ -168,10 +168,20 @@ IF .ralph/progress.txt exists AND contains "Iteration" entries:
168
168
 
169
169
  Write to: `.ralph/progress.txt`
170
170
 
171
- ### 5. Update BA Manifest (docs/index.json)
171
+ ### 5. Update Project Index (status tracking)
172
172
 
173
- **Schema:**
173
+ > **ba-006:** No global `docs/index.json` manifest. Projects are autonomous.
174
+ > Update the project's own `{docs_dir}/index.json` with handoff status instead.
174
175
 
176
+ **Update logic:**
177
+
178
+ 1. Read `{docs_dir}/index.json` (project master index)
179
+ 2. Update status to `"handed-off"` for each processed module
180
+ 3. Update `metadata.lastModified` timestamp
181
+ 4. Write back
182
+ 5. Display: "Project index updated: {docs_dir}/index.json (status: handed-off)"
183
+
184
+ **Legacy (pre-ba-006):** If `docs/index.json` global manifest exists, also update it for backward compatibility:
175
185
  ```json
176
186
  {
177
187
  "version": "1.0",
@@ -185,21 +195,13 @@ Write to: `.ralph/progress.txt`
185
195
  "version": "{version}",
186
196
  "status": "handed-off",
187
197
  "featureDescription": "{description}",
188
- "path": "{app_code}/business-analyse/v{version}/index.json",
198
+ "path": "{projectSlug}/v{version}/index.json",
189
199
  "updatedAt": "{ISO timestamp}"
190
200
  }
191
201
  ]
192
202
  }
193
203
  ```
194
204
 
195
- **Update logic:**
196
-
197
- 1. Read existing manifest (or create empty)
198
- 2. **PROJECT MODE:** Add/update project entry + all app entries + all module entries per app
199
- 3. **SINGLE-APP MODE:** Update app entry + module entries for this app
200
- 4. Write manifest back with updated timestamp
201
- 5. Display: "BA manifest updated: docs/index.json ({total} entries)"
202
-
203
205
  ### 6. Display Completion Summary
204
206
 
205
207
  ```
@@ -229,7 +231,7 @@ Artifacts generated:
229
231
  .ralph/prd-{module}.permissions.json — Permissions (companion)
230
232
  .ralph/progress.txt — Progression tracker
231
233
  .ralph/modules-queue.json — Module execution order (if multi-module)
232
- docs/index.json BA manifest (status: handed-off)
234
+ {docs_dir}/index.json Project index (status: handed-off)
233
235
 
234
236
  [NEXT] Development:
235
237
  1. Run /business-analyse-develop to begin implementation
@@ -246,7 +248,7 @@ Artifacts generated:
246
248
  1. `.ralph/prd-{module}.json` exists for ALL modules (>100 bytes each)
247
249
  2. `.ralph/progress.txt` exists (>500 bytes)
248
250
  3. `.ralph/modules-queue.json` exists (if 2+ modules)
249
- 4. `docs/index.json` updated with correct entry count and status "handed-off"
251
+ 4. `{docs_dir}/index.json` updated with handoff status (legacy: `docs/index.json` if it exists)
250
252
  5. All PRD files have $version=3.0.0 or 4.0.0, file manifest present, 8 categories
251
253
  6. File counts match between PRD and handoff for all categories
252
254
  7. For EACH module: 5 companion files exist in `.ralph/` (entities, rules, usecases, screens, permissions)
@@ -27,6 +27,20 @@ Generate the interactive HTML document of the business analysis from the JSON an
27
27
  - JSON analysis files must exist (at minimum `index.json` + `cadrage.json`)
28
28
  - Feature status must be `consolidated`
29
29
 
30
+ ## Project Detection (ba-006)
31
+
32
+ When launched, detect and select the target project:
33
+
34
+ ```
35
+ 1. Glob: docs/*/v*/index.json
36
+ 2. If 0 projects → BLOCKING ERROR "No project found. Run /business-analyse first."
37
+ 3. If 1 project → auto-select
38
+ 4. If N projects → AskUserQuestion "Which project?"
39
+ 5. Store projectSlug, docs_dir in session
40
+ ```
41
+
42
+ **Legacy fallback:** Also check `docs/business-analyse/v*/index.json` and `docs/*/business-analyse/v*/index.json`.
43
+
30
44
  ## Workflow
31
45
 
32
46
  4 progressive steps: