@atlashub/smartstack-cli 3.8.0 → 3.9.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 (120) hide show
  1. package/dist/index.js +365 -2
  2. package/dist/index.js.map +1 -1
  3. package/package.json +2 -1
  4. package/templates/agents/action.md +1 -0
  5. package/templates/agents/ba-writer.md +33 -0
  6. package/templates/agents/explore-codebase.md +1 -0
  7. package/templates/agents/explore-docs.md +1 -0
  8. package/templates/agents/fix-grammar.md +1 -0
  9. package/templates/agents/snipper.md +1 -0
  10. package/templates/skills/admin/SKILL.md +6 -0
  11. package/templates/skills/ai-prompt/SKILL.md +32 -136
  12. package/templates/skills/ai-prompt/steps/step-01-implementation.md +122 -0
  13. package/templates/skills/apex/SKILL.md +120 -0
  14. package/templates/skills/apex/_shared.md +86 -0
  15. package/templates/skills/apex/references/agent-teams-protocol.md +164 -0
  16. package/templates/skills/apex/references/smartstack-layers.md +173 -0
  17. package/templates/skills/apex/steps/step-00-init.md +156 -0
  18. package/templates/skills/apex/steps/step-01-analyze.md +169 -0
  19. package/templates/skills/apex/steps/step-02-plan.md +160 -0
  20. package/templates/skills/apex/steps/step-03-execute.md +166 -0
  21. package/templates/skills/apex/steps/step-04-validate.md +138 -0
  22. package/templates/skills/apex/steps/step-05-examine.md +124 -0
  23. package/templates/skills/apex/steps/step-06-resolve.md +105 -0
  24. package/templates/skills/apex/steps/step-07-tests.md +130 -0
  25. package/templates/skills/apex/steps/step-08-run-tests.md +115 -0
  26. package/templates/skills/application/SKILL.md +10 -0
  27. package/templates/skills/application/references/backend-controller-hierarchy.md +58 -0
  28. package/templates/skills/application/references/backend-entity-seeding.md +72 -0
  29. package/templates/skills/application/references/backend-verification.md +88 -0
  30. package/templates/skills/application/references/frontend-verification.md +111 -0
  31. package/templates/skills/application/references/nav-fallback-procedure.md +200 -0
  32. package/templates/skills/application/references/provider-template.md +134 -0
  33. package/templates/skills/application/references/test-frontend.md +73 -0
  34. package/templates/skills/application/references/test-prerequisites.md +72 -0
  35. package/templates/skills/application/steps/step-01-navigation.md +7 -198
  36. package/templates/skills/application/steps/step-03b-provider.md +4 -128
  37. package/templates/skills/application/steps/step-04-backend.md +20 -350
  38. package/templates/skills/application/steps/step-05-frontend.md +12 -101
  39. package/templates/skills/application/steps/step-07-tests.md +12 -132
  40. package/templates/skills/business-analyse/SKILL.md +11 -2
  41. package/templates/skills/business-analyse/html/ba-interactive.html +176 -14
  42. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +1 -0
  43. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +16 -4
  44. package/templates/skills/business-analyse/html/src/scripts/06-render-consolidation.js +7 -2
  45. package/templates/skills/business-analyse/html/src/scripts/09-export.js +103 -0
  46. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +12 -6
  47. package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +24 -2
  48. package/templates/skills/business-analyse/html/src/styles/08-review-panel.css +12 -0
  49. package/templates/skills/business-analyse/html/src/template.html +1 -0
  50. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +78 -0
  51. package/templates/skills/business-analyse/references/cadrage-vibe-coding.md +97 -0
  52. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +92 -0
  53. package/templates/skills/business-analyse/references/deploy-data-build.md +121 -0
  54. package/templates/skills/business-analyse/references/deploy-modes.md +49 -0
  55. package/templates/skills/business-analyse/references/handoff-file-templates.md +119 -0
  56. package/templates/skills/business-analyse/references/handoff-mappings.md +81 -0
  57. package/templates/skills/business-analyse/references/html-data-mapping.md +10 -2
  58. package/templates/skills/business-analyse/references/init-schema-deployment.md +65 -0
  59. package/templates/skills/business-analyse/references/review-data-mapping.md +363 -0
  60. package/templates/skills/business-analyse/references/spec-auto-inference.md +57 -0
  61. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +85 -0
  62. package/templates/skills/business-analyse/references/ui-resource-cards.md +110 -0
  63. package/templates/skills/business-analyse/references/validate-incremental-html.md +55 -0
  64. package/templates/skills/business-analyse/steps/step-00-init.md +35 -68
  65. package/templates/skills/business-analyse/steps/step-01-cadrage.md +5 -194
  66. package/templates/skills/business-analyse/steps/step-03a-data.md +6 -49
  67. package/templates/skills/business-analyse/steps/step-03b-ui.md +12 -178
  68. package/templates/skills/business-analyse/steps/step-03d-validate.md +3 -48
  69. package/templates/skills/business-analyse/steps/step-04-consolidation.md +9 -104
  70. package/templates/skills/business-analyse/steps/step-05a-handoff.md +25 -441
  71. package/templates/skills/business-analyse/steps/step-05b-deploy.md +19 -187
  72. package/templates/skills/business-analyse/steps/step-06-review.md +277 -0
  73. package/templates/skills/cc-agent/references/agent-behavior-patterns.md +95 -0
  74. package/templates/skills/cc-agent/steps/step-02-generate.md +5 -78
  75. package/templates/skills/check-version/SKILL.md +7 -0
  76. package/templates/skills/controller/references/controller-code-templates.md +159 -0
  77. package/templates/skills/controller/references/permission-sync-templates.md +152 -0
  78. package/templates/skills/controller/steps/step-03-generate.md +6 -158
  79. package/templates/skills/controller/steps/step-04-perms.md +5 -144
  80. package/templates/skills/debug/SKILL.md +7 -0
  81. package/templates/skills/explore/SKILL.md +6 -0
  82. package/templates/skills/feature-full/SKILL.md +39 -142
  83. package/templates/skills/feature-full/steps/step-01-implementation.md +120 -0
  84. package/templates/skills/gitflow/references/init-config-template.md +135 -0
  85. package/templates/skills/gitflow/references/init-name-normalization.md +103 -0
  86. package/templates/skills/gitflow/references/plan-template.md +69 -0
  87. package/templates/skills/gitflow/references/start-efcore-preflight.md +70 -0
  88. package/templates/skills/gitflow/references/start-local-config.md +110 -0
  89. package/templates/skills/gitflow/steps/step-init.md +18 -289
  90. package/templates/skills/gitflow/steps/step-plan.md +6 -63
  91. package/templates/skills/gitflow/steps/step-start.md +16 -126
  92. package/templates/skills/mcp/SKILL.md +9 -213
  93. package/templates/skills/mcp/steps/step-01-healthcheck.md +108 -0
  94. package/templates/skills/mcp/steps/step-02-tools.md +73 -0
  95. package/templates/skills/notification/SKILL.md +7 -0
  96. package/templates/skills/quick-search/SKILL.md +5 -0
  97. package/templates/skills/ralph-loop/SKILL.md +99 -381
  98. package/templates/skills/ralph-loop/references/category-rules.md +259 -0
  99. package/templates/skills/ralph-loop/references/compact-loop.md +182 -0
  100. package/templates/skills/ralph-loop/references/task-transform-legacy.md +259 -0
  101. package/templates/skills/ralph-loop/references/team-orchestration.md +189 -0
  102. package/templates/skills/ralph-loop/steps/step-00-init.md +111 -383
  103. package/templates/skills/ralph-loop/steps/step-01-task.md +79 -896
  104. package/templates/skills/ralph-loop/steps/step-02-execute.md +68 -680
  105. package/templates/skills/ralph-loop/steps/step-03-commit.md +47 -277
  106. package/templates/skills/ralph-loop/steps/step-04-check.md +124 -607
  107. package/templates/skills/ralph-loop/steps/step-05-report.md +68 -367
  108. package/templates/skills/refactor/SKILL.md +12 -176
  109. package/templates/skills/refactor/steps/step-01-discover.md +60 -0
  110. package/templates/skills/refactor/steps/step-02-execute.md +67 -0
  111. package/templates/skills/review-code/SKILL.md +19 -257
  112. package/templates/skills/review-code/steps/step-01-smartstack.md +96 -0
  113. package/templates/skills/review-code/steps/step-02-detailed-review.md +80 -0
  114. package/templates/skills/review-code/steps/step-03-react.md +44 -0
  115. package/templates/skills/ui-components/SKILL.md +7 -0
  116. package/templates/skills/utils/SKILL.md +6 -0
  117. package/templates/skills/validate/SKILL.md +6 -0
  118. package/templates/skills/validate-feature/SKILL.md +8 -0
  119. package/templates/skills/workflow/SKILL.md +40 -118
  120. package/templates/skills/workflow/steps/step-01-implementation.md +84 -0
@@ -0,0 +1,259 @@
1
+ # Category Execution Rules
2
+
3
+ > **Loaded by:** step-02 (first iteration) and compact-loop.md (subsequent iterations)
4
+ > **Purpose:** Defines execution rules, MCP tools, folder paths, and forbidden patterns per task category.
5
+
6
+ ---
7
+
8
+ ## Domain
9
+
10
+ **Folder:** `Domain/Entities/{ContextPascal}/{App}/{Module}/`
11
+ **Enums:** `Domain/Enums/{ContextPascal}/{App}/{Module}/`
12
+ **Exceptions:** `Domain/Exceptions/{ContextPascal}/{App}/{Module}/`
13
+ **MCP:** `validate_conventions`
14
+
15
+ Rules:
16
+ - Entity base class inheritance (AuditableEntity, IHasData, ISoftDeletable)
17
+ - Audit fields: CreatedAt, CreatedBy, ModifiedAt, ModifiedBy
18
+ - Domain events for state changes
19
+ - Value objects for composite values
20
+
21
+ ---
22
+
23
+ ## Infrastructure — EF Core Configurations
24
+
25
+ **Folder:** `Infrastructure/Persistence/Configurations/{ContextPascal}/{App}/{Module}/`
26
+ **MCP:** `validate_conventions`, `check_migrations`
27
+
28
+ Rules:
29
+ - One configuration per entity
30
+ - Table name = plural entity name
31
+ - All relationships explicitly configured (no convention-based)
32
+ - Indexes on foreign keys and frequently queried fields
33
+ - Register DbSet in ExtensionsDbContext
34
+
35
+ ---
36
+
37
+ ## Infrastructure — Migration (BLOCKING)
38
+
39
+ > **CRITICAL:** After EF configs, a migration MUST be created and applied.
40
+ > Without migrations, no database schema = no tests = no API = broken module.
41
+
42
+ **Folder:** `Infrastructure/Persistence/Migrations/` (NEVER subdirectories)
43
+ **MCP:** `suggest_migration` → get migration name
44
+
45
+ Execution sequence:
46
+ 1. Call `mcp__smartstack__suggest_migration` → get standardized name
47
+ 2. `dotnet ef migrations add {Name} --project src/{Infra}.csproj --startup-project src/{Api}.csproj -o Persistence/Migrations`
48
+ 3. `dotnet ef database update --project src/{Infra}.csproj --startup-project src/{Api}.csproj`
49
+ 4. `dotnet build --no-restore` → verify build passes
50
+
51
+ **BLOCKING:** If migration fails, DO NOT proceed. Fix the EF configs first.
52
+
53
+ **Rules:**
54
+ - NEVER create subdirectories under Migrations/
55
+ - Always use `-o Persistence/Migrations` flag
56
+ - One migration per module (all entities together)
57
+ - Migration name from MCP (NEVER invented)
58
+
59
+ ---
60
+
61
+ ## Infrastructure — Seed Data (MANDATORY reference loading)
62
+
63
+ **Folder:** `Infrastructure/Persistence/Seeding/Data/{Module}/`
64
+ **MCP:** `generate_permissions` (PRIMARY), fallback to templates
65
+
66
+ > **IF** task description contains "seed data", "SeedData", "NavigationModule",
67
+ > "PermissionsSeedData", "RolesSeedData", or "IClientSeedDataProvider":
68
+ > **THEN read `references/core-seed-data.md`** — this is MANDATORY, DO NOT improvise.
69
+
70
+ **Rules:**
71
+ - NavigationModuleSeedData.cs: deterministic GUIDs (SHA256), 4 languages (fr, en, it, de)
72
+ - PermissionsSeedData.cs: MCP `generate_permissions` first, fallback to template
73
+ - RolesSeedData.cs: context-based role mapping (Admin=CRUD, Manager=CRU, Contributor=CR, Viewer=R)
74
+ - SeedConstants.cs: shared deterministic GUIDs
75
+ - IClientSeedDataProvider: SeedNavigationAsync + SeedPermissionsAsync + SeedRolePermissionsAsync
76
+ - DI: `services.AddScoped<IClientSeedDataProvider, {AppPascalName}SeedDataProvider>()`
77
+
78
+ **FORBIDDEN:**
79
+ - `Guid.NewGuid()` → use deterministic GUIDs
80
+ - Empty seed data classes with only GUIDs and no seeding methods
81
+ - Missing translations (must have all 4 languages)
82
+
83
+ ---
84
+
85
+ ## Infrastructure — SQL Objects
86
+
87
+ **Folder:** `Infrastructure/Persistence/SqlObjects/Functions/`
88
+
89
+ Rules:
90
+ - `.sql` files with `CREATE OR ALTER` for idempotency
91
+ - `SqlObjectHelper.cs` for embedded resource loading
92
+
93
+ ---
94
+
95
+ ## Post-Infrastructure Build Check (BLOCKING)
96
+
97
+ > **After ALL infrastructure tasks (configs + migration + seed data) are done:**
98
+
99
+ ```bash
100
+ dotnet build --no-restore
101
+ ```
102
+
103
+ **BLOCKING:** Build MUST pass before proceeding to application/api/test/frontend.
104
+ If build fails, fix infrastructure code first.
105
+
106
+ ---
107
+
108
+ ## Application
109
+
110
+ **Services:** `Application/Services/{ContextPascal}/{App}/{Module}/`
111
+ **DTOs:** `Application/DTOs/{ContextPascal}/{App}/{Module}/`
112
+ **Validators:** `Application/Validators/{ContextPascal}/{App}/{Module}/`
113
+ **MCP:** `validate_conventions`, `scaffold_extension`
114
+
115
+ Rules:
116
+ - CQRS pattern with MediatR
117
+ - FluentValidation for all commands
118
+ - DTOs separate from domain entities
119
+ - Service interfaces in Application, implementations in Infrastructure
120
+
121
+ ---
122
+
123
+ ## API
124
+
125
+ **Controllers:** `Api/Controllers/{ContextShort}/{App}/{Entity}Controller.cs`
126
+ **MCP:** `scaffold_routes`, `validate_security`
127
+
128
+ **Context-to-folder mapping (`{ContextShort}`):**
129
+
130
+ | NavRoute Prefix | Controller Folder |
131
+ |-----------------|-------------------|
132
+ | `platform.administration` | `Admin` |
133
+ | `platform.support` | `Support` |
134
+ | `business.*` | `Business` |
135
+ | `personal.*` | `User` |
136
+
137
+ **Rules:**
138
+ - `[RequirePermission(Permissions.{Module}.{Action})]` on EVERY endpoint (NOT `[Authorize]`)
139
+ - Swagger XML documentation
140
+ - Consistent route patterns: `api/{context}/{app}/{module}`
141
+ - Return DTOs, never domain entities
142
+
143
+ **FORBIDDEN:**
144
+ - `[Authorize]` without specific permission → use `[RequirePermission]`
145
+ - Returning domain entities directly
146
+
147
+ ---
148
+
149
+ ## Frontend (MCP-FIRST PROTOCOL)
150
+
151
+ > **CRITICAL:** Frontend code is generated via MCP tools, NOT written from scratch.
152
+
153
+ **Page hierarchy:** `src/pages/{ContextPascal}/{AppPascal}/{Module}/{Page}.tsx`
154
+ **FORBIDDEN:** `src/pages/{Module}/` (flat structure without Context/App)
155
+
156
+ **Execution sequence (IN ORDER):**
157
+ 1. `mcp__smartstack__scaffold_api_client` → API client + types + React Query hook
158
+ 2. `mcp__smartstack__scaffold_routes` → routes inside correct Layout wrapper
159
+ 3. Create pages using SmartStack components
160
+ 4. Create preferences hook: `use{Module}Preferences.ts`
161
+ 5. Generate i18n (4 languages: fr, en, it, de)
162
+ 6. `npm run typecheck` MUST pass (BLOCKING)
163
+
164
+ **Components:**
165
+ - Lists: `SmartTable` + `SmartFilter` (NOT HTML `<table>`)
166
+ - Grids: `EntityCard` (NOT custom `<div>` cards)
167
+ - Detail: `EntityDetailCard`, `StatusBadge`, tab layout
168
+ - Forms: `SmartForm` with FluentValidation-backed fields
169
+ - Dashboard: `StatCard`, Recharts components
170
+
171
+ **Layout wrapper mapping:**
172
+
173
+ | Context | Layout | Route path |
174
+ |---------|--------|------------|
175
+ | `platform.*` | `AdminLayout` | `/platform` |
176
+ | `business.*` | `BusinessLayout` | `/business` |
177
+ | `personal.*` | `UserLayout` | `/personal/myspace` |
178
+
179
+ **CSS:** Variables ONLY → `bg-[var(--bg-card)]`, `text-[var(--text-primary)]`
180
+
181
+ **FORBIDDEN patterns (any = FAIL):**
182
+ ```
183
+ import axios from 'axios' → use @/services/api/apiClient
184
+ <table>...</table> → use SmartTable
185
+ <div className="bg-blue-600"> → use bg-[var(--color-accent-600)]
186
+ <Route path="/business/app/mod" /> → MUST be nested inside Layout
187
+ Only fr/en translations → MUST have 4 languages
188
+ src/pages/{Module}/ → MUST be src/pages/{Context}/{App}/{Module}/
189
+ ```
190
+
191
+ ---
192
+
193
+ ## I18n
194
+
195
+ **Rules:**
196
+ - 4 JSON files: fr, en, it, de
197
+ - Identical key structures across all languages
198
+ - All UI labels, validation messages, button text, empty states
199
+ - Depends on frontend task completion
200
+
201
+ ---
202
+
203
+ ## Test (BLOCKING)
204
+
205
+ **MCP:** `scaffold_tests`, `analyze_test_coverage`
206
+
207
+ **Execution sequence:**
208
+
209
+ 1. **Ensure test project exists:**
210
+ ```bash
211
+ TEST_PROJECT="tests/${PROJECT_NAME}.Tests.Unit"
212
+ if [ ! -d "$TEST_PROJECT" ]; then
213
+ dotnet new xunit -n "${PROJECT_NAME}.Tests.Unit" -o "$TEST_PROJECT"
214
+ dotnet add "$TEST_PROJECT" package Moq
215
+ dotnet add "$TEST_PROJECT" package FluentAssertions
216
+ for proj in src/*/*.csproj; do dotnet add "$TEST_PROJECT" reference "$proj"; done
217
+ dotnet sln add "$TEST_PROJECT/${PROJECT_NAME}.Tests.Unit.csproj"
218
+ fi
219
+ ```
220
+
221
+ 2. **Generate tests via MCP** (NOT manually):
222
+ - Domain: `scaffold_tests` with target_layer="domain"
223
+ - Service: `scaffold_tests` with target_layer="application"
224
+ - Controller: `scaffold_tests` with target_layer="api", test_type="integration"
225
+ - Security: `scaffold_tests` with test_type="security"
226
+
227
+ 3. **Run tests (BLOCKING):**
228
+ ```bash
229
+ dotnet build "$TEST_PROJECT" --no-restore
230
+ dotnet test "$TEST_PROJECT" --no-build --verbosity normal
231
+ ```
232
+
233
+ 4. **Fix loop:** If tests fail → analyze → fix code (NOT tests) → rebuild → retest → loop until 100% pass
234
+
235
+ 5. **Coverage check:** `analyze_test_coverage` → must be >= 80%
236
+
237
+ **Completion criteria (ALL required):**
238
+ - Test project exists
239
+ - Tests generated via MCP
240
+ - `dotnet test` exits 0 (all pass)
241
+ - Coverage >= 80%
242
+ - No `[Fact(Skip = "...")]`
243
+
244
+ ---
245
+
246
+ ## Validation (FINAL — BLOCKING)
247
+
248
+ **Execution sequence:**
249
+
250
+ 1. `dotnet clean && dotnet restore && dotnet build` → MUST pass
251
+ 2. `dotnet test` (full suite) → MUST pass
252
+ 3. `mcp__smartstack__validate_conventions` → 0 errors
253
+ 4. Generate validation report in progress.txt
254
+
255
+ **Completion criteria:**
256
+ - Build exit code 0
257
+ - Test exit code 0
258
+ - MCP validation 0 errors
259
+ - Production ready = true
@@ -0,0 +1,182 @@
1
+ # Compact Loop — Inline Execution
2
+
3
+ > **Loaded by:** step-04 section 5 (after first full iteration)
4
+ > **Purpose:** Execute all subsequent iterations inline without re-reading step files.
5
+ > **Rule:** NEVER stop the loop. NEVER wait for user input. NEVER re-read step files.
6
+
7
+ ---
8
+
9
+ ## Loop Entry
10
+
11
+ Display compact progress:
12
+ ```
13
+ [{iteration}/{max}] {completed}/{total} done | Finding eligible tasks...
14
+ ```
15
+
16
+ ---
17
+
18
+ ## A. Find Eligible Tasks
19
+
20
+ ```javascript
21
+ const prd = readJSON('.ralph/prd.json');
22
+
23
+ // Block tasks whose dependencies failed
24
+ for (const task of prd.tasks) {
25
+ if (task.status !== 'pending') continue;
26
+ const depsBlocked = task.dependencies.some(depId => {
27
+ const dep = prd.tasks.find(t => t.id === depId);
28
+ return dep && (dep.status === 'failed' || dep.status === 'blocked');
29
+ });
30
+ if (depsBlocked) { task.status = 'blocked'; task.error = 'Blocked by failed dependency'; }
31
+ }
32
+
33
+ // Find ALL eligible tasks (dependencies met)
34
+ const eligible = prd.tasks.filter(task => {
35
+ if (task.status !== 'pending') return false;
36
+ return task.dependencies.every(depId => {
37
+ const dep = prd.tasks.find(t => t.id === depId);
38
+ return dep && dep.status === 'completed';
39
+ });
40
+ });
41
+
42
+ if (eligible.length === 0) {
43
+ // Dead-end or all done — return to step-04 sections 2-4
44
+ goto CHECK_COMPLETION;
45
+ }
46
+
47
+ // BATCH: group by category, take first group (max 5)
48
+ const firstCategory = eligible[0].category;
49
+ const batch = eligible.filter(t => t.category === firstCategory).slice(0, 5);
50
+ ```
51
+
52
+ Display:
53
+ ```
54
+ Batch: {batch.length} [{firstCategory}] → {batch.map(t => `[${t.id}] ${t.description.substring(0, 60)}`).join(' | ')}
55
+ ```
56
+
57
+ ---
58
+
59
+ ## B. Execute Batch
60
+
61
+ **For EACH task in batch:**
62
+
63
+ 1. Mark `task.status = 'in_progress'`, `task.started_at = now`
64
+ 2. **Read `references/category-rules.md`** for category-specific rules
65
+ 3. Implement the task following SmartStack conventions
66
+ 4. Track `files_created` and `files_modified`
67
+
68
+ **Execution cycle per task:**
69
+ 1. Generate code following category-rules.md
70
+ 2. **BUILD verification (BLOCKING per task):**
71
+ - Backend (domain/infra/app/api): `dotnet build --no-restore` → MUST exit 0
72
+ - Frontend: `npm run typecheck` → MUST exit 0
73
+ 3. If build fails → read FULL error output → fix source code → rebuild → loop until pass
74
+ 4. Verify acceptance criteria
75
+ 5. If failed after 3 attempts: `task.status = 'failed'`, `task.error = reason`, continue to next in batch
76
+
77
+ **Category-specific triggers:**
78
+
79
+ | Category | Action |
80
+ |----------|--------|
81
+ | `infrastructure` with `_migrationMeta` | Migration sequence: `suggest_migration` MCP → `dotnet ef migrations add` → `dotnet ef database update` → `dotnet build` |
82
+ | `infrastructure` with seed data keywords | **MANDATORY:** Read `references/core-seed-data.md` → implement templates → `dotnet build` |
83
+ | `frontend` | MCP-first: `scaffold_api_client` → `scaffold_routes` → create pages → `npm run typecheck && npm run lint` |
84
+ | `test` | **Create tests:** `scaffold_tests` MCP → **Run:** `dotnet test --verbosity normal` → **Fix loop:** if fail → fix SOURCE CODE → rebuild → retest → repeat until 100% pass |
85
+ | `validation` | `dotnet clean && dotnet restore && dotnet build` → `dotnet test` (full) → `validate_conventions` MCP |
86
+
87
+ **Post-batch verification (BLOCKING — ALL must pass before commit):**
88
+
89
+ 1. **Backend build:**
90
+ ```bash
91
+ dotnet build --no-restore
92
+ ```
93
+ If FAIL → fix → rebuild → DO NOT commit until exit 0
94
+
95
+ 2. **Tests (if test tasks in batch OR after infrastructure batch):**
96
+ ```bash
97
+ TEST_PROJECT="tests/$(basename $(pwd)).Tests.Unit"
98
+ dotnet test "$TEST_PROJECT" --no-build --verbosity normal
99
+ ```
100
+ If FAIL → fix source code (NOT tests) → rebuild → retest → loop until 100% pass
101
+
102
+ 3. **Frontend (if frontend/i18n tasks in batch):**
103
+ ```bash
104
+ npm run typecheck && npm run lint
105
+ ```
106
+ If FAIL → fix → re-check → loop until pass
107
+
108
+ 4. **MCP validation:**
109
+ `mcp__smartstack__validate_conventions` ONCE for the whole batch
110
+
111
+ **Error resolution cycle:**
112
+ 1. Read the FULL error output (not just first line)
113
+ 2. Identify root cause: file path + line number
114
+ 3. Fix the issue in source code
115
+ 4. Rebuild/retest
116
+ 5. If still failing → repeat from step 1
117
+ 6. **NEVER** commit with failing build or tests
118
+
119
+ ---
120
+
121
+ ## C. Commit Batch
122
+
123
+ ```bash
124
+ # Stage all changed files from batch
125
+ git add {all_files_from_batch}
126
+ git add .ralph/prd.json
127
+
128
+ git commit -m "$(cat <<'EOF'
129
+ feat({scope}): [{category}] {batch.length} tasks — {short summary}
130
+
131
+ Tasks: {task_ids} / {total}
132
+ Iteration: {iteration}
133
+ {module ? "Module: " + module : ""}
134
+
135
+ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
136
+ EOF
137
+ )"
138
+
139
+ COMMIT_HASH=$(git rev-parse --short HEAD)
140
+ ```
141
+
142
+ **Finalize tasks in prd.json:**
143
+ ```javascript
144
+ const now = new Date().toISOString();
145
+ for (const task of batch) {
146
+ if (task.status !== 'failed') task.status = 'completed';
147
+ task.completed_at = now;
148
+ task.iteration = prd.config.current_iteration;
149
+ task.commit_hash = COMMIT_HASH;
150
+ }
151
+ prd.history.push({
152
+ iteration: prd.config.current_iteration,
153
+ task_ids: batch.map(t => t.id),
154
+ action: 'batch-completed',
155
+ timestamp: now,
156
+ commit_hash: COMMIT_HASH,
157
+ notes: "{summary}"
158
+ });
159
+ prd.config.current_iteration++;
160
+ prd.updated_at = now;
161
+ writeJSON('.ralph/prd.json', prd);
162
+ ```
163
+
164
+ **Commit progress:**
165
+ ```bash
166
+ git add .ralph/prd.json .ralph/progress.txt
167
+ [ -f .ralph/modules-queue.json ] && git add .ralph/modules-queue.json
168
+ git commit -m "chore(ralph): progress — iteration {iteration}"
169
+ ```
170
+
171
+ ---
172
+
173
+ ## D. Loop Back
174
+
175
+ **IMMEDIATELY return to step-04 section 1 (Read Current State).**
176
+ DO NOT stop. DO NOT wait for user. DO NOT re-read step files.
177
+
178
+ The only exit conditions:
179
+ - ALL tasks complete (all modules if multi-module)
180
+ - Max iterations reached
181
+ - Dead-end (all remaining blocked/failed)
182
+ - User Ctrl+C