@atlashub/smartstack-cli 3.7.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.
- package/dist/index.js +365 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/templates/agents/action.md +1 -0
- package/templates/agents/ba-writer.md +33 -0
- package/templates/agents/explore-codebase.md +1 -0
- package/templates/agents/explore-docs.md +1 -0
- package/templates/agents/fix-grammar.md +1 -0
- package/templates/agents/snipper.md +1 -0
- package/templates/skills/admin/SKILL.md +6 -0
- package/templates/skills/ai-prompt/SKILL.md +32 -136
- package/templates/skills/ai-prompt/steps/step-01-implementation.md +122 -0
- package/templates/skills/apex/SKILL.md +120 -0
- package/templates/skills/apex/_shared.md +86 -0
- package/templates/skills/apex/references/agent-teams-protocol.md +164 -0
- package/templates/skills/apex/references/smartstack-layers.md +173 -0
- package/templates/skills/apex/steps/step-00-init.md +156 -0
- package/templates/skills/apex/steps/step-01-analyze.md +169 -0
- package/templates/skills/apex/steps/step-02-plan.md +160 -0
- package/templates/skills/apex/steps/step-03-execute.md +166 -0
- package/templates/skills/apex/steps/step-04-validate.md +138 -0
- package/templates/skills/apex/steps/step-05-examine.md +124 -0
- package/templates/skills/apex/steps/step-06-resolve.md +105 -0
- package/templates/skills/apex/steps/step-07-tests.md +130 -0
- package/templates/skills/apex/steps/step-08-run-tests.md +115 -0
- package/templates/skills/application/SKILL.md +10 -0
- package/templates/skills/application/references/backend-controller-hierarchy.md +58 -0
- package/templates/skills/application/references/backend-entity-seeding.md +72 -0
- package/templates/skills/application/references/backend-verification.md +88 -0
- package/templates/skills/application/references/frontend-verification.md +111 -0
- package/templates/skills/application/references/nav-fallback-procedure.md +200 -0
- package/templates/skills/application/references/provider-template.md +134 -0
- package/templates/skills/application/references/test-frontend.md +73 -0
- package/templates/skills/application/references/test-prerequisites.md +72 -0
- package/templates/skills/application/steps/step-01-navigation.md +7 -198
- package/templates/skills/application/steps/step-03b-provider.md +4 -128
- package/templates/skills/application/steps/step-04-backend.md +20 -350
- package/templates/skills/application/steps/step-05-frontend.md +12 -101
- package/templates/skills/application/steps/step-07-tests.md +12 -132
- package/templates/skills/business-analyse/SKILL.md +11 -2
- package/templates/skills/business-analyse/html/ba-interactive.html +3214 -2246
- package/templates/skills/business-analyse/html/build-html.js +77 -0
- package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +130 -0
- package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +22 -0
- package/templates/skills/business-analyse/html/src/scripts/03-render-cadrage.js +208 -0
- package/templates/skills/business-analyse/html/src/scripts/04-render-modules.js +211 -0
- package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +554 -0
- package/templates/skills/business-analyse/html/src/scripts/06-render-consolidation.js +110 -0
- package/templates/skills/business-analyse/html/src/scripts/07-render-handoff.js +90 -0
- package/templates/skills/business-analyse/html/src/scripts/08-editing.js +45 -0
- package/templates/skills/business-analyse/html/src/scripts/09-export.js +168 -0
- package/templates/skills/business-analyse/html/src/scripts/10-comments.js +171 -0
- package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +161 -0
- package/templates/skills/business-analyse/html/src/styles/01-variables.css +38 -0
- package/templates/skills/business-analyse/html/src/styles/02-layout.css +101 -0
- package/templates/skills/business-analyse/html/src/styles/03-navigation.css +62 -0
- package/templates/skills/business-analyse/html/src/styles/04-cards.css +196 -0
- package/templates/skills/business-analyse/html/src/styles/05-modules.css +325 -0
- package/templates/skills/business-analyse/html/src/styles/06-wireframes.css +230 -0
- package/templates/skills/business-analyse/html/src/styles/07-comments.css +184 -0
- package/templates/skills/business-analyse/html/src/styles/08-review-panel.css +241 -0
- package/templates/skills/business-analyse/html/src/template.html +623 -0
- package/templates/skills/business-analyse/references/cadrage-structure-cards.md +78 -0
- package/templates/skills/business-analyse/references/cadrage-vibe-coding.md +97 -0
- package/templates/skills/business-analyse/references/consolidation-structural-checks.md +92 -0
- package/templates/skills/business-analyse/references/deploy-data-build.md +121 -0
- package/templates/skills/business-analyse/references/deploy-modes.md +49 -0
- package/templates/skills/business-analyse/references/handoff-file-templates.md +119 -0
- package/templates/skills/business-analyse/references/handoff-mappings.md +81 -0
- package/templates/skills/business-analyse/references/html-data-mapping.md +10 -2
- package/templates/skills/business-analyse/references/init-schema-deployment.md +65 -0
- package/templates/skills/business-analyse/references/review-data-mapping.md +363 -0
- package/templates/skills/business-analyse/references/spec-auto-inference.md +57 -0
- package/templates/skills/business-analyse/references/ui-dashboard-spec.md +85 -0
- package/templates/skills/business-analyse/references/ui-resource-cards.md +110 -0
- package/templates/skills/business-analyse/references/validate-incremental-html.md +55 -0
- package/templates/skills/business-analyse/steps/step-00-init.md +35 -68
- package/templates/skills/business-analyse/steps/step-01-cadrage.md +5 -194
- package/templates/skills/business-analyse/steps/step-03a-data.md +6 -49
- package/templates/skills/business-analyse/steps/step-03b-ui.md +12 -178
- package/templates/skills/business-analyse/steps/step-03d-validate.md +3 -48
- package/templates/skills/business-analyse/steps/step-04-consolidation.md +9 -104
- package/templates/skills/business-analyse/steps/step-05a-handoff.md +25 -441
- package/templates/skills/business-analyse/steps/step-05b-deploy.md +19 -187
- package/templates/skills/business-analyse/steps/step-06-review.md +277 -0
- package/templates/skills/cc-agent/references/agent-behavior-patterns.md +95 -0
- package/templates/skills/cc-agent/steps/step-02-generate.md +5 -78
- package/templates/skills/check-version/SKILL.md +7 -0
- package/templates/skills/controller/references/controller-code-templates.md +159 -0
- package/templates/skills/controller/references/permission-sync-templates.md +152 -0
- package/templates/skills/controller/steps/step-03-generate.md +6 -158
- package/templates/skills/controller/steps/step-04-perms.md +5 -144
- package/templates/skills/debug/SKILL.md +7 -0
- package/templates/skills/explore/SKILL.md +6 -0
- package/templates/skills/feature-full/SKILL.md +39 -142
- package/templates/skills/feature-full/steps/step-01-implementation.md +120 -0
- package/templates/skills/gitflow/references/init-config-template.md +135 -0
- package/templates/skills/gitflow/references/init-name-normalization.md +103 -0
- package/templates/skills/gitflow/references/plan-template.md +69 -0
- package/templates/skills/gitflow/references/start-efcore-preflight.md +70 -0
- package/templates/skills/gitflow/references/start-local-config.md +110 -0
- package/templates/skills/gitflow/steps/step-init.md +18 -289
- package/templates/skills/gitflow/steps/step-plan.md +6 -63
- package/templates/skills/gitflow/steps/step-start.md +16 -126
- package/templates/skills/mcp/SKILL.md +9 -213
- package/templates/skills/mcp/steps/step-01-healthcheck.md +108 -0
- package/templates/skills/mcp/steps/step-02-tools.md +73 -0
- package/templates/skills/notification/SKILL.md +7 -0
- package/templates/skills/quick-search/SKILL.md +5 -0
- package/templates/skills/ralph-loop/SKILL.md +99 -381
- package/templates/skills/ralph-loop/references/category-rules.md +259 -0
- package/templates/skills/ralph-loop/references/compact-loop.md +182 -0
- package/templates/skills/ralph-loop/references/task-transform-legacy.md +259 -0
- package/templates/skills/ralph-loop/references/team-orchestration.md +189 -0
- package/templates/skills/ralph-loop/steps/step-00-init.md +111 -383
- package/templates/skills/ralph-loop/steps/step-01-task.md +79 -896
- package/templates/skills/ralph-loop/steps/step-02-execute.md +68 -680
- package/templates/skills/ralph-loop/steps/step-03-commit.md +47 -277
- package/templates/skills/ralph-loop/steps/step-04-check.md +124 -607
- package/templates/skills/ralph-loop/steps/step-05-report.md +68 -367
- package/templates/skills/refactor/SKILL.md +12 -176
- package/templates/skills/refactor/steps/step-01-discover.md +60 -0
- package/templates/skills/refactor/steps/step-02-execute.md +67 -0
- package/templates/skills/review-code/SKILL.md +19 -257
- package/templates/skills/review-code/steps/step-01-smartstack.md +96 -0
- package/templates/skills/review-code/steps/step-02-detailed-review.md +80 -0
- package/templates/skills/review-code/steps/step-03-react.md +44 -0
- package/templates/skills/ui-components/SKILL.md +7 -0
- package/templates/skills/utils/SKILL.md +6 -0
- package/templates/skills/validate/SKILL.md +6 -0
- package/templates/skills/validate-feature/SKILL.md +8 -0
- package/templates/skills/workflow/SKILL.md +40 -118
- 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
|