@atlashub/smartstack-cli 3.5.0 → 3.7.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 (34) hide show
  1. package/dist/index.js +13 -0
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/skills/business-analyse/SKILL.md +24 -19
  5. package/templates/skills/business-analyse/_architecture.md +1 -1
  6. package/templates/skills/business-analyse/_elicitation.md +1 -1
  7. package/templates/skills/business-analyse/_module-loop.md +4 -4
  8. package/templates/skills/business-analyse/html/ba-interactive.html +39 -10
  9. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  10. package/templates/skills/business-analyse/questionnaire.md +2 -2
  11. package/templates/skills/business-analyse/references/html-data-mapping.md +3 -2
  12. package/templates/skills/business-analyse/schemas/feature-schema.json +1 -1
  13. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  14. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +1 -0
  15. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  16. package/templates/skills/business-analyse/steps/step-00-init.md +37 -1
  17. package/templates/skills/business-analyse/steps/step-01-cadrage.md +166 -6
  18. package/templates/skills/business-analyse/steps/step-02-decomposition.md +4 -4
  19. package/templates/skills/business-analyse/steps/{step-03a-specify.md → step-03a-data.md} +10 -359
  20. package/templates/skills/business-analyse/steps/step-03b-ui.md +414 -0
  21. package/templates/skills/business-analyse/steps/step-03c-compile.md +343 -0
  22. package/templates/skills/business-analyse/steps/{step-03b-compile.md → step-03d-validate.md} +26 -308
  23. package/templates/skills/business-analyse/steps/step-04-consolidation.md +23 -2
  24. package/templates/skills/business-analyse/steps/step-05a-handoff.md +66 -46
  25. package/templates/skills/business-analyse/steps/step-05b-deploy.md +262 -212
  26. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  27. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +1 -1
  28. package/templates/skills/controller/steps/step-03-generate.md +2 -1
  29. package/templates/skills/ralph-loop/SKILL.md +20 -5
  30. package/templates/skills/ralph-loop/references/core-seed-data.md +538 -0
  31. package/templates/skills/ralph-loop/steps/step-00-init.md +79 -1
  32. package/templates/skills/ralph-loop/steps/step-01-task.md +25 -2
  33. package/templates/skills/ralph-loop/steps/step-02-execute.md +39 -15
  34. package/templates/skills/ralph-loop/steps/step-04-check.md +87 -4
@@ -435,15 +435,30 @@ A validation task is ONLY complete when:
435
435
 
436
436
  When executing `infrastructure` category tasks, follow these rules strictly:
437
437
 
438
- 1. **Seed data files** MUST go under `Infrastructure/Persistence/Seeding/Data/{Module}/`
438
+ 1. **Core seed data (navigation, permissions, roles) CONDITIONAL REFERENCE LOADING:**
439
+
440
+ > **IF** the current task description contains "seed data", "SeedData",
441
+ > "NavigationModule", "PermissionsSeedData", "RolesSeedData", or "IClientSeedDataProvider":
442
+ > **THEN read `references/core-seed-data.md`** for COMPLETE execution guidance including:
443
+ > - Parameter extraction from PRD seedDataCore / task `_seedDataMeta`
444
+ > - MCP `generate_permissions` call sequence (primary) with fallback templates
445
+ > - `NavigationModuleSeedData.cs` template (deterministic GUIDs, 4 languages)
446
+ > - `PermissionsSeedData.cs` template (wraps MCP output)
447
+ > - `RolesSeedData.cs` template (context-based role mapping)
448
+ > - `IClientSeedDataProvider` complete implementation template
449
+ > - DI registration pattern
450
+ > - Verification checklist (BLOCKING)
451
+ >
452
+ > **This reference is MANDATORY for seed data tasks. Do NOT improvise.**
453
+
454
+ **Directory convention:** All seed data files MUST go under `Infrastructure/Persistence/Seeding/Data/{Module}/`
439
455
  - NEVER use `Infrastructure/Data/SeedData/` or `Data/SeedData/`
440
- - Each module gets 5 core files: NavigationModuleSeedData.cs, PermissionsSeedData.cs, RolesSeedData.cs, TenantSeedData.cs, UserSeedData.cs
441
456
 
442
457
  2. **IClientSeedDataProvider** (client projects with `extensions` DbContext):
443
458
  - Generate at `Infrastructure/Persistence/Seeding/{AppPascalName}SeedDataProvider.cs`
444
459
  - Register in DI: `services.AddScoped<IClientSeedDataProvider, {AppPascalName}SeedDataProvider>()`
445
460
  - Must implement: SeedNavigationAsync, SeedPermissionsAsync, SeedRolePermissionsAsync
446
- - See `/application` skill step-03b-provider for the full pattern
461
+ - **Complete template and rules in `references/core-seed-data.md`**
447
462
 
448
463
  3. **DevDataSeeder** for domain entity seed data:
449
464
  - Located at `Infrastructure/Persistence/Seeding/DevDataSeeder.cs`
@@ -514,15 +529,29 @@ Only fr/en translations → MUST have 4 languages (fr, en,
514
529
  | `business.*` | `BusinessLayout` | `/business` |
515
530
  | `personal.*` | `UserLayout` | `/personal/myspace` |
516
531
 
517
- **API/Controller task guidance (MANDATORY folder hierarchy):**
532
+ **Backend folder hierarchy (MANDATORY for ALL layers):**
518
533
 
519
- When executing `api` category tasks, follow these rules strictly:
534
+ > **CRITICAL:** ALL backend files MUST be organized by `{ContextPascal}/{ApplicationName}/{ModuleName}/` hierarchy.
535
+ > Derive from PRD `project.application` and feature.json `metadata.context`.
536
+ > The file paths in prd.json already include this hierarchy — follow them exactly.
520
537
 
521
- 1. **Controllers MUST be organized by context and application folders:**
522
- - Path: `Api/Controllers/{ContextShort}/{Application}/{EntityName}Controller.cs`
523
- - If no application sub-level: `Api/Controllers/{ContextShort}/{EntityName}Controller.cs`
538
+ When executing `domain`, `application`, `infrastructure`, `api`, or `test` category tasks:
524
539
 
525
- 2. **Context-to-folder mapping (from navRoute):**
540
+ 1. **ALL layers use context/application/module folder hierarchy:**
541
+
542
+ | Layer | Path Pattern |
543
+ |-------|-------------|
544
+ | Domain | `Domain/Entities/{ContextPascal}/{App}/{Module}/{Entity}.cs` |
545
+ | Domain Enums | `Domain/Enums/{ContextPascal}/{App}/{Module}/{Enum}.cs` |
546
+ | Domain Exceptions | `Domain/Exceptions/{ContextPascal}/{App}/{Module}/{Exception}.cs` |
547
+ | Application Services | `Application/Services/{ContextPascal}/{App}/{Module}/{Service}.cs` |
548
+ | Application DTOs | `Application/DTOs/{ContextPascal}/{App}/{Module}/{Dto}.cs` |
549
+ | Application Validators | `Application/Validators/{ContextPascal}/{App}/{Module}/{Validator}.cs` |
550
+ | Infrastructure Configs | `Infrastructure/Persistence/Configurations/{ContextPascal}/{App}/{Module}/{Config}.cs` |
551
+ | API Controllers | `Api/Controllers/{ContextShort}/{App}/{Entity}Controller.cs` |
552
+ | Tests | `Tests/Unit/Domain/{ContextPascal}/{App}/{Module}/{Tests}.cs` |
553
+
554
+ 2. **Controller context-to-folder mapping (`{ContextShort}`):**
526
555
 
527
556
  | NavRoute Prefix | Controller Folder |
528
557
  |-----------------|-------------------|
@@ -531,12 +560,7 @@ When executing `api` category tasks, follow these rules strictly:
531
560
  | `business.*` | `Business` |
532
561
  | `personal.*` | `User` |
533
562
 
534
- 3. **Sub-folders for applications/modules with multiple controllers:**
535
- - `Admin/Tenants/` for tenant-related controllers
536
- - `Admin/AI/` for AI-related controllers
537
- - `Admin/Communications/` for communication controllers
538
-
539
- 4. **Reference:** SmartStack.app `Api/Controllers/` for the canonical structure
563
+ 3. **Reference:** SmartStack.app `Api/Controllers/` for the canonical structure
540
564
 
541
565
  ### 4. Explore Context (if needed)
542
566
 
@@ -168,7 +168,64 @@ if (hasQueue) {
168
168
  const queue = readJSON(queuePath);
169
169
  const currentModule = queue.modules[queue.currentIndex];
170
170
 
171
- // Mark current module as completed
171
+ // FIX #4: MODULE COMPLETENESS CHECK (MANDATORY before advancing)
172
+ // A module is NOT complete unless all expected layers have at least one completed task.
173
+ // This prevents marking a module as "done" when only backend was implemented.
174
+ const completedCategories = new Set(
175
+ prd.tasks.filter(t => t.status === 'completed').map(t => t.category)
176
+ );
177
+ const expectedCategories = ['domain', 'infrastructure', 'application', 'api', 'frontend', 'test'];
178
+ const missingCategories = expectedCategories.filter(c => !completedCategories.has(c));
179
+
180
+ if (missingCategories.length > 0) {
181
+ console.log(`
182
+ ╔══════════════════════════════════════════════════════════════════╗
183
+ ║ ⚠️ MODULE INCOMPLETE: Missing layers ║
184
+ ╠══════════════════════════════════════════════════════════════════╣
185
+ ║ Module: ${currentModule.code} ║
186
+ ║ Missing: ${missingCategories.join(', ')} ║
187
+ ╠══════════════════════════════════════════════════════════════════╣
188
+ ║ Injecting guardrail tasks for missing layers... ║
189
+ ╚══════════════════════════════════════════════════════════════════╝
190
+ `);
191
+
192
+ // Inject guardrail tasks for each missing category
193
+ let maxId = Math.max(...prd.tasks.map(t => t.id));
194
+ const lastCompletedByCategory = {};
195
+ for (const task of prd.tasks) {
196
+ if (task.status === 'completed') lastCompletedByCategory[task.category] = task.id;
197
+ }
198
+
199
+ for (const cat of missingCategories) {
200
+ maxId++;
201
+ const depId = cat === 'frontend'
202
+ ? (lastCompletedByCategory['api'] || lastCompletedByCategory['application'])
203
+ : cat === 'test'
204
+ ? (lastCompletedByCategory['api'] || lastCompletedByCategory['frontend'])
205
+ : (lastCompletedByCategory['domain'] || lastCompletedByCategory['infrastructure']);
206
+
207
+ prd.tasks.push({
208
+ id: maxId,
209
+ description: `[${cat}] GUARDRAIL: Generate missing ${cat} layer for module ${currentModule.code}`,
210
+ status: 'pending',
211
+ category: cat,
212
+ dependencies: depId ? [depId] : [],
213
+ acceptance_criteria: `${cat} layer fully implemented for module ${currentModule.code}`,
214
+ started_at: null, completed_at: null, iteration: null, commit_hash: null,
215
+ files_changed: { created: [], modified: [] },
216
+ validation: null, error: null, module: currentModule.code
217
+ });
218
+ console.log(` → Injected task ${maxId}: [${cat}] guardrail for ${currentModule.code}`);
219
+ }
220
+
221
+ prd.updated_at = new Date().toISOString();
222
+ writeJSON('.ralph/prd.json', prd);
223
+
224
+ // DO NOT mark module as complete — continue the COMPACT LOOP with new tasks
225
+ // Fall through to section 5 (COMPACT LOOP)
226
+ } else {
227
+
228
+ // Mark current module as completed (only when ALL layers verified)
172
229
  currentModule.status = 'completed';
173
230
  queue.completedModules++;
174
231
 
@@ -231,6 +288,7 @@ if (hasQueue) {
231
288
  ║ ${queue.modules.map(m => m.code + ": " + m.status).join("\n║ ")} ║
232
289
  ╚══════════════════════════════════════════════════════════════════╝
233
290
  `);
291
+ } // end else (module completeness check passed)
234
292
  }
235
293
  ```
236
294
 
@@ -430,9 +488,19 @@ Batch: {tasksToExecute.length} task(s) [{firstCategory}]
430
488
  8. Generate 4-language i18n (fr, en, it, de)
431
489
  9. `npm run typecheck` MUST pass
432
490
 
433
- **IF category = "infrastructure":** Seed data in `Infrastructure/Persistence/Seeding/Data/{Module}/`
491
+ **IF category = "domain":** Entities in `Domain/Entities/{ContextPascal}/{App}/{Module}/`, Enums in `Domain/Enums/{ContextPascal}/{App}/{Module}/`
434
492
 
435
- **IF category = "api":** Controllers in `Api/Controllers/{Context}/{App}/{Entity}Controller.cs`
493
+ **IF category = "application":** Services in `Application/Services/{ContextPascal}/{App}/{Module}/`, DTOs in `Application/DTOs/{ContextPascal}/{App}/{Module}/`
494
+
495
+ **IF category = "infrastructure":**
496
+ - EF configs in `Infrastructure/Persistence/Configurations/{ContextPascal}/{App}/{Module}/`
497
+ - Seed data in `Infrastructure/Persistence/Seeding/Data/{Module}/`
498
+ - **IF task description contains "seed data", "SeedData", or "IClientSeedDataProvider":**
499
+ Read `references/core-seed-data.md` for COMPLETE execution guidance (parameter extraction,
500
+ MCP `generate_permissions` call, code templates, IClientSeedDataProvider, verification checklist).
501
+ **Do NOT improvise core seed data generation.**
502
+
503
+ **IF category = "api":** Controllers in `Api/Controllers/{ContextShort}/{App}/{Entity}Controller.cs`
436
504
 
437
505
  After ALL tasks in batch executed:
438
506
  - Run `mcp__smartstack__validate_conventions` ONCE for the whole batch
@@ -581,17 +649,32 @@ Completion Check:
581
649
  1. ALL tasks have `status: "completed"` or `status: "skipped"`
582
650
  2. Zero tasks with `status: "blocked"` or `status: "failed"`
583
651
  3. The statement is genuinely true
652
+ 4. **Multi-module:** ALL modules in `modules-queue.json` have `status: "completed"`
584
653
 
585
654
  **False promises to escape the loop are FORBIDDEN.**
586
655
 
587
656
  **Always update `prd.status` and `prd.updated_at` before proceeding.**
588
657
 
658
+ **NEVER DELEGATE THE LOOP:**
659
+ - NEVER use the Task tool to spawn a sub-agent for Ralph loop execution.
660
+ - Sub-agents lose ALL skill context and WILL stop prematurely.
661
+ - The ONLY acceptable Task usage: isolated read-only research (e.g., Context7 docs lookup).
662
+
663
+ **MODULE COMPLETENESS (multi-module):**
664
+ - Before advancing to the next module, verify ALL expected layers have completed tasks.
665
+ - Expected layers: domain, infrastructure, application, api, frontend, test.
666
+ - If any layer is missing, inject guardrail tasks and continue the COMPACT LOOP.
667
+ - A module with only backend tasks is NOT complete.
668
+
589
669
  **LOOP CONTINUATION IS MANDATORY:**
590
670
  - After the first full iteration (step-01→02→03→04), ALL subsequent iterations use the COMPACT LOOP in section 5.
591
671
  - DO NOT re-read step-01, step-02, step-03 files. You already know the instructions.
592
672
  - DO NOT stop and wait for user input between iterations.
593
673
  - DO NOT output a summary and pause. The loop is AUTONOMOUS.
594
- - The ONLY reasons to stop: completion, max iterations, dead-end, or user interruption.
674
+ - DO NOT decide to stop because "quality over quantity" or "this is enough for now".
675
+ - DO NOT stop after completing one module when others remain in the queue.
676
+ - DO NOT reduce scope autonomously ("I'll skip frontend/tests to save time").
677
+ - The ONLY reasons to stop: ALL tasks complete (all modules), max iterations, dead-end, or user Ctrl+C.
595
678
  - Stopping for any other reason is a **BUG** that wastes user time and context.
596
679
  - **BATCH tasks of the same category** to reduce iterations (max 5 per batch).
597
680
  - Prefer compact output (1-2 lines per task) over verbose output during the loop.