Files
eip4-platform/docs/skills/eip4-page-recipe.md
zhengwr 0e457d9945 feat(cli): agent 接入补全(token/MCP/REST 分流)+ 修 page-recipe recipe-id
- fix: page-recipe 的 maintenance-crud 漏 `-v1`,而 compile 端点精确匹配
  maintenance-crud-v1,agent 照抄示例会 400;统一为 -v1,并引导以
  GET /api/ai/page-recipes 为权威列表,避免硬写字面量漂移。
- env-manage 新增「鉴权/Token」段:非 prod profile permitAll 免 token,
  prod/JWT 环境需 POST /api/auth/login 取顶层 `token` + `Authorization: Bearer`
  (核实 AuthController/JwtAuthFilter)。
- AGENTS.md(writeAgentsMd):把「优先 platform-cli」误导修为按类分流
  (env/ai/release 用 CLI,建模/页面/授权用 REST 或 platform-mcp),
  并点名 platform-mcp 注册方式 + token 获取指引。
- data-modeling/page-recipe/acl-manage 各加调用方式与 token 交叉引用。
- 测试 +3:page-recipe recipe-id 回归、AGENTS.md MCP/auth、bundled skills 防漂移。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 09:50:23 +08:00

49 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Skill: eip4-page-recipe
## 触发场景
- 用户要为某实体生成默认页面(维护 / 树 / 主子表)。
- 需要派生列、父级汇总。
> 调用方式:经 REST(无对应 CLI 子命令),或经 `platform-mcp`(MCP)。非 local 环境需带 `Authorization: Bearer <token>`,取 token 见 `eip4-env-manage`。
## recipe 类型
权威列表以 `GET {{EIP4_BASE_URL}}/api/ai/page-recipes` 为准;当前三种(id 带 `-v1`,须逐字传,端点精确匹配,不接受省略 `-v1` 的别名):
- `maintenance-crud-v1` — 普通维护 CRUD(列表 + 表单)。
- `tree-crud-v1` — 树形维护(有 parentid 的层级表)。
- `master-detail-v1` — 主子表(主表 + 子表行内编辑)。
## 端点
编译生成默认页:`POST {{EIP4_BASE_URL}}/api/design/recipe/compile`
```json
{
"tableName": "EIP4_DEMO",
"title": "演示页面",
"recipe": "maintenance-crud-v1",
"pageSize": 20,
"displayField": "NAME",
"childTable": "DEMO_DETAIL",
"linkColumn": "MASTERID",
"childDerived": [{"column": "AMOUNT", "formula": "QTY*PRICE"}],
"childRollup": [{"masterColumn": "TOTAL", "childColumn": "AMOUNT", "agg": "SUM"}]
}
```
- `childTable` / `linkColumn` 仅 `master-detail-v1` 需要;`childDerived` / `childRollup` 可选。
- 生成流程:读实体属性 → 装配编译 → typed schema 严格校验(不过则 400)→ 落标准层(页面唯一真相)。
- 返回 `data.templateId`。
查可用 recipe(经 AI 链路):`GET {{EIP4_BASE_URL}}/api/ai/page-recipes`。
校验页面 schema(不写库):`POST {{EIP4_BASE_URL}}/api/page/schema/validate`。
组件能力表:`GET {{EIP4_BASE_URL}}/api/page/schema/components`。
## 红线
- schema 只能使用注册过的组件 / 动作;typed 校验会拒未注册组件或不支持的 actionType。
- 生成 = 落标准层;设计器 overlay 在其上叠加,二者共用同一份 typed schema 校验。