114 lines
3.5 KiB
Markdown
114 lines
3.5 KiB
Markdown
# Skill: eip4-ai-feature-development
|
||
|
||
## 触发场景
|
||
|
||
- 用户描述一个新功能,希望 AI 自动生成。
|
||
- 用户要求从 EIP3 模板、实体、服务流或页面定义生成 EIP4 功能。
|
||
- 用户要求本地自动开发、自动修复和 smoke。
|
||
|
||
## 输入要求
|
||
|
||
最小需求应包含:
|
||
|
||
- 功能目标
|
||
- 功能名称
|
||
- 业务表名
|
||
- 实体名称
|
||
- 页面 templateId
|
||
- 菜单名称
|
||
- 字段列表
|
||
- 页面配方,可省略。默认 `maintenance-crud-v1`;树形维护页使用 `tree-crud-v1`
|
||
|
||
字段格式:
|
||
|
||
```text
|
||
column:label:type[:length][:required]
|
||
```
|
||
|
||
示例:
|
||
|
||
```text
|
||
NAME:名称:string:100:true
|
||
CODE:编码:string:64:true
|
||
ENABLED:启用:boolean::false
|
||
```
|
||
|
||
## 推荐命令
|
||
|
||
```bash
|
||
java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai auto-develop \
|
||
--base-url http://localhost:8084 \
|
||
--objective "新增客户等级维护功能" \
|
||
--feature-name "客户等级维护" \
|
||
--table-name EIP4AI_CUSTOMER_LEVEL \
|
||
--entity-name "客户等级" \
|
||
--template-id eip4ai-customer-level \
|
||
--menu-name "客户等级维护" \
|
||
--field NAME:名称:string:100:true \
|
||
--field CODE:编码:string:64:true \
|
||
--field ENABLED:启用:boolean::false \
|
||
--page-recipe maintenance-crud-v1 \
|
||
--max-repair-attempts 2 \
|
||
--output target/ai-runs/customer-level.json
|
||
```
|
||
|
||
树形维护页示例:
|
||
|
||
```bash
|
||
java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai auto-develop \
|
||
--base-url http://localhost:8084 \
|
||
--objective "新增组织分类树形维护功能" \
|
||
--feature-name "组织分类维护" \
|
||
--table-name EIP4AI_ORG_CATEGORY \
|
||
--entity-name "组织分类" \
|
||
--template-id eip4ai-org-category \
|
||
--menu-name "组织分类维护" \
|
||
--field NAME:名称:string:100:true \
|
||
--field CODE:编码:string:64:true \
|
||
--page-recipe tree-crud-v1 \
|
||
--max-repair-attempts 2 \
|
||
--output target/ai-runs/org-category-tree.json
|
||
```
|
||
|
||
## 通过标准
|
||
|
||
- `applyStatus` 为 `PASSED`。
|
||
- `smokeStatus` 为 `PASSED`。
|
||
- 最终状态为 `READY_FOR_HUMAN_REVIEW`。
|
||
- 部署包存在且 `requiresHumanApproval=true`。
|
||
- 页面 schema 只能使用组件能力表中注册的组件和动作。
|
||
- `PAGE_SCHEMA` 草稿必须声明并通过 `page-recipe` 门禁;普通维护页为 `maintenance-crud-v1`,树形维护页为 `tree-crud-v1`。
|
||
- `TEST` 草稿必须通过 `smoke-plan` 和 `render-plan`;`renderTests` 是后续 Playwright 渲染验收的输入,需包含 previewUrl、预期组件、列、动作、数据 API 和关键文本。
|
||
|
||
## 页面 schema 校验
|
||
|
||
```bash
|
||
curl http://localhost:8084/api/page/schema/components
|
||
|
||
curl -X POST http://localhost:8084/api/page/schema/validate \
|
||
-H "Content-Type: application/json" \
|
||
--data-binary @target/ai-runs/page-schema.json
|
||
```
|
||
|
||
设计器保存 overlay 时也会执行同一套 typed schema 校验;未注册组件或不支持的 `actionType` 会被拒绝。
|
||
|
||
## AI 工具权限检查
|
||
|
||
```bash
|
||
curl http://localhost:8084/api/ai/tools
|
||
curl http://localhost:8084/api/ai/employees
|
||
|
||
curl -X POST http://localhost:8084/api/ai/tools/access-check \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"employeeId":"agent-developer","toolName":"local.apply","grantedScopes":["ai:local:apply"],"targetEnv":"local","productionWrite":false}'
|
||
```
|
||
|
||
本地 apply、smoke 等工具只允许本地目标;生产写默认被阻断,线上部署仍走人工发布。
|
||
|
||
## 失败处理
|
||
|
||
1. 查看输出 JSON 中的 apply/smoke/repair evidence。
|
||
2. 如果自动修复已尝试但失败,基于 evidence 修改本地代码或元数据生成逻辑。
|
||
3. 重新运行本地 auto-develop。
|
||
4. 不直接连接线上库修复。
|