@nocobase/cli 2.1.0-alpha.3 → 2.1.0-alpha.31

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 (182) hide show
  1. package/LICENSE.txt +107 -0
  2. package/README.md +379 -19
  3. package/README.zh-CN.md +329 -0
  4. package/bin/run.cmd +3 -0
  5. package/bin/run.js +131 -0
  6. package/dist/commands/api/resource/create.js +15 -0
  7. package/dist/commands/api/resource/destroy.js +15 -0
  8. package/dist/commands/api/resource/get.js +15 -0
  9. package/dist/commands/api/resource/index.js +20 -0
  10. package/dist/commands/api/resource/list.js +16 -0
  11. package/dist/commands/api/resource/query.js +15 -0
  12. package/dist/commands/api/resource/update.js +15 -0
  13. package/dist/commands/app/down.js +266 -0
  14. package/dist/commands/app/logs.js +98 -0
  15. package/dist/commands/app/restart.js +75 -0
  16. package/dist/commands/app/start.js +253 -0
  17. package/dist/commands/app/stop.js +99 -0
  18. package/dist/commands/app/upgrade.js +582 -0
  19. package/{src/cli.js → dist/commands/build.js} +4 -11
  20. package/dist/commands/config/delete.js +30 -0
  21. package/dist/commands/config/get.js +29 -0
  22. package/dist/commands/config/index.js +20 -0
  23. package/dist/commands/config/list.js +29 -0
  24. package/dist/commands/config/set.js +35 -0
  25. package/dist/commands/db/check.js +238 -0
  26. package/dist/commands/db/logs.js +85 -0
  27. package/dist/commands/db/ps.js +60 -0
  28. package/dist/commands/db/shared.js +96 -0
  29. package/dist/commands/db/start.js +71 -0
  30. package/dist/commands/db/stop.js +71 -0
  31. package/{templates/plugin/src/client/models/index.ts → dist/commands/dev.js} +4 -4
  32. package/{src/index.js → dist/commands/down.js} +4 -6
  33. package/{src/commands/locale/react-js-cron/index.js → dist/commands/download.js} +4 -8
  34. package/dist/commands/env/add.js +312 -0
  35. package/dist/commands/env/auth.js +55 -0
  36. package/dist/commands/env/info.js +156 -0
  37. package/dist/commands/env/list.js +50 -0
  38. package/dist/commands/env/remove.js +59 -0
  39. package/dist/commands/env/shared.js +158 -0
  40. package/dist/commands/env/update.js +67 -0
  41. package/dist/commands/env/use.js +28 -0
  42. package/dist/commands/examples/prompts-stages.js +150 -0
  43. package/dist/commands/examples/prompts-test.js +181 -0
  44. package/dist/commands/init.js +1027 -0
  45. package/dist/commands/install.js +2206 -0
  46. package/dist/commands/license/activate.js +360 -0
  47. package/dist/commands/license/env.js +94 -0
  48. package/dist/commands/license/generate-id.js +108 -0
  49. package/dist/commands/license/id.js +56 -0
  50. package/dist/commands/license/index.js +20 -0
  51. package/dist/commands/license/plugins/clean.js +101 -0
  52. package/dist/commands/license/plugins/index.js +20 -0
  53. package/dist/commands/license/plugins/list.js +50 -0
  54. package/dist/commands/license/plugins/shared.js +325 -0
  55. package/dist/commands/license/plugins/sync.js +269 -0
  56. package/dist/commands/license/shared.js +414 -0
  57. package/dist/commands/license/status.js +50 -0
  58. package/dist/commands/logs.js +12 -0
  59. package/dist/commands/plugin/disable.js +66 -0
  60. package/dist/commands/plugin/enable.js +66 -0
  61. package/dist/commands/plugin/list.js +62 -0
  62. package/dist/commands/pm/disable.js +12 -0
  63. package/dist/commands/pm/enable.js +12 -0
  64. package/dist/commands/pm/list.js +12 -0
  65. package/dist/commands/restart.js +12 -0
  66. package/dist/commands/scaffold/migration.js +38 -0
  67. package/dist/commands/scaffold/plugin.js +37 -0
  68. package/dist/commands/self/check.js +71 -0
  69. package/dist/commands/self/index.js +20 -0
  70. package/dist/commands/self/update.js +86 -0
  71. package/dist/commands/skills/check.js +69 -0
  72. package/dist/commands/skills/index.js +20 -0
  73. package/dist/commands/skills/install.js +71 -0
  74. package/dist/commands/skills/remove.js +71 -0
  75. package/dist/commands/skills/update.js +78 -0
  76. package/dist/commands/source/build.js +58 -0
  77. package/dist/commands/source/dev.js +158 -0
  78. package/dist/commands/source/download.js +866 -0
  79. package/dist/commands/source/test.js +477 -0
  80. package/dist/commands/start.js +12 -0
  81. package/dist/commands/stop.js +12 -0
  82. package/dist/commands/test.js +12 -0
  83. package/dist/commands/upgrade.js +12 -0
  84. package/dist/generated/command-registry.js +133 -0
  85. package/dist/help/runtime-help.js +23 -0
  86. package/dist/lib/api-client.js +329 -0
  87. package/dist/lib/app-health.js +126 -0
  88. package/dist/lib/app-managed-resources.js +268 -0
  89. package/dist/lib/app-runtime.js +171 -0
  90. package/dist/lib/auth-store.js +328 -0
  91. package/dist/lib/bootstrap.js +384 -0
  92. package/dist/lib/build-config.js +18 -0
  93. package/dist/lib/builtin-db.js +86 -0
  94. package/dist/lib/cli-config.js +176 -0
  95. package/dist/lib/cli-home.js +47 -0
  96. package/dist/lib/cli-locale.js +129 -0
  97. package/dist/lib/command-discovery.js +39 -0
  98. package/dist/lib/db-connection-check.js +178 -0
  99. package/dist/lib/env-auth.js +872 -0
  100. package/dist/lib/env-config.js +87 -0
  101. package/dist/lib/generated-command.js +171 -0
  102. package/dist/lib/http-request.js +49 -0
  103. package/dist/lib/naming.js +70 -0
  104. package/dist/lib/openapi.js +62 -0
  105. package/dist/lib/plugin-storage.js +127 -0
  106. package/dist/lib/post-processors.js +23 -0
  107. package/dist/lib/prompt-catalog.js +581 -0
  108. package/dist/lib/prompt-validators.js +185 -0
  109. package/dist/lib/prompt-web-ui.js +2103 -0
  110. package/dist/lib/resource-command.js +343 -0
  111. package/dist/lib/resource-request.js +104 -0
  112. package/dist/lib/run-npm.js +250 -0
  113. package/dist/lib/runtime-env-vars.js +32 -0
  114. package/dist/lib/runtime-generator.js +498 -0
  115. package/dist/lib/runtime-store.js +56 -0
  116. package/dist/lib/self-manager.js +301 -0
  117. package/dist/lib/skills-manager.js +296 -0
  118. package/dist/lib/startup-update.js +281 -0
  119. package/dist/lib/ui.js +178 -0
  120. package/dist/locale/en-US.json +339 -0
  121. package/dist/locale/zh-CN.json +339 -0
  122. package/dist/post-processors/data-modeling.js +66 -0
  123. package/dist/post-processors/data-source-manager.js +114 -0
  124. package/dist/post-processors/index.js +19 -0
  125. package/nocobase-ctl.config.json +369 -0
  126. package/package.json +95 -26
  127. package/LICENSE +0 -661
  128. package/bin/index.js +0 -39
  129. package/nocobase.conf.tpl +0 -95
  130. package/src/commands/benchmark.js +0 -73
  131. package/src/commands/build.js +0 -49
  132. package/src/commands/clean.js +0 -30
  133. package/src/commands/client.js +0 -166
  134. package/src/commands/create-nginx-conf.js +0 -37
  135. package/src/commands/create-plugin.js +0 -33
  136. package/src/commands/dev.js +0 -200
  137. package/src/commands/doc.js +0 -76
  138. package/src/commands/e2e.js +0 -265
  139. package/src/commands/global.js +0 -43
  140. package/src/commands/index.js +0 -45
  141. package/src/commands/instance-id.js +0 -47
  142. package/src/commands/locale/cronstrue.js +0 -122
  143. package/src/commands/locale/react-js-cron/en-US.json +0 -75
  144. package/src/commands/locale/react-js-cron/zh-CN.json +0 -33
  145. package/src/commands/locale/react-js-cron/zh-TW.json +0 -33
  146. package/src/commands/locale.js +0 -81
  147. package/src/commands/p-test.js +0 -88
  148. package/src/commands/perf.js +0 -63
  149. package/src/commands/pkg.js +0 -321
  150. package/src/commands/pm2.js +0 -37
  151. package/src/commands/postinstall.js +0 -88
  152. package/src/commands/start.js +0 -148
  153. package/src/commands/tar.js +0 -36
  154. package/src/commands/test-coverage.js +0 -55
  155. package/src/commands/test.js +0 -107
  156. package/src/commands/umi.js +0 -33
  157. package/src/commands/update-deps.js +0 -72
  158. package/src/commands/upgrade.js +0 -47
  159. package/src/commands/view-license-key.js +0 -44
  160. package/src/license.js +0 -76
  161. package/src/logger.js +0 -75
  162. package/src/plugin-generator.js +0 -80
  163. package/src/util.js +0 -517
  164. package/templates/bundle-status.html +0 -338
  165. package/templates/create-app-package.json +0 -39
  166. package/templates/plugin/.npmignore.tpl +0 -2
  167. package/templates/plugin/README.md.tpl +0 -1
  168. package/templates/plugin/client.d.ts +0 -2
  169. package/templates/plugin/client.js +0 -1
  170. package/templates/plugin/package.json.tpl +0 -11
  171. package/templates/plugin/server.d.ts +0 -2
  172. package/templates/plugin/server.js +0 -1
  173. package/templates/plugin/src/client/client.d.ts +0 -249
  174. package/templates/plugin/src/client/index.tsx.tpl +0 -1
  175. package/templates/plugin/src/client/locale.ts +0 -21
  176. package/templates/plugin/src/client/plugin.tsx.tpl +0 -10
  177. package/templates/plugin/src/index.ts +0 -2
  178. package/templates/plugin/src/locale/en-US.json +0 -1
  179. package/templates/plugin/src/locale/zh-CN.json +0 -1
  180. package/templates/plugin/src/server/collections/.gitkeep +0 -0
  181. package/templates/plugin/src/server/index.ts.tpl +0 -1
  182. package/templates/plugin/src/server/plugin.ts.tpl +0 -19
package/LICENSE.txt ADDED
@@ -0,0 +1,107 @@
1
+ Updated Date: February 24, 2026
2
+
3
+ NocoBase License Agreement
4
+
5
+ NOCOBASE PTE. LTD.,a Singaporean Exempt Private Company Limited by Shares with its principal place of business located at 112 ROBINSON ROAD, #03-01, SINGAPORE ("The Company") https://www.nocobase.com/ issues this License Agreement ("Agreement") to you. You, as an individual or a company ("The User"), will be deemed to voluntarily accept all terms of this Agreement by using NocoBase (including but not limited to obtaining NocoBase source code or installation package in any form, installing and using NocoBase, purchasing NocoBase commercial license and services, purchasing NocoBase commercial plugins). If the User does not agree to any term of this Agreement, or cannot accurately understand our interpretation of the relevant terms, please stop using it immediately.
6
+
7
+ This Agreement applies to any use, quotation, contract, invoice, and all software delivered by the Company. The User and the Company or NocoBase's agents can no longer sign a separate license agreement for the sale and delivery of the software.
8
+
9
+ The Company reserves the right to formulate and modify this Agreement from time to time as needed. If there are changes, the Company will announce them in the form of website announcements, without further individual notification. The changed Agreement will automatically take effect once it is announced, becoming part of this Agreement.
10
+
11
+ ==============
12
+ 1. Definitions
13
+ ==============
14
+
15
+ 1.1 "Software" refers to the NocoBase kernel and plugins placed in the same code repository as the kernel, including their source code, installation packages, images, and all their modifications, updates, and upgrades.
16
+
17
+ 1.2 "Community Edition" refers to the free version of the Software provided to the User through public channels.
18
+
19
+ 1.3 "Commercial Edition" refers to the paid version of the Software purchased by the User from the Company or its agents, downloaded through exclusive channels, and includes additional benefits. It consists of three versions: Standard Edition, Professional Edition, and Enterprise Edition.
20
+
21
+ 1.4 "Upper Layer Application" refers to a specific business use case application serving internal or external customers of the User, developed based on Software and Commercial Plugins, such as ERP/CRM.
22
+
23
+ 1.5 "Customer" refers to the clients who purchase the User's Upper Layer Application.
24
+
25
+ 1.6 "Third-Party Open Source Software" refers to open source software provided with Software and Commercial Plugins. They are licensed through various published open source software licenses or copyright notices accompanying such software.
26
+
27
+ ===================================
28
+ 2. Intellectual Property Protection
29
+ ===================================
30
+
31
+ Except for Third-Party Open Source Software, the Company owns all copyrights, trademark rights, patent rights, trade secrets, and other intellectual property rights of the Software, and has registered and protected them in relevant countries and regions according to the "Paris Convention" or "TRIPS Agreement", ensuring that the intellectual property rights of the Software and Commercial Plugins are internationally recognized and protected.
32
+
33
+ =============
34
+ 3. Disclaimer
35
+ =============
36
+
37
+ 3.1 The User shall not use the Software and Commercial Plugins to engage in activities that contravene applicable laws and regulations or offend against public order or religious prohibitions. All legal liabilities and consequences arising from the User’s use shall be borne by the User.
38
+
39
+ 3.2 The Company shall not be liable for any direct, indirect, special, incidental, or consequential damages (including but not limited to loss of profits, business interruption, data loss, or business information disclosure) caused by the User's use of the Software and Commercial Plugins, even if it has been previously informed of the possibility of such damages.
40
+
41
+ ===============
42
+ 4. License Type
43
+ ===============
44
+
45
+ 4.1 This Agreement serves as the unified license agreement for NocoBase Software, applying to both the Community Edition and the Commercial Editions.
46
+
47
+ 4.2 This Agreement incorporates and references the full text of the Apache License, Version 2.0 ("Apache-2.0", available at: https://www.apache.org/licenses/LICENSE-2.0 ). Users must comply with the Apache-2.0 License as well as the supplementary terms set forth in this Agreement. In case of any inconsistency between Apache-2.0 and this Agreement, the supplementary terms of this Agreement shall prevail.
48
+
49
+ ================================================
50
+ 5. Rights and Obligations of Open Source License
51
+ ================================================
52
+
53
+ 5.1 The Software can be used for commercial purposes.
54
+
55
+ 5.2 It is not allowed to remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface, except for the main LOGO in the upper left corner of the page.
56
+
57
+ 5.3 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
58
+
59
+ 5.4 It is not allowed to provide to the public any form of no-code, zero-code, low-code, AI platform SaaS/PaaS products using the original or modified Software.
60
+
61
+ ===============================
62
+ 6. Rights of Commercial License
63
+ ===============================
64
+
65
+ 6.1 Obtain a permanent commercial license of the Software.
66
+
67
+ 6.2 Get software upgrades and exclusive technical support during the upgrade validity period.
68
+
69
+ 6.3 The licensed Software can be used for commercial purposes with no restrictions on the number of applications and users.
70
+
71
+ 6.4 Can remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface.
72
+
73
+ 6.5 The User holding a Professional or Enterprise Edition License can sell Upper Layer Application to its Customers.
74
+
75
+ 6.6 If there are other agreements in the contract for the above rights, the contract agreement shall prevail.
76
+
77
+ ====================================
78
+ 7. Obligations of Commercial License
79
+ ====================================
80
+
81
+ 7.1 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
82
+
83
+ 7.2 It is not allowed to sell, transfer, lease, share, gift, or distribute the Commercial License.
84
+
85
+ 7.3 It is not allowed to sell, transfer, lease, share, or distribute any form of no-code, zero-code, low-code, AI platform, or developer tools developed based on Software.
86
+
87
+ 7.4 It is not allowed to provide any form of no-code, zero-code, low-code, AI platform SaaS/PaaS products to the public using the original or modified Software.
88
+
89
+ 7.5 It is not allowed for the User holding a Standard Edition license to sell Upper Layer Application to Customers without a Commercial license.
90
+
91
+ 7.6 It is not allowed for the User holding a Professional or Enterprise Edition license to sell Upper Layer Application to Customers without a Commercial license with access to further development and configuration.
92
+
93
+ 7.7 If there is a violation of the above obligations or the terms of this Agreement, the rights owned by the User will be immediately terminated, the paid fees will not be refunded, and the Company reserves the right to pursue the User's legal responsibility.
94
+
95
+ 7.8 If there are other agreements in the contract for the above obligations, the contract agreement shall prevail.
96
+
97
+ =============================================================
98
+ 8. Legal Jurisdiction, Interpretation, and Dispute Resolution
99
+ =============================================================
100
+
101
+ 8.1 Except for Mainland China, the interpretation, application, and all matters related to this agreement are subject to the jurisdiction of Singapore law.
102
+
103
+ 8.2 Any dispute related to this Agreement should first be resolved through friendly negotiation. If the negotiation fails to resolve the dispute, the dispute should be submitted to the International Chamber of Commerce (ICC) for arbitration. The arbitration venue should be Singapore, conducted in English.
104
+
105
+ 8.3 All terms and conditions of this Agreement shall be deemed enforceable to the maximum extent permitted by applicable law. If any term of this Agreement is deemed invalid by any applicable law, the invalidity of that term does not affect the validity of any other term of this Agreement, and it should be deemed that the invalid term has been modified as much as possible to make it valid and enforceable, or if the term cannot be modified, it should be deemed to have been deleted from this Agreement.
106
+
107
+ 8.4 The arbitration award is final, binding on both parties, and can be enforced in any court with jurisdiction.
package/README.md CHANGED
@@ -1,30 +1,390 @@
1
- # NocoBase
1
+ # NocoBase CLI
2
2
 
3
- <video width="100%" controls>
4
- <source src="https://static-docs.nocobase.com/NocoBase0510.mp4" type="video/mp4">
5
- </video>
3
+ NocoBase CLI (`nb`) is a command-line tool for setting up and managing NocoBase
4
+ apps in a local workspace. It helps you connect coding agents to NocoBase by
5
+ preparing the app, saving the CLI env config, and providing day-to-day commands
6
+ for start, stop, logs, upgrade, and cleanup.
6
7
 
8
+ The CLI supports two common setup paths:
7
9
 
8
- ## What is NocoBase
10
+ - Connect an existing NocoBase app so coding agents can use it.
11
+ - Install a new NocoBase app from Docker, npm, or Git, then connect it as a CLI env.
9
12
 
10
- NocoBase is a scalability-first, open-source no-code development platform.
11
- Instead of investing years of time and millions of dollars in research and development, deploy NocoBase in a few minutes and you'll have a private, controllable, and extremely scalable no-code development platform!
13
+ ## Prerequisites
12
14
 
13
- Homepage:
14
- https://www.nocobase.com/
15
+ - Node.js v20+
16
+ - Yarn 1.x
17
+ - Git, required when installing from Git source
18
+ - Docker, required when installing with Docker or using the built-in database
15
19
 
16
- Online Demo:
17
- https://demo.nocobase.com/new
20
+ ## Installation
18
21
 
19
- Documents:
20
- https://docs.nocobase.com/
22
+ Install the CLI globally:
21
23
 
22
- Commericial license & plugins:
23
- https://www.nocobase.com/en/commercial
24
+ ```bash
25
+ npm install -g @nocobase/cli@alpha
26
+ ```
24
27
 
25
- License agreement:
26
- https://www.nocobase.com/en/agreement
28
+ Check the available commands:
27
29
 
30
+ ```bash
31
+ nb --help
32
+ nb init --help
33
+ ```
28
34
 
29
- ## Contact Us:
30
- hello@nocobase.com
35
+ ## Core Concepts
36
+
37
+ - **Workspace**: the current project folder where `.nocobase` is stored.
38
+ - **Env**: a named NocoBase connection saved by the CLI. In `nb init`, the app name is also the env name.
39
+ - **Source**: how the local app is obtained. Supported values are `docker`, `npm`, and `git`.
40
+ - **Remote env**: an env that only stores an API connection to an existing NocoBase app.
41
+ - **Runtime resources**: local app process, Docker app container, built-in database container, source directory, and storage directory managed by CLI commands.
42
+
43
+ ## Quick Start
44
+
45
+ ### Guided Setup
46
+
47
+ Run the guided terminal flow:
48
+
49
+ ```bash
50
+ nb init
51
+ ```
52
+
53
+ Use the browser-based setup form:
54
+
55
+ ```bash
56
+ nb init --ui
57
+ ```
58
+
59
+ `nb init` can either connect to an existing NocoBase app or install a new one.
60
+ When creating a new app, it can also install NocoBase AI coding skills
61
+ (`nocobase/skills`) globally.
62
+
63
+ Use `--skip-skills` if the skills are managed separately, or when running in CI
64
+ or offline environments where `nb init` should not install or update them.
65
+
66
+ ### Non-Interactive Setup
67
+
68
+ When prompts are skipped, an app/env name is required:
69
+
70
+ ```bash
71
+ nb init --env app1 --yes
72
+ nb init --env app1 --yes --skip-skills
73
+ ```
74
+
75
+ Install with Docker:
76
+
77
+ ```bash
78
+ nb init --env app1 --yes --source docker --version alpha
79
+ ```
80
+
81
+ Install from npm:
82
+
83
+ ```bash
84
+ nb init --env app1 --yes --source npm --version alpha --app-port 13080
85
+ ```
86
+
87
+ Install from Git source:
88
+
89
+ ```bash
90
+ nb init --env app1 --yes --source git --version alpha
91
+ ```
92
+
93
+ For Git source installs, `--version alpha` resolves to the `develop` branch.
94
+
95
+ Install from a Git branch:
96
+
97
+ ```bash
98
+ nb init --env app1 --yes --source git --version fix/cli-v2
99
+ ```
100
+
101
+ `--version` is the shared version input across sources:
102
+
103
+ - npm: package version
104
+ - Docker: image tag
105
+ - Git: git ref such as a branch or tag
106
+
107
+ By default, a new local app uses:
108
+
109
+ - Source directory: `./<envName>/source/`
110
+ - Storage directory: `./<envName>/storage/`
111
+
112
+ ### Resume an Interrupted Setup
113
+
114
+ If `nb init` was interrupted after the env config had already been saved, you can continue the same setup:
115
+
116
+ ```bash
117
+ nb init --env app1 --resume
118
+ nb init --env app1 --resume --skip-skills
119
+ ```
120
+
121
+ `--resume` reuses the saved workspace env config for app, source, database, and env connection settings. In interactive mode, it only asks for any missing setup-only values.
122
+
123
+ In non-interactive resume mode, `nb init --resume --yes` uses default initialization values unless these flags are passed explicitly:
124
+
125
+ - `--lang`
126
+ - `--root-username`
127
+ - `--root-email`
128
+ - `--root-password`
129
+ - `--root-nickname`
130
+
131
+ ## Daily Commands
132
+
133
+ | Command | Description |
134
+ | --- | --- |
135
+ | `nb init` | Set up NocoBase and connect it as a CLI env for coding agents. |
136
+ | `nb app` | Manage app runtimes: start, stop, restart, logs, cleanup, and upgrades. |
137
+ | `nb source` | Manage the local source project: download, develop, build, and test. |
138
+ | `nb db` | Inspect or manage built-in database runtime status for local envs. |
139
+ | `nb env` | Manage saved CLI env connections. |
140
+ | `nb api` | Call NocoBase API resources from the CLI. |
141
+ | `nb plugin` | Manage plugins for the selected NocoBase env. |
142
+ | `nb self` | Check or update the installed NocoBase CLI. |
143
+ | `nb skills` | Check, install, or update global NocoBase AI coding skills. |
144
+
145
+ Recommended style: pass the env name explicitly when operating on a specific env. Runtime commands accept `--env`, and `nb env info` also accepts a positional env name:
146
+
147
+ ```bash
148
+ nb app start --env app1
149
+ nb app restart --env app1
150
+ nb app logs --env app1
151
+ nb env info app1
152
+ nb db ps --env app1
153
+ ```
154
+
155
+ Equivalent shorthand examples:
156
+
157
+ ```bash
158
+ nb app start -e app1
159
+ nb app restart -e app1
160
+ nb app logs -e app1
161
+ nb app upgrade -e app1
162
+ nb db start -e app1
163
+ ```
164
+
165
+ ## CLI And Skills Updates
166
+
167
+ Check whether the installed CLI itself is up to date:
168
+
169
+ ```bash
170
+ nb self check
171
+ nb self check --json
172
+ ```
173
+
174
+ Update the CLI when it is installed globally with npm:
175
+
176
+ ```bash
177
+ nb self update
178
+ ```
179
+
180
+ Check whether the global NocoBase AI coding skills are installed:
181
+
182
+ ```bash
183
+ nb skills check
184
+ nb skills check --json
185
+ ```
186
+
187
+ Install the skills for the first time, or update an existing `nocobase/skills` install:
188
+
189
+ ```bash
190
+ nb skills install
191
+ nb skills update
192
+ ```
193
+
194
+ ## Runtime Types
195
+
196
+ ### Docker
197
+
198
+ Docker envs are managed through saved Docker containers and images:
199
+
200
+ ```bash
201
+ nb init --env app1 --yes --source docker --version alpha
202
+ nb app start --env app1
203
+ nb app restart --env app1
204
+ nb app logs --env app1
205
+ nb app stop --env app1
206
+ ```
207
+
208
+ Docker downloads support platform selection:
209
+
210
+ ```bash
211
+ nb source download --source docker --version alpha --docker-platform auto
212
+ nb source download --source docker --version alpha --docker-platform linux/amd64
213
+ nb source download --source docker --version alpha --docker-platform linux/arm64
214
+ ```
215
+
216
+ ### npm and Git
217
+
218
+ npm and Git envs use a local source directory and can run development mode:
219
+
220
+ ```bash
221
+ nb init --env app1 --yes --source git --version alpha
222
+ nb source dev --env app1
223
+ ```
224
+
225
+ `nb source dev` only supports npm/Git source envs. Docker envs can be inspected with
226
+ `nb app logs`, and remote envs only support API/env operations.
227
+
228
+ ### Existing NocoBase App
229
+
230
+ To connect an existing app, use `nb init` and choose the existing-app setup
231
+ path, or add the env directly:
232
+
233
+ ```bash
234
+ nb env add app1 --api-base-url http://localhost:13000/api
235
+ ```
236
+
237
+ `nb env add` will start the authentication flow automatically when needed.
238
+
239
+ ## Upgrade
240
+
241
+ Upgrade refreshes the saved source or image, then restarts the app:
242
+
243
+ ```bash
244
+ nb app upgrade --env app1
245
+ ```
246
+
247
+ Use `--skip-code-update` or `-s` to restart with the saved local code or Docker
248
+ image without downloading updates first:
249
+
250
+ ```bash
251
+ nb app upgrade --env app1 -s
252
+ ```
253
+
254
+ ## Database Commands
255
+
256
+ Use `nb db` to inspect or manage the built-in database runtime for a local env:
257
+
258
+ ```bash
259
+ nb db ps
260
+ nb db ps --env app1
261
+ nb db start --env app1
262
+ nb db stop --env app1
263
+ nb db logs --env app1
264
+ ```
265
+
266
+ Notes:
267
+
268
+ - `nb db start` and `nb db stop` only work for envs created with the built-in database option enabled.
269
+ - `nb db logs` only works for envs created with the built-in database option enabled.
270
+ - `nb db ps` can also show `external` or `remote` status for envs that do not have a CLI-managed database container.
271
+
272
+ ## Cleanup
273
+
274
+ Bring down a local env:
275
+
276
+ ```bash
277
+ nb app down --env app1
278
+ ```
279
+
280
+ By default, `nb app down` stops the app and removes app/database containers if they
281
+ exist. For local envs, it also deletes the saved local app files. It keeps storage data and CLI env config.
282
+
283
+ Use explicit flags for destructive cleanup:
284
+
285
+ ```bash
286
+ nb app down --env app1 --all --yes
287
+ ```
288
+
289
+ - `--all`: delete everything for the env, including storage data and the saved env config. This requires `--yes`.
290
+
291
+ ## Environment Management
292
+
293
+ Show the current env:
294
+
295
+ ```bash
296
+ nb env
297
+ ```
298
+
299
+ List configured envs with token-verified API status:
300
+
301
+ ```bash
302
+ nb env list
303
+ ```
304
+
305
+ Show details for one env:
306
+
307
+ ```bash
308
+ nb env info app1
309
+ ```
310
+
311
+ Switch the current env:
312
+
313
+ ```bash
314
+ nb env use app1
315
+ ```
316
+
317
+ Re-authenticate an env when credentials need to be refreshed:
318
+
319
+ ```bash
320
+ nb env auth app1
321
+ ```
322
+
323
+ Update runtime command metadata from the selected app:
324
+
325
+ ```bash
326
+ nb env update app1
327
+ ```
328
+
329
+ ## API Commands
330
+
331
+ The CLI can call NocoBase resources through the configured env:
332
+
333
+ ```bash
334
+ nb api resource list --resource users -e app1
335
+ nb api resource get --resource users --filter-by-tk 1 -e app1
336
+ nb api resource create --resource users --values '{"nickname":"Ada"}' -e app1
337
+ ```
338
+
339
+ Create and download a backup:
340
+
341
+ ```bash
342
+ nb api backup create -e app1
343
+ nb api backup status --name backup_20260430_120000_1234.nbdata -e app1
344
+ nb api backup download --name backup_20260430_120000_1234.nbdata --output ./backup.nbdata -e app1
345
+ ```
346
+
347
+ Restore or run a migration package:
348
+
349
+ ```bash
350
+ nb api backup restore-upload --file ./backup.nbdata -e app1
351
+ nb api migration rules create --name default --user-defined-rule schema-only --system-defined-rule overwrite-first -e app1
352
+ nb api migration create --rule-id 1 --title release-20260430 -e app1
353
+ nb api migration execute --file ./migration.nbdata -e app1
354
+ ```
355
+
356
+ Use `-j, --json-output` to print raw JSON when available:
357
+
358
+ ```bash
359
+ nb api resource list --resource users -e app1 -j
360
+ ```
361
+
362
+ Available API command topics:
363
+
364
+ | Command | Description |
365
+ | --- | --- |
366
+ | `nb api acl` | Manage access control based on roles, resources, and actions. |
367
+ | `nb api api-keys` | Manage API keys for HTTP API access. |
368
+ | `nb api app` | Manage application resources. |
369
+ | `nb api authenticators` | Manage user authentication, including password auth, SMS auth, SSO protocols, and extensible providers. |
370
+ | `nb api backup` | Create, download, remove, and restore backups. |
371
+ | `nb api data-modeling` | Manage data sources, collections, and database modeling resources. |
372
+ | `nb api file-manager` | Manage file storage services, file collections, and attachment fields. |
373
+ | `nb api flow-surfaces` | Compose and mutate page, tab, block, field, and action surfaces. |
374
+ | `nb api migration` | Create, check, execute, and inspect migration packages. |
375
+ | `nb api pm` | Manage plugins through API commands. |
376
+ | `nb api resource` | Work with generic collection resources. |
377
+ | `nb api system-settings` | Adjust system title, logo, language, and other global settings. |
378
+ | `nb api theme-editor` | Customize UI colors and dimensions, save themes, and switch between them. |
379
+ | `nb api workflow` | Manage workflow resources for business automation. |
380
+
381
+ ## Local Data
382
+
383
+ The CLI stores workspace-level config in `.nocobase`:
384
+
385
+ - `config.json`: env definitions, current env, and workspace-level settings.
386
+ - `versions/<version>/commands.json`: cached runtime commands generated from the target app.
387
+
388
+ Runtime data such as source files, storage files, Docker containers, and
389
+ database data are managed separately according to the env source and install
390
+ options.