@dylan-dong/ezent-cli-for-agent
v0.2.3
Published
Ezent platform CLI for AI Agent (config mutations disabled)
Downloads
54
Readme
@dylan-dong/ezent-cli
Ezent 平台 CLI 工具,供 AI Agent 和开发者通过命令行操作平台 API。
安装
# 全局安装
npm install -g @dylan-dong/ezent-cli
# 或免安装执行
npx @dylan-dong/ezent-cli <command>快速开始
# 1. 配置
ezent config set token <your-token>
ezent config set enterpriseId <your-enterprise-id>
ezent config set appId <your-app-id>
# 2. 验证
ezent user me
# 3. 使用
ezent dict list
ezent entity datasources
ezent app list命令列表
| 命令 | 说明 |
|---|---|
| ezent config | 配置管理 |
| ezent user | 用户/部门/角色查询 |
| ezent app | 应用搜索/详情 |
| ezent dict | 数据字典 CRUD |
| ezent entity | 数据源/实体模型/数据 CRUD |
| ezent env | 环境变量管理 |
| ezent i18n | 多语言管理 |
| ezent orch | 服务编排(查询/创建/调试/发布/执行) |
| ezent workflow | 工作流/审批 |
| ezent image | 图片资源 |
| ezent print | 打印模板 |
| ezent export-data | 数据导出 |
每个命令均支持 --help 查看详细参数。
全局参数
ezent --token <token> --enterprise-id <id> --app-id <id> --env <env> <command>| 参数 | 说明 |
|---|---|
| --token | 覆盖 token |
| --enterprise-id | 覆盖 enterpriseId |
| --app-id | 覆盖 appId |
| --env | 覆盖环境(DEV / TEST / PROD) |
这些全局参数仅对当前命令生效,不会写回持久化配置。
配置项
| 配置项 | 说明 | 默认值 |
|---|---|---|
| baseUrl | API 地址 | 按构建环境 |
| token | 认证 token | - |
| enterpriseId | 企业 ID | - |
| appId | 应用 ID | - |
| env | 环境 | DEV |
| autoYes | 写操作跳过 --yes 检查(仅可在交互终端开启) | false |
写操作安全门禁(0.2.0+)
所有写命令(创建 / 修改 / 删除 / 发布 / orch execute / workflow start / export-data create 等)必须带 --yes 才能执行:
ezent dict delete --id 123 --yes # ✅
ezent dict delete --id 123 # ❌ exit 2本机信任环境下可以持久化开启跳过:
ezent config set autoYes true开启过程需要交互式终端下 stdin 敲入大写 YES 确认,非交互环境(CI / Claude Code / 管道 shell)直接拒绝。开启后每条写命令仍会在 stderr 打一行提醒:⚠️ autoYes enabled, write confirmation skipped for "..."。
⚠️ 没有环境变量后门。CI 场景请在每条命令里显式写
--yes。
Agent 模式(多租户隔离)
为防止 AI Agent 通过 config set 修改持久化配置导致多租户数据互相污染,项目提供了独立的 Agent 构建包:
| | @dylan-dong/ezent-cli | @dylan-dong/ezent-cli-for-agent |
|---|---|---|
| 命令名 | ezent | ezent |
| config set/delete | 可用 | 编译时禁用,exit 2 |
| config 只读(list/get/path) | 可用 | 可用 |
| 构建 | npm run build:prod | npm run build:agent |
| 发布 | npm publish | bash scripts/publish-agent.sh |
安装 Agent 版本:
npm install -g @dylan-dong/ezent-cli-for-agentAgent 版本中 config set 和 config delete 在编译时被禁用,运行时不存在任何可修改的开关。AI Agent 必须通过全局参数传入凭证:
ezent --token <token> --enterprise-id <id> --app-id <id> --env <env> <command>发布
# 发布正常版本
npm publish --access public
# 发布 Agent 版本
bash scripts/publish-agent.shLicense
MIT
