zero-ai 1.0.74 → 1.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.r2mo/task/command/ex-api.yaml.example +13 -0
- package/.r2mo/task/task-001.md +136 -4
- package/.r2mo/task/task-002.md +4 -0
- package/.r2mo/task/task-003.md +4 -0
- package/package.json +4 -3
- package/script/clear-excel-template-data.js +128 -0
- package/script/create-ex-api-templates.js +39 -0
- package/script/inspect-excel-templates.js +102 -0
- package/script/read-ex-api-templates.js +51 -0
- package/script/scan-rbac-schema.js +102 -0
- package/src/_template/EXCEL/ex-api/README.md +13 -0
- package/src/_template/EXCEL/ex-api/template-RBAC_RESOURCE.xlsx +0 -0
- package/src/_template/EXCEL/ex-api/template-RBAC_ROLE.xlsx +0 -0
- package/src/_template/EXCEL/ex-api/template-def.json +21 -0
- package/src/_template/EXCEL/ex-crud/README.md +28 -0
- package/src/_template/EXCEL/ex-crud/ex-crud.yaml +6 -0
- package/src/_template/EXCEL/ex-crud/template-RBAC_ROLE.xlsx +0 -0
- package/src/_template/EXCEL/ex-crud/x.log.xlsx +0 -0
- package/src/commander/ex-api.json +9 -0
- package/src/commander/ex-crud.json +1 -0
- package/src/commander-ai/fn.ex.api.js +812 -0
- package/src/commander-ai/fn.ex.crud.js +501 -0
- package/src/commander-ai/fn.ex.perm.js +18 -3
- package/src/commander-ai/index.js +4 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# ai ex-crud 模板(R2MO-INIT 默认模板)
|
|
2
|
+
|
|
3
|
+
模板固定位于 **R2MO-INIT** 项目下的 `src/_template/EXCEL/ex-crud`。执行 `ai ex-crud` 时读取**目标项目**的 `.r2mo/task/command/ex-crud.yaml`,用其 `metadata` 替换模板中的占位符后,生成到目标项目的 `plugins/{pluginId}/security/RBAC_CRUD` 下。
|
|
4
|
+
|
|
5
|
+
## 占位符(五种,替换顺序避免冲突)
|
|
6
|
+
|
|
7
|
+
| 占位符/参考字面 | 说明 | 示例 |
|
|
8
|
+
|----------------|------|------|
|
|
9
|
+
| `x.log` | identifier | 如 `x.crud` |
|
|
10
|
+
| `x-log` | actor | 如 `x-crud` |
|
|
11
|
+
| `log` | keyword | 如 `log` / `crud` |
|
|
12
|
+
| `日志` | name | 中文名称 |
|
|
13
|
+
| `resource.ambient` | type | 资源类型 |
|
|
14
|
+
|
|
15
|
+
替换顺序为:先 `x.log`、再 `x-log`、再 `log`,避免先替换 `log` 导致 `x-log`/`x.log` 被破坏。
|
|
16
|
+
|
|
17
|
+
- 路径(目录/文件名):按上述顺序替换字面;也支持 `{{identifier}}`、`{{actor}}`、`{{keyword}}`、`{{name}}`、`{{type}}`。
|
|
18
|
+
- 文件内容:同上;所有 UUID 会重新生成。
|
|
19
|
+
|
|
20
|
+
## 目录与 seekSyntax
|
|
21
|
+
|
|
22
|
+
- 模板中可用参考目录名如 `x.log`、`res.log.read`,生成时会被替换为 yaml 中的 identifier / keyword。
|
|
23
|
+
- `seekSyntax.json` 所在路径及 JSON 内容中的 identifier 等也会被替换;路径与 ex-crud.yaml 的 metadata 一致即可。
|
|
24
|
+
|
|
25
|
+
## 执行流程
|
|
26
|
+
|
|
27
|
+
1. 仅根据 ex-crud.yaml 与模板生成 CRUD 文件(不访问数据库)。
|
|
28
|
+
2. 若不使用 `-s`/`--skip`:连接数据库,查/建 S_PERMISSION,列出 S_ROLE 供用户多选,写 `falcon-crud-{identifier}.xlsx` 到 `RBAC_ROLE/ADMIN.SUPER`。
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"executor": "executeExApi",
|
|
3
|
+
"description": "对已开发 API 进行授权(数据库 + Excel),需 .r2mo/task/command/ex-api.yaml",
|
|
4
|
+
"command": "ex-api",
|
|
5
|
+
"options": [
|
|
6
|
+
{"name": "request", "alias": "r", "description": "请求方法与 URI,格式:\"<METHOD> <uri>\",如 \"GET /api/ambient\""},
|
|
7
|
+
{"name": "skip", "alias": "s", "type": "boolean", "description": "仅生成 Excel,跳过去重等检查", "default": false}
|
|
8
|
+
]
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"executor":"executeExCrud","description":"按 ex-crud.yaml 从模板生成 CRUD Excel 及 RBAC 授权(RBAC_CRUD + falcon),需 .r2mo/task/command/ex-crud.yaml","command":"ex-crud","options":[{"name":"skip","alias":"s","type":"boolean","description":"仅生成 CRUD 文件,跳过数据库与角色选择","default":false}]}
|