Files
eip4-platform/docs/skills/eip4-data-modeling.md
zhengwr 8a6c94ebde feat(cli): eip4 skills list/check + 3 个新 agent skill (G3)
- 新增 skill(均基于源码核实过的端点):
  - eip4-data-modeling — /api/meta/entity 建实体/加字段/引用列/主子表
  - eip4-page-recipe   — /api/design/recipe/compile 生成默认页(维护/树/主子表)
  - eip4-acl-manage    — /api/admin/* 菜单/角色/用户组授权
  manifest.json + jar 打包同步,docs/skills 现共 6 个
- CLI 新增 eip4 skills list(列内置 skills)+ skills check --dir(缺失退出非 0)
- TDD 2 个新测试,platform-cli 共 22 单测全绿
- 真实验证:skills list 列 6 个 / init 装 6 个 / skills check 全 installed(exit 0)/ 端口渲染零占位符残留
- serviceflow-diagnose 暂缓:平台无「查看/诊断服务流定义」的 agent 可操作端点(需先补端点)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22 14:47:31 +08:00

54 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-data-modeling
## 触发场景
- 用户要新建业务实体(表)、给已有表加字段。
- 需要引用列(外键)、主子表结构。
## 端点
建实体:`POST {{EIP4_BASE_URL}}/api/meta/entity`
```json
{
"tablename": "EIP4AI_DEMO",
"name": "演示实体",
"attributes": [
{"column": "TITLE", "display": "标题", "type": "string", "length": 200, "mandatory": true},
{"column": "OWNER", "display": "负责人", "type": "reference", "referenceTable": "SYS_USER"}
],
"tabletype": 0,
"masterTable": "PARENT_TABLE"
}
```
- `tablename` 必须 EIP4 前缀,大写,匹配 `[A-Z][A-Z0-9_]{2,40}`。
- `type`:`string | integer | number | date | datetime | boolean | reference`。
- `reference` 必带 `referenceTable`,自动生成 CHAR(36) 外键列指向目标表。
- `tabletype`:`0`=主表 `1`=子表 `2`=中间表;子表用 `masterTable` 指定主表,自动加 `MASTERID` 回链列。
- 标准列(主键/版本/审计时间/操作人)由引擎自动补齐,**不要手传**。
加字段:`POST {{EIP4_BASE_URL}}/api/meta/entity/{table}/attributes`,body 为 `{"attributes":[...]}`。
- ALTER ADD COLUMN 恒可空(有数据的表加 NOT NULL 会失败)。
查询:
- `GET {{EIP4_BASE_URL}}/api/meta/entities` — 实体目录(引用列目标表选择)。
- `GET {{EIP4_BASE_URL}}/api/meta/entity/{table}` — 单实体属性(columns + displayColumn)。
- `GET {{EIP4_BASE_URL}}/api/meta/entity-types` — 实体分类。
删除:`DELETE {{EIP4_BASE_URL}}/api/meta/entity/{table}`(仅 EIP4 前缀表)。
## 命令示例
```bash
curl -X POST {{EIP4_BASE_URL}}/api/meta/entity \
-H "Content-Type: application/json" \
--data-binary @entity.json
```
## 红线
- 表名必须 EIP4 前缀,DDL 经 CreateTableSqlGuard / AlterTableSqlGuard / DropTableSqlGuard 强制校验。
- 建表/加列/删表只对 EIP4 前缀表;生产表禁碰。
- 不手传标准审计列。