@nocobase/cli 2.3.0-beta.5 → 2.4.0-alpha.1

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 (56) hide show
  1. package/dist/commands/api/swagger/get.js +96 -0
  2. package/dist/commands/api/swagger/index.js +20 -0
  3. package/dist/commands/api/swagger/list.js +92 -0
  4. package/dist/commands/config/set.js +1 -0
  5. package/dist/commands/env/add.js +6 -0
  6. package/dist/commands/env/update.js +13 -0
  7. package/dist/commands/init.js +51 -5
  8. package/dist/commands/install.js +60 -3
  9. package/dist/commands/portal/config.js +99 -0
  10. package/dist/commands/portal/create.js +96 -0
  11. package/dist/commands/portal/deploy.js +81 -0
  12. package/dist/commands/portal/destroy.js +126 -0
  13. package/dist/commands/portal/dev.js +73 -0
  14. package/dist/commands/portal/index.js +20 -0
  15. package/dist/commands/portal/info.js +82 -0
  16. package/dist/commands/portal/list.js +98 -0
  17. package/dist/commands/portal/pull.js +113 -0
  18. package/dist/commands/portal/push.js +79 -0
  19. package/dist/commands/source/dev.js +1 -1
  20. package/dist/lib/api-client.js +35 -9
  21. package/dist/lib/app-client-entry-mode.js +28 -0
  22. package/dist/lib/app-managed-resources.js +2 -0
  23. package/dist/lib/auth-store.js +55 -2
  24. package/dist/lib/bootstrap.js +3 -1
  25. package/dist/lib/cli-config.js +20 -1
  26. package/dist/lib/env-auth.js +2 -36
  27. package/dist/lib/env-command-config.js +1 -0
  28. package/dist/lib/env-config.js +11 -0
  29. package/dist/lib/env-portal-config.js +30 -0
  30. package/dist/lib/env-proxy.js +154 -7
  31. package/dist/lib/managed-env-file.js +119 -9
  32. package/dist/lib/managed-init-env.js +4 -1
  33. package/dist/lib/portal-build-html.js +27 -0
  34. package/dist/lib/portal-command-env.js +31 -0
  35. package/dist/lib/portal-config.js +119 -0
  36. package/dist/lib/portal-configure.js +110 -0
  37. package/dist/lib/portal-create.js +515 -0
  38. package/dist/lib/portal-deploy.js +266 -0
  39. package/dist/lib/portal-destroy.js +114 -0
  40. package/dist/lib/portal-dev.js +78 -0
  41. package/dist/lib/portal-env-files.js +54 -0
  42. package/dist/lib/portal-info.js +28 -0
  43. package/dist/lib/portal-list.js +205 -0
  44. package/dist/lib/portal-path-safety.js +76 -0
  45. package/dist/lib/portal-source.js +692 -0
  46. package/dist/lib/prompt-catalog-core.js +2 -2
  47. package/dist/lib/prompt-catalog-terminal.js +4 -5
  48. package/dist/lib/prompt-web-ui.js +12 -6
  49. package/dist/lib/proxy-caddy.js +2 -0
  50. package/dist/lib/proxy-nginx.js +1 -0
  51. package/dist/lib/run-npm.js +85 -20
  52. package/dist/lib/swagger-command.js +52 -0
  53. package/dist/lib/ui.js +28 -1
  54. package/dist/locale/en-US.json +245 -1
  55. package/dist/locale/zh-CN.json +245 -1
  56. package/package.json +5 -2
@@ -89,6 +89,9 @@
89
89
  "lowerCaseTableNamesRequiresUnderscored": "当 MySQL 的 lower_case_table_names=1 时,必须设置 DB_UNDERSCORED=true。"
90
90
  }
91
91
  },
92
+ "apiClient": {
93
+ "authRequiredHint": "认证失败或已保存的登录状态已过期。请运行 `{{command}}` 重新认证。"
94
+ },
92
95
  "commands": {
93
96
  "envAdd": {
94
97
  "prompts": {
@@ -168,6 +171,204 @@
168
171
  "refusal": "拒绝对 env \"{{requestedEnv}}\" 执行该命令,因为当前 env 是 \"{{currentEnv}}\",且当前 agent 会话无法进行交互确认。\n\n出于安全考虑,agent 不会自动切换 env,也不会替你自动补上 --yes。\n\n如果要继续:\n- 请先自行执行 `nb env use {{requestedEnv}}`,然后重新运行该命令,或\n- 使用相同命令并追加 `--env {{requestedEnv}} --yes`,以确认这是一次性的跨 env 操作。"
169
172
  }
170
173
  },
174
+ "portalCreate": {
175
+ "errors": {
176
+ "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
177
+ "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
178
+ "templateInvalidDirectory": "Portal 模板 \"{{source}}\" 无效:需要是一个目录。",
179
+ "localTemplateMissing": "Portal 模板目录不存在:{{source}}",
180
+ "templateUnresolved": "无法解析 Portal 模板 \"{{source}}\"。{{details}}",
181
+ "templateDownloadFailed": "无法通过 npm pack 下载 Portal 模板 \"{{source}}\"。{{details}}",
182
+ "templateExtractFailed": "解压 Portal 模板 \"{{source}}\" 失败:{{details}}",
183
+ "templateMissingPackageJson": "Portal 模板 \"{{source}}\" 无效:缺少 package.json。",
184
+ "npmPackNoTarball": "npm pack 没有为 {{source}} 生成本地 tarball。",
185
+ "npmPackMultipleTarballs": "npm pack 为 {{source}} 生成了多个 tarball。",
186
+ "invalidPortalName": "Portal 名称 \"{{value}}\" 无效。请使用小写字母、数字、下划线或连字符,并以小写字母或数字开头。",
187
+ "invalidPortalAppName": "从 apiBaseUrl 解析出的 Portal app 名称 \"{{value}}\" 无效。请使用字母、数字、下划线或连字符,并以字母或数字开头。",
188
+ "missingApiBaseUrl": "无法创建 Portal,因为当前 env 没有 apiBaseUrl。",
189
+ "outsideParent": "拒绝修改 {{parentDir}} 之外的 Portal:{{portalDir}}",
190
+ "sshUnsupported": "第一版暂不支持为 ssh env 创建 Portal。",
191
+ "workspaceExists": "Portal 已存在:{{portalDir}}\n如需删除并重新创建,请追加 --force。",
192
+ "workspaceNotReplaceable": "拒绝替换非 Portal 目录:{{portalDir}}\n目标目录必须为空,或包含带 nocobase 字段的 package.json。"
193
+ },
194
+ "messages": {
195
+ "skipInstall": "未找到 {{portalDir}}/package.json,已跳过 pnpm install。",
196
+ "created": "Portal \"{{portal}}\" 已创建:{{portalDir}}",
197
+ "app": "App:{{app}}",
198
+ "base": "Base:{{base}}",
199
+ "sourceStorage": "源码存储:{{sourceStorage}}",
200
+ "installFailed": "依赖安装没有成功完成。请在 {{portalDir}} 中手动运行 `pnpm install`。"
201
+ }
202
+ },
203
+ "portalConfig": {
204
+ "errors": {
205
+ "invalidSourceStorage": "源码存储 \"{{value}}\" 无效。请使用 \"nocobase\" 或 \"git\"。",
206
+ "invalidGitPath": "--git-path 必须是 Git 仓库内的相对路径。",
207
+ "gitOptionsForNocobaseStorage": "--git-repo、--git-branch 和 --git-path 只能与 --source-storage git 一起使用。",
208
+ "gitRepoRequired": "--source-storage 为 git 时必须提供 --git-repo。",
209
+ "gitRepoInvalid": "--git-repo 必须是完整的 Git remote URL。",
210
+ "updateFailed": "Portal 配置更新失败,状态码 {{status}}\n{{details}}"
211
+ }
212
+ },
213
+ "portalConfigure": {
214
+ "errors": {
215
+ "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
216
+ "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
217
+ "noChanges": "没有提供 Portal 配置变更。请传入 --path、--source-storage 或 --git-* 参数。",
218
+ "notFound": "Portal \"{{portal}}\" 不存在。请运行 `nb portal list` 查看可用 Portal。"
219
+ },
220
+ "messages": {
221
+ "updated": "Portal \"{{portal}}\" 配置已更新。",
222
+ "pathUpdated": "开发路径:{{portalDir}}",
223
+ "remoteSynced": "远端 Portal 记录:已同步",
224
+ "remoteSkipped": "远端 Portal 记录:未找到,仅更新本地配置"
225
+ }
226
+ },
227
+ "portalDeploy": {
228
+ "errors": {
229
+ "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
230
+ "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
231
+ "workspaceMissing": "Portal 不存在:{{portalDir}}\n请先运行 `nb portal create {{portal}}`。",
232
+ "packageJsonMissing": "Portal 无效:{{portalDir}} 中缺少 package.json。",
233
+ "distMissing": "Portal build 没有生成 {{distDir}}/index.html。",
234
+ "unsupportedEnvKind": "第一版暂不支持为 {{kind}} env 部署 Portal。",
235
+ "uploadFailed": "Portal dist 上传失败,状态码 {{status}}\n{{details}}",
236
+ "recordSyncFailed": "Portal 记录同步失败,状态码 {{status}}\n{{details}}"
237
+ },
238
+ "messages": {
239
+ "deployed": "Portal \"{{portal}}\" 已部署。",
240
+ "mode": "Mode:{{mode}}",
241
+ "app": "App:{{app}}",
242
+ "base": "Base:{{base}}",
243
+ "record": "记录:已同步",
244
+ "dist": "Dist:{{dist}}",
245
+ "localDist": "本地 dist:{{dist}}",
246
+ "serverDist": "服务端 dist:{{dist}}"
247
+ }
248
+ },
249
+ "portalList": {
250
+ "errors": {
251
+ "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
252
+ "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
253
+ "unsupportedEnvKind": "第一版暂不支持为 {{kind}} env 列出 Portal。",
254
+ "listFailed": "Portal 列表获取失败,状态码 {{status}}\n{{details}}"
255
+ },
256
+ "messages": {
257
+ "empty": "没有找到 Portal 记录。"
258
+ },
259
+ "table": {
260
+ "name": "名称",
261
+ "url": "访问 URL",
262
+ "portalType": "Portal 类型",
263
+ "path": "开发路径",
264
+ "enabled": "启用",
265
+ "default": "默认"
266
+ }
267
+ },
268
+ "portalPull": {
269
+ "errors": {
270
+ "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
271
+ "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
272
+ "gitRepoRequiredForTemporaryPull": "--git-branch 和 --git-path 作为临时 Git pull 参数时必须同时提供 --git-repo。如需更新 Portal 配置,请使用 `nb portal config`。"
273
+ },
274
+ "messages": {
275
+ "noop": "无需执行 pull。",
276
+ "pulled": "Portal 源码 \"{{portal}}\" 已拉取到 {{portalDir}}",
277
+ "installFailed": "依赖安装没有成功完成。请在 {{portalDir}} 中手动运行 `pnpm install`。"
278
+ }
279
+ },
280
+ "portalSource": {
281
+ "errors": {
282
+ "workspaceNotReplaceable": "拒绝替换非 Portal 目录:{{portalDir}}\n目标目录必须为空,或包含带 nocobase 字段的 package.json。"
283
+ }
284
+ },
285
+ "swagger": {
286
+ "errors": {
287
+ "pluginDisabled": "API 文档插件尚未启用。请先启用该插件,再获取 Swagger 文档。",
288
+ "requestFailed": "Swagger 请求失败,状态码 {{status}}\n{{details}}",
289
+ "invalidDestinations": "swagger:getUrls 返回了无效的文档列表。",
290
+ "invalidDocument": "swagger:get 返回了无效的 OpenAPI 文档。"
291
+ },
292
+ "messages": {
293
+ "empty": "没有可用的 Swagger 文档命名空间。",
294
+ "saved": "Swagger 文档已保存到 {{output}}。"
295
+ },
296
+ "table": {
297
+ "name": "名称",
298
+ "namespace": "命名空间",
299
+ "url": "URL",
300
+ "field": "字段",
301
+ "value": "值"
302
+ },
303
+ "fields": {
304
+ "namespace": "命名空间",
305
+ "title": "标题",
306
+ "version": "版本",
307
+ "openapi": "OpenAPI",
308
+ "paths": "路径数"
309
+ }
310
+ },
311
+ "portalInfo": {
312
+ "errors": {
313
+ "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
314
+ "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
315
+ "notFound": "Portal \"{{portal}}\" 不存在。"
316
+ },
317
+ "fields": {
318
+ "name": "名称",
319
+ "url": "访问 URL",
320
+ "portalType": "Portal 类型",
321
+ "developmentPath": "开发路径",
322
+ "deploymentPath": "部署路径",
323
+ "enabled": "启用"
324
+ }
325
+ },
326
+ "portalDestroy": {
327
+ "errors": {
328
+ "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
329
+ "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
330
+ "confirmationRequired": "非交互模式下拒绝删除 Portal。请追加 --yes 后重试。",
331
+ "outsideParent": "拒绝删除 {{parentDir}} 之外的 Portal:{{portalDir}}",
332
+ "workspaceMissing": "Portal 部署路径不存在:{{portalDir}}\n如需忽略部署文件缺失,请追加 --force。",
333
+ "unsupportedEnvKind": "第一版暂不支持为 {{kind}} env 删除 Portal。",
334
+ "unsafeDevelopmentPath": "拒绝删除不安全的 Portal 开发路径:{{portalDir}}",
335
+ "recordDestroyFailed": "Portal 记录删除失败,状态码 {{status}}\n{{details}}"
336
+ },
337
+ "prompts": {
338
+ "confirm": "删除 Portal \"{{portal}}\" 并移除它的部署目录?"
339
+ },
340
+ "statuses": {
341
+ "deleted": "已删除",
342
+ "missing": "缺失",
343
+ "retained": "已保留"
344
+ },
345
+ "messages": {
346
+ "destroyed": "Portal \"{{portal}}\" 已删除。",
347
+ "mode": "Mode:{{mode}}",
348
+ "app": "App:{{app}}",
349
+ "base": "Base:{{base}}",
350
+ "record": "记录:{{status}}",
351
+ "deploymentPath": "部署路径:{{status}}({{dir}})",
352
+ "developmentPath": "开发路径:{{status}}({{dir}})",
353
+ "developmentPathMissing": "开发路径:缺失"
354
+ }
355
+ },
356
+ "portalDev": {
357
+ "errors": {
358
+ "envNotConfigured": "env \"{{envName}}\" 尚未配置。请先运行 `nb env add {{envName}} --api-base-url <url>`。",
359
+ "noEnvConfigured": "还没有配置 NocoBase env。请先运行 `nb init --ui` 创建一个。",
360
+ "workspaceMissing": "Portal 不存在:{{portalDir}}\n请先运行 `nb portal create {{portal}}`。",
361
+ "packageJsonMissing": "Portal 无效:{{portalDir}} 中缺少 package.json。",
362
+ "sshUnsupported": "第一版暂不支持为 ssh env 启动 Portal 开发服务。"
363
+ },
364
+ "messages": {
365
+ "starting": "正在启动 Portal \"{{portal}}\"...",
366
+ "mode": "Mode:{{mode}}",
367
+ "app": "App:{{app}}",
368
+ "base": "Base:{{base}}",
369
+ "dir": "目录:{{dir}}"
370
+ }
371
+ },
171
372
  "license": {
172
373
  "activate": {
173
374
  "interactive": {
@@ -267,7 +468,7 @@
267
468
  "betaLabel": "beta",
268
469
  "betaHint": "测试版。包含即将发布的新功能,适合提前体验和反馈。",
269
470
  "alphaLabel": "alpha",
270
- "alphaHint": "开发版。功能更新最快,但可能不完整或不稳定。",
471
+ "alphaHint": "如果要体验 3.0 新功能,选择这个版本。",
271
472
  "otherLabel": "其他",
272
473
  "otherHint": "手动填写其他版本号、Docker tag 或 Git ref,例如分支名。"
273
474
  },
@@ -341,6 +542,21 @@
341
542
  "message": "应用子路径(例如 /nocobase/)",
342
543
  "placeholder": "/ 或 /nocobase/"
343
544
  },
545
+ "portalType": {
546
+ "message": "Portal 类型",
547
+ "noCodeLabel": "无代码 Portal",
548
+ "noCodeHint": "通过可视化配置创建,AI 可以协助调整配置。访问路径:/v/<name>",
549
+ "aiLabel": "AI Portal",
550
+ "aiHint": "通过 AI Agent 和代码创建,可用自然语言提出修改要求。访问路径:/x/<name>"
551
+ },
552
+ "portalName": {
553
+ "message": "Portal 名称",
554
+ "placeholder": "admin"
555
+ },
556
+ "portalTemplate": {
557
+ "message": "起始模板(将复制到 ./storage/portals/)",
558
+ "placeholder": "git@github.com:nocobase/admin-starter.git"
559
+ },
344
560
  "storagePath": {
345
561
  "message": "上传文件和本地存储目录",
346
562
  "placeholder": "./<env>/storage/"
@@ -440,6 +656,30 @@
440
656
  },
441
657
  "skipDownload": {
442
658
  "message": "跳过下载 NocoBase,直接复用已有的本地应用文件或 Docker 镜像"
659
+ },
660
+ "appClientEntryMode": {
661
+ "message": "应用界面入口",
662
+ "modernOnlyLabel": "仅使用新版界面",
663
+ "modernOnlyHint": "只能进入新版界面,不可进入旧版界面。",
664
+ "modernDefaultLabel": "默认进入新版界面",
665
+ "modernDefaultHint": "默认进入新版界面,同时保留旧版界面入口。",
666
+ "legacyDefaultLabel": "默认进入旧版界面",
667
+ "legacyDefaultHint": "默认进入旧版界面,也可以进入新版界面。"
668
+ },
669
+ "portalType": {
670
+ "message": "Portal 类型",
671
+ "noCodeLabel": "无代码 Portal",
672
+ "noCodeHint": "通过可视化配置创建,AI 可以协助调整配置。访问路径:/v/<name>",
673
+ "aiLabel": "AI Portal",
674
+ "aiHint": "通过 AI Agent 和代码创建,可用自然语言提出修改要求。访问路径:/x/<name>"
675
+ },
676
+ "portalName": {
677
+ "message": "Portal 名称",
678
+ "placeholder": "admin"
679
+ },
680
+ "portalTemplate": {
681
+ "message": "起始模板(将复制到 ./storage/portals/)",
682
+ "placeholder": "git@github.com:nocobase/admin-starter.git"
443
683
  }
444
684
  },
445
685
  "webUi": {
@@ -462,6 +702,10 @@
462
702
  "title": "应用来源和版本",
463
703
  "description": "选择应用的获取方式,以及要使用的来源和版本。"
464
704
  },
705
+ "portalType": {
706
+ "title": "配置 Portal",
707
+ "description": "设置默认 Portal 的标识和类型。"
708
+ },
465
709
  "configureDatabase": {
466
710
  "title": "配置数据库",
467
711
  "description": "选择内置数据库或自定义数据库。"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/cli",
3
- "version": "2.3.0-beta.5",
3
+ "version": "2.4.0-alpha.1",
4
4
  "description": "NocoBase Command Line Tool",
5
5
  "type": "module",
6
6
  "main": "dist/generated/command-registry.js",
@@ -71,6 +71,9 @@
71
71
  "backup": {
72
72
  "description": "Create and restore NocoBase backups."
73
73
  },
74
+ "portal": {
75
+ "description": "Manage portals."
76
+ },
74
77
  "skills": {
75
78
  "description": "Inspect or synchronize NocoBase AI coding skills for the current workspace."
76
79
  },
@@ -144,5 +147,5 @@
144
147
  "type": "git",
145
148
  "url": "git+https://github.com/nocobase/nocobase.git"
146
149
  },
147
- "gitHead": "7047516aba0d14965ddf457b64587103a871b923"
150
+ "gitHead": "82ecd3aed067e4cc98c32e7a0039b6e55cee76a7"
148
151
  }