@atlashub/smartstack-cli 4.25.0 → 4.27.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 (30) hide show
  1. package/dist/index.js +765 -517
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +33 -11
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/agents/ba-writer.md +46 -42
  7. package/templates/project/appsettings.json.template +4 -6
  8. package/templates/skills/apex/SKILL.md +1 -0
  9. package/templates/skills/apex/references/challenge-questions.md +17 -0
  10. package/templates/skills/apex/references/post-checks.md +48 -0
  11. package/templates/skills/apex/steps/step-03-execute.md +63 -2
  12. package/templates/skills/ba-generate-html/references/data-build.md +22 -13
  13. package/templates/skills/ba-generate-html/references/data-mapping.md +33 -24
  14. package/templates/skills/ba-generate-html/steps/step-01-collect.md +15 -6
  15. package/templates/skills/ba-generate-html/steps/step-02-build-data.md +37 -22
  16. package/templates/skills/business-analyse/steps/step-00-init.md +22 -14
  17. package/templates/skills/business-analyse/steps/step-04-consolidate.md +3 -0
  18. package/templates/skills/derive-prd/steps/step-01-transform.md +6 -2
  19. package/templates/skills/derive-prd/steps/step-02-export.md +12 -0
  20. package/templates/skills/ralph-loop/references/category-completeness.md +3 -3
  21. package/templates/skills/ralph-loop/references/compact-loop.md +81 -14
  22. package/templates/skills/ralph-loop/references/init-resume-recovery.md +1 -1
  23. package/templates/skills/ralph-loop/references/module-transition.md +30 -5
  24. package/templates/skills/ralph-loop/references/multi-module-queue.md +4 -4
  25. package/templates/skills/ralph-loop/references/section-splitting.md +6 -6
  26. package/templates/skills/ralph-loop/steps/step-01-task.md +14 -4
  27. package/templates/skills/ralph-loop/steps/step-02-execute.md +14 -6
  28. package/templates/skills/ralph-loop/steps/step-03-commit.md +15 -4
  29. package/templates/skills/ralph-loop/steps/step-04-check.md +19 -5
  30. package/templates/skills/ralph-loop/steps/step-05-report.md +35 -3
@@ -18,8 +18,19 @@ Commit PRD state changes after apex delegation. Apex already committed code —
18
18
 
19
19
  ### 1. Finalize Task in prd.json
20
20
 
21
+ > **BLOCKING:** If prd.tasks has any task with status='pending' that should be 'completed'
22
+ > based on actual code commits, FIX prd.json BEFORE committing.
23
+
21
24
  ```javascript
22
- const prd = readJSON('.ralph/prd.json');
25
+ // PRD PATH RESOLUTION
26
+ const queuePath = '.ralph/modules-queue.json';
27
+ let currentPrdPath = '.ralph/prd.json';
28
+ if (fileExists(queuePath)) {
29
+ const queue = readJSON(queuePath);
30
+ currentPrdPath = queue.queue[queue.currentIndex].prdFile;
31
+ }
32
+
33
+ const prd = readJSON(currentPrdPath);
23
34
  const now = new Date().toISOString();
24
35
 
25
36
  // Apex updates individual task statuses. Ralph updates overall PRD state.
@@ -29,7 +40,7 @@ prd.status = allDone ? 'completed' : prd.tasks.some(t => t.status === 'failed' |
29
40
  prd.config.current_iteration++;
30
41
  prd.updated_at = now;
31
42
 
32
- writeJSON('.ralph/prd.json', prd);
43
+ writeJSON(currentPrdPath, prd);
33
44
  ```
34
45
 
35
46
  ### 2. Update progress.txt
@@ -44,7 +55,7 @@ Module: {current_module}
44
55
  ### 3. Stage and Commit (PRD state only)
45
56
 
46
57
  ```bash
47
- git add .ralph/prd.json .ralph/progress.txt
58
+ git add {currentPrdPath} .ralph/progress.txt
48
59
  [ -f .ralph/modules-queue.json ] && git add .ralph/modules-queue.json
49
60
 
50
61
  git commit -m "$(cat <<'EOF'
@@ -69,7 +80,7 @@ prd.history.push({
69
80
  commit_hash: COMMIT_HASH,
70
81
  notes: "Delegated to /apex"
71
82
  });
72
- writeJSON('.ralph/prd.json', prd);
83
+ writeJSON(currentPrdPath, prd);
73
84
  ```
74
85
 
75
86
  ### 5. Verify
@@ -15,7 +15,15 @@ Check if all tasks are complete and decide: output completion promise, advance m
15
15
  ## 1. Read Current State
16
16
 
17
17
  ```javascript
18
- const prd = readJSON('.ralph/prd.json');
18
+ // PRD PATH RESOLUTION
19
+ const queuePath = '.ralph/modules-queue.json';
20
+ let currentPrdPath = '.ralph/prd.json';
21
+ if (fileExists(queuePath)) {
22
+ const queue = readJSON(queuePath);
23
+ currentPrdPath = queue.queue[queue.currentIndex].prdFile;
24
+ }
25
+
26
+ const prd = readJSON(currentPrdPath);
19
27
  const tasksCompleted = prd.tasks.filter(t => t.status === 'completed').length;
20
28
  const tasksSkipped = prd.tasks.filter(t => t.status === 'skipped').length;
21
29
  const tasksFailed = prd.tasks.filter(t => t.status === 'failed').length;
@@ -41,7 +49,7 @@ if [ $BUILD_RC -ne 0 ]; then
41
49
  prd.tasks.push({ id: maxId+1, description: "Fix build regression",
42
50
  status: "pending", category: "validation", dependencies: [],
43
51
  acceptance_criteria: "dotnet build passes" });
44
- writeJSON('.ralph/prd.json', prd);
52
+ writeJSON(currentPrdPath, prd);
45
53
  fi
46
54
  ```
47
55
 
@@ -57,7 +65,7 @@ const { missing, guardrailsNeeded } = checkCategoryCompleteness(prd);
57
65
 
58
66
  if (guardrailsNeeded.length > 0) {
59
67
  prd.tasks.push(...guardrailsNeeded);
60
- writeJSON('.ralph/prd.json', prd);
68
+ writeJSON(currentPrdPath, prd);
61
69
  console.log(`PRD updated: +${guardrailsNeeded.length} guardrails, ${prd.tasks.filter(t => t.status === 'pending').length} pending tasks`);
62
70
  }
63
71
  // Artifact verification is handled inside checkCategoryCompleteness() — see reference file.
@@ -117,6 +125,8 @@ if (fileExists(queuePath)) {
117
125
  } else {
118
126
  // All categories complete — advance to next module
119
127
  // (detailed logic in references/module-transition.md)
128
+ // MANDATORY: If this was the LAST module, ALWAYS proceed to step-05-report.md.
129
+ // NEVER stop without generating the final report.
120
130
  }
121
131
  }
122
132
  ```
@@ -128,7 +138,11 @@ ALL TASKS COMPLETE | Iterations: {n} | Tasks: {completed}/{total}
128
138
  <promise>{completion_promise}</promise>
129
139
  ```
130
140
 
131
- Set `prd.status = 'completed'` → step-05.
141
+ Set `prd.status = 'completed'`.
142
+
143
+ **MANDATORY: After displaying completion, ALWAYS load step-05-report.md and generate the report.**
144
+ **NEVER stop after displaying "ALL TASKS COMPLETE" without generating the report.**
145
+ → step-05.
132
146
 
133
147
  ## 4. Dead-End Check
134
148
 
@@ -149,7 +163,7 @@ if (!hasPending && !allDone && retriableCount > 0) {
149
163
  // TRUE dead-end: all retries exhausted
150
164
  console.log(`DEAD-END: ${tasksCompletedNow} done, ${tasksFailed} failed (retries exhausted), ${tasksBlocked} blocked`);
151
165
  prd.status = 'failed';
152
- writeJSON('.ralph/prd.json', prd);
166
+ writeJSON(currentPrdPath, prd);
153
167
  // → step-05
154
168
  }
155
169
  ```
@@ -15,7 +15,17 @@ Generate a comprehensive feature report using structured data from prd.json.
15
15
  ## 1. Load Data
16
16
 
17
17
  ```javascript
18
- const prd = readJSON('.ralph/prd.json');
18
+ // PRD PATH RESOLUTION
19
+ const queuePath = '.ralph/modules-queue.json';
20
+ let currentPrdPath = '.ralph/prd.json';
21
+ if (fileExists(queuePath)) {
22
+ const queue = readJSON(queuePath);
23
+ // For report, use last module's PRD (or current if still in progress)
24
+ const idx = Math.min(queue.currentIndex, queue.modules.length - 1);
25
+ currentPrdPath = queue.modules[idx].prdFile;
26
+ }
27
+
28
+ const prd = readJSON(currentPrdPath);
19
29
  const stats = {
20
30
  feature: prd.feature, status: prd.status,
21
31
  iterations_used: prd.config.current_iteration - 1,
@@ -53,6 +63,28 @@ if (fileExists(queuePath)) {
53
63
  }
54
64
  ```
55
65
 
66
+ ### 1d. Artifact Verification (Post-Execution Validation)
67
+
68
+ ```javascript
69
+ // Verify key artifacts exist on disk
70
+ const allFiles = prd.implementation?.filesToCreate || {};
71
+ const missingFiles = [];
72
+ for (const cat of Object.keys(allFiles)) {
73
+ for (const file of allFiles[cat] || []) {
74
+ if (!fileExists(file.path)) missingFiles.push(file.path);
75
+ }
76
+ }
77
+ if (missingFiles.length > 0) {
78
+ console.warn(`WARNING: ${missingFiles.length} files declared in PRD but not found on disk`);
79
+ for (const f of missingFiles.slice(0, 10)) {
80
+ console.warn(` MISSING: ${f}`);
81
+ }
82
+ if (missingFiles.length > 10) {
83
+ console.warn(` ... and ${missingFiles.length - 10} more`);
84
+ }
85
+ }
86
+ ```
87
+
56
88
  ### 1c. Test Metrics (from PRD)
57
89
 
58
90
  > **Note:** Apex already ran tests and recorded results. Source metrics from PRD task data.
@@ -136,7 +168,7 @@ Write to `.ralph/reports/{feature-slug}.md`:
136
168
  // can resume with `-r` — deleting them here would make recovery impossible.
137
169
  if (prd._sectionSplit?.enabled && prd.status === 'completed') {
138
170
  for (const phase of prd._sectionSplit.phases) {
139
- if (fileExists(phase.prdFile) && phase.prdFile !== '.ralph/prd.json') {
171
+ if (fileExists(phase.prdFile) && phase.prdFile !== currentPrdPath) {
140
172
  deleteFile(phase.prdFile);
141
173
  }
142
174
  }
@@ -146,7 +178,7 @@ if (prd._sectionSplit?.enabled && prd.status === 'completed') {
146
178
  }
147
179
 
148
180
  prd.updated_at = new Date().toISOString();
149
- writeJSON('.ralph/prd.json', prd);
181
+ writeJSON(currentPrdPath, prd);
150
182
  ```
151
183
 
152
184
  ## 4. Display Summary