@atlashub/smartstack-cli 3.1.0 → 3.3.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 (39) hide show
  1. package/.documentation/prd-json-v2.0.0.md +396 -0
  2. package/.documentation/testing-ba-e2e.md +462 -0
  3. package/dist/index.js +605 -25
  4. package/dist/index.js.map +1 -1
  5. package/package.json +6 -2
  6. package/templates/agents/ba-reader.md +1 -1
  7. package/templates/agents/ba-writer.md +8 -1
  8. package/templates/skills/business-analyse/SKILL.md +46 -31
  9. package/templates/skills/business-analyse/_architecture.md +123 -0
  10. package/templates/skills/business-analyse/_elicitation.md +206 -0
  11. package/templates/skills/business-analyse/_module-loop.md +56 -0
  12. package/templates/skills/business-analyse/_shared.md +75 -531
  13. package/templates/skills/business-analyse/_suggestions.md +34 -0
  14. package/templates/skills/business-analyse/html/ba-interactive.html +146 -57
  15. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  16. package/templates/skills/business-analyse/questionnaire.md +22 -17
  17. package/templates/skills/business-analyse/react/components.md +1 -1
  18. package/templates/skills/business-analyse/react/schema.md +1 -1
  19. package/templates/skills/business-analyse/references/html-data-mapping.md +294 -0
  20. package/templates/skills/business-analyse/schemas/feature-schema.json +1 -1
  21. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  22. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +1 -1
  23. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  24. package/templates/skills/business-analyse/steps/step-00-init.md +85 -59
  25. package/templates/skills/business-analyse/steps/step-01-cadrage.md +2 -0
  26. package/templates/skills/business-analyse/steps/step-02-decomposition.md +5 -3
  27. package/templates/skills/business-analyse/steps/{step-03-specify.md → step-03a-specify.md} +16 -606
  28. package/templates/skills/business-analyse/steps/step-03b-compile.md +670 -0
  29. package/templates/skills/business-analyse/steps/step-04-consolidation.md +7 -5
  30. package/templates/skills/business-analyse/steps/step-05a-handoff.md +727 -0
  31. package/templates/skills/business-analyse/steps/step-05b-deploy.md +479 -0
  32. package/templates/skills/business-analyse/steps/step-06-extract.md +134 -4
  33. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  34. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +161 -0
  35. package/templates/skills/business-analyse/templates/tpl-progress.md +171 -0
  36. package/templates/skills/ralph-loop/SKILL.md +138 -20
  37. package/templates/skills/ralph-loop/steps/step-01-task.md +75 -18
  38. package/templates/skills/ralph-loop/steps/step-04-check.md +72 -5
  39. package/templates/skills/business-analyse/steps/step-05-handoff.md +0 -1414
@@ -181,13 +181,25 @@ if (hasQueue) {
181
181
  queue.modules[nextIndex].status = 'in-progress';
182
182
  writeJSON(queuePath, queue);
183
183
 
184
+ // ✅ FIX #1: Create module transition marker
185
+ // This signals to step-01 that it MUST reload even on iteration > 1
186
+ writeJSON('.ralph/module-changed.json', {
187
+ fromModule: currentModule.code,
188
+ toModule: queue.modules[nextIndex].code,
189
+ timestamp: new Date().toISOString()
190
+ });
191
+
184
192
  // Mark current prd.json as completed
185
193
  prd.status = 'completed';
186
194
  prd.updated_at = new Date().toISOString();
187
195
  writeJSON('.ralph/prd.json', prd);
188
196
 
189
- // Reset iteration counter for next module
190
- // (preserve max_iterations from config)
197
+ // FIX #2: Load next module's PRD NOW and reset iteration counter
198
+ const nextModulePrd = readJSON(queue.modules[nextIndex].prdFile);
199
+ nextModulePrd.config.current_iteration = 1;
200
+ nextModulePrd.config.max_iterations = prd.config.max_iterations; // Preserve
201
+ nextModulePrd.updated_at = new Date().toISOString();
202
+ writeJSON('.ralph/prd.json', nextModulePrd);
191
203
 
192
204
  console.log(`
193
205
  ╔══════════════════════════════════════════════════════════════════╗
@@ -197,10 +209,13 @@ if (hasQueue) {
197
209
  ║ Modules: ${queue.completedModules} / ${queue.totalModules} ║
198
210
  ╠══════════════════════════════════════════════════════════════════╣
199
211
  ║ ADVANCING TO NEXT MODULE: ${queue.modules[nextIndex].code} ║
212
+ ║ Next module PRD loaded: ${queue.modules[nextIndex].prdFile} ║
213
+ ║ Iteration counter reset: 1 ║
200
214
  ╚══════════════════════════════════════════════════════════════════╝
201
215
  `);
202
216
 
203
- // Loop back to step-01 which will load next module's prd
217
+ // Loop back to step-01 which will detect module-changed.json
218
+ // and skip the "Only Read Once" rule for this transition
204
219
  // -> Proceed to step-01-task.md
205
220
  return;
206
221
  }
@@ -347,8 +362,60 @@ Batch: {tasksToExecute.length} task(s) [{firstCategory}]
347
362
  1. Mark `task.status = 'in_progress'`, `task.started_at = now`
348
363
  2. ULTRA THINK: implement the task following SmartStack conventions
349
364
  - Track files_created and files_modified per task
350
- 3. Verify acceptance criteria
351
- 4. If failed: set `task.status = 'failed'`, `task.error = reason`, continue to next task in batch
365
+ 3. **MANDATORY TEST-DRIVEN CYCLE (per task):**
366
+ ```
367
+ ┌─────────────────────────────────────────────────────────┐
368
+ │ TASK EXECUTION CYCLE (100% tests pass required) │
369
+ ├─────────────────────────────────────────────────────────┤
370
+ │ │
371
+ │ 1. GENERATE CODE │
372
+ │ ├─ Backend: Entity, Service, Repository, Controller│
373
+ │ ├─ Frontend: Page, Component, Hook │
374
+ │ ├─ Tests: Unit tests + Integration tests │
375
+ │ └─ Docs: Inline comments + tooltips + i18n │
376
+ │ │
377
+ │ 2. COMPILE CODE │
378
+ │ ├─ Backend: dotnet build --no-restore │
379
+ │ └─ Frontend: npm run typecheck │
380
+ │ │
381
+ │ 3. RUN TESTS (MANDATORY) │
382
+ │ ├─ Backend: dotnet test {TestProject} │
383
+ │ ├─ Frontend: npm test (if applicable) │
384
+ │ └─ Security: tenant isolation + RBAC checks │
385
+ │ │
386
+ │ 4. CHECK RESULT │
387
+ │ ├─ IF 100% PASS → Mark task completed, next task │
388
+ │ └─ IF ANY FAIL → Go to step 5 │
389
+ │ │
390
+ │ 5. FIX ERRORS (loop until pass) │
391
+ │ ├─ Parse test output → identify failing tests │
392
+ │ ├─ Analyze root cause (stack trace, logs) │
393
+ │ ├─ Fix code (NOT test - fix implementation) │
394
+ │ ├─ Re-compile (step 2) │
395
+ │ └─ Re-run tests (step 3) → loop until 100% pass │
396
+ │ │
397
+ │ 🎯 Goal: ZERO test failures before next task │
398
+ │ 📊 Coverage: 95-100% (tests auto-generated per task) │
399
+ │ │
400
+ └─────────────────────────────────────────────────────────┘
401
+ ```
402
+
403
+ **Implementation per task:**
404
+ a. Generate code + tests
405
+ b. Compile: `dotnet build` or `npm run typecheck`
406
+ c. Run tests: `dotnet test {TestProject}` or `npm test`
407
+ d. Parse test output → count passed/failed/skipped
408
+ e. IF failed > 0:
409
+ - Log failure details to progress.txt
410
+ - Analyze error (stack trace, assertion message)
411
+ - Fix code (modify implementation, NOT test)
412
+ - Re-compile
413
+ - Re-run tests
414
+ - Repeat until passed = total (100%)
415
+ f. IF passed = total → task.status = 'completed'
416
+
417
+ 4. Verify acceptance criteria
418
+ 5. If task execution failed (not tests, but code generation): set `task.status = 'failed'`, `task.error = reason`, continue to next task in batch
352
419
 
353
420
  **CATEGORY-SPECIFIC EXECUTION RULES:**
354
421