# Executable Business Blueprint Implementation Plan > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. **Goal:** Generate runnable workflow, status, insert, update, and numeric inventory/amount business code from business blueprints. **Architecture:** Extend the current safe DSL instead of letting AI write Java. The backend validates `ruleChecks` and expanded `effects` against saved schema, then Velocity templates render deterministic Java/Vue code. **Tech Stack:** Java 8, Spring Boot, MyBatis, Fastjson2/Jackson, Velocity, JUnit 4, Mockito, Vue. --- ### Task 1: Extend Blueprint DTO And AI Normalization **Files:** - Create: `ruoyi-generator/src/main/java/com/ruoyi/generator/domain/front/dto/BusinessActionRuleDesign.java` - Modify: `ruoyi-generator/src/main/java/com/ruoyi/generator/domain/front/dto/BusinessActionDesign.java` - Modify: `ruoyi-generator/src/main/java/com/ruoyi/generator/domain/front/dto/BusinessActionEffectDesign.java` - Modify: `ruoyi-generator/src/main/java/com/ruoyi/generator/service/front/AiGenerateServiceImpl.java` - Test: `ruoyi-generator/src/test/java/com/ruoyi/generator/service/front/AiGenerateServiceImplTest.java` - [ ] Add a failing test proving `ruleChecks`, `INSERT_ROW`, and `DECREASE_NUMBER` parse and persist. - [ ] Run `mvn -pl ruoyi-generator -Dtest=AiGenerateServiceImplTest test` and verify RED. - [ ] Add DTO fields and normalization helpers. - [ ] Re-run the targeted test and verify GREEN. ### Task 2: Validate Executable DSL Safely **Files:** - Modify: `ruoyi-generator/src/main/java/com/ruoyi/generator/service/front/AiBusinessBlueprintValidator.java` - Test: `ruoyi-generator/src/test/java/com/ruoyi/generator/service/front/AiGenerateServiceImplTest.java` - [ ] Add tests for unknown rule/effect fields and unsafe values. - [ ] Run the targeted test and verify RED. - [ ] Validate action tables, rule tables/fields, effect tables/fields, map keys, placeholders, and numeric amounts. - [ ] Re-run tests and verify GREEN. ### Task 3: Render Full Runnable Workflow Helpers **Files:** - Modify: `sql/business_blueprint_templates.sql` - Modify: `sql/db.sql` - Test: `ruoyi-generator/src/test/java/com/ruoyi/generator/service/GenProjectServiceImplTest.java` - [ ] Add a failing template test for `assertExists`, `insertRow`, `updateFields`, `setStatus`, `increaseNumberField`, and `decreaseNumberField`. - [ ] Run the targeted test and verify RED. - [ ] Extend the backend Velocity template to render rule checks and executable effects. - [ ] Sync the template block into `sql/db.sql`. - [ ] Re-run template tests and verify GREEN. ### Task 4: Frontend Display Compatibility **Files:** - Modify: `easycode-web/src/views/GenerateView.vue` - [ ] Render structured `ruleChecks` and expanded effect details without breaking old string `rules`. - [ ] Run existing frontend tests if available. ### Task 5: Full Verification - [ ] Run `mvn -pl ruoyi-generator -Dtest=AiGenerateServiceImplTest,GenProjectServiceImplTest test`. - [ ] Run any impacted frontend tests. - [ ] Inspect generated template snippets for one sample action.