@atlashub/smartstack-cli 1.13.2 → 1.14.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 (210) hide show
  1. package/.documentation/agents.html +1 -1
  2. package/.documentation/apex.html +1 -1
  3. package/.documentation/business-analyse.html +1 -1
  4. package/.documentation/cli-commands.html +3 -3
  5. package/.documentation/commands.html +1 -1
  6. package/.documentation/efcore.html +1 -1
  7. package/.documentation/gitflow.html +1 -1
  8. package/.documentation/hooks.html +1 -1
  9. package/.documentation/index.html +1 -1
  10. package/.documentation/init.html +3 -3
  11. package/.documentation/installation.html +1001 -352
  12. package/.documentation/ralph-loop.html +1 -1
  13. package/.documentation/test-web.html +1 -1
  14. package/README.md +88 -20
  15. package/dist/index.js +276 -85
  16. package/dist/index.js.map +1 -1
  17. package/package.json +1 -1
  18. package/templates/agents/code-reviewer.md +163 -0
  19. package/templates/agents/efcore/db-deploy.md +25 -7
  20. package/templates/agents/efcore/db-reset.md +31 -10
  21. package/templates/agents/efcore/db-status.md +22 -5
  22. package/templates/agents/efcore/migration.md +69 -19
  23. package/templates/agents/gitflow/cleanup.md +8 -1
  24. package/templates/agents/gitflow/commit.md +7 -5
  25. package/templates/agents/gitflow/finish.md +6 -4
  26. package/templates/agents/gitflow/pr.md +8 -1
  27. package/templates/agents/gitflow/start.md +1 -1
  28. package/templates/commands/check-version.md +267 -0
  29. package/templates/commands/efcore/_shared.md +30 -1
  30. package/templates/commands/efcore/db-reset.md +18 -6
  31. package/templates/commands/gitflow/OPTIMIZATIONS.md +206 -0
  32. package/templates/commands/refactor.md +164 -0
  33. package/templates/project/DependencyInjection.Application.cs.template +25 -0
  34. package/templates/project/DependencyInjection.Infrastructure.cs.template +61 -0
  35. package/templates/project/DesignTimeExtensionsDbContextFactory.cs.template +70 -0
  36. package/templates/project/ExampleEntity.cs.template +116 -0
  37. package/templates/project/ExampleEntityConfiguration.cs.template +64 -0
  38. package/templates/project/ExampleService.cs.template +146 -0
  39. package/templates/project/ExtensionsDbContext.cs.template +41 -0
  40. package/templates/project/IExtensionsDbContext.cs.template +22 -0
  41. package/templates/project/Program.cs.template +47 -0
  42. package/templates/project/README.md +79 -0
  43. package/templates/ralph/README.md +10 -8
  44. package/templates/ralph/ralph.config.yaml +2 -2
  45. package/templates/skills/_shared.md +44 -44
  46. package/templates/skills/ai-prompt/SKILL.md +55 -55
  47. package/templates/skills/apex/SKILL.md +235 -0
  48. package/templates/skills/apex/steps/step-00-init.md +203 -0
  49. package/templates/skills/apex/steps/step-01-analyze.md +210 -0
  50. package/templates/skills/apex/steps/step-02-plan.md +217 -0
  51. package/templates/skills/apex/steps/step-03-execute.md +178 -0
  52. package/templates/skills/apex/steps/step-04-validate.md +217 -0
  53. package/templates/skills/apex/steps/step-05-examine.md +207 -0
  54. package/templates/skills/apex/steps/step-06-resolve.md +181 -0
  55. package/templates/skills/apex/steps/step-07-tests.md +206 -0
  56. package/templates/skills/apex/steps/step-08-run-tests.md +207 -0
  57. package/templates/skills/apex/templates/00-context.md +46 -0
  58. package/templates/skills/apex/templates/01-analyze.md +63 -0
  59. package/templates/skills/apex/templates/02-plan.md +63 -0
  60. package/templates/skills/apex/templates/03-execute.md +34 -0
  61. package/templates/skills/apex/templates/04-validate.md +61 -0
  62. package/templates/skills/apex/templates/05-examine.md +58 -0
  63. package/templates/skills/apex/templates/06-resolve.md +39 -0
  64. package/templates/skills/apex/templates/07-tests.md +56 -0
  65. package/templates/skills/apex/templates/08-run-tests.md +41 -0
  66. package/templates/skills/apex/templates/README.md +69 -0
  67. package/templates/skills/application/SKILL.md +50 -50
  68. package/templates/skills/application/templates-backend.md +25 -25
  69. package/templates/skills/application/templates-frontend.md +43 -43
  70. package/templates/skills/application/templates-i18n.md +29 -29
  71. package/templates/skills/application/templates-seed.md +77 -77
  72. package/templates/skills/business-analyse/SKILL.md +223 -0
  73. package/templates/skills/business-analyse/_shared.md +258 -0
  74. package/templates/skills/business-analyse/questionnaire/01-context.md +33 -0
  75. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +35 -0
  76. package/templates/skills/business-analyse/questionnaire/03-scope.md +35 -0
  77. package/templates/skills/business-analyse/questionnaire/04-data.md +36 -0
  78. package/templates/skills/business-analyse/questionnaire/05-integrations.md +36 -0
  79. package/templates/skills/business-analyse/questionnaire/06-security.md +40 -0
  80. package/templates/skills/business-analyse/questionnaire/07-ui.md +36 -0
  81. package/templates/skills/business-analyse/questionnaire/08-performance.md +35 -0
  82. package/templates/skills/business-analyse/questionnaire/09-constraints.md +35 -0
  83. package/templates/skills/business-analyse/questionnaire/10-documentation.md +35 -0
  84. package/templates/skills/business-analyse/questionnaire.md +177 -177
  85. package/templates/skills/business-analyse/react/components.md +340 -0
  86. package/templates/skills/business-analyse/react/i18n-template.md +245 -0
  87. package/templates/skills/business-analyse/react/schema.md +151 -0
  88. package/templates/skills/business-analyse/steps/step-00-init.md +293 -0
  89. package/templates/skills/business-analyse/steps/step-01-discover.md +267 -0
  90. package/templates/skills/business-analyse/steps/step-02-analyse.md +243 -0
  91. package/templates/skills/business-analyse/steps/step-03-specify.md +317 -0
  92. package/templates/skills/business-analyse/steps/step-04-validate.md +239 -0
  93. package/templates/skills/business-analyse/steps/step-05-handoff.md +336 -0
  94. package/templates/skills/business-analyse/steps/step-06-doc-html.md +261 -0
  95. package/templates/skills/business-analyse/templates/00-context.md +105 -0
  96. package/templates/skills/business-analyse/templates/frd-brd.md +97 -0
  97. package/templates/skills/business-analyse/templates/frd-discovery.md +78 -0
  98. package/templates/skills/business-analyse/templates/frd-handoff.md +118 -0
  99. package/templates/skills/business-analyse/templates/frd-spec.md +168 -0
  100. package/templates/skills/business-analyse/templates-frd.md +217 -217
  101. package/templates/skills/business-analyse/templates-react.md +26 -26
  102. package/templates/skills/controller/SKILL.md +141 -92
  103. package/templates/skills/controller/postman-templates.md +15 -15
  104. package/templates/skills/controller/steps/step-00-init.md +191 -0
  105. package/templates/skills/controller/steps/step-01-analyze.md +146 -0
  106. package/templates/skills/controller/steps/step-02-plan.md +176 -0
  107. package/templates/skills/controller/steps/step-03-generate.md +219 -0
  108. package/templates/skills/controller/steps/step-04-perms.md +219 -0
  109. package/templates/skills/controller/steps/step-05-validate.md +107 -0
  110. package/templates/skills/controller/templates.md +77 -77
  111. package/templates/skills/documentation/SKILL.md +79 -79
  112. package/templates/skills/feature-full/SKILL.md +38 -38
  113. package/templates/skills/gitflow/SKILL.md +277 -0
  114. package/templates/{commands → skills}/gitflow/_shared.md +20 -20
  115. package/templates/skills/gitflow/phases/abort.md +173 -0
  116. package/templates/skills/gitflow/phases/cleanup.md +226 -0
  117. package/templates/skills/gitflow/phases/status.md +178 -0
  118. package/templates/skills/gitflow/steps/step-commit.md +255 -0
  119. package/templates/skills/gitflow/steps/step-finish.md +255 -0
  120. package/templates/skills/gitflow/steps/step-init.md +209 -0
  121. package/templates/skills/gitflow/steps/step-merge.md +225 -0
  122. package/templates/skills/gitflow/steps/step-plan.md +208 -0
  123. package/templates/skills/gitflow/steps/step-pr.md +235 -0
  124. package/templates/skills/gitflow/steps/step-start.md +234 -0
  125. package/templates/skills/gitflow/steps/step-sync.md +200 -0
  126. package/templates/skills/gitflow/templates/config.json +53 -0
  127. package/templates/skills/notification/SKILL.md +51 -51
  128. package/templates/skills/ralph-loop/SKILL.md +228 -0
  129. package/templates/skills/ralph-loop/steps/step-00-init.md +201 -0
  130. package/templates/skills/ralph-loop/steps/step-01-task.md +169 -0
  131. package/templates/skills/ralph-loop/steps/step-02-execute.md +173 -0
  132. package/templates/skills/ralph-loop/steps/step-03-commit.md +170 -0
  133. package/templates/skills/ralph-loop/steps/step-04-check.md +162 -0
  134. package/templates/skills/ralph-loop/steps/step-05-report.md +181 -0
  135. package/templates/skills/review-code/SKILL.md +219 -0
  136. package/templates/skills/review-code/references/clean-code-principles.md +140 -0
  137. package/templates/skills/review-code/references/code-quality-metrics.md +174 -0
  138. package/templates/skills/review-code/references/feedback-patterns.md +149 -0
  139. package/templates/skills/review-code/references/security-checklist.md +127 -0
  140. package/templates/skills/ui-components/SKILL.md +54 -54
  141. package/templates/skills/workflow/SKILL.md +46 -46
  142. package/templates/commands/ai-prompt.md +0 -315
  143. package/templates/commands/apex/1-analyze.md +0 -100
  144. package/templates/commands/apex/2-plan.md +0 -145
  145. package/templates/commands/apex/3-execute.md +0 -171
  146. package/templates/commands/apex/4-examine.md +0 -116
  147. package/templates/commands/apex/5-tasks.md +0 -209
  148. package/templates/commands/apex.md +0 -76
  149. package/templates/commands/application/create.md +0 -362
  150. package/templates/commands/application/templates-backend.md +0 -463
  151. package/templates/commands/application/templates-frontend.md +0 -517
  152. package/templates/commands/application/templates-i18n.md +0 -478
  153. package/templates/commands/application/templates-seed.md +0 -362
  154. package/templates/commands/application.md +0 -303
  155. package/templates/commands/business-analyse/0-orchestrate.md +0 -156
  156. package/templates/commands/business-analyse/1-init.md +0 -99
  157. package/templates/commands/business-analyse/2-discover.md +0 -143
  158. package/templates/commands/business-analyse/3-analyse.md +0 -106
  159. package/templates/commands/business-analyse/4-specify.md +0 -133
  160. package/templates/commands/business-analyse/5-validate.md +0 -132
  161. package/templates/commands/business-analyse/6-handoff.md +0 -157
  162. package/templates/commands/business-analyse/7-doc-html.md +0 -103
  163. package/templates/commands/business-analyse/_shared.md +0 -176
  164. package/templates/commands/business-analyse/bug.md +0 -118
  165. package/templates/commands/business-analyse/change-request.md +0 -144
  166. package/templates/commands/business-analyse/hotfix.md +0 -116
  167. package/templates/commands/business-analyse.md +0 -121
  168. package/templates/commands/controller/create.md +0 -216
  169. package/templates/commands/controller/postman-templates.md +0 -528
  170. package/templates/commands/controller/templates.md +0 -600
  171. package/templates/commands/controller.md +0 -337
  172. package/templates/commands/create/agent.md +0 -138
  173. package/templates/commands/create/command.md +0 -166
  174. package/templates/commands/create/hook.md +0 -234
  175. package/templates/commands/create/plugin.md +0 -329
  176. package/templates/commands/create/project.md +0 -508
  177. package/templates/commands/create/skill.md +0 -199
  178. package/templates/commands/create.md +0 -220
  179. package/templates/commands/documentation/module.md +0 -202
  180. package/templates/commands/documentation/templates.md +0 -432
  181. package/templates/commands/documentation.md +0 -190
  182. package/templates/commands/epct.md +0 -69
  183. package/templates/commands/explain.md +0 -186
  184. package/templates/commands/feature-full.md +0 -267
  185. package/templates/commands/gitflow/1-init.md +0 -188
  186. package/templates/commands/gitflow/10-start.md +0 -190
  187. package/templates/commands/gitflow/11-finish.md +0 -382
  188. package/templates/commands/gitflow/12-cleanup.md +0 -103
  189. package/templates/commands/gitflow/13-sync.md +0 -216
  190. package/templates/commands/gitflow/14-rebase.md +0 -251
  191. package/templates/commands/gitflow/2-status.md +0 -122
  192. package/templates/commands/gitflow/3-commit.md +0 -209
  193. package/templates/commands/gitflow/4-plan.md +0 -174
  194. package/templates/commands/gitflow/5-exec.md +0 -202
  195. package/templates/commands/gitflow/6-abort.md +0 -121
  196. package/templates/commands/gitflow/7-pull-request.md +0 -176
  197. package/templates/commands/gitflow/8-review.md +0 -113
  198. package/templates/commands/gitflow/9-merge.md +0 -157
  199. package/templates/commands/gitflow.md +0 -128
  200. package/templates/commands/implement.md +0 -663
  201. package/templates/commands/init.md +0 -567
  202. package/templates/commands/mcp-integration.md +0 -330
  203. package/templates/commands/notification.md +0 -129
  204. package/templates/commands/oneshot.md +0 -57
  205. package/templates/commands/quickstart.md +0 -154
  206. package/templates/commands/ralph-loop/cancel-ralph.md +0 -18
  207. package/templates/commands/ralph-loop/help.md +0 -126
  208. package/templates/commands/ralph-loop/ralph-loop.md +0 -120
  209. package/templates/commands/review.md +0 -106
  210. package/templates/commands/workflow.md +0 -193
@@ -0,0 +1,169 @@
1
+ ---
2
+ name: step-01-task
3
+ description: Load or create tasks from prd.json
4
+ next_step: steps/step-02-execute.md
5
+ ---
6
+
7
+ # Step 1: Load Task
8
+
9
+ ## YOUR TASK:
10
+
11
+ Load the current task from prd.json or create initial task breakdown.
12
+
13
+ **ULTRA THINK about task decomposition.**
14
+
15
+ ---
16
+
17
+ ## EXECUTION SEQUENCE:
18
+
19
+ ### 1. Check for Existing prd.json
20
+
21
+ **If `.ralph/prd.json` exists:**
22
+ - Read and parse the file
23
+ - Find the next task with `passes: false`
24
+ - Load into state
25
+ - Skip to step 4
26
+
27
+ **If `.ralph/prd.json` does NOT exist:**
28
+ - Continue to step 2 (create tasks)
29
+
30
+ ### 2. Analyze Task Description
31
+
32
+ **ULTRA THINK about the task:**
33
+
34
+ - What are the logical subtasks?
35
+ - What order should they be executed?
36
+ - What are the success criteria for each?
37
+ - What files will be modified?
38
+
39
+ **Generate task breakdown:**
40
+
41
+ For `{task_description}`, identify 3-10 subtasks.
42
+
43
+ **Example for "implement user authentication":**
44
+ ```json
45
+ {
46
+ "tasks": [
47
+ { "id": 1, "description": "Create User entity in Domain layer", "passes": false },
48
+ { "id": 2, "description": "Add User DbSet to ApplicationDbContext", "passes": false },
49
+ { "id": 3, "description": "Create EF Core migration", "passes": false },
50
+ { "id": 4, "description": "Implement IPasswordService", "passes": false },
51
+ { "id": 5, "description": "Implement IJwtService", "passes": false },
52
+ { "id": 6, "description": "Create AuthController with login endpoint", "passes": false },
53
+ { "id": 7, "description": "Add authentication middleware", "passes": false },
54
+ { "id": 8, "description": "Write integration tests", "passes": false }
55
+ ]
56
+ }
57
+ ```
58
+
59
+ ### 3. Create prd.json
60
+
61
+ **Write `.ralph/prd.json`:**
62
+
63
+ ```json
64
+ {
65
+ "feature": "{task_description}",
66
+ "created": "{timestamp}",
67
+ "max_iterations": {max_iterations},
68
+ "completion_promise": "{completion_promise}",
69
+ "current_iteration": 1,
70
+ "tasks": [
71
+ { "id": 1, "description": "...", "passes": false },
72
+ { "id": 2, "description": "...", "passes": false }
73
+ ]
74
+ }
75
+ ```
76
+
77
+ **Initialize `.ralph/progress.txt`:**
78
+
79
+ ```markdown
80
+ # Ralph Loop Progress
81
+
82
+ ## Task: {task_description}
83
+ ## Started: {timestamp}
84
+
85
+ ---
86
+
87
+ ## Iteration 1
88
+
89
+ ### Context
90
+ Starting fresh implementation.
91
+
92
+ ### Learnings
93
+ (To be updated after each iteration)
94
+ ```
95
+
96
+ ### 4. Find Current Task
97
+
98
+ **Find the next task with `passes: false`:**
99
+
100
+ ```javascript
101
+ const currentTask = tasks.find(t => !t.passes);
102
+ ```
103
+
104
+ **If all tasks are `passes: true`:**
105
+ - This shouldn't happen in step-01
106
+ - If it does, skip to step-05 (report)
107
+
108
+ **Store in state:**
109
+ ```
110
+ {current_task_id} = currentTask.id
111
+ {current_task_description} = currentTask.description
112
+ {tasks_completed} = tasks.filter(t => t.passes).length
113
+ {tasks_total} = tasks.length
114
+ ```
115
+
116
+ ### 5. Read Previous Progress
117
+
118
+ **If iteration > 1:**
119
+
120
+ Read `.ralph/progress.txt` to understand:
121
+ - What was done in previous iterations
122
+ - Key learnings and context
123
+ - Files that were modified
124
+ - Issues encountered
125
+
126
+ **This provides context for the current iteration.**
127
+
128
+ ### 6. Show Task Status
129
+
130
+ **Display current state:**
131
+
132
+ ```
133
+ ╔══════════════════════════════════════════════════════════════════╗
134
+ ║ ITERATION {current_iteration} / {max_iterations} ║
135
+ ╠══════════════════════════════════════════════════════════════════╣
136
+ ║ Progress: {tasks_completed} / {tasks_total} tasks complete ║
137
+ ║ ║
138
+ ║ Current Task: ║
139
+ ║ [{current_task_id}] {current_task_description} ║
140
+ ╠══════════════════════════════════════════════════════════════════╣
141
+ ║ Previous Learnings: ║
142
+ ║ {summary from progress.txt} ║
143
+ ╚══════════════════════════════════════════════════════════════════╝
144
+
145
+ -> Executing task...
146
+ ```
147
+
148
+ ---
149
+
150
+ ## OUTPUT FORMAT:
151
+
152
+ ```
153
+ Task Loaded:
154
+
155
+ | Field | Value |
156
+ |-------|-------|
157
+ | Iteration | {current_iteration} / {max_iterations} |
158
+ | Task ID | {current_task_id} |
159
+ | Task | {current_task_description} |
160
+ | Progress | {tasks_completed} / {tasks_total} |
161
+
162
+ -> Executing...
163
+ ```
164
+
165
+ ---
166
+
167
+ ## NEXT STEP:
168
+
169
+ After task loaded, proceed to `./step-02-execute.md`
@@ -0,0 +1,173 @@
1
+ ---
2
+ name: step-02-execute
3
+ description: Execute ONE task from the task list
4
+ next_step: steps/step-03-commit.md
5
+ ---
6
+
7
+ # Step 2: Execute Task
8
+
9
+ ## YOUR TASK:
10
+
11
+ Execute exactly ONE task from prd.json. Do NOT batch multiple tasks.
12
+
13
+ **ULTRA THINK about the implementation.**
14
+
15
+ ---
16
+
17
+ ## EXECUTION RULES:
18
+
19
+ 1. **ONE TASK ONLY** - Execute only `{current_task_description}`
20
+ 2. **ATOMIC CHANGES** - Changes should be complete and working
21
+ 3. **USE MCP** - Validate with SmartStack MCP as needed
22
+ 4. **DOCUMENT** - Track what you're doing
23
+
24
+ ---
25
+
26
+ ## EXECUTION SEQUENCE:
27
+
28
+ ### 1. Understand the Task
29
+
30
+ **ULTRA THINK:**
31
+
32
+ - What exactly needs to be done?
33
+ - What files need to be created/modified?
34
+ - What are the success criteria?
35
+ - What patterns should be followed?
36
+
37
+ ### 2. Explore Context (if needed)
38
+
39
+ **Use subagents sparingly:**
40
+
41
+ ```
42
+ If exploration needed:
43
+ - Use explore-codebase agent for file discovery
44
+ - Use explore-docs agent for library docs
45
+ - Use Context7 MCP for documentation
46
+ ```
47
+
48
+ **Prefer direct tool usage:**
49
+ - Glob for file patterns
50
+ - Grep for code search
51
+ - Read for file contents
52
+
53
+ ### 3. Execute Implementation
54
+
55
+ **Implement the task:**
56
+
57
+ - Create/modify files as needed
58
+ - Follow existing patterns in codebase
59
+ - Use SmartStack conventions
60
+ - Add appropriate logging
61
+ - Handle errors properly
62
+
63
+ **Use TodoWrite to track sub-steps:**
64
+
65
+ ```
66
+ If task has multiple parts:
67
+ 1. Create TodoWrite entries for each part
68
+ 2. Mark in_progress as you work
69
+ 3. Mark completed when done
70
+ ```
71
+
72
+ ### 4. Validate with MCP
73
+
74
+ **After implementation, validate:**
75
+
76
+ ```
77
+ mcp__smartstack__validate_conventions:
78
+ checks: ["all"]
79
+ ```
80
+
81
+ **If validation fails:**
82
+ - Fix the issues
83
+ - Re-validate
84
+ - Do NOT proceed until valid
85
+
86
+ ### 5. Run Quick Tests
87
+
88
+ **If applicable:**
89
+
90
+ ```bash
91
+ # For backend changes
92
+ dotnet build src/SmartStack.Api/SmartStack.Api.csproj --no-restore
93
+
94
+ # For frontend changes
95
+ npm run lint && npm run typecheck
96
+
97
+ # For specific tests
98
+ dotnet test --filter "FullyQualifiedName~{relevant_test}"
99
+ ```
100
+
101
+ **If tests fail:**
102
+ - Fix the failing tests
103
+ - Re-run until passing
104
+ - Document what was fixed
105
+
106
+ ### 6. Track Progress
107
+
108
+ **Update internal state:**
109
+
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"
115
+ ```
116
+
117
+ ---
118
+
119
+ ## IMPORTANT CONSTRAINTS:
120
+
121
+ ### What TO DO:
122
+ - Implement exactly what the task describes
123
+ - Follow existing patterns
124
+ - Validate changes
125
+ - Write minimal, clean code
126
+
127
+ ### What NOT TO DO:
128
+ - Don't implement other tasks
129
+ - Don't refactor unrelated code
130
+ - Don't add "nice to have" features
131
+ - Don't skip validation
132
+
133
+ ---
134
+
135
+ ## OUTPUT FORMAT:
136
+
137
+ ```
138
+ Task Executed:
139
+
140
+ | Action | Details |
141
+ |--------|---------|
142
+ | Task | [{current_task_id}] {current_task_description} |
143
+ | Files Created | {files_created} |
144
+ | Files Modified | {files_modified} |
145
+ | Validation | ✅ Passed |
146
+ | Tests | ✅ Passed |
147
+
148
+ -> Committing changes...
149
+ ```
150
+
151
+ ---
152
+
153
+ ## ERROR HANDLING:
154
+
155
+ **If task cannot be completed:**
156
+
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
161
+
162
+ **If build fails:**
163
+
164
+ 1. Analyze error messages
165
+ 2. Fix the issues
166
+ 3. Re-build until success
167
+ 4. Then proceed
168
+
169
+ ---
170
+
171
+ ## NEXT STEP:
172
+
173
+ After task executed and validated, proceed to `./step-03-commit.md`
@@ -0,0 +1,170 @@
1
+ ---
2
+ name: step-03-commit
3
+ description: Commit changes, update prd.json and progress.txt
4
+ next_step: steps/step-04-check.md
5
+ ---
6
+
7
+ # Step 3: Commit Changes
8
+
9
+ ## YOUR TASK:
10
+
11
+ Commit the changes from the executed task, update prd.json and progress.txt.
12
+
13
+ ---
14
+
15
+ ## EXECUTION SEQUENCE:
16
+
17
+ ### 1. Stage Changes
18
+
19
+ **Add modified files:**
20
+
21
+ ```bash
22
+ git add {files_created} {files_modified}
23
+ ```
24
+
25
+ **Verify staged changes:**
26
+
27
+ ```bash
28
+ git status
29
+ ```
30
+
31
+ ### 2. Create Commit
32
+
33
+ **Commit with descriptive message:**
34
+
35
+ ```bash
36
+ git commit -m "$(cat <<'EOF'
37
+ feat(ralph): {current_task_description}
38
+
39
+ Task {current_task_id}/{tasks_total} - Iteration {current_iteration}
40
+
41
+ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42
+ EOF
43
+ )"
44
+ ```
45
+
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
+
52
+ ### 3. Update prd.json
53
+
54
+ **Mark current task as complete:**
55
+
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
+ ]
64
+ }
65
+ ```
66
+
67
+ **Write updated prd.json:**
68
+
69
+ ```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++;
74
+ writeJSON('.ralph/prd.json', prd);
75
+ ```
76
+
77
+ ### 4. Update progress.txt
78
+
79
+ **Append learnings to progress.txt:**
80
+
81
+ ```markdown
82
+ ---
83
+
84
+ ## Iteration {current_iteration}
85
+
86
+ ### Task Completed
87
+ [{current_task_id}] {current_task_description}
88
+
89
+ ### Files Changed
90
+ - Created: {files_created}
91
+ - Modified: {files_modified}
92
+
93
+ ### Learnings
94
+ {What was learned during this task}
95
+ {Any issues encountered and how they were resolved}
96
+ {Patterns discovered that might help future tasks}
97
+
98
+ ### Context for Next Task
99
+ {What the next iteration should know}
100
+ ```
101
+
102
+ ### 5. Verify Commit
103
+
104
+ **Check commit was created:**
105
+
106
+ ```bash
107
+ git log -1 --oneline
108
+ ```
109
+
110
+ **Expected output:**
111
+ ```
112
+ abc1234 feat(ralph): {current_task_description}
113
+ ```
114
+
115
+ ### 6. Log Activity (if verbose)
116
+
117
+ **If {verbose_mode} = true:**
118
+
119
+ Append to `.ralph/logs/{date}.log`:
120
+ ```
121
+ [{timestamp}] TASK COMPLETED
122
+ Task: [{current_task_id}] {current_task_description}
123
+ Commit: {commit_hash}
124
+ Files: {file_count} changed
125
+ Iteration: {current_iteration}
126
+ ```
127
+
128
+ ---
129
+
130
+ ## OUTPUT FORMAT:
131
+
132
+ ```
133
+ Changes Committed:
134
+
135
+ | Field | Value |
136
+ |-------|-------|
137
+ | Commit | {commit_hash} |
138
+ | Task | [{current_task_id}] ✅ |
139
+ | Iteration | {current_iteration} |
140
+ | Files | {file_count} changed |
141
+
142
+ prd.json: Updated task {current_task_id} to passes: true
143
+ progress.txt: Added iteration {current_iteration} learnings
144
+
145
+ -> Checking completion...
146
+ ```
147
+
148
+ ---
149
+
150
+ ## ERROR HANDLING:
151
+
152
+ **If commit fails (pre-commit hook):**
153
+
154
+ 1. Read hook error message
155
+ 2. Fix the issue (lint, format, etc.)
156
+ 3. Stage fixes
157
+ 4. Create NEW commit (don't amend)
158
+ 5. Proceed to step-04
159
+
160
+ **If prd.json write fails:**
161
+
162
+ 1. Log error
163
+ 2. Retry write
164
+ 3. If still fails, output error and stop
165
+
166
+ ---
167
+
168
+ ## NEXT STEP:
169
+
170
+ After commit and updates complete, proceed to `./step-04-check.md`
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: step-04-check
3
+ description: Check completion criteria and decide next action
4
+ next_step: steps/step-05-report.md OR steps/step-01-task.md
5
+ ---
6
+
7
+ # Step 4: Check Completion
8
+
9
+ ## YOUR TASK:
10
+
11
+ Check if all tasks are complete and decide whether to output completion promise or continue to next task.
12
+
13
+ ---
14
+
15
+ ## EXECUTION SEQUENCE:
16
+
17
+ ### 1. Read Current State
18
+
19
+ **Load prd.json:**
20
+
21
+ ```javascript
22
+ const prd = readJSON('.ralph/prd.json');
23
+ const tasksCompleted = prd.tasks.filter(t => t.passes).length;
24
+ const tasksTotal = prd.tasks.length;
25
+ const allComplete = tasksCompleted === tasksTotal;
26
+ ```
27
+
28
+ ### 2. Check Iteration Limit
29
+
30
+ **If {current_iteration} >= {max_iterations}:**
31
+
32
+ ```
33
+ ╔══════════════════════════════════════════════════════════════════╗
34
+ ║ ⚠️ MAX ITERATIONS REACHED ║
35
+ ╠══════════════════════════════════════════════════════════════════╣
36
+ ║ Iterations: {current_iteration} / {max_iterations} ║
37
+ ║ Tasks: {tasksCompleted} / {tasksTotal} complete ║
38
+ ╠══════════════════════════════════════════════════════════════════╣
39
+ ║ Ralph loop stopped due to iteration limit. ║
40
+ ║ Remaining tasks: ║
41
+ ║ {list of tasks with passes: false} ║
42
+ ╚══════════════════════════════════════════════════════════════════╝
43
+
44
+ -> Generating partial report...
45
+ ```
46
+
47
+ **Proceed to step-05-report.md**
48
+
49
+ ### 3. Check All Tasks Complete
50
+
51
+ **If allComplete = true:**
52
+
53
+ ```
54
+ ╔══════════════════════════════════════════════════════════════════╗
55
+ ║ ✅ ALL TASKS COMPLETE ║
56
+ ╠══════════════════════════════════════════════════════════════════╣
57
+ ║ Iterations: {current_iteration} ║
58
+ ║ Tasks: {tasksTotal} / {tasksTotal} complete ║
59
+ ╠══════════════════════════════════════════════════════════════════╣
60
+ ║ Output completion promise: ║
61
+ ║ <promise>{completion_promise}</promise> ║
62
+ ╚══════════════════════════════════════════════════════════════════╝
63
+
64
+ <promise>{completion_promise}</promise>
65
+ ```
66
+
67
+ **CRITICAL: Output the promise tag exactly as shown:**
68
+ ```
69
+ <promise>{completion_promise}</promise>
70
+ ```
71
+
72
+ **Proceed to step-05-report.md**
73
+
74
+ ### 4. More Tasks Remaining
75
+
76
+ **If allComplete = false AND iteration < max_iterations:**
77
+
78
+ ```
79
+ Progress: {tasksCompleted} / {tasksTotal} tasks
80
+
81
+ Next task:
82
+ [{next_task_id}] {next_task_description}
83
+
84
+ Continuing to next iteration...
85
+ ```
86
+
87
+ **Loop back to step-01-task.md**
88
+
89
+ ---
90
+
91
+ ## DECISION TREE:
92
+
93
+ ```
94
+ ┌─────────────────────┐
95
+ │ Check Completion │
96
+ └──────────┬──────────┘
97
+
98
+ ┌────────────────┼────────────────┐
99
+ │ │ │
100
+ ▼ ▼ ▼
101
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
102
+ │ Max Iters │ │ All Tasks │ │ Tasks │
103
+ │ Reached │ │ Complete │ │ Remaining │
104
+ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘
105
+ │ │ │
106
+ ▼ ▼ ▼
107
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
108
+ │ Partial │ │ Output │ │ Loop to │
109
+ │ Report │ │ Promise │ │ step-01 │
110
+ │ step-05 │ │ step-05 │ │ │
111
+ └──────────────┘ └──────────────┘ └──────────────┘
112
+ ```
113
+
114
+ ---
115
+
116
+ ## OUTPUT FORMAT:
117
+
118
+ **If continuing:**
119
+ ```
120
+ Completion Check:
121
+
122
+ | Field | Value |
123
+ |-------|-------|
124
+ | Iteration | {current_iteration} / {max_iterations} |
125
+ | Tasks | {tasksCompleted} / {tasksTotal} |
126
+ | Status | Continuing |
127
+ | Next | [{next_task_id}] {next_task_description} |
128
+
129
+ -> Loading next task...
130
+ ```
131
+
132
+ **If complete:**
133
+ ```
134
+ Completion Check:
135
+
136
+ | Field | Value |
137
+ |-------|-------|
138
+ | Iteration | {current_iteration} |
139
+ | Tasks | {tasksTotal} / {tasksTotal} |
140
+ | Status | COMPLETE |
141
+
142
+ <promise>{completion_promise}</promise>
143
+
144
+ -> Generating report...
145
+ ```
146
+
147
+ ---
148
+
149
+ ## CRITICAL RULE:
150
+
151
+ **NEVER output the completion promise unless:**
152
+ 1. ALL tasks have `passes: true`
153
+ 2. The statement is genuinely true
154
+
155
+ **False promises to escape the loop are FORBIDDEN.**
156
+
157
+ ---
158
+
159
+ ## NEXT STEP:
160
+
161
+ - If complete or max iterations: `./step-05-report.md`
162
+ - If tasks remaining: `./step-01-task.md`