@atlashub/smartstack-cli 1.35.0 → 1.36.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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: step-05-report
3
- description: Generate final feature report
3
+ description: Generate final report from prd.json v2 structured data
4
4
  next_step: null
5
5
  ---
6
6
 
@@ -8,57 +8,79 @@ next_step: null
8
8
 
9
9
  ## YOUR TASK:
10
10
 
11
- Generate a comprehensive feature report documenting what was accomplished.
11
+ Generate a comprehensive feature report using structured data from prd.json v2 (history, task metadata, file tracking).
12
12
 
13
13
  ---
14
14
 
15
15
  ## EXECUTION SEQUENCE:
16
16
 
17
- ### 1. Gather Statistics
17
+ ### 1. Load Structured Data from prd.json
18
18
 
19
- **Collect data from prd.json and progress.txt:**
19
+ **Read all data from the single source of truth:**
20
20
 
21
21
  ```javascript
22
22
  const prd = readJSON('.ralph/prd.json');
23
+
23
24
  const stats = {
24
25
  feature: prd.feature,
26
+ status: prd.status,
27
+ schema: prd.$version,
25
28
  started: prd.created,
26
29
  completed: new Date().toISOString(),
27
- iterations: prd.current_iteration,
28
- maxIterations: prd.max_iterations,
29
- tasksCompleted: prd.tasks.filter(t => t.passes).length,
30
- tasksTotal: prd.tasks.length,
31
- status: allComplete ? "COMPLETE" : "PARTIAL"
30
+ iterations_used: prd.config.current_iteration - 1,
31
+ max_iterations: prd.config.max_iterations,
32
+ tasks: {
33
+ total: prd.tasks.length,
34
+ completed: prd.tasks.filter(t => t.status === 'completed').length,
35
+ failed: prd.tasks.filter(t => t.status === 'failed').length,
36
+ blocked: prd.tasks.filter(t => t.status === 'blocked').length,
37
+ skipped: prd.tasks.filter(t => t.status === 'skipped').length,
38
+ pending: prd.tasks.filter(t => t.status === 'pending').length
39
+ },
40
+ source: prd.source ? prd.source.type : 'direct',
41
+ branch: prd.metadata.branch
32
42
  };
43
+
44
+ // Aggregate files from all tasks
45
+ const allFilesCreated = [];
46
+ const allFilesModified = [];
47
+ for (const task of prd.tasks) {
48
+ if (task.files_changed) {
49
+ allFilesCreated.push(...task.files_changed.created);
50
+ allFilesModified.push(...task.files_changed.modified);
51
+ }
52
+ }
53
+
54
+ // Deduplicate
55
+ const filesCreated = [...new Set(allFilesCreated)];
56
+ const filesModified = [...new Set(allFilesModified)];
57
+
58
+ // Calculate total duration from history
59
+ const totalDuration = prd.history.reduce((sum, h) => sum + (h.duration_seconds || 0), 0);
33
60
  ```
34
61
 
35
- ### 2. Collect File Changes
62
+ ### 2. Collect MCP Usage (from logs if available)
36
63
 
37
- **Get files from git log:**
64
+ **Parse from verbose logs:**
38
65
 
39
66
  ```bash
40
- git log --name-status --pretty=format:"%H" HEAD~{iterations}..HEAD
67
+ # Count MCP calls from log files
68
+ MCP_CALLS=$(grep -c "\[MCP\]" .ralph/logs/*.log 2>/dev/null || echo "0")
69
+ SMARTSTACK_CALLS=$(grep -c "mcp__smartstack" .ralph/logs/*.log 2>/dev/null || echo "0")
70
+ CONTEXT7_CALLS=$(grep -c "mcp__context7" .ralph/logs/*.log 2>/dev/null || echo "0")
41
71
  ```
42
72
 
43
- **Categorize:**
44
- - Files created (A)
45
- - Files modified (M)
46
- - Files deleted (D)
47
-
48
- ### 3. Collect MCP Usage
49
-
50
- **From verbose logs (if available):**
73
+ **Or extract from task validations:**
51
74
 
52
75
  ```javascript
53
- const mcpStats = {
54
- validate_conventions: X,
55
- check_migrations: Y,
56
- scaffold_extension: Z,
57
- context7_queries: W
76
+ const validationStats = {
77
+ passed: prd.tasks.filter(t => t.validation === 'passed').length,
78
+ failed: prd.tasks.filter(t => t.validation && t.validation.startsWith('failed')).length,
79
+ skipped: prd.tasks.filter(t => t.validation === null).length
58
80
  };
59
81
  ```
60
82
 
61
- ### 4. Generate Report File
83
+ ### 3. Generate Report File
62
84
 
63
85
  **Write to `.ralph/reports/{feature-slug}.md`:**
64
86
 
@@ -66,87 +88,148 @@ const mcpStats = {
66
88
  # Feature Report: {feature}
67
89
 
68
90
  ## Summary
69
- - **Started**: {started}
70
- - **Completed**: {completed}
71
- - **Duration**: {iterations} iterations
72
- - **Status**: {status}
73
-
74
- ## Task Progress
75
-
76
- | # | Task | Status |
77
- |---|------|--------|
78
- | 1 | {task_1_description} | ✅ |
79
- | 2 | {task_2_description} | ✅ |
80
- | 3 | {task_3_description} | ❌ (if incomplete) |
81
-
82
- ## MCP Usage Statistics
83
-
84
- | Tool | Calls | Success | Failures |
85
- |------|-------|---------|----------|
86
- | validate_conventions | X | X | 0 |
87
- | check_migrations | Y | Y | 0 |
88
- | scaffold_extension | Z | Z | 0 |
89
- | context7 query-docs | W | W | 0 |
90
-
91
- ## Files Created
92
91
 
93
- ```
94
- {list of created files}
95
- ```
92
+ | Field | Value |
93
+ |-------|-------|
94
+ | **Status** | {status} |
95
+ | **Started** | {started} |
96
+ | **Completed** | {completed} |
97
+ | **Iterations** | {iterations_used} / {max_iterations} |
98
+ | **Branch** | {branch} |
99
+ | **Source** | {source} |
100
+ | **Schema** | {schema} |
96
101
 
97
- ## Files Modified
102
+ ## Task Progress
98
103
 
99
- ```
100
- {list of modified files}
101
- ```
104
+ | # | Task | Category | Status | Iteration | Duration | Commit |
105
+ |---|------|----------|--------|-----------|----------|--------|
106
+ {for each task in prd.tasks:}
107
+ | {id} | {description} | {category} | {status_emoji} | {iteration || '-'} | {duration}s | {commit_hash || '-'} |
108
+ {end for}
109
+
110
+ **Summary: {completed}/{total} completed, {failed} failed, {blocked} blocked, {skipped} skipped**
111
+
112
+ {status_emoji mapping: completed=✅, failed=❌, blocked=🚫, skipped=⏭️, pending=⏳}
113
+
114
+ ## Failed Tasks
115
+
116
+ {if any failed tasks:}
117
+ | # | Task | Error |
118
+ |---|------|-------|
119
+ {for each failed task:}
120
+ | {id} | {description} | {error} |
121
+ {end for}
122
+ {else:}
123
+ No failed tasks.
124
+ {end if}
125
+
126
+ ## Blocked Tasks
127
+
128
+ {if any blocked tasks:}
129
+ | # | Task | Blocked By | Error |
130
+ |---|------|------------|-------|
131
+ {for each blocked task:}
132
+ | {id} | {description} | Tasks {dependencies} | {error} |
133
+ {end for}
134
+ {else:}
135
+ No blocked tasks.
136
+ {end if}
137
+
138
+ ## Iteration History
139
+
140
+ {for each entry in prd.history:}
141
+ ### Iteration {iteration} — Task [{task_id}]
142
+ - **Action**: {action}
143
+ - **Timestamp**: {timestamp}
144
+ - **Commit**: {commit_hash}
145
+ - **Duration**: {duration_seconds}s
146
+ - **Notes**: {notes}
147
+
148
+ {end for}
149
+
150
+ ## MCP Validation Results
151
+
152
+ | Task | Category | Validation |
153
+ |------|----------|------------|
154
+ {for each task:}
155
+ | [{id}] {description} | {category} | {validation || 'N/A'} |
156
+ {end for}
157
+
158
+ ## Files Created ({filesCreated.length})
159
+
160
+ {if filesCreated.length > 0:}
161
+ {for each file:}
162
+ - `{file}`
163
+ {end for}
164
+ {else:}
165
+ - (none)
166
+ {end if}
167
+
168
+ ## Files Modified ({filesModified.length})
169
+
170
+ {if filesModified.length > 0:}
171
+ {for each file:}
172
+ - `{file}`
173
+ {end for}
174
+ {else:}
175
+ - (none)
176
+ {end if}
102
177
 
103
178
  ## Git Commits
104
179
 
105
- ```
106
- {commit_hash_1} feat(ralph): {message_1}
107
- {commit_hash_2} feat(ralph): {message_2}
108
- ```
180
+ {for each unique commit_hash in tasks:}
181
+ `{commit_hash}` {commit message from task description}
182
+ {end for}
109
183
 
110
- ## Validations Performed
184
+ ## Metadata
111
185
 
112
- - [x] SmartStack conventions validated
113
- - [x] EF Core migrations checked (if applicable)
114
- - [x] No conflicts detected
115
- - [x] Build passes
116
- - [x] Tests pass (if applicable)
186
+ | Field | Value |
187
+ |-------|-------|
188
+ | CLI Version | {prd.metadata.cli_version} |
189
+ | Branch | {prd.metadata.branch} |
190
+ | Project | {prd.metadata.project_path} |
191
+ | MCP SmartStack | {prd.metadata.mcp_servers.smartstack ? '✅' : '❌'} |
192
+ | MCP Context7 | {prd.metadata.mcp_servers.context7 ? '✅' : '❌'} |
193
+ | Total Duration | {totalDuration}s ({Math.round(totalDuration/60)} min) |
117
194
 
118
- ## Key Learnings
195
+ ---
196
+ *Auto-generated by Ralph Loop v2 — SmartStack CLI*
197
+ ```
119
198
 
120
- {Extracted from progress.txt - key insights from each iteration}
199
+ ### 4. Finalize prd.json
121
200
 
122
- ## Notes
201
+ **Set final status (if not already set by step-04):**
123
202
 
124
- {Any additional observations about the implementation}
203
+ ```javascript
204
+ prd.updated_at = new Date().toISOString();
205
+ writeJSON('.ralph/prd.json', prd);
125
206
  ```
126
207
 
127
208
  ### 5. Display Final Summary
128
209
 
129
210
  ```
130
211
  ╔══════════════════════════════════════════════════════════════════╗
131
- ║ RALPH LOOP COMPLETE
212
+ ║ RALPH LOOP COMPLETE
132
213
  ╠══════════════════════════════════════════════════════════════════╣
133
- ║ Feature: {feature}
134
- ║ Status: {status}
135
- ║ Iterations: {iterations}
136
- ║ Tasks: {tasksCompleted} / {tasksTotal}
214
+ ║ Feature: {feature}
215
+ ║ Status: {status}
216
+ ║ Iterations: {iterations_used}
217
+ ║ Tasks: {completed}/{total} completed
218
+ ║ {failed} failed, {blocked} blocked ║
137
219
  ╠══════════════════════════════════════════════════════════════════╣
138
- ║ Files Created: {created_count}
139
- ║ Files Modified: {modified_count}
140
- ║ Commits: {commit_count}
220
+ ║ Files Created: {filesCreated.length}
221
+ ║ Files Modified: {filesModified.length}
222
+ ║ Commits: {unique_commits.length}
223
+ ║ Duration: {totalDuration}s ({minutes} min) ║
141
224
  ╠══════════════════════════════════════════════════════════════════╣
142
- ║ Report saved to:
143
- ║ .ralph/reports/{feature-slug}.md
225
+ ║ Report saved to:
226
+ ║ .ralph/reports/{feature-slug}.md
144
227
  ╚══════════════════════════════════════════════════════════════════╝
145
228
  ```
146
229
 
147
230
  ### 6. Output Completion (if applicable)
148
231
 
149
- **If all tasks complete and not already output:**
232
+ **If prd.status === 'completed' and not already output:**
150
233
 
151
234
  ```
152
235
  <promise>{completion_promise}</promise>
@@ -154,7 +237,7 @@ const mcpStats = {
154
237
 
155
238
  ---
156
239
 
157
- ## CLEANUP OPTIONS:
240
+ ## CLEANUP SUGGESTIONS:
158
241
 
159
242
  **Suggest to user:**
160
243
 
@@ -162,19 +245,23 @@ const mcpStats = {
162
245
  Next steps:
163
246
  1. Review report: .ralph/reports/{feature-slug}.md
164
247
  2. Run full test suite: dotnet test
165
- 3. Create PR: /gitflow:7-pull-request
166
- 4. Clean up Ralph files: rm -rf .ralph/
248
+ 3. Create PR: /gitflow pr
249
+ 4. Clean up Ralph files: rm -rf .ralph/ (optional)
167
250
  ```
168
251
 
169
252
  ---
170
253
 
171
254
  ## SUCCESS CRITERIA:
172
255
 
173
- - Report generated in `.ralph/reports/`
174
- - All statistics accurate
175
- - File lists complete
176
- - Learnings documented
256
+ - Report generated in `.ralph/reports/` with ALL structured data from prd.json
257
+ - Task progress table with categories, status, iterations, and commits
258
+ - Failed/blocked tasks documented with error messages
259
+ - Iteration history from `history[]` included
260
+ - File lists from task-level tracking (not git log)
261
+ - Metadata section with execution context
262
+ - Duration calculated from history entries
177
263
  - Final summary displayed
264
+ - prd.json `status` and `updated_at` finalized
178
265
 
179
266
  ## COMPLETION:
180
267