feat(cli): eip4 init 一键接入 Claude Code/Codex/OpenCode (G1)

- 新增 eip4 init:把 agent skills 装到目标项目
  - Claude Code → .claude/skills/<name>/SKILL.md(代码生成 frontmatter)
  - Codex/OpenCode → 根 AGENTS.md(EIP4-SKILLS 标记块,内嵌 skill 全文,块外保留,幂等)
  - base URL 按 --base-url/--env/current env 渲染
- docs/skills/*.md 的 base URL 改为 {{EIP4_BASE_URL}} 占位符
- 新增 eip4-skills/manifest.json + pom 用 maven-resources-plugin 把 docs/skills 打进 jar(init 默认从 classpath 读,无需仓库在场)
- 文档:AI_AGENT_Nocobase_INTEGRATION_GAP_AND_PLAN(NocoBase 对照 + G1-G3 计划)、skills/README、平台 README
- TDD 5 个新测试,platform-cli 共 20 单测全绿;真实 jar 端到端验证通过

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-22 14:14:26 +08:00
parent 2fc093f25e
commit 5b06aeceff
10 changed files with 478 additions and 14 deletions

View File

@@ -10,6 +10,29 @@
| `eip4-ai-feature-development` | 从自然语言需求生成实体、服务流、页面、菜单和本地 smoke |
| `eip4-release-manage` | 部署包、人审、发布前校验和回滚边界 |
## 快速接入(一键安装)
用 `eip4 init` 把这些 skills 安装到目标项目,供 Claude Code / Codex / OpenCode 直接读取。skill 示例里的 base URL 会按当前环境自动渲染(不再硬编码 8084/8093):
```bash
# 可选:先登记环境地址(init 会用 current env 渲染示例端口)
java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar env add \
--name local --base-url http://localhost:8094 --use
# 一键安装 skills + 生成 AGENTS.md
java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar init --base-url http://localhost:8094
# 然后在该目录启动你的 agent
cd <project> && claude
```
产出:
- `.claude/skills/<name>/SKILL.md`:Claude Code 原生 skill(自带 frontmatter)。
- `AGENTS.md`:Codex / OpenCode 共用入口,内容受 `EIP4-SKILLS` 标记块管理(块外内容不动,可重复执行)。块内**内嵌每个 skill 的完整正文**,因此 Codex / OpenCode 只读 `AGENTS.md` 即可拿到全部规程,不依赖 `.claude/skills/`。
参数:`--dir` 目标项目根(默认当前目录)、`--base-url` 或 `--env` 指定渲染地址、`--skills-dir` 用本地目录覆盖内置 skills。skills 已随 `platform-cli` jar 一起打包,`init` 默认从 jar 内读取,无需仓库在场。
## 通用原则
1. 优先使用 `platform-cli`,其次使用公开 REST API,最后才考虑人工 SQL。

View File

@@ -37,7 +37,7 @@ ENABLED:启用:boolean::false
```bash
java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai auto-develop \
--base-url http://localhost:8084 \
--base-url {{EIP4_BASE_URL}} \
--objective "新增客户等级维护功能" \
--feature-name "客户等级维护" \
--table-name EIP4AI_CUSTOMER_LEVEL \
@@ -56,7 +56,7 @@ java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai auto-develop \
```bash
java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai auto-develop \
--base-url http://localhost:8084 \
--base-url {{EIP4_BASE_URL}} \
--objective "新增组织分类树形维护功能" \
--feature-name "组织分类维护" \
--table-name EIP4AI_ORG_CATEGORY \
@@ -83,9 +83,9 @@ java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai auto-develop \
## 页面 schema 校验
```bash
curl http://localhost:8084/api/page/schema/components
curl {{EIP4_BASE_URL}}/api/page/schema/components
curl -X POST http://localhost:8084/api/page/schema/validate \
curl -X POST {{EIP4_BASE_URL}}/api/page/schema/validate \
-H "Content-Type: application/json" \
--data-binary @target/ai-runs/page-schema.json
```
@@ -95,10 +95,10 @@ curl -X POST http://localhost:8084/api/page/schema/validate \
## AI 工具权限检查
```bash
curl http://localhost:8084/api/ai/tools
curl http://localhost:8084/api/ai/employees
curl {{EIP4_BASE_URL}}/api/ai/tools
curl {{EIP4_BASE_URL}}/api/ai/employees
curl -X POST http://localhost:8084/api/ai/tools/access-check \
curl -X POST {{EIP4_BASE_URL}}/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}'
```

View File

@@ -10,15 +10,13 @@
1. 确认当前目录是否是独立 worktree,避免污染用户正在做的任务。
2. 使用 JDK 21,不能使用 JDK 26。
3. 默认本地 profile:
- `local`: `http://localhost:8084`
- `dev`: `http://localhost:8093`
3. 默认本地 base URL 由 `eip4 init` 渲染,当前环境为 `{{EIP4_BASE_URL}}`;多套环境用 `eip4 env add/use` 管理。
4. 使用 CLI 探测环境:
```bash
java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar env add \
--name local \
--base-url http://localhost:8084 \
--base-url {{EIP4_BASE_URL}} \
--kind local \
--use

View File

@@ -17,7 +17,7 @@
```bash
java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai feature-package \
--base-url http://localhost:8084 \
--base-url {{EIP4_BASE_URL}} \
--task-id ait-xxx \
--change-set-id aics-xxx \
--output target/ai-runs/feature-package.json
@@ -27,7 +27,7 @@ java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai feature-package
```bash
java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai revision \
--base-url http://localhost:8084 \
--base-url {{EIP4_BASE_URL}} \
--task-id ait-xxx \
--package-id aipkg-xxx \
--note "本地门禁通过,待人工部署" \