@nocobase/cli 2.2.0-test.15 → 2.2.0

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.
Files changed (44) hide show
  1. package/dist/commands/api/resource/create.js +11 -2
  2. package/dist/commands/app/start.js +1 -21
  3. package/dist/commands/config/set.js +0 -1
  4. package/dist/commands/init.js +3 -120
  5. package/dist/commands/install.js +4 -121
  6. package/dist/commands/source/dev.js +1 -1
  7. package/dist/lib/api-client.js +7 -0
  8. package/dist/lib/auth-store.js +1 -3
  9. package/dist/lib/browser.js +29 -0
  10. package/dist/lib/cli-config.js +1 -20
  11. package/dist/lib/env-config.js +0 -3
  12. package/dist/lib/env-proxy.js +1 -65
  13. package/dist/lib/generated-command.js +81 -0
  14. package/dist/lib/managed-init-env.js +1 -6
  15. package/dist/lib/naming.js +9 -0
  16. package/dist/lib/plugin-import.js +30 -8
  17. package/dist/lib/resource-command.js +18 -2
  18. package/dist/lib/resource-request.js +8 -0
  19. package/dist/lib/run-npm.js +16 -17
  20. package/dist/lib/runtime-generator.js +28 -1
  21. package/dist/lib/ui.js +1 -28
  22. package/dist/locale/en-US.json +0 -154
  23. package/dist/locale/zh-CN.json +0 -154
  24. package/nocobase-ctl.config.json +111 -0
  25. package/package.json +3 -5
  26. package/dist/commands/portal/create.js +0 -105
  27. package/dist/commands/portal/deploy.js +0 -81
  28. package/dist/commands/portal/destroy.js +0 -104
  29. package/dist/commands/portal/dev.js +0 -71
  30. package/dist/commands/portal/index.js +0 -20
  31. package/dist/commands/portal/info.js +0 -82
  32. package/dist/commands/portal/list.js +0 -98
  33. package/dist/commands/portal/pull.js +0 -77
  34. package/dist/commands/portal/push.js +0 -79
  35. package/dist/lib/portal-command-env.js +0 -31
  36. package/dist/lib/portal-create.js +0 -488
  37. package/dist/lib/portal-deploy.js +0 -275
  38. package/dist/lib/portal-destroy.js +0 -100
  39. package/dist/lib/portal-dev.js +0 -79
  40. package/dist/lib/portal-env-files.js +0 -53
  41. package/dist/lib/portal-info.js +0 -31
  42. package/dist/lib/portal-list.js +0 -197
  43. package/dist/lib/portal-source.js +0 -416
  44. package/dist/lib/portal-template.js +0 -190
@@ -168,126 +168,6 @@
168
168
  "refusal": "Refusing to run against env \"{{requestedEnv}}\" because the current env is \"{{currentEnv}}\" and interactive confirmation is unavailable in the current agent session.\n\nFor safety, the agent will not switch envs automatically and will not add --yes on your behalf.\n\nTo continue:\n- run `nb env use {{requestedEnv}}` yourself and then re-run the command, or\n- re-run the same command with `--env {{requestedEnv}} --yes` to confirm this one-off cross-env operation."
169
169
  }
170
170
  },
171
- "portalCreate": {
172
- "errors": {
173
- "envNotConfigured": "Env \"{{envName}}\" is not configured. Run `nb env add {{envName}} --api-base-url <url>` first.",
174
- "noEnvConfigured": "No NocoBase env is configured yet. Run `nb init --ui` to create one first.",
175
- "templateInvalidDirectory": "Portal template \"{{source}}\" is invalid: expected a directory.",
176
- "localTemplateMissing": "Portal template directory does not exist: {{source}}",
177
- "templateUnresolved": "Portal template \"{{source}}\" could not be resolved. {{details}}",
178
- "templateDownloadFailed": "Failed to download Portal template \"{{source}}\" with npm pack. {{details}}",
179
- "templateExtractFailed": "Failed to extract Portal template \"{{source}}\": {{details}}",
180
- "templateMissingPackageJson": "Portal template \"{{source}}\" is invalid: package.json is missing.",
181
- "npmPackNoTarball": "npm pack did not produce a local tarball for {{source}}.",
182
- "npmPackMultipleTarballs": "npm pack produced multiple tarballs for {{source}}.",
183
- "invalidPortalName": "Invalid Portal name \"{{value}}\". Use lowercase letters, numbers, underscores, or hyphens, and start with a lowercase letter or number.",
184
- "invalidPortalAppName": "Invalid Portal app name \"{{value}}\" from apiBaseUrl. Use letters, numbers, underscores, or hyphens, and start with a letter or number.",
185
- "missingApiBaseUrl": "Cannot create a Portal workspace because the selected env has no apiBaseUrl.",
186
- "outsideParent": "Refusing to modify a Portal workspace outside {{parentDir}}: {{portalDir}}",
187
- "sshUnsupported": "Cannot create a Portal workspace for ssh envs in the first version.",
188
- "workspaceExists": "Portal workspace already exists: {{portalDir}}\nPass --force to delete it and create a new workspace."
189
- },
190
- "messages": {
191
- "skipInstall": "Skipped pnpm install because package.json was not found in {{portalDir}}.",
192
- "created": "Portal \"{{portal}}\" created at {{portalDir}}.",
193
- "app": "App: {{app}}",
194
- "base": "Base: {{base}}"
195
- }
196
- },
197
- "portalDeploy": {
198
- "errors": {
199
- "envNotConfigured": "Env \"{{envName}}\" is not configured. Run `nb env add {{envName}} --api-base-url <url>` first.",
200
- "noEnvConfigured": "No NocoBase env is configured yet. Run `nb init --ui` to create one first.",
201
- "workspaceMissing": "Portal workspace does not exist: {{portalDir}}\nRun `nb portal create {{portal}}` first.",
202
- "packageJsonMissing": "Portal workspace is invalid: package.json is missing in {{portalDir}}.",
203
- "distMissing": "Portal build did not produce {{distDir}}/index.html.",
204
- "unsupportedEnvKind": "Cannot deploy a Portal workspace for {{kind}} envs in the first version.",
205
- "uploadFailed": "Portal dist upload failed with status {{status}}\n{{details}}",
206
- "recordSyncFailed": "Portal record sync failed with status {{status}}\n{{details}}"
207
- },
208
- "messages": {
209
- "deployed": "Portal \"{{portal}}\" deployed.",
210
- "mode": "Mode: {{mode}}",
211
- "app": "App: {{app}}",
212
- "base": "Base: {{base}}",
213
- "record": "Record: synced",
214
- "dist": "Dist: {{dist}}",
215
- "localDist": "Local dist: {{dist}}",
216
- "serverDist": "Server dist: {{dist}}"
217
- }
218
- },
219
- "portalList": {
220
- "errors": {
221
- "envNotConfigured": "Env \"{{envName}}\" is not configured. Run `nb env add {{envName}} --api-base-url <url>` first.",
222
- "noEnvConfigured": "No NocoBase env is configured yet. Run `nb init --ui` to create one first.",
223
- "unsupportedEnvKind": "Cannot list Portal workspaces for {{kind}} envs in the first version.",
224
- "listFailed": "Portal list failed with status {{status}}\n{{details}}"
225
- },
226
- "messages": {
227
- "empty": "No Portal records found."
228
- },
229
- "table": {
230
- "name": "Name",
231
- "url": "URL",
232
- "developmentMode": "Development mode",
233
- "path": "Local path",
234
- "enabled": "Enabled",
235
- "localSynced": "Local synced"
236
- }
237
- },
238
- "portalInfo": {
239
- "errors": {
240
- "envNotConfigured": "Env \"{{envName}}\" is not configured. Run `nb env add {{envName}} --api-base-url <url>` first.",
241
- "noEnvConfigured": "No NocoBase env is configured yet. Run `nb init --ui` to create one first.",
242
- "notFound": "Portal \"{{portal}}\" was not found."
243
- },
244
- "fields": {
245
- "name": "Name",
246
- "url": "URL",
247
- "developmentMode": "Development mode",
248
- "path": "Local path",
249
- "enabled": "Enabled",
250
- "localSynced": "Local synced"
251
- }
252
- },
253
- "portalDestroy": {
254
- "errors": {
255
- "envNotConfigured": "Env \"{{envName}}\" is not configured. Run `nb env add {{envName}} --api-base-url <url>` first.",
256
- "noEnvConfigured": "No NocoBase env is configured yet. Run `nb init --ui` to create one first.",
257
- "confirmationRequired": "Refusing to destroy a Portal in non-interactive mode without --yes.",
258
- "outsideParent": "Refusing to delete a Portal workspace outside {{parentDir}}: {{portalDir}}",
259
- "workspaceMissing": "Portal workspace does not exist: {{portalDir}}\nPass --force to ignore missing local files.",
260
- "unsupportedEnvKind": "Cannot destroy a Portal workspace for {{kind}} envs in the first version.",
261
- "recordDestroyFailed": "Portal record destroy failed with status {{status}}\n{{details}}"
262
- },
263
- "prompts": {
264
- "confirm": "Destroy Portal \"{{portal}}\" and delete its storage directory?"
265
- },
266
- "messages": {
267
- "destroyed": "Portal \"{{portal}}\" destroyed.",
268
- "mode": "Mode: {{mode}}",
269
- "app": "App: {{app}}",
270
- "base": "Base: {{base}}",
271
- "record": "Record: {{status}}",
272
- "workspace": "Workspace: {{status}} ({{dir}})"
273
- }
274
- },
275
- "portalDev": {
276
- "errors": {
277
- "envNotConfigured": "Env \"{{envName}}\" is not configured. Run `nb env add {{envName}} --api-base-url <url>` first.",
278
- "noEnvConfigured": "No NocoBase env is configured yet. Run `nb init --ui` to create one first.",
279
- "workspaceMissing": "Portal workspace does not exist: {{portalDir}}\nRun `nb portal create {{portal}}` first.",
280
- "packageJsonMissing": "Portal workspace is invalid: package.json is missing in {{portalDir}}.",
281
- "sshUnsupported": "Cannot start a Portal workspace in dev mode for ssh envs in the first version."
282
- },
283
- "messages": {
284
- "starting": "Starting Portal \"{{portal}}\"...",
285
- "mode": "Mode: {{mode}}",
286
- "app": "App: {{app}}",
287
- "base": "Base: {{base}}",
288
- "dir": "Dir: {{dir}}"
289
- }
290
- },
291
171
  "license": {
292
172
  "activate": {
293
173
  "interactive": {
@@ -461,21 +341,6 @@
461
341
  "message": "App subpath (for example, /nocobase/)",
462
342
  "placeholder": "/ or /nocobase/"
463
343
  },
464
- "developmentMode": {
465
- "message": "Who will lead development?",
466
- "noCodeLabel": "Human-led development",
467
- "noCodeHint": "Build your application using configuration and low-code tools, with AI as your assistant.",
468
- "vibeCodingLabel": "AI-led development",
469
- "vibeCodingHint": "You describe what you need, and AI writes the code and builds the application for you."
470
- },
471
- "portalName": {
472
- "message": "Initial portal name",
473
- "placeholder": "admin"
474
- },
475
- "portalTemplate": {
476
- "message": "Starter template (copied to ./storage/portals/)",
477
- "placeholder": "git@github.com:nocobase/admin-starter.git"
478
- },
479
344
  "storagePath": {
480
345
  "message": "Uploads and local files directory",
481
346
  "placeholder": "./<env>/storage/"
@@ -575,21 +440,6 @@
575
440
  },
576
441
  "skipDownload": {
577
442
  "message": "Skip downloading NocoBase and reuse existing local app files or Docker images"
578
- },
579
- "developmentMode": {
580
- "message": "Who will lead development?",
581
- "noCodeLabel": "Human-led development",
582
- "noCodeHint": "Build your application using configuration and low-code tools, with AI as your assistant.",
583
- "vibeCodingLabel": "AI-led development",
584
- "vibeCodingHint": "You describe what you need, and AI writes the code and builds the application for you."
585
- },
586
- "portalName": {
587
- "message": "Initial portal name",
588
- "placeholder": "admin"
589
- },
590
- "portalTemplate": {
591
- "message": "Starter template (copied to ./storage/portals/)",
592
- "placeholder": "git@github.com:nocobase/admin-starter.git"
593
443
  }
594
444
  },
595
445
  "webUi": {
@@ -612,10 +462,6 @@
612
462
  "title": "App source and version",
613
463
  "description": "Choose how to get the app and which source and version to use."
614
464
  },
615
- "developmentMode": {
616
- "title": "Development approach",
617
- "description": "Choose the development approach for your application."
618
- },
619
465
  "configureDatabase": {
620
466
  "title": "Configure the database",
621
467
  "description": "Use built-in or custom."
@@ -168,126 +168,6 @@
168
168
  "refusal": "拒绝对 env \"{{requestedEnv}}\" 执行该命令,因为当前 env 是 \"{{currentEnv}}\",且当前 agent 会话无法进行交互确认。\n\n出于安全考虑,agent 不会自动切换 env,也不会替你自动补上 --yes。\n\n如果要继续:\n- 请先自行执行 `nb env use {{requestedEnv}}`,然后重新运行该命令,或\n- 使用相同命令并追加 `--env {{requestedEnv}} --yes`,以确认这是一次性的跨 env 操作。"
169
169
  }
170
170
  },
171
- "portalCreate": {
172
- "errors": {
173
- "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
174
- "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
175
- "templateInvalidDirectory": "Portal 模板 \"{{source}}\" 无效:需要是一个目录。",
176
- "localTemplateMissing": "Portal 模板目录不存在:{{source}}",
177
- "templateUnresolved": "无法解析 Portal 模板 \"{{source}}\"。{{details}}",
178
- "templateDownloadFailed": "无法通过 npm pack 下载 Portal 模板 \"{{source}}\"。{{details}}",
179
- "templateExtractFailed": "解压 Portal 模板 \"{{source}}\" 失败:{{details}}",
180
- "templateMissingPackageJson": "Portal 模板 \"{{source}}\" 无效:缺少 package.json。",
181
- "npmPackNoTarball": "npm pack 没有为 {{source}} 生成本地 tarball。",
182
- "npmPackMultipleTarballs": "npm pack 为 {{source}} 生成了多个 tarball。",
183
- "invalidPortalName": "Portal 名称 \"{{value}}\" 无效。请使用小写字母、数字、下划线或连字符,并以小写字母或数字开头。",
184
- "invalidPortalAppName": "从 apiBaseUrl 解析出的 Portal app 名称 \"{{value}}\" 无效。请使用字母、数字、下划线或连字符,并以字母或数字开头。",
185
- "missingApiBaseUrl": "无法创建 Portal workspace,因为当前 env 没有 apiBaseUrl。",
186
- "outsideParent": "拒绝修改 {{parentDir}} 之外的 Portal workspace:{{portalDir}}",
187
- "sshUnsupported": "第一版暂不支持为 ssh env 创建 Portal workspace。",
188
- "workspaceExists": "Portal workspace 已存在:{{portalDir}}\n如需删除并重新创建,请追加 --force。"
189
- },
190
- "messages": {
191
- "skipInstall": "未找到 {{portalDir}}/package.json,已跳过 pnpm install。",
192
- "created": "Portal \"{{portal}}\" 已创建:{{portalDir}}。",
193
- "app": "App:{{app}}",
194
- "base": "Base:{{base}}"
195
- }
196
- },
197
- "portalDeploy": {
198
- "errors": {
199
- "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
200
- "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
201
- "workspaceMissing": "Portal workspace 不存在:{{portalDir}}\n请先运行 `nb portal create {{portal}}`。",
202
- "packageJsonMissing": "Portal workspace 无效:{{portalDir}} 中缺少 package.json。",
203
- "distMissing": "Portal build 没有生成 {{distDir}}/index.html。",
204
- "unsupportedEnvKind": "第一版暂不支持为 {{kind}} env 部署 Portal workspace。",
205
- "uploadFailed": "Portal dist 上传失败,状态码 {{status}}\n{{details}}",
206
- "recordSyncFailed": "Portal 记录同步失败,状态码 {{status}}\n{{details}}"
207
- },
208
- "messages": {
209
- "deployed": "Portal \"{{portal}}\" 已部署。",
210
- "mode": "Mode:{{mode}}",
211
- "app": "App:{{app}}",
212
- "base": "Base:{{base}}",
213
- "record": "记录:已同步",
214
- "dist": "Dist:{{dist}}",
215
- "localDist": "本地 dist:{{dist}}",
216
- "serverDist": "服务端 dist:{{dist}}"
217
- }
218
- },
219
- "portalList": {
220
- "errors": {
221
- "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
222
- "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
223
- "unsupportedEnvKind": "第一版暂不支持为 {{kind}} env 列出 Portal workspace。",
224
- "listFailed": "Portal 列表获取失败,状态码 {{status}}\n{{details}}"
225
- },
226
- "messages": {
227
- "empty": "没有找到 Portal 记录。"
228
- },
229
- "table": {
230
- "name": "名称",
231
- "url": "访问 URL",
232
- "developmentMode": "开发模式",
233
- "path": "本地路径",
234
- "enabled": "启用",
235
- "localSynced": "本地已同步"
236
- }
237
- },
238
- "portalInfo": {
239
- "errors": {
240
- "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
241
- "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
242
- "notFound": "Portal \"{{portal}}\" 不存在。"
243
- },
244
- "fields": {
245
- "name": "名称",
246
- "url": "访问 URL",
247
- "developmentMode": "开发模式",
248
- "path": "本地路径",
249
- "enabled": "启用",
250
- "localSynced": "本地已同步"
251
- }
252
- },
253
- "portalDestroy": {
254
- "errors": {
255
- "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
256
- "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
257
- "confirmationRequired": "非交互模式下拒绝删除 Portal。请追加 --yes 后重试。",
258
- "outsideParent": "拒绝删除 {{parentDir}} 之外的 Portal workspace:{{portalDir}}",
259
- "workspaceMissing": "Portal workspace 不存在:{{portalDir}}\n如需忽略本地文件缺失,请追加 --force。",
260
- "unsupportedEnvKind": "第一版暂不支持为 {{kind}} env 删除 Portal workspace。",
261
- "recordDestroyFailed": "Portal 记录删除失败,状态码 {{status}}\n{{details}}"
262
- },
263
- "prompts": {
264
- "confirm": "删除 Portal \"{{portal}}\" 并移除它的 storage 目录?"
265
- },
266
- "messages": {
267
- "destroyed": "Portal \"{{portal}}\" 已删除。",
268
- "mode": "Mode:{{mode}}",
269
- "app": "App:{{app}}",
270
- "base": "Base:{{base}}",
271
- "record": "记录:{{status}}",
272
- "workspace": "Workspace:{{status}}({{dir}})"
273
- }
274
- },
275
- "portalDev": {
276
- "errors": {
277
- "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
278
- "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
279
- "workspaceMissing": "Portal workspace 不存在:{{portalDir}}\n请先运行 `nb portal create {{portal}}`。",
280
- "packageJsonMissing": "Portal workspace 无效:{{portalDir}} 中缺少 package.json。",
281
- "sshUnsupported": "第一版暂不支持为 ssh env 启动 Portal workspace 开发服务。"
282
- },
283
- "messages": {
284
- "starting": "正在启动 Portal \"{{portal}}\"...",
285
- "mode": "Mode:{{mode}}",
286
- "app": "App:{{app}}",
287
- "base": "Base:{{base}}",
288
- "dir": "目录:{{dir}}"
289
- }
290
- },
291
171
  "license": {
292
172
  "activate": {
293
173
  "interactive": {
@@ -461,21 +341,6 @@
461
341
  "message": "应用子路径(例如 /nocobase/)",
462
342
  "placeholder": "/ 或 /nocobase/"
463
343
  },
464
- "developmentMode": {
465
- "message": "谁来主导开发?",
466
- "noCodeLabel": "人主导开发",
467
- "noCodeHint": "通过配置和低代码的方式构建应用,AI 作为你的助手提供支持。",
468
- "vibeCodingLabel": "AI 主导开发",
469
- "vibeCodingHint": "你描述自己的需求,AI 将为你编写代码并构建应用。"
470
- },
471
- "portalName": {
472
- "message": "初始化 Portal 名称",
473
- "placeholder": "admin"
474
- },
475
- "portalTemplate": {
476
- "message": "起始模板(将复制到 ./storage/portals/)",
477
- "placeholder": "git@github.com:nocobase/admin-starter.git"
478
- },
479
344
  "storagePath": {
480
345
  "message": "上传文件和本地存储目录",
481
346
  "placeholder": "./<env>/storage/"
@@ -575,21 +440,6 @@
575
440
  },
576
441
  "skipDownload": {
577
442
  "message": "跳过下载 NocoBase,直接复用已有的本地应用文件或 Docker 镜像"
578
- },
579
- "developmentMode": {
580
- "message": "谁来主导开发?",
581
- "noCodeLabel": "人主导开发",
582
- "noCodeHint": "通过配置和低代码的方式构建应用,AI 作为你的助手提供支持。",
583
- "vibeCodingLabel": "AI 主导开发",
584
- "vibeCodingHint": "你描述自己的需求,AI 将为你编写代码并构建应用。"
585
- },
586
- "portalName": {
587
- "message": "初始化 Portal 名称",
588
- "placeholder": "admin"
589
- },
590
- "portalTemplate": {
591
- "message": "起始模板(将复制到 ./storage/portals/)",
592
- "placeholder": "git@github.com:nocobase/admin-starter.git"
593
443
  }
594
444
  },
595
445
  "webUi": {
@@ -612,10 +462,6 @@
612
462
  "title": "应用来源和版本",
613
463
  "description": "选择应用的获取方式,以及要使用的来源和版本。"
614
464
  },
615
- "developmentMode": {
616
- "title": "开发方式",
617
- "description": "选择适合你的应用开发方式。"
618
- },
619
465
  "configureDatabase": {
620
466
  "title": "配置数据库",
621
467
  "description": "选择内置数据库或自定义数据库。"
@@ -202,6 +202,117 @@
202
202
  }
203
203
  }
204
204
  },
205
+ "ai": {
206
+ "name": "ai",
207
+ "description": "Discover LLM providers and manage LLM services and AI employees.",
208
+ "include": true,
209
+ "resources": {
210
+ "includes": ["ai", "llmServices", "aiEmployees"],
211
+ "excludes": [],
212
+ "overrides": {
213
+ "ai": {
214
+ "name": "llm-providers",
215
+ "description": "Discover providers and models and test unsaved LLM settings.",
216
+ "topLevel": false,
217
+ "operations": {
218
+ "includes": [
219
+ "ai:listLLMProviders",
220
+ "ai:listProviderModels",
221
+ "ai:testFlight",
222
+ "ai:listModels",
223
+ "ai:listLLMServices"
224
+ ]
225
+ }
226
+ },
227
+ "llmServices": {
228
+ "name": "llm-services",
229
+ "description": "Manage saved LLM service configurations.",
230
+ "topLevel": false,
231
+ "operations": {
232
+ "includes": [
233
+ "llmServices:list",
234
+ "llmServices:get",
235
+ "llmServices:create",
236
+ "llmServices:update",
237
+ "llmServices:destroy"
238
+ ]
239
+ }
240
+ },
241
+ "aiEmployees": {
242
+ "name": "employees",
243
+ "description": "Manage AI employees.",
244
+ "topLevel": false,
245
+ "operations": {
246
+ "includes": [
247
+ "aiEmployees:list",
248
+ "aiEmployees:get",
249
+ "aiEmployees:create",
250
+ "aiEmployees:update",
251
+ "aiEmployees:destroy"
252
+ ]
253
+ }
254
+ }
255
+ }
256
+ }
257
+ },
258
+ "kb": {
259
+ "name": "kb",
260
+ "description": "Manage vector databases, knowledge bases, documents, vectorization, and retrieval tests.",
261
+ "include": true,
262
+ "resources": {
263
+ "includes": ["aiVectorDatabases", "aiKnowledgeBase", "aiKnowledgeBaseDocs"],
264
+ "excludes": [],
265
+ "overrides": {
266
+ "aiVectorDatabases": {
267
+ "name": "vector-databases",
268
+ "description": "Manage vector database connections.",
269
+ "topLevel": false,
270
+ "operations": {
271
+ "includes": [
272
+ "aiVectorDatabases:listProviders",
273
+ "aiVectorDatabases:testConnection",
274
+ "aiVectorDatabases:list",
275
+ "aiVectorDatabases:get",
276
+ "aiVectorDatabases:create",
277
+ "aiVectorDatabases:update",
278
+ "aiVectorDatabases:destroy"
279
+ ]
280
+ }
281
+ },
282
+ "aiKnowledgeBase": {
283
+ "name": "kb",
284
+ "segments": ["kb"],
285
+ "description": "Manage knowledge bases and retrieval tests.",
286
+ "topLevel": true,
287
+ "operations": {
288
+ "includes": [
289
+ "aiKnowledgeBase:list",
290
+ "aiKnowledgeBase:get",
291
+ "aiKnowledgeBase:create",
292
+ "aiKnowledgeBase:update",
293
+ "aiKnowledgeBase:destroy",
294
+ "aiKnowledgeBase:runHitTest",
295
+ "aiKnowledgeBase:listExternalVectorStoreProviders"
296
+ ]
297
+ }
298
+ },
299
+ "aiKnowledgeBaseDocs": {
300
+ "name": "documents",
301
+ "description": "Manage knowledge base documents and vectorization.",
302
+ "topLevel": false,
303
+ "operations": {
304
+ "includes": [
305
+ "aiKnowledgeBaseDocs:list",
306
+ "aiKnowledgeBaseDocs:get",
307
+ "aiKnowledgeBaseDocs:upload",
308
+ "aiKnowledgeBaseDocs:vectorization",
309
+ "aiKnowledgeBaseDocs:destroy"
310
+ ]
311
+ }
312
+ }
313
+ }
314
+ }
315
+ },
205
316
  "flow-engine": {
206
317
  "name": "flow-engine",
207
318
  "description": "Manage flow surface composition, configuration, layout, and mutation APIs.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/cli",
3
- "version": "2.2.0-test.15",
3
+ "version": "2.2.0",
4
4
  "description": "NocoBase Command Line Tool",
5
5
  "type": "module",
6
6
  "main": "dist/generated/command-registry.js",
@@ -71,9 +71,6 @@
71
71
  "backup": {
72
72
  "description": "Create and restore NocoBase backups."
73
73
  },
74
- "portal": {
75
- "description": "Manage Portal workspaces."
76
- },
77
74
  "skills": {
78
75
  "description": "Inspect or synchronize NocoBase AI coding skills for the current workspace."
79
76
  },
@@ -146,5 +143,6 @@
146
143
  "repository": {
147
144
  "type": "git",
148
145
  "url": "git+https://github.com/nocobase/nocobase.git"
149
- }
146
+ },
147
+ "gitHead": "d5052cae37177054c236f1bf7bba3aed6ef029d0"
150
148
  }
@@ -1,105 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Args, Command, Flags } from '@oclif/core';
10
- import { getEnv } from '../../lib/auth-store.js';
11
- import { resolveDefaultConfigScope } from '../../lib/cli-home.js';
12
- import { translateCli } from '../../lib/cli-locale.js';
13
- import { ensureCrossEnvConfirmed, hasExplicitEnvSelection } from '../../lib/env-guard.js';
14
- import { createPortalWorkspace } from '../../lib/portal-create.js';
15
- import { printInfo, printSuccess } from '../../lib/ui.js';
16
- const DEFAULT_PORTAL_TEMPLATE = '@nocobase/portal-template-default';
17
- const portalCreateText = (key, values, fallback) => translateCli(`commands.portalCreate.${key}`, values, { fallback });
18
- export default class PortalCreate extends Command {
19
- static summary = 'Create a local Portal workspace from a template';
20
- static examples = [
21
- '<%= config.bin %> <%= command.id %> customer',
22
- '<%= config.bin %> <%= command.id %> customer --template @nocobase/portal-template-default',
23
- '<%= config.bin %> <%= command.id %> customer --env dev --yes',
24
- '<%= config.bin %> <%= command.id %> customer --source-storage git --git-repo git@github.com:nocobase/customer-portal.git',
25
- ];
26
- static args = {
27
- portal: Args.string({
28
- required: true,
29
- description: 'Portal name/slug',
30
- }),
31
- };
32
- static flags = {
33
- template: Flags.string({
34
- description: 'Template package, local path, or file:// URL',
35
- default: DEFAULT_PORTAL_TEMPLATE,
36
- }),
37
- env: Flags.string({
38
- char: 'e',
39
- description: 'CLI env name; omitted uses the current env',
40
- }),
41
- yes: Flags.boolean({
42
- char: 'y',
43
- description: 'Confirm using --env when it targets a different env than the current env',
44
- default: false,
45
- }),
46
- title: Flags.string({
47
- description: 'Portal display title; defaults to a title generated from the portal slug',
48
- }),
49
- force: Flags.boolean({
50
- description: 'Delete the existing Portal workspace and recreate it',
51
- default: false,
52
- }),
53
- 'source-storage': Flags.string({
54
- description: 'Where Portal source code is managed',
55
- options: ['nocobase', 'git'],
56
- default: 'nocobase',
57
- }),
58
- 'git-repo': Flags.string({
59
- description: 'Git repository URL used when --source-storage=git',
60
- }),
61
- 'git-branch': Flags.string({
62
- description: 'Git branch used when --source-storage=git',
63
- default: 'main',
64
- }),
65
- 'git-path': Flags.string({
66
- description: 'Directory inside the Git repository for this Portal; defaults to the portal slug',
67
- }),
68
- };
69
- async run() {
70
- const { args, flags } = await this.parse(PortalCreate);
71
- const requestedEnv = hasExplicitEnvSelection(this.argv) ? flags.env : undefined;
72
- const confirmed = await ensureCrossEnvConfirmed({
73
- command: this,
74
- requestedEnv,
75
- yes: flags.yes,
76
- });
77
- if (!confirmed) {
78
- return;
79
- }
80
- const env = await getEnv(flags.env, { scope: resolveDefaultConfigScope() });
81
- if (!env) {
82
- this.error(flags.env
83
- ? portalCreateText('errors.envNotConfigured', { envName: flags.env }, `Env "${flags.env}" is not configured. Run \`nb env add ${flags.env} --api-base-url <url>\` first.`)
84
- : portalCreateText('errors.noEnvConfigured', undefined, 'No NocoBase env is configured yet. Run `nb init --ui` to create one first.'));
85
- }
86
- const result = await createPortalWorkspace({
87
- portal: args.portal,
88
- title: flags.title,
89
- template: flags.template,
90
- env,
91
- envName: flags.env,
92
- cliVersion: String(this.config.pjson.version ?? '').trim(),
93
- force: flags.force,
94
- sourceStorage: flags['source-storage'],
95
- gitRepo: flags['git-repo'],
96
- gitBranch: flags['git-branch'],
97
- gitPath: flags['git-path'],
98
- onSkipInstall: (message) => printInfo(message),
99
- });
100
- printSuccess(portalCreateText('messages.created', { portal: result.portal, portalDir: result.portalDir }, `Portal "${result.portal}" created at ${result.portalDir}.`));
101
- printInfo(portalCreateText('messages.app', { app: result.app }, `App: ${result.app}`));
102
- printInfo(portalCreateText('messages.base', { base: result.portalBase }, `Base: ${result.portalBase}`));
103
- printInfo(portalCreateText('messages.sourceStorage', { sourceStorage: result.sourceStorage }, `Source storage: ${result.sourceStorage}`));
104
- }
105
- }