@atlashub/smartstack-cli 1.35.0 → 1.37.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 (27) hide show
  1. package/package.json +1 -1
  2. package/templates/skills/_shared.md +7 -7
  3. package/templates/skills/application/steps/step-01-navigation.md +226 -43
  4. package/templates/skills/application/steps/step-03-roles.md +160 -38
  5. package/templates/skills/application/steps/step-04-backend.md +126 -19
  6. package/templates/skills/application/steps/step-05-frontend.md +4 -1
  7. package/templates/skills/application/templates-backend.md +8 -8
  8. package/templates/skills/application/templates-frontend.md +8 -8
  9. package/templates/skills/application/templates-seed.md +200 -1
  10. package/templates/skills/gitflow/_shared.md +188 -53
  11. package/templates/skills/gitflow/phases/abort.md +28 -16
  12. package/templates/skills/gitflow/phases/cleanup.md +13 -9
  13. package/templates/skills/gitflow/phases/status.md +16 -17
  14. package/templates/skills/gitflow/steps/step-commit.md +11 -5
  15. package/templates/skills/gitflow/steps/step-finish.md +43 -33
  16. package/templates/skills/gitflow/steps/step-init.md +7 -2
  17. package/templates/skills/gitflow/steps/step-merge.md +24 -10
  18. package/templates/skills/gitflow/steps/step-pr.md +42 -28
  19. package/templates/skills/gitflow/steps/step-start.md +19 -13
  20. package/templates/skills/gitflow/templates/config.json +7 -4
  21. package/templates/skills/ralph-loop/SKILL.md +57 -11
  22. package/templates/skills/ralph-loop/steps/step-00-init.md +170 -30
  23. package/templates/skills/ralph-loop/steps/step-01-task.md +243 -40
  24. package/templates/skills/ralph-loop/steps/step-02-execute.md +142 -24
  25. package/templates/skills/ralph-loop/steps/step-03-commit.md +140 -36
  26. package/templates/skills/ralph-loop/steps/step-04-check.md +128 -44
  27. package/templates/skills/ralph-loop/steps/step-05-report.md +175 -88
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: step-02-execute
3
- description: Execute ONE task from the task list
3
+ description: Execute ONE task with dependency checks and rich tracking
4
4
  next_step: steps/step-03-commit.md
5
5
  ---
6
6
 
@@ -20,21 +20,68 @@ Execute exactly ONE task from prd.json. Do NOT batch multiple tasks.
20
20
  2. **ATOMIC CHANGES** - Changes should be complete and working
21
21
  3. **USE MCP** - Validate with SmartStack MCP as needed
22
22
  4. **DOCUMENT** - Track what you're doing
23
+ 5. **CHECK DEPENDENCIES** - Verify all dependencies are met before starting
24
+ 6. **TRACK FILES** - Record every file created or modified
23
25
 
24
26
  ---
25
27
 
26
28
  ## EXECUTION SEQUENCE:
27
29
 
28
- ### 1. Understand the Task
30
+ ### 1. Verify Dependencies
31
+
32
+ **BEFORE starting, check all dependencies are satisfied:**
33
+
34
+ ```javascript
35
+ const prd = readJSON('.ralph/prd.json');
36
+ const task = prd.tasks.find(t => t.id === {current_task_id});
37
+
38
+ for (const depId of task.dependencies) {
39
+ const dep = prd.tasks.find(t => t.id === depId);
40
+ if (!dep || dep.status !== 'completed') {
41
+ echo `❌ BLOCKED: Task ${task.id} depends on task ${depId} (status: ${dep?.status || 'missing'})`;
42
+ task.status = 'blocked';
43
+ task.error = `Dependency task ${depId} not completed (${dep?.status})`;
44
+ writeJSON('.ralph/prd.json', prd);
45
+ STOP - return to step-01 to find next eligible task
46
+ }
47
+ }
48
+ ```
49
+
50
+ ### 2. Mark Task as In-Progress
51
+
52
+ **Update prd.json immediately:**
53
+
54
+ ```javascript
55
+ task.status = 'in_progress';
56
+ task.started_at = new Date().toISOString();
57
+ prd.updated_at = task.started_at;
58
+ writeJSON('.ralph/prd.json', prd);
59
+ ```
60
+
61
+ ### 3. Understand the Task
29
62
 
30
63
  **ULTRA THINK:**
31
64
 
32
65
  - What exactly needs to be done?
33
66
  - What files need to be created/modified?
34
- - What are the success criteria?
67
+ - What are the acceptance criteria? → `{current_task_criteria}`
35
68
  - What patterns should be followed?
69
+ - What category is this? → `{current_task_category}`
70
+
71
+ **Category-specific guidance:**
36
72
 
37
- ### 2. Explore Context (if needed)
73
+ | Category | MCP Tools | Patterns |
74
+ |----------|-----------|----------|
75
+ | `domain` | `validate_conventions` | Entity base class, IHasData, audit fields |
76
+ | `application` | `validate_conventions`, `scaffold_extension` | CQRS, MediatR, FluentValidation |
77
+ | `infrastructure` | `check_migrations`, `suggest_migration` | EF Core config, HasData seeding |
78
+ | `api` | `scaffold_routes`, `validate_security` | Controller conventions, authorization |
79
+ | `frontend` | `validate_frontend_routes`, `scaffold_frontend_extension` | React patterns, hooks |
80
+ | `i18n` | - | 4-language JSON structure |
81
+ | `test` | `scaffold_tests`, `analyze_test_coverage` | xUnit, test naming conventions |
82
+ | `validation` | `validate_conventions` | Build, test, lint checks |
83
+
84
+ ### 4. Explore Context (if needed)
38
85
 
39
86
  **Use subagents sparingly:**
40
87
 
@@ -50,7 +97,7 @@ If exploration needed:
50
97
  - Grep for code search
51
98
  - Read for file contents
52
99
 
53
- ### 3. Execute Implementation
100
+ ### 5. Execute Implementation
54
101
 
55
102
  **Implement the task:**
56
103
 
@@ -60,6 +107,13 @@ If exploration needed:
60
107
  - Add appropriate logging
61
108
  - Handle errors properly
62
109
 
110
+ **Track every file operation:**
111
+
112
+ ```
113
+ {files_created} = [] // Accumulate as you create files
114
+ {files_modified} = [] // Accumulate as you modify files
115
+ ```
116
+
63
117
  **Use TodoWrite to track sub-steps:**
64
118
 
65
119
  ```
@@ -69,32 +123,68 @@ If task has multiple parts:
69
123
  3. Mark completed when done
70
124
  ```
71
125
 
72
- ### 4. Validate with MCP
126
+ ### 6. Validate with MCP
73
127
 
74
- **After implementation, validate:**
128
+ **After implementation, validate based on category:**
75
129
 
76
130
  ```
131
+ # Always run general validation
77
132
  mcp__smartstack__validate_conventions:
78
133
  checks: ["all"]
134
+
135
+ # Category-specific validation
136
+ if category == "infrastructure":
137
+ mcp__smartstack__check_migrations
138
+
139
+ if category == "api":
140
+ mcp__smartstack__validate_security
141
+
142
+ if category == "frontend":
143
+ mcp__smartstack__validate_frontend_routes
144
+
145
+ if category == "test":
146
+ mcp__smartstack__analyze_test_coverage
147
+ ```
148
+
149
+ **Record validation result:**
150
+ ```
151
+ {validation_result} = "passed" | "failed: {reason}"
79
152
  ```
80
153
 
81
154
  **If validation fails:**
82
155
  - Fix the issues
83
156
  - Re-validate
84
157
  - Do NOT proceed until valid
158
+ - If cannot fix: set `{validation_result} = "failed: {reason}"`
159
+
160
+ ### 7. Check Acceptance Criteria
161
+
162
+ **Verify against `{current_task_criteria}`:**
163
+
164
+ ```
165
+ ULTRA THINK: Does the implementation satisfy the acceptance criteria?
166
+
167
+ Criteria: {current_task_criteria}
168
+
169
+ ✅ Met / ❌ Not met (explain why)
170
+ ```
85
171
 
86
- ### 5. Run Quick Tests
172
+ **If criteria NOT met:**
173
+ - Continue working until met
174
+ - If impossible to meet: document in `{task_error}`
175
+
176
+ ### 8. Run Quick Tests
87
177
 
88
178
  **If applicable:**
89
179
 
90
180
  ```bash
91
- # For backend changes
92
- dotnet build src/SmartStack.Api/SmartStack.Api.csproj --no-restore
181
+ # For backend changes (domain, application, infrastructure, api)
182
+ dotnet build --no-restore 2>&1
93
183
 
94
184
  # For frontend changes
95
185
  npm run lint && npm run typecheck
96
186
 
97
- # For specific tests
187
+ # For test category
98
188
  dotnet test --filter "FullyQualifiedName~{relevant_test}"
99
189
  ```
100
190
 
@@ -103,17 +193,33 @@ dotnet test --filter "FullyQualifiedName~{relevant_test}"
103
193
  - Re-run until passing
104
194
  - Document what was fixed
105
195
 
106
- ### 6. Track Progress
196
+ ### 9. Update Task State in prd.json
107
197
 
108
- **Update internal state:**
198
+ **Persist tracking data BEFORE committing:**
109
199
 
110
- ```
111
- {files_created} = ["path/to/file1.cs", "path/to/file2.ts"]
112
- {files_modified} = ["path/to/existing.cs"]
113
- {tests_run} = true/false
114
- {validation} = "passed" / "failed"
200
+ ```javascript
201
+ const prd = readJSON('.ralph/prd.json');
202
+ const task = prd.tasks.find(t => t.id === {current_task_id});
203
+
204
+ task.files_changed = {
205
+ created: {files_created},
206
+ modified: {files_modified}
207
+ };
208
+ task.validation = {validation_result};
209
+
210
+ // If task failed
211
+ if ({task_failed}) {
212
+ task.status = 'failed';
213
+ task.error = '{failure_reason}';
214
+ task.completed_at = new Date().toISOString();
215
+ }
216
+
217
+ prd.updated_at = new Date().toISOString();
218
+ writeJSON('.ralph/prd.json', prd);
115
219
  ```
116
220
 
221
+ **Note: `task.status` stays `"in_progress"` until step-03 confirms the commit. Only `"failed"` is set here if the task cannot be completed.**
222
+
117
223
  ---
118
224
 
119
225
  ## IMPORTANT CONSTRAINTS:
@@ -121,7 +227,9 @@ dotnet test --filter "FullyQualifiedName~{relevant_test}"
121
227
  ### What TO DO:
122
228
  - Implement exactly what the task describes
123
229
  - Follow existing patterns
124
- - Validate changes
230
+ - Validate changes with MCP
231
+ - Track all file operations
232
+ - Check acceptance criteria
125
233
  - Write minimal, clean code
126
234
 
127
235
  ### What NOT TO DO:
@@ -129,6 +237,7 @@ dotnet test --filter "FullyQualifiedName~{relevant_test}"
129
237
  - Don't refactor unrelated code
130
238
  - Don't add "nice to have" features
131
239
  - Don't skip validation
240
+ - Don't forget to track files
132
241
 
133
242
  ---
134
243
 
@@ -140,9 +249,11 @@ Task Executed:
140
249
  | Action | Details |
141
250
  |--------|---------|
142
251
  | Task | [{current_task_id}] {current_task_description} |
252
+ | Category | {current_task_category} |
143
253
  | Files Created | {files_created} |
144
254
  | Files Modified | {files_modified} |
145
- | Validation | Passed |
255
+ | Validation | {validation_result} |
256
+ | Acceptance | ✅ Criteria met |
146
257
  | Tests | ✅ Passed |
147
258
 
148
259
  -> Committing changes...
@@ -154,10 +265,11 @@ Task Executed:
154
265
 
155
266
  **If task cannot be completed:**
156
267
 
157
- 1. Document the blocker
158
- 2. Update progress.txt with learnings
159
- 3. Mark task with a note (don't mark passes: true)
160
- 4. Proceed to step-03 to save progress
268
+ 1. Document the blocker in `task.error`
269
+ 2. Set `task.status = "failed"` in prd.json
270
+ 3. Update progress.txt with learnings
271
+ 4. Proceed to step-03 to save progress (commit what was done)
272
+ 5. step-04 will handle blocked downstream tasks
161
273
 
162
274
  **If build fails:**
163
275
 
@@ -166,6 +278,12 @@ Task Executed:
166
278
  3. Re-build until success
167
279
  4. Then proceed
168
280
 
281
+ **If validation fails:**
282
+
283
+ 1. Fix validation issues
284
+ 2. Re-validate until clean
285
+ 3. If unfixable: document in `task.error`, set `task.validation = "failed: {reason}"`
286
+
169
287
  ---
170
288
 
171
289
  ## NEXT STEP:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: step-03-commit
3
- description: Commit changes, update prd.json and progress.txt
3
+ description: Commit changes, update prd.json v2 with full tracking
4
4
  next_step: steps/step-04-check.md
5
5
  ---
6
6
 
@@ -8,7 +8,7 @@ next_step: steps/step-04-check.md
8
8
 
9
9
  ## YOUR TASK:
10
10
 
11
- Commit the changes from the executed task, update prd.json and progress.txt.
11
+ Commit the changes from the executed task, finalize task tracking in prd.json, and append to history.
12
12
 
13
13
  ---
14
14
 
@@ -20,12 +20,16 @@ Commit the changes from the executed task, update prd.json and progress.txt.
20
20
 
21
21
  ```bash
22
22
  git add {files_created} {files_modified}
23
+
24
+ # Also stage prd.json (already updated in step-02)
25
+ git add .ralph/prd.json
23
26
  ```
24
27
 
25
28
  **Verify staged changes:**
26
29
 
27
30
  ```bash
28
31
  git status
32
+ git diff --cached --stat
29
33
  ```
30
34
 
31
35
  ### 2. Create Commit
@@ -34,47 +38,107 @@ git status
34
38
 
35
39
  ```bash
36
40
  git commit -m "$(cat <<'EOF'
37
- feat(ralph): {current_task_description}
41
+ {PREFIX}({scope}): {current_task_description}
38
42
 
39
43
  Task {current_task_id}/{tasks_total} - Iteration {current_iteration}
44
+ Category: {current_task_category}
40
45
 
41
46
  Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42
47
  EOF
43
48
  )"
44
49
  ```
45
50
 
46
- **Commit message format:**
47
- - Type: `feat`, `fix`, `refactor`, `test`, `docs`
48
- - Scope: `ralph` or specific module
49
- - Description: Task description
50
- - Footer: Iteration info
51
+ **Determine commit prefix from category:**
52
+
53
+ | Category | Prefix | Scope |
54
+ |----------|--------|-------|
55
+ | `domain` | `feat` | entity name or module |
56
+ | `application` | `feat` | module name |
57
+ | `infrastructure` | `db` | migrations / config |
58
+ | `api` | `feat` | controller name |
59
+ | `frontend` | `feat` | component/page name |
60
+ | `i18n` | `chore` | i18n |
61
+ | `test` | `test` | module name |
62
+ | `validation` | `chore` | validation |
63
+ | `other` | `chore` | ralph |
64
+
65
+ **Get commit hash:**
66
+ ```bash
67
+ COMMIT_HASH=$(git rev-parse --short HEAD)
68
+ ```
69
+
70
+ ### 3. Finalize Task in prd.json
51
71
 
52
- ### 3. Update prd.json
72
+ **Mark task as completed with all tracking data:**
53
73
 
54
- **Mark current task as complete:**
74
+ ```javascript
75
+ const prd = readJSON('.ralph/prd.json');
76
+ const task = prd.tasks.find(t => t.id === {current_task_id});
77
+ const now = new Date().toISOString();
55
78
 
56
- ```json
57
- {
58
- "feature": "{task_description}",
59
- "current_iteration": {current_iteration + 1},
60
- "tasks": [
61
- { "id": 1, "description": "...", "passes": true }, // was false
62
- { "id": 2, "description": "...", "passes": false } // next task
63
- ]
79
+ // Only mark completed if not already failed in step-02
80
+ if (task.status !== 'failed') {
81
+ task.status = 'completed';
82
+ }
83
+ task.completed_at = now;
84
+ task.iteration = prd.config.current_iteration;
85
+ task.commit_hash = COMMIT_HASH;
86
+
87
+ // files_changed already set in step-02, but verify
88
+ if (!task.files_changed || (!task.files_changed.created.length && !task.files_changed.modified.length)) {
89
+ // Fallback: extract from git diff
90
+ task.files_changed = {
91
+ created: getGitNewFiles(), // git diff --cached --name-only --diff-filter=A
92
+ modified: getGitModifiedFiles() // git diff --cached --name-only --diff-filter=M
93
+ };
64
94
  }
65
95
  ```
66
96
 
67
- **Write updated prd.json:**
97
+ ### 4. Append to History
98
+
99
+ **Add structured iteration entry:**
68
100
 
69
101
  ```javascript
70
- const prd = readJSON('.ralph/prd.json');
71
- const task = prd.tasks.find(t => t.id === currentTaskId);
72
- task.passes = true;
73
- prd.current_iteration++;
102
+ prd.history.push({
103
+ iteration: prd.config.current_iteration,
104
+ task_id: task.id,
105
+ action: task.status, // "completed" or "failed"
106
+ timestamp: now,
107
+ commit_hash: COMMIT_HASH,
108
+ duration_seconds: Math.round(
109
+ (new Date(now) - new Date(task.started_at)) / 1000
110
+ ),
111
+ notes: "{What was learned or accomplished during this task}"
112
+ });
113
+ ```
114
+
115
+ ### 5. Increment Iteration and Update Timestamps
116
+
117
+ **IMPORTANT: Increment AFTER recording the current iteration in task and history.**
118
+
119
+ ```javascript
120
+ prd.config.current_iteration++;
121
+ prd.updated_at = now;
122
+
123
+ // Update top-level status
124
+ const allCompleted = prd.tasks.every(t =>
125
+ t.status === 'completed' || t.status === 'skipped'
126
+ );
127
+ const anyFailed = prd.tasks.some(t => t.status === 'failed');
128
+ const anyBlocked = prd.tasks.some(t => t.status === 'blocked');
129
+
130
+ if (allCompleted) {
131
+ prd.status = 'completed';
132
+ } else if (anyFailed || anyBlocked) {
133
+ prd.status = 'partial';
134
+ } else {
135
+ prd.status = 'in_progress';
136
+ }
137
+
74
138
  writeJSON('.ralph/prd.json', prd);
75
139
  ```
76
140
 
77
- ### 4. Update progress.txt
141
+ ### 6. Update progress.txt
78
142
 
79
143
  **Append learnings to progress.txt:**
80
144
 
@@ -85,10 +149,17 @@ writeJSON('.ralph/prd.json', prd);
85
149
 
86
150
  ### Task Completed
87
151
  [{current_task_id}] {current_task_description}
152
+ Category: {current_task_category}
153
+ Status: {task.status}
154
+ Commit: {COMMIT_HASH}
88
155
 
89
156
  ### Files Changed
90
- - Created: {files_created}
91
- - Modified: {files_modified}
157
+ - Created: {task.files_changed.created}
158
+ - Modified: {task.files_changed.modified}
159
+
160
+ ### Acceptance Criteria
161
+ {current_task_criteria}
162
+ Result: ✅ Met / ❌ Not met
92
163
 
93
164
  ### Learnings
94
165
  {What was learned during this task}
@@ -99,20 +170,38 @@ writeJSON('.ralph/prd.json', prd);
99
170
  {What the next iteration should know}
100
171
  ```
101
172
 
102
- ### 5. Verify Commit
173
+ ### 7. Commit prd.json and progress.txt Updates
174
+
175
+ **Stage and commit the tracking files separately:**
176
+
177
+ ```bash
178
+ git add .ralph/prd.json .ralph/progress.txt
179
+ git commit -m "$(cat <<'EOF'
180
+ chore(ralph): update progress - task {current_task_id}/{tasks_total}
181
+
182
+ Iteration {current_iteration} complete
183
+ Status: {task.status}
184
+
185
+ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
186
+ EOF
187
+ )"
188
+ ```
189
+
190
+ ### 8. Verify Commit
103
191
 
104
192
  **Check commit was created:**
105
193
 
106
194
  ```bash
107
- git log -1 --oneline
195
+ git log -2 --oneline
108
196
  ```
109
197
 
110
198
  **Expected output:**
111
199
  ```
112
- abc1234 feat(ralph): {current_task_description}
200
+ def5678 chore(ralph): update progress - task {id}/{total}
201
+ abc1234 feat(scope): {current_task_description}
113
202
  ```
114
203
 
115
- ### 6. Log Activity (if verbose)
204
+ ### 9. Log Activity (if verbose)
116
205
 
117
206
  **If {verbose_mode} = true:**
118
207
 
@@ -120,9 +209,13 @@ Append to `.ralph/logs/{date}.log`:
120
209
  ```
121
210
  [{timestamp}] TASK COMPLETED
122
211
  Task: [{current_task_id}] {current_task_description}
123
- Commit: {commit_hash}
124
- Files: {file_count} changed
212
+ Category: {current_task_category}
213
+ Status: {task.status}
214
+ Commit: {COMMIT_HASH}
215
+ Files: {file_count} changed ({created_count} created, {modified_count} modified)
216
+ Duration: {duration_seconds}s
125
217
  Iteration: {current_iteration}
218
+ Validation: {validation_result}
126
219
  ```
127
220
 
128
221
  ---
@@ -134,13 +227,17 @@ Changes Committed:
134
227
 
135
228
  | Field | Value |
136
229
  |-------|-------|
137
- | Commit | {commit_hash} |
138
- | Task | [{current_task_id}] |
230
+ | Commit | {COMMIT_HASH} |
231
+ | Task | [{current_task_id}] {current_task_description} |
232
+ | Category | {current_task_category} |
233
+ | Status | {task.status} |
139
234
  | Iteration | {current_iteration} |
140
235
  | Files | {file_count} changed |
236
+ | Duration | {duration_seconds}s |
237
+ | Validation | {validation_result} |
141
238
 
142
- prd.json: Updated task {current_task_id} to passes: true
143
- progress.txt: Added iteration {current_iteration} learnings
239
+ prd.json: Task {current_task_id} {task.status}, history entry added
240
+ progress.txt: Iteration {current_iteration} learnings appended
144
241
 
145
242
  -> Checking completion...
146
243
  ```
@@ -163,6 +260,13 @@ progress.txt: Added iteration {current_iteration} learnings
163
260
  2. Retry write
164
261
  3. If still fails, output error and stop
165
262
 
263
+ **If task was failed in step-02:**
264
+
265
+ 1. Still commit whatever was done (partial progress)
266
+ 2. task.status remains "failed"
267
+ 3. history entry records action: "failed"
268
+ 4. step-04 will handle downstream blocking
269
+
166
270
  ---
167
271
 
168
272
  ## NEXT STEP: