4.1 KiB
Frontend Action Slots 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: Add a generic page-slot binding layer so generated frontend menus can receive specific business actions on list rows or detail page buttons.
Architecture: Extend the existing blueprint DTOs and safe business-action DSL. Keep backend action generation table-owned, but add frontend slot grouping for Velocity templates and compatibility fallback for legacy projects.
Tech Stack: Java 8, Spring Boot, Jackson/Fastjson2, Velocity, JUnit 4, Mockito, Vue3, Element Plus.
Task 1: Add DTOs And Request Propagation
Files:
-
Create:
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/front/dto/AppPageDesign.java -
Create:
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/front/dto/BusinessActionUiBindingDesign.java -
Modify:
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/front/dto/AppBlueprintDesign.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/GenerateBusinessBlueprintRequest.java -
Modify:
ruoyi-generator/src/main/java/com/ruoyi/generator/service/front/AiGenerationTaskWorker.java -
Test:
ruoyi-generator/src/test/java/com/ruoyi/generator/service/front/AiGenerationTaskServiceImplTest.java -
Add failing test that proves app blueprint is available when a
business_blueprinttask executes. -
Run
mvn -pl ruoyi-generator -Dtest=AiGenerationTaskServiceImplTest testand verify RED. -
Add DTO fields and copy
source.getAppBlueprint()intoGenerateBusinessBlueprintRequest. -
Re-run the targeted test and verify GREEN.
Task 2: Prompt And Validation
Files:
-
Modify:
ruoyi-generator/src/main/java/com/ruoyi/generator/service/front/AiGenerateServiceImpl.java -
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 failing tests for valid
uiBindingsand unknownpageCode. -
Run
mvn -pl ruoyi-generator -Dtest=AiGenerateServiceImplTest testand verify RED. -
Include app blueprint JSON and page-slot instructions in the business blueprint prompt.
-
Normalize empty binding collections and validate page codes, slots, components, targets, and input mappings.
-
Re-run targeted tests and verify GREEN.
Task 3: Slot Grouping For Velocity
Files:
-
Modify:
ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenProjectServiceImpl.java -
Test:
ruoyi-generator/src/test/java/com/ruoyi/generator/service/GenProjectServiceImplTest.java -
Add failing test that expects
slotBusinessActionsto group actions bypageCode:slot. -
Run
mvn -pl ruoyi-generator -Dtest=GenProjectServiceImplTest testand verify RED. -
Build
slotBusinessActionsinprepareVelocityContextfor table templates. -
Keep
tableBusinessActionsas compatibility fallback. -
Re-run targeted tests and verify GREEN.
Task 4: Vue3 Template Slots
Files:
-
Modify:
sql/business_blueprint_templates.sql -
Modify:
sql/db.sql -
Test:
ruoyi-generator/src/test/java/com/ruoyi/generator/service/GenProjectServiceImplTest.java -
Add failing template assertions for
list.rowActionsanddetail.primaryActions. -
Run
mvn -pl ruoyi-generator -Dtest=GenProjectServiceImplTest testand verify RED. -
Update Vue3 list template to render row slot actions.
-
Update Vue3 detail template to render detail primary actions.
-
Sync the same template seed into
sql/db.sql. -
Re-run targeted tests and verify GREEN.
Task 5: Verification
- Run
mvn -pl ruoyi-generator -Dtest=AiGenerateServiceImplTest,AiGenerationTaskServiceImplTest,GenProjectServiceImplTest test. - Run relevant frontend unit tests if changed files require it.
- Inspect
git diff --statto ensure only expected files changed.