@atlashub/smartstack-cli 3.36.0 → 3.38.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 +16 -24
- package/dist/index.js.map +1 -1
- package/dist/mcp-entry.mjs +201 -256
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +3 -2
- package/scripts/extract-api-endpoints.ts +325 -0
- package/scripts/extract-business-rules.ts +440 -0
- package/scripts/generate-doc-with-mock-ui.ts +804 -0
- package/scripts/health-check.sh +168 -0
- package/scripts/postinstall.js +18 -0
- package/templates/agents/ba-reader.md +9 -9
- package/templates/agents/ba-writer.md +12 -15
- package/templates/agents/code-reviewer.md +1 -1
- package/templates/agents/docs-context-reader.md +1 -1
- package/templates/agents/gitflow/merge.md +0 -4
- package/templates/agents/gitflow/pr.md +0 -4
- package/templates/agents/gitflow/start.md +30 -5
- package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +20 -20
- package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +16 -24
- package/templates/mcp-scaffolding/migrations/seed-roles.cs.hbs +2 -2
- package/templates/skills/_resources/mcp-validate-documentation-spec.md +3 -3
- package/templates/skills/_shared.md +15 -17
- package/templates/skills/ai-prompt/SKILL.md +1 -1
- package/templates/skills/ai-prompt/steps/step-00-init.md +47 -0
- package/templates/skills/apex/SKILL.md +3 -4
- package/templates/skills/apex/_shared.md +10 -20
- package/templates/skills/apex/references/analysis-methods.md +141 -0
- package/templates/skills/apex/references/challenge-questions.md +1 -21
- package/templates/skills/apex/references/core-seed-data.md +35 -57
- package/templates/skills/apex/references/examine-build-validation.md +87 -0
- package/templates/skills/apex/references/execution-frontend-gates.md +177 -0
- package/templates/skills/apex/references/execution-frontend-patterns.md +105 -0
- package/templates/skills/apex/references/execution-layer1-rules.md +96 -0
- package/templates/skills/apex/references/initialization-challenge-flow.md +110 -0
- package/templates/skills/apex/references/planning-layer-mapping.md +151 -0
- package/templates/skills/apex/references/post-checks.md +145 -40
- package/templates/skills/apex/references/smartstack-api.md +35 -51
- package/templates/skills/apex/references/smartstack-frontend.md +17 -17
- package/templates/skills/apex/references/smartstack-layers.md +38 -62
- package/templates/skills/apex/steps/step-00-init.md +14 -26
- package/templates/skills/apex/steps/step-01-analyze.md +10 -143
- package/templates/skills/apex/steps/step-02-plan.md +10 -92
- package/templates/skills/apex/steps/step-03-execute.md +47 -249
- package/templates/skills/apex/steps/step-04-examine.md +14 -78
- package/templates/skills/apex/steps/step-05-deep-review.md +2 -2
- package/templates/skills/apex/steps/step-08-run-tests.md +2 -0
- package/templates/skills/application/SKILL.md +6 -7
- package/templates/skills/application/references/backend-controller-hierarchy.md +16 -16
- package/templates/skills/application/references/backend-seeding-and-dto-output.md +83 -0
- package/templates/skills/application/references/backend-table-prefix-mapping.md +79 -0
- package/templates/skills/application/references/backend-verification.md +1 -1
- package/templates/skills/application/references/frontend-i18n-and-output.md +67 -0
- package/templates/skills/application/references/frontend-route-naming.md +117 -0
- package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +107 -0
- package/templates/skills/application/references/frontend-verification.md +12 -12
- package/templates/skills/application/references/init-parameter-detection.md +120 -0
- package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -0
- package/templates/skills/application/references/nav-fallback-procedure.md +5 -6
- package/templates/skills/application/references/provider-template.md +2 -6
- package/templates/skills/application/references/roles-client-project-handling.md +55 -0
- package/templates/skills/application/references/roles-fallback-procedure.md +149 -0
- package/templates/skills/application/references/test-coverage-requirements.md +213 -0
- package/templates/skills/application/references/test-frontend.md +3 -3
- package/templates/skills/application/steps/step-00-init.md +11 -141
- package/templates/skills/application/steps/step-01-navigation.md +3 -3
- package/templates/skills/application/steps/step-02-permissions.md +4 -4
- package/templates/skills/application/steps/step-03-roles.md +18 -175
- package/templates/skills/application/steps/step-03b-provider.md +1 -2
- package/templates/skills/application/steps/step-04-backend.md +19 -110
- package/templates/skills/application/steps/step-05-frontend.md +17 -143
- package/templates/skills/application/steps/step-06-migration.md +12 -60
- package/templates/skills/application/steps/step-07-tests.md +9 -76
- package/templates/skills/application/templates-backend.md +29 -27
- package/templates/skills/application/templates-frontend.md +48 -48
- package/templates/skills/application/templates-seed.md +57 -131
- package/templates/skills/business-analyse/SKILL.md +27 -30
- package/templates/skills/business-analyse/_architecture.md +6 -6
- package/templates/skills/business-analyse/_shared.md +60 -88
- package/templates/skills/business-analyse/questionnaire/04-data.md +3 -3
- package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
- package/templates/skills/business-analyse/questionnaire/13-cross-module.md +1 -1
- package/templates/skills/business-analyse/react/application-viewer.md +12 -12
- package/templates/skills/business-analyse/react/components.md +8 -12
- package/templates/skills/business-analyse/react/schema.md +11 -11
- package/templates/skills/business-analyse/references/agent-module-prompt.md +2 -3
- package/templates/skills/business-analyse/references/analysis-semantic-checks.md +190 -0
- package/templates/skills/business-analyse/references/cache-warming-strategy.md +2 -2
- package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +41 -0
- package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +74 -0
- package/templates/skills/business-analyse/references/cadrage-shared-modules.md +69 -0
- package/templates/skills/business-analyse/references/cadrage-structure-cards.md +1 -1
- package/templates/skills/business-analyse/references/compilation-structure-cards.md +297 -0
- package/templates/skills/business-analyse/references/consolidation-structural-checks.md +2 -2
- package/templates/skills/business-analyse/references/deploy-modes.md +5 -5
- package/templates/skills/business-analyse/references/detection-strategies.md +7 -7
- package/templates/skills/business-analyse/references/handoff-file-templates.md +14 -22
- package/templates/skills/business-analyse/references/handoff-mappings.md +4 -4
- package/templates/skills/business-analyse/references/handoff-seeddata-generation.md +312 -0
- package/templates/skills/business-analyse/references/init-schema-deployment.md +3 -3
- package/templates/skills/business-analyse/references/naming-conventions.md +22 -24
- package/templates/skills/business-analyse/references/prd-generation.md +2 -2
- package/templates/skills/business-analyse/references/review-data-mapping.md +2 -2
- package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
- package/templates/skills/business-analyse/references/spec-auto-inference.md +3 -3
- package/templates/skills/business-analyse/references/team-orchestration.md +49 -6
- package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
- package/templates/skills/business-analyse/references/ui-resource-cards.md +18 -18
- package/templates/skills/business-analyse/references/validate-incremental-html.md +2 -2
- package/templates/skills/business-analyse/references/validation-checklist.md +2 -2
- package/templates/skills/business-analyse/schemas/application-schema.json +4 -5
- package/templates/skills/business-analyse/schemas/project-schema.json +1 -6
- package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +2 -3
- package/templates/skills/business-analyse/schemas/sections/specification-schema.json +4 -4
- package/templates/skills/business-analyse/steps/step-00-init.md +8 -17
- package/templates/skills/business-analyse/steps/step-01-cadrage.md +35 -198
- package/templates/skills/business-analyse/steps/step-01b-applications.md +16 -20
- package/templates/skills/business-analyse/steps/step-02-decomposition.md +1 -1
- package/templates/skills/business-analyse/steps/step-03a1-setup.md +4 -4
- package/templates/skills/business-analyse/steps/step-03a2-analysis.md +1 -1
- package/templates/skills/business-analyse/steps/step-03b-ui.md +4 -4
- package/templates/skills/business-analyse/steps/step-03c-compile.md +66 -140
- package/templates/skills/business-analyse/steps/step-03d-validate.md +2 -2
- package/templates/skills/business-analyse/steps/step-04a-collect.md +2 -2
- package/templates/skills/business-analyse/steps/step-04b-analyze.md +42 -160
- package/templates/skills/business-analyse/steps/step-04c-decide.md +1 -1
- package/templates/skills/business-analyse/steps/step-05a-handoff.md +74 -104
- package/templates/skills/business-analyse/steps/step-05b-deploy.md +13 -11
- package/templates/skills/business-analyse/steps/step-06-review.md +3 -3
- package/templates/skills/business-analyse/templates/tpl-frd.md +13 -13
- package/templates/skills/business-analyse/templates/tpl-handoff.md +12 -12
- package/templates/skills/business-analyse/templates-frd.md +25 -25
- package/templates/skills/business-analyse/templates-react.md +15 -21
- package/templates/skills/controller/SKILL.md +1 -1
- package/templates/skills/controller/postman-templates.md +1 -1
- package/templates/skills/controller/references/controller-code-templates.md +2 -2
- package/templates/skills/controller/references/mcp-scaffold-workflow.md +209 -0
- package/templates/skills/controller/references/permission-sync-templates.md +13 -16
- package/templates/skills/controller/steps/step-00-init.md +11 -11
- package/templates/skills/controller/steps/step-03-generate.md +64 -103
- package/templates/skills/controller/templates.md +67 -71
- package/templates/skills/debug/SKILL.md +13 -218
- package/templates/skills/debug/steps/step-00-init.md +57 -0
- package/templates/skills/debug/steps/step-01-analyze.md +219 -0
- package/templates/skills/debug/steps/step-02-resolve.md +85 -0
- package/templates/skills/documentation/SKILL.md +49 -345
- package/templates/skills/documentation/data-schema.md +11 -8
- package/templates/skills/documentation/steps/step-00-init.md +70 -0
- package/templates/skills/documentation/steps/step-01-scan.md +113 -0
- package/templates/skills/documentation/steps/step-02-generate.md +231 -0
- package/templates/skills/documentation/steps/step-03-validate.md +238 -0
- package/templates/skills/documentation/templates.md +480 -322
- package/templates/skills/efcore/references/both-contexts.md +32 -0
- package/templates/skills/efcore/references/database-operations.md +67 -0
- package/templates/skills/efcore/references/destructive-operations.md +38 -0
- package/templates/skills/efcore/references/reset-operations.md +81 -0
- package/templates/skills/efcore/references/seed-methods.md +86 -0
- package/templates/skills/efcore/references/shared-init-functions.md +250 -0
- package/templates/skills/efcore/references/sql-objects-injection.md +61 -0
- package/templates/skills/efcore/references/troubleshooting.md +81 -0
- package/templates/skills/efcore/steps/db/step-deploy.md +1 -32
- package/templates/skills/efcore/steps/db/step-reset.md +7 -103
- package/templates/skills/efcore/steps/db/step-seed.md +10 -132
- package/templates/skills/efcore/steps/db/step-status.md +5 -44
- package/templates/skills/efcore/steps/migration/step-03-validate.md +8 -62
- package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +1 -57
- package/templates/skills/efcore/steps/shared/step-00-init.md +11 -254
- package/templates/skills/efcore/steps/squash/step-03-create.md +1 -58
- package/templates/skills/feature-full/SKILL.md +1 -1
- package/templates/skills/feature-full/steps/step-00-init.md +57 -0
- package/templates/skills/feature-full/steps/step-01-implementation.md +1 -1
- package/templates/skills/gitflow/SKILL.md +1 -1
- package/templates/skills/gitflow/_shared.md +23 -0
- package/templates/skills/gitflow/references/commit-message-generation.md +58 -0
- package/templates/skills/gitflow/references/commit-migration-validation.md +49 -0
- package/templates/skills/gitflow/references/finish-cleanup.md +51 -0
- package/templates/skills/gitflow/references/finish-version-bumping.md +45 -0
- package/templates/skills/gitflow/references/init-environment-detection.md +41 -0
- package/templates/skills/gitflow/references/init-questions.md +185 -0
- package/templates/skills/gitflow/references/init-structure-creation.md +71 -0
- package/templates/skills/gitflow/references/init-version-detection.md +21 -0
- package/templates/skills/gitflow/references/init-workspace-detection.md +43 -0
- package/templates/skills/gitflow/references/merge-ci-status.md +36 -0
- package/templates/skills/gitflow/references/merge-execution.md +62 -0
- package/templates/skills/gitflow/references/merge-pr-context.md +76 -0
- package/templates/skills/gitflow/references/pr-build-checks.md +60 -0
- package/templates/skills/gitflow/references/pr-generation.md +58 -0
- package/templates/skills/gitflow/references/start-branch-normalization.md +28 -0
- package/templates/skills/gitflow/references/start-worktree-creation.md +50 -0
- package/templates/skills/gitflow/references/sync-push-verify.md +44 -0
- package/templates/skills/gitflow/references/sync-rebase-conflicts.md +38 -0
- package/templates/skills/gitflow/steps/step-commit.md +12 -91
- package/templates/skills/gitflow/steps/step-finish.md +15 -159
- package/templates/skills/gitflow/steps/step-init.md +24 -326
- package/templates/skills/gitflow/steps/step-merge.md +17 -176
- package/templates/skills/gitflow/steps/step-pr.md +10 -116
- package/templates/skills/gitflow/steps/step-start.md +16 -109
- package/templates/skills/gitflow/steps/step-sync.md +6 -69
- package/templates/skills/ralph-loop/SKILL.md +6 -0
- package/templates/skills/ralph-loop/references/category-completeness.md +185 -0
- package/templates/skills/ralph-loop/references/compact-loop.md +1 -1
- package/templates/skills/ralph-loop/references/init-resume-recovery.md +127 -0
- package/templates/skills/ralph-loop/references/module-transition.md +151 -0
- package/templates/skills/ralph-loop/references/multi-module-queue.md +171 -0
- package/templates/skills/ralph-loop/references/parallel-execution.md +246 -0
- package/templates/skills/ralph-loop/references/task-transform-legacy.md +6 -9
- package/templates/skills/ralph-loop/references/team-orchestration.md +45 -3
- package/templates/skills/ralph-loop/steps/step-00-init.md +36 -109
- package/templates/skills/ralph-loop/steps/step-01-task.md +15 -163
- package/templates/skills/ralph-loop/steps/step-02-execute.md +8 -154
- package/templates/skills/ralph-loop/steps/step-04-check.md +21 -73
- package/templates/skills/review-code/references/owasp-api-top10.md +5 -5
- package/templates/skills/review-code/references/smartstack-conventions.md +11 -11
- package/templates/skills/validate-feature/references/api-smoke-tests.md +140 -0
- package/templates/skills/validate-feature/references/db-validation-checks.md +180 -0
- package/templates/skills/validate-feature/steps/step-01-compile.md +5 -2
- package/templates/skills/validate-feature/steps/step-04-api-smoke.md +34 -145
- package/templates/skills/validate-feature/steps/step-05-db-validation.md +74 -260
- package/templates/skills/workflow/SKILL.md +1 -1
- package/templates/skills/workflow/steps/step-00-init.md +57 -0
|
@@ -72,13 +72,12 @@ function transformPrdJsonToRalphV2(prdJson, moduleCode) {
|
|
|
72
72
|
// --- 1b. Consolidated frontend task ---
|
|
73
73
|
if (frontendFiles.length > 0) {
|
|
74
74
|
const apiDepId = lastIdByCategory["api"] || lastIdByCategory["application"];
|
|
75
|
-
const ctx = (prdJson.project?.context || 'Business').replace(/^./, c => c.toUpperCase());
|
|
76
75
|
const app = prdJson.project?.application || moduleCode;
|
|
77
76
|
tasks.push({
|
|
78
77
|
id: taskId,
|
|
79
78
|
description: `[frontend] Generate COMPLETE frontend for module ${moduleCode} via MCP (${frontendFiles.length} files)`,
|
|
80
79
|
status: "pending", category: "frontend", dependencies: apiDepId ? [apiDepId] : [],
|
|
81
|
-
acceptance_criteria: `Pages in src/pages/${
|
|
80
|
+
acceptance_criteria: `Pages in src/pages/${app}/${moduleCode}/; MCP scaffold_api_client + scaffold_routes; SmartTable for lists; CSS variables ONLY; 4-language i18n; npm run typecheck passes`,
|
|
82
81
|
started_at: null, completed_at: null, iteration: null, commit_hash: null,
|
|
83
82
|
files_changed: { created: frontendFiles.map(f => f.path), modified: [] },
|
|
84
83
|
validation: null, error: null, module: moduleCode,
|
|
@@ -130,15 +129,14 @@ function transformPrdJsonToRalphV2(prdJson, moduleCode) {
|
|
|
130
129
|
|
|
131
130
|
// 1f. INJECT missing frontend
|
|
132
131
|
if (frontendFiles.length === 0 && (sections.length > 0 || wireframes.length > 0 || apiEndpoints.length > 0)) {
|
|
133
|
-
const ctx = (prdJson.project?.context || 'Business').replace(/^./, c => c.toUpperCase());
|
|
134
132
|
const app = prdJson.project?.application || moduleCode;
|
|
135
|
-
const derivedFiles = wireframes.map(wf => ({ path: `web/src/pages/${
|
|
133
|
+
const derivedFiles = wireframes.map(wf => ({ path: `web/src/pages/${app}/${moduleCode}/${wf.screen || wf.id}.tsx`, type: 'Page' }));
|
|
136
134
|
if (apiEndpoints.length > 0) derivedFiles.push({ path: `web/src/services/api/${moduleCode}Api.ts`, type: 'ApiService' });
|
|
137
135
|
|
|
138
136
|
tasks.push({ id: taskId,
|
|
139
137
|
description: `[frontend] Generate COMPLETE frontend for ${moduleCode} via MCP (${derivedFiles.length} files)`,
|
|
140
138
|
status: "pending", category: "frontend", dependencies: [lastIdByCategory["api"] || lastIdByCategory["application"]].filter(Boolean),
|
|
141
|
-
acceptance_criteria: `Pages in src/pages/${
|
|
139
|
+
acceptance_criteria: `Pages in src/pages/${app}/${moduleCode}/; SmartTable for lists; CSS variables ONLY; 4-language i18n; npm run typecheck passes`,
|
|
142
140
|
started_at: null, completed_at: null, iteration: null, commit_hash: null,
|
|
143
141
|
files_changed: { created: derivedFiles.map(f => f.path), modified: [] },
|
|
144
142
|
validation: null, error: null, module: moduleCode,
|
|
@@ -184,8 +182,7 @@ function transformPrdJsonToRalphV2(prdJson, moduleCode) {
|
|
|
184
182
|
files_changed: { created: [], modified: [] }, validation: null, error: null, module: moduleCode,
|
|
185
183
|
_seedDataMeta: {
|
|
186
184
|
source: "guardrail-derived", coreSeedData,
|
|
187
|
-
navRoute: prdJson.project?.navRoute ||
|
|
188
|
-
contextCode: prdJson.project?.context || 'business',
|
|
185
|
+
navRoute: prdJson.project?.navRoute || `${prdJson.project?.application || 'app'}.${moduleCode}`,
|
|
189
186
|
appCode: prdJson.project?.application, appLabels: prdJson.project?.labels || null
|
|
190
187
|
}
|
|
191
188
|
});
|
|
@@ -203,8 +200,8 @@ function transformPrdJsonToRalphV2(prdJson, moduleCode) {
|
|
|
203
200
|
started_at: null, completed_at: null, iteration: null, commit_hash: null,
|
|
204
201
|
files_changed: { created: [], modified: [] }, validation: null, error: null, module: moduleCode,
|
|
205
202
|
_providerMeta: {
|
|
206
|
-
navRoute: prdJson.project?.navRoute ||
|
|
207
|
-
|
|
203
|
+
navRoute: prdJson.project?.navRoute || `${prdJson.project?.application || 'app'}.${moduleCode}`,
|
|
204
|
+
appCode: prdJson.project?.application
|
|
208
205
|
}
|
|
209
206
|
});
|
|
210
207
|
lastIdByCategory["infrastructure"] = taskId; taskId++;
|
|
@@ -155,7 +155,7 @@ for (const t of teammates) {
|
|
|
155
155
|
|
|
156
156
|
// 2. Create team
|
|
157
157
|
const teamName = `smartstack-${kebabCase(projectName)}`;
|
|
158
|
-
TeamCreate({ team_name: teamName, description: `
|
|
158
|
+
TeamCreate({ team_name: teamName, description: `Layer-based module orchestration for ${projectName}` });
|
|
159
159
|
|
|
160
160
|
// 3. Spawn teammates in parallel (single message, multiple Task calls)
|
|
161
161
|
for (const teammate of teammates) {
|
|
@@ -290,6 +290,49 @@ console.log(`Team ${teamName} deleted. All teammates shut down.`);
|
|
|
290
290
|
|
|
291
291
|
---
|
|
292
292
|
|
|
293
|
+
## Task List Coordination (T10)
|
|
294
|
+
|
|
295
|
+
Create tasks for each module before spawning teammates:
|
|
296
|
+
|
|
297
|
+
```javascript
|
|
298
|
+
// Create tasks for each module before spawning teammates
|
|
299
|
+
for (const mod of modules) {
|
|
300
|
+
TaskCreate({
|
|
301
|
+
subject: `Complete ${mod.code} module`,
|
|
302
|
+
description: `Generate services, controllers, frontend, and tests for ${mod.code}`,
|
|
303
|
+
activeForm: `Working on ${mod.code}`
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Teammates update task status when done
|
|
308
|
+
TaskUpdate({ taskId: currentTaskId, status: 'completed' });
|
|
309
|
+
|
|
310
|
+
// Team lead checks progress
|
|
311
|
+
TaskList(); // View all tasks and their status
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Idle State Handling (T13)
|
|
317
|
+
|
|
318
|
+
> **IMPORTANT:** Teammates go idle after every turn — this is completely normal.
|
|
319
|
+
> Idle simply means the teammate is waiting for input. An idle notification immediately
|
|
320
|
+
> after a message does NOT mean the teammate is done or has errors.
|
|
321
|
+
> Send a message to an idle teammate to wake it up.
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Team Config Discovery (T14)
|
|
326
|
+
|
|
327
|
+
```javascript
|
|
328
|
+
// Teammates can discover each other via team config:
|
|
329
|
+
// ~/.claude/teams/{team-name}/config.json
|
|
330
|
+
// Contains: members[] with name, agentId, agentType
|
|
331
|
+
// Always refer to teammates by NAME, not by UUID.
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
293
336
|
## Dependency Layer Mode Protocol (no `-p` flag — LEGACY)
|
|
294
337
|
|
|
295
338
|
### 1. Layer Detection
|
|
@@ -324,7 +367,7 @@ if (!layers) {
|
|
|
324
367
|
|
|
325
368
|
```javascript
|
|
326
369
|
// Create team
|
|
327
|
-
TeamCreate({ team_name: `ralph-${appName}` });
|
|
370
|
+
TeamCreate({ team_name: `ralph-${appName}`, description: `Layer-based module orchestration for ${appName}` });
|
|
328
371
|
|
|
329
372
|
// Store team context
|
|
330
373
|
const teamContext = {
|
|
@@ -406,7 +449,6 @@ ${prdFile}
|
|
|
406
449
|
- Project path: ${projectPath}
|
|
407
450
|
- Branch: ${branch}
|
|
408
451
|
- Application: ${appName}
|
|
409
|
-
- Context: ${contextCode}
|
|
410
452
|
```
|
|
411
453
|
|
|
412
454
|
---
|
|
@@ -14,8 +14,6 @@ next_step: steps/step-01-task.md
|
|
|
14
14
|
- ONLY check resume if -r flag is set
|
|
15
15
|
- **NEVER ask the user** to choose a mode, confirm execution, or select options
|
|
16
16
|
- **NEVER set max_iterations = 1** — unless the user explicitly passed `-m 1`
|
|
17
|
-
- CONTEXT BUDGET: Keep output COMPACT
|
|
18
|
-
- **NEVER DELEGATE** the main Ralph loop to a sub-agent (single module)
|
|
19
17
|
- **Multi-module (2+ modules):** Use Agent Teams for parallel execution
|
|
20
18
|
|
|
21
19
|
## YOUR TASK:
|
|
@@ -33,168 +31,93 @@ Defaults:
|
|
|
33
31
|
verbose_mode: false
|
|
34
32
|
resume_mode: false
|
|
35
33
|
parallel_mode: false
|
|
36
|
-
current_iteration: 1
|
|
37
34
|
|
|
38
35
|
Flags:
|
|
39
|
-
-m N / --max-iterations N
|
|
36
|
+
-m N / --max-iterations N → {max_iterations} = N
|
|
40
37
|
-c TEXT / --completion-promise TEXT → {completion_promise} = TEXT
|
|
41
|
-
-v / --verbose
|
|
42
|
-
-r / --resume
|
|
43
|
-
-p / --parallel
|
|
38
|
+
-v / --verbose → {verbose_mode} = true
|
|
39
|
+
-r / --resume → {resume_mode} = true
|
|
40
|
+
-p / --parallel → {parallel_mode} = true
|
|
44
41
|
Remainder → {task_description}
|
|
45
42
|
```
|
|
46
43
|
|
|
47
|
-
**If `-p
|
|
44
|
+
**If `-p`:** set parallel_mode = true. Ralph executes Phase 0 (entities) sequentially, then spawns parallel teammates.
|
|
48
45
|
|
|
49
46
|
## 2. Verify MCP (MANDATORY)
|
|
50
47
|
|
|
51
48
|
```
|
|
52
|
-
mcp__smartstack__validate_conventions: checks: ["all"]
|
|
53
|
-
mcp__context7__resolve-library-id: libraryName: "test"
|
|
49
|
+
mcp__smartstack__validate_conventions: checks: ["all"] → {mcp_smartstack} = true/false
|
|
50
|
+
mcp__context7__resolve-library-id: libraryName: "test" → {mcp_context7} = true/false
|
|
54
51
|
```
|
|
55
52
|
|
|
56
53
|
If ANY fails: show error, suggest `smartstack check-mcp`, STOP.
|
|
57
54
|
|
|
58
55
|
## 3. Execution Mode (FULLY AUTONOMOUS)
|
|
59
56
|
|
|
60
|
-
|
|
61
|
-
> It executes ALL tasks from start to finish WITHOUT stopping.
|
|
62
|
-
> The user launched `/ralph-loop` — this IS the instruction to execute everything.
|
|
57
|
+
Ralph-loop is FULLY AUTONOMOUS by default. It executes ALL tasks from start to finish WITHOUT stopping.
|
|
63
58
|
|
|
64
59
|
**DO NOT** ask the user to confirm, choose a mode, or approve execution.
|
|
65
|
-
**DO NOT** set
|
|
66
|
-
**DO NOT** stop after the first task to "check quality".
|
|
60
|
+
**DO NOT** set max_iterations = 1 or any reduced value.
|
|
67
61
|
|
|
68
62
|
The loop runs autonomously until:
|
|
69
63
|
- ALL tasks are completed (success)
|
|
70
|
-
-
|
|
71
|
-
- Dead-end detected (all remaining
|
|
64
|
+
- max_iterations is reached (user set via `-m N`)
|
|
65
|
+
- Dead-end detected (all remaining blocked/failed)
|
|
72
66
|
- User Ctrl+C (external interrupt)
|
|
73
67
|
|
|
74
|
-
|
|
75
|
-
// NO user prompt. NO mode selection. JUST EXECUTE.
|
|
76
|
-
// max_iterations is already set from flags (default: 50).
|
|
77
|
-
// If user wants fewer iterations, they use -m N explicitly.
|
|
78
|
-
console.log(`Mode: AUTONOMOUS | Max iterations: ${max_iterations}`);
|
|
79
|
-
```
|
|
68
|
+
### Speed Warning (informational only)
|
|
80
69
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
If tests are slow (>30s detected in previous logs), display a one-line warning but **continue execution**:
|
|
70
|
+
If tests are slow (>30s in logs), display warning but **continue execution**:
|
|
84
71
|
```
|
|
85
72
|
⚠ Slow tests detected. Consider disabling E2E during ralph-loop.
|
|
86
73
|
```
|
|
87
74
|
|
|
88
|
-
## 4. Resume
|
|
89
|
-
|
|
90
|
-
If `{resume_mode} = true`:
|
|
75
|
+
## 4. Resume or Initialize
|
|
91
76
|
|
|
92
|
-
|
|
93
|
-
2. Detect format:
|
|
94
|
-
- `$version === "3.0.0"` → **v3 unified** (native, preferred)
|
|
95
|
-
- `$version === "2.0.0"` → **v2 legacy** (OK, continue)
|
|
96
|
-
- `.project && .requirements && !.$version` → **FORMAT A (DEPRECATED)** — warn and transform via step-01
|
|
97
|
-
- Other → error
|
|
98
|
-
3. Check branch consistency: current branch vs `prd.metadata.branch`
|
|
99
|
-
4. Restore state: `current_iteration`, `completion_promise`, `max_iterations`
|
|
100
|
-
5. If `modules-queue.json` exists: restore multi-module state
|
|
101
|
-
6. Continue to step-01
|
|
77
|
+
See `references/init-resume-recovery.md` for complete Resume Mode and Auto-Recovery logic.
|
|
102
78
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
```
|
|
79
|
+
**Quick:**
|
|
80
|
+
- If `-r` flag: restore state from .ralph/prd.json
|
|
81
|
+
- Else if BA artifacts exist: auto-recover PRDs via `ss derive-prd`
|
|
82
|
+
- Else: fresh start
|
|
108
83
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
If no PRD files exist (neither `prd-*.json` nor `prd.json`):
|
|
112
|
-
|
|
113
|
-
```javascript
|
|
114
|
-
const masterFeature = findFile('docs/business/**/business-analyse/**/feature.json');
|
|
115
|
-
if (masterFeature) {
|
|
116
|
-
const master = readJSON(masterFeature);
|
|
117
|
-
if (master.status === 'handed-off' || master.handoff?.status === 'handed-off') {
|
|
118
|
-
console.log('BA artifacts detected without PRD — auto-recovering...');
|
|
119
|
-
exec(`ss derive-prd --application ${masterFeature}`);
|
|
120
|
-
const newPrds = glob('.ralph/prd-*.json');
|
|
121
|
-
if (newPrds.length === 0) { console.log('ss derive-prd failed'); STOP; }
|
|
122
|
-
console.log(`Auto-recovered ${newPrds.length} PRD files`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
```
|
|
84
|
+
---
|
|
126
85
|
|
|
127
|
-
|
|
86
|
+
## 4b. Detect Multi-Module PRDs
|
|
128
87
|
|
|
129
|
-
|
|
130
|
-
const prdFiles = glob('.ralph/prd-*.json');
|
|
131
|
-
const PRD_COUNT = prdFiles.length;
|
|
132
|
-
|
|
133
|
-
if (PRD_COUNT > 0) {
|
|
134
|
-
// Build module queue (from master feature.json order or alphabetical)
|
|
135
|
-
const modules = [];
|
|
136
|
-
const masterFeature = findFile('docs/business/**/business-analyse/**/feature.json');
|
|
137
|
-
if (masterFeature) {
|
|
138
|
-
const master = readJSON(masterFeature);
|
|
139
|
-
const moduleOrder = master.metadata?.workflow?.moduleOrder || [];
|
|
140
|
-
for (const mod of moduleOrder) {
|
|
141
|
-
if (fileExists(`.ralph/prd-${mod.code}.json`)) {
|
|
142
|
-
modules.push({ code: mod.code, prdFile: `.ralph/prd-${mod.code}.json`, status: 'pending' });
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
// Fallback: alphabetical
|
|
147
|
-
if (modules.length === 0) {
|
|
148
|
-
for (const file of prdFiles) {
|
|
149
|
-
const code = file.match(/prd-(.+)\.json$/)[1];
|
|
150
|
-
modules.push({ code, prdFile: `.ralph/${file}`, status: 'pending' });
|
|
151
|
-
}
|
|
152
|
-
}
|
|
88
|
+
See `references/multi-module-queue.md` for queue initialization.
|
|
153
89
|
|
|
154
|
-
|
|
155
|
-
modules[0].status = 'in-progress';
|
|
156
|
-
const queue = { modules, currentIndex: 0, totalModules: modules.length, completedModules: 0 };
|
|
157
|
-
writeJSON('.ralph/modules-queue.json', queue);
|
|
158
|
-
console.log(`Multi-module: ${modules.length} modules → ${modules.map(m => m.code).join(' → ')}`);
|
|
90
|
+
Quick: `glob('.ralph/prd-*.json').length > 1` → create modules-queue.json
|
|
159
91
|
|
|
160
|
-
|
|
161
|
-
{current_module} = modules[0].code;
|
|
162
|
-
}
|
|
163
|
-
```
|
|
92
|
+
---
|
|
164
93
|
|
|
165
|
-
|
|
94
|
+
## 4c. Team Orchestration (multi-module, 2+ modules)
|
|
166
95
|
|
|
167
96
|
```javascript
|
|
168
97
|
if (PRD_COUNT > 1) {
|
|
169
98
|
// Read references/team-orchestration.md for full protocol
|
|
170
|
-
// Detect dependency layers from master feature.json
|
|
171
99
|
const layers = master.metadata?.workflow?.dependencyGraph?.layers;
|
|
172
100
|
|
|
173
101
|
if (layers) {
|
|
174
102
|
// PARALLEL MODE: Use Agent Teams
|
|
175
103
|
TeamCreate({ team_name: `ralph-${appName}` });
|
|
176
|
-
|
|
177
|
-
// For each layer, spawn teammates in parallel
|
|
178
|
-
// Layer 0: foundation modules (spawn, wait for LAYER_READY)
|
|
179
|
-
// Layer 1+: dependent modules (spawn after previous layer completes)
|
|
180
|
-
// See references/team-orchestration.md for teammate prompt template
|
|
181
|
-
|
|
182
|
-
// After all layers: cross-module verify → step-05 → TeamDelete
|
|
104
|
+
// Spawn teammates per layer (see reference)
|
|
183
105
|
// STOP here — team orchestration takes over
|
|
184
106
|
return;
|
|
185
107
|
}
|
|
186
|
-
// If no layers: fall through to sequential mode
|
|
108
|
+
// If no layers: fall through to sequential mode
|
|
187
109
|
}
|
|
188
110
|
```
|
|
189
111
|
|
|
112
|
+
---
|
|
113
|
+
|
|
190
114
|
## 5. Completion Promise (auto-set)
|
|
191
115
|
|
|
192
116
|
```javascript
|
|
193
|
-
// Auto-set if not provided — NEVER ask the user
|
|
194
117
|
if (!completion_promise) {
|
|
195
118
|
completion_promise = "COMPLETE";
|
|
196
119
|
}
|
|
197
|
-
//
|
|
120
|
+
// Output ONLY when ALL tasks done
|
|
198
121
|
```
|
|
199
122
|
|
|
200
123
|
## 6. Collect Metadata
|
|
@@ -206,8 +129,12 @@ PROJECT_PATH=$(pwd)
|
|
|
206
129
|
```
|
|
207
130
|
|
|
208
131
|
```javascript
|
|
209
|
-
{metadata} = {
|
|
210
|
-
|
|
132
|
+
{metadata} = {
|
|
133
|
+
cli_version: CLI_VERSION,
|
|
134
|
+
branch: CURRENT_BRANCH,
|
|
135
|
+
project_path: PROJECT_PATH,
|
|
136
|
+
mcp_servers: { smartstack: {mcp_smartstack}, context7: {mcp_context7} }
|
|
137
|
+
}
|
|
211
138
|
```
|
|
212
139
|
|
|
213
140
|
## 7. Show Summary
|
|
@@ -29,56 +29,13 @@ Load task from prd.json or create initial task breakdown with categories, depend
|
|
|
29
29
|
|
|
30
30
|
## 0. Multi-Module Queue Check
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
const queuePath = '.ralph/modules-queue.json';
|
|
34
|
-
if (fileExists(queuePath)) {
|
|
35
|
-
const queue = readJSON(queuePath);
|
|
36
|
-
const currentModule = queue.modules[queue.currentIndex];
|
|
37
|
-
console.log(`Multi-module: ${currentModule.code} (${queue.currentIndex + 1}/${queue.totalModules})`);
|
|
38
|
-
|
|
39
|
-
{modules_queue} = queue;
|
|
40
|
-
{current_module} = currentModule.code;
|
|
41
|
-
|
|
42
|
-
// Verify PRD matches current module
|
|
43
|
-
const currentPrd = readJSON('.ralph/prd.json');
|
|
44
|
-
if (currentPrd.metadata?.moduleCode !== currentModule.code) {
|
|
45
|
-
const modulePrd = readJSON(currentModule.prdFile);
|
|
46
|
-
|
|
47
|
-
// v3 FAST PATH: unified PRD from ss derive-prd (tasks pre-computed)
|
|
48
|
-
if (modulePrd.$version === '3.0.0') {
|
|
49
|
-
// Inject runtime fields and use directly
|
|
50
|
-
modulePrd.status = 'in_progress';
|
|
51
|
-
modulePrd.feature = `${modulePrd.project?.module || currentModule.code} (${modulePrd.project?.application || 'app'})`;
|
|
52
|
-
modulePrd.created = modulePrd.created || new Date().toISOString();
|
|
53
|
-
modulePrd.updated_at = new Date().toISOString();
|
|
54
|
-
modulePrd.config = modulePrd.config || { max_iterations: {max_iterations}, completion_promise: "{completion_promise}", current_iteration: 1 };
|
|
55
|
-
modulePrd.metadata.branch = modulePrd.metadata.branch || getCurrentBranch();
|
|
56
|
-
modulePrd.metadata.project_path = modulePrd.metadata.project_path || process.cwd();
|
|
57
|
-
modulePrd.metadata.mcp_servers = modulePrd.metadata.mcp_servers || { smartstack: true, context7: true };
|
|
58
|
-
modulePrd.history = modulePrd.history || [];
|
|
59
|
-
writeJSON('.ralph/prd.json', modulePrd);
|
|
60
|
-
}
|
|
61
|
-
// LEGACY: FORMAT A (no $version) — transform + warning
|
|
62
|
-
else if (modulePrd.project && modulePrd.requirements && !modulePrd.$version) {
|
|
63
|
-
console.warn('⚠ DEPRECATED: FORMAT A prd.json detected. Re-run `ss derive-prd` to generate v3 format.');
|
|
64
|
-
writeJSON('.ralph/prd.json', transformPrdJsonToRalphV2(modulePrd, currentModule.code));
|
|
65
|
-
}
|
|
66
|
-
// v2 legacy or already runtime format
|
|
67
|
-
else {
|
|
68
|
-
writeJSON('.ralph/prd.json', modulePrd);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
} else {
|
|
72
|
-
{modules_queue} = null;
|
|
73
|
-
{current_module} = null;
|
|
74
|
-
}
|
|
75
|
-
```
|
|
32
|
+
See `references/multi-module-queue.md` for full module queue initialization, detection, and loading.
|
|
76
33
|
|
|
77
|
-
|
|
34
|
+
Quick: If `glob('.ralph/prd-*.json').length > 1` → create modules-queue.json and load first module's PRD.
|
|
78
35
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## PrdJson → Ralph v2 Transformation (DEPRECATED)
|
|
82
39
|
|
|
83
40
|
See [references/task-transform-legacy.md](../references/task-transform-legacy.md) for the full `transformPrdJsonToRalphV2()` function including:
|
|
84
41
|
- Layer-ordered task generation (domain → infra → app → api → frontend → seedData → tests)
|
|
@@ -96,7 +53,7 @@ If `.ralph/prd.json` exists:
|
|
|
96
53
|
- Write back to `.ralph/prd.json`
|
|
97
54
|
- **Run CATEGORY COMPLETENESS CHECK (section 4b) before proceeding**
|
|
98
55
|
- Skip directly to section 5 (find next task)
|
|
99
|
-
3. **v2 legacy:** If `$version === "2.0.0"` → find next eligible task (section 5)
|
|
56
|
+
3. **v2 legacy:** If `$version === "2.0.0"` → find next eligible task (section 5)
|
|
100
57
|
4. **FORMAT A (deprecated):** If `.project && .requirements && !.$version` → run `transformPrdJsonToRalphV2()` → section 5
|
|
101
58
|
|
|
102
59
|
If `.ralph/prd.json` does not exist: continue to section 1b.
|
|
@@ -105,10 +62,8 @@ If `.ralph/prd.json` does not exist: continue to section 1b.
|
|
|
105
62
|
|
|
106
63
|
> **CRITICAL:** Before generating ANY tasks, verify the BA handoff is complete.
|
|
107
64
|
> A missing handoff means no frontend files, no test plan, no BR-to-code mapping.
|
|
108
|
-
> Generating tasks without handoff produces an INCOMPLETE PRD (backend-only).
|
|
109
65
|
|
|
110
66
|
```javascript
|
|
111
|
-
// Find the source feature.json for the current module
|
|
112
67
|
const sourceFeatureJson = prd?.metadata?.sourceFeatureJson
|
|
113
68
|
|| findFile('docs/business/**/business-analyse/**/feature.json');
|
|
114
69
|
|
|
@@ -118,35 +73,19 @@ if (sourceFeatureJson) {
|
|
|
118
73
|
|
|
119
74
|
// CHECK 1: Handoff status must be "handed-off"
|
|
120
75
|
if (handoff.status !== 'handed-off') {
|
|
121
|
-
console.error(`
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
║ ║
|
|
125
|
-
║ feature.json handoff.status = "${handoff.status || 'missing'}"
|
|
126
|
-
║ Expected: "handed-off" ║
|
|
127
|
-
║ ║
|
|
128
|
-
║ The /business-analyse did not complete steps 04a→05c. ║
|
|
129
|
-
║ Without handoff, the PRD will be MISSING: ║
|
|
130
|
-
║ - Frontend tasks (pages, components, routes) ║
|
|
131
|
-
║ - Test tasks (unit, integration, security) ║
|
|
132
|
-
║ - BR-to-code mappings ║
|
|
133
|
-
║ - API endpoint summary ║
|
|
134
|
-
║ ║
|
|
135
|
-
║ ACTION: Run /business-analyse to complete the handoff, ║
|
|
136
|
-
║ then re-run /ralph-loop. ║
|
|
137
|
-
╚══════════════════════════════════════════════════════════════╝`);
|
|
76
|
+
console.error(`BLOCKING: BA HANDOFF INCOMPLETE
|
|
77
|
+
handoff.status = "${handoff.status || 'missing'}" (expected "handed-off")
|
|
78
|
+
Run /business-analyse to complete the handoff, then re-run /ralph-loop.`);
|
|
138
79
|
STOP;
|
|
139
80
|
}
|
|
140
81
|
|
|
141
|
-
// CHECK 2: filesToCreate must have all
|
|
82
|
+
// CHECK 2: filesToCreate must have all categories
|
|
142
83
|
const filesToCreate = handoff.filesToCreate || {};
|
|
143
84
|
const requiredCategories = ['domain', 'application', 'infrastructure', 'api', 'frontend', 'seedData', 'tests'];
|
|
144
85
|
const missingInHandoff = requiredCategories.filter(c => !filesToCreate[c] || filesToCreate[c].length === 0);
|
|
145
86
|
|
|
146
87
|
if (missingInHandoff.length > 0) {
|
|
147
88
|
console.warn(`⚠ Handoff has empty categories: ${missingInHandoff.join(', ')}`);
|
|
148
|
-
console.warn('PRD generation may produce incomplete tasks. Consider re-running /business-analyse step-05a.');
|
|
149
|
-
// WARNING only — allow proceeding if handoff.status is correct
|
|
150
89
|
}
|
|
151
90
|
}
|
|
152
91
|
```
|
|
@@ -181,112 +120,25 @@ Initialize `.ralph/progress.txt`:
|
|
|
181
120
|
|
|
182
121
|
### 4b. Category Completeness Check (BLOCKING)
|
|
183
122
|
|
|
184
|
-
|
|
185
|
-
> A PRD with only backend categories (domain, infrastructure, application, api) is INCOMPLETE.
|
|
186
|
-
> This check prevents the "no frontend generated" failure mode.
|
|
123
|
+
See `references/category-completeness.md` for full implementation.
|
|
187
124
|
|
|
188
|
-
|
|
189
|
-
// CRITICAL: seedData MUST be in the required list — without it, nav_Applications/auth_Roles/auth_Permissions
|
|
190
|
-
// are not seeded, and frontend/test tasks execute against an empty database.
|
|
191
|
-
const REQUIRED_CATEGORIES = ['domain', 'infrastructure', 'application', 'api', 'seedData', 'frontend', 'test'];
|
|
192
|
-
const presentCategories = new Set(prd.tasks.map(t => t.category));
|
|
193
|
-
const missingCategories = REQUIRED_CATEGORIES.filter(c => !presentCategories.has(c));
|
|
194
|
-
|
|
195
|
-
if (missingCategories.length > 0) {
|
|
196
|
-
console.warn(`⚠ PRD MISSING CATEGORIES: ${missingCategories.join(', ')}`);
|
|
197
|
-
|
|
198
|
-
// AUTO-INJECT guardrail tasks for missing categories
|
|
199
|
-
let maxIdNum = Math.max(...prd.tasks.map(t => {
|
|
200
|
-
const num = parseInt(t.id.replace(/[^0-9]/g, ''), 10);
|
|
201
|
-
return isNaN(num) ? 0 : num;
|
|
202
|
-
}));
|
|
203
|
-
const prefix = prd.tasks[0]?.id?.replace(/[0-9]+$/, '') || 'GUARD-';
|
|
204
|
-
const lastApiTask = prd.tasks.filter(t => t.category === 'api').pop()?.id || prd.tasks[prd.tasks.length - 1]?.id;
|
|
205
|
-
const lastSeedDataTask = prd.tasks.filter(t => t.category === 'seedData').pop()?.id;
|
|
206
|
-
|
|
207
|
-
// DEPENDENCY CHAIN: domain → infrastructure → application → api → seedData → frontend → test
|
|
208
|
-
// Frontend MUST depend on seedData (not just API) — otherwise navigation/permissions are empty
|
|
209
|
-
const frontendDep = lastSeedDataTask || lastApiTask;
|
|
210
|
-
|
|
211
|
-
for (const cat of missingCategories) {
|
|
212
|
-
maxIdNum++;
|
|
213
|
-
const taskId = `${prefix}${String(maxIdNum).padStart(3, '0')}`;
|
|
214
|
-
|
|
215
|
-
// Determine dependencies based on category order
|
|
216
|
-
let deps;
|
|
217
|
-
if (cat === 'seedData') {
|
|
218
|
-
deps = [lastApiTask]; // seedData depends on API (infrastructure must exist first)
|
|
219
|
-
} else if (cat === 'frontend') {
|
|
220
|
-
deps = [frontendDep]; // frontend depends on seedData (navigation must be seeded)
|
|
221
|
-
} else if (cat === 'test') {
|
|
222
|
-
deps = [frontendDep]; // test depends on seedData too
|
|
223
|
-
} else {
|
|
224
|
-
deps = [];
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
const guardrailTask = {
|
|
228
|
-
id: taskId,
|
|
229
|
-
description: `[GUARDRAIL] Generate ${cat} layer for ${prd.project?.module || 'module'}`,
|
|
230
|
-
status: 'pending',
|
|
231
|
-
category: cat,
|
|
232
|
-
dependencies: deps,
|
|
233
|
-
acceptance_criteria: [
|
|
234
|
-
cat === 'seedData' ? 'NavigationApplicationSeedData + NavigationModuleSeedData + PermissionsSeedData + ApplicationRolesSeedData created, IClientSeedDataProvider wired, startup test passes' :
|
|
235
|
-
cat === 'frontend' ? 'React pages created via MCP scaffold_api_client + scaffold_routes, wired to App.tsx, navigation seed data verified in DB' :
|
|
236
|
-
cat === 'test' ? 'Unit + Integration test projects created, scaffold_tests MCP called, dotnet test passes' :
|
|
237
|
-
`${cat} layer fully implemented per category-rules.md`
|
|
238
|
-
],
|
|
239
|
-
started_at: null, completed_at: null, iteration: null,
|
|
240
|
-
commit_hash: null, files_changed: [], validation: null, error: null
|
|
241
|
-
};
|
|
242
|
-
prd.tasks.push(guardrailTask);
|
|
243
|
-
console.log(` → Injected guardrail: [${taskId}] ${cat}`);
|
|
244
|
-
|
|
245
|
-
// Update frontendDep if we just injected seedData (frontend guardrail should depend on it)
|
|
246
|
-
if (cat === 'seedData') {
|
|
247
|
-
// Re-resolve for subsequent iterations
|
|
248
|
-
const updatedFrontendDep = taskId;
|
|
249
|
-
// Patch any previously-added frontend guardrail to depend on this seedData task
|
|
250
|
-
const frontendGuard = prd.tasks.find(t => t.category === 'frontend' && t.description.includes('[GUARDRAIL]'));
|
|
251
|
-
if (frontendGuard && !frontendGuard.dependencies.includes(taskId)) {
|
|
252
|
-
frontendGuard.dependencies = [taskId];
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
writeJSON('.ralph/prd.json', prd);
|
|
258
|
-
console.log(`PRD updated: ${prd.tasks.length} tasks (${missingCategories.length} guardrails added)`);
|
|
259
|
-
}
|
|
260
|
-
```
|
|
125
|
+
Quick: `checkCategoryCompleteness(prd)` → inject guardrails if needed
|
|
261
126
|
|
|
262
|
-
|
|
127
|
+
---
|
|
263
128
|
|
|
264
129
|
### 4c. Section Split Detection (Large Module)
|
|
265
130
|
|
|
266
|
-
> **Purpose:** Modules with >4 domain entities overwhelm a single `/apex -d` call.
|
|
267
|
-
> Split execution into Phase 0 (foundation) + Phase 1..N (per section).
|
|
268
|
-
|
|
269
131
|
```javascript
|
|
270
132
|
const domainTasks = prd.tasks.filter(t => t.category === 'domain');
|
|
271
133
|
const sections = prd.architecture?.sections ?? [];
|
|
272
134
|
|
|
273
135
|
if (domainTasks.length > 4 && sections.length > 1 && !prd._sectionSplit?.enabled) {
|
|
274
136
|
console.log(`SECTION SPLIT: ${domainTasks.length} domain tasks, ${sections.length} sections → activating`);
|
|
275
|
-
|
|
276
|
-
// Read references/section-splitting.md for full logic
|
|
277
|
-
// 1. Build entity-to-section mapping from architecture.sections[].resources[].entity
|
|
278
|
-
// 2. Build section dependency graph from architecture.entities[].relationships[]
|
|
279
|
-
// 3. Topological sort sections by FK dependencies
|
|
280
|
-
// 4. Create Phase 0 PRD (all domain + infrastructure + module seed data)
|
|
281
|
-
// 5. Create Section PRDs (per-section: application + api + seedData + frontend + i18n + test)
|
|
282
|
-
// 6. Set prd._sectionSplit state
|
|
283
|
-
|
|
284
137
|
// LOAD references/section-splitting.md — execute sections 2-6
|
|
285
138
|
}
|
|
286
139
|
```
|
|
287
140
|
|
|
288
|
-
**Activation
|
|
289
|
-
**No-op when:** `<= 4 domain tasks` OR `<= 1 section` OR `_sectionSplit.enabled` already set
|
|
141
|
+
**Activation:** `> 4 domain tasks` AND `> 1 architecture section`
|
|
290
142
|
|
|
291
143
|
## 5. Find Current Task
|
|
292
144
|
|
|
@@ -306,7 +158,7 @@ function findNextTask(tasks) {
|
|
|
306
158
|
}
|
|
307
159
|
```
|
|
308
160
|
|
|
309
|
-
If no eligible task:
|
|
161
|
+
If no eligible task: check if all completed → step-05, else STOP.
|
|
310
162
|
|
|
311
163
|
## 6. Show Task Status
|
|
312
164
|
|