@atlashub/smartstack-cli 3.17.0 → 3.19.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 (43) hide show
  1. package/dist/index.js +3 -0
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/agents/gitflow/start.md +2 -2
  5. package/templates/skills/business-analyse/SKILL.md +5 -5
  6. package/templates/skills/business-analyse/_shared.md +46 -20
  7. package/templates/skills/business-analyse/html/ba-interactive.html +57 -107
  8. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +13 -0
  9. package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +1 -1
  10. package/templates/skills/business-analyse/html/src/scripts/03-render-cadrage.js +11 -20
  11. package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +1 -3
  12. package/templates/skills/business-analyse/html/src/template.html +31 -83
  13. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +71 -3
  14. package/templates/skills/business-analyse/references/cadrage-pre-analysis.md +11 -8
  15. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +7 -5
  16. package/templates/skills/business-analyse/references/deploy-data-build.md +42 -14
  17. package/templates/skills/business-analyse/references/deploy-modes.md +1 -1
  18. package/templates/skills/business-analyse/references/entity-architecture-decision.md +218 -0
  19. package/templates/skills/business-analyse/references/robustness-checks.md +2 -1
  20. package/templates/skills/business-analyse/references/spec-auto-inference.md +70 -16
  21. package/templates/skills/business-analyse/references/ui-resource-cards.md +149 -0
  22. package/templates/skills/business-analyse/steps/step-00-init.md +23 -5
  23. package/templates/skills/business-analyse/steps/step-01-cadrage.md +220 -32
  24. package/templates/skills/business-analyse/steps/step-02-decomposition.md +35 -26
  25. package/templates/skills/business-analyse/steps/step-03a1-setup.md +122 -32
  26. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +8 -0
  27. package/templates/skills/business-analyse/steps/step-03b-ui.md +68 -5
  28. package/templates/skills/business-analyse/steps/step-03d-validate.md +34 -1
  29. package/templates/skills/business-analyse/steps/step-05a-handoff.md +99 -2
  30. package/templates/skills/business-analyse/steps/step-05b-deploy.md +44 -8
  31. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +226 -41
  32. package/templates/skills/business-analyse/steps/step-06-review.md +2 -1
  33. package/templates/skills/business-analyse/templates/tpl-handoff.md +5 -4
  34. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +4 -1
  35. package/templates/skills/business-analyse/templates-frd.md +5 -4
  36. package/templates/skills/gitflow/references/start-local-config.md +6 -3
  37. package/templates/skills/gitflow/steps/step-start.md +2 -2
  38. package/templates/skills/ralph-loop/SKILL.md +41 -1
  39. package/templates/skills/ralph-loop/references/category-rules.md +96 -2
  40. package/templates/skills/ralph-loop/references/compact-loop.md +85 -24
  41. package/templates/skills/ralph-loop/steps/step-00-init.md +30 -54
  42. package/templates/skills/ralph-loop/steps/step-01-task.md +102 -1
  43. package/templates/skills/ralph-loop/steps/step-04-check.md +87 -40
@@ -71,6 +71,68 @@ if [ -f "web/package.json" ] || [ -f "package.json" ]; then
71
71
  fi
72
72
  ```
73
73
 
74
+ ### 1.7. Category Completeness Check (RUNS EVERY ITERATION)
75
+
76
+ > **CRITICAL:** This check runs REGARDLESS of allDone status.
77
+ > In test-v4-005, allDone was never true (PRD status not updated), so the
78
+ > module completeness check in section 3b never triggered, and missing
79
+ > frontend/test categories were never detected.
80
+
81
+ ```javascript
82
+ const presentCategories = new Set(prd.tasks.map(t => t.category));
83
+ const REQUIRED_CATEGORIES = ['domain', 'infrastructure', 'application', 'api', 'frontend', 'test'];
84
+ const missingFromPrd = REQUIRED_CATEGORIES.filter(c => !presentCategories.has(c));
85
+
86
+ if (missingFromPrd.length > 0) {
87
+ console.warn(`⚠ PRD MISSING CATEGORIES: ${missingFromPrd.join(', ')}`);
88
+
89
+ // Inject guardrail tasks for missing categories
90
+ let maxIdNum = Math.max(...prd.tasks.map(t => parseInt(t.id.replace(/[^0-9]/g, ''), 10) || 0));
91
+ const prefix = prd.tasks[0]?.id?.replace(/[0-9]+$/, '') || 'GUARD-';
92
+ const lastApiTask = prd.tasks.filter(t => t.category === 'api').pop()?.id;
93
+
94
+ for (const cat of missingFromPrd) {
95
+ maxIdNum++;
96
+ const taskId = `${prefix}${String(maxIdNum).padStart(3, '0')}`;
97
+ prd.tasks.push({
98
+ id: taskId,
99
+ description: `[GUARDRAIL] Generate missing ${cat} layer for ${prd.project?.module || 'module'}`,
100
+ status: 'pending', category: cat,
101
+ dependencies: lastApiTask ? [lastApiTask] : [],
102
+ acceptance_criteria: [
103
+ cat === 'frontend' ? 'React pages + routes wired to App.tsx (standard + tenant blocks)' :
104
+ cat === 'test' ? 'Unit + integration test projects with passing dotnet test' :
105
+ `${cat} layer complete`
106
+ ],
107
+ started_at: null, completed_at: null, iteration: null,
108
+ commit_hash: null, files_changed: [], validation: null, error: null
109
+ });
110
+ console.log(` → Injected [${taskId}] ${cat} guardrail`);
111
+ }
112
+ writeJSON('.ralph/prd.json', prd);
113
+
114
+ // Re-count after injection
115
+ const newPending = prd.tasks.filter(t => t.status === 'pending').length;
116
+ console.log(`PRD updated: +${missingFromPrd.length} guardrails, ${newPending} pending tasks`);
117
+ }
118
+
119
+ // Also check: artifact existence for categories with completed tasks
120
+ const completedCats = new Set(prd.tasks.filter(t => t.status === 'completed').map(t => t.category));
121
+ const artifactChecks = {
122
+ 'frontend': () => glob.sync('**/src/pages/**/*.tsx').length > 0,
123
+ 'test': () => glob.sync('tests/**/*Tests.cs').length > 0,
124
+ 'api': () => glob.sync('src/*/Controllers/**/*Controller.cs').length > 0
125
+ };
126
+ for (const [cat, check] of Object.entries(artifactChecks)) {
127
+ if (completedCats.has(cat) && !check()) {
128
+ console.warn(`ARTIFACT MISSING: ${cat} tasks marked completed but no files found — resetting`);
129
+ prd.tasks.filter(t => t.category === cat && t.status === 'completed')
130
+ .forEach(t => { t.status = 'pending'; t.error = 'Artifacts missing — re-execute'; t.completed_at = null; });
131
+ writeJSON('.ralph/prd.json', prd);
132
+ }
133
+ }
134
+ ```
135
+
74
136
  ## 2. Check Iteration Limit
75
137
 
76
138
  If `current_iteration > max_iterations`:
@@ -82,6 +144,13 @@ Set `prd.status = 'partial'` → step-05.
82
144
 
83
145
  ## 3. Check All Tasks Complete
84
146
 
147
+ **Re-read state after section 1.7 (categories may have been injected):**
148
+ ```javascript
149
+ const tasksCompletedNow = prd.tasks.filter(t => t.status === 'completed').length;
150
+ const tasksTotalNow = prd.tasks.length;
151
+ const allDone = (tasksCompletedNow + prd.tasks.filter(t => t.status === 'skipped').length) === tasksTotalNow;
152
+ ```
153
+
85
154
  If `allDone`:
86
155
 
87
156
  ### 3a. Team Mode (multi-module with Agent Teams)
@@ -107,42 +176,15 @@ if (fileExists(queuePath)) {
107
176
  const queue = readJSON(queuePath);
108
177
  const currentModule = queue.modules[queue.currentIndex];
109
178
 
110
- // MODULE COMPLETENESS CHECK: verify all expected layers AND their artifacts
179
+ // MODULE COMPLETENESS CHECK (lightweight heavy check already done in section 1.7)
180
+ // Verify all expected layers have completed tasks
111
181
  const completedCats = new Set(prd.tasks.filter(t => t.status === 'completed').map(t => t.category));
112
182
  const expected = ['domain', 'infrastructure', 'application', 'api', 'frontend', 'test'];
113
183
  const missing = expected.filter(c => !completedCats.has(c));
114
184
 
115
- // ARTIFACT EXISTENCE CHECK: categories with completed tasks must have real files
116
- const artifactChecks = {
117
- 'infrastructure': () => fs.existsSync('src/*/Persistence/Migrations') && fs.readdirSync('src/*/Persistence/Migrations').length > 0,
118
- 'test': () => fs.existsSync(`tests/${projectName}.Tests.Unit`) && glob.sync('tests/**/*Tests.cs').length > 0,
119
- 'api': () => glob.sync('src/*/Controllers/**/*Controller.cs').length > 0,
120
- 'frontend': () => glob.sync('**/src/pages/**/*.tsx').length > 0
121
- };
122
- for (const [cat, check] of Object.entries(artifactChecks)) {
123
- if (completedCats.has(cat) && !check()) {
124
- // Tasks marked completed but artifacts missing — reset to pending
125
- prd.tasks.filter(t => t.category === cat && t.status === 'completed')
126
- .forEach(t => { t.status = 'pending'; t.error = 'Artifacts missing — re-execute'; t.completed_at = null; });
127
- missing.push(cat);
128
- console.log(`ARTIFACT RESET: ${cat} tasks reset to pending (no files found)`);
129
- }
130
- }
131
-
132
185
  if (missing.length > 0) {
133
- // Inject guardrail tasks for missing layers
134
- let maxId = Math.max(...prd.tasks.map(t => t.id));
135
- for (const cat of missing) {
136
- maxId++;
137
- prd.tasks.push({
138
- id: maxId, description: `[${cat}] GUARDRAIL: Generate missing ${cat} for ${currentModule.code}`,
139
- status: 'pending', category: cat, dependencies: [],
140
- acceptance_criteria: `${cat} layer fully implemented`, started_at: null, completed_at: null,
141
- iteration: null, commit_hash: null, files_changed: { created: [], modified: [] },
142
- validation: null, error: null, module: currentModule.code
143
- });
144
- }
145
- writeJSON('.ralph/prd.json', prd);
186
+ // Section 1.7 should have injected guardrails already — fall through to compact loop
187
+ console.log(`Module ${currentModule.code}: missing categories ${missing.join(', ')} — continuing loop`);
146
188
  // Fall through to section 5 (compact loop)
147
189
  } else {
148
190
  // Module complete — advance
@@ -198,28 +240,33 @@ DEAD-END: {completed} done, {failed} failed, {blocked} blocked
198
240
  ```
199
241
  Set `prd.status = 'failed'` → step-05.
200
242
 
201
- ## 5. Compact Loop (CRITICAL)
243
+ ## 5. Compact Loop (MANDATORY — EXECUTE IMMEDIATELY)
202
244
 
203
- > **MANDATORY:** After first full iteration, ALL subsequent iterations use this inline loop.
204
- > DO NOT stop. DO NOT wait for user. DO NOT re-read step files.
205
- > **Read `references/compact-loop.md` and execute inline.**
245
+ > **THIS IS NOT OPTIONAL.** If there are pending tasks, you MUST enter the compact loop NOW.
246
+ > DO NOT stop. DO NOT wait for user. DO NOT ask for confirmation. DO NOT re-read step files.
247
+ > **Read `references/compact-loop.md` and execute ALL sections inline.**
248
+ > **Stopping here is a VIOLATION of the execution guarantee.**
206
249
 
207
250
  If `hasPending && iteration < max`:
208
251
 
209
252
  1. Read `references/compact-loop.md`
210
- 2. Execute sections A → B → C → D inline
211
- 3. Return to section 1 of THIS step
253
+ 2. Execute sections A → B → C → D inline (find tasks → execute batch → commit → loop back)
254
+ 3. **IMMEDIATELY** return to section 1 of THIS step (do NOT pause)
255
+ 4. Repeat until ALL tasks are complete, max iterations reached, or dead-end
212
256
 
213
257
  ---
214
258
 
215
- ## CRITICAL RULES:
259
+ ## CRITICAL RULES — EXECUTION GUARANTEE:
216
260
 
217
261
  - **NEVER** output completion promise unless ALL tasks done (all modules if multi)
218
262
  - **NEVER** delegate the loop to sub-agents (except team mode for multi-module)
219
- - **NEVER** stop between iterations
263
+ - **NEVER** stop between iterations — this is the CORE PROMISE of ralph-loop
264
+ - **NEVER** ask the user "should I continue?" or "is this OK?" — JUST CONTINUE
265
+ - **NEVER** pause to show intermediate results and wait for feedback
220
266
  - **BATCH** same-category tasks (max 5)
221
267
  - **MODULE COMPLETENESS:** All layers must have completed tasks before advancing
222
- - Only valid stop: all complete, max iterations, dead-end, or user Ctrl+C
268
+ - **Only valid stop conditions:** all complete, max iterations, dead-end, or user Ctrl+C
269
+ - **If you stop for any other reason, you have VIOLATED the execution guarantee.**
223
270
 
224
271
  ---
225
272