@nocobase/cli 2.1.0-beta.14 → 2.1.0-beta.16
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.
- package/LICENSE.txt +107 -0
- package/README.md +307 -63
- package/README.zh-CN.md +332 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +114 -0
- package/dist/commands/api/resource/create.js +15 -0
- package/dist/commands/api/resource/destroy.js +15 -0
- package/dist/commands/api/resource/get.js +15 -0
- package/dist/commands/api/resource/index.js +20 -0
- package/dist/commands/api/resource/list.js +16 -0
- package/dist/commands/api/resource/query.js +15 -0
- package/dist/commands/api/resource/update.js +15 -0
- package/dist/commands/build.js +57 -0
- package/dist/commands/db/logs.js +85 -0
- package/dist/commands/db/ps.js +60 -0
- package/dist/commands/db/shared.js +81 -0
- package/dist/commands/db/start.js +70 -0
- package/dist/commands/db/stop.js +70 -0
- package/dist/commands/dev.js +149 -0
- package/dist/commands/down.js +193 -0
- package/dist/commands/download.js +743 -0
- package/dist/commands/env/add.js +327 -0
- package/dist/commands/env/auth.js +62 -0
- package/dist/commands/env/list.js +41 -0
- package/dist/commands/env/remove.js +65 -0
- package/dist/commands/env/update.js +73 -0
- package/dist/commands/env/use.js +36 -0
- package/dist/commands/init.js +806 -0
- package/dist/commands/install.js +1840 -0
- package/dist/commands/logs.js +90 -0
- package/dist/commands/pm/disable.js +63 -0
- package/dist/commands/pm/enable.js +63 -0
- package/dist/commands/pm/list.js +54 -0
- package/dist/commands/prompts-stages.js +150 -0
- package/dist/commands/prompts-test.js +181 -0
- package/dist/commands/ps.js +116 -0
- package/dist/commands/scaffold/migration.js +38 -0
- package/dist/commands/scaffold/plugin.js +37 -0
- package/dist/commands/start.js +211 -0
- package/dist/commands/stop.js +90 -0
- package/dist/commands/upgrade.js +583 -0
- package/dist/generated/command-registry.js +133 -0
- package/dist/help/runtime-help.js +20 -0
- package/dist/lib/api-client.js +243 -0
- package/dist/lib/app-runtime.js +142 -0
- package/dist/lib/auth-store.js +241 -0
- package/dist/lib/bootstrap.js +387 -0
- package/dist/lib/build-config.js +10 -0
- package/dist/lib/cli-home.js +30 -0
- package/dist/lib/cli-locale.js +115 -0
- package/dist/lib/command-discovery.js +39 -0
- package/dist/lib/env-auth.js +872 -0
- package/dist/lib/generated-command.js +142 -0
- package/dist/lib/naming.js +70 -0
- package/dist/lib/openapi.js +62 -0
- package/dist/lib/post-processors.js +23 -0
- package/dist/lib/prompt-catalog.js +574 -0
- package/dist/lib/prompt-validators.js +185 -0
- package/dist/lib/prompt-web-ui.js +2061 -0
- package/dist/lib/resource-command.js +335 -0
- package/dist/lib/resource-request.js +104 -0
- package/dist/lib/run-npm.js +123 -0
- package/dist/lib/runtime-generator.js +419 -0
- package/dist/lib/runtime-store.js +56 -0
- package/dist/lib/ui.js +175 -0
- package/dist/locale/en-US.json +282 -0
- package/dist/locale/zh-CN.json +282 -0
- package/dist/post-processors/data-modeling.js +66 -0
- package/dist/post-processors/data-source-manager.js +114 -0
- package/dist/post-processors/index.js +19 -0
- package/nocobase-ctl.config.json +287 -0
- package/package.json +52 -25
- package/LICENSE +0 -201
- package/bin/index.js +0 -39
- package/nocobase.conf.tpl +0 -95
- package/src/cli.js +0 -19
- package/src/commands/benchmark.js +0 -73
- package/src/commands/build.js +0 -49
- package/src/commands/clean.js +0 -30
- package/src/commands/client.js +0 -166
- package/src/commands/create-nginx-conf.js +0 -37
- package/src/commands/create-plugin.js +0 -33
- package/src/commands/dev.js +0 -200
- package/src/commands/doc.js +0 -76
- package/src/commands/e2e.js +0 -265
- package/src/commands/global.js +0 -43
- package/src/commands/index.js +0 -45
- package/src/commands/instance-id.js +0 -47
- package/src/commands/locale/cronstrue.js +0 -122
- package/src/commands/locale/react-js-cron/en-US.json +0 -75
- package/src/commands/locale/react-js-cron/index.js +0 -17
- package/src/commands/locale/react-js-cron/zh-CN.json +0 -33
- package/src/commands/locale/react-js-cron/zh-TW.json +0 -33
- package/src/commands/locale.js +0 -81
- package/src/commands/p-test.js +0 -88
- package/src/commands/perf.js +0 -63
- package/src/commands/pkg.js +0 -321
- package/src/commands/pm2.js +0 -37
- package/src/commands/postinstall.js +0 -88
- package/src/commands/start.js +0 -148
- package/src/commands/tar.js +0 -36
- package/src/commands/test-coverage.js +0 -55
- package/src/commands/test.js +0 -107
- package/src/commands/umi.js +0 -33
- package/src/commands/update-deps.js +0 -72
- package/src/commands/upgrade.js +0 -47
- package/src/commands/view-license-key.js +0 -44
- package/src/index.js +0 -14
- package/src/license.js +0 -76
- package/src/logger.js +0 -75
- package/src/plugin-generator.js +0 -80
- package/src/util.js +0 -517
- package/templates/bundle-status.html +0 -338
- package/templates/create-app-package.json +0 -39
- package/templates/plugin/.npmignore.tpl +0 -2
- package/templates/plugin/README.md.tpl +0 -1
- package/templates/plugin/client.d.ts +0 -2
- package/templates/plugin/client.js +0 -1
- package/templates/plugin/package.json.tpl +0 -11
- package/templates/plugin/server.d.ts +0 -2
- package/templates/plugin/server.js +0 -1
- package/templates/plugin/src/client/client.d.ts +0 -249
- package/templates/plugin/src/client/index.tsx.tpl +0 -1
- package/templates/plugin/src/client/locale.ts +0 -21
- package/templates/plugin/src/client/models/index.ts +0 -12
- package/templates/plugin/src/client/plugin.tsx.tpl +0 -10
- package/templates/plugin/src/index.ts +0 -2
- package/templates/plugin/src/locale/en-US.json +0 -1
- package/templates/plugin/src/locale/zh-CN.json +0 -1
- package/templates/plugin/src/server/collections/.gitkeep +0 -0
- package/templates/plugin/src/server/index.ts.tpl +0 -1
- 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,99 +1,343 @@
|
|
|
1
|
-
# NocoBase
|
|
1
|
+
# NocoBase CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
|
7
|
-
|
|
8
|
-
<a href="https://trendshift.io/repositories/4112" target="_blank"><img src="https://trendshift.io/api/badge/repositories/4112" alt="nocobase%2Fnocobase | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
|
9
|
-
<a href="https://www.producthunt.com/posts/nocobase?embed=true&utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-nocobase" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=456520&theme=light&period=weekly&topic_id=267" alt="NocoBase - Scalability-first, open-source no-code platform | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
|
|
10
|
-
</p>
|
|
8
|
+
The CLI supports two common setup paths:
|
|
11
9
|
|
|
12
|
-
|
|
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.
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
Total control. Infinite extensibility. AI collaboration.
|
|
16
|
-
Enable your team to adapt quickly and cut costs dramatically.
|
|
17
|
-
No years of development. No millions wasted.
|
|
18
|
-
Deploy NocoBase in minutes — and take control of everything.
|
|
13
|
+
## Prerequisites
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
https://demo.nocobase.com/new
|
|
20
|
+
## Installation
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
https://docs.nocobase.com/
|
|
22
|
+
Install the CLI globally:
|
|
28
23
|
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g @nocobase/cli@alpha
|
|
26
|
+
```
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
https://www.nocobase.com/en/blog/tags/customer-stories
|
|
28
|
+
Check the available commands:
|
|
34
29
|
|
|
35
|
-
|
|
30
|
+
```bash
|
|
31
|
+
nb --help
|
|
32
|
+
nb init --help
|
|
33
|
+
```
|
|
36
34
|
|
|
37
|
-
|
|
35
|
+
## Core Concepts
|
|
38
36
|
|
|
39
|
-
|
|
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.
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
## Quick Start
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
### Guided Setup
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
- Multiple blocks and actions can be created for the same table or record in any quantity or form
|
|
47
|
-
- Supports the main database, external databases, and third-party APIs as data sources
|
|
47
|
+
Run the guided terminal flow:
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
```bash
|
|
50
|
+
nb init
|
|
51
|
+
```
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
Unlike standalone AI demos, NocoBase allows you to embed AI capabilities seamlessly into your interfaces, workflows, and data context, making AI truly useful in real business scenarios.
|
|
53
|
+
Use the browser-based setup form:
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
```bash
|
|
56
|
+
nb init --ui
|
|
57
|
+
```
|
|
57
58
|
|
|
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`) for the current workspace.
|
|
59
62
|
|
|
60
|
-
###
|
|
63
|
+
### Non-Interactive Setup
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
When prompts are skipped, an app/env name is required:
|
|
63
66
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
```bash
|
|
68
|
+
nb init --env app1 --yes
|
|
69
|
+
```
|
|
67
70
|
|
|
68
|
-
|
|
71
|
+
Install with Docker:
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
```bash
|
|
74
|
+
nb init --env app1 --yes --source docker --version alpha
|
|
75
|
+
```
|
|
72
76
|
|
|
73
|
-
|
|
74
|
-
- Plugins are ready to use upon installation
|
|
75
|
-
- Pages, blocks, actions, APIs, and data sources can all be extended through custom plugins
|
|
77
|
+
Install from npm:
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
```bash
|
|
80
|
+
nb init --env app1 --yes --source npm --version alpha --app-port 13080
|
|
81
|
+
```
|
|
78
82
|
|
|
79
|
-
|
|
83
|
+
Install from Git source:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
nb init --env app1 --yes --source git --version alpha
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
For Git source installs, `--version alpha` resolves to the `develop` branch.
|
|
90
|
+
|
|
91
|
+
Install from a Git branch:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
nb init --env app1 --yes --source git --version fix/cli-v2
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`--version` is the shared version input across sources:
|
|
98
|
+
|
|
99
|
+
- npm: package version
|
|
100
|
+
- Docker: image tag
|
|
101
|
+
- Git: git ref such as a branch or tag
|
|
102
|
+
|
|
103
|
+
By default, a new local app uses:
|
|
104
|
+
|
|
105
|
+
- Source directory: `./<envName>/source/`
|
|
106
|
+
- Storage directory: `./<envName>/storage/`
|
|
107
|
+
|
|
108
|
+
### Resume an Interrupted Setup
|
|
109
|
+
|
|
110
|
+
If `nb init` was interrupted after the env config had already been saved, you can continue the same setup:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
nb init --env app1 --resume
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The advanced low-level equivalent is:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
nb install --env app1 --resume
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`--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.
|
|
123
|
+
|
|
124
|
+
In non-interactive mode, pass these setup-only flags again because they are not saved in env config:
|
|
125
|
+
|
|
126
|
+
- `--lang`
|
|
127
|
+
- `--root-username`
|
|
128
|
+
- `--root-email`
|
|
129
|
+
- `--root-password`
|
|
130
|
+
- `--root-nickname`
|
|
131
|
+
|
|
132
|
+
## Daily Commands
|
|
133
|
+
|
|
134
|
+
| Command | Description |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| `nb init` | Set up NocoBase and connect it as a CLI env for coding agents. |
|
|
137
|
+
| `nb install` | Advanced command used by `nb init` to install a local NocoBase app and save env config. In most cases, use `nb init` instead. |
|
|
138
|
+
| `nb download` | Advanced command used by `nb init` or `nb upgrade` to fetch NocoBase from Docker, npm, or Git. It is rarely used directly. |
|
|
139
|
+
| `nb start` | Start the selected local app or Docker container. |
|
|
140
|
+
| `nb stop` | Stop the selected local app or Docker container. |
|
|
141
|
+
| `nb dev` | Run development mode for npm/Git source envs. |
|
|
142
|
+
| `nb logs` | Show app logs for npm/Git or Docker envs. |
|
|
143
|
+
| `nb ps` | Show runtime status for configured envs. |
|
|
144
|
+
| `nb db` | Inspect or manage built-in database runtime status for local envs. |
|
|
145
|
+
| `nb upgrade` | Refresh code/image and restart the selected app. |
|
|
146
|
+
| `nb down` | Stop and remove local runtime containers for an env. |
|
|
147
|
+
| `nb env` | Manage saved CLI env connections. |
|
|
148
|
+
| `nb api` | Call NocoBase API resources from the CLI. |
|
|
149
|
+
| `nb pm` | Manage plugins for the selected NocoBase env. |
|
|
150
|
+
|
|
151
|
+
Recommended style: use `--env` explicitly for app/runtime commands. `-e` is the short form:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
nb start --env app1
|
|
155
|
+
nb logs --env app1
|
|
156
|
+
nb ps --env app1
|
|
157
|
+
nb db ps --env app1
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Equivalent shorthand examples:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
nb start -e app1
|
|
164
|
+
nb logs -e app1
|
|
165
|
+
nb upgrade -e app1
|
|
166
|
+
nb db start -e app1
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Runtime Types
|
|
170
|
+
|
|
171
|
+
### Docker
|
|
172
|
+
|
|
173
|
+
Docker envs are managed through saved Docker containers and images:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
nb init --env app1 --yes --source docker --version alpha
|
|
177
|
+
nb start --env app1
|
|
178
|
+
nb logs --env app1
|
|
179
|
+
nb stop --env app1
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Docker downloads support platform selection:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
nb download --source docker --version alpha --docker-platform auto
|
|
186
|
+
nb download --source docker --version alpha --docker-platform linux/amd64
|
|
187
|
+
nb download --source docker --version alpha --docker-platform linux/arm64
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### npm and Git
|
|
191
|
+
|
|
192
|
+
npm and Git envs use a local source directory and can run development mode:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
nb init --env app1 --yes --source git --version alpha
|
|
196
|
+
nb dev --env app1
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
`nb dev` only supports npm/Git source envs. Docker envs can be inspected with
|
|
200
|
+
`nb logs`, and remote envs only support API/env operations.
|
|
201
|
+
|
|
202
|
+
### Existing NocoBase App
|
|
203
|
+
|
|
204
|
+
To connect an existing app, use `nb init` and choose the existing-app setup
|
|
205
|
+
path, or add the env directly:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
nb env add app1 --base-url http://localhost:13000/api
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
`nb env add` will start the authentication flow automatically when needed.
|
|
212
|
+
|
|
213
|
+
## Upgrade
|
|
214
|
+
|
|
215
|
+
Upgrade refreshes the saved source or image, then restarts the app:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
nb upgrade --env app1
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Use `--skip-code-update` or `-s` to restart with the saved local code or Docker
|
|
222
|
+
image without downloading updates first:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
nb upgrade --env app1 -s
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Database Commands
|
|
229
|
+
|
|
230
|
+
Use `nb db` to inspect or manage the built-in database runtime for a local env:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
nb db ps
|
|
234
|
+
nb db ps --env app1
|
|
235
|
+
nb db start --env app1
|
|
236
|
+
nb db stop --env app1
|
|
237
|
+
nb db logs --env app1
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Notes:
|
|
241
|
+
|
|
242
|
+
- `nb db start` and `nb db stop` only work for envs created with the built-in database option enabled.
|
|
243
|
+
- `nb db logs` only works for envs created with the built-in database option enabled.
|
|
244
|
+
- `nb db ps` can also show `external` or `remote` status for envs that do not have a CLI-managed database container.
|
|
245
|
+
|
|
246
|
+
## Cleanup
|
|
247
|
+
|
|
248
|
+
Bring down a local env:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
nb down --env app1
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
By default, `nb down` stops the app and removes app/database containers if they
|
|
255
|
+
exist. It keeps user data, source files, and CLI env config.
|
|
256
|
+
|
|
257
|
+
Use explicit flags for destructive cleanup:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
nb down --env app1 --remove-data
|
|
261
|
+
nb down --env app1 --remove-source
|
|
262
|
+
nb down --env app1 --remove-env
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
- `--remove-data`: delete storage and managed database data. This requires confirmation unless `--yes` is used.
|
|
266
|
+
- `--remove-source`: delete the npm/Git source directory.
|
|
267
|
+
- `--remove-env`: remove the saved CLI env config.
|
|
268
|
+
|
|
269
|
+
## Environment Management
|
|
270
|
+
|
|
271
|
+
Show the current env:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
nb env
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
List configured envs:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
nb env list
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Switch the current env:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
nb env use app1
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Re-authenticate an env when credentials need to be refreshed:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
nb env auth app1
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Update runtime command metadata from the selected app:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
nb env update app1
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## API Commands
|
|
302
|
+
|
|
303
|
+
The CLI can call NocoBase resources through the configured env:
|
|
80
304
|
|
|
81
|
-
|
|
305
|
+
```bash
|
|
306
|
+
nb api resource list --resource users -e app1
|
|
307
|
+
nb api resource get --resource users --filter-by-tk 1 -e app1
|
|
308
|
+
nb api resource create --resource users --values '{"nickname":"Ada"}' -e app1
|
|
309
|
+
```
|
|
82
310
|
|
|
83
|
-
-
|
|
311
|
+
Use `-j, --json-output` to print raw JSON when available:
|
|
84
312
|
|
|
85
|
-
|
|
313
|
+
```bash
|
|
314
|
+
nb api resource list --resource users -e app1 -j
|
|
315
|
+
```
|
|
86
316
|
|
|
87
|
-
|
|
317
|
+
Available API command topics:
|
|
88
318
|
|
|
89
|
-
|
|
319
|
+
| Command | Description |
|
|
320
|
+
| --- | --- |
|
|
321
|
+
| `nb api acl` | Manage access control based on roles, resources, and actions. |
|
|
322
|
+
| `nb api api-keys` | Manage API keys for HTTP API access. |
|
|
323
|
+
| `nb api app` | Manage application resources. |
|
|
324
|
+
| `nb api authenticators` | Manage user authentication, including password auth, SMS auth, SSO protocols, and extensible providers. |
|
|
325
|
+
| `nb api data-modeling` | Manage data sources, collections, and database modeling resources. |
|
|
326
|
+
| `nb api file-manager` | Manage file storage services, file collections, and attachment fields. |
|
|
327
|
+
| `nb api flow-surfaces` | Compose and mutate page, tab, block, field, and action surfaces. |
|
|
328
|
+
| `nb api pm` | Manage plugins through API commands. |
|
|
329
|
+
| `nb api resource` | Work with generic collection resources. |
|
|
330
|
+
| `nb api system-settings` | Adjust system title, logo, language, and other global settings. |
|
|
331
|
+
| `nb api theme-editor` | Customize UI colors and dimensions, save themes, and switch between them. |
|
|
332
|
+
| `nb api workflow` | Manage workflow resources for business automation. |
|
|
90
333
|
|
|
91
|
-
|
|
334
|
+
## Local Data
|
|
92
335
|
|
|
93
|
-
|
|
336
|
+
The CLI stores workspace-level config in `.nocobase`:
|
|
94
337
|
|
|
95
|
-
|
|
338
|
+
- `config.json`: env definitions, current env, and workspace-level settings.
|
|
339
|
+
- `versions/<version>/commands.json`: cached runtime commands generated from the target app.
|
|
96
340
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
341
|
+
Runtime data such as source files, storage files, Docker containers, and
|
|
342
|
+
database data are managed separately according to the env source and install
|
|
343
|
+
options.
|